text:
Q: "Second order correct", "first order asymptotics" I keep seeing phrases like "first order asymptotic", "second order correct", "high order asymptotics" and I am honestly don't know how these terms are rigorously/conventionally/informally defined.  My best guess is that the higher the order, the higher the level of precision.  I'd like to know some sort of definition or guidance for how these terms are used though.
A Few Examples:

*

*I see two different asymptotic approximations for a distribution/probability under different assumptions.  There are several terms in these results and the first terms match.  I then see that the first set of assumptions are "second order correct" under the second set of assumptions.  I am assuming they are doing something like Edgeworth expansion and just matching the first couple of terms. But why call this first and second order?  Is there a more detailed reason to call this first and second order beside it just being the first few terms?

*I see a derivation for error for a given estimator.  This estimator has several sources of error.  One source is called first-order bias, and another is called second-order bias.  I am assuming it has to deal with how fast these biases converge to zero?  Meaning one is at a slower rate and one is at a faster?  But why call it first and second?  Is it just comparing the two sources together, the worse one being first and the better one being second? Or is it something about the rate and both of these could have been first-order biases?


text:
Q: Screen capture doesn't work on MFC application in Vista We've got some in-house applications built in MFC, with OpenGL drawing routines.  They all use the same code to draw on the screen and either print the screen or save it to a JPEG file.  Everything's been working fine in Windows XP, and I need to find a way to make them work on Vista.
In three of our applications, everything works.  In the remaining one, I can get the window border, title bar, menus, and task bar, but the interior never shows up.  As I said, these applications use the exact same code to write to the screen and capture the window image, and the only difference I see that looks like it might be relevant is that the problem application uses the MFC multiple document interface, while the ones that work use the single document interface.
Either the answer isn't on the net, or I'm worse at Googling than I thought.  I asked on the MSDN forums, and the only practical suggestion I got was to use GDI+ rather than GDI, and that did nothing different.  I have tried different things with every part of the code that captures and prints or save, given a pointer to the window, so apparently it's a matter of the window itself.  I haven't rebuilt the offending application using SDI yet, and I really don't have any other ideas.
Has anybody seen anything like this?

What I've got is four applications.  They use a lot of common code, and share the actual .h and .cpp files, so I know the drawing and screen capture code is identical.
There is a WindowtoDIB() routine that takes a *pWnd, and a source rectangle and destination size.  It looks like very slightly adapted Microsoft code, and I've found other functions in this file on the Microsoft website.  Of my four applications, three handle this just fine, but one doesn't.  The most obvious difference is that the problem one is MDI.
It looks to me like the *pWnd is the problem.  I'm not a MFC guru by a long shot, and it seems to me that the problem may be that we've got one window setup in the SDIs, and more than one in the MDI.  I may be passing the wrong *pWnd to the function.
In the meantime, it has started working properly on the 64-bit Vista test machine, although it still doesn't work on the 32-bit Vista machine.  I have no idea why.  I haven't changed anything since the last tests, and I didn't think anybody else had.  (On the 32-bit version, the Print Screen key works as expected, but it does not save the screen as a JPEG.)

A: Your question title mentions screen capture but your actual question doesn't. Please elaborate more clearly. Is the problem that you can do screen capture of three of your applications, but not the fourth one? You can use different screen capture software that can capture OpenGL/DirectX windows. Those surfaces are handled directly by the Window Manager and won't show up with a simple 'PrtScn'.
Switching to GDI+ won't solve it, nor will switching to SDI.

A: If it's the content of the CView that you want, then yes, that should be right one. If it's the content of the whole screen (at least the content, without the toolbar(s) and status bar), then you should pass it the CMainFrame (that's the default name which may have been changed, the one that is derived from CMDIFrameWnd).
Can you post the code of WindowToDIB()? I've just tried it and It Works For Me (TM), but without OpenGL code in the view. Try passing the following windows to your WindowToDIB() function:
CMainFrame* mainfrm = static_cast<CMainFrame*>(::AfxGetMainWnd());
- mainfrm

- mainfrm->MDIGetActive()

- mainfrm->MDIGetActive()->GetActiveView()

and see what you get.

A: The contents of each window are directX surfaces and are only assembled by the window manager in the graphics card.  You'd not be able to capture this unless you switch off the new interface (DWM) or code specifically for screen capture from the DWM.
Wikipedia has a good description of the Desktop Window Manager (DWM)

A: Sorry, I still don't understand. You're trying to get the Print Screen key to work on all four applications? Or you're trying to get the WindowtoDIB() function to work, which takes a 'screenshot' (from within your own application) of the application itself, so that it can be saved as an image file?
Also, what do you mean with 'he Print Screen key works as expected, but it does not save the screen as a JPEG.'? Print Screen only copies to the clipboard, what happens when you paste in Paint?
If your WindowtoDIB() function only 'captures' the window you pass to it, then yes, your MDI child windows are not going to show up.

A: We eventually solved this by creating a different OpenGL context, and drawing everything to that.  We gave up on the screen capture.

redpajama_set_name: RedPajamaStackExchange


text:
Q: R Shiny: Updating .csv input on a schedule I have a .csv that auto-updates every minute with new data. I'd like to have R Shiny reupdate every hour with this new dataset.
From everything I've seen, this will involve invalidateLater or autoInvalidate; however, I'm not sure how to get these working (or more importantly, where to put them).
ui.R is pretty straightforward so I won't include it. server.R is below:
library(ggplot2)
library(reshape2)
library(scales)

# data <- reactive({ # data refresh once a day # 86400000ms is 1 day
#   invalidateLater(10000, session) # 10s to test
# })

shinyServer(function(input, output, session) {

  autoInvalidate <- reactiveTimer(10000, session)

  observe({
    x <- read.csv("wait_times.csv", header=T, stringsAsFactors=FALSE)
    x <- rename(x, c("Fall.River" = "Fall River", "Martha.s.Vineyard" = "Martha's Vineyard", "New.Bedford" = "New Bedford", "North.Adams" = "North Adams", "South.Yarmouth" = "South Yarmouth"))
    cities <- colnames(x)[-1]

    x[x == 999] <- NA

    x_long <- melt(x, id.var="timestamp") ### does not work after Attleboro ###
    x_long <- rename(x_long, c("variable" = "city", "value" = "wait_time"))
    x_long$timestamp <- strptime(x_long$timestamp, "%d/%m/%Y %H:%M %p")

    weeks <- as.double(difftime(x_long$timestamp[1], x_long$timestamp[length(x_long$timestamp)], units = "weeks")) + 1

    print("REFRESHING CSV!")
    autoInvalidate()
  })

  # pass server-side code into initial UI page
  output$cities <- renderUI({
    checkboxGroupInput("cities",
                       label = h3("Which cities to view?"),
                       as.list(cities),
                       selected = "Boston")
  })

  output$weeks <- renderUI({
    sliderInput("weeks",
                label = h3("How many prior weeks to average?"),
                min = 1,
                max = weeks,
                step = 1,
                value = 1)
  })

  output$main <- renderPlot({

    x_output <- x_long[x_long$city == input$cities, ]
    p <- ggplot(x_output, aes(x=timestamp, y=wait_time, group=city)) + geom_line(aes(color=city), size=1.5) + scale_x_datetime(breaks = date_breaks("10 min")) + theme(axis.text.x = element_text(angle = 90, hjust=1), legend.position = "bottom") + labs(x=NULL, y="Waiting time (minutes)")
    print(p)

  })

})

When I pull out certain values from the .csv (like "weeks" and "cities"), R Shiny says they don't exist:
Error in as.list(cities) : object 'cities' not found
Error in sliderInput("weeks", label = h3("How many prior weeks to average?"),  :
  object 'weeks' not found
Error in func() : object 'x_long' not found

What I think is happening is that since these are being declared inside the observe function, they are encapsulated by it. Perhaps I should be invalidating/declaring these earlier? I've tried putting them before declaring shinyServer() but that hasnt' seemed to work either.
I've researched these sources but haven't been able to replicate:

*

*https://github.com/Btibert3/nhl-shiny/blob/master/server.R

*Update graph/plot with fixed interval of time

*http://shiny.rstudio.com/reference/shiny/latest/reactiveTimer.html

A: observe doesn't return a value (it returns an observer reference class).
You want to use reactive instead.
If you wanted only the variable cities for exemple, you could do it like this:
refrehed_cities <- reactive({
    autoInvalidate()

    x <- read.csv("wait_times.csv", header=T, stringsAsFactors=FALSE)
    x <- rename(x, c("Fall.River" = "Fall River", "Martha.s.Vineyard" = "Martha's Vineyard", "New.Bedford" = "New Bedford", "North.Adams" = "North Adams", "South.Yarmouth" = "South Yarmouth"))
    cities <- colnames(x)[-1]
    return cities
)}

and then use it in checkboxGroupInput:
output$cities <- renderUI({
     checkboxGroupInput("cities",
                       label = h3("Which cities to view?"),
                       as.list(refreshed_cities()),
                       selected = "Boston")
    })
})

An other way to do it would be to use the function reactiveValues, which enables you to store reactive values.


text:
Q: Upload large files to s3 with ASP.net MVC There are plenty of similar questions on Stack Overflow, but I'm having trouble uploading a large file to S3 via MVC.net.
Based on the aws .net sdk examples, and some other answers, I have the following:
public static void UploadToS3(System.IO.Stream stream, string bucketName, string keyName, bool asAttachement)
    {
        AmazonS3 client;
        string accessKey = Settings.ApplicationSettings.AccessKeyID;
        string secretKey = Settings.ApplicationSettings.SecretAccessKeyID;
        // This config ensures s3 works in medium trust.
        AmazonS3Config s3config = new AmazonS3Config();
        s3config.UseSecureStringForAwsSecretKey = false;
        using (client = Amazon.AWSClientFactory.CreateAmazonS3Client(accessKey, secretKey, s3config))
        {
            try
            {
                PutObjectRequest request = new PutObjectRequest();
                request.WithBucketName(bucketName)
                    .WithKey(keyName)
                    .WithInputStream(stream);

                if (asAttachement)
                {
                    // add headers to ensure asset is downloaded, not opened in browser.
                    request.AddHeaders(Amazon.S3.Util.AmazonS3Util.CreateHeaderEntry("Content-Disposition", "attachment"));
                }

                S3Response response = client.PutObject(request);
                response.Dispose();
            }
            catch(Exception ex)
            {
                throw new ApplicationException("Unable to upload asset." + ex.Message);
            }
        }
    }

The web app works perfectly with small files, and large files will upload to the site (hosted with Rackspace Cloud Sites), but the browser times out after about 30 seconds past the http post, which is not long enough to upload the stream to Amazon.  The browser times out as not receiving a response from the server.
What do I need to do to make this work for large files, or how should I be uploading a file to S3?

