text:
Q: O python não possui biblioteca mysql.connector no Xubuntu Já tentei várias coisas para instalar essa bendita biblioteca, meu projeto é para terça que vem(02/11/2002) e infelizmente não consegui instalar no Xubuntu...
sudo pip3 mysql.connector

Preciso dessa biblioteca , senão meu código inteiro trava.
Obrigado, abraços.

A: Bartô,
Acabo de fazer a instalação sem problemas no Linux, acho que você se confundiu, veja:
Ao fazer o import dessa biblioteca em um fonte python, você faz da seguinte forma:
import mysql.connector

Porém ao fazer a instalação pelo pip, essa biblioteca tem outro nome, trata-se da mysql-connector-python, tente instalar da seguinte forma:
pip3 install mysql-connector-python

Obs.: Não precisei utilizar de sudo

Referência:
  https://stackoverflow.com/questions/372885/how-do-i-connect-to-a-mysql-database-in-python


text:
Q: how get the position of vertex from window form in c#? I have been started with wireless sensor network simulator, and I want to simulate my own topology , which need to make the rings that connect the vertices with each other ( boundary hull).
I am seeking to get the position of every vertex which are  represented on the window form ( graphical) and which are a neighbor of other vertices and connect them with each other , but I want to make the connection between the nearest vertices , (the vertices that have smallest radiuses between each other)wireless sensor network simulator ( node (vertex) deployment).
my question is that , how can I get the position of every vertices?
the code 4bellow is the way that I tried to calculate the reduise
int r1  = (int)Math.Sqrt(Math.Pow(firstNode.x - ((WirelessSensor)firstNode.SensorNeighbors[count]).x, 2) + Math.Pow(firstNode.y - ((WirelessSensor)firstNode.SensorNeighbors[count ]).y, 2));
int r2  = (int)Math.Sqrt(Math.Pow(firstNode.x - ((WirelessSensor)firstNode.SensorNeighbors[count+1]).x, 2) + Math.Pow(firstNode.y - ((WirelessSensor)firstNode.SensorNeighbors[count+1]).y, 2));

redpajama_set_name: RedPajamaStackExchange


text:
Q: Angular access component route I want to access a component's routing URL that is not the current url and store it in a service. So basically if my component is parentComponent and has childComponent then the URL of the child component is
/parentComponent/childComponent

If I navigate to the above URL and call this.router.url in parentComponent's ngOnInit then it correctly returns /parentComponent/childComponent. How do I get just /parentComponent, i.e. the route to the component itself, from the router within the parent component?

A: this.router.parent.url will return parent url and it's params.


text:
Q: Is possível two heterogenous databases as a only one transactional My scenario has two different versions of the same system with different database structures, where 1.0 is in production and 2.0 in dev.
Version 2.0 needs to go into production using the data and structure of version 1.0 for a specified time. Our team would like not to change the data structure of 2.0, the question is whether through a VDB it would be possible for 2.0 to manipulate the base 1.0 by performing queries and transactions.
Our knowledge of teiid is still quite initial, so we would like advice if teiid would be a possibility for our need, if it would be a way forward.

A: Yes you can use a vdb to provide a stable interface to a single or set of sources.  As long as the sources support XA, you can perform transactionally safe reads/writes across them.


text:
Q: WebGL Shared Resources Web Workers I am just a beginner to WebGL - sorry, if this question is naive. I searched online, but could not find the latest support from a WebGL expert.
I would like to do share resources for WebGL using web workers - mainly texture upload and texture readback. What is the status of the support to do this? What workaround(s) do I have?

A: You can't share resources inside a Web Worker yet. You can pass TypedArrays into and out of WebWorkers though so it really depends on what you want to do. If you're decoding textures in JavaScript you can do the decoding in a worker, then pass a TypedArray with the data back to the main thread. This can happen with zero copying. But the call to gl.texImage2d has to happen on the main thread currently.
As for reading back textures in a worker you're out of luck for now.

A: Not yet, see:
Using WebGL from inside a Web Worker: is it possible ? How?
https://www.khronos.org/webgl/public-mailing-list/archives/1306/msg00050.html


