text:
Q: Dependency injection on multi-Maven project with Spring and JavaFX Hi I'm working on a project with the following structure:
Healthcontrol (Maven parent project), with following children Maven modules:
-dbc (Spring JPA database)
-gui (JavaFX project, implemented as shown https://drogago.net/javafxmavenspring-step-by-step/)
-central (Module, supposed to be used for communication between modules), consisting of configs and services
Project structcure image
The problem is, that we cannot inject anything from central module into GUI, error: No qualifying bean of type 'hc.module.gui.spring.configuration.Config' available. (injecting from dbc into central module is possible).
To make autowiring for dbc-central possible we use @Configuration 's :

*

*'config dbc'

*'config central'
and we tried to do the same for gui:

*

*'config gui'

but it doesn't see any bean of used object.
Another problem is that pom.xml of gui don't see:
<dependency>
    <groupId>hc</groupId>
    <artifactId>central</artifactId>
    <version>1.0-SNAPSHOT</version>
    <scope>compile</scope>
</dependency>

All pom's looks like:
' parent pom '
' dbc pom '
' central pom '
' gui pom '
How can we make it work?
Pom healthcontrol (parent)
<?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>

        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.6.2</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>

        <modules>
            <module>central</module>
            <module>gui</module>
            <module>dbc</module>
        </modules>
        <packaging>pom</packaging>

        <groupId>hc</groupId>
        <artifactId>health_control</artifactId>
        <version>1.0-SNAPSHOT</version>
        <name>hc</name>

        <properties>
            <maven.compiler.source>15</maven.compiler.source>
            <maven.compiler.target>15</maven.compiler.target>
            <java.version>11</java.version>
        </properties>

        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-jpa</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-validation</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
                <scope>runtime</scope>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>

        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <excludes>
                            <exclude>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok</artifactId>
                            </exclude>
                        </excludes>
                        <classifier>exec</classifier>
                        <mainClass>hc.module.gui.viewsControllers.LoginController</mainClass>
                    </configuration>
                </plugin>
            </plugins>
        </build>

    </project>

Pom GUI
 <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <parent>
            <artifactId>health_control</artifactId>
            <groupId>hc</groupId>
            <version>1.0-SNAPSHOT</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>

        <artifactId>gui</artifactId>

        <properties>
            <maven.compiler.source>15</maven.compiler.source>
            <maven.compiler.target>15</maven.compiler.target>
        </properties>

        <packaging>jar</packaging>

        <dependencies>
            <dependency>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-controls</artifactId>
                <version>17.0.0.1</version>
            </dependency>
            <dependency>
                <groupId>de.jensd</groupId>
                <artifactId>fontawesomefx-fontawesome</artifactId>
                <version>4.7.0-9.1.2</version>
            </dependency>

            <dependency>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-fxml</artifactId>
                <version>17.0.0.1</version>
            </dependency>
            <dependency>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-web</artifactId>
                <version>17.0.0.1</version>
            </dependency>
            <dependency>
                <groupId>org.controlsfx</groupId>
                <artifactId>controlsfx</artifactId>
                <version>11.1.0</version>
            </dependency>
            <dependency>
                <groupId>com.dlsc.formsfx</groupId>
                <artifactId>formsfx-core</artifactId>
                <version>11.3.2</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.openjfx</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>hc</groupId>
                <artifactId>central</artifactId>
                <version>1.0-SNAPSHOT</version>
                <scope>compile</scope>
            </dependency>
        </dependencies>

        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>1.6.0</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>java</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <mainClass>hc.module.gui.viewsControllers.LoginController</mainClass>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.0.0</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                            <configuration>
                                <transformers>
                                    <transformer
                                            implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                        <mainClass>hc.module.gui.viewsControllers.LoginController</mainClass>
                                    </transformer>
                                </transformers>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>

    </project>

Pom central
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>health_control</artifactId>
        <groupId>hc</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>central</artifactId>

    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>hc</groupId>
            <artifactId>dbc</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>

    <properties>
        <maven.compiler.source>15</maven.compiler.source>
        <maven.compiler.target>15</maven.compiler.target>
    </properties>

</project>

Central config
package hc.module.central.configuration;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Configuration
@Import(hc.module.dbc.configuration.Config.class)
@ComponentScan(basePackages = "hc.module.central.services.dbc")
public class Config {
}

Gui config
package hc.module.dbc.configuration;

import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

@Configuration
@EnableJpaRepositories(basePackages = "hc.module.dbc.repo")
@EntityScan(basePackages = "hc.module.dbc.models")
@ComponentScan(basePackages = "hc.module.dbc.service")
public class Config {
}

Example of injection into gui
package hc.module.gui.viewsControllers;

import hc.module.gui.configuration.Config;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.controlsfx.control.Notifications;

import java.io.IOException;

@SpringBootApplication
public class LoginController extends Application {
    private ConfigurableApplicationContext springContext;
    private Parent rootNode;

    @Autowired
    Config config;

    public static void main(String[] args) {
        Application.launch(args);
    }

    @Override
    public void start(Stage stage) throws Exception {
        stage.setScene(new Scene(rootNode, 500, 400)); //#todo
        stage.setTitle("Health Control Login");
        stage.show();
        config.run();

    }

    public void init() throws Exception {
        springContext = SpringApplication.run(LoginController.class);
        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/views/login-view.fxml"));
        fxmlLoader.setControllerFactory(springContext::getBean);
        rootNode = fxmlLoader.load();
    }

    public void stop() throws Exception {
        springContext.close();
    }
}


text:
Q: WCF service is not exposing binding information I have just a very basic WCF service implemented and I want the clients to have some properties in their config automatically generated, like maxReceivedMessageSize, maxBufferSize, etc (the default maxReceivedMessageSize is not enough for me). I have the below config  in service application's web.config file. I have the properly configured binding (BasicHttpBinding_IService1_YY), that binding is referenced in both service endpoint and client endpoint (I am not sure there is need for client endpoint as well). I also have mexHttpBinding typed endpoint under service. The service points to a behaviour where httpGetEnabled is true.
After all, when I generate the client from this the binding parameters won't be there, it will use the default values. Naturally the wsdl doesn't contain those parameters.
So my question would be is this something that is out of WCF's scope? Do I have to manually maintenance the client config from this perspective if something change? Is there any solution for this issue, because I went through many stackoverflow and other topics and found nothing or I was careless.
    <system.serviceModel>
        <behaviors>
          <serviceBehaviors>
            <behavior name="myServiceBehavior">
              <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
              <serviceMetadata httpGetEnabled="true" policyVersion="Policy15" httpGetBindingConfiguration="BasicHttpBinding_IService1_YY" />
              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <services>
          <service name="WcfServiceApplication.Service1" behaviorConfiguration="myServiceBehavior">
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:51483/"/>
              </baseAddresses>
            </host>
            <endpoint address="" binding="basicHttpBinding" contract="WcfServiceApplication.IService1"
                      bindingConfiguration="BasicHttpBinding_IService1_YY" name="BasicHttpBinding_IService1_YY" >
            </endpoint>

            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" >
            </endpoint>
          </service>
        </services>
        <bindings>
          <basicHttpBinding>
            <binding name="BasicHttpBinding_IService1_YY"
                     maxReceivedMessageSize="20000099" maxBufferSize="20000099" maxBufferPoolSize="20000099"/>
          </basicHttpBinding>
        </bindings>

        <client>
          <endpoint address="" binding="basicHttpBinding"
              bindingConfiguration="BasicHttpBinding_IService1_YY" contract="WcfServiceApplication.IService1"
              name="BasicHttpBinding_IService1_YY" />
          <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        </client>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>

      </system.serviceModel>

And the generated client config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_IService1_YY" sendTimeout="00:05:00" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:51483/Service1.svc" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_IService1_YY" contract="IService1"
                name="BasicHttpBinding_IService1_YY" />
        </client>
    </system.serviceModel>
</configuration>

Ok, the name of the binding really appears correctly, but nothing more. When I manually adjust it, then everything works ok, but I think there should be a more suitable solution.
Can you please help me out at this one? Thanks in advance.

A: The answer is probably: Yes.
The feature of WCF is that the client and server can evolve separately. The server settings are not automatically updated to the client, you need to manually set the parameters you need on the client.
You may try using the "update service reference" feature to update instead of creating a new service reference.

redpajama_set_name: RedPajamaStackExchange


text:
Q: TransactionScope related practice Can I do any other things (not related to DataBase) in the TransactionScope ?
Will it be a bad practice ?
e.g
Starting a workflow inside the scope.
I don't want to save in DB unless starting the workflow fails.
If it's a bad practice, what would be a good practice?
Thanks in advance.
using (TransactionScope scope = new TransactionScope())
{
    using (ComponentCM.Audit auditComponent = new ComponentCM.Audit())
    {
        using (AccessCM.Biz dataAccess = new AccessCM.Biz())
        {
            auditComponent.SaveInDB();
            dataAccess.SaveinDB()

            StartWorkflow();
        }
    }
    scope.Complete();
}

A: You want transactions to take as little time as possible, as they can cause locking on the database.
In this regard, it is better to do other work outside of the transaction scope.

A: I agree with Oded.
I'd also add that the scope of the TransactionScope should define the state changes that are defined in your unit of work.  In other words, state changes inside the scope should all succeed or fail together and are usually part of the same logical operation.
In order to keep the scope of the as small as possible, one common pattern is optimistic concurrency.  When using optimistic concurrency, you typically only open a transaction scope when performing a write operation on the state store.  In this case, you are excepting that usually the data you are working on will not have changed (by another operation) between the time that you query and commit.


text:
Q: Fillfactor for a sequential index that is PK Yes, fillfactor again. I spend many hours reading and I can't decide what's best for each case. I don't understand when and how fragmentation happens. I'm migrating a database from MS SQL Server to PostgreSQL 9.2.
Case 1
10-50 inserts / minute in a sequential (serial) PK, 20-50 reads / hour.
CREATE TABLE dev_transactions (
  transaction_id serial NOT NULL,
  transaction_type smallint NOT NULL,
  moment timestamp without time zone NOT NULL,
  gateway integer NOT NULL,
  device integer NOT NULL,
  controler smallint NOT NULL,
  token integer,
  et_mode character(1),
  status smallint NOT NULL,
  CONSTRAINT pk_dev_transactions PRIMARY KEY (transaction_id)
);

Case 2
Similar structure, index for serial PK, writes in blocks (one shot) of ~ 50.000 registers every 2 months, readings 10-50 / minute.
Does a 50% fillfactor mean that each insert generates a new page and moves 50% of existing rows to a newly generated page?
Does a 50% fillfactor mean frees space is allocated between physical rows in new data pages?
A new page is generated only if there is no free space left in existing pages?
As you can see I'm very confused; I would appreciate some help — maybe a good link to read about PostgreSQL and index fillfactor.

A: FILLFACTOR
With only INSERT and SELECT you should use a FILLFACTOR of 100 for tables (which is the default anyway). There is no point in leaving wiggle room per data page if you are not going to "wiggle" with UPDATEs.
The mechanism behind FILLFACTOR is simple. INSERTs only fill data pages (usually 8 kB blocks) up to the percentage declared by the FILLFACTOR setting. Also, whenever you run VACUUM FULL or CLUSTER on the table, the same wiggle room per block is re-established. Ideally, this allows UPDATE to store new row versions in the same data page, which can provide a substantial performance boost when dealing with lots of UPDATEs. Also beneficial in combination with H.O.T. updates. See:

*

*Redundant data in update statements
Indexes need more wiggle room by design. They have to store new entries at the right position in leaf pages. Once a page is full, a relatively costly "page split" is needed. So indexes tend to bloat more than tables. The default FILLFACTOR for a (default) B-Tree index is 90 (varies per index type). And wiggle room makes sense for just INSERTs, too. The best strategy heavily depends on write patterns.
Example: If new inserts have steadily growing values (typical case for a serial or timestamp column), then there are basically no page-splits, and you might go with FILLFACTOR = 100 (or a bit lower to allows for some noise).
For a random distribution of new values, you might go below the default 90 ...
Basic source of information: the manual for CREATE TABLE and CREATE INDEX.
Other optimization
But you can do something else - since you seem to be a sucker for optimization ... :)
CREATE TABLE dev_transactions(
  transaction_id   serial PRIMARY KEY
, gateway          integer NOT NULL
, moment           timestamp NOT NULL
, device           integer NOT NULL
, transaction_type smallint NOT NULL
, status           smallint NOT NULL
, controller       smallint NOT NULL
, token            integer
, et_mode          character(1)
);

