text:
Q: User defined function only returning first value I am trying to create a user defined function that would find the max of three numbers that a user input. When I run the program, it only returns the first value entered.
//input
$n1 = $_POST['n1'];
$n2 = $_POST['n2'];
$n3 = $_POST['n3'];

print "Max number entered is: " . find_max($n1, $n2, $n3);

//data validation
function find_max($result) {
    if (($n1>$n2)&($n1>$n3)) {
        $result = $n1;
    }

    if (($n2>$n1)&($n2>$n3)) {
        $result = $n2;
    }

    if (($n3>$n1)&($n3>$n2)) {
        $result = $n3;
    }

    return $result;
}

A: The defect is fixed by the sort function.
Try following code.

$n1 = $_POST['n1'];
$n2 = $_POST['n2'];
$n3 = $_POST['n3'];

print "Max number entered is: " . find_max([$n1, $n2, $n3]);

function find_max($result) {
    sort($result);
    return $result[count($result) - 1];
}

Number 1 argument of the sort function is used to compare items numerically
I will my code helps,


text:
Q: Retrieve just root classes/classes with no asserted subclassof parent class Is there an easy way to retrieve just the root classes from an OWL ontology in OWLAPI? Here I mean named classes with no asserted parent class. Added complexity, trying not to use reasoner because ontologies are huge and reasoner is not completing in fast enough time (typically). Thanks as always!

A: Actually using a reasoner would make the task trivial because the only named class without a parent would be owl:Thing.
Jokes aside, you'd need to take all the classes in the ontology signature and, for each one, ensure it does not appear in a subclass axiom as subclass (or, if it does, that the class on the other side is owl:Thing.
The code would look like this:
    OWLDataFactory df=OWLManager.getOWLDataFactory();
    OWLClass thing=df.getOWLThing();
    OWLOntology o = ...
    o.classesInSignature()
                   // all asserted superclasses
        .filter(c->o.subClassAxiomsForSubClass(c)
                               // skip owl:Thing
                    .filter(s->!thing.equals(s.getSuperClass()))
                    // only keep the ones with no superclass
                    .count()==0)
        .forEach(System.out::println);

This example prints out the IRIs for those classes.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Python: how to use classes for plotting different lines? I want to plot different lines using a class method. In order to plot a line. Similar to Passing plots out of a class I use this class to plot a line
from matplotlib.figure import Figure
import matplotlib.pyplot as plt

class Plotter(object):
    def __init__(self, xval=None, yval=None, dim1=None, dim2=None):
        self.xval = xval
        self.yval = yval
        self.dim1 = dim1
        self.dim2 = dim2

    def plotthing(self):
        fig, ax = plt.subplots(figsize=(self.dim1,self.dim2))
        ax.plot(self.xval, self.yval, 'o-')
        return fig

app = Plotter(xval=range(0,10), yval=range(0,10),  dim1=5, dim2=5)
plot = app.plotthing()

However I would like to plot different curves in the same plot and define a function inside the class to do so.
Xval = []
Yval = []
xval=range(0,10)
yval=range(0,10)
Xval.append(xval)
Yval.append(yval)
xval=range(0,10)
yval=np.sin(range(0,10))
Xval.append(xval)
Yval.append(yval)

How can I define a function to pass to plotthing?
class Plotter(object):
    def __init__(self, xval=None, yval=None, dim1=None, dim2=None):
        self.xval = xval
        self.yval = yval
        self.dim1 = dim1
        self.dim2 = dim2

    def function_do_plot(x, y):
        do something

    def plotthing(self):
        fig, ax = plt.subplots(figsize=(self.dim1,self.dim2))
        for i in range(0, len(self.xval)):
             x = xval[i]
             y = yval[i]
             fig = function_do_plot(x, y)
        return fig

A: Consider looping through your lists of inputs without needing a separate method:
class Plotter(object):
    def __init__(self, xval=None, yval=None, dim1=None, dim2=None):
        self.xval = xval    # LIST
        self.yval = yval    # LIST
        self.dim1 = dim1
        self.dim2 = dim2

    def plotthing(self):
        fig, ax = plt.subplots(figsize=(self.dim1,self.dim2))

        for i, j in zip(self.xval, self.yval):
            ax.plot(i, j, 'o-')

        return fig

# POPULATE LIST OF RANGES
Xval = []; Yval = []

xval = range(0,10)
yval = range(0,10)
Xval.append(xval)
Yval.append(yval)

xval = range(0,10)
yval = np.sin(range(0,10))
Xval.append(xval)
Yval.append(yval)

# PASS IN LIST OF RANGES
app = Plotter(xval=Xval, yval=Yval, dim1=5, dim2=5)
plot = app.plotthing()


text:
Q: Ruby Validation failed on .create I am attempting to use a .create method but constantly getting back the error:
Validation failed: Account can't be blank
This is the code I am running to produce the error:
What could cause .create! to produce that error when it is apparent that :account is not blank?
Edit:
Here is some more info around my validations:
*It's worth noting that I the sample code in my initial post is not the complete script, but simple the code I am experiencing the error with. I define several other attributes inside that script but didn't want to put too much noise in this post.

A: Your problem is that you are validates_presence_of on the account_id but you are passing in the account.  The error message says Account because when humanizing the field name, it drops the id.
You may want to try create with:
test.newentry.create!({
              :account_id => demo_account.id,
              :date => date
})


text:
Q: Resource Directory Path Issue in iOS 3.2 for developing a game.I have developed game in android but facing a problem in iOS i.e
I am facing problem to read resource images.In my game have 3 stages "Simple","Medium" and "Hard".I have put images on the following path
# "Simple/1.png","Medium/1.png","Hard/1.png"
# "Simple/2.png","Medium/2.png","Hard/2.png"
# ------------------------------------------
# ------------------------------------------
# "Simple/n.png","Medium/n.png","Hard/n.png"

In android getting correct image by using full path of image.
But in iOS it is not working.
How i can fetch image of same name from different directory in iOS.

A: You should probably use FileUtils::addSearchPath() and add "Simple", "Medium" or "Hard", depending on the game stage and then you can use just "1.png" to refer to the file from various Cocos2d-x APIs.

A: landge,
Please try this:
See my screenshot using cocos2d-x-3.6
http://prntscr.com/7zwty9
It shows Xcode with 3 files with the same name 1.png in different absolute directories: hard/medium/simple.
vector<string> searchPaths = fu->getSearchPaths();
fu->addSearchPath("res/medium");
CCLOG("fpff = %s", fu->fullPathForFilename("1.png").c_str());

This is the console output:
fpff = /Users/javier.fuchs/Library/Developer/CoreSimulator/Devices/68F9EE6B-2829-420E-9359-00EC30C6372D/data/Containers/Bundle/Application/E586FE31-AFC2-4052-9826-9B27AA75182A/MyCppGame iOS.app/res/medium/1.png

Please make sure where is the file, and take a look of the full path, inside the project.
There is no guaranty with search paths, even if you doing:
auto& list = fu->getSearchPaths();
for( const auto &item : list) {
    CCLOG("%s", item.c_str());
}

You will see that adding a relative path that does not exist, the relative path will be included anyway.


text:
Q: Is $i^{i^{i}}$ a real number? I figured out that $i^{i} = e^{-\pi/2}$, but I can't seem to find a way to determine a technique to see if $i^{i^{i}}$ is real or not. What I've tried so far:
$i^{i^{i}}$ = $i^{e^{-\pi/2}}$ = $(e^{i\pi/2})^{e^{-\pi/2}}$

A: Rkb's answer is correct for $(i^i)^{^i}$.
For $i^{(i^i)}$, your approach seems correct so far, as it would indeed resolve to $e^{i \frac{\pi}{2} e^{-\frac{\pi}{2}}}$.
To figure out whether this is a real number or not, recall the following formula:
$$e^{ix}=\cos (x)+i\sin(x)$$
$e^{ix}$ is real if and only if $\sin (x) = 0$, which is true for $x = n\pi, n \in \mathbb{Z}$. Thus, for $i^{(i^i)}$ to be real, the following equation needs to have at least one solution:
$$\frac{\pi}{2} e^{- \frac{\pi}{2} } = n\pi,n \in \mathbb{Z}$$
Dividing both sides by $\pi$ gives
$$n = \frac{e^{- \frac{\pi}{2}}}{2} \implies n = \frac{i^i}{2}$$
which is not an integer. Therefore, the above equation has no solution and it follows that $i^{(i^i)}$ is not a real number.

A: your calculations for $i^i$ are incorrect.(Use the formula $e^{ix}=\cos x+ i\sin x$)
We have, $$i=e^{i\frac{\pi}{2}}\implies i^i=(e^{i\frac{\pi}{2}})^i=e^{-\frac{\pi}{2}}\implies i^{i^i}=(e^{-\frac{\pi}{2}})^i=e^{-i\frac{\pi}{2}}=-i$$
which is not real.


text:
Q: Let $a$ and $b$ be integers such that $a|b$ and $b|a$. Show that $a ∈ \{b,−b\}$. Let $a$ and $b$ be integers such that $a|b$ and $b|a$. Show that $a ∈ \{b,−b\}$.
My attempt
Since  $a\mid b$ and $b\mid a$, we have that $a\neq 0$ and $b\neq 0.$
I think I can use this result that appears in the book I am studying... If  $a\mid b$ and $b\neq 0$, then $a\leq |b|$.  Thus, in this case $a\leq |b|$ and $b\leq|a|$. The problem is that I don't see how to relate these two inequalities to get what I want.

A: Another approach
If $a\mid b$, then  $b= n a$ for some integer $ n$.
Analogously, since $b\mid a$, $a= m b$ for some integer $m$.
So, $a= m b= m n a$, hence $mn=1$. But $m$ and $n$ are integers, so $m=n=1$ or $m=n=-1$.

