text:
Q: How to avoid too many classes in jackson Java? I have JSON serialization and deserialization is done using Jackson in java.
I have so many JSON fields that to serialize and deserialize I have multiple single-member classes, is there any better way to do this?
I don't have any limitations on using Jackson library, that is the library I have used for most of my cases.
public class Data{
    public String type;
    public int id;
    public Attributes attributes;
    public Relationships relationships;
}

public class Category{
    public Data data;
}

public class Service{
    public Data data;
}

public class Priority{
    public Data data;
}

public class Status{
    public Data data;
}

public class User{
    public Data data;
}

public class Relationships{
    public Category category;
    public Service service;
    public Priority priority;
    public Status status;
    public User user;
}

public class Root{
    public Data data;
}

My sample JSON for which I am serializing looks like below.
{
  "data": {
    "id": 111,
    "type": "op type",
    "attributes": {
      "title": "Some title"
    },
    "relationships": {
      "category": {
        "data": {
          "type": "category",
          "id": 1
        }
      },
      "service": {
        "data": {
          "type": "service",
          "id": 3
        }
      },
      "priority": {
        "data": {
          "type": "priority",
          "id": 1
        }
      },
      "status": {
        "data": {
          "type": "status",
          "id": 3
        }
      },
      "user": {
        "data": {
          "type": "user",
          "id": 3
        }
      }
    }
  }
}

A: Because Category, Service and others have the same fields data, if you create class manually, you can just create one common class DataWrapper. But I also see you said you use jsonschema2pojo rather than create class manually.
public class Data{
    public String type;
    public int id;
    public Attributes attributes;
    public Relationships relationships;
}

public class DataWrapper {
    public Data data;
}

public class Relationships{

    public DataWrapper category;
    public DataWrapper service;
    public DataWrapper priority;
    public DataWrapper status;
    public DataWrapper user;
}

public class Root{
    public Data data;
}


text:
Q: amCharts with Angularjs showing undefined object in the value field of the chart I am new to both angularjs and amcharts. What i am trying to do is that I am sending some data in json from a controller (asp.net core). The data is sent to the angularjs controller which is then suppose to create a basic chart using amCharts.
In the category field of the chart i am getting "Undefined" written instead of the names of the countries. The code seems to be running fine but i just cannot find the error. the following is my code.
The following is the class and controller from which i am sending the data written in asp.net core.
  public class tempCountry
    {
        public string Country { get; set; }
        public int Visits { get; set; }

    }

    [HttpGet]
    public IActionResult Charts_Json()
    {
        List<tempCountry> tempCountry = new List<chartController.tempCountry>();

        tempCountry tObj = new tempCountry();
        tObj.Country = "Pakistan";
        tObj.Visits = 500;

        tempCountry.Add(tObj);

        tObj = new tempCountry();
        tObj.Country = "Japan";
        tObj.Visits = 1000;

        tempCountry.Add(tObj);

        tObj = new tempCountry();
        tObj.Country = "India";
        tObj.Visits = 3000;

        tempCountry.Add(tObj);

        tObj = new tempCountry();
        tObj.Country = "Austrailia";
        tObj.Visits = 4000;

        tempCountry.Add(tObj);

        return Json(tempCountry);

    }

The following is my Angularjs controller.
var myApp = angular.module("main", []);
myApp.controller("myController", function ($scope,$http) {
$http({
    method: "GET",
    url: "/chart/charts_json"
}).then(function mySuccess(response) {

    chartdata = response.data;
    var chart = new AmCharts.AmSerialChart();
    chart.dataProvider = response.data;
    chart.categoryFeild = "Country";
    var graph = new AmCharts.AmGraph();
    graph.valueField = "Visits";
    chart.addGraph(graph);
    chart.write('chartdiv');
});

});
The following the view code (MVC asp.net core).
@section scripts {

}

this is the chart view page

The following is the screenshot of the output i am getting
enter image description here

A:
chart.categoryFeild = "Country";

categoryFeild is not a valid amCharts property.
If that is literally how you are spelling the property,
you can edit a column chart on the amCharts website and reproduce the same undefined column names you are generating by using categoryFeild.
Instead, please try replacing categoryFeild with categoryField.
https://docs.amcharts.com/3/javascriptstockchart/AmSerialChart#categoryField

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I update the contents of an entry in the Call Log? I would like to update the CallLog.Calls.TYPE field of the first entry in the Android Call Log from MISSED to INCOMING.  I have read books, the developers reference and googled this to death and am reasonably sure that my code is correct. However, when I actually make the call to update(), the result is that no record is updated.  My code sample is below.
Before you ask:
  - I have permissions for WRITE_CONTACTS
  - The record to be updated (0) does exist
  - I have tried this on both a DroidX (Verizon) and a Samsung Galaxy (AT&T)
  - I have tried various other, longer forms of this code with same result
Can someone please help with this?
    ContentValues newValues = new ContentValues();
    newValues.put(CallLog.Calls.TYPE, CallLog.Calls.INCOMING_TYPE);
    newValues.put(CallLog.Calls.DURATION, 50);
    int result = OsmoService.context.getContentResolver().update(
    ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI, 0),
    newValues,null,null);

A: If you update your code above and replace the line:
ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI, 0)

with this line:
Uri.parse("content://call_log/calls")

It works.  I don't know why, but something is not correct with the content URI.
example:
ContentValues newValues = new ContentValues();
newValues.put(CallLog.Calls.TYPE, CallLog.Calls.INCOMING_TYPE);
newValues.put(CallLog.Calls.DURATION, 50);
int result = OsmoService.context.getContentResolver().update(
    Uri.parse("content://call_log/calls"),
    newValues,
    null,
    null);

A: ContentValues cv = new ContentValues();
cv.put(CallLog.Calls.NUMBER,"7070770"); // contact number

cv.put(CallLog.Calls.TYPE,1); // type

cv.put(CallLog.Calls.DURATION, 120); // duration in second

getContentResolver().insert(CallLog.CONTENT_URI, cv);

A: for example CallLog.Calls.CACHED_NAME
private void updateCachedName(int id, @NonNull String name) {

    ContentValues contentValues = new ContentValues();
    contentValues.put(CallLog.Calls.CACHED_NAME, name);

    if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.WRITE_CALL_LOG) == PackageManager.PERMISSION_GRANTED) {

        getContext().getContentResolver().update(CallLog.Calls.CONTENT_URI, contentValues, CallLog.Calls._ID + "=" + id, null);
    }
}


text:
Q: Vaadin ComboBox and vertical scrollbar I have following problem. Whenever i click on ComboBox the vertical scroll goes to the top of the window. This only happens if the subwindow is too big to fit in browser window. I'm trying to find solution for this over last four days with no result. Please someone help! :)
If anyone can look here is the video which better describes my problem:
http://www.youtube.com/watch?v=x2gfY_D9H8Y

A: The solution is to set height of a window:
window.setHeight("someHeight")
and it will work.


text:
Q: Using the Jena RDF library, how do I return the property of a URI resource? I have a Jena URI Resource (Resource reference to an object where isURIResource() returns true). An example Resource URI is this:

http://d.opencalais.com/er/company/ralg-tr1r/4ee13d20-b44f-3bce-98bc-49a303e72db5

If you open that in a web browser, you'll probably be given the HTML representation of the data:

http://d.opencalais.com/er/company/ralg-tr1r/4ee13d20-b44f-3bce-98bc-49a303e72db5.html

You can change the .html extension to .rdf giving you:

http://d.opencalais.com/er/company/ralg-tr1r/4ee13d20-b44f-3bce-98bc-49a303e72db5.rdf

This RDF model is formatted as XML. The property I need to retrieve is:
<c:symbol>MSFT.OQ</c:symbol>

In summary, I'm looking for a way to use my Jena URI Resource to return the value of c:symbol, which in my example would be MSFT.OQ
I'm aware that I could take this URI, GET the RDF representation via some HTTP client, then load and query the model as I'm doing already. What I'm assuming, however, is that Jena offers a more elegant solution to this recurring task.

A: I don't think Jena has a 'streaming' API just like the StaX API for XML. Might help: last year, I wrote a simple  streaming parser for RDF: A lightweight java parser for RDF. It does not handle the full RDF spec, but you might get some ideas there.