This optimizes your table with regard to data alignment and avoids padding for a typical 64 bit server and saves a few bytes, probably just 8 byte on average - you typically can't squeeze out much with "column tetris":

*

*Calculating and saving space in PostgreSQL
Keep NOT NULL columns at the start of the table for a very small performance bonus.
Your table has 9 columns. The initial ("cost-free") 1-byte NULL bitmap covers 8 columns. The 9th column triggers an additional 8 bytes for the extended NULL bitmap - if there are any NULL values in the row.
If you make et_mode and token NOT NULL, all columns are NOT NULL and there is no NULL bitmap, freeing up 8 bytes per row.
This even works per row if some columns can be NULL. If all fields of the same row have values, there is no NULL bitmap for the row. In your special case, this leads to the paradox that filling in values for et_mode and token can make your storage size smaller or at least stay the same:

*

*Do nullable columns occupy additional space in PostgreSQL?
Basic source of information: the manual on Database Physical Storage.
Compare the size of rows (filled with values) with your original table to get definitive proof:
SELECT pg_column_size(t) FROM dev_transactions t;

(Plus maybe padding between rows, as the next row starts at a multiple of 8 bytes.)


text:
Q: How to: Add TextOverflow.ellipsis to Text without specifying maxLines? (Flutter) I basically want to show a TextOverflow.ellipsis when my Text wraps and overflows at the bottom of a Column.
If I don't specify maxLines, then the ellipsis begins when the Text reaches the edge of the Column (the max width).
If I do specify maxLines then the ellipsis is visible but only if text fits in the space .. this could be a problem on smaller screens and also will begin the ellipsis before the bottom of the Column on larger screens.
Is this even possible? Seems like it should be :/


text:
Q: Disabling the submit button until the form data matches all the validations? As working on form validation using JQuery i have applied all validations on the text fields but unable to fix the submit button condition.
Submit button condition: By default submit button is 'disabled'. When all text fields matches all the validations it should be enabled which is not happening.
All my 7 text fields are set to 'false' when they don't match the validation then they will become 'true'.
$("#reg_form").submit(function(){

            error_firstName = false;
            error_lastName = false;
            error_emailAdd = false;
            error_pass = false;
            error_confirmPass = false;
            error_mobile = false;
            error_confirmMob = false;

            check_FirstName();
            check_LastName();
            check_email();
            check_password();
            check_confirm_password();
            check_Mobile();
            check_cMobile();

            validate();

            $("#form_firstName,#form_lasttName,#form_email,#form_pass,#form_cPass,#form_mob,#form_cMob").change(validate);

            function validate(){

                if(error_firstName === false && error_lastName === false && error_emailAdd === false && error_pass === false && error_confirmPass === false && error_mobile === false && error_confirmMob === false){
                    $("input[type=submit]").prop("disabled",false);
                    return true;
                }
                else{
                    $("input[type=submit]").prop('disabled',true);
                    return false;
                }
            }

    });

So please correct me with this and save a life,thank you in advance.

A: it easy and better to use jquery-validation then custom validation.
example:
Html
<form id="form-signin_v1" name="form-signin_v1" method="POST">
    <label>
        Username
        <input name="signin_v1[username]" type="text" data-validation="[NOTEMPTY]">
    </label>
    <label>
        Password
        <input name="signin_v1[password]" type="password" data-validation="[NOTEMPTY]">
    </label>
    <input type="submit" class="ui blue submit button" value="Login">
</form>

javascript
$('#form-signin_v1').validate();

official website : https://jqueryvalidation.org/ try it.

A: This would probably be the easiest way without having to use any extra libraries. I've not tested the code but shouldn't be hard to tweak.
$('#reg_form').on('change', 'input', function(){

    // Do your validation on this item
    // On validation add .valid or .invalid classes to the inputs

    // Find all inputs that aren't valid (class .valid) and aren't submit buttons
    var incorrect = $('#reg_form').find('input:not(.valid):not(type="submit")').length;

    // Add/Disable disabled property based on number of incorrect inputs
    $("input[type=submit]").prop("disabled", incorrect > 0);

});


text:
Q: ngx-datatable column header tooltip gets cut off <ngx-datatable-column [width]="24"
                                  [sortable]="true"
                                  [canAutoResize]="false"
                                  [draggable]="false"
                                  [resizeable]="false"
                                  [headerCheckboxable]="true"
                                  [checkboxable]="true">
            </ngx-datatable-column>
            <ngx-datatable-column name='Name' prop='formattedStudentName' [width]="400" [cellClass]="'se-list-item'">
                <ng-template let-column="column" ngx-datatable-header-template>
                    <ng-container>

                            {{column.name}}

                    </ng-container>
                </ng-template>
                <ng-template let-value="value" let-row="row" ngx-datatable-cell-template>

                        {{value}}

                </ng-template>
                </ngx-datatable-column>

This is part of my code. I needed to use a ngbTooltip, which works, for the column header, but when I hover the bubble gets cut off by the datatable. How can I prevent it from getting cutoff?

A: <ngx-datatable-column name='Name' prop='formattedStudentName' [width]="400" [cellClass]="'se-list-item'">
            <ng-template let-column="column" ngx-datatable-header-template>
                <ng-container>

                        {{column.name}}

                </ng-container>
            </ng-template>
            <ng-template let-value="value" let-row="row" ngx-datatable-cell-template>

                    {{value}}

            </ng-template>
            </ngx-datatable-column>

By adding container="body" to the div with the tooltip it allowed the tooltip window to pop over the borders of the ngx-datatable.
Side note: in my research I found that for ngbTooltip you can add tooltipClass="className" to customize the tooltip window.


text:
Q: Using a prebuilt native binary in android app this question has been raised in different places but none seem to give a simple detailed explanation of what is required.
So far I have built a native binary ffmpeg to be used in android,  the build is ok.
I have put the binary in my project /lib/armeabi-v7a/ directory and renamed it to libffmpeg.so so it can be picked up by the packaging system, as advised in other posts.
Now the issue is that the libffmpeg.so or ffmpeg requires some other libraries which are normally in its( ffmpeg) own lib directory. when I run it with Runtime.getRuntime().exec(command) , it calls out for those other libraries which are either not in the right place or have not been picked up at all by android packaging system.
so I copied all the libraries that ffmpeg requires into the same /lib/armeabi-v7a/ but still no success.
Searching in Stackoverflow, i find posts of using jni aproach and others say they can do it without jni. what is the simplest way to use a pre-built binary that requires other libaries in android?
Then there is also the question of Android.mk and Application.mk files, when are they needed, is it only when one is trying to build native C/C++ code in android or should it also be used when pre-built libraries and binaries are involved. And also if I need them for this case where should these files be put in the project?
I'm very new to android please be clear and consice, thanks for sharing some of your wisdom.