A: What does $a\mid b$ mean literally?
We have that $a\mid b$ so there is an integer, $k$, so that $b=ak$ and $b\mid a$ so there is an integer, $m$, so that $a = mb$ so $a = m(ak) = a(km)$.
If $a\ne 0$ then $km = 1$ and the only divisors of $1$ are $1$ and $-1$ so either $m=1$ and $a = 1\cdot b = b$.  Or $m=-1$ so $a = (-1)b = -b$.  So $a \in \{b,-b\}$.
But what if $a = 0$. (I don't see why you can claim $a\ne 0; b\ne 0$). We then $b =ak = b\cdot 0 = 0 = a$ and $a = b$.  So $a \in \{b,-b\}$.
So either way $a\in \{b,-b\}$.


text:
Q: Force a route to exit a subdomain in Rails 3.2 I'm struggling with exiting out of a subdomain back up to the root domain in Rails 3.2.
Say I have a blog with a dashboard. Each user has a subdomain at username.blog.com. Each user also has a dashboard at blog.com/dashboard.
If a user manually types in username.blog.com/dashboard, I want them to be redirected to blog.com/dashboard.
I've tried using subdomain => false in my routes, but it seems to be of no use. I also tried a matcher underneath the domain scope, but that also didn't work. Any help would be greatly appreciated!
Relevant routes.rb follows.
resource :dashboard, :controller => 'dashboard', :subdomain => false
scope '/', constraints: lambda { |r| r.subdomain.present? && r.subdomain != 'www' } do
    get '/' => 'feed#show'
  end

root :to => 'dashboard#show', :subdomain => false

A: I would keep that logic outside the routing.
I would use dashboard_url instead of dashboard_path in my views / controllers.
I would put something like this in my ApplicationController
def dashboard_url(options={})
  options[:subdomain] = false
  super(options)
end


text:
Q: What is the best way to apply default date formatting to all such fields in an ASP.NET MVC 3 app? My goals are:

*

*Display all dates in d MMM yyyy format

*

*Default/existing values on first page load

*Anything entered by the user, then round-tripped via the server

*Add class="behaviour-date-picker" to the input field so that I can show a jQuery date picker

*Build on top of the System.ComponentModel.DataAnnotations infrastructure

*Still show bad data values such as 12 Joone 2010 after a server roundtrip, with the appropriate validation error message

Here's an example model:
public class DebugDatesStub
{
    [DataType(DataType.Date)]
    public DateTimeOffset Date { get; set; }
}

The DisplayFormat attribute doesn't solve my scenario because it doesn't apply to round-tripped values. (User fills in form, submits it, gets the same form back because of some server-side validation issue - date is still shown in the original format they entered instead of being reformatted.)

A: I had a similar problem and solved it something like this (code taken as sample from WebGrid, hopefully it will give you an idea):
@{
    var viewDictionary = new ViewDataDictionary<DebugDatesStub>(new DebugDatesStub());
}

...
ModelMetadata.FromLambdaExpression(d => d.DateTimeOffset, viewDictionary).PropertyName,
ModelMetadata.FromLambdaExpression(d => d.DateTimeOffset, viewDictionary).DisplayName,
format: (item) => { return new HtmlString(item.DateTimeOffset.ToString("MMM yyyy hh:mm:ss")); })
...

A: Render the field on the page with:
@Html.EditorFor(m => m.Date)

Create this code in ~\Views\Shared\EditorTemplates\Date.cshtml:
@using System.Globalization
@model DateTimeOffset?

@{
    var propertyState = ViewData.ModelState[ViewData.ModelMetadata.PropertyName];
    var displayValue =
        propertyState != null && propertyState.Errors.Any() ? propertyState.Value.AttemptedValue :
        ViewData.Model.HasValue ? string.Format("{0:d MMM yyyy}", ViewData.Model.Value) :
        string.Empty;

    ViewData.ModelState.SetModelValue(
        ViewData.ModelMetadata.PropertyName,
        new ValueProviderResult(displayValue, displayValue, CultureInfo.CurrentCulture));
}

@Html.TextBoxFor(m => m, new { @class = "behaviour-date-picker" })


text:
Q: Display vba code output in particular cell & sheet in active worksheet Sub get_cookie()
MsgBox (GetCookie("https://www.nseindia.com/api/option-chain-indices?symbol=NIFTY"))
End Sub

Thanks!!!
I have written these codes for getting cookies from the website. But I want this cookie in my active worksheet.


text:
Q: Как поменять размер шрифта в Windows консоли используя Python 3.5 Можно ли поменять размер шрифта, и сам шрифт в консоли Python 3.5. Если да, то как?

A: Решение для Windows.
Для изменения размера шрифта в cmd требуется доступ к windows api
Решение с pywin32 (выбираете инсталлер под свою версию питона и разрядность ос)
import win32console
p = win32console.PyConsoleScreenBufferType(win32console.GetStdHandle( win32console.STD_OUTPUT_HANDLE ))
# p = _
p.SetConsoleFont(1)
p.SetConsoleFont(2)

Параметр SetConsoleFont "не документирован MSDN".

A: На сколько я знаю нельзя,пользуйтесь средой разработки (Pycharm и тд.)там точно можно.Попробуйте поменять шрифт в настройках ОС.


text:
Q: How can I Select duplicate results, insert the results to a new table and delete them from the original table? (phpmyadmin) I have 2 tables, both with the same column names that look like this

I have an app that is used for clocking in/out. A user goes up to a tablet and selects there name, the data is then inputted into table 'clocktable' as shown above.
What I need to happen is when a user presses their name for a second time (to clock out) it detects that there is already a value in the table with the same employeename value, and moves both clocks to a different table 'oldclocks' so that a record is kept of clocking in/out times. The reason it needs to be in a separate table is I have a web page that displays the 'clocktable' table so we can determine who is in the building.
How can I go about doing this?
I can execute
SELECT DISTINCT EmployeeName, time FROM clocktable ORDER BY EmployeeName

from within myphp and then execute
INSERT INTO oldclocks SELECT Employeename, Department, time FROM clocktable;

Afterwards, but I cannot seem to execute them both at the same time in order to get them into a php script. Also is there a way I can delete the select results from the 'clocktable' at the same time?
Help with this would be greatly appreciated.

A: 2 tables are not nessesary. And it is bad idea.
Why dont you simply add boolean IN_BUILDING which will have 0 ->Not in building and 1->In building. Then you can do:
SELECT EmployeeName FROM clocktable WHERE IN_BUILDING = 0; which will show you all employees who are not in building
or
SELECT EmployeeName FROM clocktable WHERE IN_BUILDING = 1; which will show you all employees who are in building that moment.
Its easier also because you can change it value easy on click.

A: You can add an indicator, where 1 is in and 0 is out & if you want to save the logs, then creat another table to INSERT a record whenever the indicator's value change.
1- add 2 new attributes in table A, lets say userid & in_out for an example.
2- in_out = 1/0 where 1 is in and 0 is out
3- creat table B and insert userid & time every time the in_out value change.
And that's how you know if the user in the building or out, also you will keep logs of every move