text:
Q: wcf http post method get null request by android i have a method as post
    [OperationContract]
    [WebInvoke(Method = "POST", UriTemplate = "UpdateCheckListParagraphs", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
    Boolean  UpdateCheckListParagraphs( Stream   Result);//

i get the request by c# but by android i get "Type="System.ServiceModel.Channels.NullMessage" "
the web.config
<system.serviceModel>
<bindings>
  <webHttpBinding>
    <binding name="default" />
  </webHttpBinding>
</bindings>
<services>
  <service name="spcWcfService.Testit" behaviorConfiguration="TestitBehaviors">
    <endpoint binding="webHttpBinding" indingNamespace="http://mnet.co.il/spcWcfService.svc" contract="spcWcfService.ITestit" behaviorConfiguration="GetEndpointBehavior">
    </endpoint>
    <endpoint name="mexHttpBinding" address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
 </service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="GetEndpointBehavior">
      <webHttp helpEnabled="true" automaticFormatSelectionEnabled="true" />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="TestitBehaviors">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

the android call
public String postGetJson2(String dataToSend, String serviceUri) {
    // Log.d("dataToSend", dataToSend);

    StringEntity entity = null;
    HttpPost httpPost = new HttpPost(serviceUri);
    httpPost.setHeader("Accept", "application/json");
    httpPost.setHeader("Content-type", "application/json");
    httpPost.setHeader("Accept-Charset", "UTF-8");
    String result = null;
    try {
        if (dataToSend != null) {
            entity = new StringEntity(dataToSend, "UTF-8");
            httpPost.setEntity(entity);
        }

        DefaultHttpClient httpClient = new DefaultHttpClient();
        HttpResponse response = null;
        try {
            response = httpClient.execute(httpPost);
            result = EntityUtils.toString(response.getEntity());

        } finally {
        }
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
    }

    return result;

can anyone help me? please...


text:
Q: Hide Empty columns I got a table with 75 columns,. what is the sql statement to display only the columns with values in in ?
thanks

A: It's true that a similar statement doesn't exist (in a SELECT you can use condition filters only for the rows, not for the columns). But you could try to write a (bit tricky) procedure. It must check which are the columns that contains at least one not NULL/empty value, using queries. When you get this list of columns just join them in a string with a comma between each one and compose a query that you can run, returning what you wanted.
EDIT: I thought about it and I think you can do it with a procedure but under one of these conditions:

*

*find a way to retrieve column names dynamically in the procedure, that is the metadata (I never heard about it, but I'm new with procedures)

*or hardcode all column names (loosing generality)
You could collect column names inside an array, if stored procedures of your DBMS support arrays (or write the procedure in a programming language like C), and loop on them, making a SELECT each time, checking if it's an empty* column or not. If it contains at least one value concatenate it in a string where column names are comma-separated. Finally you can make your query with only not-empty columns!
Alternatively to stored procedure you could write a short program (eg in Java) where you can deal with a better flexibility.
*if you check for NULL values it will be simple, but if you check for empty values you will need to manage with each column data type... another array with data types?

A: I would suggest that you write a SELECT statement and define which COLUMNS you wish to display and then save that QUERY as a VIEW.
This will save you the trouble of typing in the column names every time you wish to run that query.
As marc_s pointed out in the comments, there is no select statement to hide columns of data.

A: You could do a pre-parse and dynamically create a statement to do this, but this would be a very inefficient thing to do from a SQL performance perspective. Would strongly advice against what you are trying to do.

A: A simplified version of this is to just select the relevant columns, which was what I needed personally. A quick search of what we're dealing with in a table
SELECT * FROM table1 LIMIT 10;

-> shows 20 columns where im interested in 3 of them. Limit is just to not overflow the console.
SELECT column1,column3,colum19 FROM table1 WHERE column3='valueX';

It is a bit of a manual filter but it works for what I need.


text:
Q: Trying to use Imagemagick to convert an RGB image into a list of hex codes, each for every pixel As the title states, I'm attempting to make a script which reads an image, doesn't matter the resolution, and converts the image into a list of hex codes. For example, an 8x8 PNG Image with alternating white and black pixels would be converted into this:
FFFFFF
000000
FFFFFF
000000
FFFFFF
000000

And so on. I've tried the following so far:
convert $name.png -compress none pnm:-

However, the above code returned just regular numbers instead of hex values. Here's an example:
205 0 0 205 0 0 205 0 0 205 0 0 205 0 0 205 0 0 224 160 0 224 160 0 224 160 0

What went wrong here, and what changes would I make to it to make it output hex codes?

A: This works for me:
convert yourimage.png txt:- | tail -n +2 | sed -n 's/^.*#\([0-9A-Fa-f]*\).*$/\1/p'

See http://www.imagemagick.org/Usage/files/#txt

A: You could use ImageMagick to decode the file to raw RGB values and xxd to group them and display in hex:
convert yourImage.png rgb:- | xxd -g3

I use -g3 to group into threes for RGB files, and if there is an alpha/transparency layer:
convert yourImage.png rgba:- | xxd -g4

Other switches you might like to use with xxd would be:
xxd -g3 -c15    # 15 bytes per line, good if you have 5 pixels of 3 bytes each, so hex lines match image scanlines

xxd -ps         # continuous output without offsets at start of lines


text: Q: How to stop webpack-dev-server from comand line Ctrl+C is not option because i need to stop running instance on remote Linux server. I tried with kill -9 but i did not know the PID so if any of you have any advice i will appreciate it.


text:
Q: Can't install mscviplib package on ubuntu I can't install mscviplib package on ubuntu, I am using the following command to install it:
pip install mscviplib

and I got error saying :
ERROR: Could not find a version that satisfies the requirement mscviplib (from versions: none)
ERROR: No matching distribution found for mscviplib

A: According to [PyPI]: mscviplib 2.211201.122 - Download files, the only existing binary is for Python 3.7 064bit (and no source package), which implies that the only Python supported version is v3.7 (although the same page states):

Requires: Python >=3.7

So, in order to be able to pip install that module, you should use Python 3.7.
But maybe there are other ways to go. Check [MS.Docs]: Custom Vision documentation (which instructs working via a web browser) for more details.


text:
Q: How does this complex function map πi/2 to => 0 So I'm working on a question that asks
Find a conformal map that maps the horizontal strip $Im(z) ∈ (0,π)$ onto the unit disk $|z| < 1$
and maps $πi/2$ to 0
.
It says the solutions involve:
$f_1(z)=z-\frac{\pi}{2}$
I'm confused as to why this would even be included arrived as the first one doesn't work for mapping π/2 to 0:
$f_1(\frac{\pi i}{2})=\frac{\pi}{2}(i-1)≠0$
Shouldn't the proper mapping be
$f_1(z)=z-\frac{\pi i}{2}$

A: A solution involves $f_1(z) = z - \frac{\pi}{2}$, meaning that you probably have to find additional conformal maps $f_2,f_3,...$ in order to solve the exercise. So it is no surprise that $f_1(\frac{\pi}{2})\neq0$. Even if you were to define $f_1(z) = z-\frac{\pi i}{2}$, $f_1$ still wouldn't be a conformal map $A := \{z \in \mathbb{C} \mid \text{Im}(z) \in (0,\pi)\} \to \mathbb{D}$, so that doesn't really help.
However, I can give you a hint on how to solve the exercise differently (in my opinion the easiest way): Try to find conformal maps $f_1 : A \to \mathbb{H}$ and $f_2 : \mathbb{H} \to \mathbb{D}$. Here, $\mathbb{H}$ denotes the upper half plane. Then, you can define $f : A \to \mathbb{D}$ as $f := f_2 \circ f_1$ and you'll see that indeed $f(\frac{\pi i}{2})=0$, as needed.
$f_1$ is a map that I'm sure you've used many times before, and if you're having trouble coming up with $f_2$ you can look up "Cayley transform/map". If you need additional hints, feel free to let me know.
I hope this was helpful!


text:
Q: Selected ListView item column value I have created a listview,

and id like to be able to change the selected item values. I wonder if is possible to somehow access the "ID" string of the selected item.
I created an event to detect when the user selects an item and tried colID.Index.ToString but it just returns the actual column index. Anyone able to provide a syntax that will return the selected item ID?
Private Sub lvwCars_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lvwCars.SelectedIndexChanged
currentCarIDString = colID.Index.ToString
end sub

A: It's either going to be the item text or subitem text.
currentCarIDString = lvwCars.Items(colID.Index).Text

or
currentCarIDString = lvwCars.Items(colID.Index).SubItems(1).Text

A: I found something that works for my specific case
ListView.FocusedItem.Index

since my ID is always going by up by one, this solution works perfect. However if anyone can offer a solution that can retrieve the actual value of a row of a column, that would be great.


text:
Q: Are Exercises the Surest Path to Enlightenment? I've been told that the goal of the undergraduate mathematics curriculum is really to learn how to learn mathematics. While I have mixed feelings about how efficiently this goal is accomplished, I do feel that my professors have done an excellent job of making me take responsibility for my own learning. When I felt like I was stuck on some exercise or problem, my best professors did not bail me out with an easy explanation but rather they pointed me in the general direction and sent me back on my way. In the moment I found such an approach to be frustrating (sometimes even enraging) but looking back, I am a much better mathematician for it. I think that my heavy focus on solving exercises and proving every theorem when I'm reading has improved my problem solving abilities significantly. On the other hand, I have a nagging fear that I might be missing part of the puzzle by focusing so much on the exercises.
All of that being said, my goal is to have the deepest understanding of mathematics that I could possibly have and ultimately to do my own research down the road. I feel as though I can usually figure out the vast majority of the exercises I work on pretty quickly (i.e. within 30 mins or so) but I'm fearful that this won't translate to an ability to solve ill-posed problems that don't have clean textbook solutions.
The essence of my question is basically: "Did the 'masters' of modern mathematics (early 1900's to today) primarily emphasize exercises in their education or did they achieve their mastery through some other means?" Obviously I know the real answer is that they were incredibly intelligent and spent enough time with the material to achieve a deep understanding but on the other hand, plenty of people spend a good deal of time with mathematics but never truly "get it".
Disclaimer:
While I'm sure this question might be vague on the surface, I do think that there is a reasonably precise answer here. In the past 100 years, I'd imagine the herd has been sufficiently culled with respect to the best (or better yet, the most efficient) approach to learning mathematics that would make this a fairly reasonable question to ask on here.

A:
I have a nagging fear that I might be missing part of the puzzle by focusing so much on the exercises

An argument can be made that "good" textbooks are designed in a way that exercises and theory go hand-in-hand. The only difference is that text is supposed to be the passive form, i.e. "This is x", and exercises are meant to flex your brain, "Is this x?". Exercises are often a part of a book/course, in a way that if you skip them then you haven't really completed the book/course.
Now let's try to understand the role of exercises a little better so that we could talk intelligently about substitutes for exercises.
Since this question is about learning, consider the levels in Bloom's Taxonomy

I feel that exercises are a versatile tool in mathematics because they can be made to target the levels of evaluation, analysis, application, and understanding (the most basic of problems)
After you do exercises, you'll find that the role they play is that they concretize the levels below it in your head.
As an example – in order to do an understanding problem, you'll have to refer to the theorems, properties and propositions which falls in the remembering domain. And similarly, in order to apply math in a new situation, you'll first have to understand the mathematics that's going on behind the scenes. And so on, each level depends on mastery of the level below it.
You'll find that if you keep on reading new things without having a concrete mastery of the topics it depends upon, you'll get lost.

"Did the 'masters' of modern mathematics (early 1900's to today) primarily emphasize exercises in their education or did they achieve their mastery through some other means?

I don't have any historical information, but now that we've discerned the role of exercises, maybe if someone is able to concretize their knowledge in some other way, then they could get away with not doing exercises because it won't really be of any use to them.
Mathematics gradually builds up on the topics previously studied. Exercises help you concretize the topics you're studying so you could depend on your understanding of the topic when you set out to study the next one. It isn't exercises which are important, but this effect - which may be fulfilled by some other ways as well.

A: My answer is YES. I shall start with some generalisation.
In every field, you are Master if you are capable of doing things on the ground level (in real world). There is nothing which you can't understand, but there are a lot of things which you can't learn. Because you understand something when you study it, observe it, but you learn something when you apply the knowledge you have about that thing in reality.
We study so that we can apply the knowledge which we are gaining . Application is everything and knowledge can be applied only when you now When to apply/ Where to apply and How to apply. How can someone get the answers of  when to apply/where to apply and how to apply?? It is easy, just apply. If you want to know how mango tastes, you will have to eat it.
In mathematics, problems are the objects on which you can apply your knowledge. So, doing problem/exercises is finding application, and finding application is ultimately learning.


text:
Q: Getting jquery to work with dynamic content I am currently using a very similar AJAX post request across many parts of my page:
$(document).ready(function() {
    $("#name").change(function(e){
        var vname = $("#name").val();
        $.post("addit.php", {name:vname}, function(response, status) {
            $("#table").html(response);
        });
    });
});

The above code works perfectly.
I am having a problem getting any functionality with dynamically loaded content. So for example a form grabbed by an AJAX call and put into my page this above does not work.
If we can pretend that I was running the same AJAX call as above but on dynamically loaded content from a PHP script using AJAX. what would my call look like. #table is a static element that is always present on the page.
I have tried this but it is not working:
$(document).ready(function() {
    $("#table").on("click", "#btn1", function(e){
        e.preventDefault();
        var vname = $("#name").val();
        $.post("addit.php", {name:vname}, function(response, status) {
            $("#table").html(response);
        });
    });
});

Currently I am getting nothing show up on console and it just does not work.
Is what I am doing here correct?
The html would look like this: echoed from php:
<table id='table'>//this is the static element form is echoed
<form method='post'>
<input id='name' name = 'name'>
<button id='btn1' type='submit'>Add me</button>
</form>

</table>

I have changed my code slightly click on button rather than on change.

A: Try updating the code with following
$(document).ready(function() {
    $("#table #btn1").on("click", function(e){
        e.preventDefault();
        var vname = $("#name").val();
        $.post("addit.php", {name:vname}, function(response, status) {
            $("#table").html(response);
        });
    });
});

It is not possible to set a function on a dynamically added element, when the element is not there in document
And instead of <table> use <div> if possible

A: I think your problem is that you miss
$( document ).ajaxComplete(function() { "script here will run and be available after ajax load" });


text:
Q: 'For Loop' to populate array I have never been good at developing arrays. I am trying to loop through a large set of data in a spreadsheet, store it in an array, and use it to basically perform a VLOOKUP function through an If statement. When I run the program I get:

Run time error 9 - subscript out of range (noted where the error is below)

EDIT: when I comment out Redim statement I get an error on j "Type Mismatch"...The data only holds integers....
 Dim LoArray()
 Dim TargetWorkbook As Workbook
 Dim SourceWorkbook As Workbook
 Dim i As Long
 Dim j As Long
 Dim k As Long

 Assign the Workbook File Name along with its Path
 TargetPath = "C:\filepath.....xlsx"
 Set TargetWorkbook = Workbooks.Open(TargetPath)
 Set SourceWorkbook = ThisWorkbook

 'Sets Counter in For Loop
 k = TargetWorkbook.Sheets("LRG Pivots").Cells(Rows.Count, "A").End(xlUp).row

 'error happens here
 ReDim LoArray(1 To i, 0 To 1)
 'Count Rows in LoadWTable
     For row = 6 To k
         i = i + 1
         j = Cells(row, 2) 'throws mismatch error
         LoArray(i, j) = Cells(i, j)
          Next row

 'Store Rows in Array
 ReDim Preserve LoArray(1 To i, 0 To 1)

 End Sub


text:
Q: How to translate a part of string in Aurelia? I am a beginner on Aurelia. I have the following code and I want to localize(translate) "Jahre" word to english/german language when we select one of them.
<option repeat.for="interval of intervals">${interval}&nbsp Jahre</option>

How can I localize this part of sentence?
If I want to localize a word or the whole sentence, I don't have any problem. I have just problem, when I want to localize a part of a sentence.
Could you please help me?

A: The right way would be localising the whole sentence with parameters. Like this:
// Translation file
{
  "years": "{{count}} Jahre"
}

// Translation file
{
  "years": "{{count}} years"
}

Then, you can use pass the parameters via t-params:

 //myVariable = { count: 5 }

Or

${ 'years' | t: { count: 5 } }

More information at: http://aurelia.io/hub.html#/doc/article/aurelia/i18n/latest/i18n-with-aurelia/5

A: Finally I solved it:
// json file
"tests": {
 "title": "Tests",
 "reminders": {
   "years_singular": "{{count}} Year",
   "years_plural": "{{count}} Years"
}
// html file
<select class="select-interval" value.bind="capacityTestInterval">
      <option repeat.for="interval of intervals"
              model.bind="interval"
              t="tests.reminders.years"
              t-params.bind="{count: interval, context: interval === 1 ? 'singular' : 'plural' }">
      </option>
</select>

Thank Fabio for your help


text:
Q: Why is this panel not working? Have a look at this code here, as you will see I'm just doing a bit of practice with jQuery and trying to build a tab panel.
I got stuck on trying to get the sections to move out of the way once i clicked on a new section.
I have no idea why this is not working for me like this.

  <meta charset="utf-8">
  <title>JS Bin</title>

    Section 1
    Section 2
    Section 3
    Section 4

      Section 1

      Section 1

      Section 1

      Section 1

      Section 2

      Section 2

      Section 2

      Section 2

      Section 3

      Section 3

      Section 3

      Section 3

      Section 4

      Section 4

      Section 4

      Section 4

sass
body
  text-align: center
  padding-top: 50px

a
  color: white
  text-decoration: none
  padding: 10px
  background-color: grey
  margin: 0px -1px
  border-radius: 10px 10px 0px 0px
  transition: all 0.3s ease-in-out
  &:hover
    background-color: lightgrey

.active_button
  background-color: lightgrey

.sections
  position: relative

.section
  display: none
  padding: 20px
  background-color: lightgrey
  position: absolute
  width: 286px
  top: 10px
  left: 50%
  margin-left: -163px
  border-radius: 0 0 10px 10px

.active_section
  display: block

jquery
$(function() {

  // capture click of section button
  $("a").click(function(e) {

    // prevent default link behaviour
    e.preventDefault();

     // hide the current active section
    $(".section .active_section").slideUp(500, function(){
      // then take away their active class
      $(this).removeClass("active_section");
    });

  }); // click function closes here

  // find out what section button is pressed
  var sectionId = $("a").attr("data-sectionId");

  // slide down that section
  $("#"+sectionId).slideDown(500, function(){
    // add the active class
    $(this).addClass("active_section");
  });

});

A: Move all your code to the click function, and it's work ;)
https://jsfiddle.net/pgytuq6j/
// capture click of section button
$("a").click(function(e) {

    // prevent default link behaviour
    e.preventDefault();

    // find out what section button is pressed
    var sectionId = $(this).attr("data-sectionId");

    // hide the current active section
    $(".active_section").slideUp(500, function(){
        // then take away their active class
        $(this).removeClass("active_section");
    });

    // slide down that section
    $("#"+sectionId).slideDown(500, function(){
        // add the active class
        $(this).addClass("active_section");
    });

}); // click function closes here

This is what you want ?

A: please check this
[https://jsfiddle.net/k2v06bnv/][1]

small problems in the code , you have to be more careful about small things

A: When you write $('.section .activeSection') - this means that select an element with class activeSection which is a child of an element with class section. Also the whole code should be inside the click event:
$("a").click(function (e) {

    // prevent default link behaviour
    e.preventDefault();
    var currentAnchor = $(this);
    // hide the current active section
    $(".active_section").slideUp(500, function () {
        // then take away their active class
        $(this).removeClass("active_section");
        $('.active_button').removeClass('active_button');
        $(currentAnchor).addClass('active_button');
    });

    // find out what section button is pressed
    var sectionId = $(this).attr("data-sectionId");

    console.log(sectionId);
    // slide down that section
    $("#" + sectionId).slideDown(500, function () {
        // add the active class
        $(this).addClass("active_section");

    });
});

jsFiddle

A: DEMO
Check the inline comments for JS
Updated JS
$(function() {
    $("a").click(function(e) {
        e.preventDefault();
        $(".section.active_section").slideUp(500, function(){
            $(this).removeClass("active_section");
        });
        //You need to identify clicked element inside click event itself
        //get the sectionId of clicked element using $(this)
        var sectionId = $(this).attr("data-sectionId");
        $("#"+sectionId).slideDown(500, function(){
            $(this).addClass("active_section");
        });
    });
});

A: DEMO
The below function will give you smooth transition while sliding up and down
$(function() {
  // capture click of section button
  $("a").click(function(e) {

    // prevent default link behaviour
    e.preventDefault();

     // hide the current active section
    $(".active_section").slideUp(500, function(){
      // then take away their active class
      $(this).removeClass("active_section");
        // find out what section button is pressed
    });

    var sectionId = $(this).attr("data-sectionId");

    setTimeout(function() {
        // slide down that section
        $("#"+sectionId).slideDown(500, function(){
            // add the active class
            $(this).addClass("active_section");
        });
      }, 500);
  }); // click function closes here
});


text:
Q: Const-ness issues: how to traverse a linked list of Objects in D? If I have a class like:
class Node
{
    string id;
    const Node next;
}

How do I find, say, the id of the last Node in the linked list?
string lastID(const Node node)
{
    ???
}

A: I assume that your problem is that you need to loop but can't reset your variable, because it's const? If you want to have an object which refers to a const object but is re-assignable itself (i.e. it's tail-const), then use std.typecons.Rebindable. In this case, that gives you:
string lastID(const Node node)
{
    import std.typecons;
    Rebindable!(const Node) curr = node;

    while(curr.next)
        curr = curr.next;

    return curr.id;
}

I must say that I find it a bit odd though that you don't just ask about how to have a reference to a const object where the reference isn't const itself, since that's all I can see that you're really asking here, given how straightforward the loop itself is. As it stands, your question is a bit too much along the lines of asking someone to write your code for you rather than asking a question.

A: You can also go fancy and use recursion:
string lastID(const Node node)
{
    if(node.next)
        return lastID(node.next);
    return node.id;
}

Do take in mind that it might cause a stack overflow if the list is very long(as far as I know D does not support tail call recursion optimization)


text:
Q: search for neighbors of a value in a dataframe I look for the bottom and top closest to a value
in this dataframe
             0            1
 1.    0.738235    0.000000
 2.    1.210000     0.000000
 3.    1.713830     0.031915
 15.   7.705405   536.778378
 16.   8.187640   649.865169
 17.   8.710476   790.257143
 18.   9.165625   921.343750
 19.   9.678723  1053.531915
 20.  10.188000  1190.200000
 21.  10.700000  1325.523810
 22.  11.220000  1480.300000
 23.  11.642857  1591.285714
 24.  12.300000  1748.142857
 25.  12.660000  1903.200000
 26.  13.150000  1988.666667
 27.  13.700000  2023.000000
 29.  14.633333  2034.000000
 31.  15.900000  2053.000000
 32.  14.210000  1111.000000

If I look for the value of 15.9, then I want to have the nearest lower 14.633333 and the nearest higher than 15.90000
If I look for the value of 12.3, then I want to have the nearest lower 11.64 and the nearest higher 12.66
I tried   :
df.iloc[(df[0]-value).abs().argsort()[:2]]

but the result was
 28  14.233333  2039.0
 31  14.210000  1111.0

A: It might be possible with only one query, but I am not sure how to do that, so instead you can run 2 separate queries to get the upper and lower values:
For the upper value:
df.loc[df.loc[(df['0']-value)>0]['0'].idxmin()]

For the lower one:
df.loc[df.loc[(df['0']-value)<0]['0'].idxmax()]

A: it worked but I had to create the exception because if there are equal numbers but no neighbors
try:
    print(dados_import.loc[dados_import.loc[(dados_import[0]-valor)>0][0].idxmin()])
except:
    print(dados_import.loc[dados_import.loc[(dados_import[0]-valor)>=0][0].idxmin()])
try:
    print(dados_import.loc[dados_import.loc[(dados_import[0]-valor)<0][0].idxmax()])
except:
print(dados_import.loc[dados_import.loc[(dados_import[0]-valor)<=0][0].idxmax()])

A: This will select all the appropriate rows even if the numbers are not unique or the value is below the minimum or above the maximum
def boundingRows(col, value):
    dif = col - value
    lw0 = dif < 0
    gr0 = dif > 0
    il = dif == dif[dif[lw0].idxmax()] if lw0.any() else dif == 0
    iu = dif == dif[dif[gr0].idxmin()] if gr0.any() else dif == 0
    return il | iu
df[boundingRows(df[0], 12.3)]


text:
Q: Git clone from remote server failing in bitbucket pipelines I'm trying to automatically deploy my app to digital ocean through bitbucket pipelines. Here are the steps my deployment is following:

*

*connect to the remote digital ocean droplet using ssh

*clone my repository by running a git clone with ssh

*launch my application with docker-compose

I have successfully setup ssh access to my remote. I have also configured ssh access to my repository and can successfully execute git clone from my remote server.
However, in the pipeline, while connection to the remote server is successfull, the git clone command fails with the following error.

git@bitbucket.org: Permission denied (publickey).
  fatal: Could not read from remote repository.

Anybody has an idea of what is going on here?
Here is my bitbucket-pipelines.yml
image: atlassian/default-image:latest
pipelines:
  default:
    - step:
      deployment: production
      script:
        - cat deploy.sh | ssh $USER_NAME@$HOST
        - echo "Deploy step finished"

And the deployment script deploy.sh
#!/usr/bin/env sh
git clone git@bitbucket.org:<username>/<my_repo>.git
cd my_repo
docker-compose up -d

Logs for the git clone ssh commands within the droplet and from the pipeline

A: Git uses the default ssh key by default.
You can overwrite the SSH command used by git, by setting the GIT_SSH_COMMAND environment variable. You can add the -i argument to use a different SSH key.
export GIT_SSH_COMMAND="ssh -i ~/.ssh/<key>"
git clone git@bitbucket.org:<username>/<my_repo>.git

From the git documentation:

GIT_SSH
GIT_SSH_COMMAND
If either of these environment variables is set then git fetch and git push will use the specified command instead of ssh when they need to connect to a remote system. The command-line parameters passed to the configured command are determined by the ssh variant. See ssh.variant option in git-config[1] for details.
$GIT_SSH_COMMAND takes precedence over $GIT_SSH, and is interpreted by the shell, which allows additional arguments to be included. $GIT_SSH on the other hand must be just the path to a program (which can be a wrapper shell script, if additional arguments are needed).
Usually it is easier to configure any desired options through your personal .ssh/config file. Please consult your ssh documentation for further details.


text:
Q: Facing my stickman in the correct way JavaScript I'm making an educational online board game and I have made I stickman as the main character. I use arrow keys for the user to guide him along the board.
I am trying to make him face the way he's going but I've only managed to make his eyes and mouth face the opposite way. His arms keep swaying forward in odd manners that change every time I hit the arrow key.
I was wonder If anybody could spot my error. I have surfed the internet and rewritten the code in many ways to no avail. Here is the important code:

window.addEventListener("keyup", (e) => {
  switch (e.key) {
    case "ArrowLeft":
      update();
      icon.style.left = parseInt(icon.style.left) - moveBy + "px";
      eye.style.right = 65 + "%";
      mouth.style.right = 40 + "%";
      arm1.style.animation = "walk-arm2 1s infinite";
      arm_after1.style.animation =  " walk-arm-after2 1s infinite";
      break;
    case "ArrowRight":
      update();
      icon.style.left = parseInt(icon.style.left) + moveBy + "px";
      eye.style.right = 25 + "%";
      mouth.style.right = 0 + "%";
      arm1.style.animation = " walk-arm 1s infinite";
      arm_after1.style.animation = "walk-arm-after 1s infinite";
      break;
    case "ArrowUp":
      update();
      icon.style.top = parseInt(icon.style.top) - moveBy + "px";
      break;
    case "ArrowDown":
      update();
      icon.style.top = parseInt(icon.style.top) + moveBy + "px";
  }
  verifyThePosition();
  verifyThePosition2();
  verifyThePosition3();
  verifyThePosition4();
  // verifyThePosition2(targetButton);
});

function openShop() {
  // shopWindow.classList.add('show');
}
// shopBtn.addEventListener('click', )
function verifyThePosition() {
  // console.log(icon.style.left, icon.style.top)
  if (icon.style.left == "650px" && icon.style.top == "50px") {
    let selectedModal = "modal";
    rn = Math.floor(Math.random() * 45) + 1;
    console.log(rn);
    document.querySelector("#modal" + rn).classList.add("show");
  }
}

function verifyThePosition2() {
  // console.log(icon.style.left, icon.style.top)
  if (icon.style.left == "375px" && icon.style.top == "325px") {
    let selectedModal = "modal";
    rn = Math.floor(Math.random() * 45) + 1;
    console.log(rn);
    document.querySelector("#modal" + rn).classList.add("show");
  }
}

function verifyThePosition3() {
  // console.log(icon.style.left, icon.style.top)
  if (icon.style.left == "700px" && icon.style.top == "600px") {
    let selectedModal = "modal";
    rn = Math.floor(Math.random() * 45) + 1;
    console.log(rn);
    document.querySelector("#modal" + rn).classList.add("show");
  }
}

function verifyThePosition4() {
  // console.log(icon.style.left, icon.style.top)
  if (icon.style.left == "875px" && icon.style.top == "75px") {
    let selectedModal = "modal";
    rn = Math.floor(Math.random() * 45) + 1;
    console.log(rn);
    document.querySelector("#modal" + rn).classList.add("show");
  }
}
.stickman {
  transition: 300ms ease-in;
  height: 5em;
  width: 5em;
  position: absolute;
  /* top: 50%;
  left: 50%; */
  margin-top: -10em;
  margin-left: -5em;
  border-bottom: 0.1em solid;
  animation: 0.5s walk-body ease-in infinite;
  z-index: 10;
}
.stickman .head {
  height: 2em;
  width: 2em;
  position: absolute;
  top: 48px;
  left: 25%;
  background-color: #111;
  border-radius: 100%;
}
.stickman .head .eye {
  height: 0.225em;
  width: 0.225em;
  position: absolute;
  top: 32.5%;
  right: 25%;
  background: #fff;
  border-radius: 100%;
}
.stickman .head .mouth {
  height: 0.1125em;
  width: 1.2285714286em;
  position: absolute;
  bottom: 25%;
  right: 0;
  transform: rotate(11.25deg);
  background-color: #fff;
}
.stickman .body {
  height: 3.6666666667em;
  width: 0.325em;
  position: absolute;
  top: 5em;
  left: 50%;
  margin-left: -0.3125em;
  background-color: #111;
}
.stickman .body .arm {
  height: 2em;
  width: 0.325em;
  position: absolute;
  top: 0;
  transform: rotate(-45deg);
  transform-origin: top;
  background: #111;
  animation: 1s walk-arm infinite;
}
.stickman .body .arm#left {
  animation-delay: 0.5s;
  background: #222;
}
.stickman .body .arm#left::after {
  animation-delay: 0.5s;
  background: #222;
}
.stickman .body .arm::after {
  content: "";
  height: 1.3333333333em;
  width: 0.325em;
  position: absolute;
  bottom: 0;
  transform: rotate(90deg);
  transform-origin: right bottom;
  background: #111;
  animation: 1s walk-arm-after infinite;
}
.stickman .body .leg {
  height: 4.1666666667em;
  width: 0.325em;
  position: absolute;
  bottom: -4.1666666667em;
  transform: rotate(-90deg);
  transform-origin: top;
  background: #222;
  animation: 1s walk-leg infinite;
}
.stickman .body .leg#right {
  background: #111;
  animation-delay: 0.5s;
}

@keyframes walk-body {
  0% {
    margin-top: -11.25em;
    padding-bottom: 1.25em;
  }
  50% {
    margin-top: -10em;
    padding-bottom: 0;
  }
  100% {
    margin-top: -11.25em;
    padding-bottom: 1.25em;
  }
}
@keyframes walk-arm {
  0% {
    transform: rotate(-45deg);
  }
  50% {
    transform: rotate(45deg);
  }
  100% {
    transform: rotate(-45deg);
  }
}
@keyframes walk-arm-after {
  0% {
    transform: rotate(67.5deg);
  }
  50% {
    transform: rotate(90deg);
  }
  100% {
    transform: rotate(67.5deg);
  }
}
@keyframes walk-arm2 {
  0% {
    transform: rotate(45deg);
  }
  50% {
    transform: rotate(-45deg);
  }
  100% {
    transform: rotate(45deg);
  }
}
@keyframes walk-arm-after2 {
  0% {
    transform: rotate(-67.5deg);
  }
  50% {
    transform: rotate(-90deg);
  }
  100% {
    transform: rotate(-67.5deg);
  }
}
@keyframes walk-leg {
  0% {
    transform: rotate(-45deg);
  }
  50% {
    transform: rotate(45deg);
  }
  100% {
    transform: rotate(-45deg);
  }
}

Thank you before ward,
Dimitri


text:
Q: Как узнать масштаб экрана с помощью python или pyqt5 Как узнать масштаб экрана с помощью python или pyqt5. !!!Не разрешения!!!

A: Вот таким образом можно получить текущий DPI для мониторов.
from PyQt5.QtWidgets import QApplication
app = QApplication([])
for screen in app.screens():
    dpi = screen.physicalDotsPerInch()
    print(f"Screen {screen.name()} DPI =", dpi)
app.quit()

Screen \\.\DISPLAY1 DPI = 141.58475185806762
Screen \\.\DISPLAY4 DPI = 99.60784313725489


text: Q: fluid image behavior on Google Ads images I want to add the fluid image behavior to the image displayed by the ad (Google Ads) on my site, ¿how can do this? the ad seems that is a remote content pulled by an iframe, so the Same Origin Policy "http://en.wikipedia.org/wiki/Same_origin_policy" applies to the case of add the fluid behavior to the image (or I am wrong?), but I am not sure, so I am here on SO asking about that.


text:
Q: Django Views - How does it work? I'm a little bit confused on how Django's views work. I thought it worked this way:

*

*User  pressed a button on a html page

*The action is linked to a view, so it goes to the function as defined in the url.py, and then it does some logic.

However below I have an index.html page that will redirect the user to a login page if the user is NOT logged in:
def index(request):
    if not request.user.is_authenticated():
        return redirect('/login.html')
    else:
        result = Hello_World.delay()
        somethingDownByCelery = result.get(timeout=2)
        context = {'somethingDownByCelery': somethingDownByCelery, 'userName': request.user.username}
        return render(request, 'webapp/index.html', context)

Then I have a login.html, I have a logger that records users behaviors on each of the webpage.
def loginUser(request):
    logger = logging.getLogger('views.logger.login')
    try:
        username = request.POST['username'];
        logger.info("User:" + username + " in Login Page");
    except:
        logger.error("Cannot Identify User");

    type = ""

    try:
        type = request.POST['submit']
        logger.info("User:" + username + " requests:" + type);
    except MultiValueDictKeyError:
        logger.error("Cannot Identify User's Request");

    try:
        username = request.POST['username']
        password = request.POST['password']

        user = authenticate(username=username, password=password)
        if user is not None:
            if user.is_active:
                login(request, user)
                return redirect('index.html')
            else:
                return redirect('disabled.html')
        else:
            condition = "Invalid Login"
            context = {'condition': condition}
            return render(request, 'webapp/login.html', context)
    except MultiValueDictKeyError:
        context = None
        return render(request, 'webapp/login.html', context)

The problem is that when the webpage is refreshed, or redirected to, it will get two logger.error in the two exceptions when I'm trying to request POST with username and submit, because I thought the behavior was 1(press the button in the webpage) then 2(run the function in views).
However, somehow it goes through the whole function first then generate a webpage, which is a 3 step procedure?

A: When Django executes a redirect, it executes the code for that view first, before rendering the actual page. Your code is executing loginUser(), and is triggering exceptions in both the first and second try blocks, which causes your logger statements.
So assuming you're coming from index and are not authenticated, the process goes something like:

*

*index()

*

*redirect('/login.html') [this will call whatever view is mapped to that url; you may want to consider using the url resolution django offers]

*loginUser()

*

*return render(request, 'webapp/login.html', context)

*create and return the html to the user


text:
Q: "Member Mapping specified is not valid" error when saving to a database with Entity Framework The full error message is below:

(46,12) : error 2019: Member Mapping specified is not valid. The type
  'Edm.String[Nullable=True,DefaultValue=,MaxLength=Max,Unicode=True,FixedLength=False]'
  of member 'SEJ_STARDATE' in type 'HotelSearch.APP_SEJOUR' is not
  compatible with
  'SqlServer.date[Nullable=True,DefaultValue=,Precision=0]' of member
  'SEJ_STARDATE' in type 'CodeFirstDatabaseSchema.APP_SEJOUR'. (47,12) :
  error 2019: Member Mapping specified is not valid. The type
  'Edm.String[Nullable=True,DefaultValue=,MaxLength=Max,Unicode=True,FixedLength=False]'
  of member 'SEJ_ENDDATE' in type 'HotelSearch.APP_SEJOUR' is not
  compatible with
  'SqlServer.date[Nullable=True,DefaultValue=,Precision=0]' of member
  'SEJ_ENDDATE' in type 'CodeFirstDatabaseSchema.APP_SEJOUR'. (112,12) :
  error 2019: Member Mapping specified is not valid. The type
  'Edm.String[Nullable=True,DefaultValue=,MaxLength=Max,Unicode=True,FixedLength=False]'
  of member 'PRIX_PRICE' in type 'HotelSearch.RFS_PRIX_R' is not
  compatible with
  'SqlServer.date[Nullable=True,DefaultValue=,Precision=0]' of member
  'PRIX_PRICE' in type 'CodeFirstDatabaseSchema.RFS_PRIX_R'.

The code is below:
var h = new Hotel();

var t = new APP_STAR {
            STA_IDSTAR = 11111,
            STA_STARRATING = "blah",
         };
h.APP_STAR.Add(t);
h.SaveChanges();

Obviously this is just dummy data for testing. Can anyone point me in the right direction as to how to fix this error?

A: The error message is pretty clear:
The type 'Edm.String' of member 'SEJ_STARDATE' in type 'HotelSearch.APP_SEJOUR' is not compatible with 'SqlServer.date

Change edm.String to a recognizable datetime format (MM/DD/YYYY) by manipulating its contents or using DateTime.Parse


text:
Q: Joshua Bloch builder pattern - a good idea when concerned about thread safety? I am considering using the builder pattern described by Joshua Bloch mentioned here.
I have a class which displays an Alert message and will be used by numerous applications.
It can have a large number of varied options like, line1, btn txt, title, line2, timeout etc.
I like the idea of chaining the object construction with setters, but really all the app has to do after the construction is to display this alert.
Since the object created is immutable, they will have to create multiple ones for different scenarios.
All calls to display these alerts are asynchronous.
Is this pattern a good idea or is better to just have static methods in the class, keep it stateless and take all the parameters in the method itself.

A: Seems overly complex to use a builder for such a utility method.  A series of static methods with apt overload signatures would do the trick fine. Not "oh my god the sky is collapsing" complexity, granted, but most consumers might consider statics "easier".
Of course, if you find yourself needing 4 overloads with (String, String, String), things change I guess...

A: Using the builder pattern in a concurrent system is perfectly fine.
The key decision factors are the number of parameters, and how many valid permutations of exist.

A: The article you link mentions it. One of the usecases of the builder pattern is to create a complex immutable object. One you don't want to write a huge constructor for because there are just too many parameters.
While the builder is mutable and has setters like a bean - is therefore not threadsafe - the resulting object you build is. Objects that don't have mutable state can be shared across as many threads as you wish. Nothing can modify them, so nothing can read inconsistent state.
-> safe if you don't share the builder across threads and the resulting object is threadsafe. Threadsafety of the resulting object is by the way totally independent from the way you create it.

Is this pattern a good idea or is better to just have static methods in the class, keep it stateless and take all the parameters in the method itself.

Depends on how complex the creation of the object is. Stateless is always good but with just static methods, how would you pass some sort of configuration for the alert? There must be some state somewhere to show it.


text:
Q: How to set all cookies with a single max_age in pylons? Normally, we set the cookie with a single max_age as following:
response.set_cookie('name1', 'value1', max_age=3600*24*365)
response.set_cookie('name2', 'value2', max_age=3600*24*365)
response.set_cookie('name3', 'value3', max_age=3600*24*365)

Note, we set the max_age again and again. How to set a default max_age to all cookies that does not have a max_age parameter? Is there any configuration for it?

A: May be simple wrap set_cookie function:
def set_cookie(name, value, max_age=DEFAULT_MAX_AGE):
   response.set_cookie(name, value, max_age)


text:
Q: Basic problem about property of algebraic set We know there is a property about algebraic set:
$V(I\cap J) = V(I) \cup V(J)$
Where $I$ and $J$ are two ideals consisting polynomials contained in a polynomial ring (not shown). $V(I)$ is a algebraic set consisting of points which make polynomials in $I$ vanishing, i.e. $V(I) := \{x|f_i(x)=0, f_i\in I\}$.
Now, consider the following graph:

My question is
$V(I)$ should be the set of points making both 1 and 2 polynomials vanishing. So it
should be points 1 and 2 (red pts). And $V(J)$ should be points 2 and 3 (red pts). The
$V(I) \cup V(J)$ should be red points 1, 2 and 3.
However, I think $V(I\cap J)$ should be the green triangle, which is the intersected
polynomial. My idea is $I\cap J$ = green triangle
I am confused where did I make a mistake?

A: So it looks to me like you are doing something wrong when you are finding $I \cap J$ because you are claiming that any polynomial in it should vanish on your green triangle. Using your notation the polynomial $1*3$ is in $I \cap J$ and doesn't vanish on the entire green triangle (instead it vanishes if either $1$ or $3$ does). This means that, since $2$ is in the intersection of these ideals as well, the most places that could be in the vanishing set of $I \cap J$ are the three red dots in your picture.

A: The property $V(I\cap J) = V(I) \cup V(J)$ holds for ideals $I$, $J$ and not for just any sets of functions. The proof of it works like this
$$V(I) \cup V(J)  \subset V(I\cap J) \subset V(I\cdot J) \subset\ V(I) \cup V(J)$$
The only nontrivial inclusion is $V(I\cdot J) \subset V(I) \cup V(J)$ and this uses in some way or another "$a\cdot b = 0 \Rightarrow a=0 \ \text{or}\  b=0$".
Let's look at your subsets of functions $I$, $J$. We have as sets $I \cdot J = \{ 1\cdot 2, 1\cdot 3, 2\cdot 2, 2\cdot 3\}$ and it's easy to check that
$$V(\{ 1\cdot 2, 1\cdot 3, 2\cdot 2, 2\cdot 3\}) = V(\{2,\, 1\cdot 3\}) = V(I) \cup V(J)$$
Why not for $I\cap J$? Well,  $I \cap J \supset I\cdot J$ is a property of ideals. In general $I \cap J$ will just be too small so $V(I \cap J)$ will strictly include $V(I) \cup V(J)$.


text:
Q: How do I derive a formula for eigenvalues for this matrix? Let $\pi$ be a $3\times 3$ orthogonal projection matrix of rank $2$, $H$ be another symmetric $3\times 3$ matrix and $c$ be a constant. Also let $A =\pi H/c$.
Then I wish to show that the non-zero eigenvalues of $\frac{-1}{2c}\pi H\pi$ is given by
$$\kappa_{\pm} = \frac{\text{tr} A \pm \sqrt{2\text{tr}(A^2) - (\text{tr}A)^2  }}{2} \tag{1}$$
, in order to complete my derivation of a formula for principal curvatures for surface.

FYI here is the original problem in my homework:
Let $f$ be a smooth real function on an open set $U$ of $\Bbb{E}^3$. Suppose that $X:= f^{-1}(0)$ is non-empty and $df_p \neq 0$ for any $p \in X$. Put
$$\pi = I - \frac{\nabla f(\nabla f)^T}{|\nabla f|^2}, \quad A = \pi \frac{Hf}{|\nabla f|}$$
Prove that $(1)$ is the formula for principal curvatures of the hypersurface $X$.

I followed the procedures in the concrete examples given in the book. Here I copy and paste my attempts:
Given $p \in X$, up to rigid motion, assume $p = 0$. Then Taylor formula at $p$ is
\begin{align*} f(p + \vec x) = f(0 + \vec x) &= f(0) + \nabla f(p) \cdot \vec x + \frac{1}{2} \vec x \cdot Hf(p) \vec x + o(|\vec x |^2)\\
0 & = 0 + \underbrace{\frac{\nabla f(p)}{|\nabla f(p)|}}_{\vec n} \cdot \vec x + \frac{1}{2\underbrace{|\nabla f(p)|}_{c}}\vec x  \cdot \underbrace{Hf(p)}_{H} \vec x + o(|\vec x^2|) \\
& = \vec n \cdot \vec x + \frac{1}{2c} \vec x \cdot H \vec x + o(|\vec x|^2)\end{align*}
From linear algebra, $P = \vec n \vec n^T$ is the orthogonal projection onto the span of $\vec n$. So the given $\pi = I - \vec n \vec n^T$ is the orthogonal projection onto the tangent plane at $p$.
$\vec n   \cdot \vec x $ can be written as $x_3$, which is the coordinate of $\vec x$ along direction $\vec n$.
If $x_1, x_2$ are any orthogonal coordinates on the tangent plane at $p$, up to a rotation around $x_3$ axis, we have $x_3 = \kappa_1x_1^2 + \kappa_2 x_2^2 + o(x_1^2 + x_2^2)$. So that in the quadratic form $\vec x \cdot H\vec x$, further multiplication of $x_1$, $x_2$ or $x_3$ onto $x_3$ would become $o(x_1^2 + x_2^2)$.
So that $\vec x \cdot H\vec x = (\pi \vec x) \cdot H(\pi \vec x) + o(x_1^2  + x_2^2)$, and that
$$ x_3 = - \frac{1}{2c} (\pi \vec x) \cdot H (\pi \vec x) + o(x_1^2 + x_2^2) = - \frac{1}{2c} \vec x^T (\pi^T  H \pi) \vec x + o(x_1^2 + x_2^2) $$
Finally, to remove the crossing term in $- \frac{1}{2c} \vec x^T (\pi^T  H \pi) \vec x $, we have to orthogonally diagonalize the matrix $- \frac{1}{2c} (\pi^T  H \pi)$ and the nonzero entries on the resulting diagonal matrix are the principal curvatures $\kappa_1$ and $\kappa_2$, as shown in that example in the book. But this is just the same as computing the nonzero eigenvalues of the matrix $- \frac{1}{2c} (\pi^T  H \pi)$ and the eigenvalues are found to be...
(Here I need your answers)

I also checked with a particular example and found that the nonzero eigenvalues of $\frac{-1}{2c}\pi H\pi$ are really given by $(1)$ and is the principal curvatures of the surface.

A: We can conjugate by an orthogonal matrix to make
$$\pi=\pmatrix{1&0&0\\0&1&0\\0&0&0}.$$
So let's do so. Also $H$ remains symmetric; write
$$H=\pmatrix{a&b&d\\b&e&f\\d&f&g}.$$
I'll assume $c=1$ for simplicity (general $c$ will be no harder),
then
$$A=-\pmatrix{a&b&0\\b&e&0\\0&0&0}.$$
The characteristic polynomial of $A$ is
$$x(x^2+(a+e)x+ae-b^2).$$
The eigenvalues are zero and
$$\frac{-a-e\pm\sqrt{a^2-2ae+e^2+4b^2}}2$$
But
$$\text{Tr}(A)=-a-e,$$
$$\text{Tr}(A^2)=a^2+e^2+2b^2$$
and so
$$2\text{Tr}(A^2)-\text{Tr}(A)^2=a^2-2ae+e^2+4b^2$$
and your formula drops out.


text:
Q: How to store many to many relationship with extra column data
in the above scenario 'signs and symptoms' is a multi selection and if 'others' selected  'specify-others' field must be filled . how to store this .
 what is the best table structure for performance and querying
  Either to provide 15 columns in single table and store null if no value or to store  foreign key of symptoms in another table (in this strategy how to store 'others symptom' description column ie specify-other field data).

A: There is no universal answer, your choice may depend on multiple factors including external issues, i.e. coding framework you use to support database (if any). The "classic" way to do it:
1. Patient table:

   id (PK)
   name

2. Symptom table:

    id (PK)
    symptom

3. Patient to Symptom table:

    id (PK)
    patient_id (FK)
    symptom_id (FK)
    other_symptoms (text)

But once again, any approach (including this one) has its own pros and cons and this is not a universal solution.

A: I would definitely exclude the 15 columns in a table option because whenever a new symptom would be needed to be added, and it will be needed rather sooner than later, you'll have to:

*

*alter the table schema

*the code that displays the symptoms

*the code that inserts/updates patient records

*who knows what else.

I'd go with a classic many to many relationship, with tables similar to:

*

*patients: patient_id, name, etc

*symptoms: symptom_id, name, description, etc

*patient_symptoms: patient_id, symptom_id

Even better would be an extra table:

*

*visits: doctor_id, patient_id, date, other_symptoms
And then, your patient_symptoms table can be related to an actual visit to a doctor:

*

*patient_symptoms: visit_id, symptom_id


text:
Q: How to make a selection of a datatable into a new smaller datatable within a loop See the picture for extra info.
I have a datatable with unique adresses. dtUniqueAdresses
I have another datatable with all sort of adresses and some additional columns
dtAdresses
Then i want to create a loop with the following goal in the loop...
For each unique adress select this adress from dtAdresseswhich generates a set of matching rows with the same adresses as the selected unique adress.
Make a new datatable or dataview from this set of matching adressrows and call it dtSelectedAdresses.
Then on this new datatable (or dataview>) dtSelectedAdresses i do some excercise like finding the highest value- of NUMBER for example.
And when ready i pick the next uniqueadress, make the selection and find teh highest value and so on.
The problem i have now is that i have working code of similar problems but they were never in a loop. I tried with datarows new datatables inside and outside the loop and dataviews but all generate different errors. Somehow code examples from the internet cant be used in a loop succesfully. Any idea whats the best way to get a changing datatable within a loop?

Here some bad codes i tried, i tried more but it gives you an idea that i am a beginner although my total software is working fine...


text:
Q: I can't run bundle it show bundle: command not found I install bundle by using
sudo bundle install and sudo gem install bundler

It show error
bundle: command not found

I set path like this.
export PATH=$PATH:/var/lib/gems/1.8/bin

When I run command gem environment it show like this.
RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.8
  - RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
  - USER INSTALLATION DIRECTORY: /root/.gem/ruby/1.8
  - RUBY EXECUTABLE: /usr/bin/ruby1.8
  - EXECUTABLE DIRECTORY: /usr/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/lib/ruby/gems/1.8
     - /root/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-rdoc --no-ri"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games

When I run command echo $PATH it show like this.
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

How to fix error bundle: command not found ?

A: Simply hit the command
$gem install bundle
if the ruby version is required to updated do it separately

A: bundle(r) is a gem. I am guessing you have the gem not installed yet.
try
gem install bundler

A: Well, you're trying to install ruby as system package, and I would suggest not doing that since ruby 1.8 is very old version.
You should use rvm or rbenv instead for ruby installation.
Take a look on http://rvm.io. After rvm installed, install ruby

rvm install 2.3.1

then install bundler

gem install bundler


text:
Q: Unable to access axis2 framework based service deployed on wso2 application server I am newbie to services. I am trying to make Service for login module by using axis2 framework. I made Web Dynamic Project in eclipse and generate java skeleton from wsdl. I made WAR file and deploy it on wso2 application server.After that i open the application server and perform the following steps.

*

*open the Application list

*click on "Go To URL" in Action

*click on services

I got the following exception
 javax.servlet.ServletException: javax.servlet.ServletException: org.apache.axis2.AxisFault: The system is attempting to engage a module that is not available: addressing
    org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:462)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    org.wso2.carbon.statistics.webapp.RequestIntercepterValve.invoke(RequestIntercepterValve.java:43)
    org.wso2.carbon.bam.webapp.stat.publisher.WebAppStatisticPublisherValve.invoke(WebAppStatisticPublisherValve.java:104)
    org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
    org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
    org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56)
    org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
    org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
    org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
    org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    java.lang.Thread.run(Thread.java:722)

root cause

javax.servlet.ServletException: org.apache.axis2.AxisFault: The system is attempting to engage a module that is not available: addressing
    org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:591)
    org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:454)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    org.wso2.carbon.statistics.webapp.RequestIntercepterValve.invoke(RequestIntercepterValve.java:43)
    org.wso2.carbon.bam.webapp.stat.publisher.WebAppStatisticPublisherValve.invoke(WebAppStatisticPublisherValve.java:104)
    org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
    org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
    org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56)
    org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
    org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
    org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
    org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    java.lang.Thread.run(Thread.java:722)