A: I can give you some links:
How to use external C/C++ library file while working with JNI
include .h file into java file in android using jni as source folder of .h file?
multiple (my and 3rd-party) native libraries in Android NDK
Android NDK - make two native shared libraries calling each other
First of all, how do you want to call the native code?
You have 2 options:
1) Call library functions via a wrapper: a class that defined a set of native functions. You will have to convert data structures between the Java representation and the C representation. A Java object maps to a very specific kind of C data structure, and C structures cannot be normally accessed from Java. So for each invoked C/C++ function there is a wrapper that implements a Java native function.
2) You can invoke a shell command. Android is Linux, and you can communicate to it via adb shell. You can pass command-line arguments, write/read to/from stdin/stdout of the started process. You also can pass data to/from the started process via the file system. For example, this is how to use su on a rooted device:
execute shell command from android


text:
Q: access files outside public_html folder I want to make some folder out of root directory (public_html).
I have shared server linux with follow directory.

*

*/home/mysite

*

*access-log

*etc

*mail

*public_ftp

*public_html

*tmp

*www
and my site directory in my computer(wamp):

*

*app

*

*model

*controller

*view

*config

*public

*

*images

*css

*js

*index.php

*htaccess
I want public folder to be placed into public_html folder in server.
1)how can I include my code using relative paths?
and I have htaccess file that points all requests to that public/index.php in my computer.
2)Where should I put my htaccess in my Shared server linux?
my htaccess file:
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

A: *

*You need place all public file in public_html.

*Move .htaccess to public html (that example not redirect to public/html only redirect to index.php and is fine)

*if have absoulute path example "../public" change to "../public_html", if is relative path is fine

*Move all other not public code in root folder.

You aplication must be running in this time.

A: Put everything in

/home/mysite

and configure your virtual host to use

/home/mysite/public/

as DocumentRoot.
Put the .htaccess in

/home/mysite/public/

A: You can't traverse out of the document root using relative paths or rewriting in the htaccess file. You can include files from your php script (index.php). So what you can do is allow a request for something outside of public_html to be routed to index.php, then in php, load the file outside of public_html.


text:
Q: How to get textbox value via button click Ajax I have 2 input's:
<input id='someName_1' type='textbox' value='1' />
<input id='someID_1' class="button1" type='button' value='Submit' />

I have below ajax code:
$("body").on('click', '.button1', function () {
    var params = { id: this.id, value: (?) };
    $.ajax({
        type: 'POST',
        url: '@Url.Action(SomeUrl- pointless)',
        dataType: 'json',
        cache: false,
        contentType: 'application/json; charset=utf8',
        data: JSON.stringify(params),
        success: function (data, status) {
            doingsomething
        },
        error: function (er, info) {

        },
        complete: function (xhr, status) {

        },
    });
});

Question is: how i can get value in variable 'params', field 'value' from textbox with someID_1, if all my id's are created dynamically via response from server? Input's are too created dinamically.
There is code which generated my input's:
var s = [];
$.each(data.items, function (i, item) {
                var t = "<input id='someName_" + item.id + "' type='textbox' value='1' />	" +
                "<input id='someID_" + item.id + "' class='button1' type='button' value='Submit' />
";
                s.push(t);
            });
$('body').html(s.join(""));

A: Since your DOM is a bit problematic you will have to traverse to the previous td element and take the input from there.
Here is an example:
$("body").on('click', '.button1', function () {
    input = $(this).parent('td').prev('td').children('input[type=textbox]')
    var params = { id: $(this).attr('id'), value: input.val() };
    $.ajax({
        type: 'POST',
        url: '@Url.Action(SomeUrl- pointless)',
        dataType: 'json',
        cache: false,
        contentType: 'application/json; charset=utf8',
        data: JSON.stringify(params),
        success: function (data, status) {
            doingsomething
        },
        error: function (er, info) {

        },
        complete: function (xhr, status) {

        },
    });
});

A: I am not sure that I see an issue here, but maybe I misunderstood the question?
Basically, you can pick up any DOM element that has any ID, by using jquery with:
$("#MY_RANDOM_ID")

so you can access its value (user input or automatically generated input) with:
$("#MY_RANDOM_ID").val()


text:
Q: Python script importing results to ctrl-c memory I would like to know is it possible that python script would import results into clipboard (ctrl-C memory) on windows. This would enable me to manipulate-transfer results more easily.
Is it possible to do? How?

A: It's called the "clipboard"
Copied from this link:
import ctypes
def winSetClipboard(text):
    GMEM_DDESHARE = 0x2000
    ctypes.windll.user32.OpenClipboard(0)
    ctypes.windll.user32.EmptyClipboard()
    try:
        # works on Python 2 (bytes() only takes one argument)
        hCd = ctypes.windll.kernel32.GlobalAlloc(GMEM_DDESHARE, len(bytes(text))+1)
    except TypeError:
        # works on Python 3 (bytes() requires an encoding)
        hCd = ctypes.windll.kernel32.GlobalAlloc(GMEM_DDESHARE, len(bytes(text, 'ascii'))+1)
    pchData = ctypes.windll.kernel32.GlobalLock(hCd)
    try:
        # works on Python 2 (bytes() only takes one argument)
        ctypes.cdll.msvcrt.strcpy(ctypes.c_char_p(pchData), bytes(text))
    except TypeError:
        # works on Python 3 (bytes() requires an encoding)
        ctypes.cdll.msvcrt.strcpy(ctypes.c_char_p(pchData), bytes(text, 'ascii'))
    ctypes.windll.kernel32.GlobalUnlock(hCd)
    ctypes.windll.user32.SetClipboardData(1,hCd)
    ctypes.windll.user32.CloseClipboard()


text:
Q: sort list of int[] in java I would like to sort a list of int arrays in java, specifically like so:
1, 2
1, 3
2, 3
1, 4
2, 4
3, 1

Should be sorted into:
1, 2
1, 3
1, 4
2, 3
2, 4
3, 1

I read some other posts, and have been trying to use something like this that was answered for sorting String[]:
Collections.sort(listOfStringArrays,new Comparator<String[]>() {
        public int compare(String[] strings, String[] otherStrings) {
            return strings[1].compareTo(otherStrings[1]);
        }
    });

by changing it into:
Collections.sort(listOfIntArrays,new Comparator<int[]>() {
        public int compare(int[] ints, int[] otherInts) {
            return ints[0].compareTo(otherInts[0]);
        }
    });

But this didn't work, the error was for the return line Cannot invoke compareTo(int) on the primitive type int
Can someone help me.

A: It is normal that you get this error since the .compareTo(Integer) method can only be called from an Integer object. But in your case, you have primitive int elements.
To make your comparison work, you can call the Integer.compare(int, int) method instead like this:
Instead of
return ints[0].compareTo(otherInts[0]);

Use
return Integer.compare(ints[0], otherInts[0]);

You can take a look at Integer#compare method description
Sorting depending on both values
If you want to sort both on first and second value, you can simply transform the two values into one by creating a two digit number (assuming that each value is a digit in the range 0-9).
I suggest you to do like this
return Integer.compare(ints[0] * 10 + ints[1], otherInts[0] * 10 + otherInts[1]);

A: As @tfosra said, you should use Integer.compare(int, int) instead. However, I suggest using a different method for prioritizing the first array over the second array when sorting. If the first array contains equal values, compare the values in the second array. This won't constrict the range to 0-9, and is probably more readable.
return ints[0] != otherInts[0]
           ? Integer.compare(ints[0], otherInts[0])
           : Integer.compare(ints[1], otherInts[1]);