A: From the sound of it, you have 3 systems involved in this.  There is a client running a web-browser, there is your server, and there is S3.  As I understand your scenario, the client makes a request against your server, causing your server to upload a file to S3.  You mention that the browser is complaining that the server is not responding.  That is probably because your server is busy uploading the file to S3.  While your server is uploading the object to S3, it is not sending any status updates to the browser.  If the upload takes long enough, the browser will give up waiting.  That doesn't mean that the upload didn't happen, just that the browser stopped waiting for your server to respond.  What you need to do is return some kind of incremental result to the client.  I'm not a .Net programmer, but what I would probably do is to spawn an new thread to do the upload, and on the request thread return some initial content indicating that the request was underway, flush that response but not close the output.  When have a loop that waited for the upload thread, waking up every 5 seconds to writing a space character and flushing that to the client.  That will keep the browser from timing-out.


text:
Q: Themes in Adobe AIR What is the best way to skin/theme an AIR application. For example, I want to use a dark/blackish theme instead (similar to Tour de Flex) instead of the default gray one.

A: The ScaleNine themes are a good place to start, find one that is sort of like what you want, plug it into your app, and gradually replace the colors, images, and controls with your own.
http://www.scalenine.com/

A: I'm only just getting started in AIR as well, but if you're using Flex check out the Flex in a Week video series. There are several videos that cover creating custom MXML components and item renderers, which effectively let you skin your application.
You can also use CSS to style your app.

A: First you need to set the system chrome property in the air application properties file to none.
<initialWindow>
...
<systemChrome>none</systemChrome>
...
</initialWindow>

If the main file in your air app is named Main.mxml, then your application properties files will be named Main-app.xml. This file is not hard to find, it should be in the same location as the Main.mxml file.
By setting this property to none you are saying that you do not wish your air app window to take the style of the OS windows in which the app is running.
Since this property is set to none, the chrome for the air app will have to come from your Main.mxml file, which should be a WindowedApplication
Use the titleBarBackgroundSkin attriubute of the WindowedApplication To set the skin for the air app. titleBarBackgroundSkin defaults to "mx.skins.halo.ApplicationTitleBarBackgroundSkin"


text:
Q: How can I show the last update time on my wiki's home page I want to show something like: "This wiki was last updated on: dd/mm/yy at mm:ss", or maybe a fuzzy date like: "This wiki was last updated: 3 hours ago"
Is there a way of doing this?


text:
Q: IE11 Javascript behavior with polyfilled Function.name I have run into a strange behavior in IE11 JavaScript JIT.
Calling Function.name on Classes fails if it is called in the order of base class->child.  If called in the child->base class order, it succeeds.
This example:
console.log(Animal.name);
console.log(Snake.name); // returns Animal in IE11
console.log(Horse.name); // returns Animal in IE11

However:
console.log(Snake.name); // returns Snake in IE11
console.log(Horse.name); // returns Horse in IE11
console.log(Animal.name);

Note: changing the order of the children doesn't have any effect in this example.
I have a simple class hierarchy example which I built using Typescript, which is transpired into es6, then babel'd into es5.
The sample page includes the babel polyfill and the script.
I've also tried the JamesMGreene/Function.name polyfill.
Based on walking the code I don't think that is the problem.  This appears to be a flaw in the IE11 JIT.
I'm looking for any advice on how to handle this besides (1) don't use IE11 or (2) don't use Function.name.
Sample:

// Typescript
class Animal {
    hello(person: string) {
        console.log(`Hello ${person}`);
    }
}

class Snake extends Animal {
    hello(person: string) {
        console.log("I'm a snake");
        super.hello(person);
    }
}

class Horse extends Animal {
    get wow(): string {
        return "wow";
    }
}

console.log(Animal.name);
console.log(Snake.name);
console.log(Horse.name);

tsc -t ES2015 with produces this JavaScript:

class Animal {
    hello(person) {
        console.log(`Hello ${person}`);
    }
}
class Snake extends Animal {
    hello(person) {
        console.log("I'm a snake");
        super.hello(person);
    }
}
class Horse extends Animal {
    get wow() {
        return "wow";
    }
}
console.log(Animal.name);
console.log(Snake.name);
console.log(Horse.name);

Then babel with "presets": ["es2015"] generates the es5 Javascript:

"use strict";

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Animal = function () {
    function Animal() {
        _classCallCheck(this, Animal);
    }

    _createClass(Animal, [{
        key: "hello",
        value: function hello(person) {
            console.log("Hello " + person);
        }
    }]);

    return Animal;
}();

var Snake = function (_Animal) {
    _inherits(Snake, _Animal);

    function Snake() {
        _classCallCheck(this, Snake);

        return _possibleConstructorReturn(this, (Snake.__proto__ || Object.getPrototypeOf(Snake)).apply(this, arguments));
    }

    _createClass(Snake, [{
        key: "hello",
        value: function hello(person) {
            console.log("I'm a snake");
            _get(Snake.prototype.__proto__ || Object.getPrototypeOf(Snake.prototype), "hello", this).call(this, person);
        }
    }]);

    return Snake;
}(Animal);

var Horse = function (_Animal2) {
    _inherits(Horse, _Animal2);

    function Horse() {
        _classCallCheck(this, Horse);

        return _possibleConstructorReturn(this, (Horse.__proto__ || Object.getPrototypeOf(Horse)).apply(this, arguments));
    }

    _createClass(Horse, [{
        key: "wow",
        get: function get() {
            return "wow";
        }
    }]);

    return Horse;
}(Animal);

console.log(Animal.name);
console.log(Snake.name); // returns Animal in IE11
console.log(Horse.name); // returns Animal in IE11

<!DOCTYPE html>
<html>
    <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <script src="node_modules/babel-polyfill/dist/polyfill.js"></script>
        <script src="sample.es5.js"></script>
    </head>
</html>

A: I paid the $$$ and opened a support ticket with Microsoft.  This is a known bug with IE11, and may be fixed in the next release.


text:
Q: How to do a table with multicolumn in Latex? I have tried to do a table with multicolumn in LaTex but it doesn't work.
Here is my Code:
\documentclass[a4paper]{scrartcl}

\usepackage{adjustbox}
\usepackage{array}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{tabu}
\usepackage{xcolor}

\begin{document}

\begin{table}[h!]
\centering
%\begin{adjustbox}{width=\textwidth}
\begin{tabu}{|[1.5pt]c|[1.5pt]c|[1.5pt]c|[1.5pt]c|[1.5pt]c|[1.5pt]c|[1.5pt]c|[1.5pt]c|[1.5pt]c}
\tabucline[1.5pt]{-}
\multicolumn{8}{|[1.5pt]c|[1.5pt]}{\colorbox{yellow}{All Data}} \\
\tabucline[1.5pt]{-}
  & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\
\tabucline[1.5pt]{-}
Stepp 1 & • & • & • & • & • & • & • \\
\tabucline[1.5pt]{-}
Mean Value & • & • & • & • & • & • & • \\
\hline
Standard\-deviation & • & • & • & • & • & • & • \\
\tabucline[1.5pt]{-}
\end{tabu}
%\end{adjustbox}
\normalsize
\caption{gesamt}
\end{table}

\end{document}

And that's the result of the code:

But I want, that it looks like that:

Could someone help me to reach this, please? Thanks.

A: You may use the new LaTeX3 package tabularray instead of the outdated tabu package:
\documentclass[a4paper]{scrartcl}
\usepackage{tabularray}
\usepackage{xcolor}
\begin{document}
\begin{tblr}{hlines={1.5pt},vlines={1.5pt},cells={c},row{1}={yellow}}
\SetCell[c=8]{c} All Data & & & & & & & \\
                    & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\
Stepp 1             & • & • & • & • & • & • & • \\
Mean Value          & • & • & • & • & • & • & • \\
Standard-deviation  & • & • & • & • & • & • & • \\
\end{tblr}
\end{document}

A: With a regular tabular:

\documentclass[a4paper]{scrartcl}
\usepackage[table]{xcolor}
\begin{document}

\setlength{\arrayrulewidth}{1.5pt}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline
\rowcolor{yellow}\multicolumn{8}{|c|}{All Data} \\ \hline
                   & 1 & 2 & 3 & 4 & 5 & 6 & 7  \\ \hline
Stepp 1            & • & • & • & • & • & • & •  \\ \hline
Mean Value         & • & • & • & • & • & • & •  \\ \hline
Standard deviation & • & • & • & • & • & • & •  \\ \hline
\end{tabular}
\bigskip

\begin{tabular}{|>{\raggedright\arraybackslash}m{2cm}|c|c|c|c|c|c|c|}
\hline
\multicolumn{8}{|l|}{All Data} \\ \hline
                   & 1 & 2 & 3 & 4 & 5 & 6 & 7  \\ \hline
Stepp 1            & • & • & • & • & • & • & •  \\ \hline
Mean Value         & • & • & • & • & • & • & •  \\ \hline
Standard deviation & • & • & • & • & • & • & •  \\ \hline
\end{tabular}
\end{document}

A: With {NiceTabular} of nicematrix.
\documentclass[a4paper]{scrartcl}
\usepackage{nicematrix}
\usepackage{xcolor}
\begin{document}

\setlength{\extrarowheight}{3pt}
\begin{NiceTabular}[hvlines,rules/width=1pt]{cccccccc}
\Block[fill=yellow]{1-8}{All Data} \\
                    & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\
Stepp 1             & • & • & • & • & • & • & • \\
Mean Value          & • & • & • & • & • & • & • \\
Standard-deviation  & • & • & • & • & • & • & • \\
\end{NiceTabular}
\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).


text:
Q: Delete downloaded remote file with WinSCP script I have a PowerShell script that is working great to grab some files from a remote SFTP.  But I can not get the code to delete the files after download.  Here is what I have.
$session.Open($sessionOptions)

# Set up transfer options
$transferOptions = New-Object WinSCP.TransferOptions -Property @{
    ResumeSupport = New-Object WinSCP.TransferResumeSupport -Property @{ State = [WinSCP.TransferResumeSupportState]::Off }
}

# Transfer files
$session.GetFiles("/remote/*.txt", "\\Local\*", $False, $transferOptions).Check()

# Delete Transfers
$session.RemoveFiles($difference.Remote.FileName)