root cause

org.apache.axis2.AxisFault: The system is attempting to engage a module that is not available: addressing
    org.apache.axis2.engine.AxisConfiguration.engageModule(AxisConfiguration.java:584)
    org.apache.axis2.engine.AxisConfiguration.engageGlobalModules(AxisConfiguration.java:705)
    org.apache.axis2.deployment.DeploymentEngine.engageModules(DeploymentEngine.java:831)
    org.apache.axis2.deployment.WarBasedAxisConfigurator.engageGlobalModules(WarBasedAxisConfigurator.java:300)
    org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:94)
    org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:584)
    org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:454)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    org.wso2.carbon.statistics.webapp.RequestIntercepterValve.invoke(RequestIntercepterValve.java:43)
    org.wso2.carbon.bam.webapp.stat.publisher.WebAppStatisticPublisherValve.invoke(WebAppStatisticPublisherValve.java:104)
    org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
    org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
    org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56)
    org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
    org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
    org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
    org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    java.lang.Thread.run(Thread.java:722)

Can anybody help me? Why is it giving exception.
Best Regards

A: It seems that the problem is with the wso2 not with your application. The addressing module is something internal. Review your wso2 configuration and installation  or install a more recent version.


text:
Q: "Roll Over" in the Song Roll Over Beethoven There is a famous Chuck Berry song titled Roll Over Beethoven. The overall meaning was telling a DJ to stop playing classical music and play rock and roll. But when I looked up for the definition of the phrase "roll over", I can't find a meaning suitable for here. Can you explain what does "roll over" mean here?