text:
Q: Javascript check all button for items that are in a loop I am having trouble making a button that will check all the boxes (and possibly another button that unchecks them all.
So what i need is: A function that will check all the boxes and a line of code to put into html to call that function.
My items are NOT in a form.
This is the code inside my .js file (array)
var computer = new Array();
{
computer[0] = "10001, Nvidia Geforce GTX 690, $1200"

computer[1] = "10002, Raedon HD 7950, $450"

computer[2] = "20001, Ivy Bridge i7 3770, $400"

computer[3] = "20002, Ivy Bridge i7 3770k, $420"

computer[4] = "20003, Sandy Bridge i7 2700k, $340"

computer[5] = "20004, Bulldozer FX-8150, $270"

computer[6] = "30001, Antec eleven-hundred, $120"

computer[7] = "30002, Coolermaster HAF-X, $170"

computer[8] = "30003, Antec three-hundred, $50"

computer[9] = "30004, Corsair 550D, $160"

computer[10] = "40001, INTEL-ASrock fatal1ty Z77 Professional Motherboard, $250"

computer[11] = "40002, INTEL-ASrock Z77 extreme9 Motherboard, $350"

computer[12] = "40003, AMD-ASrock fatal1ty 990FX Professional Motherboard, $240"

computer[13] = "40004, AMD-ASUS Sabertooth 990FX Motherboard, $260"

}

This is the code inside my HTML.


text:
Q: NodeJs missing stacktrace when JSON.stringify an err We are trying to send out errors to a sqlite3 database when an error occurs in one of our node scripts.  We are using IPC Channel communications between processes that our main.js spawns and routes as necessary.
const logme = (message, type, showMessage = true) => {
    if (showMessage) {
        switch (type.toLowerCase()) {
            case 'error':
            case 'warn':
                console.error(message);
                break;
            default:
                console.log(message);
                break;
        }
    }
    if (process.send) {
        process.send({ to: 'logs', msg: { c: 'logme', a: 'thisScript', m: message, mt: type } });
    }
};

process.on('uncaughtException', err => {
    logme(`thisScript Uncaught Exception Error: ${JSON.stringify(err, null, 2)}`, 'error');
    if (process.send) {
        process.send({ to: 'main', msg: { c: 'kill', a: 'thisScript' } });
    }
});

On an uncaught exception, we got a message like this, however, no stacktrace was  in the object.  I thought it would be, how do we add this to the object in the future so we know where the error occurred in our code?
thisScript Uncaught Exception Error: {

  "message": "Cannot read property 'StorageFiles' of undefined",

  "code": "TypeError",

  "time": "2019-06-13T16:26:44.753Z"

}


text:
Q: PHP Symfony- How to inherit multiple classes from one php file I am using Symfony 2.4
I have a PHP file OAuth.php which has multiple classes inside that.
Code of OAuth.php is as below
<?php

namespace RT\AuthBundle\DependencyInjection\Vzaar;
use Exception;

class OAuthException extends Exception {
  // pass
}

class OAuthConsumer {
     //some code
}

class OAuthToken {
     //some code
}

?>

I am inheriting above file in Vzaar.php file which is with in same namespace and it's code is as below
    <?php
    namespace RT\AuthBundle\DependencyInjection\Vzaar;

    /*require_once 'OAuth.php';
    require_once 'HttpRequest.php';
    require_once 'AccountType.php';
    require_once 'User.php';
    require_once 'VideoDetails.php';
    require_once 'VideoList.php';
    require_once 'UploadSignature.php';*/

    use RT\AuthBundle\DependencyInjection\Vzaar\OAuth;
    use RT\AuthBundle\DependencyInjection\Vzaar\HttpRequest;
    use RT\AuthBundle\DependencyInjection\Vzaar\AccountType;
    use RT\AuthBundle\DependencyInjection\Vzaar\User;
    use RT\AuthBundle\DependencyInjection\Vzaar\VideoDetails;
    use RT\AuthBundle\DependencyInjection\Vzaar\VideoList;
    use RT\AuthBundle\DependencyInjection\Vzaar\UploadSignature;
    //use RT\AuthBundle\DependencyInjection\Vzaar\OAuth\OAuthConsumer;

    Class Profile
    {
       public static function setAuth($_url, $_method = 'GET')
       {
        $consumer = new OAuthConsumer('', '');
            //some code
       }
    }
?>

Creating new object of OAuthConsumer class throws error that
Fatal error:  Class 'RT\AuthBundle\DependencyInjection\Vzaar\OAuthConsumer' not found in /var/temp/rt-web/src/RT/AuthBundle/DependencyInjection/Vzaar/Vzaar.php

1/1 ClassNotFoundException: Attempted to load class "OAuthConsumer" from namespace "RT\AuthBundle\DependencyInjection\Vzaar" in /var/temp/rt-web/src/RT/AuthBundle/DependencyInjection/Vzaar/Vzaar.php line 378. Do you need to "use" it from another namespace?

A: Because since 2.1 Symfony uses composer, and composer uses PSR-0/PSR-4 to autoloading the classes, you have to follow the namespace convention, so you have to create those classes in separate files and in the right directory structure, what is represented in the namespace.
EDIT
As Cerad mentioned in the comment, you can specify a class map in composer, although what is considered as a best practice with symfony projects, create every class in a separate file.


text:
Q: Which sum shows up most often when you roll 10 dice? Which sum shows up most often when you roll 10 dice?

A: The sum that shows up most often when you roll 10 dice is 35.
Are you also interested to see a reason why this is so?

A: The key to this question is the concept of unimodality (q.v.).
Try to prove by induction that if you take the sum of $n \geq 2$ cubes then the distribution has the following form:

*

*It is supported (has non-zero probability) on the numbers $n, \ldots, 6n$.

*It is symmetric around $3.5n$.

*It is unimodal: the sequence of probabilities increases monotonically until it reaches its mode (the most probable value), then decreases monotonically.

*If $n$ is even then the mode is unique (and so $3.5n$).

*If $n$ is odd then there are two modes ($\lfloor 3.5n \rfloor$ and $\lceil 3.5n \rceil$).

If you find the proof difficult, try again with two-sided dice.
Of course, as $n \rightarrow \infty$ the distribution will approach (in some sense) a Gaussian, but I'm not sure this is enough to prove anything specific about the mode (other than its asymptotics).


text:
Q: How to authenticate two types of user from oauth at the same time. and in every request header both users credential is needed I have an agent authentication and there are lots of users under each agent. We want to authenticate with "Oauth" and with an app the agent can login beside an user. we want to login both (user and agent) from the same apps at the same time with "Oauth". What is the suitable way to do this.

A: You can use one user table for storing user's info (username, password, ...) and you should authenticate based on this table, for many types of user you can use plymorhipc-relationship, for example, you need three tables users, agents, regular_users and users table know type of each user.


text:
Q: Can the -ObjC flag be applied selectively to static libraries? TL;DR
How can I make the -ObjC linker flag target a specific static library and not all the static libraries I am linking against in order to avoid unused object files being linked in with my app?

Too Long; Did Read
So you are developing a new iOS app and you add in your homegrown "objcutil" static library which contains a variety of useful Objective-C classes (not implemented as categories) to do various things that have been useful in the past.    So far, so good, and only those object files that are being referenced in the utility library are being linked with the app.
Then you decide to integrate the Google Maps SDK which wants you to use the -ObjC Other Linker Flags and all of a sudden dependencies in the utility library fail to be resolved, because you haven't configured Xcode to link to those libraries.
OK I can resolve the missing dependencies easily enough, however you now have unused object files and library dependencies that you don't need and you'd like to be a bit tidier than that.
So how do you avoid OCD overload?

Some reference from the ld manpage:

-ObjC Loads all members of static archive libraries that define an Objective C class or a category. This option does not apply to dynamic
  shared libraries.

*

*Xcode Version: 5.1.1

*OSX Version: 10.9.4

A: OK so the answer is to use -force_load instead of -ObjC as -force_load is more focused.
So WRT to the Google Maps SDK, if you followed the instructions and copied the static framework into the app project directory, then the framework will be in the project root directory and you can remove -ObjC from the Other Linker Flags and replace it with
-force_load GoogleMaps.framework/Versions/Current/GoogleMaps:

Nothing else needs changing.
For other libraries you will need to use the full static library path as the argument to -force_load.


text:
Q: Terraform enable or disable a resource conditionally My requirement is to create or delete a resource by specifying enable flag true or false (In case of false the resource should get deleted, in case of true the resource should get created)
Kindly refer below code - here I am creating "confluent topic" resource and calling it dynamically using  for_each condition.
Confluent Topic creation
topic.tf file:
resource "confluent_kafka_topic" "topic" {
  kafka_cluster {
    id = confluent_kafka_cluster.dedicated.id
  }
  for_each         = { for t in var.topic_name : t.topic_name => t }
  topic_name       = each.value["topic_name"]
  partitions_count = each.value["partitions_count"]
  rest_endpoint    = confluent_kafka_cluster.dedicated.rest_endpoint
  credentials {
    key    = confluent_api_key.app-manager-kafka-api-key.id
    secret = confluent_api_key.app-manager-kafka-api-key.secret
  }
}

Variable declared as:
variable "topic_name" {
  type = list(map(string))
  default = [{
    "topic_name" = "default_topic"
  }]
}

And finally executing it through DEV.tfvars file:
topic_name = [
    {
        topic_name  = "avro-topic-1"
        partitions_count = "6"
    },
    {
        topic_name  = "json-topic-1"
        partitions_count = "8"
    },
]

The above code execution works fine and I am able to create and delete multiple resources. I want to modify it further and add a flag/toggle to create or delete a resource.
Example as shown below:
topic_name = [
    {
        topic_name  = "avro-topic-1"
        partitions_count = "6"
        **enable = true #this flag will create the resource**
    },
    {
        topic_name  = "json-topic-1"
        partitions_count = "8"
        **enable = false #this flag will delete the resource**
    },
]

Kindly help suggest how it can be achieved and if there is any different approach to follow.

A: As mentioned in my comment, I think this can be achieved with the following change:
resource "confluent_kafka_topic" "topic" {
  for_each         = { for t in var.topic_name : t.topic_name => t if t.enable }
  kafka_cluster {
    id = confluent_kafka_cluster.dedicated.id
  }
  topic_name       = each.value["topic_name"]
  partitions_count = each.value["partitions_count"]
  rest_endpoint    = confluent_kafka_cluster.dedicated.rest_endpoint
  credentials {
    key    = confluent_api_key.app-manager-kafka-api-key.id
    secret = confluent_api_key.app-manager-kafka-api-key.secret
  }
}

Additionally, for_each should probably be at the top of the resource block to make sure it is visible immediately to the reader. The if t.enable part will make sure that for_each will create a resource only when the variable key has the enabled = true.


text:
Q: Should it be necessary to assign navigation properties and foreign key properties? I have two tables: Status (primary key Sid) and Order (primary key Oid). The relation is set so that Sid is a foreign key in Order using a column StatusId.
When I generate the model using EF, I get two properties in Order that refer to Status. First being the actual column (type Nullable, which is the foreign key). Second being the navigational property (type virtual Status). In Status I only  get one property referring to Order (virtual ICollection).
I had no reasons to suspect there was anything wrong with the setup and I haven't modified anything in the classes, I have no partial alterations and I haven't changed the T4 scripts. Everything is automagically generated from the database (no Code First).
I notice something that bother me, though. When I edit one of the orders, I set the status of it (not the id integer but the actual property). In the debugger, I'm checking that it's been set. However, then I call SaveChanges, those are not being stored - the database contains no update and reloading the entities produces the state before my change being entered.
At the moment I tackle the problem as follows.
private void Combox_Changed(object sender, SelectionChangedEventArgs eventArgs)
{
  EditedOrder.StatusId = EditedOrder.Status.Sid;
}

However, that seems as a work-around hinding the real issue that I have in my code, rather than something that need to be done. My question is whether my suspicion is justified.
The property or Order is set by data binding to a combo box using the following XAML markup.
<ComboBox Name="Status"
          DisplayMemberPath="Name"
          ItemsSource="{Binding Statuses}"
          SelectedItem="{Binding Path=Order.Status}"
          SelectionChanged="Combox_Changed"
          Style="{StaticResource DefaultComboBoxStyle}" />


text:
Q: Hive is not starting and show errors I have hadoop single node installed. Now I download hive and configured the environment variables in .bashrc file and now I create a hive-site.xml with this content:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>

</configuration>

Now I'm starting hive but Im getting a lot of errors. Do you see why this errors are happening? It is because of hive-site.xml? What are the necessary proprieties in this hive-site.xml? I´m trying to find this info to see if we edit this hive-site.xml file correctly the errors disappear, and I already try some configuration examples but the errors still continues..
[hdoopadmin@hadoop ~]$ hive

Logging initialized using configuration in jar:file:/usr/local/apache-hive-1.2.1-bin/lib/hive-common-1.2.1.jar!/hive-log4j.properties
Exception in thread "main" java.lang.RuntimeException: java.net.ConnectException: Call From hadoop/10.2.0.15 to localhost:9000 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused
    at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:522)
    at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:677)
    at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.net.ConnectException: Call From hadoop/10.2.0.15 to localhost:9000 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.apache.hadoop.net.NetUtils.wrapWithMessage(NetUtils.java:792)
    at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:732)
    at org.apache.hadoop.ipc.Client.call(Client.java:1480)
    at org.apache.hadoop.ipc.Client.call(Client.java:1407)
    at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:229)
    at com.sun.proxy.$Proxy15.getFileInfo(Unknown Source)
    at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getFileInfo(ClientNamenodeProtocolTranslatorPB.java:771)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:187)
    at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102)
    at com.sun.proxy.$Proxy16.getFileInfo(Unknown Source)
    at org.apache.hadoop.hdfs.DFSClient.getFileInfo(DFSClient.java:2116)
    at org.apache.hadoop.hdfs.DistributedFileSystem$22.doCall(DistributedFileSystem.java:1305)
    at org.apache.hadoop.hdfs.DistributedFileSystem$22.doCall(DistributedFileSystem.java:1301)
    at org.apache.hadoop.fs.FileSystemLinkResolver.resolve(FileSystemLinkResolver.java:81)
    at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:1301)
    at org.apache.hadoop.fs.FileSystem.exists(FileSystem.java:1424)
    at org.apache.hadoop.hive.ql.session.SessionState.createRootHDFSDir(SessionState.java:596)
    at org.apache.hadoop.hive.ql.session.SessionState.createSessionDirs(SessionState.java:554)
    at org.apache.hadoop.hive.ql.session.SessionState.start(SessionState.java:508)
    ... 8 more
Caused by: java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
    at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:531)
    at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:495)
    at org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:609)
    at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:707)
    at org.apache.hadoop.ipc.Client$Connection.access$2800(Client.java:370)
    at org.apache.hadoop.ipc.Client.getConnection(Client.java:1529)
    at org.apache.hadoop.ipc.Client.call(Client.java:1446)
    ... 28 more
[hdadmin@hadoop ~]$

When I start the hiveserver:
[hdadmin@hadoop ~]$ hive --service hiveserver
Starting Hive Thrift Server
Exception in thread "main" java.lang.ClassNotFoundException: org.apache.hadoop.hive.service.HiveServer
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.apache.hadoop.util.RunJar.run(RunJar.java:214)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
[hdadmin@hadoop ~]$


text:
Q: Issue with scope.$eval in a third party directive I am using a selectionModel(selection-model.js) directive in my application. I am passing some values to directive using attribute in my element.
In the directive link function, value is being read like =
var smMode = scope.$eval(attrs.selectionModelMode) || defaultMode

