text:
Q: CurrentProject vs CurrentDb I'm new to VBA and very new to SQL so I don't quite understand why I am having this problem. I'm trying to import excel files into an access database. For a few reasons I have to store my excel data into an array and then upload that array into a temporary table and then append the pertinent parts of the table. To my current understanding, the best way to get my data from my array into a new temporary table would be to create that table and then populate it row by row using SQL. My problem is that when I try to create the table, I get an error. I've simplified my code, I believe this contains what you need to know.
Dim strSQL As String
strSQL = "CREATE TABLE TestTable (`Value` VARCHAR(20))"
CurrentDb.Execute strSQL

This works fine
Dim strSQL As String
strSQL = "CREATE TABLE TestTable (`Value` DECIMAL(4,2))"
CurrentDb.Execute strSQL

This results in run-time error 3292 "Syntax error in field definition"
Dim strSQL As String
strSQL = "CREATE TABLE TestTable (`Value` DECIMAL(4,2))"
CurrentProject.Connection.Execute strSQL

This works fine
Is there a reason why I should ever use one over the other? Simply changing to CurrentProject seems to fix any problems I have but I just want to understand what is happening here. I have done my own research but any answer I find goes over my head (again, I am relatively new to VBA). I apologize in advance, there may be no answer that I am currently able to comprehend

A: IIRC, CurrentDb.Execute supports a different ANSI SQL standard, I think ANSI 89, although I could be wrong. CurrentProject.Connection.Execute supports ANSI 92, which allows that statement to execute correctly. It's a different spec of the SQL language. If you've ever used or will use SQL server this becomes obvious pretty quickly.
You should notice that your SQL statement won't work either trying to run it as a plain SQL query either. To run this successfully as a query, one option is to enable ANSI 92 as it isn't enabled by default in Access. See below for the relevant option to toggle.

That being said, changing the SQL standard may be less than ideal if you are familiar with Access' SQL syntax, however it might be very helpful if you already have experience with SQL Server. Also worth noting, changing the ANSI option in Access won't change how CurrentDB.Execute runs executes SQL statements in VBA, you'll still need the current approach, or running a stored query.


text:
Q: How to tell Nginx to not rewrite URL's in selected location I am writing some PHP CMS code with a clean url implementation in Nginx.  To improve security of my code I want to rewrite all of the requests in my root directory / using the following type:
rewrite ^(.*)$ /index.php?q=$1 last;

With this kind of rewrite the rest of the php scripts will not be accessible from the user's side (they will be only, if included in php, am I right?).  However, I do not want to rewrite the request in one location (for mi that will me /static/), because I will be serving only static content such as images and css from that location.  How can I make this rewrite not work in certain locations?