A: I agree with the comment by @Michael Harvey although I can't quote a source.
For me, "roll over" means "move over" or "move out of the way"
There's an old children's rhyme

There were ten in a bed and the little one said
"Roll over, roll over"
So they all rolled over and one fell out
There were nine in a bed and the little one said
"Roll over, roll over"
So they all rolled over and one fell out
There were eight in a bed and the little one said
"Roll over, roll over"
So they all rolled over and one fell out
http://www.lyricsondemand.com/miscellaneouslyrics/childrenslyrics/rolloverlyrics.html

A: From wikipedia

The lyric "roll over Beethoven and tell Tchaikovsky the news" refers to how classical composers would roll over in their graves upon hearing that classical music had given way to rock and roll.

further details:

(Enough to make one) "turn in one's grave" is an idiom to describe an extreme level of shock or an intense level of surprise and is expressed as the vicarious sentiment of a deceased person. ... Other forms or "fanciful variants" of this idiom includes: "Roll over in one's grave"

A: Rolling over is something that a dog does to acknowledge domination by another dog. This is likely to mean the same. Beethoven, roll over on your back, and acknowledge the dominance of Rock'n'Roll.

A: It seems short for "Roll over and play dead", meaning to submit or comply without any action, resistance, or protest. It is similar to what animals do when feigning death when faced with some predators. As explained here.