Earlier, the directive was working fine but suddenly it is not working anymore. when i investigated and found scope.$eval(attrs.selectionModelMode) is coming as undefined and it's falling back to defaultMode.
Directive does not have a isolated scope. but it's used with ng-repeat.
When I am adding a property to parent scope as attrs.selectionModelMode = 'multiple' and change the directive code to
var smMode = scope.$parent.$eval('attrs.selectionModelMode') || defaultMode
then only it's working.
The problem with this I can not change the directive code. Is there any work around in AngularJS for this?
Thanks a lot in advance...


text:
Q: Arduino array of structs in PROGMEM I am using a standalone ATmega328P with two piezo elements to generate some music.
I have defined some constants with the frequencies of the music notes.
Then I defined a struct which contains the note for the first and the second piezo and the length of the note.
Then I made more arrays of these structs to describe each songs.
The problem is that this way I run out of memory quickly. I tried to store the arrays of structs in the PROGMEM, to avoid this problem. I tried to use a small library called PROGMEM_readAnything, the memcpy_P() or the pgm_read_word() and pgm_read_byte() functions, but in all cases I get the same problem.
As I loop through the array of NOTES it skips some of the elements, while reads and plays the others correctly. It always skips the same elements, and not just random ones.
I even tried to change the microcontroller, thinking that certain parts of the chip may have been damaged by something, but uploading the same sketch I got the same results, so the microcontroller is probably intact.
Here is the code:
#include <Tone.h>
#include <avr/pgmspace.h>

// Define the notes frequency
#define G2 98
#define Gs2 104
#define Ab2 104
#define A2 110
#define As2 116

//... and so on with many other music notes ...

#define Fs7 2960
#define Gb7 2960
#define G7 3136

//Rest
#define R 0

typedef struct {
    int n1;
    int n2;
    byte units;
} NOTES;

Tone buzzer1;
Tone buzzer2;

int myTempo = 100;

// Walkyrie
const NOTES walkyrie[] PROGMEM = {

                          {Fs3, Fs4, 2},
                          {B3,  B4,  3},
                          {Fs3, Fs4, 1},
                          {B3,  B4,  2},
                          {D4,  D5,  6},
                          {B3,  B4,  6},
                          {D4,  D5,  3},
                          {B3,  B4,  1},
                          {D4,  D5,  2},
                          {Fs4, Fs5, 6},
                          {D4,  D5,  6},
                          {Fs4, Fs5, 3},
                          {D4,  D5,  1},
                          {Fs4, Fs5, 2},
                          {A4,  A5,  6},
                          {A3,  A4,  6},
                          {D4,  D5,  3},
                          {A3,  A4,  1},
                          {D4,  D5,  2},
                          {Fs4, Fs5, 6},
                          {R,    0,  4},
                          {A3,  A4,  2},
                          {D4,  D5,  3},
                          {A3,  A4,  1},
                          {D4,  D5,  2},
                          {Fs4, Fs5, 6},
                          {D4,  D5,  6},
                          {Fs4, Fs5, 3},
                          {D4,  D5,  1},
                          {Fs4, Fs5, 2},
                          {A4,  A5,  6},
                          {Fs4, Fs5, 6},
                          {A4,  A5,  3},
                          {Fs4, Fs5, 1},
                          {A4,  A5,  2},
                          {Cs5, Cs6, 6},
                          {Cs4, Cs5, 6},
                          {Fs4, Fs5, 3},
                          {Cs4, Cs5, 1},
                          {Fs4, Fs5, 2},
                          {As4, As5, 6}
                        };

void playSong()
{
    // We store the frequency of the second piezo in this variable
    int secondFreq = 0;
    Serial.println(sizeof(walkyrie)/sizeof(walkyrie[0]));
    // Walk through the array of music
    for(int i = 0; i < sizeof(walkyrie)/sizeof(walkyrie[0]); i++)
    {
        int n1;
        int n2;
        byte units;
        // Only play if it is not a rest
        if (walkyrie[i].n1 > 0)
        {
            n1 = pgm_read_word(&(walkyrie[i].n1));
            n2 = pgm_read_word(&(walkyrie[i].n2));
            units = pgm_read_byte(&(walkyrie[i].units));

            Serial.print("Row ");
            Serial.print(i);
            Serial.print(": Frequency 1: ");
            Serial.print(n1);
            Serial.print(" Frequency 2: ");
            Serial.print(n2);
            Serial.print(" Units: ");
            Serial.println(units);

            // Play the note of the first piezo
            buzzer1.play(n1, (units*myTempo));
            // If the frequency of the second piezo is 0, we play the same note
            // as the first, else the note set for the second one
            if (n2 == 0)
            {
                secondFreq = n1;
            }
            else {
                secondFreq = n2;
            }

            buzzer2.play(secondFreq, (units*myTempo));
        }

        // Then we wait for the note to end plus a little, between two notes
        delay((units*myTempo) + 10);
    }
}

void setup() {
    Serial.begin(9600);
    buzzer1.begin(11);
    buzzer2.begin(12);
}

void loop()
{
     playSong();
}

I added some lines to see in serial monitor what happens. It reads the correct length...
The output of the serial monitor is the following:
41                                        (correct length)
Row 1: Freq1: 247 Freq2: 499 Units: 3     (row 0 - the first note is already missing)
Row 2: Freq1: 185 Freq2: 370 Units: 1
Row 3: Freq1: 247 Freq2: 499 Units: 2     (row 4 missing)
Row 5: Freq1: 247 Freq2: 499 Units: 6     (row 6-7 missing)
Row 8: Freq1: 294 Freq2: 587 Units: 2
Row 9: Freq1: 370 Freq2: 740 Units: 6
Row 10: Freq1: 294 Freq2: 587 Units: 6
Row 11: Freq1: 370 Freq2: 740 Units: 3
Row 12: Freq1: 294 Freq2: 587 Units: 1
Row 13: Freq1: 370 Freq2: 740 Units: 2
Row 14: Freq1: 440 Freq2: 880 Units: 6
Row 15: Freq1: 220 Freq2: 440 Units: 6    (row 16-17 missing)
Row 18: Freq1: 294 Freq2: 587 Units: 2
Row 19: Freq1: 370 Freq2: 740 Units: 6
Row 20: Freq1: 0 Freq2: 0 Units: 4
Row 21: Freq1: 220 Freq2: 440 Units: 2
Row 22: Freq1: 294 Freq2: 587 Units: 3
Row 23: Freq1: 220 Freq2: 440 Units: 1
Row 24: Freq1: 294 Freq2: 587 Units: 2
Row 25: Freq1: 370 Freq2: 740 Units: 6
Row 26: Freq1: 294 Freq2: 587 Units: 6
Row 27: Freq1: 370 Freq2: 740 Units: 3
Row 28: Freq1: 294 Freq2: 587 Units: 1
Row 29: Freq1: 370 Freq2: 740 Units: 2
Row 30: Freq1: 440 Freq2: 880 Units: 6
Row 31: Freq1: 370 Freq2: 740 Units: 6
Row 32: Freq1: 440 Freq2: 880 Units: 3
Row 33: Freq1: 370 Freq2: 740 Units: 1
Row 34: Freq1: 440 Freq2: 880 Units: 2
Row 35: Freq1: 554 Freq2: 1109 Units: 6
Row 36: Freq1: 277 Freq2: 554 Units: 6
Row 37: Freq1: 370 Freq2: 740 Units: 3
Row 38: Freq1: 277 Freq2: 554 Units: 1
Row 39: Freq1: 370 Freq2: 740 Units: 2
Row 40: Freq1: 466 Freq2: 932 Units: 6

Why does it happen? Or is there a better, more efficient way of solving this problem?

A: In this line, you check the data, but you haven't done a 'pgm_read_word()' to actually get the data from the flash memory:
if(walkyrie[i].n1 > 0)

If, by accident, you get a non-zero value, then you correctly read the values from flash, but otherwise, you skip that row.
Further evidence:
Row 20: Frq1: 0 Frq2: 0 Units: 4

Here, n1 is zero, but that test should have skipped the row.
Also, the logic for a 'rest' is a little off. Right now, you don't read the units for the duration of the rest, so it's using the previous value (from a played note).
I think I'd get all three values first, and then check them.
I'd also encode the frequencies into a byte, and use a look-up table to convert the "key number" into a frequency (like MIDI key numbers).  Your array of structs will be a little smaller that way. Maybe turn on the __packed__ (whatever) attribute also, to avoid the padding between the entries -- if saving flash space matters (then you could get more songs in there!)
Sounds fun! Good luck!


text:
Q: Changing the class of a div after a time delay I am wanting add a class to a div element (id="one") 10 seconds after a page loads, without anything having to be hovered on or clicked on etc. I tried the following code but it does not work:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

$(document).ready(function(){
$('#one').delay(10000).addClass("grow")
});

Any idea where the above code is going wrong?

A: DEMO
$(document).ready(function(){
    window.setTimeout(function(){
        $("#one").addClass("one");
    },10000);
});

A: delay only works on elements on jQuery's queue. Since addClass isn't an animation added to the queue by default, it runs immediately regardless of delay. You should use Javascript's native setTimeout for general delays:
$(function(){
    setTimeout(function() {
        $('#one').addClass("grow")
    }, 10000);
});

jsfiddle

A: The delay method adds an item to the animation queue, but as addClass is not an animation effect, it's not put on the queue, it takes effect right away.
You can use the queue method to put code in the animation queue, so that it runs after the delay:
$('#one').delay(10000).queue(function(){
  $(this).addClass("one");
});

Demo: http://jsfiddle.net/6V9rX/
An alternative to use animation for the delay is to use the setTimeout method:
window.setTimeout(function(){
  $('#one').addClass("one");
}, 10000);


text:
Q: AWS Glue vs EMR Serverless Recently, AWS announced Amazon EMR Serverless (Preview) https://aws.amazon.com/blogs/big-data/announcing-amazon-emr-serverless-preview-run-big-data-applications-without-managing-servers/  - new very promising service.
From my understanding - AWS Glue is a managed service on top of Apache Spark (for transformation layer). AWS EMR is mostly used for Apache Spark as well. So EMR Serverless (for Apache Spark) looks like is something pretty much similar to AWS Glue.
Right now I have one question in my mind - what is the core difference from AWS Glue and when to choose EMR Serverless over Glue?
Potentially EMR Serverless, may be even a part of AWS Glue ecosystem for transformation layer? Maybe AWS is going to replace the transformation layer in AWS Glue with EMR Serverless, and then it may make sense. AWS Glue will play a role of ETL Overlay, Metastore with EMR Serverless as processing layer.