text:
Q: Setup of Whiteoctober-Swiftmailer-Bundle I'd like to user the whiteoctober bundle for spooling my emails via my database. I followed the installation so far but am now stuck at the setup for the email entity itself (I know..)
So they provide this EmailInterface (https://github.com/whiteoctober/WhiteOctoberSwiftMailerDBBundle/blob/master/EmailInterface.php) which should be implemented in my own email entity. The documentation says:

You will need to create an entity that can be persisted and that extends from the EmailInterface interface in the bundle. At the
  moment, the bundle expects a property to be available on your entity
  called 'status', since this field is queried.
Once you have your entity all set up, use the full namespaced path in
  your config.yml configuration as detailed above.

I have the following needs:

*

*an email is sent to multiple users due to different actions happening
in the application. The email however should be sent seperately
so that there is only one user in the "To" field

*a user should be able to receive emails (probably one or two email each day) --> it might happen, though, that the user gets assigned to several emails but he still should be added to the database only once!
other than that, the bundle provides message, status and environment as properties and I'm - to be honest- not 100% sure how to implement them..
So here is what I did so far:
   <?php

namespace NewsBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use WhiteOctober\SwiftMailerDBBundle\EmailInterface;

/**
 * @ORM\Entity
 * @ORM\Table(name="news_email")
 */
class Email implements EmailInterface
{

    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\OneToMany(targetEntity="UserBundle\Entity\User", mappedBy="spooledEmail", cascade={"persist"})
     *
     */
    protected $whereTo;
    /**
    * @ORM\Column(type="string", name="subject")
    */
    protected $subject;
    /**
    * @ORM\Column(type="text", name="message")
    */
    protected $message;
    /**
    * @ORM\Column(type="string", name="status")
    */
    protected $status;
    /**
    * @ORM\Column(type="string", name="environment")
    */
    protected $environment;

    /**
     * @return string
     */
    public function getMessage()
    {
        return $this->message;
    }

    /**
     * @param $message string Serialized \Swift_Mime_Message
     */
    public function setMessage($message)
    {
        $this->message = $message;

        return $this;
    }

    /**
     * @return string
     */
    public function getStatus()
    {
        return $this->status;
    }

    /**
     * @param $status string
     */
    public function setStatus($status)
    {
        $this->status = $status;

        return $this;
    }

    /**
     * @return string
     */
    public function getEnvironment()
    {
        return $this->environment;
    }

    /**
     * @param $environment string
     */
    public function setEnvironment($environment)
    {
        $this->environment = $environment;

        return $this;
    }

}

So I set this up and updated the database. But how am I actually using the bundle now? how do I send emails etc.? I feel like the documentation doesn't really provide sufficient infos for non-pros.

A: The command your are probably looking for is
doctrine:generate:entities NewsBundle:Email

to generate the getters & setters (note the entities instead of entity).
Hope it helps

A: From what I understand from the docs, you would need to update your database schema and then configure swiftmail to use it:
# app/config/config.yml

white_october_swift_mailer_db:
    keep_sent_messages: true

Did you make any tests to see if it works ?


text:
Q: Online IDE to run the following scala code I want to test the following scala code. I want to use an online editor. I tried scalafiddle and jdoodle but both can't identify the work package. Is there an online IDE where I can run the following code?
package P {
  object X { val x = 1; val y = 2 }
}

package Q {
  object X { val x = true; val y = "" }
}

package P {                  // `X' bound by package clause
import Console._             // `println' bound by wildcard import
object A {
  println("L4: "+X)          // `X' refers to `P.X' here
  object B {
    import Q._               // `X' bound by wildcard import
    println("L7: "+X)        // `X' refers to `Q.X' here
    import X._               // `x' and `y' bound by wildcard import
    println("L8: "+x)        // `x' refers to `Q.X.x' here
    object C {
      val x = 3              // `x' bound by local definition
      println("L12: "+x)     // `x' refers to constant `3' here
      { import Q.X._         // `x' and `y' bound by wildcard import
//      println("L14: "+x)   // reference to `x' is ambiguous here
        import X.y           // `y' bound by explicit import
        println("L16: "+y)   // `y' refers to `Q.X.y' here
        { val x = "abc"      // `x' bound by local definition
          import P.X._       // `x' and `y' bound by wildcard import
//        println("L19: "+y) // reference to `y' is ambiguous here
          println("L20: "+x) // `x' refers to string "abc" here
}}}}}}

A: In Scastie, try turning Worksheet mode OFF and then extend App to provide main method, for example, try pasting the following in Scastie:
package P {
  object X { val s = "hello"}
}
package P {
  object Y { val s = "world"}
}

object Hello extends App {
  println(P.X.s)
  println(P.Y.s)
}

Note that P and Q from your example should be in separate compilations units

Assume the following two definitions of objects named X in packages p
  and q in separate compilation units.
package p {
  object X { val x = 1; val y = 2 }
}

package q {
  object X { val x = true; val y = false }
}

which means they should be in separate .scala files. I am not sure it is possible to have multiple files in Scatstie.


text:
Q: angular fixing scroll position on repainting with ngrepeat list update? I have list of items and I am trying to update the list dynamically on scroll down similarly like infinite scrolling. Initially I was worried about rerendering the all elements, I found one useful option "track by" to avoid rerendering. Now my problem is when add some items to the list its repainting the whole view, with this user losing the scroll position.
How can I fix the scroll position on repainting with ngrepeat?


text:
Q: Why am I getting tuples instead of ints when creating an instance of a class? I'm working on a little project where I'd like to collect data from MODBUS slaves and put them in a database.
I decided to do it in python, because it has some nice modules for handling both MODBUS and mysql. I am very much new to python and wanted to do some testing first, just to warm up and get some basic understanding of the language.
My idea is to have a class with its attributes being the same as columns in my database table, and then I can load stuff into an instance of this class, manipulate it if I need to, and insert the data into the database.
I have encountered a problem with the types of attributes, however. My class looks like this:
class Sensor:
def __init__(self, id, s_id, type, s_pin, off, loc, desc, desc_l):
    self.id = id,
    self.slave_id = s_id,
    self.type = type,
    self.slave_pin = s_pin,
    self.offset = off,
    self.sensor_location = loc,
    self.desc = desc,
    self.desc_long = desc_l

Now, I create an instance of the class:
Sens = Sensor(4, 1, "temp", 2, 0.0, "Jupiter", "Temp Sens 4_D1_P2", "Temperature Sensor on Jupiter LOL")

The problem is that, even though VS Code tells me 4, and 1, and 2 are ints, and the strings are strings and so on, when I call:
print(type(Sens.id))

I get the answer that it's a
<class 'tuple'>

Even though, clearly, it should be an int. Same for the "offset" which should be a float, or the strings.
HOWEVER, interestingly enough, the last attribute "desc_long" is in fact a string.
I've searched the web, and I'm pretty sure my init() function is correct, and I'm creating the instance properly as well. Can anyone explain to me why it's a tuple, and not an int (or a float)?

A: In this case,
self.id = id,

creates a single element tuple. It might be more obvious if you add parenthesis
self.id = (id,)

Remove the commas to prevent them from being interpreted as tuples.

A: To fix this, remove the commas from your init method's assignments to self as such:
class Sensor:
    def __init__(self, id, s_id, type, s_pin, off, loc, desc, desc_l):
        self.id = id
        self.slave_id = s_id
        self.type = type
        self.slave_pin = s_pin
        self.offset = off
        self.sensor_location = loc
        self.desc = desc
        self.desc_long = desc_l

If you have a declaration like the following, you get a tuple.
var = 3,


text: Q: Frobenius determinant theorem Can anyone please recommend a paper or a book that gives a detailed proof of the Frobenius determinant theorem? I have read some few papers I saw online but their information are not sufficient for my understanding.Thanks.


text:
Q: TRUNCATE table on MariaDB just started hanging I am running 10.1.26-MariaDB-0+deb9u1 Debian 9.1 in multiple locations.
Just got a call today that some scripts are no longer running at one of the locations.  I've diagnosed that whenever a script tries to execute TRUNCATE <table name> it just hangs.
I've tried it from the CLI and Workbench as well with the same results.  I have also tried TRUNCATE TABLE <table name> with the same results.
I cannot figure out A) why this all of a sudden stopped working.  and B) what's different between this location and other three, where it does work.

A: I expect you see something like this:
mysql> show processlist;
+----+-----------------+-----------+------+---------+------+---------------------------------+------------------------+
| Id | User            | Host      | db   | Command | Time | State                           | Info                   |
+----+-----------------+-----------+------+---------+------+---------------------------------+------------------------+
|  8 | msandbox        | localhost | test | Query   |  435 | Waiting for table metadata lock | truncate table mytable |

Try this experiment in a test instance of MySQL (like on your local development environment): open two shell windows and run the mysql client. Create a test table.
mysql> create table test.mytable ( answer int );
mysql> insert into test.mytable set answer = 42;

Now start a transaction and query the table, but do not commit the transaction yet.
mysql> begin;

mysql> select * from test.mytable;
+--------+
| answer |
+--------+
|     42 |
+--------+

In the second window, try to truncate that table.
mysql> truncate table mytable;
<hangs>

What it's waiting for is a metadata lock. It will wait for a number of seconds equal to the lock_wait_timeout configuration option.
Now go back to the first window, and commit.
mysql> commit;

Now see in your second window, the TRUNCATE TABLE stops waiting, and it finally does its work, truncating the table.
Any DDL statement like ALTER TABLE, TRUNCATE TABLE, DROP TABLE needs to acquire an exclusive metadata lock on the table. But any transaction that has been reading or writing that table holds a shared metadata lock. This means many concurrent sessions can do their work, like SELECT/UPDATE/INSERT/DELETE without blocking each other (because their locks are shared). But a DDL statement requires an exclusive metadata lock, meaning no other metadata lock, either shared or exclusive, can exist.
So I'd guess there's some transaction hanging around that has done some read or write against your table, without committing. Either the query itself is very long-running, or else the query has finished but the transaction hasn't.
You have to figure out where you have an outstanding transaction. If you are using MySQL 5.7 or later, you can read the sys.schema_lock_waits table while one of your truncate table statements is waiting.
select * from sys.schema_table_lock_waits\G
*************************** 1. row ***************************
               object_schema: test
                 object_name: mytable
           waiting_thread_id: 47
                 waiting_pid: 8
             waiting_account: msandbox@localhost
           waiting_lock_type: EXCLUSIVE
       waiting_lock_duration: TRANSACTION
               waiting_query: truncate table mytable
          waiting_query_secs: 625
 waiting_query_rows_affected: 0
 waiting_query_rows_examined: 0
          blocking_thread_id: 48
                blocking_pid: 9
            blocking_account: msandbox@localhost
          blocking_lock_type: SHARED_READ
      blocking_lock_duration: TRANSACTION
     sql_kill_blocking_query: KILL QUERY 9
sql_kill_blocking_connection: KILL 9

This tells us which session is blocked, waiting for a metadata lock. The waiting_pid (8 in the above example) corresponds to the Id in the processlist of the blocked session.
The blocking_pid (9 in the above example) corresponds to the Id in the processlist of the session that currently holds the lock, and which is blocking the truncate table.
It even tells you exactly how to kill the session that's holding the lock:
mysql> KILL 9;

Once the session is killed, it must release its locks, and the truncate table finally finishes.
mysql> truncate table mytable;
Query OK, 0 rows affected (13 min 34.50 sec)

Unfortunately, you're using MariaDB 10.1. This doesn't support the sys schema or the performance_schema.metadata_locks table that it needs to report those locks. MariaDB is a fork from MySQL 5.5, which is nearly ten years old now, and they didn't have the metadata_locks table at that time.
I don't use MariaDB, but I googled and found that they have their own proprietary implementation for querying metadata locks: https://mariadb.com/kb/en/library/metadata_lock_info/ I haven't used it, so I'll leave it to you to read the docs about that.