A: "Roll over" simply means to give way to pressure.
https://dictionary.cambridge.org/dictionary/english/roll-over
In this context Chuck Berry is telling classical composers (Beethoven, Tchaikovsky, etc) to "give way, rock and roll is here".
There could be a "roll over in his grave" interpretation (the normal terminology is "turn in his grave" though), but without a reference to Berry's intent, the standard definition seems to be the simplest explanation.


text:
Q: Change the data when the option is selected I have the following pricing plan and I've already broke my had trying to change the data of list item
Gain 20 Likes
 when the appropriate option is chosen. For example when chosen the option <option value="10.00">15 .......$10.00</option> I want the list item to display
Gain 15 Likes
, when chosen <option value="15.00">30 .......$15.00</option> to display
Gain 30 Likes
 etc. My javascript knowledge is too poor to solve this problem unfortunately.

Plan

                        <select class="form-control" id="followersPlans" name="followersPlans">
                            <option value="10.00">15 .......$10.00</option>
                            <option value="15.00">30 .......$15.00</option>
                            <option value="30.00">50 .......$30.00</option>
                            <option value="60.00">100 .....$60.00</option>
                            <option value="100.00">200 .....$100.00</option>
                            <option value="140.00">300 .....$140.00</option>
                            <option value="220.00">500 .....$220.00</option>
                            <option value="420.00">1000 ...$420.00</option>
                        </select>