A: I'll give you my two cents about this because I've been wondering the same thing.
Glue
As per AWS documentation, AWS Glue is "Simple, scalable, and serverless data integration". Glue can be used for a variety of things: as a metadata repository, automatic schema discovery, code generation, and run ETL pipelines to prepare data. Glue takes care of providing and managing the computation resources needed to run your data pipelines. Glue is a serverless service, so you don't need to create and manage the infrastructure, because Glue does it for you.
If we focus only on the processing feature and discard the Glue-specific features (schema discovery, code generation, etc) then EMR Serverless and Glue services look almost identical. One of the key advantages of both services is the ability to run Spark or Hive serverless applications.
What advantage will EMR Serverless have over Glue Spark jobs?
To run Glue, you must either specify MaxCapacity (for Glue version 1.0 or earlier jobs) or Worker type and the Number of workers (for Glue version 2.0 jobs). Both options assume, first, that there is some understanding of the data and workload per cluster, and second, that the workload during job execution will be uniform, i.e., there will be no over- or under- utilization of the provisioned resources.
EMR Serverless
EMR Serverless is a new deployment option for AWS EMR. With EMR Serverless, you don't need to configure, optimize, protect, or manage clusters to run applications on these platforms. EMR Serverless helps you avoid over- or under-allocation of resources to process jobs at the individual stage level.
EMR Serverless automatically identifies the resources needed by jobs, provisions those resources to run the jobs, and releases them when the jobs are completed. In cases where applications require a response within seconds, such as interactive data analysis, the engineer can pre-initialize the necessary resources during application creation. This provides easy initialization, fast job startup, automatic capacity management, and simple cost control.
More info: https://luminousmen.com/post/emr-serverless-a-400level-guide

A: AWS Glue is a data integration service and ETL. Completely different service than EMR Analytics.
AWS Glue can be used as metadata store (table schema) for EMR and run integration jobs to prepare data (e. g. for the EMR). There are are data integration jobs and workflows.  At least that's the intention to make the jobs limited, but simpler to manage.
EMR is much more (and very different). In theory the EMR  could as well run the python data integration jobs in batch on top of a Spark cluster, but you could run any jobs inside a Spark cluster. EMR is more an analytics tool and processing tool. It is not limited to Spark processing of python batch jobs, you can use different frameworks. Though EMR serverless docs mention only Spark and Hive queries, you have much more control over the processing job.
If anything compares to the EMR service, it's Athena, which is something like EMR serverless with Spark and Presto and on its own network.


text:
Q: Exclude parameters taken from XML by regular expression (regex) I have a parameter in XML files with a mask:
<id>ALL2-20210301-XXXXXX-XXXXX_X</id>

where ALL2 is always the same parameter, 20210301 is a date so changing every day, and XXXXXX-XXXXX_X is a variable parameter.
I want to parse XML and get 20210304 value (or other date) with regex - I don't need any other parameter from . How should regular expression value looks like?
code is:
[xml]$xml = Get-Content c:\buy\buy.xml
$date= $xml.buy.id[0]
if ($date -match "regex?") {
    $date = $matches[0];
}

A: You don't need regex, you can just split on '-' and take the second element, so for example:
$result = ($date -split '-')[1]
It is likely faster than regex too (haven't measured).

A: Several alternative approaches
$date = 'ALL2-20210301-XXXXXX-XXXXX_X'

$date.Split('-')[1]

$date -split '-' | Select-Object -Index 1

$date -replace '^.+?-|-.+$'

$date -replace '.+(\d{8}).+','$1'

[regex]::Match($date,'\d{8}').Value

if($date -match '\d{8}'){$matches.0}


text:
Q: Why when I run the ggttest there is an error? When I run the t-test for a numeric and a dichotomous variable there in no problem and I can see the results. The problem is when I run the ggttest of the same t-test. There is an error and says that one of my variable is not found. I do not why that happens. The aml dataset I used is from package boot. Below you can see the code:
https://i.stack.imgur.com/7kuaA.png
library(gginference)
time_group.test16537 = t.test(formula = time~group,
                              data = aml,
                              alternative = "two.sided",
                              paired = FALSE,
                              var.equal = FALSE,
                              conf.level = 0.95)
    time_group.test16537

    ggttest(time_group.test16537,
            colaccept="lightsteelblue1",
            colreject="gray84",
            colstat="navyblue")

A: The problem comes with these lines of code in ggttest:
datnames <- strsplit(t$data.name, splitter)
len1 <- length(eval(parse(text = datnames[[1]][1])))
len2 <- length(eval(parse(text = datnames[[1]][2])))

It tries to find the len of group and time, but it doesn't see that it came from a data.frame. Pretty bad bug...
For your situation, supposedly you have less than 30 in each group and it plots a t-distribution, so do:
library(gginference)
library(boot)
gginference:::normt(t.test(time~group,data=aml),
colaccept = "lightsteelblue1",colreject = "grey84",
colstat = "navyblue")

A: t.test doesn't store your data in the output so there is no way that you could extract the data from the list of the output of t.test.
The only way to use formula is:
library(gginference)
t_test <- t.test(questionnaire$pulse ~ questionnaire$gender)
ggttest(t_test)

Original answer here: How to extract the dataset from an "htest" object when using formula in r


text:
Q: Estimating Distance From an Image Assuming that the person stands parallel to a wall. The person and the wall are at the same ground level. The person takes a picture of the wall (Considering that the person always captures the bottom edge of the wall).
Hypothesis:
It is obvious that when the person is closer to the wall, the bottom edge of the wall tends to be at the bottom in the image. As we move farther, the edge moves more closer towards the center in the image.
So, there exists a relationship between "Distance from wall" and "Position of edge of the wall in the image".
The known parameters are:
-> Height of the camera from which the image is captured
-> Angle(Orientation of the camera)
-> Position of the edge in the image
How can I formulate the distance(depth) based on the above parameters? Are there any other parameters that affect the above relationship?

A: vres is vertical resolution (for example, 1080).
vfov - vertical field of view (for example, 20 degrees)
f - focal distance (deduced from fov)
 vres/2 / f = tg(vfov/2)
 1/f = 2 * tg(vfov/2) / vres

dy - position of bottom edge at image relative to matrix center
theta - angle of edge relative to objective axis
 tg(theta) = dy / f = dy * 2 * tg(vfov/2) / vres
 theta = atan(dy / f = dy * 2 * tg(vfov/2) / vres)

fi is camera pitch angle
alpha is inclination of camera relative to wall bottom
alpha = fi +/- theta   (depending on pitch sign)

d is distance wall bottom- camera bottom
h is camera height
d = h * ctg(alpha)


text:
Q: Image link to page I have a logo in the header of my website and I want the logo to direct you to the home page when it is clicked.  In the code, the anchor is just surrounding the  tag, but on the website the entire div is clickable.  How can I make it so that just when I hover on the image it is clickable, not the entire div.

A: I just found the answer.  I needed to add the style display: inline-block to the  tag.


text:
Q: Error preloading the connection pool while running sql statement in Jmeter Error preloading the connection pool while running sql statement in Jmeter.
I am using below env:

*

*jdk1.8.0_151

*apache-tomcat-7

*commons-dbcp.jar (version: 2.1.1)

*commons-pool2-2.4.2

*apache-jmeter-3.1

*mysql-connector-java-5.1.45-bin

pfa jdbc connection,jdbc_request,request,response_data,sampler_result screenshots

A: I had a similar question when even 10 max connection settings in oracle caused errors. I suggest you use 0 value in JDBC's Maximum number of connections as recommended in JMeter JDBC manual:

Maximum number of connections allowed in the pool. In most cases, set this to zero (0).This means that each thread will get its own pool with a single connection in it, i.e. the connections are not shared between threads.


text:
Q: Should we be putting CSS in the HTML via
A: An interesting question!
First of all lets dispense with any ease of coding arguments. Server side code can compile, minify and bundle all the css, javascript and html together from the usual separate files.
Now we have a purely technical question of speed.

*

*Is it quicker to download one file on two at almost the same time?

*Is it quicker to parse one large file or two small ones?

*Is the load on the server greater one way or the other?

*How does caching affect the situation when you have more than one request

*How does caching affect the situation where you have more than one page
We can test this in a browser easily enough and you can see a slight advantage for the single request in all but the last question.
If you have two pages which share css or javascript, loading the second page with the separate method benefits from the cached versions of those files where as the single page version downloads all that data twice.
When we consider that your JavaScript in particular can be many times larger than your html and tends to be used on every page. You can see that there is a very real benefit in putting shared code and css in separate files.


text:
Q: Using curl to get dns/connect/send/wait/receive times of url I need help picking the right curl functions to calculate these things:
DNS The web browser is looking up DNS information
Connect The web browser is connecting to the server
Send    The web browser is sending data to the server
Wait    The web browser is waiting for data from the server
Receive The web browser is receiving data from the server

For example if i have this url http://g2.delfi.lt/scms/?g=delfi-fp.css&1362823940 , i would want to get these values:
DNS - 443ms
Connect - 589ms
Send - 1ms
Wait - 152ms
Receive - 1ms

Can i do this using curl?

A: The curl can easy get the dns,connect time.wait=TOTAL?

A: Using both the curl command line tool or libcurl you will need some post-processing.
curl exposes the following times:
curl_easy_perform()
     |
     |--NAMELOOKUP
     |--|--CONNECT
     |--|--|--APPCONNECT
     |--|--|--|--PRETRANSFER
     |--|--|--|--|--STARTTRANSFER
     |--|--|--|--|--|--TOTAL
     |--|--|--|--|--|--REDIRECT

Programmatically you can use:
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );

to retrieve them. Details here
Using the curl cli tool you can print all the above values using the --write-out option
You will then need to do some really simple math to get the time deltas you need.


text:
Q: PC restarts on certain games Three days ago, I built my first gaming PC, everything was running smoothly upon today. So after 3 days, I decided to play few rounds of Fortnite, I turned it on and immediately the game crashed, I started again and I got a BSOD stating MEMORY_MANAGEMENT. I got worried (since it is my first build, very afraid of frying hardware), so I researched into the problem. I found two solutions: One of the solutions were to run "Windows Memory Diagnostics", so I ran that and it immediately thrown that there is an hardware issue. The other one, was to update everything (Windows, Drivers, BIOS). Since windows and drivers updates were updated on the first day of build (it was running smoothly) - I updated the BIOS.
The BIOS update went successful (I updated directly through BIOS using ethernet). Once the windows booted up again, I tried to run Fortnite again. Everything was working for approx. 15 minutes and I got another BSOD stating KERNEL_SECURITY_CHECK_FAILURE
. I researched the problem again and the closest issue I could come was the recent BIOS drivers, or malicious software. In this case, I was completely lost, so I just scanned the computer and it showed it was clean. I decided to try and run the game again and now it is restarting upon launching the game, without any warnings.
After, I tried to launch a different game - The Rise of the Tomb Raider. The game was running smoothly without any issues for 1+ hours until I quit. So I thought, it might be something with Fortnite, so I tried another game - Rainbow Six: Siege. It ended up on the same faith as Fortnite, restarting the PC. Last, I decided to go back to the roots and find out which RAM stick is faulty (I discovered that one stick has no issues the other is faulty) by running Windows Memory Diagnostics. So I removed the "faulty" one out and just left one (I have 2x8) and to try and run it again and it ended up restarting the PC again.
All in all, I'm in desperate need of help.
- The drivers are up to date (including BIOS)
- I am running WM Monitor, to monitor the heating and I have fair temperatures
- I ran Furmark, to make sure my GPU is working
- Some games are restarting immediately and some works fine (even with the "faulty" stick)?
Specs:
Motherboard: Asus Prime Z370-A
CPU: Intel I5 8600k
GPU: Asus GTX 1060 6 Gb
RAM: Corsair Vengeance 2x8 LPX DDR4 3000MHz
PSU: Cooler Master MasterWatt 650
Please point me to the right direction. The hardware is basically brand new (3 days of usage that had absolutely no issues) and already faulty RAM stick and something else? Before I buy new sticks, What could cause the faulty RAM? Appreciate for any kind of help.
Happy Holidays!
Marius J.