text:
Q: How To Use html dom parser to get images out of an array of links i was working with html dom parser(got it from http://simplehtmldom.sourceforge.net/) to extract images from websites . so i put every websites i want to extract images from in an array but then if i put it inside a for loop the code is not working .
sorry for my bad english
<?php
require("html/simple_html_dom.php");
$aray = array("www.google.com","www.yahoo.com");
for($xx=0;$xx<count($aray);$xx++)
{
 $html=file_get_html($aray[$xx];
  foreach($html->find('img') as $element)
   echo $element->src . '<br>';
}
?>


text:
Q: How to get svg code of (Gauge)google visualization api from browser's dom in IE 7 or IE 8? I am using google visualization api to dynamically generate chart(gauge). I need to collect generated svg from browser's dom and send it to server to generate a png image from it(using apache batik). I am able to get SVG code from browser's dom in firefox,chrome,safari and IE 9 using javascript's 'innerHTML'. But when i try the same in IE 7 and IE 8, I get empty iframes in the innerHTML text. Here is the javascript code, I am using to get svg part from html.
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
//Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['gauge']});

// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawVisualization);
function drawVisualization()
{
      var data = google.visualization.arrayToDataTable([
        ['Label', 'Value'],
        ['Memory', 80],
        ['CPU', 55],
        ['Network', 68]
      ]);

      // Create and draw the visualization.
      new google.visualization.Gauge(document.getElementById('visualization')).
          draw(data);
      alert(document.getElementById('visualization').innerHTML);
}
</script>

A: If the question is about getting the svg converted to png which gets rendered on client side.Then this can be achieved on server side using jsdom and node.js.JSDOM is a DOM implementation of browser on server so that you can execute client side javascript on the server itself.
Here is an example of how to convert svg to png using jsdom,node.js and imagemagick
click here
Hope it solves your problem!


text:
Q: No feedback from terminal I'm really new to ubuntu and I'm having trouble understanding something regarding feedback from the terminal.
The course book says that there is supposed to be feedback from the terminal when you give the "which" utility the name of a command that doesn't exist in your search path.
However, when I purposely do that, absolutely nothing comes up. See here:
no feedback at all from using commands that obviously don't do anything
Does anyone know how I could get the terminal to give me feedback for errors?

A: which never did show error messages on command line. At least not on Debian version of Linux. Every system seems to have their own version of which (one of the reasons other commands are preferred) so maybe your course was referencing another operating system? For usage in scripts you can have 3 exit statuses:
EXIT STATUS
   0      if all specified commands are found and executable
   1      if  one  or  more  specified commands is nonexistent or not executable
   2      if an invalid option is specified

Use type,whatis, or whereis. All 3 will show it did not find what you asked for.
$ type aaa
bash: type: aaa: not found
$ whereis aaaa
aaaa:
$ whatis aaaa
aaaa: nothing appropriate.

and
type firefox
firefox is /usr/bin/firefox
$ whereis firefox
firefox: /usr/bin/firefox /usr/lib/firefox /etc/firefox
  /usr/share/man/man1/firefox.1.gz
$ whatis firefox
firefox (1)          - a free and open source web browser
  from Mozilla

Here is a bit of history on which from our U&L.

A: which will show only Linux commands "which" exist on the system you have just tried random characters there... not an existent command...
Here are examples:
$ echo $PATH # This is my default path.
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

$ which python
/usr/bin/python

--- So echo $PATH will show my default locations which are: /usr/local/sbin and /usr/local/bin and /usr/sbin and.. etc..
When you use which python the terminal command is looking for command python in all the existing PATHs that you have in the system and shows you where it is.
This is useful because sometimes you might have a launcher/command that is not listed in your default PATH. THEREFORE YOUR TERMINAL WILL COME BACK WITH A REPLY LIKE command not found
You can also define your path manually:
export PATH="/home/mihai"
/home/mihai# ls
Command 'ls' is available in '/bin/ls'

The command could not be located because '/bin' is not included in the
PATH environment variable.
ls: command not found
echo $PATH
/home/mihai


text:
Q: Which selector do I need to select an option by its text? I need to check if a <select> has an option whose text is equal to a specific value.
For example, if there's an <option value="123">abc</option>, I would be looking for "abc".
Is there a selector to do this?
Im looking for something similar to $('#select option[value="123"]'); but for the text.

A: I tried a few of these things until I got one to work in both Firefox and IE. This is what I came up with.
$("#my-Select").val($("#my-Select" + " option").filter(function() { return this.text == myText }).val());

another way of writing it in a more readable fasion:
var valofText = $("#my-Select" + " option").filter(function() {
    return this.text == myText
}).val();
$(ElementID).val(valofText);

Pseudocode:
$("#my-Select").val( getValOfText( myText ) );

A: This work for me
$('#mySelect option:contains(' + value + ')').attr('selected', 'selected');

A: This could help:
$('#test').find('option[text="B"]').val();

Demo fiddle
This would give you the option with text B and not the ones which has text that contains B.
For recent versions of jQuery the above does not work. As commented by Quandary below, this is what works for jQuery 1.9.1:
$('#test option').filter(function () { return $(this).html() == "B"; }).val();

Updated fiddle

A: None of the previous suggestions worked for me in jQuery 1.7.2 because I'm trying to set the selected index of the list based on the value from a textbox, and some text values are contained in multiple options. I ended up using the following:
$('#mySelect option:contains(' + value + ')').each(function(){
    if ($(this).text() == value) {
        $(this).attr('selected', 'selected');
        return false;
    }
    return true;
});

A: Use following
$('#select option:contains(ABC)').val();

A: I faced the same issue below is the working code :
$("#test option").filter(function() {
    return $(this).text() =='Ford';
}).prop("selected", true);

Demo : http://jsfiddle.net/YRBrp/83/

A: For jquery version 1.10.2 below worked for me
  var selectedText="YourMatchText";
    $('#YourDropdownId option').map(function () {
       if ($(this).text() == selectedText) return this;
      }).attr('selected', 'selected');
    });

A: This works for me:
var result = $('#SubjectID option')
            .filter(function ()
             { return $(this).html() == "English"; }).val();

The result variable will return the index of the matched text value. Now I will just set it using it's index:
$('#SubjectID').val(result);

A: This worked for me: $("#test").find("option:contains('abc')");

A: You can use the :contains() selector to select elements that contain specific text.
For example:
$('#mySelect option:contains(abc)')

To check whether a given <select> element has such an option, use the .has() method:
if (mySelect.has('option:contains(abc)').length)

To find all <select>s that contain such an option, use the :has() selector:
$('select:has(option:contains(abc))')

A: This is the best method for select text in dropdownlist.
$("#dropdownid option:contains(your selected text)").attr('selected', true);