Monthly Subscription

                    Activate

No Survey Required

Gain 20 Likes

A: You could work with data attributes in your options and set a second value with that data you need for example:

    <select class="form-control" id="followersPlans" name="followersPlans">
        <option data-like="15" value="10.00">15 .......$10.00</option>
        <option data-like="30" value="15.00">30 .......$15.00</option>
        <option data-like="50" value="30.00">50 .......$30.00</option>
    </select>

With jQuery you can access that values with the .data() function something like this:
$(document).ready(function() {
    $("#followersPlans").change(function() {
        var yourData = $("#followersPlans option:selected").data('like');

        # Alternative
        # var likes = $(this).find('option:selected').data('likes');
        console.log(yourData);
    });
});

A: As you want to store your $ amount on the value attributes of the options items, you might want to use data-attributes to store the like numbers.
Here is how to do it with jQuery :

$(document).ready(function() {
  $('#followersPlans').on('change', function() {
    // console.log($(this).find('option:selected').data('likes'));
    var likes = $(this).find('option:selected').data('likes');
    $('.updateLikes').html('Gain ' + likes + ' Likes');
  });
});

Plan

          <select class="form-control" id="followersPlans" name="followersPlans">
            <option value="10.00" data-likes="15">15 .......$10.00</option>
            <option value="15.00" data-likes="30">30 .......$15.00</option>
            <option value="30.00" data-likes="50">50 .......$30.00</option>
            <option value="60.00" data-likes="100">100 .....$60.00</option>
            <option value="100.00" data-likes="200">200 .....$100.00</option>
            <option value="140.00" data-likes="300">300 .....$140.00</option>
            <option value="220.00" data-likes="500">500 .....$220.00</option>
            <option value="420.00" data-likes="1000">1000 ...$420.00</option>
          </select>