A: From your problem description it is very hard to pinpoint a plausible exact cause for the behavior.
One possibility for all of it is "ESD-damage".
You may have experienced the electrical snaps you get as you have walked over a carpet, sat in a car, pulled off a sweater - or similar - and then grab something metallic (car door, faucet, ...).
The snap is caused by electrical charge equalizing between your hand and a larger electrical conducting or even electrically grounded object.
The electrical voltage involved for the snaps that jolts your body has levels in the neighborhood of 5000 volts, and above.
The sad story is that all levels down to some 10-15 volts may damage electronics components; at high levels simply by pointing a finger at them, even from a 1 meter distance - depending on the construction of the component and the environmental circumstances.
As you won't notice the lower levels; there is just one thing to do. Be aware, and take precautions.
The precautions may be simple things:

*

*Wear a wrist band, wired to a electrical ground-connection.

*While working avoid wearing clothes prone to create electrical
charge.

*Place ESD-bags with components on a grounded surface (e.g. a sink) and handle them
there only.

*Repeatedly discharge yourself against the grounded surface by
touching it, or even holding your elbows or wrists against it while
working.

*Only SLIDE out the electronic components from one bag, with the bag
on the grounded surface, onto the grounded surface.

*Mount items (e.g. in a computer chassis, on the main board) while keeping elbows (shirt sleeves and arms) extended slightly from your body.

A: Problem solved (hopefuly).
While trying desperately everything, I decided to do connection checkup and reinstall windows before I bring it to the experts for full PC checkup. I started installing windows and on 22% I got Kernel_Security...... BSOD. So instantly removed the ram stick which I suspected is faulty and started the installation again. All went well, it installed and I can play games again.
Only one question remains unanswered - for what reasons the ram stick got faulty, even though it was just 3 days old...


text:
Q: Is it possible to format an RMarkdown report dashboard style? For this use case I cannot use flexdashboard, however I am looking to see if I can create something similar to flexdashboard but in RMarkdown (knitted to html). I am looking to format an RMarkdown report like the format you see below and in a landscape mode. I've only created markdown reports in a portrait style.

I found this online in a video and I wasn't sure how it was created but this was created in RMarkdown. If there is a way to do this, is it possible someone can share a reproducible example?


text:
Q: Retrieve Architecture from Java I'm writing a JNI application and I want the app to download the correct binary library for the current architecture. Is there any way to retrieve this information from code?
I need to know where it's ARM, x86 or any other architecture really.
Kind regards,
Gavin

A: java.lang.System.getProperty("os.arch") should help -- giving "arm", "amd64", and the like.

A: System.getProperty("os.arch")

http://www.roseindia.net/java/beginners/OSInformation.shtml

A: This works in Java 6SE:

public class ListProperties
{
     public static void main(String[] argv)
     {
        System.getProperties().list(System.out);
        // These are only examples of obtaining specific properties
        System.out.println(System.getProperty("user.name"));
        System.out.println(System.getProperty("java.library.path"));
     }
}


text:
Q: Create view with scalar column Can I create an Oracle view like this statement?
create or replace view FARMERS_DATA
AS
SELECT DISTINCT F.FNAME
       , F.LNAME
       , F.REGION
       , P.NAME
       , SP.NAME as SUB_PRODUCT_NAME
       , number(2) as PRICE
FROM FARMERS F, PRODUCT P, SUB_PRODUCT SP
WHERE SP.PRODUCT_ID = P.PRODUCTID
ORDER BY F.FNAME

I want that the last column will be a scalar - not a data from another table.
Thanks!

A: You want a view with an empty column which has a numeric datatype.  You can do that with a CAST() like this:
create or replace view FARMERS_DATA
AS
SELECT DISTINCT F.FNAME
       , F.LNAME
       , F.REGION
       , P.NAME
       , SP.NAME as SUB_PRODUCT_NAME
       , cast(null as number(2)) as PRICE
FROM FARMERS F, PRODUCT P, SUB_PRODUCT SP
WHERE SP.PRODUCT_ID = P.PRODUCTID
ORDER BY F.FNAME


text:
Q: TaskScheduler do not run task on main thread I write following code to try using TaskScheduler. Task content within the UpdateStatus function need to be run on the main thread. But I just get the output indicate that it's running on separate thread.
Any ideas about the reason? or alternative method of writing status from background thread in main thread context.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
  class Test
  {
    TaskScheduler scheduler;
    public void Run()
    {
      SynchronizationContext.SetSynchronizationContext(new SynchronizationContext());
      scheduler = TaskScheduler.FromCurrentSynchronizationContext();
      Console.WriteLine("Start on {0}", Thread.CurrentThread.ManagedThreadId);
      Task.Factory.StartNew(() =>
      {
        for (int i = 0; i < 10; i++)
        {
          Console.WriteLine("running on {0}", Thread.CurrentThread.ManagedThreadId);
          UpdateStatus(string.Format("Message {0}", i));
          Thread.Sleep(1000);
        }
      }).ContinueWith(_ =>
      {
        Console.WriteLine("complate");
        Console.WriteLine("running on {0}", Thread.CurrentThread.ManagedThreadId);
      }, new CancellationToken(), TaskContinuationOptions.None, scheduler).Wait();
    }

    private void UpdateStatus(string message)
    {
      Task.Factory.StartNew(() =>
      {
        Console.WriteLine("updating status on {0}", Thread.CurrentThread.ManagedThreadId);
        Console.WriteLine(message);
      }, new CancellationToken(), TaskCreationOptions.None, scheduler);
    }
  }

  class Program
  {
    public static void Main(string[] args)
    {
      var test = new Test();
      test.Run();
    }
  }
}

A: The Default SynchronizationContext (which you are using), doesn't get you to the main thread.  See Why SynchronizationContext does not work properly?.
As svick mentions, in your case (a Console application), there is usually no need for the concept of a main thread.

A: You didn't explain what exactly are you trying to do, so it's hard to advise you on the best course of action.
Your current code doesn't work, because the SynchronizationContext you're creating doesn't actually do any synchronization. (And your main thread is also blocked on the Wait() call, so nothing else can run on it.)
You could use synchronization context that synchronizes properly to the main thread (like the one from Nito AsyncEx), but I'm not sure that's the best way in your case.
I think a better approach would be to use the producer/consumer pattern using BlockingCollection. Your Tasks would add items to it and your main thread would take them from there and send them to the pipeline using WriteObject().


text:
Q: Use Current Location to draw poly lines to a destination on Flutter I have an application with a google map, the application gets my current location, there are two markers on the map, one point of the marker and the polyline are coordinates passed from a previous screen. I want the starting point of the poly line to be my current location. I also want to use my current location for the first marker. If the polyline and marker will change position as the driver moves, that will be great. But this is not a priority now.
What I have done so far: I am able to get my current location. I am able to draw polyline from a hardcoded coordinates from a source location to a destination location(the destination location was provided using hardcode Cordinate)
What I want to do: Use my current location as the starting point of my polyline Use my current location, Update the polyline and the marker when the User moves.
Here is the code I have so far.

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:google_mao/constants.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:location/location.dart';
import 'package:geolocator/geolocator.dart';

class OrderTrackingPage extends StatefulWidget {
  const OrderTrackingPage({Key? key}) : super(key: key);

  @override
  State<OrderTrackingPage> createState() => OrderTrackingPageState();
}

class OrderTrackingPageState extends State<OrderTrackingPage> {
  final Completer<GoogleMapController> _controller = Completer();
  static const snackBar = SnackBar(
    content: Text(
        "Problem Ahead Please Change Route, if you cannot change route then please proceed with carefull"),
  );
  static const LatLng sourceLocation =
      LatLng(-5.163422787901919, 119.4524314848277);
  static const LatLng problem1 = LatLng(-5.159517091944005, 119.44694331116966);
  static const LatLng problem2 = LatLng(-5.167239534487095, 119.40174159126605);
  static const LatLng destination =
      LatLng(-5.1670891353015715, 119.42620389739191);
  double distanceSourceFinish = Geolocator.distanceBetween(
      sourceLocation.latitude,
      sourceLocation.longitude,
      destination.latitude,
      destination.longitude);

  Map<PolylineId, Polyline> polylines = {};
  List<LatLng> polylineCoordinates = [];
  LocationData? currentLocation;
  late LocationData newLoc;

  getCurrentLocation() async {
    Location location = Location();

    location.getLocation().then(
      (location) {
        currentLocation = location;
      },
    );

    location.onLocationChanged.listen((newLoc) {
      currentLocation = newLoc;

      double distanceInMeters = Geolocator.distanceBetween(newLoc.latitude!,
          newLoc.longitude!, problem1.latitude, problem1.longitude);
      print(newLoc);
      print("distance : " + distanceInMeters.toInt().toString() + " m");
      print("longitude : " + newLoc.longitude.toString());
      print("latitude : " + newLoc.latitude.toString());
      if (distanceInMeters.toInt() <= 200) {
        print(
            "Problem Ahead Please Change Route, if you cannot change route then please proceed with carefull");
        ScaffoldMessenger.of(context).showSnackBar(snackBar);
      }
      setState(() {});
    });
  }

  addPolyLine(List<LatLng> polylineCoordinates) {
    PolylineId id = PolylineId("poly");
    Polyline polyline = Polyline(
      polylineId: id,
      color: Colors.deepPurpleAccent,
      points: polylineCoordinates,
      width: 8,
    );
    polylines[id] = polyline;
    setState(() {});
  }

  getPolyline() async {
    PolylinePoints polylinePoints = PolylinePoints();
    PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(
      google_api_key,
      PointLatLng(currentLocation!.latitude!, currentLocation!.longitude!),
      PointLatLng(destination.latitude, destination.longitude),
      travelMode: TravelMode.driving,
    );
    print("result" + result.toString());
    if (result.points.isNotEmpty) {
      result.points.forEach((PointLatLng point) {
        polylineCoordinates.add(LatLng(point.latitude, point.longitude));
      });
    } else {
      print(result.errorMessage);
    }

    addPolyLine(polylineCoordinates);
    setState(() {});
  }