Instead I get an error that states:
Removals Failures
-------- --------                                                                                ---------
{}       {WinSCP.SessionRemoteException: Error listing directory '"/Files'....                                                                                False

A: To delete the downloaded files from the server, just pass true to the remove (3rd) argument of  Session.GetFiles:
$session.GetFiles("/remote/*.txt", "C:\local\*", $True, $transferOptions).Check()


text:
Q: Keras weighted_metrics does not include sample weights in calculation I am training a CNN model with a 2D tensor of shape (400,22) as both input and output. I am using categorical_crossentropy both as loss and metric. However the loss/metrics values are very different.
My model is somewhat like this:
1. Using sample weights, and passing metrics with metrics= in model.compile.
# Imports
import tensorflow as tf
from tensorflow.keras.layers import *
from tensorflow.keras.optimizers import *
from tensorflow.keras.regularizers import *
from tensorflow.keras import *
import numpy as np

# Build the model
X_input = Input(shape=(400,22))
X = Conv1D(filters=32, kernel_size=2, activation='elu',
           kernel_regularizer=L2(1e-4), bias_regularizer=L2(1e-4),
           padding='same')(X_input)
X = Dropout(0.2)(X)
X = Conv1D(filters=32, kernel_size=2, activation='elu',
           kernel_regularizer=L2(1e-4), bias_regularizer=L2(1e-4),
           padding='same')(X)
X = Dropout(0.2)(X)
y = Conv1D(filters=22, kernel_size=1, activation='softmax',
           kernel_regularizer=L2(1e-4), bias_regularizer=L2(1e-4),
           padding='same')(X)
model = Model(X_input, y, name='mymodel')

# Compile and train the model (with metrics=[])
model.compile(optimizer=Adam(1e-3),
              loss=tf.keras.losses.categorical_crossentropy,
               metrics=[tf.keras.losses.categorical_crossentropy])
Xtrain = np.random.rand(20,400,22)
ytrain = np.random.rand(20,400,22)
np.random.seed(0)
sample_weight = np.random.choice([0.01, 0.1, 1], size=20)
history = model.fit(x=Xtrain, y=ytrain, sample_weight=sample_weight, epochs=4)

Epoch 1/4
1/1 [==============================] - 0s 824us/step - loss: 10.2952 - categorical_crossentropy: 34.9296
Epoch 2/4
1/1 [==============================] - 0s 785us/step - loss: 10.2538 - categorical_crossentropy: 34.7858
Epoch 3/4
1/1 [==============================] - 0s 772us/step - loss: 10.2181 - categorical_crossentropy: 34.6719
Epoch 4/4
1/1 [==============================] - 0s 766us/step - loss: 10.1903 - categorical_crossentropy: 34.5797

From the results, it is evident that Keras is not using sample weights in the calculation of metrics, hence it is larger than the loss. If we change the sample weights to ones, we get the following:
2. Sample weights = ones, passing metrics with metrics= in `model.compile.
# Compile and train the model
model.compile(optimizer=Adam(1e-3),
              loss=tf.keras.losses.categorical_crossentropy,
               metrics=[tf.keras.losses.categorical_crossentropy])
Xtrain = np.random.rand(20,400,22)
ytrain = np.random.rand(20,400,22)
np.random.seed(0)
sample_weight = np.ones((20,))
history = model.fit(x=Xtrain, y=ytrain, sample_weight=sample_weight, epochs=4)

Epoch 1/4
1/1 [==============================] - 0s 789us/step - loss: 35.2659 - categorical_crossentropy: 35.2573
Epoch 2/4
1/1 [==============================] - 0s 792us/step - loss: 35.0647 - categorical_crossentropy: 35.0562
Epoch 3/4
1/1 [==============================] - 0s 778us/step - loss: 34.9301 - categorical_crossentropy: 34.9216
Epoch 4/4
1/1 [==============================] - 0s 736us/step - loss: 34.8076 - categorical_crossentropy: 34.7991

Now the metrics and loss are quite close with sample weights of ones. I understand that the loss is slightly larger than metrics due to the effects of dropout, regularization, and the fact that the metric is computed at the end of each epoch, whereas the loss is the average over the batches in the training.
How can I get the metrics to include the sample weights??
3. UPDATED: using sample weights, and passing metrics with weighted_metrics= in model.compile.
It was suggested that I used weighted_metrics=[...] instead of metrics=[...] in model.compile. However, Keras still does not include the sample weights in the evaluation of the metrics.
# Compile and train the model
model.compile(optimizer=Adam(1e-3),
              loss=tf.keras.losses.categorical_crossentropy,
               weighted_metrics=[tf.keras.losses.categorical_crossentropy])
Xtrain = np.random.rand(20,400,22)
ytrain = np.random.rand(20,400,22)
np.random.seed(0)
sample_weight = np.random.choice([0.01, 0.1, 1], size=20)
history = model.fit(x=Xtrain, y=ytrain, sample_weight=sample_weight, epochs=4)

Epoch 1/4
1/1 [==============================] - 0s 764us/step - loss: 10.2581 - categorical_crossentropy: 34.9224
Epoch 2/4
1/1 [==============================] - 0s 739us/step - loss: 10.2251 - categorical_crossentropy: 34.8100
Epoch 3/4
1/1 [==============================] - 0s 755us/step - loss: 10.1854 - categorical_crossentropy: 34.6747
Epoch 4/4
1/1 [==============================] - 0s 746us/step - loss: 10.1631 - categorical_crossentropy: 34.5990

What can be done to ensure that the sample weights are evaluated in the metrics?

A: Keras does not automatically include sample weights in the evaluation of metrics. That's why there is a huge difference between the loss and the metrics.
If you'll like to include sample weights when evaluating metrics, pass them as weighted_metrics rather than metrics.
model.compile(optimizer=Adam(1e-3),
              loss=tf.keras.losses.categorical_crossentropy,
              weighted_metrics=[tf.keras.losses.categorical_crossentropy]))

A: First of all, categorical cross-entropy is usually not used as a metric. Secondly, you are doing some type of seq2seq task, I hope you design the model with that intention.
Finally, in your setup, using sample_weight only works on the loss, it has no effect on the metrics or validation. There are other small bugs in your code too. Here is the fixed working code:
ref: TF 2.3.0 training keras model using tf dataset with sample weights does not apply to metrics (why sample_weight only works on loss)
import tensorflow as tf
from tensorflow.keras.layers import *
from tensorflow.keras.optimizers import *
from tensorflow.keras import *
import numpy as np

X_input = Input(shape=(400,22))
X = Conv1D(filters=32, kernel_size=2, activation='elu', kernel_regularizer=L2(1e-4), bias_regularizer=L2(1e-4), padding='same')(X_input)
X = Dropout(0.2)(X)
X = Conv1D(filters=32, kernel_size=2, activation='elu', kernel_regularizer=L2(1e-4), bias_regularizer=L2(1e-4), padding='same')(X)
X = Dropout(0.2)(X)
y = Conv1D(filters=22, kernel_size=1, activation='softmax', kernel_regularizer=L2(1e-4), bias_regularizer=L2(1e-4), padding='same')(X)

model = Model(X_input, y, name='mymodel')
model.compile(optimizer=Adam(1e-3), loss=tf.keras.losses.categorical_crossentropy,
metrics=[tf.keras.losses.categorical_crossentropy])

Xtrain = np.random.rand(10,400,22)
ytrain = np.random.rand(10,400,22)

history = model.fit(Xtrain, ytrain, sample_weight=np.ones(10), epochs=10)

Epoch 1/10
1/1 [==============================] - 1s 719ms/step - loss: 35.4521 - categorical_crossentropy: 35.4437
Epoch 2/10
1/1 [==============================] - 0s 20ms/step - loss: 35.5138 - categorical_crossentropy: 35.5054
Epoch 3/10
1/1 [==============================] - 0s 19ms/step - loss: 35.5984 - categorical_crossentropy: 35.5900
Epoch 4/10
1/1 [==============================] - 0s 19ms/step - loss: 35.6617 - categorical_crossentropy: 35.6533
Epoch 5/10
1/1 [==============================] - 0s 19ms/step - loss: 35.7807 - categorical_crossentropy: 35.7723
Epoch 6/10
1/1 [==============================] - 0s 19ms/step - loss: 35.9045 - categorical_crossentropy: 35.8961
Epoch 7/10
1/1 [==============================] - 0s 18ms/step - loss: 36.0590 - categorical_crossentropy: 36.0505
Epoch 8/10
1/1 [==============================] - 0s 19ms/step - loss: 36.2040 - categorical_crossentropy: 36.1956
Epoch 9/10
1/1 [==============================] - 0s 18ms/step - loss: 36.4169 - categorical_crossentropy: 36.4084
Epoch 10/10
1/1 [==============================] - 0s 32ms/step - loss: 36.6622 - categorical_crossentropy: 36.6538

Here, if you use no sample_weight or 1 for each sample, you will get close/similar categorical cross-entropy.
Use weighted_metrics according to docs.


text:
Q: How to automatically store data from Oracle in SQL Server (according to a schedule) Hello,
I'm new here, so sorry, if my question is too basic. However, maybe you have some advice, example, links, which could help me... I'm trying to find something helpfull for few days, but no results as for now.
I'm working in a distributed environment. I have a Oracle server hundreds of miles away and a MS SQL server close to me. I'm writing a application using Visual Web Developer 2008 Express. I need some data from Oracle. It's not worth to query the Oracle server every time i need some data from it. I'd prefer to run some Oracle queries once each night and store results in some local (SQL Server) tables. I assume, I should run queries through standard windows scheduler (Windows Server 2008). I have the basic connectivity - I can open Oracle Database from local Visual Studio.
The questions are:

*

*How to write a query/procedure/function that would get data from Oracle and put them into a SQL Server table (possibly recreated before each query run)?

*How can I run such a query from command line (or in other way run from scheduler)

*What naming conventions are applicable? In VS I use something like //IP.IP.IP.IP/Name and a user with password.

Thanks for any help or advice.
Regards,
Matteo

A: I suggest you speak to the DBA's of the Oracle and SQL Server databases, as there may be other considerations you need to bear in mind. (Data Integrity, Security, ownership etc.)
One route you could follow would be to implement DTS (For older databases) or SSIS (for new versions of SQL Server) processes to copy the data across on the schedule you want. (This is pretty much what they were built for.)

A: Thanks...
I'm the DBA for the SQL Server, which will serve only for my application. For Oracle I just want to read data and I have enough privileges and agreement with DBA's. Security, ownership and integrity are not an issue for now. I just need some technical advise how to get data from Oracle to MSSQL tables on a schedule.
I use MS SQL Server 2008 Express SP1. I'm very close to solve my problem - I have established connections and everything installed and working. I just don't know, how to run a query, which would get data from Oracle and put into MSSQL, on regular basis, without manual interaction.
I've some experience in programming, but not much in databases (except creating complex SQl queries). Therefore some example or links to detailed description would be helpful. I'm not sure about naming conventions, differences between procedures, functions and queries, command line options to run db automation procedures and so on. I'm also not sure, about which mechanisms or technologies are available in MS SQL Server 2008 Express edition.

A: How much data are we talking about?
If there is a small quantity that you need to transfer every day, you can write a stupid fetch and insert script in language of your choice.
You only need to search for better solutions if "sync" would take too much resources.


text:
Q: Packing multiple exe files in Inno setup and install x64 or x86 version exe depending on OS I want to execute multiple exe files. I have 3 exe files:
1. XYZTool.exe
2. vcredst_x86 (Visual Studio Redistributable 2015)
3. vcredst_x64 (Visual Studio Redistributable 2015)
When XYZTool.exe is run, the supported vcredst( x64 or x86) should run and installed successfully and then the installation of XYZTool should resume and install successfully.


text:
Q: sh variable not working if blank Need some extra eyes for this one...
dns_lookup() {
    ip_set
    if [ `ip_ping ${ip_address}` -eq 0 ]
    then
            host=""
            dig +short -x ${ip_address} | sed 's/\.$//g' | while read host
            do
                    if [ -z "${host}" ]
                    then
                            host="unknown"
                    fi
                    echo "${ip_address},${host}"
            done
    fi

}
I get desired results if ip is pingable and has a dns name.  I do not get results if the ip is pingable but does not have a dns name.

ip_set() {
        ip_address="${a}.${b}.${c}.${d}"
}

ip_ping() {
  timeout ${delay} ping -q -c 1 -i 1 -W 1 -w 4 $1 > /dev/null 2>&1 ; echo $?
}

A: You don't get a result when there's no hostname because your while read loop never runs when there are no lines to read. You should make your printing code run regardless:
host=$(dig +short -x "${ip_address}" | sed 's/\.$//g')
if [ -z "${host}" ]
then
    host="unknown"
fi
printf "${ip_address},%s\n" $host

Also, you're going about your condition wrong. You shouldn't echo the exit status and compare it as text. You should just let your command's exit status be your function's exit status:
ip_ping() {
  timeout ${delay} ping -q -c 1 -i 1 -W 1 -w 4 $1 > /dev/null 2>&1
  # functions implicitly 'return $?' if you don't specify anything else
}

Now you can easily check your function:
if ip_ping "$ip_address"
then
    echo "It worked"
else
    echo "It failed.."
fi

A: Perhaps this is what you need. Tell me if you need revisions.
dns_lookup() {
    ip_set
    if [ `ip_ping ${ip_address}` -eq 0 ]
    then
        host=""
        dig +short -x ${ip_address} | sed 's/\.$//g' | {
            hashosts=false
            while read host
            do
                if [ -n "${host}" ]
                then
                    hashosts=true
                    echo "${ip_address},${host}"
                fi
            done
            [ "${hashosts}" = false ] && echo "${ip_address},unknown"
        }
    fi
}

I would have also suggested the change of function ip_ping but that_other_guy already did it.


text:
Q: Question mark don't follow line breaks in Hebrew on Wordpress I am working on a Wordpress website that has just one page in Hebrew, which is a FAQ page. I am using Accordion to display the questions, the problem is that when the questions break into two or more lines the question mark insists on showing up in the first line.
I've created a testing page so you can see the problem: https://ethnicitydemo.com/ethnicity-3/testing-page/
Shrink the screen to see the questions when the break line happens.
I already turn the RTL option on.
I tried to force a line break with  before the question mark without success. The question mark is always stuck at the end of the first line.
Does anyone have any idea of how to solve this problem?
Thank you!


text:
Q: Compositing 2 videos with half opacity using AVFoundation without CALayer becomes appending videos? What I wanted: Insert multiple videos layers with some opacity ALL at time 0:00 of a AVVideoCompositionTrack.
I read carefully official AVFoundation documents and also many WWDC discussion on this topic. But I couldn't understand why the result is NOT following the API statements.
I can achieve the overlay result with 2 AVPlayerLayer during playback. That could also mean I can use AVVideoCompositionCoreAnimationTool to achieve similar stuff during export.
But I tend to leave CALayer for the subtitles/image overlays or the animations.
What I tried for any inserting AVAsset:
- (void)addVideo:(AVAsset *)asset_in withOpacity:(float)opacity
{
    // This is demo for composition of opaque videos. So we all insert video at time - 0:00
    [_videoCompositionTrack insertTimeRange:CMTimeRangeMake( kCMTimeZero, asset_in.duration )
                                    ofTrack:[ [asset_in tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0 ]
                                     atTime:kCMTimeZero error:nil ];

    AVMutableVideoCompositionInstruction *mutableVideoCompositionInstruction = [AVMutableVideoCompositionInstruction videoCompositionInstruction];
    AVAssetTrack *assettrack_in = [ [asset_in tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0 ];
    mutableVideoCompositionInstruction.timeRange = CMTimeRangeMake( kCMTimeZero, assettrack_in.timeRange.duration );
    AVMutableVideoCompositionLayerInstruction *videoCompositionLayerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:_videoCompositionTrack];
    [videoCompositionLayerInstruction setTransform:assettrack_in.preferredTransform atTime:kCMTimeZero];
    [videoCompositionLayerInstruction setOpacity:opacity atTime:kCMTimeZero];
    mutableVideoCompositionInstruction.layerInstructions = @[videoCompositionLayerInstruction];
    [_arrayVideoCompositionInstructions addObject:mutableVideoCompositionInstruction];
}

Please be aware that insertTimeRange has atTime:kCMTimeZero as parameter. So I expect they will be put at the beginning of the video composition.
What I tried for exporting:
- (IBAction)ExportAndPlay:(id)sender
{
    _mutableVideoComposition.instructions = [_arrayVideoCompositionInstructions copy];

    // Create a static date formatter so we only have to initialize it once.
    static NSDateFormatter *kDateFormatter;
    if (!kDateFormatter) {
        kDateFormatter = [[NSDateFormatter alloc] init];
        kDateFormatter.dateStyle = NSDateFormatterMediumStyle;
        kDateFormatter.timeStyle = NSDateFormatterShortStyle;
    }
    // Create the export session with the composition and set the preset to the highest quality.
    AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset:_mutableComposition presetName:AVAssetExportPresetHighestQuality];
    // Set the desired output URL for the file created by the export process.
    exporter.outputURL = [[[[NSFileManager defaultManager] URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:@YES error:nil] URLByAppendingPathComponent:[kDateFormatter stringFromDate:[NSDate date]]] URLByAppendingPathExtension:CFBridgingRelease(UTTypeCopyPreferredTagWithClass((CFStringRef)AVFileTypeQuickTimeMovie, kUTTagClassFilenameExtension))];
    // Set the output file type to be a QuickTime movie.
    exporter.outputFileType = AVFileTypeQuickTimeMovie;
    exporter.shouldOptimizeForNetworkUse = YES;
    exporter.videoComposition = _mutableVideoComposition;
    _mutableVideoComposition.instructions = [_arrayVideoCompositionInstructions copy];
    // Asynchronously export the composition to a video file and save this file to the camera roll once export completes.
    [exporter exportAsynchronouslyWithCompletionHandler:^{
        dispatch_async(dispatch_get_main_queue(), ^{
            switch ([exporter status]) {
                case AVAssetExportSessionStatusFailed:
                {
                    NSLog(@"Export failed: %@ %@", [[exporter error] localizedDescription],[[exporter error]debugDescription]);
                }
                case AVAssetExportSessionStatusCancelled:
                {
                    NSLog(@"Export canceled");
                    break;
                }
                case AVAssetExportSessionStatusCompleted:
                {
                    NSLog(@"Export complete!");
                    NSLog( @"Export URL = %@", [exporter.outputURL absoluteString] );
                    [self altPlayWithUrl:exporter.outputURL];
                }
                default:
                {
                    NSLog(@"default");
                }
            }

        } );
    }];
}

What turns out: It export a video with second video appended after first video, if I select 2 video clips.
This is not the same behaviour from what I read from :AVMutableCompositionTrack
May anyone shed some light for this helpless lamb?
Edit: Is there any detail missing so that no one can lend me a hand? If so, please leave comment so I can make them up.

A: Okay, sorry to ask this because of some misunderstanding of API about AVMutableCompositionTrack.
If you want to blend 2 video as 2 overlay as I do. You're going to need 2 AVMutableCompositionTrack instances, both instantiated from the same AVMutableComposition like this:
    // 0. Setup AVMutableCompositionTracks <=  FOR EACH AVAssets !!!
AVMutableCompositionTrack *mutableCompositionVideoTrack1 = [mutableComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
AVMutableCompositionTrack *mutableCompositionVideoTrack2 = [mutableComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];

And insert both AVAssets you want into THEIR OWN AVMutableCompositionTrack:
    AVAssetTrack *videoAssetTrack1 = [ [ [_arrayVideoAssets firstObject] tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0 ];
AVAssetTrack *videoAssetTrack2 = [ [ [_arrayVideoAssets lastObject] tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0 ];
    [ mutableCompositionVideoTrack1 insertTimeRange:CMTimeRangeMake( kCMTimeZero, videoAssetTrack1.timeRange.duration ) ofTrack:videoAssetTrack1 atTime:kCMTimeZero error:nil ];
    [ mutableCompositionVideoTrack2 insertTimeRange:CMTimeRangeMake( kCMTimeZero, videoAssetTrack2.timeRange.duration ) ofTrack:videoAssetTrack2 atTime:kCMTimeZero error:nil ];

Then setup the AVMutableVideoComposition with 2 layer instruction of each AVMutableCompositionTracks:
AVMutableVideoCompositionInstruction *compInstruction = [AVMutableVideoCompositionInstruction videoCompositionInstruction];
compInstruction.timeRange = CMTimeRangeMake( kCMTimeZero, videoAssetTrack1.timeRange.duration );
AVMutableVideoCompositionLayerInstruction *layerInstruction1 = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:mutableCompositionVideoTrack1];
[layerInstruction1 setOpacity:0.5f atTime:kCMTimeZero];

AVMutableVideoCompositionLayerInstruction *layerInstruction2 = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:mutableCompositionVideoTrack2];
[layerInstruction2 setOpacity:0.8f atTime:kCMTimeZero];
CGAffineTransform transformScale = CGAffineTransformMakeScale( 0.5f, 0.5f );
CGAffineTransform transformTransition = CGAffineTransformMakeTranslation( videoComposition.renderSize.width / 2,  videoComposition.renderSize.height / 2 );
[ layerInstruction2 setTransform:CGAffineTransformConcat(transformScale, transformTransition) atTime:kCMTimeZero ];
compInstruction.layerInstructions = @[ layerInstruction1, layerInstruction2 ];
videoComposition.instructions = @[ compInstruction ];

Finally, it should be fine during exporting.
Sorry to bother if any did take a look.


text:
Q: terminal - Remove background color of text in ls (with oh-my-zsh arrow theme) I am using zsh instead of bash in my Ubuntu Gnome 16.04 machine and I'm very frustrated with the background colors when I do ls because I can barely read the text.
Here's a screenshot of my terminal.

I use oh-my-zsh's arrow theme, by the way, which has configurations of:
export LSCOLORS="exfxcxdxbxbxbxbxbxbxbx"
export LS_COLORS="di=34;40:ln=35;40:so=32;40:pi=33;40:ex=31;40:bd=31;40:cd=31;40:su=31;40:sg=31;40:tw=31;40:ow=31;40:"

I tried changing stuff on the configs above but nothing's working. Is there any way to remove the annoying background color in directories?

A: The problem is not with the .zshrc but with dircolors. The easiest way to come out of this is by installing another plugin for ohmyzsh. Follow the steps in readme and for the dark theme, I am not finding any issues.
Hope this helps.


text:
Q: What database is easy to maintain and manage in a cluster? I'm looking for a database (DBMS) that is easy to scale out. I would like to have high availability so I need a multi-master cluster, where the data is replicated to two or more physical computers. I would also like to be able to start with one node (no replication), and then scale out to more nodes as needed without a reinstallation or downtime.
I would like to have a DBMS that are easy to maintain and manage. It should be easy to add nodes, remove nodes, take live backup and monitor the use of resources.
It doesn't have to be a relational database system, so a NoSQL is okey. And I would like to have a free version so I can test it in small scale and compare it with alternatives.
What alternatives do I have?

A: *

*Cassandra has been proven to scale remarkably well.

*Voldemort is another option that is in production.

*In the commercial space there's Greenplum.

Why do you 'need' and easy to scale solution?  What problem are you trying to solve?


text:
Q: How to control the output from MS Access to Excel Does any body know how to control the layout of the output from a table in MS Access to Excel.
For example:
My MS Access table looks like  so
--------------------------------------------------
|ID      | Field 2 | Field 3| Field 4 | ETC
--------------------------------------------------
|A       | 1       | 2      | 3       |
|A       | 4       | 5      | 6       |
|B       | 7       | 8      | 9       |
|C       | 10      | 11     | 12      |
|A       | 13      | 14     | 15      |

Although I would like to output the data into excel like:
--------------------------------------------------
|ID      | Field 2 | Field 3| Field 4 | ETC
--------------------------------------------------
|A       | 1       | 2      | 3       |
|        | 4       | 5      | 6       |
|        | 13      | 14     | 15      |
|B       | 7       | 8      | 9       |
|C       | 10      | 11     | 12      |

So I can group all the records by the 'ID' field.
Any ideas?

A: Re: row order
Of course, you could sort the rows in Excel, but if you wanted to do it in Access you would create a Select query that does the sorting, save it, and then export the query instead of the table.
Re: suppressing duplicate values
You probably don't want to omit them entirely, but you can hide them in Excel using the Conditional Formatting feature. In your case you would

*

*select the ID values in column A (starting with row 2)

*invoke Conditional Formatting

*choose "Use a formula to determine which cells to format"

*set the formula to =A2=A1

*set the font colour to be the same as the background colour

(ref: here)
Edit: In response to comment below, sample Excel VBA code to apply the formatting (as captured by "Record Macro" in Excel):
Range("A2:A6").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=A2=A1"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
    .ThemeColor = xlThemeColorDark1
    .TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False

A: Try something like this.
First a few useful functions:
1) Get Recordset from Access based on SELECT statement (passed via argument).
Option Explicit
Public Function Rst_From_Access(sSQL_Select As String) As ADODB.Recordset

Dim oConn                           As ADODB.Connection
Dim oRst                            As ADODB.Recordset
Dim sPath_DB                        As String
Dim sFile_DB                        As String

Dim sConn                           As String

'Instantiate the ADO-objects.

Set oConn = New ADODB.Connection
Set oRst = New ADODB.Recordset

'Set Path and File
sPath_DB = ThisWorkbook.Names("PARAM_PATH_DB").RefersToRange.value
sFile_DB = ThisWorkbook.Names("PARAM_FILE_DB").RefersToRange.value

 'Create the connectionstring.
sConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & sPath_DB & sFile_DB & ";"

With oConn
    .Open (sConn) 'Open the connection.
    .CursorLocation = adUseClient 'Necessary to disconnect the recordset.
End With

With oRst
    .Open sSQL_Select, oConn 'Create the recordset.
    Set .ActiveConnection = Nothing 'Disconnect the recordset.
End With

Set Rst_From_Access = oRst

End Function

2) ADO Connection:
Public Sub open_ADODB_Connection()

Dim oConn                           As ADODB.Connection
Dim sPath_DB                        As String
Dim sFile_DB                        As String

Dim sConn                           As String

'Instantiate the ADO-objects.

Set oConn = New ADODB.Connection

'Set Path and File
sPath_DB = ThisWorkbook.Names("PARAM_PATH_DB").RefersToRange.value
sFile_DB = ThisWorkbook.Names("PARAM_FILE_DB").RefersToRange.value

 'Create the connectionstring.
sConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & sPath_DB & sFile_DB & ";"

With oConn
    .Open (sConn) 'Open the connection.
    .CursorLocation = adUseClient 'Necessary to disconnect the recordset.
End With

End Sub

3) Call the Recordset:
Option Explicit
Sub Connect_To_DB()

Dim oSheet                      As Excel.Worksheet

Dim sSQL_Select                 As String
Dim oRst                        As ADODB.Recordset
Dim iMax_Col                    As Integer
Dim lMax_Row                    as long

Set oSheet = ThisWorkbook.Sheets("Main")

'Get recordset
sSQL_Select = "SELECT * FROM T_TABLE ORDER BY ID;"

Set oRst = Rst_From_Access(sSQL_Select)

iMax_Col = oRst.Fields.Count
oRst.MoveLast
iMax_Row = oRst.RecordCount

With oSheet
   .Range(.Cells(1, 1), .Cells(iMax_Row, _
        lMax_Col)).CopyFromRecordset oRst
End With

End Sub

Of course, you will have a repetition of the ID, will that cause a problem?
In general, I think that it is better to keep all data for every row.
If it is for printing purposes, then I would immediately print it from Access.


text:
Q: Preserving relations and operations in an automorphism An automorphism is an isomorphism of an algebraic structure with itself.
Let's review an isomorphism $i$ of two linearly ordered groups $G(+,<)$ and $F(*,<)$.
$i$ is linear order-preserving when $a < b \iff i(a) < i(b)$ for any elements $a$ and $b$ in $G$.
Let's note that every linear order induces the reverse order: $G(+, <, >)$, $F(*, <, >)$.
An isomorphism $i^*$ is linear order-reversing when $a < b \iff i(a) > i(b) \iff i(b) < i(a)$.
Any linear order-preserving isomorphism $i$ induces linear order-reversing isomorphism $i^*$.
In case $G$ and $F$ are different, choosing between $<$ and $>$ in each of the groups is an arbitrary decision, so one can say $i$ and $i^*$ are equivalent.
It looks like this is not the case when we talk about automorphisms.
Let's assume $G$ is commutative and review the inversion automorphism $i(a) = -a$.
$i$ is order-reversing since $a < b \iff -b < -a$.
But in this case we can clearly see the difference between order-preserving and order-reversing automorphisms: $i$ maps $<$ to $>$ on the same set.
I am wondering if it make sense to explicitly say if an automorphism keeps operations and relations the same?
I've never thought of mapping $+$ to $\times$ in an automorphism of an algebraic structure $(+, \times)$.
Are there practical examples of such mapping?
There was a similar discussion with no positive conclusion in here:
https://www.researchgate.net/post/Difference_between_an_order_automorphism_and_order_isomoprhism


text:
Q: C# Upload file larger as 2mb I managed to upload files less than 2mb, but since I also want to upload larger files I had to move away from CSOM.
So I searched the web and found this solution:
ClientContext ctx = new ClientContext("https://mysharepoint.com/sites/testing/");
ctx.Credentials = new SharePointOnlineCredentials("user@sharepoint.com", passWord);
Folder folder = ctx.Web.GetFolderByServerRelativeUrl("test");
string file = String.Concat(Environment.CurrentDirectory, @"\a.pdb");

List docLib = ctx.Web.Lists.GetByTitle("test");
ctx.Load(docLib);
ctx.ExecuteQuery();

using (MemoryStream stream = new MemoryStream(System.IO.File.ReadAllBytes(file)))
{
    Microsoft.SharePoint.Client.File.SaveBinaryDirect(ctx, "/test/a.pdb", stream, true);
}

but it exits with the message:

401 not authorized

Seems to be a known issue in current SharePoint versions, but i also saw on other posts here, that it got fixed a while ago and should work?

A: The following code for your reference.
string targetSiteURL = @"https://mysharepoint.com/sites/testing/";

var login = "lz@xxx.onmicrosoft.com";
var password = "password";

var securePassword = new SecureString();
foreach (char c in password)
{
    securePassword.AppendChar(c);
}

ClientContext ctx = new ClientContext(targetSiteURL);
ctx.Credentials = new SharePointOnlineCredentials(login, securePassword);

string file = @"c:\temp\a.pdb";

using (MemoryStream stream = new MemoryStream(System.IO.File.ReadAllBytes(file)))
{
    Microsoft.SharePoint.Client.File.SaveBinaryDirect(ctx, "/sites/testing/test/a.pdb", stream, true);
}

And check if the login account and password are right.
If you use SharePoint On-premise, we need using the below code to pass Credentials.
ctx.Credentials=new NetworkCredential("username", "password","domain");


text:
Q: Сохранение данных при возврате Есть последовательность из 4 страниц html: main_page, day_page, para_page, name_page. На страницах все работает, но когда на андроиде нажимать на кнопку назад то данные не сохраняются.
Как решить проблему с помощью js либо jquery

A: Если вам нужно чтобы сохранялись данные в полях можете использовать, что-то вроде этого:
$(function() {
  function serialize() {
    var obj = {};

    $('input[type="text"]').each(function(id, el) {
      var $el = $(el);
      obj[$el.attr('name')] = $el.val();
    });

    sessionStorage.setItem('data', JSON.stringify(obj));
  }

  function deserialize() {
  console.log(sessionStorage.getItem('data'))
    var obj = JSON.parse(sessionStorage.getItem('data', '{}'));

    for (var i in obj) {
      if (!obj.hasOwnProperty(i)) continue;

      $('input[name="' + i + '"]').val(obj[i]);
    }
  }

  $('input[type="text"]').change(function() {
    serialize();
  });

  deserialize();
});

https://jsfiddle.net/vntekhm1/2/


text:
Q: Passwordless remote access to a restricted shell For, um, historic reasons, we have a C program for HPUX which accepts telnet connections, and runs a home-grown REPL that restricts the commands available.
Rather than port this code to Linux, I'd like to get effectively the same functionality using standard tools.
Simple, you say - just make a user with bash --restricted as its default shell.
However we want the restricted shell to have an effective userid of "user1", and for it to be accessible without a password. Meanwhile we'd like "user1" to behave normally when accessed in the conventional manner.
I think it would be OK -- desirable even -- if SSH was the comms protocol instead of telnet.
Any ideas?


text:
Q: Digital Ocean Kubernetes Let's Encrypt Waiting for HTTP-01 challenge propagation: failed to perform self check I have been trying to deploy a Kubernetes cluster in Digital Ocean. Everything seems to work except when I try to apply the tls certificates. I have been following these steps, but with Nginx Ingress Controller v1.0.0 and cert-manager v1.5.0.
I have two urls, let's say api.example.com and www.example.com
Checking the challenge I saw Waiting for HTTP-01 challenge propagation: failed to perform self check GET request...
I tried adding the following annotations to the ingress:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /
cert-manager.io/cluster-issuer: "letsencrypt-prod"

Or using this service as a workaround:
kind: Service
apiVersion: v1
metadata:
  name: ingress-nginx
  namespace: ingress-nginx
  annotations:
    service.beta.kubernetes.io/do-loadbalancer-enable-proxy-protocol: "true"
    service.beta.kubernetes.io/do-loadbalancer-hostname: "www.example.com"
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
spec:
  #CHANGE/ADD THIS
  externalTrafficPolicy: Cluster
  type: LoadBalancer
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
  ports:
    - name: http
      port: 80
      targetPort: http
    - name: https
      port: 443
      targetPort: https

If I go to the URL challenge I am able to see the hash, but I am stuck, I am not sure why it is failing or the steps to solve this.

A: As agusgambina has mentioned in the comment, problem is solved:

I was able to make this work, first I need to get the load balancer id executing  k describe svc ingress-nginx-controller --namespace=ingress-nginx and then pasting in the annotation kubernetes.digitalocean.com/load-balancer-id: "xxxx-xxxx-xxxx-xxxx-xxxxx" thanks for your comments, it helped me to solve the issue.

This problem described also here and there is also a tutorial
How to Set Up an Nginx Ingress with Cert-Manager on DigitalOcean Kubernetes.


text:
Q: How to run a script with admin privileges to kill a process? I'm trying to run a python script to kill a process, but I need admin rights. I tried using runas /profile /savecred /user:domain\user "taskkill /f /im myprocess.exe" but it didn't work. My user has admin rights on the system (windows).
I know the script works, because I have tested it in the Admin CMD window.
Also, I tested the code here but I am asked to run python and I need to bypass this UAC request.
Does anyone know how I can do this?


text:
Q: What's the subtle difference between certificate and credential? What's the subtle difference between certificate and credential?

A: In the broadest sense, a certificate is a certain type of credential, but may be one among many. For example, in Illinois, a barber has to have a state license, which is a credential. The barber may also have a certificate from a barber college, another type of credential, and, if he has chosen to locate his barber shop in a municipality, the barber may have a license to do business in that municipality, and a Tax certificate, if he is selling hair tonic and other supplies upon which he must charge retailers tax.


text:
Q: The most important theorems in fixed point theory What are the most important theorems in fixed point theory and why are they so important?
I know some: Banach's contraction principle, Brouwers fixed point theorem, caristi fixed point theore...
I also know that Banach's contraction principle has a crucial role in existence and uniqueness of the solution of the Cauchy problem in ode-s.

A: You should add to your list the Kakutani's fixed point theorem. It's application in Game Theory by John F. Nash, has provided the single most prominent result in the contemporary Game Theory, that is the existance of an equilibrium - which is known as the Nash Equilibrium - in every finite game.
The importance can be seen, that by applying the fixed point theorem, Nash's original paper, where he initiated the concept of the Nash Equilibrium and which is (again) the single most cited paper in Game Theory, has a length of less than a page.


text:
Q: why cant i simply copy n paste this to every page to have nav bar+logo? why cant I paste this to any .html doc and have it run right only in resources tab?
The logo only displays on the resources page, even though it is the same css stylesheet referenced in, as well as the same html copied.

Home

News

            Resources

                MINING
                CURRENCY
                TRADING
                LINKS

            Equipment

                GPU
                ASIC
                MOTHERBOARD
                ACCESORIES

A: Since you are using relative paths for the src for the logo img, it is likely that your file structure is the issue.
Your .html files need to be in the same directory as the logo2.png in order for them to find that image


text:
Q: VS2017 Project fallback framework error when building solution I have a .NET Core solution which is resulting in below error when I build - it was originally pointing to .NET Core 2.0 now pointing to .NET Core 2.1 and this error is appearing since.
I have tried to search the internet but couldn't find anyone who has had the same problem.
Error attached below:

Project file below
 <Project Sdk="Microsoft.NET.Sdk.Web">
    <PropertyGroup Label="Globals">
      <SccProjectName>SAK</SccProjectName>
      <SccProvider>SAK</SccProvider>
      <SccAuxPath>SAK</SccAuxPath>
      <SccLocalPath>SAK</SccLocalPath>
    </PropertyGroup>

    <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <AssetTargetFallback>%3bnet461%3bportable-net45+win8</AssetTargetFallback>
   </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
      <PlatformTarget>AnyCPU</PlatformTarget>
    </PropertyGroup>

    <ItemGroup>
     <Compile Remove="Controllers\TestController.cs" />
     <Compile Remove="Controllers\ValuesController.cs" />
    </ItemGroup>

    <ItemGroup>
    <Folder Include="wwwroot\" />
    </ItemGroup>

    <ItemGroup>
    <PackageReference Include="EvoHtmlToPdf_NetCore_Client" Version="7.5.0"
    />
    <PackageReference Include="Kendo.Mvc" Version="2016.2.616" />
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.5" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication"
     Version="2.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Authorization" Version="2.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Authorization.Policy" Version="2.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.1.3" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.1.3" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.1.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
    <PackageReference Include="Microsoft.Extensions.Options" Version="2.1.1" />
    <PackageReference Include="Microsoft.IdentityModel.Tokens" Version="5.2.4" />
    <PackageReference Include="Mime" Version="3.0.1" />
    <PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0-preview2-final" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\TEST\DataLayer.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Content Update="appsettings.json">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

  <ItemGroup>
    <None Update="AppSettings.cs.d.ts">
      <DependentUpon>AppSettings.cs</DependentUpon>
    </None>

A: Removing this line fixed it - thanks to Jon and Camilo
<AssetTargetFallback>%3bnet461%3bportable-net45+win8</AssetTargetFallback>


text:
Q: How Can I change the value of "maxdets" in Faster R-CNN by Pytorch? I am implementing a faster RCNN network on pytorch. I have followed the next tutorial.
https://pytorch.org/tutorials/intermediate/torchvision_tutorial.html
There are images in which I have more than 100 objects to classify. However, with this tutorial I can only detect a maximum of 100 objects, since the parameter "maxdets" = 100.
Is there a way to change this value to adapt it to my project?
IoU metric: bbox
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.235
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.655
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.105
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.238
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.006
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.066
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.331
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.331
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000

If only change next param, it would be the problem solved?
cocoeval.Params.setDetParams.maxDets = [1, 10, 100]

Thank you!

A: "There are images in which I have more than 100 objects to classify."
maxDets = 100 doesn't mean it will classify only 100 images but it refers to % AverageRecall given 100 detections per image
inshort maxDets is realted to metrics not actual no. of images classified.
for more info visit :
http://cocodataset.org/#detection-eval
Tensorboard graph recall
https://github.com/matterport/Mask_RCNN/issues/663
 # Limit to max_per_image detections **over all classes**
    if number_of_detections > self.detections_per_img > 0:
        cls_scores = result.get_field("scores")
        image_thresh, _ = torch.kthvalue(
            cls_scores.cpu(), number_of_detections - self.detections_per_img + 1
        )
        keep = cls_scores >= image_thresh.item()
        keep = torch.nonzero(keep).squeeze(1)
        result = result[keep]
    return result

according to this code snippet I found that it checks the no. of detection
so model.roi_heads.detections_per_img=300 is correct for your purpose.
And I haven't found much proper documentation on maxdets but i guess the above code should work.
 # non-maximum suppression, independently done per class
   keep = box_ops.batched_nms(boxes, scores, labels, self.nms_thresh)
 # keep only topk scoring predictions
   keep = keep[:self.detections_per_img]

this code snippet says that we can filter out only some top detections we want to have in our model.


text:
Q: Simulating keyboard input from bash script I have a simple bash script running few programs in screen like:
#!/bin/bash
program1
program2
program3

<Here I need to simulate Ctrl+A : hardcopy -h logfile in bash script>:
Programm4

But for my case xdotool does not work as well as expect. The problem is that I can't start logging screen output at the moment when screen is started, but I need to hardcopy all the output printed previously on that screen after program3 is finished without manually inputing Ctrl+A ...

A: The following script writes only the output of the first three echo commands but neither what came before nor the last echo into ~/tmp/programs123.log:
#!/bin/bash
screen -p0 -X clear           # Clear the scrollback buffer
screen -p0 -X scrollback 0
screen -p0 -X scrollback 100  # Set it to a manageable size
echo "1111"
echo "2222"
echo "3333"
screen -p0 -X hardcopy -h ~/tmp/programs123.log
echo "4444"

Adjust the size of the scrollback buffer as needed (currently set to 100).


text:
Q: PHP how to implement reading a file conitnously and update UI via AJAX call I am a novice in PHP and need to implement coding for following scenario.
The Web page would make a AJAX call to a PHP script at backend. The PHP script is suppose to read a file / data at serial port continuously which is having some values. So the UI should check if there is a updated value and update it as received via response from PHP script thru AJAX call made.
But the issue I am facing is the PHP script has to open the file /serial port only once and keep reading but also to service the UI AJAX call.
As such how in same PHP script it would keep reading file / serial port continuously and service the UI AJAX call (the read data from file should be not read again).

A: You can have a permanent connection between client/browser and server using elephant.io, but i wouldn't recommend it. So this leaves two other options:

*

*switching to node.js for just this one task since that would make it
faily easy using socket.io to have a socket connection between
browser/server and thus informing on file changes.

*just regularly check via a tiny ajax call if the last-touched timestamp of the file has changed and if so, use a second ajax query to pull the changes.


text:
Q: Generalize Formulas to $\mathbb{R}^n$ from formulas from vectors in 3D I am looking for the n-dimensional versions of formulas for the
 questions below:

•    Find equation of plane that passes through 3
  arbitrary points of $\mathbb{R}$$^3$ that have 3 coordinates
• Find vector equation of line that goes through two points in
  $\mathbb{R}$$^3$ that each have 3 coordinates
• Find the symmetric equations of a line through the point (a,b,c) and
  (e,f,g) in the same direction as some arbitrary vector in
  $\mathbb{R}$$^3$
• Find the parametric equations of the line that passes through a
  point in $\mathbb{R^{3}}$ and is parallel to the vector in
  $\mathbb{R}$$^3$
• Find the scalar equation of the line through two points in some
  arbitrary direction defined by a vector in $\mathbb{R}$$^3$
• Find the scalar equation of the line through two points.
• Find the equation of the tangent plane and symmetric equations of
  the normal line to the surface $A(x-a)^2+B(y-b)^2+C(x-c)^2=J$ at the
  point (q,r,t).
• Determine the equation of the line that passes through a point in
  $\mathbb{R}$$^3$ and normal to the plane ax+by-cz=k.
• Determine a normal vector and equation of the tangent plane to any
  surface with equation z= some polynomial at the point (a,b,c) in
  $\mathbb{R}$$^3$.
• Find the direction angle of some vector a$\vec i$+b$\vec j$+c$\vec
> k$.
• Find the projection of some vector onto another vector.

*

*Find the potential function for del f = some vector function ai
  +bi+ck.

*Find the equation of the tangent plane to some plane at some point in    $\mathbb{R}$$^2$

*Find the gradient, directional
        derivative and equation of some tangent plane of some function with
        three variables at some point in $\mathbb{R}$$^3$ in some arbitrary
        direction.

*Find the tangent plane and normal line to some surface
        at some point in $\mathbb{R}$$^3$.

I have a really hard time understanding how to compute the bulleted items above. Many of the stackexchange questions/online questions ask us for a specific plane with numbers. I'm more interested and think it would be morehelpful if I found out the general formula. I'm wondering whether you can extend my bulleted questions into $\mathbb{R^{n}}$ and points in $\mathbb{R^{n}}$. I think this would help me understand vectors in $\mathbb{R^{3}}$.

A: $\newcommand{\Reals}{\mathbf{R}}\newcommand{\Vec}[1]{\mathbf{#1}}$Rather than answer point by point, here are some useful generalities:

*

*If $\Vec{v}$ and $\Vec{w}$ are non-zero vectors, the angle $\theta$ between then satisfies
$$
\cos\theta = \frac{\Vec{v} \cdot \Vec{w}}{\|\Vec{v}\|\, \|\Vec{w}\|}.
$$
Particularly, $\Vec{v}$ and $\Vec{w}$ are orthogonal if $\Vec{v} \cdot \Vec{w} = 0$.

*If $\Vec{a}$ is a non-zero vector, then for every $\Vec{v}$, the components of $\Vec{v}$ parallel to $\Vec{a}$ and orthogonal to $\Vec{a}$ are
$$
\operatorname{proj}_{\Vec{a}} \Vec{v} = \left(\frac{\Vec{v} \cdot \Vec{a}}{\|\Vec{a}\|^{2}}\right) \Vec{a},\qquad
\operatorname{perp}_{\Vec{a}} \Vec{v} = \Vec{v} - \operatorname{proj}_{\Vec{a}} \Vec{v}.
$$

*If $\Vec{p}$ is a point and $\Vec{v}$ is a non-zero vector, then the set of points $\Vec{p} + t\Vec{v}$ ($t$ real) is the line through $\Vec{p}$ in the direction $\Vec{v}$.
If $\Vec{p}$ and $\Vec{q}$ are distinct points, set $\Vec{v} = \Vec{q} - \Vec{p}$; the preceding paragraph describes the line through $\Vec{p}$ and $\Vec{q}$.
The "symmetric form" for a line is a system of $(n - 1)$ equations in $n$ variables. The coefficients are any linearly independent set of $(n - 1)$ vectors orthogonal to $\Vec{v}$.

*If $\Vec{p}$ is a point and $\Vec{v}$, $\Vec{w}$ are non-proportional vectors (non-zero in particular), then the set of points $\Vec{p} + s\Vec{v} + t\Vec{w}$ ($s$, $t$ real) is the plane through $\Vec{p}$ parallel to $\Vec{v}$ and $\Vec{w}$.
If $\Vec{p}$, $\Vec{q}$, and $\Vec{r}$ are non-collinear points, set $\Vec{v} = \Vec{q} - \Vec{p}$ and $\Vec{w} = \Vec{r} - \Vec{p}$; the preceding paragraph describes the plane through $\Vec{p}$, $\Vec{q}$, and $\Vec{r}$.
The "symmetric form" for a plane is a system of $(n - 2)$ equations in $n$ variables.

*If $\Vec{p}$ is a point and $\Vec{v}$ is a non-zero vector, then the set of points $\Vec{x}$ satisfying $\Vec{v} \cdot (\Vec{x} - \Vec{p}) = 0$ is the hyperplane through $\Vec{p}$ with normal vector $\Vec{v}$.
Your original post had the "cross product" tag. It turns out the cross product has no generalization (as a binary operation) to arbitrary dimension; there is, however, an $(n - 1)$-ary "cross product" in $\Reals^{n}$.


text:
Q: What is wrong with the returned php DateTime? I am getting the wrong date time returned in my Symfony 4 project.
When I register an Article, I set a new DateTime to know when it was created:
$article->setCreatedAt(new \DateTime());

This is how I get the object in Symfony:
public function getArticleByIdAction(Article $article) {
    $json = $this->serializer->encode($article, 'json');
    return $this->response->fromJsonString($json);
}

And this is the returned json data:
{
  "id": 14,
  "name": "TestName",
  "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce at egestas turpis, in fringilla dui. Cras fringilla at neque vel dapibus. Ut id purus convallis, tempor nisi vel, laoreet nunc. Sed nunc ipsum, volutpat a ligula sed, accumsan aliquam arcu. Pellentesque volutpat, nisi sed tristique ultrices, nibh tellus tristique mi, sit amet venenatis erat enim eget risus. Maecenas non dolor eleifend, mattis ipsum id, dictum turpis. Nulla est mauris, facilisis et consequat ut, elementum quis ex. Suspendisse tortor eros, rutrum ac vehicula eget, bibendum ac nibh. Sed magna urna, gravida ac pharetra eu, mollis at mi. Praesent ut dolor nec massa malesuada interdum. Cras vel nunc faucibus, porta diam non, ultricies neque. Curabitur tincidunt, lacus at suscipit laoreet, ante mi bibendum dui, nec cursus ipsum libero nec mauris. Morbi tempor faucibus ullamcorper. Maecenas quis rutrum ipsum, ut pretium eros. ",
  "createdAt": {
    "timezone": {
      "name": "Europe\/Berlin",
      "transitions": [
        {
          "ts": -9223372036854775808,
          "time": "-292277022657-01-27T08:29:52+0000",
          "offset": 3208,
          "isdst": false,
          "abbr": "LMT"
        },
        {
          "ts": -2147483648,
          "time": "1901-12-13T20:45:52+0000",
          "offset": 3600,
          "isdst": false,
          "abbr": "CET"
        }
      ],
      "location": {
        "country_code": "DE",
        "latitude": 52.5,
        "longitude": 13.366659999999995989128365181386470794677734375,
        "comments": "Germany (most areas)"
      }
    },
    "offset": 3600,
    "timestamp": 1552461412
  },
  "updatedAt": null,
  "isActive": true
}

How can I return only the date as it is stored in Mysql?

A: DateTime is an object so when you encode it as json it is serialising the object. If you just want the date you need to format it.
$date = new DateTime();
$date->format(''Y-m-d H:i:s');

A: You're passing in an instance of the class DateTime, not the actual date and time.
If you just want to pass in the current date and time you can simply do:
$article->setCreatedAt(date('Y-m-d H:i:s'));


text:
Q: Numbering duplicates record in mysql I have Student table and I want to update (sequence_No.) field like that:
ID        Name      age     sequence_No.
--        -----     ---     ------------

1         sara      20         1

2         sara      20         2

3         sara      20         3

4         john      24         1

5         john      24         2

6         Hama      23         1

Which query can do that in mysql?
thank you :)

A: SELECT
ID,
Name,
age,
(
CASE Name
WHEN @curType
THEN @curRow := @curRow + 1
ELSE @curRow := 1 AND @curType := Name END
) + 1 AS sequence_No

FROM student, (SELECT @curRow := 0, @curType := '') r
ORDER BY  ID,NAME;

SQL FIDDLE

A: hope this will help you :
SELECT *, count(*) as seq_number FROM student a
JOIN student b ON a.name = b.name AND a.id >= b.id
GROUP BY a.id

Sqlfiddle

A: try out this..
select ID,Name,age,sequence_No
from Student having count(Name) > 1
order by Name asc


text:
Q: Connect to orientdb dynamically I have a java application, which uses orientDB API (tinkerprop package) for creating Class and inserting and fetching the data from OrientDB. The DB is running on another server.
I am looking to have my application such that in case the orientDB is down and later comes up, I don't need to restart my java application to get the connection with orientDB. (connection should automatically be refreshed when DB is available)
I may have 2 nodes in the replication setup, but in the case of both nodes need to restart, my application need to restart too. ( have faced scenario when the insert was not happening due to quorum not reachable error, and finally, need to restart both servers)
I tried with below code
while(true)
        {
            try {

            OrientGraphFactory factory = new OrientGraphFactory("remote:localhost/testdb", "root", "root").setupPool(1,50);
        OrientGraphNoTx graph = factory.getNoTx();
                Thread.sleep(1*30*1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

But the application terminated when I shut down the orientDB server. The below exception is thrown, when server is shutdown
Exception in thread "main" com.orientechnologies.orient.core.exception.OStorageException: Cannot create a connection to remote server address(es): [127.0.0.1:2424]
    DB name="testdb"
    at com.orientechnologies.orient.client.remote.OStorageRemote.openRemoteDatabase(OStorageRemote.java:1960)
    at com.orientechnologies.orient.client.remote.OStorageRemote.openRemoteDatabase(OStorageRemote.java:1860)
    at com.orientechnologies.orient.client.remote.OStorageRemote.open(OStorageRemote.java:356)
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:258)
    at com.orientechnologies.orient.core.db.OPartitionedDatabasePool$DatabaseDocumentTxPooled.internalOpen(OPartitionedDatabasePool.java:447)
    at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.openDatabase(OPartitionedDatabasePool.java:310)
    at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.acquire(OPartitionedDatabasePool.java:268)
    at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.<init>(OrientBaseGraph.java:143)
    at com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx.<init>(OrientGraphNoTx.java:62)
    at com.tinkerpop.blueprints.impls.orient.OrientGraphFactory$2.getGraph(OrientGraphFactory.java:116)
    at com.tinkerpop.blueprints.impls.orient.OrientGraphFactory.getNoTx(OrientGraphFactory.java:240)

A: Adding OStorageException to the catch block should be enough:
  while(true)
    {
        try {

        OrientGraphFactory factory = new OrientGraphFactory("remote:localhost/testdb", "root", "root").setupPool(1,50);
    OrientGraphNoTx graph = factory.getNoTx();
            Thread.sleep(1*30*1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (OStorageException e2) {
            e2.printStackTrace();
        } catch(OOfflineNodeException e3){
            e3.printStackTrace();
        }

    }


text:
Q: NodeJS ExpressJS. Multer returns undefined I followed the steps from the multer documentation but still it's still showing undefined

post.js
I've tried both diskStorage () and memoryStorage() and none of it worked.
app.get("/adminposts", function(req, res, next){
    // FILE LOC: routes/Admin/database
    res.render('Admin/post', {
        title : '*** Admin Posts'
    })
})
var storage = multer.diskStorage({
    destination: function (req, file, cb) {
      cb(null, 'uploads')
    },
    filename: function (req, file, cb) {
      cb(null, file.fieldname + '-' + Date.now())
    }
  })
// var storage = multer({storage:multer.memoryStorage()}) //still undefined
var upload = multer({storage: storage})
app.post('/adminposts/upload', upload.single('image_post'), (req, res)=>{
  //some req.body
  var image = req.file

  console.log(image) // undefined

post.ejs
I'm not sure what I have done wrong on this part. I just couldn't understand. Though when I console.log the image id it shows 'fakePath:------'
        //other inputs here
        <input type="file" name="image_post" accept=".jpg,.gif,.png" id="image">
    </form>

<script>
    $.ajax({
    url:"http://localhost:3000/adminposts/upload",
    method:"POST",
    data:$('#upload_post').serialize(),
    dataType:"JSON",
    success:function(data)
    {
        //some success here


text:
Q: How to create grid system in Drupal http://i.imgur.com/FSueo.png
I want to create a grid system like the one in picture in drupal 7. Can anyone point me in the right direction?
I first tried using Zen, but I could not figure out how to use SASS  to make this grid system.
Then, I checked out the panels module, but that also wont help; it only makes more columns, but I want to make more rows.
I am very comfortable with CSS and php so if you have suggestions regarding modifying a certain CSS or php file, its more than enough. Just let me know which file to modify, and what to look for...
Thanks!

A: Have you tried something like Omega? If you know CSS then with the regions it provides you should be able to achieve that structure.

A: Omega is definitely perfect for this grid use case.  Try it out!
If you'd like to stick with Zen though, it is worth noting that using SASS is not required to use Zen - from the Zen project page:

If you're not ready for Sass yet, Zen still includes a full set of well-documented CSS files. Sass integration adds zero overhead, so if you simply ignore all of Zen's Sass, your site performance isn't penalized. No worries!


text:
Q: How do I generate breadcrumbs for my Melt app? I have used the Melt Framework to build a web application with the following structure:
/views
    /inside
        index.php
        edit.php
    /outside
        index.php
        register.php
        login.php
    layout.php

Now I want to generate breadcrumbs to show in the layout.php above the contents of each view. What would be the best way to implement breadcrumbs in Melt ?

A: This has now been added to solutons.
See "Creating a breadcrumb for the menu system".


text:
Q: Access a directives scope variable from another directive I have a directive with a function and I access that function at the click of a button. What I want to do is to access a $scope variable from that function into another directive and use it in that directive's view
Here is the code for the directive that has the function defined in it:
$scope.footerLinkClicked = function (item2) {
    $scope.myvalue = true;
    console.log("parameter received :" );

    $scope.item1 = item2;
    console.log($scope.item1);

    $rootScope.$broadcast('item1',$scope.item1);
}

In my other directive's view I want to do something like
<div class="panel panel-primary" ng-show="myvalue">

Now, what I want is to acces myvalue variable in another directive. What is the way to do this ?
Thanks in advance!

A: Its better two use object instead of primitive variable.
<one-d  my-value="objVal"></one-d>

<two-d  my-value="objVal"></two-d>

In the directive script you should use  like this
    return {
    scope: { myValue: '=' },
    link: function(scope, ele, attr) {

        scope.footerLinkClicked = function(item2) {
            scope.myValue.data = true;
            scope.item1 = item2;

        }

      }
  }


text:
Q: How to call javascript from Android? How do we call javascript from Android? I have this javascript library which I would like to use, I want to call the javascript function and pass the result value to the android java code. Haven't found the answer from now. i managed to call android code from javascript, but I want the other way around.

A: In order to match the method calls of the iOS WebviewJavascriptBridge ( https://github.com/marcuswestin/WebViewJavascriptBridge ), I made some proxy for the calls of register_handle and call_handle. Please note I am not a Javascript-guru therefore there is probably a better solution.
     javascriptBridge = (function() {
        var handlers = {};
        return {
            init: function () {
            },
            getHandlers : function() {
                return handlers;
            },
            callHandler : function(name, param) {
                if(param !== null && param !== undefined) {
                    JSInterface[name](param);
                } else {
                    JSInterface[name]();
                }
            },
            registerHandler : function(name, method) {
                if(handlers === undefined) {
                    handlers = {};
                }
                if(handlers[name] === undefined) {
                    handlers[name] = method;
                }
            }
        };
    }());

This way you can send from Javascript to Java calls that can have a String parameter
javascriptBridge.callHandler("login", JSON.stringify(jsonObj));

calls down to
@JavascriptInterface
public void login(String credentialsJSON)
{
    Log.d(getClass().getName(), "Login: " + credentialsJSON);
    new Thread(new Runnable() {
         public void run() {
             Gson gson = new Gson();
             LoginObject credentials = gson.fromJson(credentialsJSON, LoginObject.class);
             SingletonBus.INSTANCE.getBus().post(new Events.Login.LoginEvent(credentials));
         }
    }).start();
}

and you can call back to Javascript with
javascriptBridge.registerHandler('successfullAuthentication', function () {
    alert('hello');
})

and
private Handler webViewHandler = new Handler(Looper.myLooper());

webViewHandler.post(
        new Runnable()
        {
            public void run()
            {
                webView.loadUrl("javascript: javascriptBridge.getHandlers().successfullAuthentication();"
            }
        }
);

If you need to pass a parameter, serialize to JSON string then call StringEscapeUtils.escapeEcmaScript(json), otherwise you get unexpected identifier: source (1) error.
A bit tacky and hacky, but it works. You just have to remove the following.
connectWebViewJavascriptBridge(function(bridge) {
}

EDIT:
in order to change the global variable to an actual property, I changed the above code to the following:
(function(root) {
    root.bridge = (function() {
        var handlers = {};
        return {
            init: function () {
            },
            getHandlers : function() {
                return handlers;
            },
            callHandler : function(name, param) {
                if(param !== null && param !== undefined) {
                    Android[name](param);
                } else {
                    Android[name]();
                }
            },
            registerHandler : function(name, method) {
                if(handlers === undefined) {
                    handlers = {};
                }
                if(handlers[name] === undefined) {
                    handlers[name] = method;
                }
            }
        };
    }());
})(this);

I got the idea from Javascript global module or global variable .

A: You can use Rhino library to execute JavaScript without WebView.
Download Rhino first, unzip it, put the js.jar file under libs folder. It is very small, so you don't need to worry your apk file will be ridiculously large because of this one external jar.
Here is some simple code to execute JavaScript code.
Object[] params = new Object[] { "javaScriptParam" };

// Every Rhino VM begins with the enter()
// This Context is not Android's Context
Context rhino = Context.enter();

// Turn off optimization to make Rhino Android compatible
rhino.setOptimizationLevel(-1);
try {
    Scriptable scope = rhino.initStandardObjects();

    // Note the forth argument is 1, which means the JavaScript source has
    // been compressed to only one line using something like YUI
    rhino.evaluateString(scope, javaScriptCode, "JavaScript", 1, null);

    // Get the functionName defined in JavaScriptCode
    Object obj = scope.get(functionNameInJavaScriptCode, scope);

    if (obj instanceof Function) {
        Function jsFunction = (Function) obj;

        // Call the function with params
        Object jsResult = jsFunction.call(rhino, scope, scope, params);
        // Parse the jsResult object to a String
        String result = Context.toString(jsResult);
    }
} finally {
    Context.exit();
}

You can see more details at my post.

A: There is a hack:

*

*Bind some Java object so that it can be called from Javascript with WebView:
addJavascriptInterface(javaObjectCallback, "JavaCallback")

*Force execute javascript within an existing page by
WebView.loadUrl("javascript: var result = window.YourJSLibrary.callSomeFunction();
    window.JavaCallback.returnResult(result)");

(in this case your java class JavaObjectCallback should have a method returnResult(..))
Note: this is a security risk - any JS code in this web page could access/call your binded Java object. Best to pass some one-time cookies to loadUrl() and pass them back your Java object to check that it's your code making the call.

A: For a full implementation of JavaScript that doesn't require using a slow WebView, please see AndroidJSCore, which is a full port of Webkit's JavaScriptCore for Android.
UPDATE 2018: AndroidJSCore is deprecated.  However, its successor, LiquidCore has all of the same functionality and more.
Calling functions from Android is very simple:
JSContext context = new JSContext();
String script =
  "function factorial(x) { var f = 1; for(; x > 1; x--) f *= x; return f; }\n" +
  "var fact_a = factorial(a);\n";
context.evaluateScript("var a = 10;");
context.evaluateScript(script);
JSValue fact_a = context.property("fact_a");
System.out.println(df.format(fact_a.toNumber())); // 3628800.0


text:
Q: Issue with align* environment in TRT pagedir (lualatex) I have this example with align* environment in TRT pagedir (lualatex engine), The result is aligned to the right even though the environment is placed in  left to right context (with \bodydir TLT \pardir TLT \textdir TLT) @DavidCarlisle
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{amsmath}

\pagedir TRT\bodydir TRT \pardir TRT \textdir TRT
\begin{document}

\begin{align*}
f(x)&=1+\dfrac{1}{x+2}\\
    &=1+k(x+2)
\end{align*}

{%
\bodydir TLT \pardir TLT \textdir TLT
\begin{align*}
f(x)&=1+\dfrac{1}{x+2}\\
    &=1+k(x+2)
\end{align*}
 }

 \newpage

\pagedir TLT \bodydir TLT \pardir TLT \textdir TLT

\begin{align*}
f(x)&=1+\dfrac{1}{x+2}\\
    &=1+k(x+2)
\end{align*}

\end{document}

A: Too complex for just a comment, but:
I just discovered that this problem has been addressed already here. I refined this solution by using the etoolbox package to patch the command instead of copying the whole definition of the relevant macro. Why exactly this patch works, however, is not fully clear to me, to be honest.
Since I only refined their answer and do not understand the mechanism behind it, credit should really be given to user22486.
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{amsmath}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\math@cr@@@align}{\fi\ifst@rred}{\else\place@tag\fi\ifst@rred}{}{}
\makeatother

\pagedir TRT \bodydir TRT \pardir TRT \textdir TRT

\begin{document}

Hello

\begin{align*}
f(x)&=1+\dfrac{1}{x+2}\\
    &=1+k(x+2)
\end{align*}

Hello

{
\bodydir TLT \pardir TLT \textdir TLT

Hello

\begin{align*}
f(x)&=1+\dfrac{1}{x+2}\\
    &=1+k(x+2)
\end{align*}

Hello

}

Hello

\end{document}


text:
Q: How to Tag registered user in WP onclick sorry if the q seems very easy but i googled a lot no luck
I need to sell online goods, when the goods are out of stock the registered users on my website can check a "Remind Me" mark, so when the goods are available I can send push notification using One Signal to them
So I need to add Tag in user properties for every category they check to push notification them later
Regards


text:
Q: how do you import Matierial ui without downloading anything I was trying flutter but do not like it so have started looking for react libays to use instead and a came across matierial ui which is great as it has the flutter components (why I considered flutter in the first place) but is built in react. I would like to use this in my projects however am struggling to import it. I have tried a number of different urls for the file including:
https://cdn.jsdelivr.net/npm/@material-ui/core
@material-ui/core
https://cdn.skypack.dev/@material-ui/core
and a number of ways of importing it incliding
import * as ui from "[url]" (js)
script(src="[url]" type="module" crossorigin) (pug)


text:
Q: What do the different vault levels reward you with in Legends of Runeterra? In Legends of Runeterra you get unlocks every Tuesday thanks to the Weekly Vault. What are the rewards for the various levels?

A: The Official Legends of Runeterra website features This Page on how to progress in the game (rewards, loot, etc.). The Vault section contains the following image, detailing the rewards and XP needed for each level:

To clarify, in order of first appearance (top to bottom), those are Bronze, Silver, Gold, Platinum and Diamond Chests. There's also Champion Wildcards to be gained (Orange Wildcards).
Each Chest contains rewards ranging from Capsules (that contain assorted Wildcards) and Shards.