text:
Q: Custom MVC Error Message Localization I want to localize my error messages on my model using attributes, such as RequiredAttribute and RangeAttribute.  I'm using ASP.NET MVC2 in Visual Studio 2010.
This is really easy if my localized resources were in resx resource files... using ErrorMessageResourceName and ErrorMessageResourceType... however, I need to integrate it against a custom localization framework.
I have set the resourceProviderFactoryType on the globalization section in web.config, but MVC doesn't use this.  It tries to access a static property on a resource file which returns the localized string.
This is the call stack...
System.ComponentModel.DataAnnotations.ValidationAttribute.SetResourceAccessorByPropertyLookup() +56576
   System.ComponentModel.DataAnnotations.ValidationAttribute.SetupResourceAccessor() +146
   System.ComponentModel.DataAnnotations.ValidationAttribute.get_ErrorMessageString() +12
   System.ComponentModel.DataAnnotations.ValidationAttribute.FormatErrorMessage(String name) +33
   System.Web.Mvc.DataAnnotationsModelValidator.get_ErrorMessage() +31
   System.Web.Mvc.RequiredAttributeAdapter.GetClientValidationRules() +46
   System.Web.Mvc.Html.ValidationExtensions.<ApplyFieldValidationMetadata>b__0(ModelValidator v) +10
   System.Linq.<SelectManyIterator>d__14`2.MoveNext() +238
   System.Web.Mvc.Html.ValidationExtensions.ApplyFieldValidationMetadata(HtmlHelper htmlHelper, ModelMetadata modelMetadata, String modelName) +207
   System.Web.Mvc.Html.ValidationExtensions.ValidationMessageHelper(HtmlHelper htmlHelper, ModelMetadata modelMetadata, String expression, String validationMessage, IDictionary`2 htmlAttributes) +527
   System.Web.Mvc.Html.ValidationExtensions.ValidationMessageFor(HtmlHelper`1 htmlHelper, Expression`1 expression, String validationMessage, IDictionary`2 htmlAttributes) +82
   System.Web.Mvc.Html.ValidationExtensions.ValidationMessageFor(HtmlHelper`1 htmlHelper, Expression`1 expression) +75

Does anyone know if it's possible for me to somehow override how MVC retrieves the error message to display?
thanks
k

A: I would create a custom class attribute that inherits from the standard Mvc HandleError class attribute...
http://blog.dantup.com/2009/04/aspnet-mvc-handleerror-attribute-custom.html

A: Does this answer help?
How to use DataAnnotations ErrorMessageResourceName with custom Resource Solution


text:
Q: Generating element of an ideal of $\Bbb Z^n$ Let $I$ be an ideal of the ring $\Bbb Z^n$. We know that $I$ is finitely generated as an ideal (finite product of noetherian is noetherian), but actually it is generated by a single element, as a finite product of PIDs is a PIR.

How do I find a generating element of $I$? Is there any algorithm? For instance how would you proceed for $I=\langle(4,0,2),(2,-2,0)\rangle$ or $J=\langle(-2,4,0,2),(2,-2,0,1)\rangle$?

Obviously, $\langle x_1,\dots,x_m\rangle=\langle x_1 \rangle+ \dots +\langle x_m \rangle$,but this is not always equal to $\langle x_1 + \cdots + x_m \rangle$ (see $m=2,x_2=-x_1$). So I'm not sure what to do.
Thank you!

A: As in the comments:
The ideal $\langle (a_{11},\dots,a_{1n}) ; \dots ; (a_{m1},\dots a_{mn}) \rangle$ is equal to $I_1 \times \cdots \times I_n$ where $I_k = \langle a_{1k}, \dots, a_{mk} \rangle$.


text:
Q: KafkaJS consumer disconnects after connecting to Kafka container I have implemented a typescript application containing the "Kafka JS" library to initialize a Kafka consumer within it.
This is the code of the consumer:
export class KafkaConsumer {
  public kafka: Kafka = {} as Kafka;
  public consumer: Consumer = {} as Consumer;

  public async InitKafkaConsumer() {
    this.kafka = new Kafka({
          logLevel: logLevel.DEBUG,
          clientId: 'kafka-consumer-client',
          brokers: ['kafka:29092'],
          ssl: false,
          retry: {
            initialRetryTime: 100,
            retries: 8
          }
        } as KafkaConfig);

    this.consumer = KafkaConsumer.kafka.consumer({
        groupId: 'kafka-consumer-group',
        sessionTimeout: 300000
    });
    await this.consumer.connect();
  }
}

In addition, I composed a single Kafka broker with all its dependencies, both are deployed in a docker-compose file:
myservice:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - 8086:8086
    depends_on:
      - kafka
    networks:
      - kafka-network
zookeeper:
    image: "confluentinc/cp-zookeeper"
    container_name: zookeeper
    restart: always
    ports:
      - 2181:2181
    environment:
      TZ: ${TZ_SET}
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
    networks:
      - kafka-network
kafka:
    image: "confluentinc/cp-kafka"
    container_name: kafka
    restart: always
    depends_on:
      - zookeeper
    ports:
      - '9092:9092'
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
      KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 100
      CONFLUENT_METRICS_ENABLE: 'false'
    networks:
      - kafka-network

networks:
  kafka-network:

Eventually, while running the compose file and the application started to ran, the consumer can't connect to the broker.
These are the logs from the container:
2023-01-02 13:22:04 {"level":"ERROR","timestamp":"2023-01-02T11:22:04.032Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:04 {"level":"ERROR","timestamp":"2023-01-02T11:22:04.033Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":0,"retryTime":90}
2023-01-02 13:22:05 {"level":"ERROR","timestamp":"2023-01-02T11:22:05.126Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:05 {"level":"ERROR","timestamp":"2023-01-02T11:22:05.127Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":1,"retryTime":174}
2023-01-02 13:22:06 {"level":"ERROR","timestamp":"2023-01-02T11:22:06.303Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:06 {"level":"ERROR","timestamp":"2023-01-02T11:22:06.304Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":2,"retryTime":400}
2023-01-02 13:22:07 {"level":"ERROR","timestamp":"2023-01-02T11:22:07.705Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:07 {"level":"ERROR","timestamp":"2023-01-02T11:22:07.706Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":3,"retryTime":734}
2023-01-02 13:22:09 {"level":"ERROR","timestamp":"2023-01-02T11:22:09.442Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:09 {"level":"ERROR","timestamp":"2023-01-02T11:22:09.443Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":4,"retryTime":1448}
2023-01-02 13:22:11 {"level":"ERROR","timestamp":"2023-01-02T11:22:11.892Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:11 {"level":"ERROR","timestamp":"2023-01-02T11:22:11.893Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":5,"retryTime":2584}
2023-01-02 13:22:15 {"level":"ERROR","timestamp":"2023-01-02T11:22:15.481Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:15 {"level":"ERROR","timestamp":"2023-01-02T11:22:15.483Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":6,"retryTime":4660}
2023-01-02 13:22:21 {"level":"ERROR","timestamp":"2023-01-02T11:22:21.145Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:21 {"level":"ERROR","timestamp":"2023-01-02T11:22:21.149Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":7,"retryTime":10256}
2023-01-02 13:22:32 {"level":"ERROR","timestamp":"2023-01-02T11:22:32.407Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:32 {"level":"ERROR","timestamp":"2023-01-02T11:22:32.409Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":8,"retryTime":19094}
2023-01-02 13:22:32 {"level":"error","message":"KafkaConsumner >> StartConsuming >> failed with error: [KafkaJSNumberOfRetriesExceeded: Connection timeout]"}
2023-01-02 13:22:32 node:internal/process/promises:246
2023-01-02 13:22:32           triggerUncaughtException(err, true /* fromPromise */);
2023-01-02 13:22:32           ^
2023-01-02 13:22:32
2023-01-02 13:22:32 KafkaJSNonRetriableError
2023-01-02 13:22:32   Caused by: KafkaJSConnectionError: Connection timeout
2023-01-02 13:22:32     at Timeout.onTimeout [as _onTimeout] (/node-typescript-template/node_modules/kafkajs/src/network/connection.js:223:23)
2023-01-02 13:22:32     at listOnTimeout (node:internal/timers:557:17)
2023-01-02 13:22:32     at processTimers (node:internal/timers:500:7) {
2023-01-02 13:22:32   name: 'KafkaJSNumberOfRetriesExceeded',
2023-01-02 13:22:32   retriable: false,
2023-01-02 13:22:32   helpUrl: undefined,
2023-01-02 13:22:32   retryCount: 8,
2023-01-02 13:22:32   retryTime: 19094
2023-01-02 13:22:32 }

What could be the problem?
Thanks in advance!


text:
Q: OData getEntity method fetches only first entity I have a service with a working getEntitySet method. The output looks like this:

But when I try to get only a single entity with /ColumnSet(1) my Output fetches only the first entity which is ColumnSet(0)
method COLUMNSET_GET_ENTITY.

 data: ls_key_tab type /iwbep/s_mgw_name_value_pair,
      lv_columnid type string,
      ls_column type zst_column.

 loop at it_key_tab into ls_key_tab.
  if ls_key_tab-name = 'COLUMNID'.
    lv_columnid = ls_key_tab-value.
    endif.
    endloop.

 select single * from zst_column into ls_column where id_num = lv_columnid.

   er_entity-id_num = ls_column-id_num.
   er_entity-id = ls_column-id.
   er_entity-posi = ls_column-posi.
   er_entity-data_id = ls_column-data_id.
   er_entity-headertext = ls_column-headertext.
   er_entity-ui_element_typ = ls_column-ui_element_typ.
   er_entity-enable = ls_column-enable.
   er_entity-enable_ref = ls_column-enable_ref.

   endmethod.

I dont know, why it only shows the first entity.

A: Your Key field is IDNUM, not COLUMNID.
 loop at it_key_tab into ls_key_tab.
  if ls_key_tab-name = 'IdNum'.
    lv_columnid = ls_key_tab-value.
  endif.
 endloop.


text:
Q: Running a script through another script does not understand PIL When I run and click the preview button, the os.system() runs and executes the test.py but does not recognize that I already have PIL. and gives out this error:
Traceback (most recent call last):
  File "/Users/adamd/Desktop/psychedelic_euphoria/test.py", line 2, in <module>
    from PIL import ImageTk, Image
ImportError: No module named PIL

The one below is the script that will open the file test.py when I press preview.
from tkinter import *
from tkinter import filedialog
import shutil
import os

location = '/Users/adamd/Desktop/psychedelic_euphoria'

def UploadAction(event=None):
    filename = filedialog.askopenfilename()
    shutil.move(filename, location )

def OpenPreview():
    os.system('python /Users/adamd/Desktop/psychedelic_euphoria/test.py')

root = Tk()
root.title('Phychedelic Euphoria')
root.geometry("300x200")
bt_import = Button(root, text='Open', command=UploadAction)
bt_quit = Button(root, text='Quit',command=root.quit)
bt_preview = Button(root, text= 'preview',command=OpenPreview)

bt_import.pack(padx=20, pady=(20,0))
bt_quit.pack(padx=20, pady=(20,0))
bt_preview.pack(padx=20, pady=(20,0))

root.mainloop()

the one below is the test.py:
from tkinter import *
from PIL import ImageTk, Image
import cv2

view = Tk()

app = Frame(view, bg="white")
app.grid()

lmain = Label(app)
lmain.grid()

cap = cv2.VideoCapture('output.avi')

def video_stream():
    _, frame = cap.read()
    cv2image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)
    img = Image.fromarray(cv2image)
    imgtk = ImageTk.PhotoImage(image=img)
    lmain.imgtk = imgtk
    lmain.configure(image=imgtk)
    lmain.after(1, video_stream)

video_stream()
view.mainloop()

If I run test.py alone it works alright but once I run it through the first script from above it does not understand where the module PIL is.
Is there a way to solve this or do I have to alter the whole thing?
If it helps, I use macos.

A: Run a new script in VS code with:
import sys
print(sys.executable)

Now use that path in your os.system()


text:
Q: How can I add the following css code to my page header from functions.php? Right now, I'm placing the following code in header.php.
I think that solution isn't very elegant.
How add this CSS code from functions.php to my header (how would that code look like)?
    wp_head();
?>
<style>
    .jimgMenu ul li.landscapes a {
        background: url(<?php bloginfo('template_directory'); ?>/images/<?php echo get_option(THEME_PREFIX . 'intro_image'); ?>) repeat scroll 0%;
    }

    .jimgMenu ul li.people a {
        background: url(<?php bloginfo('template_directory'); ?>/images/<?php echo get_option(THEME_PREFIX . 'slider_image'); ?>) repeat scroll 0%;
    }

    .jimgMenu ul li.nature a {
        background: url(<?php bloginfo('template_directory'); ?>/images/nature.jpg) repeat scroll 0%;
    }
    .jimgMenu ul li.abstract a {
        background: url(<?php bloginfo('template_directory'); ?>/images/abstract.jpg) repeat scroll 0%;
    }

    .jimgMenu ul li.urban a {
        background: url(<?php bloginfo('template_directory'); ?>/images/urban.jpg) repeat scroll 0%;

    }
    .jimgMenu ul li.people2 a {
        background: url(<?php bloginfo('template_directory'); ?>/images/people.jpg) repeat scroll 0%;
        min-width:310px;
    }
</style>

A: Using hooks is the best way - then you only have to modify functions.php and not the template, making it easier to update the template should the author release changes, updates or patches.
functions.php
<?php

function add_styles()
{
    ?>
    <style type="text/css">
    .jimgMenu ul li.landscapes a {
        background: url(<?php bloginfo('template_directory'); ?>/images/<?php echo get_option(THEME_PREFIX . 'intro_image'); ?>) repeat scroll 0%;
    }

    .jimgMenu ul li.people a {
        background: url(<?php bloginfo('template_directory'); ?>/images/<?php echo get_option(THEME_PREFIX . 'slider_image'); ?>) repeat scroll 0%;
    }

    .jimgMenu ul li.nature a {
        background: url(<?php bloginfo('template_directory'); ?>/images/nature.jpg) repeat scroll 0%;
    }
    .jimgMenu ul li.abstract a {
        background: url(<?php bloginfo('template_directory'); ?>/images/abstract.jpg) repeat scroll 0%;
    }

    .jimgMenu ul li.urban a {
        background: url(<?php bloginfo('template_directory'); ?>/images/urban.jpg) repeat scroll 0%;

    }
    .jimgMenu ul li.people2 a {
        background: url(<?php bloginfo('template_directory'); ?>/images/people.jpg) repeat scroll 0%;
        min-width:310px;
    }
</style>

    <?php
}
add_action('wp_head', 'add_styles');

assuming your theme is built correctly and had wp_head(); in the <head>, which in your example it does, you won't need to mod any files besides functions.php

I will add that for site load optimization and performance enhancement because of client side caching of external style sheets you should make a separate style sheet then instead of the function I mentioned above printing out the CSS it would print out the <link> to the styles sheet.
While you can accomplish not using <?php bloginfo('template_directory'); ?> and instead use relative urls (ie. ../images/.....) that would still pose a problem with the get_option(THEME_PREFIX . 'intro_image') so if your style sheet  changes are really this small what I listed above using the hook is an okay solution, if the styles you want to inject into the <head> are longer/larger than you listed in the question I would suggest using @erenon's suggestion about a dynamic style sheet and a what I just mentioned about modifying my function & hook to include the style sheet instead of printing the styles.

A: You can easily wrap the CSS in a function
function headerCSS(){
    ?>
      // YOUR CSS
    <?php
}

And then call the function
<HEAD>
<?php headerCSS(); ?>
//other header stuff here
<?HEAD>
<BODY>

A: You can't call it, but you can insert it as css:
<link href="generate-css.php" type="text/css" rel="stylesheet" />

A: @janoChen: Assuming your directory structure should look like this
/wp-content/
  /themes/
    /your_theme/
      /images/

put all those styles without <?php bloginfo('template_directory'); ?> in a styles.css file within /wp-content/themes/your_theme/ and then in your header.php simply have
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/styles.css" media="screen" type="text/css" />

A: This is a bad solution. External stylesheets are cached by the server. The method you're using means they must be served up in every page, and are more resource-intensive on the server side.
Look at using the  tag to set the site resource path instead.

The base tag is very useful for Web
  designers who build websites in one
  location but will ultimately be placed
  in another location.

See: http://webdesign.about.com/od/htmltags/qt/how-to-use-html-base-tag.htm


text:
Q: AB/Hypothesis testing in multiple groups Let's say I have two variants of my website and I would like to know which variant generates more revenue. This website operates in multiple countries and I will choose a variant for all countries at the same time once the test is finished. I set up an ab test, sending half of the traffic of each country to each variant. I'm using classical frequentist hypothesis test, testing if the mean revenue increases. Let's say alpha=0.05 and beta=0.8.
I want to avoid distortions like Simpsons's Paradox, so I analyse the results for the countries separately.
Let's say I find some countries to pass the test and some others don't. How can I deal with this and reach conclusions?
I've tried to treat the amount of tests that passed as a binomial random variable, but the interpretation was hard and didn't seem to make sense. Any thoughts?


text:
Q: How to find the integral of the following function step by step. How to find the following integral?
I tried to substitute $\sin (\theta)$ with $z$ but couldn't quite get to final steps.
Any solution or tips will be helpful.
$$\int(\sin \Theta+\cos \Theta+\sqrt{\sin 2 \Theta})^{2} d \Theta$$

A: Just expand out:
$$\int \left( \sin ^2(\theta )+\sin (2 \theta )+2 \sin (\theta ) \sqrt{\sin (2 \theta )}+\cos ^2(\theta
   )+2 \sin (\theta ) \cos (\theta )+2 \sqrt{\sin (2 \theta )} \cos (\theta ) \right)d\theta$$
$$= \theta +\sin (\theta ) \sqrt{\sin (2 \theta )}-\cos (2 \theta )-\sin ^{-1}(\cos (\theta
   )-\sin (\theta ))-\sqrt{\sin (2 \theta )} \cos (\theta )$$


text:
Q: Why does DOMParser.parseFromString() return an uninitialized document? Because I am a glutton for embarrassment, I have another in my series of stupid questions about synthetic documents in JavaScript.
So here goes: createDocument, createHTMLDocument, new Document() and DOMParser.parseFromString() all return new documents. While the first three all return complete documents, documents returned by DOMParser.parseFromString() are uninitialized. Any idea why? (I'm betting on some stupid JavaScript error on my part.)
Here's some code if you want to test:
<script>
function doit() {
  var doc1 = document.implementation.createDocument (null, 'html', null);
  console.log(doc1.readyState); // complete

  var doc2 = document.implementation.createHTMLDocument("HTML Doc");
  console.log(doc2.readyState); // complete

  var doc3 = new Document();
  console.log(doc3.readyState); // complete

  var parser = new DOMParser;
  var doc4 = parser.parseFromString("<!doctype html>", "text/html");
  console.log(doc4.readyState); // uninitialized
}
window.onload = doit;
</script>

ETA: Above are the results on Firefox. Chrome returns "interactive." Still not sure why.


text:
Q: rails app runtime error reports different version of action pack gem than bundle install installs After upgrading to OS X 10.14, my rails application no longer works. I'm trying to figure out why. I get an exception raised by active_support_(5.0.0.1)_lib/active_support/message_encryptor.rb on a line that tries to assign @secret to cipher.key. The exception says that key must be 32 bytes.
At this point in my attempt to resolve, I'm wondering why running bundle install from the application directory reports that it's installing activesupport 5.0.7.2, but when the application runs (via puma) the exception is thrown by code in activesupport 5.0.0.1.
rvm is my ruby version manager. It reports that it's running ruby 2.4.1 (which is the version I had installed before the upgrade). I think OS X 10.14 comes with 2.3.7, but that doesn't seem to be an issue.
Rails is at version 5.0.0.1.
I thought I'd try to update Rails to 5.0.7.2. I read the Upgrading Ruby on Rails page and modified my Gemfile to specify rails ~= 5.0.7 (used to say ~> 5.0.2), then ran rake rails::update which produces an error saying 'You have already activated rake 12.3.2 but your Gemfile requires rake 11.3.0.'.
I can't find a reference to rake in my Gemfile. The error is thrown by boot.rb on the require 'bundler/setup'.
I'm hoping someone might be able to tell me how to update rails to a more recent version in the hopes that having done that, my initial problem will disappear.
Full stack from server log:
ArgumentError (key must be 32 bytes):

activesupport (5.0.0.1) lib/active_support/message_encryptor.rb:72:in `key='
activesupport (5.0.0.1) lib/active_support/message_encryptor.rb:72:in `_encrypt'
activesupport (5.0.0.1) lib/active_support/message_encryptor.rb:58:in `encrypt_and_sign'
actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:592:in `commit'
actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:465:in `[]='
actionpack (5.0.0.1) lib/action_dispatch/middleware/session/cookie_store.rb:117:in `set_cookie'
rack (2.0.1) lib/rack/session/abstract/id.rb:353:in `commit_session'
rack (2.0.1) lib/rack/session/abstract/id.rb:224:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.0.0.1) lib/active_record/migration.rb:552:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.0.1) > lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `tagged'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.0.1) lib/rails/engine.rb:522:in `call'
puma (3.12.0) lib/puma/configuration.rb:225:in `call'
puma (3.12.0) lib/puma/server.rb:658:in `handle_request'
puma (3.12.0) lib/puma/server.rb:472:in `process_client'
puma (3.12.0) lib/puma/server.rb:332:in `block in run'
puma (3.12.0) lib/puma/thread_pool.rb:133:in `block in spawn_thread'
  Rendering /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
  Rendering /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
  Rendered /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (1.8ms)
  Rendering /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
  Rendered /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.1ms)
  Rendering /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
  Rendered /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.6ms)
  Rendered /Users/jboss/.rvm/gems/ruby-2.4.1/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (84.1ms)
Started PUT "/__web_console/repl_sessions/2b97efeccea3498fd96b79db013b3da9" for 127.0.0.1 at 2019-03-26 10:59:35 -0400
Started PUT "/__web_console/repl_sessions/2b97efeccea3498fd96b79db013b3da9" for 127.0.0.1 at 2019-03-26 10:59:36 -0400

From Gemfile.lock:
    actioncable (5.0.7.2)
      actionpack (= 5.0.7.2)
      nio4r (>= 1.2, < 3.0)
      websocket-driver (~> 0.6.1)
    actionmailer (5.0.7.2)
      actionpack (= 5.0.7.2)
      actionview (= 5.0.7.2)
      activejob (= 5.0.7.2)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.0.7.2)
      actionview (= 5.0.7.2)
      activesupport (= 5.0.7.2)
      rack (~> 2.0)
      rack-test (~> 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.0.7.2)
      activesupport (= 5.0.7.2)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (5.0.7.2)
      activesupport (= 5.0.7.2)
      globalid (>= 0.3.6)
    activemodel (5.0.7.2)
      activesupport (= 5.0.7.2)
    activerecord (5.0.7.2)
      activemodel (= 5.0.7.2)
      activesupport (= 5.0.7.2)
      arel (~> 7.0)
    activesupport (5.0.7.2)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
.
.
.
    railties (5.0.7.2)
      actionpack (= 5.0.7.2)
      activesupport (= 5.0.7.2)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.3.2)

A: What looks good is that it from your stack trace it is using the correct ruby version. What seems off is that your gemfile.lock is saying you are locked into other gems so why is it not running them? (activesupport 5.0.0.1 not 5.0.7.2)
Personally I think you need to bundle update / and or delete the lock and run bundle install again. Or track down the trouble maker gems and update them. Perhaps even putting ruby '2.4.1' in your gemfile might lock your bundler into making sure it is using the right ruby version. One thing that might help you find the gem(s) that are using that old rake:
gem dependency rake --reverse-dependencies
How do I find out which gem has a specific dependency?
Then search up to the rake 11.3.0 and see what is using it.
You actually have an old error that has been talked about:
https://github.com/rails/rails/issues/25185
Which was supposedly fixed by:
https://github.com/rails/rails/pull/25192
The question is why is your rails acting like it is still running 5.0.0.1 when you have upgraded? I wonder if your 2.4.1 rvm gems file has the new upgraded gems or if your bundler is somehow installing them into a different version. Maybe also check bundle show activesupport to see the trace leads back to your rvm 2.4.1 folder.
This guy may have a possible answer for you he answered his own question:
Rails 5 production error activesupport
So perhaps a full upgrade up to a higher rails might save you.
Hopefully some of this gets you down the right path!


text:
Q: Rails 3 has_many :through is only adding id from on side of the relationship I am trying to move from a has_many, belongs_to relationship to a has_many :through relationship with my Project and User model. However when I test it in the rails console only one side of the relationship seems to get set in the join model.
I currently have it set up like this:
class Project < ActiveRecord::Base
  has_many :collaborations
  has_many :users, :through => :collaborations
end

class User < ActiveRecord::Base
  has_many :collaborations
  has_many :projects, :through => :collaborations
end

class Collaboration < ActiveRecord::Base
  belongs_to :project
  belongs_to :user
end

Then in the console I'm typing in:
me = User.find(1)

p = Project.new(:name => "somename")
p.users << me
p.save

And what happens is that the Collaboration model gets the project_id set but not the user_id.
And the opposite happens (the user_id gets set but not the project_id) when I do something like this:
me.projects << p

Basically, it creates a "Collaboration" but only one side of the relationship gets saved.
I have been stuck at this for hours now and I feel like it's something minor - maybe something left over from when I was doing the one-to-many relationship between these two models.
---Edit---
This is what the schema looks like:
create_table "collaborations", :force => true do |t|
  t.integer  "project_id"
  t.integer  "user_id"
  t.datetime "created_at"
  t.datetime "updated_at"
end

create_table "projects", :force => true do |t|
  t.string   "name"
  t.datetime "created_at"
  t.datetime "updated_at"
  t.boolean  "shared",      :default => false
  t.integer  "position",    :default => 0
  t.string   "permalink"
  t.text     "description"
end

create_table "users", :force => true do |t|
  t.string   "username"
  t.string   "email"
  t.string   "crypted_password"
  t.string   "password_salt"
  t.string   "persistence_token"
  t.datetime "created_at"
  t.datetime "updated_at"
  t.string   "role"
  t.string   "first_name"
  t.string   "last_name"
  t.string   "perishable_token",  :default => "", :null => false
  t.integer  "avatar",            :default => 0
end

Any help would be really appreciated!

A: It sounds like you're trying to build a has_and_belongs_to_many relationship in a roundabout way. Your Collaboration model looks exactly like a join model.
I'd suggest going with a proper has_and_belongs_to_many relationship. Basically, what you have will become:
class Project < ActiveRecord::Base
  has_and_belongs_to_many :users
end

class User < ActiveRecord::Base
  has_and_belongs_to_many :projects
end

And then you'll need to create a migration for the join table:
def self.up
  create_table :projects_users, :id => false do |t|
    t.references :project, :user
  end
end

def self.down
  drop_table :projects_users
end

You should then be able to do User.find(123).projects and Project.find(321).users, as well as the << you're trying to do. For further explanation of how has_and_belongs_to_many works, as well as the various methods you can use on the associations, please see the Rails docs.


text:
Q: No improvement with intel MKL Here is a code that uses the MKL vector addition method:
#include "mkl.h"
#include <ctime>
#include <chrono>
#include <iostream>

int main() {
    const int n = 10000000;
    int nbRuns = 1000;
    double *a = (double *) mkl_malloc(n * sizeof(double), 64);
    double *b = (double *) mkl_malloc(n * sizeof(double), 64);
    double *c = (double *) mkl_malloc(n * sizeof(double), 64);

    for (int i = 0; i < n; i++) {
        a[i] = i;
        b[i] = i;
    }
    // First run not considered
    vdAdd(n, a, b, c); // MKL call

    auto start = std::chrono::system_clock::now();
    for (int i = 0; i < nbRuns; i++) {
        vdAdd(n, a, b, c); // MKL call
    }
    auto end = std::chrono::system_clock::now();
    std::chrono::duration<double> elapsed = end - start;
    std::cout << "Time: " << elapsed.count() << " sec." << std::endl;

    return 0;
}

Testing this on one machine gives normal speedup when the number of threads is increased, but on another machine, there is no improvement at all, even though, MKL is using more than one thread (this is visible from the system monitor). I am compiling against mkl_rt on Linux (g++ -std=c++14). Am I missing something?
Update:
It turns out that OpenMP also exhibits the same behavior as shown by the following code (which does not use MKL):
#include <omp.h>
#include <ctime>
#include <chrono>
#include <iostream>

int main() {
    const int n = 10000000;
    int nbRuns = 1000;
    double *a = new double[n];
    double *b = new double[n];
    double *c = new double[n];

    for (int i = 0; i < n; i++) {
        a[i] = i;
        b[i] = i;
    }

    auto start = std::chrono::system_clock::now();
    for (int i = 0; i < nbRuns; i++) {
        #pragma omp parallel for
        for (int j = 0; j < n; j++) {
            c[j] = a[j] + b[j];
        }
    }
    auto end = std::chrono::system_clock::now();
    std::chrono::duration<double> elapsed = end - start;
    std::cout << "Time: " << elapsed.count() << " sec." << std::endl;

    return 0;
}

The following are some technical info:
Machine 1 (with no speedup): This is a Laptop (hp)
CPU:
    model name  : Intel(R) Core(TM) i7 CPU       Q 840  @ 1.87GHz
    cpu MHz     : 1199.000
    cache size  : 8192 KB
Memory:
Handle 0x0004, DMI type 16, 15 bytes
Physical Memory Array
    Location: System Board Or Motherboard
    Use: System Memory
    Error Correction Type: None
    Maximum Capacity: 16 GB
    Error Information Handle: Not Provided
    Number Of Devices: 4
Handle 0x0005, DMI type 17, 27 bytes
Memory Device
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 4096 MB
    Form Factor: SODIMM
    Locator: Top-Slot 1(top)
    Bank Locator: BANK 0
    Type: DDR3
    Type Detail: Synchronous
    Speed: 1333 MHz

Machine 2 (normal speedup): This is a single node of large HPC cluster
CPU:
    model name      : Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
    cpu MHz         : 2001.000
    cache size      : 20480 KB
Memory:
    The node has 128GiB, but since I do not have root privileges, I cannot gather more info.
Compiler: gcc 6.1 (same effect with 5.3)
    g++ -std=c++14 -O3 -fopenmp -o testomp testomp.cpp
Number of threads controlled by OMP_NUM_THREADS


text:
Q: Fatal error: Uncaught Error: Call to undefined function mb_detect_encoding() in Uniform Server with PHP 7.2 I'm using Uniform Server with PHP 7.2 and upon running a php page I made I get this error.

Fatal error: Uncaught Error: Call to undefined function mb_detect_encoding()

When I try to enable the mbstring php module (and other modules) through the graphical user interface I get this.

So when I do it manually, my php_production.ini looks like this. I have used Uniform Server to select that php settings file.
extension=gd2
extension=mbstring
extension=exif      ; Must be after mbstring as it depends on it
extension=mysqli

So why do I still get the error if I have enabled the modules manually via the text editor?
Here is my phpinfo.
Below is the contents of C:\Users\Documents\UniServerZ\core\php72\extensions

A: The developer of Uniform Server managed to fix the problem, saying so in this post.

Ok.. Thanks for bringing this up.. Looks like made a mistake on the spelling on the extensions folder. Please rename the /core/php72/extentions to /core/php72/extensions and everything should work as expected.. I have updated the module in Sourceforge.


text:
Q: Correct positioning for border I want to style a warning message by adding a left border. I did this but there is a problem with the left border because it is not placed inside of the red border...it is displaced somehow to left
HTML:

Random warning message

CSS:
.msg-warning {
  border: 1px solid red;
  padding: 0px 5px;
  border-left-width: 12px;
}

.msg-warning {
  border-left-color: blue;
}

https://jsfiddle.net/uoedzqj1/

A: you could trying like this:

.msg-warning {
  border: 1px solid red;
  padding: 0px 5px;
  border-left: none;
  box-shadow:-12px 0 blue;
  margin-left:12px;
}

Random warning message

Fiddle: https://jsfiddle.net/uoedzqj1/2/

A: something like this? nest another div in your .msg-warning div

.msg-warning {
  border: 1px solid red;
  padding: 0px 5px;
    padding-left: 0px;
}

.blue {
    display:inline-block;
    width: 12px;
    height: 100%;
    background-color: blue;
    margin-right: 5px;
}

Random warning message

A: Use outline and border properties:
 .msg-warning {
    outline: 1px solid lightGray;
    padding: 0px 5px;
    border-left:12px solid #FCF8E3;
  }


text:
Q: Using EPIC debugger: how to see get a meaningful stack trace when program exits improperly I'm new to both perl and epic, so forgive me for asking obvious things.  I did do some playing around online and did not find anything though.
I'm running a perl program in the debugger, which fails.  When it fails I get a rather unhelpful message.  I can't copy and past it, and I can't write it by hand because it has so many unrecognizable characters.  It looks something like:
Debugged program terminated.  use [imq[0m to quit or [1mr[om to restart,
use [1mo[0m [4minhibit_exit[24m to avoid stopping after program termination

Everywhere that has brackets shows as an undefined character in the eclipse consol window.
What I don't get is any kind of useful stack trace.  I can see that the setup_ram_directories method was called because it's the last line of the debugger before the error.  However, the actual error occurs deeper down the stack.  I don't get a stack trace, nor can I get eclipse to pause when an error comes up so I can inspect the memory state that caused the failure.
Some extra playing around seems to suggest that EPIC is confused whenever a method defined in a different module is called, the setup_ram_directories being defined in a helper module.  If I have stepped deeper into the above method until I'm in a method contained within the module that throws an exception and then hit run I get a proper stack trace.  However, for errors deep in my stack it takes multiple runs of the program to determine what methods & modules are failing before I get to the point where I get a proper stack trace.
Is there some configuration I need to do to get PERL to provide me a proper stack trace?  Or better yet I would prefer to have the debugger pause when the program is going to fail so I can inspect variables.
I have tried o inhibit_exit from perl expressions view, it didn't seem to do anything.

A: Try the following plugin which works with EPIC:
http://andrei.gmxhome.de/anyedit/


text:
Q: Generic Binary Search Tree Implementation in Java - calling generic methods, and cast exceptions I am attempting to implement a Binary Search Tree as an assignment. We are experiencing resolving issues of derivation, inheritance, etc, so the tree can potentially hold data of a variety of different types.
In past assignments I had used base class pointers as the data type, and utilized RTTI/upcasting/downcasting to access data, I read that this is inefficient and bad practice, so I'm trying to move away from it.
To that end, I'm trying to implement a generic node/tree structure, but am having a couple of issues. First, when it comes to calling a "display" method from a generic data member, is that even possible? Since the node may not know what type of data is being stored, or if the method even exists to be called?
Second, when trying to cast an object to  I get an unchecked cast exception, is there a way to resolve this? Or conduct a checked cast?
Any advice or helpful solutions would be appreciated.
EDIT:
Here is some code...
BSTNode implementation:
/**
 * Class declaration for a BST Node. Holds left and right pointers, and a data
 * member. Contains methods for getting/setting left, right, and data.
 */
public class BSTNode<T extends Comparable<T>> {

    private BSTNode<T> left, right, next; //ptr for left/right/next nodes.
    private T data; //Integer for data.

    public BSTNode(){
        left = right = next = null; //Set left/right/next ptrs to NULL.
    }

    public BSTNode(T n){
        left = right = next = null; //Sets left/right/next ptr to NULL.
        this.data = n; //Init data to passed in arg.
    }

    public BSTNode<T> getLeft() {return this.left;}

    public BSTNode<T> getRight() {return this.right;}

    public BSTNode<T> getNext() {return this.next;}

    public T getData() {return this.data;}

    public void setLeft(BSTNode<T> left) {this.left = left;}

    public void setRight(BSTNode<T> right) {this.right = right;}

    public void setNext(BSTNode<T> n) {this.next = n;}

    public void setData(T d) {this.data = d;}
}

Insertion:
public class Interface<T extends Comparable<T>> extends Utility {

...
        case 1:
          Subjob sub1 = new Subjob("Test");
          BSTNode<T> temp = new BSTNode<T>(sub1); //ERROR ON THIS LINE
          exit = true;
          return 1;

A: Sounds like an interface should be used as the basis for the BST.  The interface would need to be comparable (as required by the BST) and provided the method display().  Then it is up to implementations to provide that method properly.
The interface might look like:
public interface Displayable<T> extends Comparable<T> {
    void display();
}

Internally to the BST, it might have a node as follows:
public class Node<T> {
    Displayable<T> value;
    Node<T> left;
    Node<T> right;
}


text:
Q: save checked checkboxes when Page reloads For my search-engine I designed a filter using a form with checkboxes. When submitting those, the filter function works fine (using Flask for this). Yet the checkboxes which where used as a filter are unchecked again when the results are shown. Do I need to save the information in the localStorage, and how can this be done?
Thanks for your help <3
This is a part of my Code for the checkbox (I am a newbie to HTML/JS):

 <form>

      Document Types

                 <input class="form-check-input" type="checkbox" name="doctype" value="offer" id="offer">
                 Offer

             <button type="submit" class="btn btn-secondary btn-sm">Submit</button>

 </form>

A: Just add checked to it
<input class="form-check-input" type="checkbox" name="doctype" value="offer" id="offer" checked>

A: Use checked in your checkbox and read here

 <form>

      Document Types

                 <input class="form-check-input" type="checkbox" name="doctype" value="offer" id="offer" checked>
                 Offer

             <button type="submit" class="btn btn-secondary btn-sm">Submit</button>

 </form>


text:
Q: How to create a symbol with arrows and an arc in QGIS I'm using QGIS 2.18 and wondering if there's a fairly simple way to create a symbol with an arrow on the end of a ray, and an arc in between.

The thing that makes it complex is that the angle is not consistent.  Also, I always want the arc to travel from the first line drawn to the second line drawn so I can show angles greater than 180.  In my drawing point 1 is the left most arrow, point 2 the center, and point three the other arrow.  So the arc would travel from line 1-2 to 2-3.

A: I recently answered to a couple of questions:
Showing antenna symbols on the map: point symbols or features (polygons)
Creating sector lights in QGIS?
related to similar topics. So, an approach would be recurring to geometry generators from the Style properties, assuming to edit the fields of your layer with information about angles, azimuths, lengths, and so on (it will depend on your skills with Field Calculator or PyQGIS).
The issue should be accomplished by creating three geometry generators (two for the arrows and one for the arc), following an approach which would be similar to the one I used in the links posted above.