  @override
  void initState() {
    getCurrentLocation();
    getPolyline();

    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Color.fromARGB(255, 155, 31, 14),
        title: const Text(
          "Route Maps",
          style: TextStyle(color: Colors.black, fontSize: 16),
        ),
      ),
      body: currentLocation == null
          ? Center(
              child: Text(
              "Loading",
              style: const TextStyle(
                fontSize: 26.0,
                fontWeight: FontWeight.w800,
              ),
            ))
          : Stack(
              alignment: Alignment.center,
              children: [
                GoogleMap(
                  mapType: MapType.satellite,
                  initialCameraPosition: CameraPosition(
                      target: LatLng(currentLocation!.latitude!,
                          currentLocation!.longitude!),
                      zoom: 16),
                  polylines: {
                    Polyline(
                        polylineId: PolylineId("route"),
                        points: polylineCoordinates,
                        color: Color.fromARGB(255, 255, 222, 35),
                        width: 6)
                  },
                  markers: {
                    Marker(
                        markerId: const MarkerId("currentLocation"),
                        position: LatLng(currentLocation!.latitude!,
                            currentLocation!.longitude!),
                        icon: BitmapDescriptor.defaultMarkerWithHue(
                            BitmapDescriptor.hueYellow)),
                    Marker(
                        markerId: MarkerId("source"),
                        position: sourceLocation,
                        icon: BitmapDescriptor.defaultMarkerWithHue(
                            BitmapDescriptor.hueAzure)),
                    Marker(
                        markerId: MarkerId("Problem"),
                        position: problem1,
                        icon: BitmapDescriptor.defaultMarkerWithHue(
                            BitmapDescriptor.hueRed)),
                    Marker(
                        markerId: MarkerId("destination"),
                        position: destination,
                        icon: BitmapDescriptor.defaultMarkerWithHue(
                            BitmapDescriptor.hueCyan)),
                  },
                  onMapCreated: (mapController) {
                    _controller.complete(mapController);
                  },
                ),
                Positioned(
                  top: 20.0,
                  child: Container(
                    padding: const EdgeInsets.symmetric(
                      vertical: 6.0,
                      horizontal: 12.0,
                    ),
                    decoration: BoxDecoration(
                      color: Colors.yellowAccent,
                      borderRadius: BorderRadius.circular(20.0),
                      boxShadow: const [
                        BoxShadow(
                          color: Colors.black26,
                          offset: Offset(0, 2),
                          blurRadius: 6.0,
                        )
                      ],
                    ),
                    child: Text(
                      "Distance : " +
                          //distanceCurrentProblem.toInt().toString() +
                          distanceSourceFinish.toInt().toString() +
                          " m",
                      style: const TextStyle(
                        fontSize: 18.0,
                        fontWeight: FontWeight.w600,
                      ),
                    ),
                  ),
                ),
              ],
            ),
    );
  }
}


text:
Q: Reinstall OS X Mavericks I am relatively new to Mac world. I've bought my first Apple computer, a MacBook Pro Retina 2013, a few weeks ago and I've tried a lot of software since then.
Anyway, to make a long story short, I have a problem with Xcode as descried in this question I posted on stack overflow. I want to try reinstalling the OS to see if the problem will disappear.
About reinstalling the OS, my biggest concert is if all my files will remain after reinstallation. So, can you reinstall OS X without having to format your hard drive?
My mac came with Mavericks.

A: Just to clarify :-) Simply reinstalling an O/S (upgrading too) does not delete any personal files, it over writes only system files to a freshly installed state.
remember that the FIRST thing you do after re-installing is running software update and getting all the patches.
The SECOND would be booting from the recovery partition and repairing permissions and the disk with Disk Utility (in that order)

A: Backup your files first before installing the OS
Note: if you are upgarding from ex: mountain lion to mavericks you will not lose files.


text:
Q: Continuously add new entries to Django model I need some conceptual help understanding how this idea would work. If I have a user make a list and they can add infinite items to each list, how would I want to map out the model?
In my list model I have user = ForeignKey(User), so each instantiation of this list model is attributed to the user currently logged in and they can have a series of lists. However, if they want to add an item to the list, would I have a new model called add_item and make the list_name = foreignkey(user.listname)?
#New List Model
    class NewList(models.Model):
        user = models.ForeignKey(User)
        list_name = models.CharField(max_length = 100, default = "Enter List Name")
        picture = models.ImageField(upload_to='profile_images', blank=True)

        def __unicode__(self):
            return self.list_name

#New Item Model
    class NewItem(models.Model):

        lists = models.ForeignKey(NewList)
        # list_name = models.OneToOneField(User.list_name)

        def __unicode__(self):
            return self.user.username

A: If I understands right,
class MyList(models.Model):
    user = ForeignKey(User)
    list_name = CharField(...)
    ....

    def list_items(self):
        return self.mylistitems_set.all()

class MyListItem(models.Model):
    mylist = ForeignKey(MyList)
    item_name = .....
    ....

A user may create as many lists an he/she wants and may add any number of items to a specific list. So logic is you create any number of lists (a record on MyList) and add as many items as you want to it through MyListItem.
Following is a good way to do this:
alist = MyList(......)
alist.mylistitem_set.create(...)  # add an item to alist

Django Reverse relations documentation is here
Update: Taking all lists of a specific user
user = User.objects.get() # a specific user
user.mylist_set.all() # returns all lists belong to that user.

You have to read more about reverse relations in django.

A: Sounds about right. If your model is eg named MyList, then:
my_user = ... # obtain a user object
my_item = MyList(user=my_user)
my_item.save()


text:
Q: Another test for Normality , or just Q-Q plot? I am considering this test for  univariate normality which I believe, but not sure, may be just like the Q-Q test.
The procedure is like this:

*

*We compute sample mean, standard error (S.E)

*Then compute percent of sample values within $ \pm 1,2,3 $ S.E's from the sample mean.

*We then compute a chi-squared goodness of fit between expected ( using 68-95-99 % rule ) and actual.

Is this a known test? If not, how could I find out how this statistic is distributed? This is not too deep, so I don't expect it to be something new, but I am curious as to how to figure out the distribution of this statistic.
Maybe his is something really simple, in which case maybe I can delete the question. My apologies if this is so.

A: Your description of the procedure is unclear. If you calculate the proportions in overlapping intervals those quantities will be dependent (above that caused by conditioning on the total), violating the chi-square assumption (though it should be possible to account for this issue).
If you have disjoint intervals then the statistic should be close to a chi-square as whuber notes (even though the boundaries are chosen based on the data).
I have seen something like this used before, but its power is surprisingly low (even after you take account of the fact that the chi-squared is already known to have fairly low power as a goodness of fit test) and it suffers from considerable bias against alternatives that are presumably of interest (that is, with power below the significance level) even at fairly large sample sizes.
[The chi-square has better power and less bias when the intervals are nearer to equiprobable but power is still fairly low even then]
I should mention that there's an issue with values outside $[-3,3]$, which should also be addressed.
Further note that testing goodness of fit for an assumption of normality is not particularly useful. See for example the discussion in Is normality testing essentially useless?; I particularly recommend Harvey's answer as concise and clear but covering what I see as the main issues.

A: There are a whole bunch of goodness-of-fit methods out there. However, I am particularly interested in this new method based on "kernel Stein  measure". It is difficult to explain it here, so please see the original paper
http://proceedings.mlr.press/v48/chwialkowski16.pdf


text:
Q: Word that means "recognizing that something is 'a thing'" I once read a story about a Navy man who, due to a bad childhood, never learned what emotions were. To him, there was no "angry", "happy", or "sad" — it was just "intense" and "not intense". Although most of us can differentiate between our feelings, there are many other such events in our daily lives that we experience, but don't necessarily have the language to talk or think about. For example:

*

*Someone who doesn't know much about cooking might not know that their food is undersalted. To them, it would simply taste "bland". Or, for a more frequent example, someone who doesn't know about the taste of astringency might find that some cups of tea taste worse than others, but not be able to describe why. One more: how about beer? I only started drinking beer recently, and it used to all taste the same to me. Now I can differentiate between vastly different styles (IPA and hefeweizen, for example), but all IPAs still taste almost identical. Over time, I'm sure I'll be able to differentiate between even those.

*Someone who's never encountered a discussion of framerate might not know why some TV shows look like soap operas and others don't.

*Someone who never bothered to learn the rules of grammar might not be able to explain them, even though they'd still be able to use them in everyday speech. (Same with math.) I constantly surprise myself by becoming conscious of weird grammar rules in Russian, such as the fact that the words in a sentence can be rearranged without changing the meaning.

*Someone who doesn't know music theory might not be able to explain why they have an emotional response to part of a song. A musician, on the other hand, can talk about chord progressions, tonality, melodic lines, voice leading, and various other techniques used to increase and decrease the tension.

In each of these cases, once you know the trick, the explanation seems obvious in retrospect. How could you not know what "happy" feels like? How do you not recognize saltiness? But when you're in a position where you don't even know that you don't know something, it's easy to miss patterns among the noise. There's simply no conceptual foundation for you to grab onto.
Is there a word that means, roughly, "taking something that was once understood in only a nebulous, ill-defined way, and acquiring the core concepts and vocabulary required to understand and talk about it specifically"? Or, more simply put, "recognizing that something is 'a thing'"?

A: apperception.

*

*Conscious perception with full awareness.

*The process of understanding by which newly observed qualities of an object are related to past experience.

Moreover from "Dictionary of Philosophy" by Dagobert D. Runes:

In psychology,
apperception is "the process by which new experience is assimilated to and transformed by the residuum of past experience of an individual to form a new whole."
In short, it is to perceive new experience in relation to past experience.

In epistomology,
"the introspective or reflective apprehension by the mind of its own inner states."

A: 'Reification' means exactly 'considering something to be a thing'. The verb is 'reify'. NB they are pronounced 'ree-ification' and 'ree-if-eye'.

A: Cogniscence I think best describes this but other synonyms like recognition and realization are somewhat valid as well.
This is similar to Donald Rumsfeld's Known known's quote which is a total classic in my opinion but he similarly had a hard time putting it into words that other people could grasp.