A: This will work in jQuery 1.6 (note colon before the opening bracket), but fails on the newer releases (1.10 at the time).
$('#mySelect option:[text=abc]")

A: That was 10 years ago.
Now jquery is EOL, we can use ordinary DOM for this simple job
document.getElementById("SomeSelectId").querySelectorAll("option").forEach(o => o.selected = o.innerText == text);

A: August 25, 2022.
For jQuery v3.5.1 what really worked for me is this:
$('#selectID option:contains("label")').prop('selected', true);

If you have the text in a variable, do this:
  ddText = 'Text to find';
  $('#selectID option:contains("' + ddText + '")').prop('selected', true);

A: use prop instead of attr
$('#mySelect option:contains(' + value + ')').each(function(){
    if ($(this).text() == value) {
        $(this).prop('selected', 'selected');
        return false;
    }
    return true;
});

A: This what worked for me on jquery V3.6.0 in 2022
$("#select >option").filter( function()
{
    if ($(this).text() === "123")
    {
        $(this).prop("selected", true);
    }
});

A: Either you iterate through the options, or put the same text inside another attribute of the option and select with that.

A: This works for me
var options = $(dropdown).find('option');
var targetOption = $(options).filter(
function () { return $(this).html() == value; });

console.log($(targetOption).val());

Thanks for all the posts.

A: This will also work.
$('#test').find("select option:contains('B')").filter(":selected");

A: As described in this answer, you can easily create your own selector for hasText. This allows you to find the option with $('#test').find('option:hastText("B")').val();
Here's the hasText method I added:
 if( ! $.expr[':']['hasText'] ) {
     $.expr[':']['hasText'] = function( node, index, props ) {
       var retVal = false;
       // Verify single text child node with matching text
       if( node.nodeType == 1 && node.childNodes.length == 1 ) {
         var childNode = node.childNodes[0];
         retVal = childNode.nodeType == 3 && childNode.nodeValue === props[3];
       }
       return retVal;
     };
  }


text:
Q: MS access Encrypt Users Passwords Stored in User Table (SQL) My database is Access front end which is linked to SQL tables, is there a way of Encrypting/Hashing the passwords that are stored in my user table?
I have seen something about Hashbytes and Salt? but not sure how to implement it?
thank you in advance for your help

A: There is no native way to encrypt/decrypt in Access, but it's not hard to create your own.  You can use the old "Zebras" method, by assigning different letters to the alphabet (you could also use some numbers or other ASCII characters instead):
Public Function Encrypt(strvalue As String) As String

Const LowerAlpha    As String = "abcdefghijklmnopqrstuvwxyz"
Const LowerSub      As String = "zebrascdfghijklmnopqtuvwxy" 'zebras
Const UpperAlpha    As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Const UpperSub      As String = "ZEBRASCDFGHIJKLMNOPQTUVWXY" 'ZEBRAS

Dim lngi            As Long
Dim lngE            As Long
Dim strEncrypt      As String
Dim strLetter       As String

If strvalue & "" = "" Then Exit Function

For lngi = 1 To Len(strvalue)

    strLetter = Mid(strvalue, lngi, 1)

    Select Case Asc(strLetter)

        Case 65 To 90 'Uppercase
            'Find position in alpha string
            For lngE = 1 To Len(UpperAlpha)
                If Mid(UpperAlpha, lngE, 1) = strLetter Then GoTo USub
            Next
USub:
            strEncrypt = strEncrypt & Mid(UpperSub, lngE, 1)

        Case 97 To 122 'Lowercase
            'Find position in alpha string
            For lngE = 1 To Len(LowerAlpha)
                If Mid(LowerAlpha, lngE, 1) = strLetter Then GoTo LSub
            Next
LSub:
            strEncrypt = strEncrypt & Mid(LowerSub, lngE, 1)

        Case Else 'Do not substitute

            strEncrypt = strEncrypt & strLetter

    End Select

Next

'Now pass this string through ROT13 for another tier of security

For lngi = 1 To Len(strEncrypt)
    Encrypt = Encrypt & Chr(Asc(Mid(strEncrypt, lngi, 1)) + 13)
Next

End Function

Then work backwards to decrypt:
Public Function Decrypt(strvalue As String) As String

Const LowerAlpha    As String = "abcdefghijklmnopqrstuvwxyz"
Const LowerSub      As String = "zebrascdfghijklmnopqtuvwxy" 'zebras
Const UpperAlpha    As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Const UpperSub      As String = "ZEBRASCDFGHIJKLMNOPQTUVWXY" 'ZEBRAS

Dim lngi            As Long
Dim lngE            As Long
Dim strDecrypt      As String
Dim strLetter       As String

If strvalue & "" = "" Then Exit Function

'Reverse the ROT13 cipher

For lngi = 1 To Len(strvalue)
    strDecrypt = strDecrypt & Chr(Asc(Mid(strvalue, lngi, 1)) - 13)
Next

'Now reverse the encryption

For lngi = 1 To Len(strDecrypt)

    strLetter = Mid(strDecrypt, lngi, 1)

    Select Case Asc(strLetter)

        Case 65 To 90 'Uppercase
            'Find position in sub string
            For lngE = 1 To Len(UpperSub)
                If Mid(UpperSub, lngE, 1) = strLetter Then GoTo USub
            Next
USub:
            Decrypt = Decrypt & Mid(UpperAlpha, lngE, 1)

        Case 97 To 122 'Lowercase
            'Find position in sub string
            For lngE = 1 To Len(LowerSub)
                If Mid(LowerSub, lngE, 1) = strLetter Then GoTo LSub
            Next
LSub:
            Decrypt = Decrypt & Mid(LowerAlpha, lngE, 1)

        Case Else 'Do not substitute

            Decrypt = Decrypt & strLetter

    End Select

Next

End Function

A: Unfortunately, if you modify or encrypt the connection in the linked table then you will find that you cannot connect to SQL serer. Any suggesting here about having some "encryption" routine will NOT WORK and is NOT relevant since if you modify or mess with the connection strings in your linked tables, then the linked tables will fail. Thus the ONLY possible way this could work is if you take the encrypted connection, de-crept and re-link to SQL server with the plan text connect strings with the user ID and password in plain sight. At this point any user placing their cursor over a linked table will see the user id and password in plain sight (so you gain little if anything by this suggested approach).
The two solutions are:
1 – use windows authentication on SQL server. That means the plain text connections in the Access linked tables do NOT require the user id and password.
2 – use cached logons. This is the RECOMMENDED solution.
Thus you DO NOT include the uid and password in the connection string. Thus there is no need to worry about users looking at the connection string.
What you thus do on startup is execute a logon. The VERY INSTANT you execute a SQL logon, then all linked tables WITHOUT userid/password WILL NOW WORK!
The logon code I use is thus this:
Function TestLogin(strcon As String) As Boolean

  On Error GoTo TestError

  Dim dbs          As DAO.Database
  Dim qdf          As DAO.QueryDef

  Set dbs = CurrentDb()
  Set qdf = dbs.CreateQueryDef("")

   qdf.Connect = strcon

   qdf.ReturnsRecords = False

   'Any VALID SQL statement that runs on server will work below.
   ' this does assume user has enough rights to query built in
   ' system tables

   qdf.SQL = "SELECT 1 as test"
   qdf.Execute

   TestLogin = True

   Exit Function

TestError:
   TestLogin = False
   Exit Function

End Function

How to achieve this is outlined in detail here:
Power Tip: Improve the security of database connections
http://blogs.office.com/b/microsoft-access/archive/2011/04/08/power-tip-improve-the-security-of-database-connections.aspx
It makes LITTLE sense to encrypt the connection string, since then on startup you have to re-link with plain connection strings NOW in sight. And worse is on shutdown you have to re-link the tables gain, else they all be in that linked state with full uid/passwords in plain sight.
Not only is such a process time consuming, but prone to MUCH failure and if the application is shutdown incorrect then the "proposed" schemes here of using custom linking will not only fail, but are impractical solutions.
So using cached logons and passwords results in NOT having to include password and logon in those strings. You can prompt a user for their uid/password, execute the logon and NOW all linked tables like magic will use that logon/pass and do NOT have to be linked and thus you don't have to store the userid/logon in the application or in the linked table(s) connection strings.


text:
Q: How to emphasize active tab in Tilda? I'm using Tilda.
It's hard to say which tab is currently active by a glance.
Is there way to make it clear which tab is active.
For example ,can I emphasize tab by changing it's background color?


text:
Q: feedback on solution to Rudin Chapter 2 Exercise 2
Does my reasoning check out? Am I missing any nontrivial steps? Understandable exposition? Thank you so much in advance.
Edit, typed it in mathjax:
Let $z=(x_1,x_2)$ and consider the expression for $n=1$:
$a_0z+a_1=0$ => $(a_0x_1+a_1, a_0x_2)=(0,0)$ => $x_1=-a_1/a_0$ and $x_2=0$.
The set (call it A) containing all values of $x_1$ satisfying the expression is therefore an infinite subset of Q, and thus countable. A is equivalent to the set $Z_1$ containing all z which are solutions to the expression, therefore $Z_1$ is countable.
Assuming $Z_k$ is countable for arbitrary k, consider $Z_{k+1}$:
Define the bijective function $$f:Z_k->Z_0$$ with $$f(z)=z^2$$ Notice that $Z_0 \bigcap Z_1=Z_{k+1}$.The intersection of these two countable sets must be countable, completing induction.

A: For an n-th degree polynomial there are at most most n different solutions.
There are only countablely many n-th degree polynomials with integer coefficients.  (Proof to be provided by reader.)
So for each n in N, there are countablely many algebraic numbers.
That is what hint is pointing out.
Now add together the number of algebraic numbers for all those n's.


text:
Q: mysql ALTER TABLE books AUTO_INCREMENT = 1; is not reflecting on rails rake db:seed After executing
ALTER TABLE books AUTO_INCREMENT = 1;

in mysql when I run
rake db:seed - mysql id number doesn't start with value 1 though the table is empty initially. Why is it so?


text:
Q: Counterintuitive logic in a conditional probability exercise I found this exercise online:
From the list of integers {11,12,13...20} you choose a random one. What is the probability that the chosen number is divisible by 2, under the condition that it is greater than 13.
So my logic was that:
$\Omega$ = {11,12,13,14,15,16,17,18,19,20}
A - numbers divisible by 2
B - numbers greater than 13
A = {12,14,16,18,20)
B = {14,15,16,17,18,19,20)
A$\cap$B = {14,16,18,20}
P(A$\cap$B) = 4/10
But the actual answer is:
P(A|B) = P(A$\cap$B) / P(B) = 4/7
I know this is conditional probability but it seems so counterintuitive to me that I can't wrap my head around it.
Can someone please explain to me the logic behind that?


text:
Q: Calulating coefficiencies I'm trying to calculate the number ofcoefficiencies of every $x^k$
in the expansion of $(x-\frac{1}{x})^{100}$ for an arbitrary $k\in\mathbb{Z}$

Now I tried the following formula:
$\binom{100}{k}$ eventhough similar to the demonstration,
Something is missing here (and/or the lack of explanation makes it harder to understand).
help?

A: Hint: $$\left(x-\frac{1}{x}\right)^{100}=x^{100}\left(1+(-x^{-2})\right)^{100}.$$ Now try the binomial theorem on the right-hand side.


text:
Q: How to find sum of numbers in a continuous manner in dataframe column? I have a column in my dataframe that contains numbers as following:
 0       0.150
 1       0.552
 2       0.144
 3       0.211
 4       1.228
    ...
 1755    0.101
 1756    0.842
 1757    0.143
 1758    0.200
 1759    0.628

I want to find sum of 5 numbers continuously and then determine the highest result. For example, finding sum of first 5 numbers in the column (such as 0.150+0.552+0.144+0.211+1.228), then starting from the second number (0.552) finding sum of the next 5 numbers. I have tried to do this with for loop, but could not find appropriate algorithm to run.

A: Looks like you want rolling.max, with a window size of 5:
df.rolling(5).sum().max()

0       NaN
1       NaN
2       NaN
3       NaN
4     1.228
1755  1.228
1756  1.228
1757  1.228
1758  1.228
1759  0.842

A: You could use DataFrame.rolling to determine the sum, and then calculate the maximum value of the result:
df = pd.DataFrame({'col1': [1,2,3,4,5,6,7,8,9,10], 'col2': [1,2,3,4,5,6,7,8,9,10]})

# Calculate the rolling sum, then take maximum:
df['col1'].rolling(5).sum().max()


text:
Q: Running a multi-module Maven web app in Eclipse I'm trying to run a multi-module Maven web app in Eclipse (EE Helios SR 1). In NetBeans one have just to click the run button. But here it's probably a little more complicated.
I've added Tomcat 7.0.26 as a server for the war module of the project. When I try running the app, in the Servers part of the window I see Apache Tomcat v.7.0.26 at localhost [Started, Synchronized], but browser doesn't react. Does the system browser need to show the page when the app is running?
I tried to move to localhost:8080 and localhost:8080/welcome.html (the second one should be processed by the app) when the server was started, but I got 404 error both times. I also didn't see the new folder in the apache-tomcat-7.0.26/webapps/. Should Eclipse place the project there when running the application? I'd be really grateful if someone tells me what I'm missing here.

A: If not specified, tomcat integration with eclipse deploy by default war to a specific folder in .metadata, in my case somethings like:  ~/workspace/<my_project_workspace_name>/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/
Every war are then unzipped to a folder. If your maven pom.xml you'll find a
<build>
    <finalName>myapp</finalName>
</build>

Then it'll deployed to tomcat as :
localhost:8080/myapp/welcome.html

A: Maven Projects are different from the ones with Web Application Facets, You cannot directly run a Maven App as a web app because the folder structure is different. In order to run your application directly from eclipse, try to add Web Application nature to your maven project [A complex modification involving modification of .project and .classpath files along with addition of few other files]. I would recommend modifying your pom.xml file accordingly

A: I have had a lot of bad experience with running web servers in Eclipse. Most of the time, this was related to unreliable class/resource reloading.
My solution was to add Jetty to my app in a new module (see Embedding Jetty). This basically turns my web app into a Java application, avoiding most of the problems. It also allows me to specify a filter (written in Java) when the app should reload.
This solves all the problems with class reloading (classes and resources are never copied anywhere; they are loaded from Eclipse's bin folders), startup is much faster (we got the startup time from several minutes down to 15s) and reliable.


text:
Q: Jsp page getting called from cache rather than getting loaded from server I am calling a jsp based on 2 parameters which is passed from jsp 1 in this way.Below i pass 2 parameters into 2.jsp and based on these 2 parameters data is displayed in 2.jsp.I have a loop in which i have a number of hrefs like the one i have described below.Each of these href passes a different set of value to 2.jsp.
out.println("" + prog.getName() + "");

I retrieve these 2 parameters in 2.jsp using the following lines
count_id = request.getParameter( "country_id" );
prog_id  = Integer.parseInt(request.getParameter( "program_id" ));

Based on these 2 parameters i show the corresponding data in 2.jsp
Now i have a back button in 2.jsp and i call 1.jsp in 2.jsp using the following code

The problem is when i use the back button and go back to 1.jsp and select another href like the one i have described above i get the data related to the previous href selected.
I guess the problem is when i request the page is loaded from cache rather than from the server.
Please advice

A: You just need to instruct the browser to NOT cache the page. You can do this with help of a servlet filter which sets the following response headers:
@WebFilter("*.jsp")
public class NoCacheFilter implements Filter {

    @Override
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
        HttpServletResponse response = (HttpServletResponse) res;
        response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
        response.setHeader("Pragma", "no-cache"); // HTTP 1.0.
        response.setDateHeader("Expires", 0); // Proxies.
        chain.doFilter(req, res);
    }

    // ...
}

Now just map this filter on an URL pattern covering the JSP pages of interest. E.g. *.jsp or /somefolder/* (the @WebFilter in the example does that for all JSPs).
Make sure that you clear the browser cache before testing.
See also:

*

*How to control web page caching, across all browsers?


text:
Q: jax-rs & mvc: return view as string issue I'm using javax.ws.rs-api and javax.mvc maven libraries to build an mvc restful web based app.
but i cant return view.the preAdd method return view just as  a simple string. it does'nt return actual view.
my webserver is glassfish4
@Path("/home")
public class HomeController {

    @Controller
    @Path("new")
    @GET
    public String preAdd() {
        return "/WEB-INF/jsp/edit.jsp"; // it echo the exact string on the screen: "/WEB-INF/jsp/edit.jsp"
    }
}


text:
Q: understanding pointers in a function argument In the code below, could somebody explain what the second argument is? is it a "constant pointer the data".
Thanks

A: The second argument is a const pointer to a const data.
 const uint8_t * const == uint8_t const * const
 uint8_t const * const == const pointer to const uint8_t

To help you, think of the backwards reading:

*

*int* - pointer to int

*int const * - pointer to const int

*int * const - const pointer to int

etc.
So in your example, const uint8_t *const data is "data const + pointer of uint8_t const" => a const pointer to const data.

A: Assuming that the code is in C or C++, the second argument is a constant pointer to constant data (and the variable name is data).  The function is promising that it will at most read, but not write, to the memory pointed at by the data parameter.  Under normal assumptions, the type of the data is unsigned bytes.

A: const uint8_t *const data essentially means that the function will not be able to update either the data parameter or the object it points to .  IOW, you can't set data to point to a different object within the function.
In short:
const T *p           -- p is writable, *p is not
T const *p           -- same as above
T * const p          -- *p is writable, p is not
const T * const p    -- neither p nor *p are writable
T const * const p    -- same as above

Edit
Note that any change to data wouldn't be reflected in the calling function (unlike any change to *data), so why bother making it const?  Typically it's because the function body needs to preserve that pointer throughout its execution; IOW, if you accidentally update data you'd break something later on in the function.  This is just a way to guarantee that such changes can't happen.


text:
Q: Why is JSON payload for int-http:outbound-gateway give 400 Bad Request? Why is JSON payload for int-http:outbound-gateway give 400 Bad Request?
Below request works fine on Chrome Rest Client with 3 headers specified in inObjgateway and JSON value of Obj
public class Obj {
    @JsonProperty("phone")
    private String phoneNo;
    @JsonProperty("orderNumber")
    private String orderNmb;
}

Application Context Code Snippet is
<int:gateway id="inObjGateway" service-interface="com.XXX.xx.IObjGateway"
                 default-request-channel="smsHttpRequestChannel" default-reply-timeout="10000">
        <int:default-header name="content-Type" value="application/json" />
        <int:default-header name="authorization" value="someWE6JHRhcGwzc0MwZDNCcsome"/>
        <int:default-header name="accept" value="application/json" />
    </int:gateway>

    <int:payload-type-router input-channel="httpRequestChannel">
        <int:mapping type="com.xxx.xx.json.entity.Obj" channel="httpObjToJsonChannel"/>
    </int:payload-type-router>

    <int:channel id="httpRequestChannel"/>
    <int:channel id="httpOutChannel"/>
    <int:channel id="httpObjToJsonChannel"/>

    <int:object-to-json-transformer auto-startup="true"
                                id="objectToJsonTxr" input-channel="httpObjToJsonChannel"
                                output-channel="smsHttpOutChannel"/>

    <bean id="httpRequestFactory" class="org.springframework.http.client.HttpComponentsClientHttpRequestFactory">
        <property name="connectTimeout" value="${connectionTimeout}"/>
        <property name="readTimeout" value="${connectionTimeout}"/>
    </bean>

    <bean id="jackson2http" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>

    <int-http:outbound-gateway request-channel="httpOutChannel" encode-uri="false"
                               url="http://www.someurl.com/something"
                               http-method="POST" auto-startup="true" request-factory="httpRequestFactory"
                               reply-channel="loggingChannel" message-converters="jackson2http"
                               reply-timeout="10000"  />

Below line in detailed logs after show correct conversion from Object to JSON-:
Writing [{"phoneNo":"1617xxxxxxx","orderNmb":"2073xxxxx"}] as "application/json"

Detailed logs
org.springframework.beans.factory.support.DefaultListableBeanFactory : Returning cached instance of singleton bean 'integrationEvaluationContext'
    org.springframework.integration.router.PayloadTypeRouter : (inner bean)#53c8bb96 received message: GenericMessage [payload=com.xxxx.json.entity.Obj@235a8276, headers={timestamp=1430802166667, id=f3c3577d-bf44-b54d-b5e6-6b3f88a5746b, content-Type=application/json, accept=application/json, authorization=someWE6JHRhcGwzc0MwZDNCcsome}]
    org.springframework.beans.factory.support.DefaultListableBeanFactory : Returning cached instance of singleton bean 'ObjHttpObjToJsonChannel'
    org.springframework.integration.transformer.MessageTransformingHandler : org.springframework.integration.transformer.MessageTransformingHandler#0 received message: GenericMessage [payload=com.xxxx.json.entity.Obj@235a8276, headers={timestamp=1430802166667, id=f3c3577d-bf44-b54d-b5e6-6b3f88a5746b, content-Type=application/json, accept=application/json, authorization=someWE6JHRhcGwzc0MwZDNCcsome}]
    org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler : org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler#2 received message: GenericMessage [payload={"phoneNo":"16173313826","orderNmb":"2070000383","firstName":"A"}, headers={timestamp=1430802166759, id=7584cee1-8392-c71c-75f4-026d423e26c2, json__TypeId__=class com.xxxx.json.entity.Obj, content-Type=application/json, accept=application/json, authorization=someWE6JHRhcGwzc0MwZDNCcsome, contentType=application/json}]
    org.springframework.integration.http.support.DefaultHttpHeaderMapper : outboundHeaderNames=[Accept, Accept-Charset, Accept-Encoding, Accept-Language, Accept-Ranges, Authorization, Cache-Control, Connection, Content-Length, Content-Type, Cookie, Date, Expect, From, Host, If-Match, If-Modified-Since, If-None-Match, If-Range, If-Unmodified-Since, Max-Forwards, Pragma, Proxy-Authorization, Range, Referer, TE, Upgrade, User-Agent, Via, Warning]
    org.springframework.integration.http.support.DefaultHttpHeaderMapper : headerName=[timestamp] WILL NOT be mapped
    org.springframework.integration.http.support.DefaultHttpHeaderMapper : headerName=[id] WILL NOT be mapped
    org.springframework.integration.http.support.DefaultHttpHeaderMapper : headerName=[json__typeid__] WILL NOT be mapped
    org.springframework.integration.http.support.DefaultHttpHeaderMapper : headerName=[content-type] WILL be mapped, matched pattern=content-type
    org.springframework.integration.http.support.DefaultHttpHeaderMapper : setting headerName=[content-Type], value=application/json
    org.springframework.integration.http.support.DefaultHttpHeaderMapper : headerName=[accept] WILL be mapped, matched pattern=accept
    org.springframework.integration.http.support.DefaultHttpHeaderMapper : setting headerName=[accept], value=application/json
    org.springframework.integration.http.support.DefaultHttpHeaderMapper : headerName=[authorization] WILL be mapped, matched pattern=authorization
    org.springframework.integration.http.support.DefaultHttpHeaderMapper : setting headerName=[authorization], value=someWE6JHRhcGwzc0MwZDNCcsome
    org.springframework.integration.http.support.DefaultHttpHeaderMapper : headerName=[contenttype] WILL be mapped, matched pattern=contenttype
    org.springframework.integration.http.support.DefaultHttpHeaderMapper : setting headerName=[contentType], value=application/json
    org.springframework.web.client.RestTemplate : Created POST request for "http://www.someurl.com/something"
    org.springframework.web.client.RestTemplate : Writing [{"phoneNo":"1617xxxxxxx","orderNmb":"2073xxxxx"}] as "application/json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@774490f3]
    org.springframework.web.client.RestTemplate : POST request for "http://www.someurl.com/something" resulted in 400 (Bad Request); invoking error handler
    org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver : Resolving exception from handler [public org.springframework.web.servlet.ModelAndView com.xxxx.page.controller.ObjController.sendObj(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpSession) throws com.xxxx.utils.exception.SomePageException]: org.springframework.web.client.HttpClientErrorException: 400 Bad Request
    org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver : Resolving exception from handler [public org.springframework.web.servlet.ModelAndView com.xxxx.page.controller.ObjController.sendObj(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpSession) throws com.xxxx.utils.exception.SomePageException]: org.springframework.web.client.HttpClientErrorException: 400 Bad Request
    org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver : Resolving exception from handler [public org.springframework.web.servlet.ModelAndView com.xxxx.page.controller.ObjController.sendObj(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpSession) throws com.xxxx.utils.exception.SomePageException]: org.springframework.web.client.HttpClientErrorException: 400 Bad Request
    org.springframework.web.servlet.handler.SimpleMappingExceptionResolver : Resolving exception from handler [public org.springframework.web.servlet.ModelAndView com.xxxx.page.controller.ObjController.sendObj(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,javax.servlet.http.HttpSession) throws com.xxxx.utils.exception.SomePageException]: org.springframework.web.client.HttpClientErrorException: 400 Bad Request
    org.springframework.web.servlet.handler.SimpleMappingExceptionResolver : Resolving to view 'error' for exception of type [org.springframework.web.client.HttpClientErrorException], based on exception mapping [java.lang.Exception]
    org.springframework.web.servlet.handler.SimpleMappingExceptionResolver : Exposing Exception as model attribute 'exception'
    org.springframework.web.servlet.DispatcherServlet : Handler execution resulted in exception - forwarding to resolved error view: ModelAndView: reference to view with name 'error'; model is {exception=org.springframework.web.client.HttpClientErrorException: 400 Bad Request}
    org.springframework.web.client.HttpClientErrorException: 400 Bad Request
        at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91)
        at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:588)
        at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:546)
        at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:517)
        at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:462)
        at org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler.handleRequestMessage(HttpRequestExecutingMessageHandler.java:422)
        at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:99)
        at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
        at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
        at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:101)
        at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97)
        at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
        at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:277)
        at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:239)
        at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
        at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
        at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:95)
        at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:248)
        at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:171)
        at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:119)
        at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:105)
        at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
        at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
        at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:101)
        at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97)
        at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
        at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:277)
        at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:239)
        at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
        at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
        at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:95)
        at org.springframework.integration.router.AbstractMessageRouter.handleMessageInternal(AbstractMessageRouter.java:164)
        at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78)
        at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
        at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:101)
        at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97)
        at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
        at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:277)
        at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:239)
        at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
        at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
        at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:95)
        at org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend(AbstractMessageSendingTemplate.java:133)
        at org.springframework.messaging.core.AbstractMessageSendingTemplate.convertAndSend(AbstractMessageSendingTemplate.java:125)
        at org.springframework.integration.gateway.MessagingGatewaySupport.send(MessagingGatewaySupport.java:302)
        at org.springframework.integration.gateway.GatewayProxyFactoryBean.invokeGatewayMethod(GatewayProxyFactoryBean.java:417)
        at org.springframework.integration.gateway.GatewayProxyFactoryBean.doInvoke(GatewayProxyFactoryBean.java:374)
        at org.springframework.integration.gateway.GatewayProxyFactoryBean.invoke(GatewayProxyFactoryBean.java:365)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
        at com.sun.proxy.$Proxy102.sendObj(Unknown Source)
        at com.xxxx.page.controller.ObjController.sendObj(ObjController.java:59)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)

The Wireshark packet trace difference from what I observed is as below.
Working request trace from Postman Rest Client!
 No.     Time           Source                Destination           Protocol Length Info
  16733 484.996811000  10.1.XX.XXX           192.XX.XX.XXX         HTTP     1126   POST /chapi/v1/some HTTP/1.1 HTTP/1.1  (application/json)

Frame 16733: 1126 bytes on wire (9008 bits), 1126 bytes captured (9008 bits) on interface 1
Ethernet II, Src: HewlettP_2d:4e:49 (a0:2b:xx:xx:xx:49), Dst: Cisco_ff:fc:04 (00:08:xx:xx:fx:04)
Internet Protocol Version 4, Src: 10.1.XX.XXX (10.1.XX.XXX), Dst: 192.XX.XX.XXX (192.XX.XX.XXX)
Transmission Control Protocol, Src Port: 60374 (60374), Dst Port: 80 (80), Seq: 2921, Ack: 1, Len: 1072
[3 Reassembled TCP Segments (3992 bytes): #16728(1460), #16729(1460), #16733(1072)]
    [Frame: 16728, payload: 0-1459 (1460 bytes)]
    [Frame: 16729, payload: 1460-2919 (1460 bytes)]
    [Frame: 16733, payload: 2920-3991 (1072 bytes)]
    [Segment count: 3]
    [Reassembled TCP length: 3992]
    [Reassembled TCP Data: 504f5354202f6d6f62696c6553657276696365732f737470...]
Hypertext Transfer Protocol
    POST /chapi/v1/some HTTP/1.1\r\n
    Host: something.com\r\n
    Connection: keep-alive\r\n
    Content-Length: 94\r\n
    Accept: application/json\r\n
    Cache-Control: no-cache\r\n
    Origin: chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm\r\n
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36\r\n
    Authorization: someWE6JHRhcGwzc0MwZDNCcsome\r\n
    Content-Type: application/json\r\n
    Accept-Encoding: gzip, deflate\r\n
    Accept-Language: en-US,en;q=0.8\r\n
     [truncated]Cookie: _br_mzv=eyIxIjozLCIyIjox
    \r\n
    [Full request URI: http://www.something.com//chapi/v1/some ]
    [HTTP request 1/1]
    [Response in frame: 16746]
JavaScript Object Notation: application/json
    Object
        Member Key: "phone"
            String value: 1617xxxXXXX
        Member Key: "orderNumber"
            String value: 12xxXXXXX
        Member Key: "application"
            String value: orderPickup

Request not working from Application as per above code configuration !
   No.     Time           Source                Destination           Protocol Length Info
      89769 2664.453624000 10.1.XX.XXX           192.XX.XX.XXX         HTTP     491    POST /chapi/v1/some HTTP/1.1  (application/json)

    Frame 89769: 491 bytes on wire (3928 bits), 491 bytes captured (3928 bits) on interface 1
    Ethernet II, Src: HewlettP_xx:xx:49 (a0:2b:xx:xx:xx:49), Dst: Cisco_ff:fc:04 (00:08:xx:xx:fx:04)
    Internet Protocol Version 4, Src: 10.1.XX.XXX (10.1.XX.XXX), Dst: 192.XX.XX.XXX (192.XX.XX.XXX)
    Transmission Control Protocol, Src Port: 60618 (60618), Dst Port: 80 (80), Seq: 1, Ack: 1, Len: 437
    Hypertext Transfer Protocol
        POST /chapi/v1/some HTTP/1.1\r\n
        Accept: application/json\r\n
        authorization: someWE6JHRhcGwzc0MwZDNCcsome\r\n
        Content-Type: application/json\r\n
        Content-Length: 91\r\n
        Host: something.com\r\n
        Connection: Keep-Alive\r\n
        User-Agent: Apache-HttpClient/4.3.6 (java 1.5)\r\n
        Accept-Encoding: gzip,deflate\r\n
        \r\n
        [Full request URI: http://www.something.com/chapi/v1/some]
        [HTTP request 1/1]
        [Response in frame: 89778]
    JavaScript Object Notation: application/json
    Line-based text data: application/json
        "{\"phoneNo\":\"1617xxxXXXX\",\"orderNmb\":\"207xxXXXX\",\"application\":\"orderPickup\"}"

Any pointers appreciated!

A: Questions like this are too general; you need to provide more details.
This requires you to use some basic debugging skills.
Step 1: Look at the server side logs to see what it is complaining about.
If that doesn't yield the solution,
Step 2: Compare a network monitor trace of the "good" and "bad" requests and figure out what's different between them. If you see what's different and can't figure out how to configure the gateway to replicate the "good" request then come back here with that specific question.
You can get a network trace with Wireshark or the eclipse TCP/IP Monitor, etc.
EDIT:
As you can see from the trace, you are doing two JSON conversions.
Remove the object-to-json-transformer and just let the outbound gateway do the conversion.


text:
Q: SQL where tuple in list I need help in a query, i need to select for each year the name of the courses with the logest duration.
My query looks like this
select *
from courses
where (cyear,duration) IN (
                          select cyear, max(duration)
                          from courses
                          group by cyear)

the problem with that is it's rise this following error at : (cyear,

Expression de type non booléen spécifiée dans un contexte où une condition est attendue, près de ','.

A: SQL Server doesn't support tuples with in.  The closest reasonable syntax is to switch to a correlated subquery:
select c.*
from courses c
where c.duration = (select max(c2.duration)
                    from courses c2
                    where c2.cyear = c.cyear
                   );

A: Using windows function
select *
from ( select *
            , DENSE_RANK( ) over (partition by cyear order by duration desc) as rn
     ) tt
 where tt.rn = 1

A: Alternatively, you could go for an EXISTS:
SELECT *
FROM courses c
WHERE EXISTS (SELECT 1
              FROM cources e
              WHERE e.cyear = c.cyear
              HAVING MAX(e.duration) = c.duration);


text:
Q: How to create a right/left Background animation? I try to develop an application with a left/right animation on the background on the first screen.
For example, this application have an image in background and this image move from left to right. It's exactly what I want to do.

I try with this code :
ImageView imageViewBackground = (ImageView)findViewById(R.id.imageViewBackground);

Animation animation = new TranslateAnimation(0.0f, 200.0f, 0.0f, 0.0f);
animation.setDuration(5000);
imageViewBackground.startAnimation(animation);

and
<ImageView android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/imageViewBackground"
    android:src="@drawable/background"
    android:scaleType="centerCrop" />

But the imageView with this scaleType are cropped and we can't see the content of the imageView entirely current the animation.

A: You can use my SlideImageView library from the GitHub. It gives you what you want.


text:
Q: how do i change button/image onclick to active state? Here is what i want:

Now in more detail:
I have 2 iframes, one on top of the other. the one above has 4 buttons/images, the one below is where a url/link will be displayed when one of these buttons/images gets clicked. i got this working...
what i want now is to have those buttons change image from inactive (ie. light pink) to active (ie. red) state when they are clicked. also, when i click on another of the 4 buttons it will turn red and the previous active (red) button/image must turn back to its inactive state (light pink). so i want 2 images here: (1) active.png and (2) inactive.png.
ALSO, i want the buttons to change to active.png when i hover over them. this i was able to manage with onmouseover and onmouseout effect. its just the ACTIVE part is what i cant figure out.
do i need javascript or can i do without it in case some user has it disabled?
i was also thinking about maybe using radio buttons and then skinning them with my active.png and inactive.png using css or something, but i dont know how to do this either :P  i dont know what is the best and simplest way to go?
------------UPDATE-----------
ok i got something working but im not all the way there yet. it might not even be the way to go, but what i've done is create 4 links and given them all an id (ie.button1, button2..)

then in css i did this for each:
button1 { width: 66px; height: 70px; display: block; background-image:url(images/inactive1.png); }
button1:hover { width: 66px; height: 70px; display: block; background-image:url(images/active1.png); }
button1:focus{ width: 66px; height: 70px; display: block; background-image:url(images/active1.png); }
but i dont want it to loose focus unless another one of the buttons is clicked. cuz now its loosing focus if i click anywhere on the page :(   how can i fix this?

A: The only way to do this without JS, is to create four static pages as mentioned in the comment to your original post.
Your body markup would look like this:

The list above is your Navigation. You do not need a separate iframe, since you have four static pages. In each static page, the li-element containing the link to the active static page gets a class called "active".
The iframe stores the url, you want to be displayed in there.
In your css file, you can style your navigation like that:
#nav a {background: url('images/inactive.png');}

#nav a:hover,
#nav li.active a{
    background: url('images/active1.png');
}

This should work, but a solution using JS would be much more elegant.

A: I made these two files that cover all:
<!DOCTYPE html>

    <title>Deep East Music</title>

button1

button2

button3

button4

And buttons.htm looks like:
<!DOCTYPE html>

    <title>Deep East Music</title>

        <input type="button" id="iframebutton1" class="iframebuttons" isselected="true" value="iframebutton1" />
        <input type="button" id="iframebutton2" class="iframebuttons" isselected="false" value="iframebutton2" />
        <input type="button" id="iframebutton3" class="iframebuttons" isselected="false" value="iframebutton3" />
        <input type="button" id="iframebutton4" class="iframebuttons" isselected="false" value="iframebutton4" />


text:
Q: Use minted for color syntax highlighting of listings and pyluatex for execute python code I'm using minted to color and display snippets of python code, which are embedded in a tcolorbox with the definition \newtcblisting (codepy environment below).
I would like to create an other environment called codepyexec that would do the same as codepy, but additionally run the python code (environment python) with the recently released pyluatex package on CTAN. How to do this ?
MWE
\documentclass[11pt]{scrbook}

\usepackage{minted}
\usemintedstyle{manni}
%
\usepackage[verbose]{pyluatex}
%
\RequirePackage[skins,breakable,xparse,many,minted]{tcolorbox}
\tcbsetforeverylayer{%
    enhanced,
    coltitle            = black   ,
    colbacktitle        = white   ,
    boxrule             = 0.5pt   ,
    colback             = white   ,
    breakable                     ,
    arc                 = 2mm     ,
    size                = title   ,
    toprule at break    = 0mm     ,
    bottomrule at break = 0mm     ,
    lower separated     = false   ,
    boxed title style ={size=small, boxrule=0pt, colframe=white,} ,
    fonttitle           = \bfseries\sffamily ,
    varwidth boxed title ,
    before app          = \parfillskip0pt
}
%
\newtcblisting{mintedpython}[1][]{
    listing engine=minted,
    minted language=python,
    minted options={autogobble,breaklines,breakanywhere}    ,
    listing only,
    skin=enhancedmiddle jigsaw, % Rule D/G uniquement
    enlarge top initially by = 2.5mm,
    rightrule=0mm,
    leftrule=2mm,
    arc=0mm,
    outer arc=0mm,
    left=3.4mm,
    titlerule=0mm,
    detach title,
    attach title to upper={\ \quad \ },
    IfValueTF={#1}{title={#1}}{},
    }
%
\newenvironment{codepy}{\VerbatimEnvironment\begin{mintedpython}%
    }{
    \end{mintedpython}
    }
%
%\newenvironment{codepyexec}{\VerbatimEnvironment...
%   }{
%   ...
%   }

%
\begin{document}

\begin{codepy}
x = 1
print(x)

def f(x):
    return x**2
\end{codepy}

%codepyexec should do this :
%\begin{codepy}
%x = 1
%print(x)
%
%def f(x):
%   return x**2
%\end{codepy}
%AND
%\begin{python}
%x = 1
%print(x)
%
%def f(x):
%   return x**2
%\end{python}

\end{document}

A: The desired functionality is available since v0.3.0 with the \PyLTVerbatimEnv macro.
For example:
\documentclass[11pt]{scrbook}

\usepackage{minted}
\usemintedstyle{manni}
\usepackage[verbose]{pyluatex}

\RequirePackage[skins,breakable,xparse,many,minted]{tcolorbox}
\tcbsetforeverylayer{
    enhanced,
    coltitle=black,
    colbacktitle=white,
    boxrule=0.5pt,
    colback=white,
    breakable,
    arc=2mm,
    size=title,
    toprule at break=0mm,
    bottomrule at break=0mm,
    lower separated=false,
    boxed title style={size=small,boxrule=0pt,colframe=white},
    fonttitle=\bfseries\sffamily,
    varwidth boxed title,
    before app=\parfillskip0pt,
}

\newtcblisting{mintedpython}[1][]{
    listing engine=minted,
    minted language=python,
    minted options={autogobble,breaklines,breakanywhere},
    listing only,
    skin=enhancedmiddle jigsaw,
    enlarge top initially by=2.5mm,
    rightrule=0mm,
    leftrule=2mm,
    arc=0mm,
    outer arc=0mm,
    left=3.4mm,
    titlerule=0mm,
    detach title,
    attach title to upper={\ \quad \ },
    IfValueTF={#1}{title={#1}}{},
}

\usepackage{luacode}
\begin{luacode}
function pytypeset()
    tex.print("\\begin{mintedpython}")
    tex.print(pyluatex.get_last_code())
    tex.print("\\end{mintedpython}")
    tex.print("") -- ensure newline
end
\end{luacode}

\newenvironment{codepyexec}
{\PyLTVerbatimEnv\begin{pythonq}}
{\end{pythonq}
\directlua{pytypeset()}
% Optional: print Python output (enable next line)
% Output: \directlua{tex.print(pyluatex.get_last_output())}
}

\begin{document}

\begin{codepyexec}
x = 1
print(x)

def f(x):
  return x**2
\end{codepyexec}

% Check whether code was not only typeset but also executed:
\py{f(3)}

\end{document}


text:
Q: How to dbms_output.put_line in Oracle The result doesn't show the command ROUND(SYSDATE - V_FECHA,1) by dbms_output.put_line, I have this script:
SET SERVEROUTPUT ON

DECLARE
    v_fecha   v$database.created%TYPE;
BEGIN
    CASE
        WHEN ( SYSDATE - v_fecha <= 50 ) THEN
            dbms_output.put_line('LA FECHA DE CREACION DE LA BASE DE DATOS ES <= 50 DÍAS');
        WHEN ( SYSDATE - v_fecha > 50 AND SYSDATE - v_fecha <= 100 ) THEN
            dbms_output.put_line('LA FECHA DE CREACIÓN ES MAYOR QUE 50 DÍAS O <= 100 DÍAS');
        ELSE
            dbms_output.put_line('LA FECHA DE CREACIÓN ES IGUAL A '
                                   || round(SYSDATE - v_fecha,1)
                                   || ' DÍAS');
    END CASE;
END;
/

OUTPUT:
LA FECHA DE CREACIÓN ES IGUAL A  DÍAS.

Oracle Version: Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
IDE: SQL DEVELOPER - Versión 4.1.1.19
Thanks.

A: The output of the command ROUND(SYSDATE - V_FECHA,1) is not shown, because V_FECHA is still NULL in your code. You can verify that with
SELECT ROUND(SYSDATE - NULL) FROM DUAL;

which doesn't show anything, too. Nearly every operation in SQL will output NULL if the input contains NULL values, and DBMS_OUTPUT shows then an empty string.
As @Kaushik suggested, if you add the SELECT to your code, and maybe something that catches NULL values, everything should be fine:
DECLARE
  v_fecha v$database.created%TYPE;
  delta NUMBER;
BEGIN
  SELECT created INTO v_fecha FROM v$database;
  delta := v_fecha - SYSDATE;

  CASE WHEN delta <= 50 THEN
          dbms_output.put_line('LA FECHA DE CREACION DE LA BASE DE DATOS ES <= 50 DÍAS');
       WHEN delta > 50 AND delta <= 100 THEN
          dbms_output.put_line('LA FECHA DE CREACIÓN ES MAYOR QUE 50 DÍAS O <= 100 DÍAS');
       WHEN delta IS NULL THEN
          dbms_output.put_line('LA FECHA DE CREACIÓN ES DESCONOCIDA');
       ELSE
          dbms_output.put_line('LA FECHA DE CREACIÓN ES IGUAL A '
                               || NVL(round(SYSDATE - v_fecha,1), 0)
                               || ' DÍAS');
  END CASE;
END;
/

I put in two options, WHEN delta IS NULL and NVL to show you different possibilities.
Furthermore I try to call SYSDATE only once, as every call of SYSDATE might be slightly later than the previous one. (The difference is of course very little, but I am trying to prevent errors which occur very rarely but are then very difficult to find.)

A: You probably want to fetch from v$database. Add this after BEGIN
SELECT
    created
INTO v_fecha
FROM
    v$database;


text:
Q: Unable to connect to the remote server [curl] in spring boot This is the start up of the boot system. just following up the process through the documentation provided at https://spring.io/guides/gs/spring-boot-for-azure/.
I'm getting the error as below;

curl : Unable to connect to the remote server
At line:1 char:1
+ curl http://localhost:8080
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (System.Net.HttpWebR
equest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsof
t.PowerShell.Commands.InvokeWebRequestCommand

A: Found the answer

./mvnw spring-boot:run

will connect to the remote server.
Just posted, cause some one may need help on this


text:
Q: How to show multiple markers with the same Lat and Lon on google maps If two locations have the same Lat and Lon how do I get both locations information to load in the same InfoWindow without using clusters
Here is the code snipped i have been working with
 var l, m = new google.maps.InfoWindow;

          console.log(m);

          for (google.maps.event.addListener(k, "click", function() {
                  m.close()
              }), i = 0; i < f.length; i++) {
              var n = f[i],
                  o = g[i][0],
                  p = parseFloat(n[1]),
                  q = parseFloat(n[2]),
                  r = new google.maps.LatLng(p, q);

              l = new google.maps.Marker({
                  position: r,
                  map: k,
                  content: o
              }), l.addListener("click", function() {

                  m.setContent(this.content), m.open(k, this)

              })
          }

Heres the full code
https://codepen.io/T-SEA/pen/wQEqaa

A: I recommend Marker Clustering.
https://developers.google.com/maps/documentation/javascript/marker-clustering
Use Marker Clustering and set click event(open InfoWindow) to cluster marker. Check this out!

A: After spending 3 days on this i figured it out
  var gmarkers = [];
              var l, m = new google.maps.InfoWindow;
              var j;
              for (google.maps.event.addListener(k, "click", function() {
                      m.close()
                  }), i = 0; i < f.length; i++) {
                  var n = f[i],
                      o = g[i][0],
                      p = parseFloat(n[1]),
                      q = parseFloat(n[2]),
                      r = new google.maps.LatLng(p, q);
                     // console.log(f);
                         for (j = 0; j < gmarkers.length; j++) {
                                if (r.equals(gmarkers[j].getPosition())) {
                                    gmarkers[j].IWcontent += "<hr>" + o;
                                    break;
                                }
                            }
                            if (i == 0 || j == gmarkers.length) {
                                var marker = new google.maps.Marker({
                                    position: r,
                                    map: k,
                                    IWcontent: o
                                });
                                google.maps.event.addListener(marker, 'click', function (evt) {
                                    m.setContent(this.IWcontent);
                                    m.open(k, this);
                                });
                                gmarkers.push(marker);
                            }

              }


text:
Q: Show that the unit sphere in $\mathbb{R}^3$ is pathwise(=arcwise) connected? I know this  question has been already asked but no one does not address the definition of pathwise(=arcwise) connectedness as the following:
A set $C$ in metric space $(M,d)$ is pathwise(=arcwise) connected if any two points of $C$ can be joined by an arc that is entirely lies in $C$.
Formally,
$$
\forall p,q \in C\,\,\, \exists \,\,\,\, \phi: [a,b] \rightarrow C \,\,\, \text{s.t.} \phi(a)=p, \phi(b)=q
$$
where $\phi$ is a continuous function.
Now to show sphere is pathwise(=arcwise) in $\mathbb{R}^3$ we need such a $\phi$ that maps a closed interval in $\mathbb{R}$ to the sphere.
What is that function $\phi$ and that interval?
This is my homework problem and what we have learned in our real analysis course is the above so the professor expects us to solve the problem from the above point of view.
Please answer in this direction.

A: So there are many ways to show that a space is path connected. Spherical coordinates may be more difficult then the approach I propose. We start with this useful fact:

Lemma. If $f:X\to Y$ is a continous function and $X$ is path connected then so is the image $f(X)$.

The proof is quite simple: you take two points $a,b\in f(X)$, you connect points from their preimages and then compose that newly created path with $f$. $\Box$
With that you have a new tool to show that some space $Y$ is path connected. You first show that a different space $X$ is path connected (which might be easier) and then you show that $Y$ is a continuous image of $X$. So let's have a look at a simplier space:

Fact. $\mathbb{R}^n\backslash\{0\}$ is path connected for $n>1$.

Proof. Indeed, let $v,w\in\mathbb{R}^n$, $v,w\neq 0$. We will consider two cases:
(1) if $v, w$ are linearly independent then the path we are looking for is given by
$$\varphi:[0,1]\to\mathbb{R}^n\backslash\{0\}$$
$$\varphi(t)=tv+(1-t)w$$
You can easily verify that this is a well defined continous function. The assumption that $v,w$ are linearly independent obviously means that $\varphi(t)\neq 0$ for any $t$.
(2) for $v,w$ linearly dependent take any point $z\in\mathbb{R}^n$ such that $z$ does not lie on the line connecting $v, w$ (or in other words such that $v,z$ are not linearly dependent). Such point always exists when $n>1$, you gain it by taking $v=(v_1,\ldots, v_n)$, now taking its first non-zero coordinate say $v_m$ and reversing its sign into $-v_m$.
In that case we can apply (1) to both $(v,z)$ and $(z,w)$ pairs in order to produce two paths. You join those two paths to complete the proof. $\Box$

Fact. The $n$-dimensional sphere $\mathbb{S}^n=\{v\in\mathbb{R}^{n+1}\ |\ \lVert v\rVert=1\}$ is path connected for $n\geq 1$.

Proof. Let
$$N:\mathbb{R}^{n+1}\backslash\{0\}\to \mathbb{S}^n$$
$$N(v)=\frac{v}{\lVert v\rVert}$$
and note that this is a surjective, continuous function. Both Lemma and previous Fact apply. $\Box$

A: You can try to use stereographic projection  $ \sigma : \Bbb{S}^2\smallsetminus \{*\} \to  \Bbb{R}^2$ with appropriate "north pole" each time you want to construct a path between two points $p$ and $q$ in $\Bbb{S}^2$.

The key fact is that the stereographic projection is a homeomorphism, so we can pass the path in the plane to the sphere.

For any two points  $p,q \in \Bbb{S}^2\smallsetminus \{*\} $ you have the corresponding points $\sigma(p),\sigma(q)\in \Bbb{R}^2$. Choose a path $\gamma : I \to  \Bbb{R}^2$ joining those points, and then compose it with $\sigma^{-1}$. So you have path $\sigma ^{-1} \circ \gamma : I \to \Bbb{S}^2\smallsetminus \{*\}$ joining $p$ and $q$. If you want to be strict, just composing it one more time with inclusion map $ i : \Bbb{S}^2\smallsetminus \{*\} \hookrightarrow \Bbb{S}^2$. Then you are done.

Alternatively (without constructing paths), note that $\Bbb{S}^2$ is the image of the continous map $ \pi : \Bbb{R}^3 \smallsetminus \{0\} \to \Bbb{R}^3$ defined by $x \mapsto \frac{x}{||x||}$. Since the image of any path-connected space under a continous map is path-connected, therefore $\Bbb{S}^2$ is path-connected.


text:
Q: Production mode: what is "the best way"\"the most commonly used approach" to change and add data in database? I am using Ruby on Rails v3.0.9 and I have a web application running in production mode. I would like to change and add some data in the database (also, I would like to make that these data changes take effect in development mode - that is, for example, that the added data should be present also in development mode when I am running and developing my application on my local machine)...
... what is "the best way"\"the most commonly used approach" to do that? I mean, for example, should I create a migration file with in some User.create(:name => '...', :surname => '...', ...) statements and run those or there are other ways to accomplish what I would like to do?
Note: I do not need to populate the database with initial data (I already made that in the seed.rb file). I just need to update and add database table rows.

A: seed.rb should be use only for initial set of values.
rake task should be use only when you want to update data any existing columns.
migration should be use when you need to change the schema of the table.

A: You should use the file db/seed.rb to accomplish this task
Here is an example on how to use it: http://asciicasts.com/episodes/179-seed-data


text:
Q: Passing a New Object as an Argument: Is it Possible? Is it possible to do the following - allowing for a properly coded constructor:
object1.method(new objectType1(argument1, argument2));

Here, object1 contains objects of objectType2.
So, consider the following code:
portfolio.addInvestment(new StockInvestment(stock, numshares));

addInvestment adds an object of type StockInvestment to an ArrayList . So, addInvestment receives an object of type StockInvestment

A: Yes, this is perfectly normal in Java


text:
Q: How to hide or modify header from window.print()? I created a view which look like a PDF document. Now I want to print it using window.print(), but when I run this code it generates header and footer.
I change the footer using this code:
let footer = "Nr"+this.contractForm.contract_number+this.datePipe.transform(this.contractForm.date, 'd.MM.yyyy');
window.history.pushState("object or string", "Title", footer.replace("http://", ""));
I want to remove header (it generates date and (I think) title).
I tried to use remove header and footer from window print
And many similar solutions.
Summarizing, I want to remove header from generated file.

A: You can use CSS rules for this (or SCSS, if you wish).
Here is an example where I hide the .hideme class. You can click the print button to see it in action.

.hideme {
  border: 5px solid black;
  height: 100px;
}

.showme {
  border: 5px dotted black;
  height: 100px;
}

@media print {
  .hideme {
    display: none;
  }
}

  Will be hidden

  Will be shown

<button onclick="print()">
  Print
</button>

I've also created an example in StackBlitz using SCSS and Angular if you want to see that in action.


text:
Q: Java Error: Bad Operand Type for binary operator < public class MaxMinArray<T>{

  private T getMin(T[] arr){

    T min = arr[0];
    for (int i = 0; i<arr.length; i++){
      min = (arr[i] < min) ? arr[i] : min;
    }
    return min;
  }

 public static void main(String[] args) {

  MaxMinArray<Integer> m = new MaxMinArray<Integer>();
  Integer[] arr = {1,2,3,4,5};
  System.out.println(m.getMin(arr));

  }

}

I am getting the following error. I dont understand why can I not use <, if T is a type variable and not an object ?
  error: bad operand types for binary operator '<'
      if (arr[i] < min){
                 ^
  first type:  T
  second type: T
  where T is a type-variable:
    T extends Object declared in class MaxMinArray

Also, since I am using T for generics, is it a good idea to define my array as Integer and not int. If not, how should I define an array of integers?
Thank you!

A: arr[i] contains some Object of some generic type T. You cannot use the < operator on an Object.
Do this instead:
public class MaxMinArray<T extends Comparable<T>> {

    private T getMin(T[] arr){
         T min = arr[0];
         for (int i = 0; i<arr.length; i++){
             min = (arr[i].compareTo(min) < 0) ? arr[i] : min;
         }
         return min;
    }
    // ...


text:
Q: Using Moq for Generic methods Totally simple situation, but I can't make it work.  I am running into an issue with using Moq to mock a generic method (in this case, on a Ninject Kernel interface):
T Get<T>();

I set up my mock object:
Mock<IKernel> mockKernel = new Mock<IKernel>();
        mockKernel.Setup(x => x.Get<IGetUserQuery>()).Returns(new GetUserQuery());

At runtime I get the following exception:
Expression references a method that does not belong to the mocked object: x => x.Get<IGetUserQuery>(new[] {  })

Any idea why it's throwing this?  I've mocked generics in Moq before without a problem...  are there cases in which generic mocking isn't supported?  This seems like a straightforward case.  The only wrinkle is that IGetUserQuery in turn inherits from a genericized type:
IGetUserQuery : ICommand<UserQueryInput, UserQueryOutput>

I don't see this creating a problem because the generic types for this implementation of ICommand are staticly defined by IGetUserQuery, so I doubt this is confusing Moq.
Thanks in advance

A: The problem is that T Get<T> () isn't actually a method defined in the IKernel interface, it is an extension method defined here.
Why are you trying to mock T Get<T> () in the first place? Interaction with the IoC container should be absolutely minimal, usually just at the toplevel "entry point" to your system.


text:
Q: Is there a way to get SQL Server capcity constraints dynamically I have some code which creates database tables dynamically, and I want to ensure that people don't try to do things that result in me trying to create a table with more columns than what SQL Server allows.
According to this article, the limit for the max number of columns per (nonwide) table is 1024.
However, this can obviously change in the future, so I don't want to hardcode it in my app.
Is there a way to get this value dynamically using a SQL query (e.g. by reading from some system table or proc)?

A: No there's nothing built in that is exposed to us.
Your app would need to maintain some sort of configuration table itself.
You can't even try and parse it out of sys.messages as it isn't hardcoded into the text for message_id=1702.

CREATE TABLE failed because column '%.*ls' in table '%.*ls' exceeds
  the maximum of %d columns.

Your app could of course try and dynamically discover the limit by simply trying CREATE TABLE statements with ever greater amounts of columns but that is not a serious suggestion.