Monthly Subscription

        Activate

No Survey Required

Gain 20 Likes

A: Here is a simple solution with Vanilla JavaScript.

var plans = document.getElementById("followersPlans");

var selectedPlan = document.getElementById("selected-plan");

plans.addEventListener('change', setLikes);

function setLikes() {
 var value = plans.querySelector('option:checked').dataset.like;
  selectedPlan.innerHTML = "Gain " + value + " Likes";
}

setLikes();

Plan

                        <select class="form-control" id="followersPlans" name="followersPlans">
                            <option data-like="15" value="10.00">15 .......$10.00</option>
                            <option data-like="30" value="15.00">30 .......$15.00</option>
                            <option data-like="50" value="30.00">50 .......$30.00</option>
                            <option data-like="100" value="60.00">100 .....$60.00</option>
                            <option data-like="200" value="100.00">200 .....$100.00</option>
                            <option data-like="300" value="140.00">300 .....$140.00</option>
                            <option data-like="500" value="220.00">500 .....$220.00</option>
                            <option data-like="1000" value="420.00">1000 ...$420.00</option>
                        </select>

Monthly Subscription

                    Activate

No Survey Required

Gain 20 Likes


text:
Q: what is defference between django rest framwork's 'serializer' and 'serializer fields' The serializer of django rest framework converts the model data to JSON format and validates incoming data
 Check function. The functions of the serializer fields are to convert values and data types and to validate input values. I think it looks the same, but I wonder what the difference is.

A: If you look at the definition of the Serializer class in the source code you will see that it is a descendant of Field.
class BaseSerializer(Field):
class Serializer(BaseSerializer):
https://github.com/encode/django-rest-framework/blob/master/rest_framework/serializers.py
Aside from the implementation in the code Serializers are complex fields which can have subfields inside. All other fields are used to serialize/validate basic data (numbers, stings, list of numbers/strings etc.) while Serializers are used to serialize/validate objects which are composed of other fields.


text:
Q: Route system with custom tag helper MVC CORE Custom Tag Helper 'Pagination'
[HtmlTargetElement("div", Attributes = "page-model")]
    public class PageLinkTagHelper : TagHelper
    {
        private IUrlHelperFactory urlHelperFactory;
        public PageLinkTagHelper(IUrlHelperFactory helperFactory)
        {
            urlHelperFactory = helperFactory;
        }

        [ViewContext]
        [HtmlAttributeNotBound]
        public ViewContext ViewContext { get; set; }
        public PagingInfo PageModel { get; set; }
        public string PageRoute { get; set; }
        [HtmlAttributeName(DictionaryAttributePrefix = "page-url-")]
        public Dictionary<string, object> PageUrlValues { get; set; } = new Dictionary<string, object>();
        public bool PageClassesEnabled { get; set; } = false;
        public string PageClass { get; set; }
        public string PageClassNormal { get; set; }
        public string PageClassSelected { get; set; }

        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            IUrlHelper urlHelper = urlHelperFactory.GetUrlHelper(ViewContext);
            TagBuilder result = new TagBuilder("div");
            for (int i = 1; i <= PageModel.TotalPages; i++)
            {
                TagBuilder tag = new TagBuilder("a");
                tag.Attributes["href"] = urlHelper.RouteUrl(PageRoute, new { page = i });
                PageUrlValues["page"] = i;
                tag.Attributes["href"] = urlHelper.RouteUrl(PageRoute, PageUrlValues);
                if (PageClassesEnabled)
                {
                    tag.AddCssClass(PageClass);
                    tag.AddCssClass(i == PageModel.CurrentPage
                    ? PageClassSelected : PageClassNormal);
                }
                tag.InnerHtml.Append(i.ToString());
                result.InnerHtml.AppendHtml(tag);
            }
            output.Content.AppendHtml(result.InnerHtml);
        }
    }

View

Controller - routes
[Route("Admin/System/[action]/{page:int}", Name = RouteUrl.Name.SystemListPagination)]
[Route("Admin/System/[action]/{page:int}", Name = RouteUrl.Name.CategoryListPagination)]
public ViewResult List(int valueId, bool isSysParamCategory, DeleteCategoryType deletedCategory, SaveCategoryType savedCategory, int page = 1)
{ }

html is generated like this:

Error:
InvalidOperationException: The view 'List' was not found. The following locations were searched:
 /Areas/Admin/Views/Shared/List.cshtml
 /Views/Shared/List.cshtml
Question and reflection
I just dont get it :) I'm using this route paths by name: 'Admin/System/List/{page:int}' or 'Admin/Category/List/{page:int}' depending on the logical flag but MVC framework is searchich view at 'Shared' folder. View is located at: Areas/Admin/Views/CategoryType/List

A: I spend some time on this error yesterday and now find solution in 5 minutes!
solution
I get this error because word Page is Reserved In Asp.net Core 2


text:
Q: How to select the location that file is being saved to? I am relatively new to C++ and I want to be able to open the file explorer and be able to select the location to be saved to. It currently saves within the same folder as the c++ files.
How do I go about this? Thanks.
std::ofstream testFile;
testFile.open("Test.csv");
testFile << "Test";
testFile.close();

A: Try this ( not tested though):
void CMyMFCDlg::OnBnClickedButtonBrowseCvsFile()
{
    CFileDialog dlg(TRUE);
    dlg.m_ofn.lpstrFilter = L"cvs files (*.cvs)\0*.cvs\0\0";
    dlg.m_ofn.lpstrInitialDir = L"D:\\MyDefaultDir\\"; //optional line
    dlg.m_ofn.lpstrTitle = L"Open cvs file";

    if (dlg.DoModal() == IDOK)
    {
         CString filenamewithpath = dlg.GetPathName();
         std::ofstream testFile;
         testFile.open(filenamewithpath.GetString());  // unicode
         //testFile.open(CStringA(filenamewithpath).GetString());  //multibyte
         testFile << "Test";
         testFile.close();
    }
}

A: You probably need something similar to this:
#include <Windows.h>

OPENFILENAME ofn;
char szFileName[MAX_PATH];
strcpy(szFileName, "Test.csv");
ZeroMemory(&ofn, sizeof(ofn));

ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFilter = (LPCSTR)"All Files (*.*)";
ofn.lpstrFile = (LPSTR)szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER;
ofn.lpstrDefExt = (LPCSTR)"csv";

if (GetSaveFileName(&ofn))
{
    std::string pathToFile = ofn.lpstrFile;
    // save you file here, using pathToFile
}
else
{
    puts("Something went wrong");
}

You open file explorer with default file name of "Test.csv". Then, you can select the directory and after pressing "Save" you get the global file path. This path could be later used to save you file.
Also, docs that you may consider useful:
GetSaveFileName
OPENFILENAME


text:
Q: When I try to login using AWS Cognito I get an AccessDeniedException about my custom Lambda trigger I am calling adminInitiateAuth and getting back a strange AccessDeniedException for my own lambdas.
Here is the code I'm calling:
      var params = {
        AuthFlow: "ADMIN_NO_SRP_AUTH",
        ClientId: "@cognito_client_id@",
        UserPoolId: "@cognito_pool_id@",
        AuthParameters: {
          USERNAME : username,
          PASSWORD : tempPassword
        },
      };
      cognitoIdentityServiceProvider.adminInitiateAuth(params, function(error, data) {
        if (error) {
          console.log("ERROR! Login failed: " + JSON.stringify(error), error.stack);
        } else {
          console.log("Login sent back: " + JSON.stringify(data));
        }
      });

The error message I'm getting is:
ERROR! Login failed: {"message":"arn:aws:lambda:us-east-1:201473124518:function:main-devryan-users_onCognitoLogin failed with error AccessDeniedException.","code":"UnexpectedLambdaException","time":"2017-02-25T18:54:15.109Z","requestId":"ce42833f-fb8b-11e6-929b-2f78b63faa12","statusCode":400,"retryable":false,"retryDelay":1.0853444458916783} UnexpectedLambdaException: arn:aws:lambda:us-east-1:201473124518:function:main-devryan-users_onCognitoLogin failed with error AccessDeniedException.

Does anybody know why I might be getting this error?

A: This was happening because I recreated my API Gateway & Lambdas (using serverless) and it turns out that the Cognito console sneakily adds permissions to contact a given Lambda function when added as a trigger through the console.

To fix this in your CloudFormation / serverless.yml file:
resources:
  Resources:
    OnCognitoSignupPermission:
      Type: 'AWS::Lambda::Permission'
      Properties:
        Action: "lambda:InvokeFunction"
        FunctionName:
          Fn::GetAtt: [ "UsersUnderscoreonCognitoSignupLambdaFunction", "Arn"]
        Principal: "cognito-idp.amazonaws.com"
        SourceArn:
          Fn::Join: [ "", [ "arn:aws:cognito-idp", ":", Ref: "AWS::Region", ":", Ref: "AWS::AccountId", ":", "userpool/", "@cognito_pool_id@" ] ]

To fix this in the AWS console:

*

*Go to the Cognito Console

*Choose your user pool

*Go to "Triggers"

*Remove your custom trigger (set it to None) and click "Save"

*Now reset it back and click "Save" again

Here's an interesting Amazon forum post that led me down the right track.

A: I had a problem similar to yours except I was trying to configure the Lambda with my Cognito User Pool through CloudFormation.
In the link that Ryan had posted there was a code sample someone posted.  Namely Cognito needed the proper permissions to invoke the lambda function.
MyLambdaInvocationPermission:
  Type: AWS::Lambda::Permission
  Properties:
    Action: lambda:InvokeFunction
    FunctionName: !GetAtt MyLambdaFunctionName.Arn
    Principal: cognito-idp.amazonaws.com
    SourceArn: !GetAtt MyCognitoUserPoolName.Arn

A: For someone ending up here, trying to add cognito triggers via terraform, all you need to do is to add an aws_lambda_permission resource:
resource "aws_lambda_permission" "allow_execution_from_user_pool" {
  statement_id = "AllowExecutionFromUserPool"
  action = "lambda:InvokeFunction"
  function_name = aws_lambda_function.<lambda>.function_name
  principal = "cognito-idp.amazonaws.com"
  source_arn = aws_cognito_user_pool.<pool>.arn
}

Found in this great post: https://www.integralist.co.uk/posts/cognito/