A: (Rather surprised this hasn't been suggested in any of the earlier answers.)
Conceptualisation (or -ization if you prefer) fits several aspects of your examples very well.  From the OED:

*

*trans. To form a concept or idea of (something); to represent with concepts.

  […]

  1899 Bk Buyer May 319/2   The phenomena which arrange themselves in our mind, and the categories which serve to conceptualize them, are nothing but forms.

A: I like to think of that awakening to knowing something or becoming aware of something as "enlightenment"
From Vocabulary.com:

"Enlightenment is education or awareness that brings change, such as your enlightenment about nutrition that leads you to throw out every last bit of your family's junk food."

A: Grok was jokingly(?) suggested as a comment, but I think it describes what you are after perfectly.

Definition of grok: to understand profoundly and intuitively

Your criticism is that

"(...)grokking, though, [implies] that you already knew that you didn't know something. I think the word I'm looking for is more about dealing with unknown unknowns."

However, your examples, and specifically the definition

"taking something that was once understood in only a nebulous, ill-defined way, and acquiring the core concepts and vocabulary required to understand and talk about it specifically"

describe something that was previously recognized as extant but not understood in a nuanced way. Grok describes this process of transforming understanding.
I think the reason why it's hard to define this word traditionally shows in the fact that an invented word seems to have gained some foothold in some communities (see StackOverflow).
EDIT: Upon rereading the question at hand, I realize there is a dissonance between your two definitions. "Understanding something in a nebulous, ill-defined way" does not mean the same thing as "don't realise that a thing is 'a thing'". This answer corresponds to the former definition.

A: I would go with metacognition.  Now that you know that you know something.  The earlier state would be ignorance.

Metacognition is defined as "cognition about cognition", or "knowing
  about knowing". It comes from the root word "meta", meaning behind.1
  It can take many forms; it includes knowledge about when and how to
  use particular strategies for learning or for problem solving.1
  There are generally two components of metacognition: knowledge about
  cognition, and regulation of cognition.

A: There might be a single word somewhere for your scenario, but I don't know it. I can offer a few related words, but they would not describe the person.
People with severe autism feel emotions similarly to your example. They have difficulty, however, in processing them. They feel intensely or less intensely, but they have difficulty in differentiating between emotions: happiness, sadness, frustration, desire, etc. Their emotions are unprocessed (not altered from an original or natural state) or undifferentiated (not made different by alteration or modification).
The same can be said of any level of understanding: of language, culture, self-insight, etc. Their understanding is unsophisticated (lacking experience or worldly wisdom; marked by a lack of refinement or complexity; unadulterated or genuine), primative (not derived from something else; primary or basic.), rudimentary (of or relating to basic facts or principles; being in the earliest stages of development), elementary (of, relating to, or involving the fundamental or simplest aspects of a subject), or basic/childlike/naive/a naif.
You can find more synonyms here.

A: Qualia

Qualia is a term used in philosophy to refer to individual instances of subjective, conscious experience. The term derives from a Latin word meaning for "what sort" or "what kind". Examples of qualia are the pain of a headache, the taste of wine, or the perceived redness of an evening sky.

This article describes qualia in terms of the experiential properties that add depth or dimension to one's understanding of their surroundings:

Qualia are the subjective or qualitative properties of experiences. What it feels like, experientially, to see a red rose is different from what it feels like to see a yellow rose. Likewise for hearing a musical note played by a piano and hearing the same musical note played by a tuba. The qualia of these experiences are what give each of them its characteristic "feel" and also what distinguish them from one another. experienced color will be able to know everything there is to know about that experience.

Qualia differs from awareness:
Awareness is the state or ability to perceive, to feel, or to be conscious of events, objects, or sensory patterns. In this level of consciousness, sense data can be confirmed by an observer without necessarily implying understanding.
Cognition may be a more colloquial word, rather than qualia, depending on who your audience is:

Cognition is the process by which the sensory input is transformed, reduced, elaborated, stored, recovered, and used. This may be an intermediate stage in the spectrum of between qualia and basic awareness

A: Thomas Kuhn's seminal The Structure of Scientific Revolutions created a big stir in the sciences, both hard and soft, when he suggested in his book that the Copernican revolution, for example, occurred because of a paradigm shift within a critical mass of astronomers. Copernicus and those who identified with him and his theory of a heliocentric planetary system began to see reality in ways which contradicted the status quo. Sparks flew, charges of heresy were levelled, and the majority of astronomers who just couldn't "see it" dug in their heels, obstinately, refusing to accept this "crazy" theory.
Similarly, when a person becomes accustomed to looking at something in a certain way, but another person provides him or her with a sufficient amount of new information, they just might have an "Aha!" moment (i.e., an epiphany--David W; an apperception--ermanem; a *metacognition--*RyeBread; or a paradigm shift--rhetorician).
A popular and simple way of demonstrating a paradigm shift is to give to a group of people a little card or slip of paper on which there is a fairly simple drawing in black and white. The person handing them out asks the people, "Now, what do you see?" Unbeknownst to the audience, there are actually two distinct images on the paper, but the person who passed out the drawings does not tell them that. Consequently, some people see one image at first glance, whereas other people see a different image at first glance.
When told there are actually two images on the paper, some people begin to "see" them. Whereas before they thought there was only one image (after all, when someone asks us what we see in a drawing, we've been conditioned to see just one thing, and to see it as a "whole," generally speaking), having now been told there are two distinct images, they slowly--sometimes quickly--begin to see both images. Their minds haven't gotten used to seeing both images at the same time, so they see one image and then the other image, back and forth, until they see both images at the same time.
At this point I will not get into the philosophical aspect of how and why we see what we see; how and why people see different things when looking at one, single thing; or if we really can see two things in the same drawing at precisely the same time, when in fact we (our brain) take a nanosecond to see first one thing and then the other.
The point is, the epiphany or "Aha!" moment indicates you've had a paradigm shift. You used to see something in one way; now you see it in two ways, or simply in a different way.
There are likely many analogies out there which describe what is happening in a paradigm shift. For example, a paradigm shift resembles

*

*the point at which the puzzle pieces come together in your mind so that you have a clear picture. Whereas before, they were simply little snatches of meaning, such as a dog's head, a half a tulip, two rungs of a ladder, a piece of a window shutter, or an apple in a tree, but now that the pieces comprise a complete picture of a quaint cottage with two cats and a dog in the yard, an apple tree off to the left, a flower garden to the right, and a guy up on a ladder cleaning out the gutters, we now see what at first was, well, just pieces of a puzzle.

*a new schema comes into existence in your mind, whether in a flash of insight, whether by hearing an apt metaphor which opens up new vistas of thought, or whether a bunch of disparate facts coalesce into something larger which is new and exhilarating to you. The "whole" becomes in some way greater than the sum of its "parts."

*when a person points out a new way of looking at something, and we are receptive to seeing or perceiving something we heretofore saw only in one comfortable, habitual way, but now we see it in a perhaps an initially uncomfortable, non-habitual, out-of-our comfort zone way.

By the way, in the two-images-in-one-drawing exercise, one drawing I've used to test various groups of people contains the image of both an old crone whose head is covered by a shawl, and a young lady whose head sports a stylish hat! Some people need several minutes before they can see both women, and some people take even longer! I have a mini-theory about that; namely, some people are so quick to say to themselves, "I just can't see it. I'll never see it." Sure enough, true to their word, they fail to see it, that is until they convince themselves and/or other folks convince them that they CAN see it, and WILL see it. Receptivity, an open and uncluttered mind, and a deliberate effort to put bias and prejudice aside go a long way toward achieving or experiencing a paradigm shift.

A: I would go with discriminate under one of its meanings
From google's definition:

*

*recognize a distinction; differentiate.
  ... perceive or constitute the difference in or between.

*make an unjust or prejudicial distinction in the treatment of different categories of people or things, esp. on the grounds of race, sex, or age.

I also think apperception is a good one.

A: "Comprehension" may be close to what you're looking for.

A: Interesting question. I would say there are multiple stages in this realisation, which are captured well by the conscious competency learning model:

If your example, when the navy man becomes aware of the existence of emotions he moves from 1 to 2. When we becomes able to identify the emotions he moves from 2 to 3. And when that becomes second nature, he moves from 3 to 4.
I think you are referring to him going from 1 to 2, so I think words like "realisation" are most appropriate. If you were talking about 2 to 3, words like "learning" would fit better.

A: The first word that sprang to mind was Categorisation.
The process of recognising that a thing is a thing, with improved discrimination would be re-categorisation.
Hope I'm not being too simplistic here.

A: How about the word »discovery«?

A: Acknowledgment

Acceptance of the truth or existence of something


text:
Q: If $f \in L^{\infty}(\Bbb R^d) \cap C_u(\Omega)$, then $\rho_{\epsilon} * f \to f$ uniformly over $\Omega$ Consider the following statement:

If $(\rho_{\epsilon})_{\epsilon > 0}$ is an approximation identity and $f \in L^{\infty}(\Bbb R^d) \cap C_u(\Omega)$, then $\rho_{\epsilon} * f \to f$ uniformly over $\Omega$. Where $\Omega$ is possibly any $\neq \varnothing$ subset of $\Bbb R^d$.

I know that if $f \in L^{\infty}(\Bbb R^d) \cap C(\Bbb R^d)$, then $\rho_{\epsilon} * f \to f$ over any compact in $\Bbb R^d$. The proof uses the fact that if $K$ is a compact, then $f$ is uniformly continuous on $K + \overline{B(0,1)}$, etc. Obviously, one can't proceed in the same way to prove the above statement.
Frankly, I am not sure whether or not the statement is true, but it is written in my notebook, so there is a good chance that the professor said it.
Is the statement true? If so, any clues on how to prove it?


text:
Q: Nginx - multiple WordPress sites in different subdirectories - /wp-admin redirect loop I am attempting to host three separate WordPress sites in three different directories with Nginx. After hours of research, I am completely unable to find a configuration that allows me to access both /wp-admin and various pages on the site.
Here is what I have at the moment:
server {
        listen 80;
        listen [::]:80 ipv6only=on;

        root /var/www;
        server_name my.ip.add.ress;

        location /wp1 {
            root /var/www/wp1;
            index index.php index.html index.htm;
            try_files $uri $uri/ /wp1/index.php?q=$args;
        }

        location /wp2 {
            root /var/www/wp2;
            index index.php index.html index.htm;
            try_files $uri $uri/ /wp2/index.php?q=$args;
        }

        location /wp3 {
            root /var/www/wp3;
            index index.php index.html index.htm;
            try_files $uri $uri/ /wp3/index.php?q=$args;
        }

        if (!-e $request_filename) {
            rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
            rewrite ^/[_0-9a-zA-Z-]+.*(/wp-admin/.*\.php)$ $1 last;
            rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
              root /usr/share/nginx/html;
        }

        location ~ \.php$ {

                try_files           $uri =404;

                fastcgi_split_path_info ^(.+\.php)(/.+)$;

                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;

                fastcgi_cache moodle;
                fastcgi_cache_valid 200 60m;

                fastcgi_read_timeout 3600;
        }

        # Cache static content
        location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
                expires 365d;
        }
}

When I try to access /wp-admin, my browser is stuck in a redirect loop. Using rewrite_log yields no output.

A: In you question you have this:
root /var/www;
...
location /wp1 {
    root /var/www/wp1;
    ...
}

The pathname for /wp1/foo is resolved as /var/www/wp1/wp1/foo. Notice that you have added a second /wp1/ term into the pathname.
Inside location /wp1 the root does not change. You do not need to specify root inside each of the locations, because it remains root /var/www; which will be inherited from the outer block anyway.
Delete the lines:
root /var/www/wp1;
root /var/www/wp2;
root /var/www/wp3;

See this document for more.