A: Understanding and using the location directive should solve your problem. When location is followed only by a prefix string (i.e. without modifiers such as '=', or '~*'), the longest prefix string is matched first. For example:
server {
    server_name example.org;
    root /var/www/site;

    location / {
        # Configuration A
    }

    location /static {
        # Configuration B
    }

In this configuration, the URL example.org/static/foo.gif would match Configuration B because the prefix string /static is longer than /. Meanwhile, example.org/index.php?q=bar would match Configuration A because that is the only match.
You could then have Configuration A serve up content with PHP, while Configuration B serves static content.
Also, I would highly recommend reading through the Nginx Pitfalls page, if you haven't already. It addresses some issues that are highly relevant in your situation, such as taxing rewrites, using fastcgi_pass safely, and so forth.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to pass multiple parameters to the shebang as of today The last time I searched for it I concluded it's not possible, or at least not portable, so I gave up and forgot.
However, in a comment to this answer I posted, I was suggested to check env's man page, which contains the following

   -S, --split-string=S
          process and split S into separate arguments;
          used to pass multiple arguments on shebang lines

Searching for "multiple parameters" shebang only finds 3 results, and none of those mentions this option.
What is state of this topic at the moment in terms of support and portability?


text:
Q: Arithmetic operation overflow when running Oracle SQL I've got a canned function in a class library to run a SQL query based on passed in query text. It works fine in most cases, but results in the error referenced in the title for a particular SQL query I'm trying to automate through it.
The entirety of the function from the class library:
''' <summary>
''' Attempts to execute the query provided and returns a datatable with the results (check for column ErrMsg to check for errors)
''' </summary>
''' <param name="FName">The name of the method requesting the query be executed</param>
''' <param name="path">The full file path to log any errors to</param>
''' <param name="QTxt">The query text to execute</param>
''' <param name="Close">Boolean to indicate whether the connection should be closed after the query is completed</param>
''' <param name="DB">The database to connect to (in case no connection is currently established)</param>
''' <param name="UName">The username to connect with (in case no connection is currently established)</param>
''' <param name="PWord">The password to connect with (in case no connection is currently established)</param>
''' <returns>A Data Table with the results of the query (on error one row and column added to return error message)</returns>
''' <remarks></remarks>
Public Function RunQuery(ByVal FName As String, ByVal path As String, ByVal QTxt As String, ByVal Close As Boolean, ByVal DB As String, ByVal UName As String, _
                         ByVal PWord As String) As Data.DataTable
    '
    Dim dt As New Data.DataTable
    Dim oda As New Oracle.DataAccess.Client.OracleDataAdapter
    Dim cmd As New Oracle.DataAccess.Client.OracleCommand

    'Establish &/or Open connection as needed
    Try
        'Connection established?
        If IsNothing(scon) Then 'scon is an Oracle connection variable associated with the class this method is part of
            EstablishCon(DB, UName, PWord, path, FName)
        End If

        'Is the connection open?
        If scon.State <> ConnectionState.Open Then
            scon.Open()
        End If
    Catch ex As Exception
        'Capture the base error
        Dim msg As String = "Encountered an error while attempting to create and/or open the database connection to run the query for " & FName & "."

        'Log the error with details (EL is an error logging class from the same library)
        EL.AddErr(msg & " Error Details: " & ex.Message, path)

        'Put the error into the data table for return, so that we can handle it on the other end
        dt.Columns.Add("ErrMsg")
        Dim r As DataRow
        r = dt.NewRow
        r.Item(0) = msg

        'Exit
        Return dt
        Exit Function
    End Try

    'Build the command
    Try
        cmd.Connection = scon 'CMD is an Oracle command variable on the class
        cmd.CommandText = QTxt
    Catch ex As Exception
        'Capture the base error
        Dim msg As String = "Encountered an error while attempting to create the command to run the query for " & FName & "."

        'Log the error with details
        EL.AddErr(msg & " Error Details: " & ex.Message, path)

        'Put the error into the data table for return, so that we can handle it on the other end
        dt.Columns.Add("ErrMsg")
        Dim r As DataRow
        r = dt.NewRow
        r.Item(0) = msg
        dt.Rows.Add(r)

        'Exit
        Return dt
        Exit Function
    End Try

    'Build the data adapter & Execute
    Try
        oda.SelectCommand = cmd 'oda is an Oracle Data Access variable
        oda.Fill(dt) 'This is the line throwing the exception
    Catch ex As Exception
        'Capture the base error
        Dim msg As String = "Encountered an error while attempting to execute the query for " & FName & "."

        'Log the error with details
        EL.AddErr(msg & " Error Details: " & ex.Message, path)

        'Clear dt to prevent bad/partial data from being returned
        dt.Clear()
        Dim cl As New List(Of String)
        For Each c As DataColumn In dt.Columns
            cl.Add(c.ColumnName)
        Next
        For Each c As String In cl
            dt.Columns.Remove(c)
        Next

        'Put the error into the data table for return, so that we can handle it on the other end
        dt.Columns.Add("ErrMsg")
        Dim r As DataRow
        r = dt.NewRow
        r.Item(0) = msg
        dt.Rows.Add(r)
    End Try

    'Clean up
    Try
        oda.SelectCommand = Nothing
        oda.Dispose()
        oda = Nothing
        cmd.Connection = Nothing
        cmd.CommandText = Nothing
        cmd.Dispose()
        cmd = Nothing
        If Close Then
            scon.Close()
            scon.ConnectionString = Nothing
            scon.Dispose()
            scon = Nothing
        End If
    Catch ex As Exception
        EL.AddErr("Encountered an error while cleaning up from the query execution for " & FName & ". Error Details: " & ex.Message, path)
    End Try

    Return dt
End Function

The SQL being passed in (blank lines added for readability):
SELECT to_date('12-29-2013', 'MM-DD-YYYY') + to_Char(trunc(fcr.Actual_Start_Date) - to_date('12-29-2013', 'MM-DD-YYYY') -
    to_char(fcr.Actual_Start_Date + 1, 'DAY', 'NLS_DATE_LANGUAGE=''numeric date language''') + 1) SWeek,
    to_date('12-29-2013', 'MM-DD-YYYY') + to_Char(trunc(fcr.Actual_Start_Date) - to_date('12-29-2013', 'MM-DD-YYYY') -
    to_char(fcr.Actual_Start_Date + 1, 'DAY', 'NLS_DATE_LANGUAGE=''numeric date language''') + 7) EWeek,
    fcp.concurrent_program_name PName, NVL(ro.ou_name, 'system') OU, NULL BGrp,
    count(*) total_cr_executions,sum(round(((fcr.actual_completion_date-fcr.actual_start_date)*1440),2)) TRtM,
    ((sum(round(((fcr.actual_completion_date-fcr.actual_start_date)*1440),2)))/count(*)) ARtM,
    sum(round(((fcr.actual_start_date-fcr.requested_start_date)*1440),2)) TWtM,
    ((sum(round(((fcr.actual_start_date-fcr.requested_start_date)*1440),2)))/count(*)) AWtM

    FROM hotsosp.XXFND_RESPONSIBILITY_OU ro,HOTSOSP.HWC_FND_CONCUR_PROGRAMS fcp,HOTSOSP.HWC_FND_CONCUR_REQUESTS fcr

    WHERE ro.responsibility_id (+) = fcr.responsibility_id AND ro.application_id (+) = fcr.responsibility_application_id
    AND fcp.concurrent_program_id = fcr.concurrent_program_id AND fcp.application_id = fcr.program_application_id
    AND fcr.Oracle_Session_ID Is Not Null AND fcr.actual_start_date >= to_date('07/12/2015','mm/dd/yyyy')
    AND fcr.actual_start_date < to_date('07/12/2015','mm/dd/yyyy')+7

    GROUP BY
    to_date('12-29-2013', 'MM-DD-YYYY') + to_Char(trunc(fcr.Actual_Start_Date) - to_date('12-29-2013', 'MM-DD-YYYY') -
    to_char(fcr.Actual_Start_Date + 1, 'DAY', 'NLS_DATE_LANGUAGE=''numeric date language''') + 1),
    to_date('12-29-2013', 'MM-DD-YYYY') + to_Char(trunc(fcr.Actual_Start_Date) - to_date('12-29-2013', 'MM-DD-YYYY') -
    to_char(fcr.Actual_Start_Date + 1, 'DAY', 'NLS_DATE_LANGUAGE=''numeric date language''') + 7),
    fcp.concurrent_program_name, NVL(ro.ou_name, 'system'), NULL

    ORDER BY 1,4,5

I would say it's a problem with the SQL, but when I run that exact same SQL through Toad it executes, as well as outputs to Excel, with no trouble.
Any thoughts would be much appreciated.
EDIT:
The call to RunQuery looks like this:
oo.RunQuery(f, Epath, Replace(CRQ, ":Dt", d), False, "HAWCSP", UName.Text, PWord.Text)

Where CRQis a variable that's hardcoded to
Public CRQ As String = "SELECT to_date('12-29-2013', 'MM-DD-YYYY') + to_Char(trunc(fcr.Actual_Start_Date) - to_date('12-29-2013', 'MM-DD-YYYY') - " & _
    Chr(10) & "to_char(fcr.Actual_Start_Date + 1, 'DAY', 'NLS_DATE_LANGUAGE=''numeric date language''') + 1) SWeek, " & _
    Chr(10) & "to_date('12-29-2013', 'MM-DD-YYYY') + to_Char(trunc(fcr.Actual_Start_Date) - to_date('12-29-2013', 'MM-DD-YYYY') - " & _
    Chr(10) & "to_char(fcr.Actual_Start_Date + 1, 'DAY', 'NLS_DATE_LANGUAGE=''numeric date language''') + 7) EWeek, " & _
    Chr(10) & "fcp.concurrent_program_name PName, NVL(ro.ou_name, 'system') OU, NULL BGrp, " & _
    Chr(10) & "count(*) total_cr_executions,sum(round(((fcr.actual_completion_date-fcr.actual_start_date)*1440),2)) TRtM, " & _
    Chr(10) & "((sum(round(((fcr.actual_completion_date-fcr.actual_start_date)*1440),2)))/count(*)) ARtM, " & _
    Chr(10) & "sum(round(((fcr.actual_start_date-fcr.requested_start_date)*1440),2)) TWtM, " & _
    Chr(10) & "((sum(round(((fcr.actual_start_date-fcr.requested_start_date)*1440),2)))/count(*)) AWtM " & _
    Chr(10) & "FROM hotsosp.XXFND_RESPONSIBILITY_OU ro,HOTSOSP.HWC_FND_CONCUR_PROGRAMS fcp,HOTSOSP.HWC_FND_CONCUR_REQUESTS fcr " & _
    Chr(10) & "WHERE ro.responsibility_id (+) = fcr.responsibility_id AND ro.application_id (+) = fcr.responsibility_application_id " & _
    Chr(10) & "AND fcp.concurrent_program_id = fcr.concurrent_program_id AND fcp.application_id = fcr.program_application_id " & _
    Chr(10) & "AND fcr.Oracle_Session_ID Is Not Null AND fcr.actual_start_date >= to_date(:Dt,'mm/dd/yyyy') " & _
    Chr(10) & "AND fcr.actual_start_date < to_date(:Dt,'mm/dd/yyyy')+7 " & _
    Chr(10) & "GROUP BY " & _
    Chr(10) & "to_date('12-29-2013', 'MM-DD-YYYY') + to_Char(trunc(fcr.Actual_Start_Date) - to_date('12-29-2013', 'MM-DD-YYYY') - " & _
    Chr(10) & "to_char(fcr.Actual_Start_Date + 1, 'DAY', 'NLS_DATE_LANGUAGE=''numeric date language''') + 1), " & _
    Chr(10) & "to_date('12-29-2013', 'MM-DD-YYYY') + to_Char(trunc(fcr.Actual_Start_Date) - to_date('12-29-2013', 'MM-DD-YYYY') - " & _
    Chr(10) & "to_char(fcr.Actual_Start_Date + 1, 'DAY', 'NLS_DATE_LANGUAGE=''numeric date language''') + 7), " & _
    Chr(10) & "fcp.concurrent_program_name, NVL(ro.ou_name, 'system'), NULL " & _
    Chr(10) & "ORDER BY 1,4,5"

d is calculated as follows
 Dim da As Date = DateAdd(DateInterval.Day, -1 * DatePart(DateInterval.Weekday, Today) - 6, Today)
 Dim d As String = "'" & DatePart(DateInterval.Month, da) & "\" & DatePart(DateInterval.Day, da) & "\" & DatePart(DateInterval.Year, da) & "'"

Which comes out to '07/12/2015' for today's date (7/24/15)


text:
Q: How can you set a floor to the gaussian decay function in ElasticSearch? I am trying to use Elastic Search for storing geo spatial data. However I want the relevance score to be a combination of the distance from a point and the relevance based on text matching queries. For example, lets say that the query is Yellowstone National Park, but the origin is in Chicago. Portage Park in Chicago is more likely to match because for any reasonable distance and decay because Yellowstone National Park will have a decay score close to zero and won't show up in the results at all. What I'd like to do is to have a FLOOR on the decay score, so that beyond a certain distance, all results look the same.
For example, here's the Java code I have:
      queryBuilder = new FunctionScoreQueryBuilder(queryBuilder).add(
      ScoreFunctionBuilders.gaussDecayFunction("search_geo_point", point.get(), "10km")
          .setDecay(0.75)
          .setOffset("5km"));

What I'd like to do is treat all points that are greater than say 30km from the origin as identical, and have the decay function no longer reduce the score beyond that point. Is this possible? The problem is that beyond a certain distance the decay function reduces the relevance so much that even if the query is an exact match for a text field, it does not appear in the results.

A: I don't know of a feature implemented within function score in Elasticsearch, although it would be very handy.
However, you can achieve your goal with a small workaround by using the filter clauses in the function query:
POST test/parks/_search
{
  "query": {
    "function_score": {
      "query": {
        "match": {
          "name": "Yellowstone National park"
        }
      },
      "functions": [
        {
          "gauss": {
            "location": {
              "origin": "41.4881832, -87.623177",
              "scale": "10km",
              "offset": "5km"
            }
          },
          "filter": {
            "geo_distance_range": {
              "from": "0km",
              "to": "30km",
              "location": {
                "lat": 41.881832,
                "lon": -87.623177
              },
              "include_upper": false
            }
          }
        },
        {
          "weight": ## Set appropriate weight,
          "filter": {
            "geo_distance_range": {
              "from": "30km",
              "location": {
                "lat": 41.881832,
                "lon": -87.623177
              },
              "include_lower": true
            }
          }
        }
      ]
    }
  }
}

With the query above, you only apply the gauss function score to hits within the range of 30km. In the second filter clause, you define a constant score for all hits, which are further afar.
Note that you should set include_upper and include_lower appropriately to prevent scoring the same element multiple times.


text:
Q: What is the best way to run a loop of regressions in R? Assume that I have sources of data X and Y that are indexable, say matrices. And I want to run a set of independent regressions and store the result. My initial approach would be
results = matrix(nrow=nrow(X), ncol=(2))
for(i in 1:ncol(X)) {
        matrix[i,] = coefficients(lm(Y[i,] ~ X[i,])

}

But, loops are bad, so I could do it with lapply as
out <- lapply(1:nrow(X), function(i) { coefficients(lm(Y[i,] ~ X[i,])) } )

Is there a better way to do this?

A: You are certainly overoptimizing here. The overhead of a loop is negligible compared to the procedure of model fitting and therefore the simple answer is - use whatever way you find to be the most understandable. I'd go for the for-loop, but lapply is fine too.

A: I do this type of thing with plyr, but I agree that it's not a processing efficency issue as much as what you are comfortable reading and writing.

A: If you just want to perform straightforward multiple linear regression, then I would recommend not using lm().  There is lsfit(), but I'm not sure it would offer than much of a speed up (I have never performed a formal comparison).  Instead I would recommend performing the (X'X)^{-1}X'y using qr() and qrcoef().  This will allow you to perform multivariate multiple linear regression; that is, treating the response variable as a matrix instead of a vector and applying the same regression to each row of observations.
Z # design matrix
Y # matrix of observations (each row is a vector of observations)
## Estimation via multivariate multiple linear regression
beta <- qr.coef(qr(Z), Y)
## Fitted values
Yhat <- Z %*% beta
## Residuals
u <- Y - Yhat

In your example, is there a different design matrix per vector of observations?  If so, you may be able to modify Z in order to still accommodate this.


text:
Q: referent of 'such a conviction' The following is taken from the novel Frankenstein:

At that age I became acquainted with the celebrated poets of our own country; but it was only when it had ceased to be in my power to derive its most important benefits from such a conviction that I perceived the necessity of becoming acquainted with more languages than that of my native country.

I'm wondering what  such a conviction refers to. The context doesn't make it clear to me.

A: Conviction here means a strongly held belief or opinion, i.e., something one is convinced of.  And you'll have to widen the context a bit to find a stated opinion.

But it is a still greater evil to me that I am self-educated: for the first fourteen years of my life I ran wild on a common, and read
  nothing but our uncle Thomas's books of voyages. At that age I became
  acquainted with the celebrated poets of our own country; but it was
  only when it had ceased to be in my power to derive its most important
  benefits from such a conviction that I perceived the necessity of
  becoming acquainted with more languages than that of my native
  country. Now I am twenty-eight, and am in reality more illiterate than many schoolboys of fifteen.

So the letter writer is convinced that the greater lack in his life is that he has no formal education, one that might have instructed him in languages other than his native tongue.  But, alas, he has come to that realization too late for it to be of benefit: he's too old at age 28 for such study.

A: I largely agree with deadrat's answer,
but I believe that the referenced conviction is

the necessity of becoming acquainted with more languages
  than that of my native country

i.e., when he was young, sophomoric, and parochial,
he believed that knowing his native language was all he needed.
Eventually he saw the wisdom in being more diversified,
but by then he no longer had the mental flexibility to learn new languages.


text:
Q: Does this psu have enough power for this graphics card? PSU: http://www.newegg.com/Product/Product.aspx?Item=N82E16817139049
GPU: http://www.newegg.com/Product/Product.aspx?Item=N82E16814125491
While looking over for the specs for the PSU, I noticed it only had 1 PCI-E power connector, while the graphics card takes two. Am I simply misreading this or do I need a different PSU?

A: The R9 270 uses 150W of power. I don't know what other equipment you have in your computer, but it doesn't sound like you will have sufficient power. I recommend at least a 500W PSU for an otherwise standard PC build.
If you're not sure how much your computer consumes, try to virtually build the system on http://pcpartpicker.com (including all disks, fans, optical drives, CPU, RAM and everything else that consumes power). It will let you know if you have any problems with your build.

A: On the Gigabyte page they state that that GPU requires a 500W PSU with two 6-pin external power connectors. The PSU you link to is only 430W and only has one 6-pin external power connector.
Look for PSU with at least 500W and with two 6-pin external power connectors


text:
Q: jQuery b is undefined during animate callback I'm making a slider and this is the meat of my code;
$('#slider a').click(function () {
                elem.filter(this.hash).addClass("active").animate({"right":"0"}, 3000,
                    function() {
                        elem.filter(activeElem).removeClass("active");
                        activeElem = elem.filter(this.hash);
                    });

I'm trying to remove the class "active" from the existing viewable element, then adding "active" to the new element.  Yet, when I run it, I get a an error in Firebug sayed, "b is undefined" and in IE that "nodeType is null or not an object".
Can you not set variables in a callback function?

A: Since you're storing activeElem as a jQuery object anyway, you can simplify your code and remove the probably offending .filter() check, like this:
$('#slider a').click(function () {
   $(this).addClass("active").animate({"right":"0"}, 3000, function() {
      activeElem.removeClass("active");
      activeElem = $(this);
   });
});

I can't say for sure what your error on the filter check is currently without seeing how you're initializing the collections, but since you're storing it as a jQuery element anyway, and .hash denotes an #ID selector the above should be a much simpler solution...or if there's only one .active class element, just do this:
$('#slider a').click(function () {
   $(this).addClass("active").animate({"right":"0"}, 3000, function() {
      $(".active").not(this).removeClass("active");
   });
});


text:
Q: Convert Month_Dt In sas I have a sample data in this format as char.
Month
2008-09
2007-10
2008-09

How to get the above as date '01sep2008' (SAS DESIGN STUDIO)

A: Use an input function
An input function is a function that interpretes a character variable using an informat. _(This is not exactly the same as an input statement, which interpretes text in an infile according to an informat.)
There might be an informat that imidiately interpretes strings like 2008-09 correctly, but I don't know one, so I just add a _01 to it and apply the informat yymmdd10.
Example
Depending on your situation (the data is inform a file or a dataset / you prefer data steps or sql / ...) the full solution would look like this:
data Before;
    input the_date $7.;
    datalines;
2008-09
2007-10
2008-09
;
data After;
    set Before (rename=(the_date=old_date));
    format the_date date9.;
    the_date = input(old_date||'-01', yymmdd10.);
    * while testing the code, uncomment the following line :
    drop old_date;

proc print;
run;

A: There are a few ways to do this.  Dirk has a good method concatenating a day onto the string and using the INPUT() function.
You could also use the yymmn6. informat with the INPUT().  That requires you to strip the '-' from the string.
data test;
x = '2008-05';
format y date9.;
y = input(compress(x,"-"),yymmn6.);
put y;
run;

You could use the MDY() to specify the Month, Day and Year.  Here you use the SCAN() function to pick out the month and year from the string using '-' as a delimiter.
data test;
x = '2008-05';
format y date9.;
y = mdy(scan(x,2,'-'),1,scan(x,1,'-'));
put y;
run;


text:
Q: Subversion svn:mergeinfo record in the trunk about itself I'm looking into a problem we have with a merge and I found something in the recent past that I hope somebody could tell me wether it is a sign of problem or not.
I found in the svn:mergeinfo on the ^/trunk itself the following record:
/trunk:1234

Is there a normal scenario where it is logical to have a merge info record in the trunk containing info about the trunk itself or is this the result of something that went wrong?
In case it's relevant: we didn't do renaming of the trunk. The "trunk record" in svn:mergeinfo seems to be added during a reintegrate merge of a feature branch
Edit:
It seems the /trunk:1234 mergeinfo record was unexpectedly added to the trunk together with the expected /branches/somebranch:1235-1241 when /branches/somebranch was reintegrated. It was the first time Subversion 1.8 was used hence it used the now automatic reintegration feature. Also the 1234 number is not random, it is the version the repository had right before the branch was was created.
We didn't find anything we could have done wrong. We concluded that it may have been a bug in the Subversion client (TortoiseSVN-1.8.4.24972-x64-svn-1.8.5)


text:
Q: Trying to use a batch file to work with filenames that have a forbidden character Okay, a brief explanation of what I am doing: I use Windows Media Center (Windows 7) to record Jeopardy every evening. I then use Handbrake to convert the .wtv files to .mkv files and then transfer them to my NAS so I can watch them later using Plex Media Server/Center. Rather than doing this "by hand", I'm trying to automate the process using a batch file as a scheduled task. Initially, I had set up a script so that I could right-click > Send To > convert.bat and it would initiate the command-line interface for Handbrake and convert the file, move the output to my NAS, and delete the original file (worked great).
Now, what I'm doing is initiating the batch script as a scheduled task and looping through the contents of my "recorded tv" directory and looping through any .wtv files to convert/move/delete them.
The problem lies in the fact that Windows Media Center correctly names the Jeopardy files with the "!" in them (Eg: Jeopardy!_KHQ_2012_12_04_21_12_12.wtv), which completely bricks my script. The "Send To" batch file worked great, but when I loop through the *.wtv files in the directory, it returns all the filenames with the "!" stripped out which means I can't do squat with them. Files without "!" do process without a hitch.
Thanks in advance to anyone who can get me pointed in the right direction! (and if you happen to see any other areas where this script could be improved, that's fine too...)
Here is the basic code that I am attempting to use:
@echo off

setlocal ENABLEDELAYEDEXPANSION

SET count=0
SET getFolder=C:\Users\Public\Recorded TV\
SET ripFolder=C:\Rips\
SET putFolder=Z:\Videos\Recorded TV\

FOR %%F IN ("%getFolder%*.wtv") DO (
SET /A count=!count!+1

REM DETERMINE OUTPUT FILENAME
for /f "tokens=5,6,7,8,9,10 delims=\_" %%a in ("%%F") do (
    set show=%%a
    set station=%%b
    set year=%%c
    set month=%%d
    set day=%%e
    set hour=%%f

    REM GENERATE OUTPUT NAMING CONVENTION
    set output=!show! s!year!e!month!!day! !hour!

)

REM PROCESS WITH HANDBRAKE CLI
"C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "%%F" -t 1 -c 1 -o %ripFolder%!OUTPUT!.mkv  -f mkv --deinterlace="fast" --crop 58:60:2:2 --strict-anamorphic  -e x264 -q 20 --vfr  -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0 --gain=0 --audio-copy-mask none --audio-fallback ffac3 -x ref=1:weightp=1:subq=2:rc-lookahead=10:trellis=0:8x8dct=0 --verbose=1

REM MOVE CONVERTED FILE TO NAS
copy "%ripFolder%!OUTPUT!.mkv" "%putFolder%"

REM DELETE ORIGINAL
del "%%F"

REM DELETE LOCAL RIP
del "%ripFolder%!output!.mkv"
)

echo %count% files processed

pause

ENDLOCAL

A: As you have recognized, the exclamation mark is stripped before you can escape it.
That's because you expand the FOR-loop variable %%F while delayed expansion is enabled, and the exclamation mark tries to expand a variable.
You need to toggle the delayed expansion here, as the variable contents are safe when using with delayed expansion, but to get the value you need the disabled mode.
@echo off
setlocal DisableDelayedExpansion
SET count=0

FOR %%F IN ("%getFolder%*.wtv") DO (
  set "orgFile=%%F"
  SET /A count+=1

  REM DETERMINE OUTPUT FILENAME
  for /f "tokens=5,6,7,8,9,10 delims=\_" %%a in ("%%F") do (
    set show=%%a
    set station=%%b
    set year=%%c
    set month=%%d
    set day=%%e
    set hour=%%f

    setlocal EnableDelayedExpansion
    REM GENERATE OUTPUT NAMING CONVENTION
    set output=!show! s!year!e!month!!day! !hour!
  )
  REM PROCESS WITH HANDBRAKE CLI
  "C:\Program Files\Handbrake\HandBrakeCLI.exe" -i "%%F" -t 1 -c 1 -o %ripFolder%!OUTPUT!.mkv  -f mkv --deinterlace="fast" --crop 58:60:2:2 --strict-anamorphic  -e x264 -q 20 --vfr  -a 1 -E faac -B 160 -6 dpl2 -R Auto -D 0 --gain=0 --audio-copy-mask none --audio-fallback ffac3 -x ref=1:weightp=1:subq=2:rc-lookahead=10:trellis=0:8x8dct=0 --verbose=1

  REM MOVE CONVERTED FILE TO NAS
  copy "%ripFolder%!OUTPUT!.mkv" "%putFolder%"

  REM DELETE ORIGINAL
  del "!orgFile!"

  REM DELETE LOCAL RIP
  del "%ripFolder%!output!.mkv"
  endlocal
)


text:
Q: How to use find_or_create in create action? I want to use find_or_create method in my game dates controller. I don't know how to use that method in create action, when params are in game_date_params. Any suggestion how can I extract date from game_date_params?
class GameDatesController < ApplicationController
  before_action :authenticate_user!
  before_action :authenticate_admin

  def index
    @game_dates = GameDate.all
    @showcases  = Showcase.joins(:game_dates)
  end

  def new
    @game_date = GameDate.new
    @game_date.referee_stats.build
  end

  def create
    @game_date = GameDate.new(game_date_params)
    if @game_date.save
      redirect_to showcases_path
      flash[:success] = "Game date created"
    else
      render 'new'
    end
  end

  def show
    @game_date = GameDate.find(params[:id])
  end

  def destroy
    @game_date = GameDate.find(params[:id]).destroy
    redirect_to root_url
    flash[:success] = "Game date deleted"
  end

  private

  def game_date_params
    params.require(:game_date).permit(:date, referee_stats_attributes: [ :games_count, :showcase_id ])
  end

This is output from POST action:

Started POST "/game_dates" for 127.0.0.1 at 2016-04-01 10:21:44 +0200
  Processing by GameDatesController#create as HTML   Parameters:
  {"utf8"=>"✓",
  "authenticity_token"=>"jmuOmMCO/WTFIkxrsw5l2cPVMqZAl7h11f281I+OyoHH3ddwKoB9ANAqvQEHulR88c7fzQXnnIaxs8FChMCjqw==",
  "game_date"=>{"date(1i)"=>"2016", "date(2i)"=>"4", "date(3i)"=>"1",
  "referee_stats_attributes"=>{"0"=>{"games_count"=>"4",
  "showcase_id"=>"1"}}}, "commit"=>"Create Game date"}   User Load
  (0.5ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER
  BY "users"."id" ASC LIMIT 1  [["id", 1]]   GameDate Load (0.4ms)
  SELECT  "game_dates".* FROM "game_dates" WHERE "game_dates"."date" IS
  NULL LIMIT 1    (0.2ms)  BEGIN   SQL (0.4ms)  INSERT INTO "game_dates"
  ("date", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING
  "id"  [["date", "2016-04-01"], ["created_at", "2016-04-01
  08:21:44.864669"], ["updated_at", "2016-04-01 08:21:44.864669"]]   SQL
  (0.4ms)  INSERT INTO "referee_stats" ("games_count", "showcase_id",
  "game_date_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4,
  $5) RETURNING "id"  [["games_count", 4], ["showcase_id", 1],
  ["game_date_id", 7], ["created_at", "2016-04-01 08:21:44.866897"],
  ["updated_at", "2016-04-01 08:21:44.866897"]]    (18.1ms)  COMMIT
  Redirected to http://localhost:3000/showcases Completed 302 Found in
  31ms (ActiveRecord: 20.1ms)

A: It should be like :
def create
    @game_date = GameDate.find_or_create_by(game_date_params)
    if @game_date.present?
      redirect_to showcases_path
      flash[:success] = "Game date created"
    else
      render 'new'
    end
 end

A: GameDate.find_or_create_by(game_date_params) would find record with ALL game_date_params, so you could do this by finding with specific params like date and assign rest of attributes to it via block. for example:
def create
  # find or initialize the record
  @game_date = GameDate.find_or_initalize_by(date: game_date_params[:date]) do |game_date|
    # Accept nested attributes as well
    game_date.assign_attributes(game_date_params)
  end

  if @game_date.save
    redirect_to showcases_path
    flash[:success] = "Game date created"
  else
    render 'new'
  end
end

See also: find_or_create_by and AttributesAssignment API docs

A: Create action is for creating an object after the new action has been called and update action if the same but for edit. Mixing create & update logic i not a good idea. Maybe you should rethink what are you trying to do in your views.


text:
Q: Common.Logging package update not compatible with Log4Net I have a dependency for Common.Logging.Log4Net1213 in my project and when trying to update it, i get:

Unable to resolve dependencies. 'Log4Net 2.0.8' is not compatible with
  'Common.Logging.Log4Net1213 3.4.1 constraint: Log4Net (= 2.0.3)'.

Why is this happening? I have Log4Net 2.8, so an earlier version of Common.Logging.Log4Net1213 is compatible with Log4Net 2.8 and the last version is not? I just don't understand.
Thank you for help.

A: On official, www.nuget.org website said that Common.Logging.Log4Net1213 logging framework has dependencies on Common.Logging (>= 3.4.1) and Log4Net (= 2.0.3). Unfortunately, as you can see there is no support for Log4Net version (2.0.8).
Please verify this description: https://www.nuget.org/packages/Common.Logging.Log4Net1213/

A: I was facing the same issue. I tried the Common.Logging.Log4Net208 and it worked for me.
You should first uninstall the Common.Logging.Log4Net1213 package and then install the new one. All the dependencies as Log4Net 2.0.8.0 will be installed.
And don't forget to modify all your App.config of all your different environments as below:
<logging>
  <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net208">
    <arg key="configType" value="INLINE" />
  </factoryAdapter>
</logging>

A: According to the tags of "Common.Logging.Log4Net" on NuGet, unless I'm mistaken, it looks like there is a version that is compatible with 2.0.8: https://www.nuget.org/packages/Common.Logging.Log4Net208/


text:
Q: update conda behind firewall I am trying to update conda but I am behind a corporate firewall.
I followed these instructions
and using:
conda config --set ssl_verify no

I managed to establish a connection.
However, when trying to update packages through conda (instead of pip), conda always tries to update everything and I receive the following connection broken errors:

Any suggestion on how to proceed? is there a way to update conda one package at a time?
EDIT
Some of the packages gets actually downloaded and if I try to run the same command again they won't be downloaded again. However for most of them the download is not completed (I have now tried several times and it seems that is always the same packages that are left to be downloaded).

EDIT 2
output of conda config --show

A: The error message indicates that the remote host closed the connection:

WSAECONNRESET 10054
  Connection reset by peer. An existing connection
  was forcibly closed by the remote host.

I would suggest to change the order of your channels and try to download from defaults first. You can find example here: https://stackoverflow.com/a/50671425/9020666
You can also update single package by conda with:
conda update _PACKAGE_NAME_
e.g:
conda update python


text:
Q: xCode Objective C: Custom UITableViewCell Connections I'm trying to implement a custom UITableView cell as the prototype for a tableview. So I make a custom class called CustomCell and set the class in the protoype cell from UITableViewCell to CustomCell, but I'm not sure how to connect my UI elements inside the prototype cell to their corresponding Outlets inside CustomCell (because custom cell isn't a view controller).

A: It doesn't matter that custom cell isn't a view controller, you can ctrl-drag and drop your outlets in exactly the same way from the view elements in Interface Builder to your CustomCell.h file.

A: Try for example this tutorial: http://www.e-string.com/content/custom-uitableviewcells-interface-builder


text:
Q: Does the index a bucket changes when rehashing occurs? In a simple design of a hashtable, the hashcode of an object will mod with the num of the buckets to produce an index. The object will be put into the bucket of this index.
My question is that when rehashing occurs, the num of buckets doubling itself, at this time does every object need to recalculate the index, hashcode mod with the new num?  I guess is yes.
I will be appreciated if anyone walks me through the rehashing process more clearly.

A: Yes in rehashing every element would move to their own new bucket based on hashcode and new size. See this document for simple one liner.


text:
Q: Trigger a Miss count when button is not click android I'm creating a simple whack a mole game using buttons,so far I only managed to get the score of the game when the button is clicked into the count.How do I register a miss count when button is not pressed?
b1 = (Button) findViewById(R.id.button1);
    b1.setOnClickListener(this);
b2 = (Button) findViewById(R.id.button1);
    b1.setOnClickListener(this);

b1 = (Button)findViewById(R.id.button1);
b2 = (Button)findViewById(R.id.button2);
final Handler handler = new Handler();
        Runnable runnable = new Runnable() { public void run() {

                int x1= r1.nextInt(array.length);
                int x2= r2.nextInt(array.length);

                b1.setText(array[x1].toString());
                b1.setText(array[x1].toString());

                int rando = (int)((Math.random()) * 2000);

                handler.postDelayed(this, rando);  //for interval...
            }
        };

handler.postDelayed(runnable, 2000);
public void onClick(View v) {
    // TODO Auto-generated method stub
        if (v.equals(b1)){
            //Toast.makeText(Random_textviewActivity.this, "Hello", Toast.LENGTH_SHORT).show();
            count++;
            score.setText(String.valueOf(count));
            b1.setText("");
        }
        else if (v.equals(b2)) {
            count++;
            score.setText(String.valueOf(count));
            b2.setText("");
        }

Those are part of my codes,is there any way to register a count for button not being clicked?
UPDATE

Okay I've got a grasp of the whole idea now,but due to I'm still not very good with android programming yet,I've gotten a lot of error while trying to do what you thought me.Belows are part of the code I've gotten so far:
b1 = (whackamolebutton) findViewById(R.id.button1);
 ((whackamolebutton) b1).setmoleactive(this);

public class whackamolebutton extends Button{

public whackamolebutton(Context context) {
    super(context);
    // TODO Auto-generated constructor stub
}//it insist I must cast a method here which I'm not sure why
 //from this point onwards I got confused by the auto fix from eclipse.
public void setmoleactive(Random_textviewActivity random_textviewActivity){
    if (boolean active){
                      count++
                                    }
                else{
                     misscount++
                    }
}
public int getScore(){
    return count;

}

}
Any help with the code would be greatly appreciated.Thank you in advance.

A: I would prefer implementing a custom Button:
public class WhackAMoleButton extends Button {
  public void setMoleActive(boolean active) {
  ...
  }
  public int getScore() {
  ...
  }
}

The idea is to collect the total score/count from all visible "WhackAMoleButton"s and move the count logic into the WhackAMoleButton-Class. If the button changes from moleActive(true) to moleActive(false) and there was no click in the meantime, you could raise the "not being clicked"-count.


text:
Q: Java BlockingQueue messages not processed not processed in full I am trying to process few million records from a text file (i.e. reading the file sequentially using one thread, and trying to process the retrieved lines using multiple threads). A method call after 'queue.take();' is only executing for the number of times equal to initial capacity allocated to BlockingQueue (100 in this example), and then the process doesn't pickup anymore records.
Could you please help in debugging or identify the issue?
Main Method:
############
final int threadCount = 10;
BlockingQueue<String> queue = new ArrayBlockingQueue<String>(100);
ExecutorService service = Executors.newFixedThreadPool(threadCount);

for (int i = 0; i < (threadCount - 1); i++) {
    service.submit(new EvaluateLine(queue));
}
service.submit(new ProcessFile(queue)).get();
service.shutdownNow();
service.awaitTermination(365, TimeUnit.DAYS);

EvaluateLine:
#############
private final BlockingQueue<String> queue;

public EvaluateLine(BlockingQueue<String> queue){
    this.queue = queue;
}

@Override
public void run() {
    String line;
    while(true) {
        try {
            line = queue.take();
            SyncOutput.Process(line);
        } catch (InterruptedException ex) {
            break;
        }
    }
}

ProcessFile:
############
private final BlockingQueue<String> queue;

public ProcessFile(BlockingQueue<String> queue) {
    this.queue = queue;
}

@Override
public void run() {
    Path path = Paths.get("C:\\Desktop\\testdata.txt");
    BufferedReader br = null;

    try {
        br =Files.newBufferedReader(path, StandardCharsets.UTF_8);
        for (String line; (line = br.readLine()) != null; ) {
            queue.put(line);
        }
    } catch(IOException e){
        e.printStackTrace();
    } catch(InterruptedException e){
        e.printStackTrace();
    } finally{
        try {
            if (br != null) br.close();
        }catch(IOException e){
            e.printStackTrace();
        }
    }

Edit:
 SyncOutput
 ##########
 class SyncOutput{
    public static void ProcessExpression(String inputLine) {
        evalExpression(inputLine);
    }
    public static double evalExpression(String s){
        Expression e = new ExpressionBuilder(s)
                       .build();
        return e.evaluate();
    }
 }

A: The following code segment(using Expression evaluation library: exp4j) is blocking the multi-thread execution, not sure why. But I have replaced this code block with a different library(parsii) and now everything looks fine.
public static void ProcessExpression(String inputLine) {
    evalExpression(inputLine);
}
public static double evalExpression(String s){
    Expression e = new ExpressionBuilder(s)
                   .build();
    return e.evaluate();
}


text:
Q: Writing a simple app to convert files to pdf I want to create an application on a Mac to convert multiple files (txt, pdf, doc, html, etc) to a single pdf file that can be printed. The real point is that if you have 50 texts you don't have to open every single file and click command-p.
I'm not quite sure whether the best way to do this is by creating a full-fledged app or an automator plugin (or something else). If I remember correctly there's a filter in mac os's terminal that can convert files to pdf (but I forgot what it's called).
So would an automator plugin do this well, or shall I make an app for this? Can you provide me advantages for each answer?
I've done cocoa touch programming before so I can write objective-c quite well.

A: Use appscript, either as an action in an automator script or standalone. The advantage is that it is very simple and will take you a fraction of the time to write an app.
Here is something very close to what you want. It sets up a drop-folder and each file dragged onto it is printed (you can use multiple-select to get what you want). It uses Apple Works 6 which doesn't support the file-types that you want.
To modify it to use the Preview application instead you need to change the tell command in the script and then google the dictionary for Preview to check which verb to use for printing.


text:
Q: why no extension of table of content in jupyter notebook? I did install NBExtension using below command without any error. I do see NBExtension tab when loging to jupyter notebook. However, I don't see table of table icon inside jupyter notebook. so I am wondering what I am missing to get this table of content working? Thanks for helping
conda install -c conda-forge jupyter_contrib_nbextensions


text:
Q: How can I utilize two default scoped objects in a test without making it public? Consider two classes that sit in two packages:
package com.foobar.barers;

abstract class BaseFooBarer<T> extends BaseBarer{ ... }

and
package com.foobar.unbarers;

abstract class BaseFooUnbarer<T> extends BaseUnbarer{ ... }

Now anything thing that can be "barred" by a BaseBarer should be able to be "unbarred" by a BaseUnbarer. But a BaseFooBarer also contains the method "BarredFoo getBarredFoo()" and "void setFoo(Foo foo)". A BaseFooUnbarer contains the method "Foo getFoo()" and "void setBarredFoo(BarredFoo barredFoo)". Given that I have several implementations of BaseFooBarer and their corresponding BaseFooUnbarer, I thought it would be easiest to test it using a parameterized junit test. Unfortunately, since they sit in separate packages I can't place the test in a package that can access both. So I'm left with either making five nearly identical tests starring the public implementations or making these things public.
Now I have no desire in making them public because I don't want anybody extending them other than the implementations in my jar. I also don't want five redundant tests in my code.
Is there any pattern in Java that will allow me to have my cake and eat it too?
There's a limitation in which I'm unable to move these classes into one package, so I can't take the easy way out.


text:
Q: Make it easy to start tomcat instances on Mac I have two tomcat servers installed, at the locations:
/Users/alexstaveley/developer/servers/apache-tomcat-6.0.37
/Users/alexstaveley/developer/servers/apache-tomcat-7.0.42

To start them, I am opening a terminal CDing the right bin directory and then doing
sh catalina.sh start

This is getting cumbersome.  I'd much prefer to have something on my doc or desktop and then just click the instance I want to start.
Any tips?

A: If you rename the *.sh files to *.command, you can just doubleclick them (I don't have a Mac to double-check, you might need to chmod +x them).
If you want the shell to open, just create a file startTomcat.command with sh catalina.sh start as its sole content

A: *

*After installing tomcat rename the folder to tomcat and place that tomcat folder under Macintosh HD -> Users -> alexstaveley directory

*Change the tomcat->bin->startup.sh file, open startup.sh in textedit, add the following 2 lines after EXECUTABLE=catalina.sh line
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home
export CATALINA_HOME=/Users/user/Tomcat**

*Finally to start tomcat, open Mac Terminal
cd /Users/alexstaveley/tomcat/bin
sh startup.sh


text:
Q: Cognito user pool for single admin I'm trying to create a personal blog using s3 and lambda. I already have the API setup but I'm trying to figure out how to make the blog post requests more secure by requiring an authorization token in order to access the API Gateway.
I believe this can be done with cognito user pools but is usually used with many users not a single admin user. However, if there's another way I should go about this then I'm all ears.

A: You can implement this by:

*

*Creating a User Pool in Cognito

*If you are using the Hosted UI login pages, I recommend having the pages send a code response rather than a token response because you can call the token endpoint to get all the appropriate tokens.

*Call your token endpoint with the code you receive in Step 2 (it'll be in the URL when you are redirected back to your site) to retrieve the ID, Access, and Refresh Tokens.

*Once you have your cognitoUser tokens, you can wrap your blog publish function with a token check function to ensure that your token is up-to-date and send the updated token to your publish blog callback.

*Send the user token in your headers: { Authorization: token } API Call.

*In API Gateway, choose the Method Request in your Blog Post API and select your Cognito User Pool name under authorizers.

As long as the token you send is valid, the Method Request is all you need to update in order to secure the ability to post.


text:
Q: Connectedness implies there exists a k for all z? (obtained from John B. Conway) This is obtained from Functions of one complex variable by John B. Conway P.39
Let $f$ be a given branch of the logarithm on the connected set G and suppose $k$ is an integer. Put $g(z)=f(z)+2\pi ki$ and $h(z)={1\over 2\pi i}[f(z)-g(z)]$, then $h$ is continuous on $G$ and $h(G)$ is connected. Hence there is a $k$ in $\Bbb Z$ with $f(z)+2\pi ki=g(z)$ for all $z$ in $G$
I have trouble in understanding why connectedness implies "Hence there is a $k$ in $\Bbb Z$ with $f(z)+2\pi ki=g(z)$ for all $z$ in $G$".

A: The function $h$ is continuous and integer-valued, hence constant. (Or if you want to argue exactly as in your quote, the only connected subsets of $\mathbb{Z}$ are single points.)


text:
Q: Java ObservableList not displaying some values I am creating a program to allow landlords to register new tenants with given information. The program writes and reads to a file perfectly, but the problem I am having is that using an ObservableList to populate a TableView won't work with all the data. A tenant extends person and has contact details. The person information displays. But the contact information won't show. Here is my code:
Contact class
package entities;

import interfaces.ContactDetailsInterface;
import java.io.Serializable;

public class Contact implements ContactDetailsInterface, Serializable {
private static final long serialVersionUID = 3458489886428771425L;
private String StreetLine;
private String City;
private String Parish;
private String Country;
private String Email;
private String Telephone;
private String TRN;

/**
 * @return the StreetLine
 */
@Override
public String getStreetLine() {
    return StreetLine;
}

/**
 * @param StreetLine the StreetLine to set
 */
@Override
public void setStreetLine(String StreetLine) {
    this.StreetLine = StreetLine;
}

/**
 * @return the City
 */
@Override
public String getCity() {
    return City;
}

/**
 * @param City the City to set
 */
@Override
public void setCity(String City) {
    this.City = City;
}

/**
 * @return the Parish
 */
@Override
public String getParish() {
    return Parish;
}

/**
 * @param Parish the Parish to set
 */
@Override
public void setParish(String Parish) {
    this.Parish = Parish;
}

/**
 * @return the Country
 */
@Override
public String getCountry() {
    return Country;
}

/**
 * @param Country the Country to set
 */
@Override
public void setCountry(String Country) {
    this.Country = Country;
}

/**
 * @return the Email
 */
@Override
public String getEmail() {
    return Email;
}

/**
 * @param Email the Email to set
 */
@Override
public void setEmail(String Email) {
    this.Email = Email;
}

/**
 * @return the Telephone
 */
@Override
public String getTelephone() {
    return Telephone;
}

/**
 * @param Telephone the Telephone to set
 */
@Override
public void setTelephone(String Telephone) {
    this.Telephone = Telephone;
}

@Override
public void setTRN(String trn) {
    this.TRN = trn;
}

@Override
public String getTRN() {
 return TRN;
}
}

Tenant class
package entities;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Scanner;
import superclass.Person;

public class Tenant extends Person {

transient SimpleDateFormat dateFormat;
transient Calendar calendar;
transient Scanner in = new Scanner(System.in);

private String dateOfBirth;

//has a
private Contact contact;
private CalculatePayments payment;

private String registra;

public String getDateOfBirth() {
    return dateOfBirth;
}

/**
 * @param dateOfBirth the dateOfBirth to set
 */
public void setDateOfBirth(String dateOfBirth) {
    this.dateOfBirth = dateOfBirth;
}

/**
 * @return the contact
 */
public Contact getContact() {
    return contact;
}

/**
 * @param contact the contact to set
 */
public void setContact(Contact contact) {
    this.contact = contact;
}

/**
 * @return the payment
 */
public CalculatePayments getPayment() {
    return payment;
}

/**
 * @param payment the payment to set
 */
public void setPayment(CalculatePayments payment) {
    this.payment = payment;
}

/**
 * @return the registrar
 */
public String getRegistra() {
    return registra;
}

/**
 * @param registra the registrar to set
 */
public void setRegistra(String registra) {
    this.registra = registra;
}

}

This is my main JavaFX controller that I want to use to populate the TableView
MainPanelController
public class MainPanelSceneController implements Initializable {

@FXML
private TableView tenantTable;

/**
 * Initializes the controller class.
 *
 * @param url
 */
@Override
public void initialize(URL url, ResourceBundle rb) {

    //firstName
    TableColumn<Tenant, String> fnColumn = new TableColumn<>("First Name");
    fnColumn.setCellValueFactory(new PropertyValueFactory<>("FirstName"));

    //lastName
    TableColumn<Tenant, String> lnColumn = new TableColumn<>("Last Name");
    lnColumn.setCellValueFactory(new PropertyValueFactory<>("LastName"));

    //gender
    TableColumn<Tenant, String> genderColumn = new TableColumn<>("Gender");
    genderColumn.setCellValueFactory(new PropertyValueFactory<>("Gender"));

    //dob
    TableColumn<Tenant, String> dobColumn = new TableColumn<>("D.O.B");
    dobColumn.setCellValueFactory(new PropertyValueFactory<>("dateOfBirth"));

    //Email
    TableColumn<Tenant, String> emailColumn = new TableColumn<>("Email");
    emailColumn.setCellValueFactory(new PropertyValueFactory<Tenant, String>("Email"));

    //Phone
    TableColumn<Tenant, String> phoneColumn = new TableColumn<>("Phone #");
    phoneColumn.setCellValueFactory(new PropertyValueFactory<>("Telephone"));

    //TRN
    TableColumn<Tenant, String> TRNColumn = new TableColumn<>("TRN");
    TRNColumn.setCellValueFactory(new PropertyValueFactory<>("TRN"));

    //Country
    TableColumn<Tenant, String> countryColumn = new TableColumn<>("Country");
    countryColumn.setCellValueFactory(new PropertyValueFactory<>("Country"));

    //Parish
    TableColumn<Tenant, String> parishColumn = new TableColumn<>("Parish");
    parishColumn.setCellValueFactory(new PropertyValueFactory<>("Parish"));

    //City
    TableColumn<Tenant, String> cityColumn = new TableColumn<>("City");
    cityColumn.setCellValueFactory(new PropertyValueFactory<>("City"));

    //StreetLine
    TableColumn<Tenant, String> streetColumn = new TableColumn<>
 ("StreeLine");
    streetColumn.setCellValueFactory(new PropertyValueFactory<>
   ("StreetLine"));

    tenantTable.setItems(getTenants());

    tenantTable.getColumns().addAll(fnColumn, lnColumn, genderColumn,
            dobColumn, emailColumn, TRNColumn,
            phoneColumn, countryColumn, parishColumn,
            cityColumn, streetColumn);
}

private ObservableList<Tenant> getTenants() {
    ObservableList<Tenant> observableList =
FXCollections.observableArrayList();
    CrudOperations crud = new CrudOperations();
    ArrayList<Tenant> arr = (ArrayList<Tenant>)
 crud.readObj(Files.TENANT_FILE);
    ListIterator itr = arr.listIterator();
    while (itr.hasNext()) {
        Tenant t = (Tenant) itr.next();
        observableList.add(t);
    }
    return observableList;
}

}

As mentioned before, The observableList only displays information from the person class but it won't display from the contact class. Help!!!

A: The JavaFX TableView PropertyValueFactory uses reflection to figure out what values to display in table cells.
So when you say:
cityColumn.setCellValueFactory(new PropertyValueFactory<>("City"));

this means cellValueFactory will try to find a method called getCity() to populate cells in the cityColumn.
Since you define your TableColumn as:
TableColumn<Tenant, String> cityColumn = new TableColumn<>("City");

The factory looks in the Tenant class for the proper getters to populate the cells. Your problem is that the Tenant class needs to have the getters but the Contact class has them instead. I would suggest adding wrappers for the contact getters to the Tenant class i.e.
public String getCity(){
  return contact.getCity();
}


text:
Q: iOS Alamofire Timeout and No Network Connection I am getting a timeout error even if there is no network connection. I am using Alamofire to send requests. I have seen there are ways to check network connection such as at How to use SCNetworkReachability in Swift but from what I read it is better to send the request rather than checking for a network connection before each one. My question is why is it throwing a timeout error even if there is no network connection? Is there a way to check between the two or should I just check network reachability if there is a timeout.
import Foundation
import Alamofire

var config = URLSessionConfiguration.default
var manager: SessionManager? = nil
var configured: Bool = false
let formatter = DateFormatter()

let postURL = URL(string: "http://httpbin.org/post")!

func postStatus(deviceID: String, status: Bool, latitude: Double, longitude: Double){
    print("\nPosting")

    if(!configured){
        print("Configuring")
        config.timeoutIntervalForResource = 4
        config.timeoutIntervalForRequest = 4
        manager = Alamofire.SessionManager(configuration: config)
        configured = true
    }else{
        print("Configured\n")
    }

    let postData: [String: Any] = ["deviceID": deviceID, "status": 0, "lat": String(latitude), "long": String(longitude), "timestamp": getCurrentTime()]

    manager?.request(postURL, method: HTTPMethod.post, parameters: postData, encoding: JSONEncoding.default, headers: nil)
        .responseJSON(completionHandler: { response in

            guard response.result.error == nil else{
                let error = response.result.error!

                if let err = error as? URLError {
                    switch err.code {
                    case .notConnectedToInternet:
                        print("No Internet Connection")
                    case .timedOut:
                        print("Request Time Out")
                    case .networkConnectionLost:
                        print("Connection Lost")
                    default:
                        print("Default Error")
                        print(err)
                    }
                }
                return
            }

            guard let json = response.result.value as? [String: Any] else{
                print("Didn't get a response")
                print("Error: \(response.result.error ?? "Json Default Error" as! Error)")
                return
            }

            print("Response From Server: \(json)")
        })
}

A: It is throwing a timeout for the same reason you have read.  It is not worth checking on every call.


text:
Q: Why is setDetails empty, then data appears? import React, { useState, useEffect } from "react";
import { useParams } from "react-router-dom";
import { useGlobalContext } from "../context";

const SingleTvShow = () => {
  const { id } = useParams();
  const [details, setDetails] = useState({});
  const { imgUrl } = useGlobalContext();

  const getDetails = async (showId) => {
    const resp = await fetch(
      `https://api.themoviedb.org/3/tv/${showId}?api_key=API_KEY&language=en-US`
    );
    const data = await resp.json();

    setDetails(data);
  };

  useEffect(() => {
    getDetails(id);
  }, [id]);

  return (

      {console.log(details)}

  );
};

export default SingleTvShow;

https://drive.google.com/file/d/1FhYcJSqZiko0lJBoQdB2Gx5KyMWGR3dj/view?usp=sharing
I just started learning react, please help

A: Because the initial value of state details is empty {}. details only update when you call api success. Before that, details kept the value {}
You can check like this:
{details.backdrop_path && }

A: As @Viet said - the initial value is an empty object {} that is being populated when you have fetched the data.
If you want to show the data to your UI only when the fetching process has been completed then i would suggest changing your return to this:
return (

      {console.log(details)}
      {details &&  }

  );

This tells your function to only show the the img element if your state is not an empty object.


text:
Q: Symfony 3: GroupSequence validation groups ignored in validation of form I would like to validate a form using group validation and therefore I defined two validation groups. The second group should only be validated if the first group does not already cause violations. So I did this:
        $form = $this->createFormBuilder(null,array('validation_groups' => new GroupSequence(array('group1','group2'))))
        ->add('email', EmailType::class,array('constraints' => array(
            new Assert\Email(array('groups' => array('group1'))),
            new Assert\NotBlank(array('groups' => array('group1'))),
            new CustomAssert\AlreadyRegistered(array('groups' => array('group2'))))))
        ->add('submit',SubmitType::class,array())
        ->getForm();

But apparently none of the constraints are validated, the form is valid no matter what I enter in the email field.
What's wrong?

A: According to the 3.2 documentation you don't need to initiate a new GroupSequence object under the validation_groups. Try this:
    $form = $this->createFormBuilder(null, array(
        'validation_groups' => array('group1','group2')
    ))
    ->add(
        'email',
        EmailType::class,
        array(
            'constraints' => array(
                new Assert\Email(array('groups' => array('group1'))),
                new Assert\NotBlank(array('groups' => array('group1'))),
                new CustomAssert\AlreadyRegistered(array('groups' => array('group2')))
    )))
    ->add(
        'submit',
        SubmitType::class
    )
    ->getForm();

Reference: http://symfony.com/doc/current/form/validation_groups.html


text:
Q: Intuition / Premonition / Precognition / Instinct / Gut feeling / Hunch What is the difference between them in terms of meaning and usage in daily life.
Can we say :

I have a Intuition  / Premonition / Precognition / Instinct /  Gut
feeling / Hunch you are going to pass
driver test successfully.
I have a  Intuition  / Premonition / Precognition / Instinct /  Gut
feeling / Hunch that if I accept this job offer, it is not going to affect
my career positively.
I have a Intuition  / Premonition / Precognition / Instinct /  Gut
feeling / Hunch that my son and your son are going to get along well even they have not met yet.

A: In order of 'magnitude'
Precognition - you really actually knew, for an absolute immutable fact, that this would happen.
Premonition - something came to you in a dream & told you it would happen.
Both the above, of course, in the real world - absolute tosh… yet sometimes used for extreme emphasis (or by raving lunatics;-).
Instinct - Instinct is the thing that puts your hands out in front of your face if you fall. It requires no conscious thought whatsoever.
Intuition - you can intuit from relatively sparse evidence, if you have sufficient background in the subject being considered. You almost 'know it without thinking'.
Gut feeling - uses a hint of both the above & a pinch of the last one..
Hunch - mainly guesswork, based on little actual evidence.
Unless you are exaggerating for effect - dramatic or comedic - you ought to choose based on how 'big a deal' it really is & how much evidence &/or conscious thought went into your conclusion.

A: Intuition, hunch, or gut feeling are probably the choices among those that are most commonly used. Hunches and gut feelings may not be based on anything in particular, but an intuition might have some reasoning behind it. A premonition or precognition has an implication of some sort of foreknowledge of the event in a psychic or paranormal sense. I don't think instinct fits among these - it's more of an automatic response to something, not something used to forecast the future.


text:
Q: Euclidean symmetries of torus links in R^3 I have a question about whether Ryan Budney's question:
Torus knots in Euclidean space -- a symmetry argument
can be extended to links. He asks:
Suppose you have a $(p,q)$ torus knot $K$ in $\mathbb{R}^3$ fixed by a subgroup $G$ of $\operatorname{SO}(3)$. Budney asks (more or less) for a nicer proof that $G$ cannot contain $\mathbb{Z}/p\mathbb{Z}$ and $\mathbb{Z}/q\mathbb{Z}$ as subgroups.
Edit: I think I understand Charlie Frohman's point in the comments to that question now that this follows from knowing the periods of the torus knots AND the structure of the finite subgroups of SO(3), which are very different than the finite subgroups of SO(4).
I'd like to extend this same result to $(p,q)$ torus links: there should be no configuration in $\mathbb{R}^3$ which is both $p$-fold and $q$-fold symmetric. I feel like this sort of thing ``should be known'', but so far my literature search has not turned up anything.
EDIT: I think you could probably do this in a similar way if you knew the periods of the torus links (as opposed to the torus knots). But is \emph{this} known?

A: A pretty nice way to interpet your question is two consider the action of the symmetry group on $\mathbb{S}^3$. This is done for knots in Boileau, Boyer, Cebanu, and Walsh section 3, but we can get enough of it to work to answer your question. The point is that the (p,q) torus link will also admit a symmetry group with an element $a$ of order $m=lcm(p,q)$.
The quotients of $\mathbb{S}^3$ under the action of $a$ are dubbed orbi-lens spaces in the language of the above paper because we can describe them similar to the way that Rolfen describes lens spaces in 9B(III) of Knots and Links. Namely, let $w$ be a primitive $m$-root of unity. We consider $\mathbb{S}^3 =$ { $(z_1,z_2)| z_1,z_2\in \mathbb{C} \mbox{ and } |z_1|^2+|z_2|^2=1$ }. The $a$ can be realized as $a(z_1,z_2)=(w^q z_1,w^p z_2)$.
If $gcd(p,q)=d$, then $a^{p/d}$ will fix the core of a Hopf fibration and $a^{q/d}$ will fix the other core. Also, according the above paper, the quotient has base space a lens space with homology $\mathbb{Z}/d\mathbb{Z}$. We note that the quotient under the action of $a^{m/d}$ will be a lens space and that $p,q \geq 2$ and are not relatively prime so $d\geq 2$ .
Since any finite order element $g$ of $SO(3)$ fixes an axis, the image of $a^{m/d}$ will fix an axis. But the map given by the 1 point compactification of $\mathbb{R}^3$, $f: \mathbb{R}^3 \cup \{\infty\} \rightarrow \mathbb{S}^3$, is 1-1. So we could induce a quotient map on $\mathbb{S}^3$ via the image under $f$ of the points equivalent under $g$ which has base space $\mathbb{S}^3$. That would contradict the above paragraph.


text:
Q: (Mono For) Android EditText Show Current Value? I have got a PreferenceActivity Screen, where I save some Values.
(But I think it doesn't mind, if it would be just a normal Activity)..
Anyway at the moment it looks like this:

There are 4 EditText Controls. It saves the values fine, but I would like,
that the stored/saved current value will be showed on this edittext, without needing to
select one of these EditTexts first, to be able to see it..
Maybe somehow on the second line of the EditText, Protokoll, and then on the darker grey Protokoll place, the current value, for example: HTTP
Any Help would be appreciated


text:
Q: Как svg использовать в значении button, для отправки ajax запросов? Есть форма, которая отправляет комментарии ajax методом:

post_query это функция которая вызывает ajax запросы, она уже проверенна, не обращайте на нее внимание, дело только в теге , нужно его поменять и все ниже прикрепил саму svg кнопку
Вопрос: в какой тег поместить svg кнопку, чтобы она работала как button и отправляла ajax запрос?

A: Псевдо кнопка из линка

body {
  margin: 0;
  padding: 0;
  background: #f1f1f1;
}

a {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); display: inline-block;
  cursor: pointer;
  border: 1px solid blue;
  padding: 5px 10px;
  background-color: white;
  box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5);
  transition: all 400ms;
}

a:hover {
  box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5)
}

  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1542.52 483" width="100px"><defs></defs><title>vialan_2</title><g id="Слой_2" data-name="Слой 2"><g id="Слой_1_копия_" data-name="Слой 1 (копия)"><path class="cls-1" d="M18,92C53.79,250.65,120.6,380.07,175.82,386.69h7.45C226.48,378,290.09,258.56,337.19,92.31L207,138.18c51.71,71.06,75.75,136-28.17,209.86C77.4,276.17,85.7,211.92,153.32,138.67Z"/><path class="cls-1" d="M437.09,386.87H343.34c49.5-92.9,50.41-216.39-.63-293.85H444.62C388.59,166.7,384.28,291.84,437.09,386.87Z"/><path class="cls-2" d="M1542.52,483c-423.22-74.31-784.86-17.43-795-16.23,234-591.63-609-400-747.52-377.12C405.52-28.61,590.72-22.88,1100.52,66c-285-5.81-300,132.76-262,341.87,275,24.06,620.57,2.67,697.32-22C1512.6,396,1516.18,477,1542.52,483Z"/><path class="cls-1" d="M1434.84,336.06c23.45-66.43,7.49-192.34-49.77-242.28,11.69,0,102.09-1,113.78-1-63.47,88.23-42.1,216.78-4.58,293.65h-80.73c38.68-38.57-92.6-142.5-189.12-224.9-25.52,80.71-5.95,167.76,27.47,225.95H1173c51.92-141.71,7.84-222.54-29.39-293.64h102.72C1215.15,181.14,1329.4,200.69,1434.84,336.06Z"/><path class="cls-1" d="M760.62,387.69C725.51,229,659.23,99.43,604,92.68h-7.45C553.32,101.27,489.26,220.6,441.5,386.78l130.35-45.62c-15.86-21.91-29-43.24-36.68-64.42,38.36-24.47,91.12-26.66,136.77-7.26-7.49,23.17-23.61,46.73-46.42,71.3ZM530.4,218.38c6.65-28.21,27.81-56.9,70.45-87,45.88,32.72,69.23,63.82,74.61,94.85C626.6,251,569,247.83,530.4,218.38Z"/><path class="cls-1" d="M1165.86,388c-35.11-158.7-101.4-288.26-156.6-295l-7.45,0c-43.25,8.62-107.32,127.92-155.07,294.09l130.35-45.62c-15.85-21.91-29-43.24-36.68-64.39,38.32-24.51,91.12-26.66,136.77-7.26-7.49,23.17-23.61,46.73-46.42,71.26ZM935.64,218.73c6.65-28.25,27.85-56.9,70.45-87,45.92,32.68,69.23,63.75,74.65,94.82C1031.84,251.35,974.19,248.18,935.64,218.73Z"/></g></g></svg>


text:
Q: Expanding a PDE in powers of a small parameter? I'm working on an assignment for my quantum mechanics class and I've arrived at a nonlinear inhomogeneous partial differential equation for a complex function $S:\mathbb{R}^2\to\mathbb{C}~;~S:(x,t)\mapsto S(x,t)$ (This is actually the Quantum Hamilton-Jacobi equation in one spatial dimension)
$$\partial _{t} S+\frac{1}{2m} |\partial _{x} S|^{2}+U =\frac{\mathrm{i} \hbar }{2m}\partial ^{2}_{x}S\tag{1}$$
Here, $\mathrm{i}$ is the imaginary unit, $\hbar$ and $m$ are positive real constants (reduced Planck's constant and the mass of the particle), the $|~|$ denotes complex norm, and $U:\mathbb{R}^2\to\mathbb{R}$ is a real function (potential energy). My professor has given me the following instruction:

Expand $S(x,t)$ in terms of the small parameter $\hbar$
$$S(x,t)=S_0(x,t)+\hbar S_1(x,t)+\hbar^2S_2(x,t)+\dots$$
Show that
$$\partial_tS_0+\frac{|\partial_x S_0|^2}{2m}+U=0\tag{2}$$
$$\partial_t S_1+\frac{1}{m}(\partial_x S_0)(\partial_x S_1)=\frac{\mathrm{i}\hbar}{2m}\partial_x^2S_1\tag{3}$$

I'm not really sure how he wants us to approach the "expand in terms of the small parameter" part. It looks kind of like a Taylor series, but I don't know how they are related. I've done small parameter expansions on single variable Fredholm integral eigenvalue problems, but I really don't know how I can apply that here. I think my question is kind of similar to this one and this one, but as for the first I'm not sure how to state my equation as an eigenvalue problem and as for the second the only answer on that post is very unclear, and I can't see a way to use geometric series as Ted Shifrin mentioned in the comments. This is from a quantum mechanics class, so we haven't been given a general treatment of the mathematical methods needed for this. "Perturbation theory" is covered later in the course, but only really on linear eigenvalue problems. I have another course that deals with this sort of thing, but its focused mostly on integral equations and on linear single variable differential equations, so I don't know how to apply those methods here.
How should I approach this??
CORRECTIONS:
My professor has issued a revised assignment (still containing errors I might add) with some corrections to equations (1),(2), and (3). They now agree with @Sal 's work. They read
$$\partial _{t} S+\frac{1}{2m} (\partial _{x} S)^{2}+U =\frac{\mathrm{i} \hbar }{2m}\partial ^{2}_{x}S\tag{1*}$$
$$\partial_tS_0+\frac{(\partial_x S_0)^2}{2m}+U=0\tag{2*}$$
$$\partial_t S_1+\frac{1}{m}(\partial_x S_0)(\partial_x S_1)=\frac{\mathrm{i}}{2m}\partial_x^2S_1\tag{3*}$$

A: Obligatory first remark (apologies in advance) $\hbar$ is a dimensionful constant, and so is not 'small' or 'large'. I may choose to work in units where $\hbar=10$, where it is certainly not true that $\hbar^n \to 0$ for large $n$. Let me rewrite the equation, setting $m=1/2$ and $\hbar=1$ for my convenience$^\dagger$
$$
\partial_t S +(\partial_x S)^2 +U =i\partial_{xx}S
$$
We wish to solve this equation with the perturbative ansatz
$$
S=\sum_{n=0}^\infty S_n \varepsilon^n
$$
That is, we claim the solution may be written as a power series in the small parameter $\varepsilon$: a dimensionless parameter that we have introduced. We wish to solve for the $S_n$ recursively. The next step is to write an $\varepsilon$ in the original equation. Following the spirit of the question, we choose
$$
\partial_t S +(\partial_x S)^2 +U =i\varepsilon \partial_{xx}S
$$
The strategy is now straightforward. We substitute our ansatz for $S$ into this equation, and equate powers of $\varepsilon$
$$
\sum_{n=0}^\infty \partial_tS_n \varepsilon^n + \left( \sum_{n=0}^\infty \partial_xS _n \varepsilon^n \right)^2+U=i\sum_{n=0}^\infty \partial_{xx}S_n \varepsilon^{n+1}
$$
Products such at the second term on the left are expanded using Cauchy's product, however, we will not need that to get the two terms required in your question. Note the lowest power of $\varepsilon$ on the right is one. The coefficients of $\varepsilon^0$ in the equation are
$$
\partial_t S_0+(\partial_xS_0)^2+U=0
$$
This is your first equation. In principle, you solve this for $S_0$. So presume $S_0$ is known. Look at coefficients of $\varepsilon^1$
$$
\partial_t S_1 + \partial_x S_0 \partial_x S_1 + \partial_x S_1 \partial_x S_0 + 0 = i \partial_{xx}S_0
$$
$$
\partial_t S_1 + 2 ( \partial_x S_0 )(\partial_x S_1) = i \partial_{xx}S_0
$$
Which is your second equation. The middle terms arise from picking the coefficients of $\varepsilon^1$ from the product
$$
(\partial_x S)^2=\left(\sum_{n=0}^\infty \partial_xS _n \varepsilon^n \right)^2 =(\partial_x S_0 + \varepsilon \partial_x S_1 + \varepsilon^2 \partial_x S_2+\dots) (\partial_x S_0 + \varepsilon \partial_x S_1 + \varepsilon^2 \partial_x S_2 +\dots)
$$
In principle, since $S_0$ is known, you can now solve the equation for $S_1$, and so on.
$\dagger$ The ansatz $\psi=e^S$ occurs frequently in perturbative analysis. With this ansatz, we get the equation in your post from the Schrodinger equation, without the complex norm. I assume this was a typo, or that what was meant is: $\nabla S \cdot \nabla S$.


text:
Q: sum is not working after taking union multiple column in knexjs mysql I need a sum of 4 column ,I am doing that by first taking union then running sum
  db.select("gen-acute-sales-before-returns").table('sales')
  .union(function() {
    this.select("gen-acute-sales-after-returns").table('sales')
  })
  .union(function(){
    this.select("gen-chronic-sales-before-returns").table('sales')
  })
  .union(function(){
    this.select("gen-chronic-sales-after-returns").table('sales')
  })
  .sum({totalSales:"gen-acute-sales-before-returns"})
  .then(result => res.json(result))

Problem is that I am getting a union table but sum is not working

A: I just add general knex debugging guidance here, since the question is pretty ambiguous.
Check out what query is generated by calling .toSQL() for the query builder. Then you can see if the generated query has something wrong.
console.log(
  db.select("gen-acute-sales-before-returns").table('sales')
  .union(function() {
    this.select("gen-acute-sales-after-returns").table('sales')
  })
  .union(function(){
    this.select("gen-chronic-sales-before-returns").table('sales')
  })
  .union(function(){
    this.select("gen-chronic-sales-after-returns").table('sales')
  })
  .sum({totalSales:"gen-acute-sales-before-returns"}).toSQL().sql
);

It is completely possible that there is bug in knex's union method (wouldn't be the first time).


text:
Q: how to free the memory of a pointer in C I wrote a program to concat two strings and make sure the buffer will double the size when there's no enough space.
char * strcat_ex(char * * dest, int * n, const char * src){
    int dest_len = 0;
    int src_len = 0;
    if (*dest == NULL)  *n = 0;
    else dest_len = strlen(*dest);
    if (src == NULL)     return *dest;
    else src_len = strlen(src);

    if (dest_len + src_len + 1 > *n) {
        //(1) malloc a new buffer of size 1 + 2 * (strlen(*dest) + strlen(src))
        char * temp;
        temp = (char*) malloc(1 + 2 * (strlen(*dest) + strlen(src)));
        //(2) set '*n' to the size of the new buffer
        *n = 1 + 2 * (strlen(*dest) + strlen(src));
        //(3) copy '*dest' into the beginning of the new buffer
        strcpy(temp, *dest);
        //(4) free the memory '*dest', and then set '*dest' to point to the new buffer
        free(*dest);
        *dest = temp;
    }
    //(5) concatenate 'src' onto the end of '*dest'.
    while (temp) temp++;
    while ((temp++ = src++) =! '\0');
    return *dest;}

and this code doesn't work. I got segmentation fault at "free(*dest)".
Please help. Thank you very much!
Here's the main function:
int main(int argc, char * * argv){
    printf("\nTesting strcat_ex(...)\n");
    char * str1;
    str1 = "one";
    char * str2;
    str2 = "two";
    int n;
    n = strlen(str1);
    printf("Before strcat_ex, str1 == %p (%s), str2 == %p (%s)\n", str1, str1, str2, str2);
    strcat_ex(&(str1), &n, str2);
    printf("After swap, str1 == %p (%s), str2 == %p (%s)\n", str1, str1, str2, str2);

return EXIT_SUCCESS;

}

A: The problem is that the initial value of str1 is a pointer to a literal string. That pointer cannot be freed. So the fix is to malloc space in main, e.g.
char *str1 = malloc( 100 );  // allocate an initial buffer
int n = 100;                 // the buffer has 100 bytes
strcpy( str1, "one" );       // put some text in the buffer


text:
Q: "Target filesystem doesn't have sbin/init" after cloning boot disk with dd I cloned a boot disk (bootloader, / and swap partitions) with dd to the same size disk (bad sectors started to appear). Got 1 reading error in the middle of the disk. After I swapped the disks I received "Target filesystem doesn't have sbin/init" error. At first I thought that the problem is /etc/fstab points to the wrong UUID to boot off. It turns out new disk has the same UUID, but I changed it to /dev/sda just to be shure and it is indeed /dev/sda (I disconnected all other disks). The problem persists.
How could it be that from 2 identical disks one is okay and the other not?
Edit:
I just mounted the new disk (it's LVM except /boot - does this matter?) and I can't read anything - "Input/output error". So why I receive "Target filesystem doesn't have sbin/init" now solved. I did try this before, I swear. But I did ls on it, saw my root directory and decided that it's okay.

A: It is my understanding that dd doesn't play well when there are errors on the disk.  Maybe try using dd_rescue to image bootloader, / and swap to the new disk.  Otherwise you might try imaging the entire disk.
dd_rescue works the exact same way as dd but can handle errors.


text:
Q: Conversion Neo4j query to .Net I'm using Neo4jClient to connect my Aspnet Application with Neo4j database.
But I'm having trouble when i try to convert this query:
MATCH (person:Person)-[r_students]->(students:Person)
 where person.personID = '{0}'
 return students, r_students;

to this code:
_client.Cypher
            .Match("(person:Person)-[r_students]->(students:Person)")
            .Where(string.Format(@"person.personID = '{0}'", id))
            .Return((students, r_students, person) => new TeacherStudents
            {
                Students = students.As<Person>(),
                StudentsRelations = r_students.As<Supervised>(),
            })
            .Results;

the error I'm getting is:
FormatException: Input string was not in a correct format.

The entire contents of the error (it's very long) can be found here
Neo4j Error
How can I convert properly?

A: I would suggest you to try this Cypher:
graphClient.Cypher
    .Match("(person:Person)-[r_students]->(students:Person)")
    .Where("person.PersonID = {id}")
    .WithParam("id", id)
    .Return((students, r_students, person) => new TeacherStudents
    {
       Student = students.As<Person>(),
       StudentsRel = r_students.As<Supervised>(),
    })
    .Results;

Tell me if its doin the job.


text:
Q: URL by making another page as intermediate in HTML website I am having an HTML site https://example.com. I have a page named example.html. I want to make my page URL https://example.com/exam/example.html. Where exam is another page.
How to do this in HTML website?
I am using:

but this is not like what i want. How to do this?

A: This can't be done as HTML + CSS are both for client side, if you would have made a server then from server side you could have changed this using route.

A: I'm pretty sure you'd have to create a directory called exam and have a file called example.html in that directory in the place that serves the domain example.com. :-)


text:
Q: Natural surjection from complex upper half plane into modular curve I am considering the natural surjection $\pi : \mathcal{H} \to Y(\Gamma)$ where $\mathcal{H}$ is the complex upper half plane and $Y(\Gamma)$ the modular curve of the congruence subgroup $\Gamma$. $Y(\Gamma)$ inherits the quotient topology, meaning a subset of $Y(\Gamma)$ is open if its inverse image under $\pi$ in $\mathcal{H}$ is open. \pi is continuous. Then the problem is the following:

This makes $\pi$ an open mapping.

I want to show the above. I have had two ideas.
1) Simply show that some open set $U \subset \mathcal{H}$ is mapped to an open set $A \subset Y(\Gamma)$. Let $A \subset Y(\Gamma)$ be an open set. Then $\pi^{-1}(A)$ is open by the above. Hence $\pi(\pi^{-1}(A))$ is open and $\pi(\pi^{-1}(A)) \subset A$. So if I can show that $\pi(\pi^{-1}(A)) \supset A$ we would in fact have equality and $A$ would be open. But this does not hold right, since it's only $\pi$ that is surjective?
2) Show that $\pi$ is non-constant and holomorphic and use the Open Mapping Theorem. I tried to find the limit $$\lim_{z \to z_0} \frac{\pi(z)-\pi(z_0)}{z-z_0}$$ but to no avail.
Can you help?


text:
Q: How to parse all the game data from the steam website from first page? i am using python i am trying to parse all the game title from the first page from the steam website but this code bring only first game title how i can deal with it
import requests
from bs4 import BeautifulSoup

url = f'https://store.steampowered.com/category/sports_and_racing/#p=0&tab=NewReleases'

r = requests.get(url, headers=h)

content = r.text
soup = BeautifulSoup(content, 'html.parser')

all_games_block = soup.find('div', 'class', class_='tab_content_ctn sub')

all_games = all_games_block.find_all('div', id='NewReleasesRows')

for each in all_games:

title = each.a.find('div', class_='tab_item_name').text

print(f'title:{title}')


text:
Q: Toggle labels on a vectortile connection I have a vectortile server connection (e. g. to basemap.de, see example below) styled with a lot of labels.

I see no way to quickly toggle the labels on/off without deleting them all and adding them back via Add style... later.
On a normal vectorlayer, I can easily switch to No labels and later switch back .

Am I missing something or is this just not implemented? It's really annoying to toggle them all individually and deleting/readding doesn't seem to be the way developers had in mind.


text:
Q: Using R with RODBCext and RODBC to execute a SQL stored procedure I am using the RODBCext package and the RODBC package to execute a stored procedure in SQL server 2008 using R.  If I use this code the stored procedure works.
query <- "EXEC [dbo].[usp_SchoolMerge] @Number = ?,
                                       @Name = ?,
                                       @Type = ?,
                                       @Comments = ?,
                                       @DualEnrollment =?,
                                       @CEP = ?,
                                       @DistrictGuidId = ?,
                                       @ImportName = ?,
                                       @ImportID = ?"

query <- gsub("[[:space:]]+", " ", query)

con2 <- odbcConnect("database", uid="userid", pwd="password")

for(i in 1:nrow(us11_12_00_school)) {

  sqlExecute(con2, query, us11_12_00_school[i,])

}

odbcClose(con2)

If I try to use the vectorized form explained here under 2.3.2 Using parameterized queries.
query <- "EXEC [dbo].[usp_SchoolMerge] @Number = ?,
                                       @Name = ?,
                                       @Type = ?,
                                       @Comments = ?,
                                       @DualEnrollment =?,
                                       @CEP = ?,
                                       @DistrictGuidId = ?,
                                       @ImportName = ?,
                                       @ImportID = ?"

query <- gsub("[[:space:]]+", " ", query)

con2 <- odbcConnect("database", uid="userid", pwd="password")

sqlExecute(con2, query, us11_12_00_school)

odbcClose(con2)

I get this error in R.
Error in sqlExecute(con2, query, us11_12_00_school) :
  24000 0 [Microsoft][ODBC SQL Server Driver]Invalid cursor state
[RODBCext] Error: SQLExecute failed

If I use a data frame with only one row the vectorized code works.  Anyone else had this problem?  Any ideas?

A: Seems like you want to use only the first column of the us11_12_00_school - which you pass in the loop-version of the function with us11_12_00_school[i,]. In the vectorised version though, you pass in the whole dataframe!
I havent tested it out, but i guess passing the dataframe as us11_12_00_school[1,] in the vectorised version would give you the expected results?

A: I use the code below, and seems to work well. Hopefully it helps you too.
require(RODBC)
require(RODBCext)

ExecuteQuery <- function(query, arguments){

  dbhandle <- odbcDriverConnect('driver={SQL Server Native Client 11.0};server=SereverName;database=DbName;trusted_connection=yes')
  if(missing(arguments))
    result <- sqlExecute(dbhandle, query = query, fetch = TRUE)
  else
    result <- sqlExecute(dbhandle, query =query, data=arguments, TRUE)
  close(dbhandle)
  return(result)
}

CallProcWithSomeParams <- function(param1, param2){

  ExecuteQuery('exec dbo.procName ?, ?', data.frame(param1, param2))
}


text:
Q: EF Core Cannot Save Related Data one to many Im trying to save a new user into the users table with a new role. Here's the model and configuration.
When I insert the below entity, The role table gets populated with the new role, but the user entity is not being inserted.
    `var userEntity = new User
    {
        Id = 0,
        Active = true,
        Firstname = "Fname",
        Lastname = "Lname",
        Password = "test",
        Phonenumber = "2223334444",
        Test = false,
        Username = "test@test.com",
        RoleId = 0
        //                Role = roleEntity
    };
    var roleEntity = new Role
    {
        Id = 0,
        Name = "test role",
        Active = true,
        Users = new List<User>
        {
            userEntity
        }
    };

    context.Role.Add(roleEntity);
    await context.SaveChangesAsync();

public class User
{
    public int Id { get; set; }

    public string Username { get; set; }

    public string Password { get; set; }

    public string Firstname { get; set; }

    public string Middlename { get; set; }

    public string Lastname { get; set; }

    public string Phonenumber { get; set; }

    public bool Active { get; set; }

    public bool Test { get; set; }

    public int RoleId { get; set; }

    public virtual Role Role { get; set; }
}

public class Role
{
    public int Id { get; set; }

    public string Name { get; set; }

    public bool Active { get; set; }

    public virtual ICollection<User> Users { get; set; }

    public Role()
    {
        Users = new HashSet<User>();
    }
}`

Here are the entity configurations.
`
 public class RoleConfiguration : IEntityTypeConfiguration<Role>
 {
    public void Configure(EntityTypeBuilder<Role> builder)
    {
        builder.ToTable("Role");

        builder.HasKey(r => r.Id);
        builder.Property(r => r.Id).IsRequired().ValueGeneratedOnAdd();
        builder.Property(r => r.Name).IsRequired().HasMaxLength(255);
        builder.Property(r => r.Active).IsRequired();
        builder.HasMany(r => r.Users)
            .WithOne(u => u.Role)
            .HasForeignKey(u => u.RoleId)
            .OnDelete(DeleteBehavior.Restrict);

    }
}

    public void Configure(EntityTypeBuilder<User> builder)
    {
        builder.ToTable("User");

        builder.HasKey(u => u.Id);
        builder.Property(u => u.Id).IsRequired().ValueGeneratedOnAdd();
        builder.Property(u => u.Username).IsRequired().HasMaxLength(255);
        builder.Property(u => u.Password).IsRequired();
        builder.Property(u => u.Firstname).IsRequired().HasMaxLength(255);
        builder.Property(u => u.Lastname).IsRequired().HasMaxLength(255);
        builder.Property(u => u.Phonenumber).HasMaxLength(255);
        builder.Property(u => u.Active).IsRequired();
        builder.Property(u => u.Test).IsRequired();
        builder.Property(u => u.RoleId).IsRequired();

        builder.HasOne(u => u.Role)
            .WithMany(r => r.Users)
            .HasForeignKey(u => u.RoleId)
            .OnDelete(DeleteBehavior.Restrict);
    }
}`

Is there anything I'm doing wrong.
Thanks for your help.

A: I made a mistake by using
context.Entry(entity).State = EntityState.Added;

instead of
context.Add(entity);

that's why the related entities weren't being added.


text:
Q: How to correctly use separators in Ocaml Consider the following code in OCamel:
let rodrigue="The cid" ; let diegue="cid's father"

this gives a syntax error on tryOcaml. What is wrong? It seems to work when I removed the ; Please help.
Also,
rodrigue.[4] <- 'c' gives unknown constructor error. Does this mean that we can't use <- ? as rodrigue.[4] is immutable or there is a function to change a character in a string?
What does ; do ?
I tried 4=4 ;6=5, it gave a value of bool= false.
is 4=4 an expression or a statement?
what about let x=5?
So let x=8 let y=9 executes both statements but $4=4 ; 5=6$ only evaluate the last expression?
What is the difference between an expression and a statement?
What is toplevel? What is the difference between toplevel and normal OCamel expression?

A: There are two places where you can use let in OCaml. At the top level of a module you can have this:
let pattern = expression

A module is, in essence, a collection of named values, and this form of let is the way of defining a name and its value.
On the other hand, there is an OCaml expression that looks like this:
let pattern = expression1 in expression2

This is, in essence, a way of defining local variables for use in expression2.
Your code with the ; doesn't work as either of these forms. A ; is used to combine two expressions into a single expression. But let pattern = value is not an expression. It has the form of a top-level declaration of a module.
The reason it works when you remove the ; is that you then have two top-level declarations. That will work as long as the code appears at the top level of a module. In this case, it defines the names rodrigue and diegue as named values of the module.
Other answers:
In recent versions of OCaml, strings are not mutable. You need to use the bytes type if you need mutability. As part of this change the string.[...] <- ... notation became obsolete. You should use Bytes.set instead.
# let mystring = "abc";;
val mystring : string = "abc"
# let mybytes = Bytes.of_string "abc";;
val mybytes : bytes = Bytes.of_string "abc"
# mystring.[0] <- 'b';;
Warning 3: deprecated: String.set
Use Bytes.set instead.
Error: This expression has type string but an expression was
            expected of type bytes
# Bytes.set mybytes 0 'b';;
- : unit = ()
# mybytes;;
- : bytes = Bytes.of_string "bbc"

OCaml doesn't really have statements. In places where you would have a statement in some other languages, you have an expression of type unit. For example, the for statement in OCaml is actually an expression with unit type.
# for x = 1 to 1 do () done = ();;
- : bool = true

From this point of view, then, 4 = 4 is an expression because it has type bool (and not unit).
So then let x = 5 is neither an expression nor a statement (which is just a kind of expression). As I pointed out above, this has the form of a top-level module declaration. Hence, it can only appear at the top of a module.
In contrast, let x = 5 in x + 2 is an expression with the value 7.
The name toplevel is what OCaml veterans call the read-eval-print loop of OCaml. In other words, it's a name for the OCaml interpreter.
In my answers above I'm using "top level" to mean the outermost syntactic nesting level of a module. It's not the same as the toplevel (the OCaml interpreter).


text:
Q: Why this Twitter Bootstrap 3 Modal Won't Fade? I have what should be a very simple modal using Twitter Bootstrap 3.  The modal displays no problem, but it doesn't fade in from the top, as it does in this example, http://getbootstrap.com/javascript/#modals.  Instead, it just plonks itself on the screen.
Here's the trigger:
Sign up with Email

Here's the modal:

                This is the header

                This is the body

                This is the footer

I am pretty sure that it was working before.
I checked out this other answer, Twitter Bootstrap: Modal popup won't fade, where the modal was nested within another .fade class, but that's not the case with my code above.
Also, I'm including the entire bootstrap javascript file (at the bottom of the page) so this can't be the problem.  I am loading jQuery too (before the bootstrap js).
EDIT:
This is bizarre.  In the process of creating a JS fiddle I went through and eliminated extraneous elements in the page, one at a time.  When I commented out a line so that my own site-wide.js would not load in the document head, the problem ceased.  I then restored the line that includes site-wide.js, but I can't recreate the problem???

A: Firstly, thanks for the comments above.
In the end I commented out some unnecessary javascript includes and that solved the problem.  Presumably it was a namespacing issue?  Interesting to see that it could manifest in such a subtle manner.