A: you can add the permission  from the lambda Role (create a policy for cognito and add to to the lamda role ) . this solve my problem when i stuck into it

A: while creation of cloudformation stack - I got error like
User:arn:aws::12345678:user/xyz is not authorized to perform:
cognito-idp:CreateUserPool on resource:*(Service:AWSCognitoIdentityProviderService;
Status Code: 400; Error Code: AccessDeniedException;Request ID: xxxxx)

workaround :

*

*went on to the Stack which is in Rollback state -> checked events and could see , (creation-failed) some Roles I don't have access ,

*So , I checked IAM policy assigned to me - I was not having the access.

*I created a new policy and assigned to myself as an Inline Policy by Importing it from AWS.

aws-cognito-idp

    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Cognito-IDP",
            "Effect": "Allow",
            "Action": [
                "lambda:InvokeFunction",
                "cognito-idp:*"
            ],
            "Resource": "*"
        }
    ]
}

note: you can restrict the access on resource and cognito-idp user.

with this - I am successfully able to create and deploy cloudformation Stack for the module.


text:
Q: How to database seed JSON field in Laravel? I am having trouble to seed user_preference column from users table which is of JSON type. I get error 'Array to string conversion' in my git bash when I type php artisan db:seed.
UserSeeder.php
public function run()
{
    $faker = Faker\Factory::create();
    foreach ($this->getUsers() as $userObject) {
        $user = DB::table('users')->insertGetId([
            "first_name" => $userObject->first_name,
            "last_name" => $userObject->last_name,
            "email" => $userObject->email,
            "email_verified_at" => Carbon::now(),
            "password" => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
            "city" => 'Beograd',

            'user_preferences' => [
                $faker->randomElement(["house", "flat", "apartment", "room", "shop", "lot", "garage"])
            ],

            "created_at" => Carbon::now(),
            "updated_at" => Carbon::now(),
            "type" => 'personal',
        ]);
}

Users Table
Schema::table('users', function (Blueprint $table) {
    $table->json('user_preferences')->nullable()->after('city');
});

User Model
class User extends Authenticatable implements MustVerifyEmail
{
    use Notifiable;
    use EntrustUserTrait;

    protected $fillable = [
        'first_name', 'last_name', 'email', 'password',
        'city', 'user_preferences', 'active', 'type'
    ];

    protected $hidden = [
        'password', 'remember_token',
    ];

    protected $casts = [
        'email_verified_at' => 'datetime',
        'user_preferences' => 'array',
    ];
}

A: In Laravel 8, you can just use it like this:
'user_preferences' => [
   $faker->randomElement(
      [
        'house',
        'flat',
        'apartment',
        'room', 'shop',
        'lot', 'garage'
      ]
   )
],

Note: no need to json_encode it.
Of course dont forget to put this inside your model.
/**
 * The attributes that should be cast.
 *
 * @var array
 */
protected $casts = [
    'user_preferences' => 'array'
];

A: You forgot to encode it to json. So you are trying to insert an Array.
It tries to serialize the array to a string, which doesn't work.
'user_preferences' => json_encode([
     $faker->randomElement(
          [
            "house",
            "flat",
            "apartment",
            "room", "shop",
            "lot", "garage"
          ]
       )
  ]),


text:
Q: Dynamic pie chart using Jfreechart when mouse over the chart its not showing particular area percentage I am developed dynamic pie chart using Jfreechart successfully.Here my concern is when i over the mouse particular area i want see how munch percentage occupy in that area.This is my code.
    import java.awt.BasicStroke;
    import java.awt.Color;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;

    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import org.jfree.chart.ChartFactory;
    import org.jfree.chart.ChartRenderingInfo;
    import org.jfree.chart.ChartUtilities;
    import org.jfree.chart.JFreeChart;
    import org.jfree.chart.entity.StandardEntityCollection;
    import org.jfree.data.jdbc.JDBCPieDataset;

    public class PieChartDemo extends HttpServlet {

        private static final long serialVersionUID = 1L;

        protected void doGet(HttpServletRequest request,
                HttpServletResponse response) throws ServletException, IOException {
            String connectionUrl = "jdbc:sqlserver://localhost:1433;"
                    + "databaseName=mydb;user=madhu;password=*****";
            Connection connection = null;
            try {
                Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver")
                        .newInstance();
                try {
                    connection = DriverManager.getConnection(connectionUrl);
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            }
            JDBCPieDataset dataset = new JDBCPieDataset(connection);
            try {
                dataset.executeQuery("Select country,employes From CompanyDetails order by cid ");
                JFreeChart chart = ChartFactory.createPieChart("Employes Chart", dataset, true, true, false);
                chart.setBorderPaint(Color.black);

                chart.setBorderStroke(new BasicStroke(10.0f));
                chart.setBorderVisible(true);

                if (chart != null) {
                    int width = 500;
                    int height = 350;
                    final ChartRenderingInfo info = new ChartRenderingInfo(
                            new StandardEntityCollection());
                    response.setContentType("image/png");
                    OutputStream out = response.getOutputStream();
                    ChartUtilities.writeChartAsPNG(out, chart, width, height, info);
                }
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        protected void doPost(HttpServletRequest request,
                HttpServletResponse response) throws ServletException, IOException {
            // TODO Auto-generated method stub
        }
    }

My output is :

This is my database Table.


text:
Q: Substring until end of the character How can I substring a character until the end of the text which the length of the string always changes? I need to get everything after the ABC
The samples are:
ABC123
ABC13245
ABC123456
ABC1

A: string search = "ABC";
string result = input.Substring(input.IndexOf(search) + search.Length);

A: Answer
var startIndex = "ABC".Length;
var a = "ABC123".Substring(startIndex); // 123
var b = "ABC13245".Substring(startIndex); // 13245
var c = "ABC123456".Substring(startIndex); // 123456
car d = "ABC1".Substring(startIndex); // 1

Remarks
With Substring() - Faster
string.Substring(int startIndex) returns all the characters after startIndex. Here it is as a method you can use.
public static string SubstringAfter(string s, string after)
{
    return s.Substring(after.Length);
}

With Remove() - Slightly Slower
string.Remove(int start, int count) returns a new string after removing count characters beginning with the character at index start.
public static string SubstringAfter(string s, string after)
{
    return s.Remove(0, after.Length);
}

With Substring() and IndexOf() - Slower Still
If your string started with something other than ABC, and if you wanted to get everything after ABC, then, as Greg rightly answered, you would use IndexOf().
var s = "123ABC456";
var result = s.Substring(s.IndexOf("ABC") + "ABC".Length)); // 456

Proof
Here's a demo, which also shows which is fastest.
using System;
public class Program
{
    public static void Main()
    {
        var result = "ABC123".Substring("ABC".Length);
        Console.WriteLine(result);
        Console.WriteLine("---");

        Test(SubstringAfter_Remove);
        Test(SubstringAfter_Substring);
        Test(SubstringAfter_SubstringWithIndexOf);
    }

    public static void Test(Func<string, string, string> f)
    {
        var array =
            new string[] { "ABC123", "ABC13245", "ABC123456", "ABC1" };

        var sw = new System.Diagnostics.Stopwatch();
        sw.Start();
        foreach(var s in array) {
            Console.WriteLine(f.Invoke(s, "ABC"));
        }
        sw.Stop();
        Console.WriteLine(f.Method.Name + " : " + sw.ElapsedTicks + " ticks.");
        Console.WriteLine("---");
    }

    public static string SubstringAfter_Remove(string s, string after)
    {
        return s.Remove(0, after.Length);
    }

    public static string SubstringAfter_Substring(string s, string after)
    {
        return s.Substring(after.Length);
    }

    public static string SubstringAfter_SubstringWithIndexOf(string s, string after)
    {
        return s.Substring(s.IndexOf(after) + after.Length);
    }
}

Output
123
---
123
13245
123456
1
SubstringAfter_Remove : 2616 ticks.
---
123
13245
123456
1
SubstringAfter_Substring : 2210 ticks.
---
123
13245
123456
1
SubstringAfter_SubstringWithIndexOf : 2748 ticks.
---


text:
Q: In Rust, why can higher-level references be assigned to lower-level references, and why not the other way around? Rust allows assigning references with a higher level of indirection to references with a lower level of indirection. For instance, the compiler allows assigning a &&&&&& to a &:
fn main() {
    let mut some_number = 5;

    // assign an &&&&&&i32 to an &i32, which works.
    let reference : &i32 = &&&&&&some_number;
}

This also works for function parameters:
fn main() {
    let num = 5;

    // ref1 is an &&i32
    let ref1 = &#

    // Pass an &&i32 to a function parameter, which itself is an &i32 (works)
    func(ref1);
}

fn func(test: &i32) {
    println!("^^^^ This works!");
}

I've learned that this works because of automatic dereferencing, which allows the Rust compiler to dereference a type as much as it needs to match some other type (please correct me if I'm wrong on this).
However, Rust doesn't seem to allow assigning lower-indirection references to higher-indirection references:
fn main() {
    let num = 5;

    // Try assigning an &i32 to an &&i32 (error)
    let ref1 : &&i32 = #
}

This results in an expected &i32, found integer compiler error. We get a similar compiler error when testing this with function parameters:
fn main() {
    let num = 5;

    // ref1 is an &&&i32
    let ref1 = &&#

    // Try passing an &&&i32 to a function parameter of type &&&&&i32 (error)
    func(ref1);
}

fn func(test: &&&&&i32) {
    println!("^^^^^^^^ This does not work!")
}

Here, we get a mismatched types error as well. Something I'm curious about, however, is that the compiler output isn't exactly what we expect. Rather than expected &&&&&i32, found &&&i32, the compiler error is expected &&i32, found integer. It seems that the compiler dereferenced both references until one was no longer a reference - why does it dereference both references? I thought it only dereferenced whatever was being passed to the function.
Overall, my main question is
Why, exactly, should assigning lower-indirection to higher-indirection references be disallowed when assigning higher-indirection to lower-indirection references is allowed? What is so different about these two things, that their behaviors must be different as well?

A: &&T can be coerced to &T because of deref coercion ("&T or &mut T to &U if T implements Deref<Target = U>") and the impl Deref<Target = T> for &T the other way is not possible because there exists no impl Deref<Target = &T> for T.
By repeatet application &&&&&&T can be coerced to &T
As to why one is allowed while the other isn't well if implicit referencing was allowed everywhere tracking ownership would be even harder than it currently is, we have this problem already with auto-referencing of method receivers.
let s = String::from("Hello");
my_fun(s);

The question "Does s get moved?" can't be answered without looking at the definition of my_fun if we allow automatic referencing.