text:
Q: java.lang.IllegalArgumentException: Unable to locate Attribute with the the given name I have an application on Spring using JPA and Oracle DB. My table has following structure:
CREATE TABLE MODULE
(
 id NUMBER(19,0),
 name VARCHAR2(255 CHAR) NOT NULL,
 label VARCHAR(255 CHAR) NOT NULL,
 is_active VARCHAR(1 CHAR) NOT NULL,
 CONSTRAINT PK_MODULE PRIMARY KEY (id)
)

Here is my entity class:
@Entity
@Table(name="module")
public class Module {
private Long id;
private String name;
private String label;
private Boolean isActive;

@Id
@Column(name = "id", updatable = false)
public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

@Column(name = "name")
public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

@Column(name = "label")
public String getLabel() {
    return label;
}

public void setLabel(String label) {
    this.label = label;
}

@Column(name = "is_active")
public Boolean getActive() {
    return isActive;
}

public void setActive(Boolean active) {
    isActive = active;
}
}

Here is my JPA repository interface:
public interface ModuleDAO extends JpaRepository<Module, Long> {
     List<Module> findModulesByNameAndIdNot(String name, Long id);
     List<Module> findModulesByNameAndIsActive(String name, Boolean isActive);
     List<Module> findModulesByIsActive(Boolean isActive);
 }

But when I try to deploy my application I have following exception:
java.lang.IllegalArgumentException: Failed to create query for method public abstract java.util.List com.sbt.azimuth_forms.dao.ModuleDAO.findModulesByNameAndIsActive(java.lang.String,java.lang.Boolean)! Unable to locate Attribute  with the the given name [isActive] on this ManagedType [com.sbt.azimuth_forms.entities.Module]
            at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:103)
            at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:106)
            at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:211)
            at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:79)
            at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lookupQuery(RepositoryFactorySupport.java:574)
            at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$mapMethodsToQuery$1(RepositoryFactorySupport.java:567)
            at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
            at java.util.Iterator.forEachRemaining(Iterator.java:116)
            at java.util.Collections$UnmodifiableCollection$1.forEachRemaining(Collections.java:1049)
            at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
            at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
            at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
            at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
            at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
            at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
            at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.mapMethodsToQuery(RepositoryFactorySupport.java:569)
            at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$new$0(RepositoryFactorySupport.java:559)
            at java.util.Optional.map(Optional.java:215)
            at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:559)
            at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:332)
            at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:297)
            at org.springframework.data.util.Lazy.getNullable(Lazy.java:212)
            at org.springframework.data.util.Lazy.get(Lazy.java:94)
            at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:300)
            at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:121)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1758)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1695)
            ... 60 more
 Caused by: java.lang.IllegalArgumentException: Unable to locate Attribute  with the the given name
 [isActive] on this ManagedType [com.sbt.azimuth_forms.entities.Module]
            at org.hibernate.metamodel.model.domain.internal.AbstractManagedType.checkNotNull(AbstractManagedType.java:147)
            at org.hibernate.metamodel.model.domain.internal.AbstractManagedType.getAttribute(AbstractManagedType.java:118)
            at org.hibernate.metamodel.model.domain.internal.AbstractManagedType.getAttribute(AbstractManagedType.java:43)
            at org.springframework.data.jpa.repository.query.QueryUtils.toExpressionRecursively(QueryUtils.java:633)
            at org.springframework.data.jpa.repository.query.QueryUtils.toExpressionRecursively(QueryUtils.java:617)
            at org.springframework.data.jpa.repository.query.JpaQueryCreator$PredicateBuilder.getTypedPath(JpaQueryCreator.java:385)
            at org.springframework.data.jpa.repository.query.JpaQueryCreator$PredicateBuilder.build(JpaQueryCreator.java:308)
            at org.springframework.data.jpa.repository.query.JpaQueryCreator.toPredicate(JpaQueryCreator.java:211)
            at org.springframework.data.jpa.repository.query.JpaQueryCreator.and(JpaQueryCreator.java:133)
            at org.springframework.data.jpa.repository.query.JpaQueryCreator.and(JpaQueryCreator.java:59)
            at org.springframework.data.repository.query.parser.AbstractQueryCreator.createCriteria(AbstractQueryCreator.java:122)
            at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:95)
            at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:81)
            at org.springframework.data.jpa.repository.query.PartTreeJpaQuery$QueryPreparer.<init>(PartTreeJpaQuery.java:230)
            at org.springframework.data.jpa.repository.query.PartTreeJpaQuery$CountQueryPreparer.<init>(PartTreeJpaQuery.java:363)
            at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:98)
            ... 86 more

I have read many different posts about this topic, but any of them is not my case. I suspect that problem can be in mapping varchar field is_active to boolean field of class Module, but as far as I know JPA and Hibernate can resolve such kind of mapping. Will be greateful for any suggestions and advices!

A: Your methods should look like:
interface ModuleDAO extends JpaRepository<Module, Long> {
     List<Module> findByNameAndIdNot(String name, Long id);
     List<Module> findByNameAndActive(String name, boolean active);
     List<Module> findByActive(boolean isActive);
}

Some remarks:

*

*Interfaces are public by default

*You shouldn't use Boolean wrapper type because this would allow null values

A: try this
@Column(name = "is_active")
public Boolean getIsActive() {
    return isActive;
}
public void setIsActive(Boolean isActive) {
    this.isActive = isActive;
 }
}


text:
Q: Operand should contain 1 column(s) Codeigniter is my query okay ?
public function parse()
{
    $db4 = $this->load->database('db4', TRUE);
    $query = $db4->query(' INSERT INTO test (nik, nama, status, bulan, tahun, hk, hb, lembur, gp, obat, transport, tunjangan, bpjs) SELECT (`karyawan`.`no_nik`, `karyawan`.`nama`, `karyawan`.`kd_status`, `absensi`.`bulan`, `absensi`.`tahun`, `absensi`.`hk`, `absensi`.`hari_besar`, `absensi`.`lembur`, `karyawan`.`gapok`, `karyawan`.`obat`, `karyawan`.`transport`, `karyawan`.`tunjangan`, `karyawan`.`bpjs`) FROM karyawan LEFT JOIN absensi ON `karyawan`.`no_nik` = `absensi`.`nik` ');
}

notification of error

A: I think that issue with karyawan.no_nik = absensi.nik part where field no_nik or nik does not exist  cause it's talking about: operand
try to run this query in phpmyadmin or some mysql gui:
SELECT
       karyawan.no_nik    AS nik,
       karyawan.nama,
       karyawan.kd_status AS status,
       absensi.bulan,
       absensi.tahun,
       absensi.hk,
       absensi.hari_besar AS hb,
       absensi.lembur,
       karyawan.gapok     AS gp,
       karyawan.obat,
       karyawan.transport,
       karyawan.tunjangan,
       karyawan.bpjs
FROM karyawan
         LEFT JOIN absensi ON (karyawan.no_nik = absensi.nik)

If query will be successful then scoping SELECT inside brackets may solve the issue:
public function parse()
{
    $db4 = $this->load->database('db4', TRUE);
    $query = '
      INSERT INTO test
      (nik, nama, status, bulan, tahun, hk, hb, lembur, gp, obat, transport, tunjangan, bpjs)
      (
        SELECT karyawan.no_nik    AS nik,
               karyawan.nama,
               karyawan.kd_status AS status,
               absensi.bulan,
               absensi.tahun,
               absensi.hk,
               absensi.hari_besar AS hb,
               absensi.lembur,
               karyawan.gapok     AS gp,
               karyawan.obat,
               karyawan.transport,
               karyawan.tunjangan,
               karyawan.bpjs
        FROM karyawan
                 LEFT JOIN absensi ON (karyawan.no_nik = absensi.nik)
      )
    ';
    $query = $db4->query($query);
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: IRC Bot TypeError (python)   if data.find('!search') != -1:
     nick = data.split('!')[ 0 ].replace(':','')
     conn = httplib.HTTPConnection("www.md5.rednoize.com")
     conn.request("GET", "?q=" + arg)
     response = conn.getresponse()
     data = response.read()
     result = re.findall('<div id="result" >(.+?)</div', data)
     if result:
        sck.send('PRIVMSG ' + chan + result + '\r\n')
     else:
           sck.send('PRIVMSG ' + chan + " :" ' could not find the hash' + '\r\n')

When I run this code I get this error:
conn.request("GET " + "?q=" + arg)
TypeError: cannot concatenate 'str' and 'list' objects

How can I fix this?

A: Where does arg come from?  Do you know what it's supposed to contain?
arg is apparently a list, not a string.  Try replacing arg with str(arg[0]) and see if that works.


text:
Q: B-spline curve is not satisfying partition of Unity property at the beginning and end At the beginning and end, the curve goes to zero
The following is the matlab code
clear,clc;
%%
p = 3; % degree
n = 10; % no.of control points
% control points
x = [1 0.5 5 3  11 8 12 11 15 17];
y = [4 6   4 12 14 4 3  9  10 8];

m = p + n + 1; % no.of knot vector
% specifying t(1:p) = 0, t(m-p:m) = 1
t = zeros(1,m);
t(1:p-1) = 0;
t(end:-1:end-p) = 1;
t(p : end-p+1) = linspace(0,1,size(p:m-p+1,2));

%%
cx = 0; cy = 0;
t_req = 0 : 0.01: 1;

px = zeros(size(t_req));
py = zeros(size(t_req));
pb = zeros(size(t_req));
params.m = m; params.p = p;
params.n = n;

b = zeros(size(t_req,2),size(x,2));

for ct = 1 : size(t_req,2)
    cx = 0; cy = 0; b = 0;

    for idx = 1 : size(x,2)

        basis_fun = N(idx,p,t,t_req(ct),params);

        b = b + basis_fun;
        cx = cx + x(idx)*basis_fun;
        cy = cy + y(idx)*basis_fun;
    end

    px(ct) = cx;
    py(ct) = cy;
    pb(ct) = b;
end

%% plotting
figure;
plot(px,py,'b','linewidth',1.3),grid,hold on;
plot(x,y,'r*-.','MarkerSize',7);

%% function to calculate basis_functions
function basis_fun = N(idx,p,t,t_req,params)

if ( p == 0 )
    if (t(idx) <= t_req && t(idx+1) > t_req)
        basis_fun = 1;
        return;
    else
        basis_fun = 0;
        return;
    end
else
    basis_fun = (t_req - t(idx))/(t(idx+p)-t(idx)) * N(idx,p-1,t,t_req,params) + ...
        (t(idx+p+1)-t_req)/(t(idx+p+1)-t(idx+1)) * N(idx+1,p-1,t,t_req,params);

    if (isnan(basis_fun) || isinf(basis_fun))
        basis_fun = 0;
    end

end
end


text:
Q: IllegalArgumentException: columnname is not a field defined in this UDT I have the following table structure
@Table(value = "employee")
public class Employee implements MapIdentifiable{

    @PrimaryKeyColumn(value = "employee_id", ordinal = 0, type = PrimaryKeyType.PARTITIONED)
    private String empId;

    @Column(value="info")
    @CassandraType(type = DataType.Name.UDT, userTypeName = "emp_info")
    private EmployeeInfo info;

// getters & setters
}

@UserDefinedType(value = "emp_info")
public class EmployeeInfo {

  @CassandraType(type = DataType.Name.TEXT, userTypeName = "employee_name")
  private String employeeName

// getters & setters
}

Whenever I am trying to do a repository.save(emp), I am getting the following error IllegalArgumentException: employeename is not a field defined in this UDT..
I have no reference of any field called 'employeename' in my code or in database, yet I am getting the above mentioned error.
I am have tried, recreating the entire schema and tables but with no luck.
My maven dependencies are as follows
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-cassandra</artifactId>
            <version>2.1.6.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>com.datastax.cassandra</groupId>
            <artifactId>cassandra-driver-core</artifactId>
            <version>3.7.1</version>
        </dependency>
        <dependency>
            <groupId>com.datastax.cassandra</groupId>
            <artifactId>cassandra-driver-mapping</artifactId>
            <version>3.7.1</version>
        </dependency>
        <dependency>
            <groupId>com.datastax.cassandra</groupId>
            <artifactId>cassandra-driver-extras</artifactId>
            <version>3.7.1</version>
        </dependency>

The same code works if I remove the underscore from my field names. I am not able to figure out my code is not working with underscore in my field names.
Please let me know if I am missing out any information to share.
My stacktrace,
java.lang.IllegalArgumentException: employeename is not a field defined in this UDT
web_1  |    at com.datastax.driver.core.UDTValue.getAllIndexesOf(UDTValue.java:47)
web_1  |    at com.datastax.driver.core.AbstractData.set(AbstractData.java:535)
web_1  |    at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.writeUDTValueWhereFromObject(MappingCassandraConverter.java:495)
web_1  |    at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.write(MappingCassandraConverter.java:353)
web_1  |    at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.getWriteValue(MappingCassandraConverter.java:769)
web_1  |    at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.getWriteValue(MappingCassandraConverter.java:711)
web_1  |    at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.writeMapFromWrapper(MappingCassandraConverter.java:368)
web_1  |    at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.write(MappingCassandraConverter.java:343)
web_1  |    at org.springframework.data.cassandra.repository.support.InsertUtil.createInsert(InsertUtil.java:52)
web_1  |    at org.springframework.data.cassandra.repository.support.SimpleCassandraRepository.createInsert(SimpleCassandraRepository.java:110)
web_1  |    at org.springframework.data.cassandra.repository.support.SimpleCassandraRepository.save(SimpleCassandraRepository.java:77)
web_1  |    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
web_1  |    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
web_1  |    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
web_1  |    at java.lang.reflect.Method.invoke(Method.java:498)
web_1  |    at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:377)
web_1  |    at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:200)
web_1  |    at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:641)
web_1  |    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
web_1  |    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:605)
web_1  |    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:590)
web_1  |    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
web_1  |    at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:59)
web_1  |    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
web_1  |    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
web_1  |    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
web_1  |    at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:61)
web_1  |    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
web_1  |    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
web_1  |    at com.sun.proxy.$Proxy136.save(Unknown Source)
web_1  |    at com.hindol.service.EmployeeServiceImpl.createEmployee(EmployeeServiceImpl.java:31)
web_1  |    at com.hindol.EmployeeController.saveEmployee(EmployeeController.java:72)

A: employeename comes from your mapped UDT EmployeeInfo as it contains the property
private String employeeName

To alter the name of a UDT field, please us @Column(…).

A: I was getting this error when I was trying to run my Spring app after I added another field to my @UserDefinedType class. My Spring app was not updating my UDT structure, so I had to do that manually.
If your project is brand new, you can simply delete table and UDT from your Cassandra, and then let your Spring app run again to recreate the data model:
DROP TABLE employee;

DROP TYPE emp_info;

However, if your can't simply drop and recreate your table, you have to use ALTER TYPE command to update your UDT structure. See documentation for details.


text:
Q: Issue with gridComplete in jqGrid I have a jQGrid which has loadComplete and gridComplete parameters. The grid is currently working fine.
Now I had to do a generic change where I need to add one more event which works on the events of the pager.
I added the below code to bind one more event with gridComplete.
jQuery('#grid0').jqGrid('setGridParam', { gridComplete: function()
            {
                           myGenericMethod();

            }});

The problem with this code is : myGenericMethod() is called but the original gridComplete block is not executed.
I am sure @Oleg will be having the answer.
My grid declaration is below:
$("#grid0").jqGrid({
         datatype: "jsonstring",

    datastr:GetJSON1(),

    colNames:[strFieldNames[0], strFieldNames[1], strFieldNames[2], strFieldNames[3]],

    colModel:[
        {name:'newdynaid', index:'newdynaid', width: 50, editable:true, editoptions:{readonly:false, size:5}, hidden:true,sortable:false},

        {name:strFieldValues[1], index:strFieldValues[1], editable:false, readonly:true, width:80},

        {name:strFieldValues[2], index:strFieldValues[2], editable:false, readonly:true, width:80,
                hidden:false,sortable:true},

        {name:strFieldValues[3], index:strFieldValues[3], editable:false, readonly:true, width:80}

        ],

        postData: {},
        rowNum: 10,
        height: "100%",
        shrinkToFit: true,
        autowidth: true,
        rownumbers: false,
        pager: '#pager0',
        sortname: 'id',

        viewrecords: true,
        sortorder: "asc",
        emptyrecords: "Empty records",
        loadonce: true,
        sortable: true,

        rowList: [6,10,20,40,60,80,100],

        loadComplete: function() {
             var grid0 = jQuery("#grid0");
             var allDropDownElements = getAllDropDownElements0();
            var allDropDownElementRefTables = getAllDropDownElementRefTables0();
             processLoadComplete(grid0, allDropDownElements, allDropDownElementRefTables, 0);
             },
        gridComplete:function() {
             var grid0 = $("#grid0");
             var pager0Center = $("#pager0_center");
             processGridComplete(grid0, pager0Center, 0);
             onLoadpopulateName();
             }
        });

A: Starting with version 4.3.2 jqGrid supports jQuery Events together with callbacks. At the time I spend many my time to create the corresponding pull request which was merge to the main code of jqGrid. Later in free jqGrid I changed internal code of jqGrid so that practically every callback have the corresponding jQuery event. The events are very important if you need to write common actions (common callbacks) which need be done on every grid of your project. Only using the events one can write jqGrid plugin which don't reserves any callbacks.
The usage of events is very easy. It's important to understand that you can bind the events before jqGrid is created. It's especially important to do with events jqGridBeforeInitGrid (exist only in free jqGrid), jqGridInitGrid, jqGridGridComplete, jqGridAfterGridComplete, jqGridLoadComplete, jqGridAfterLoadComplete.
I would recommend you to read the answer which describes the differences between gridComplete and loadComplete. I personally use almost only loadComplete, but the choice of the callback depend on your exact requirements.
Let us you really need to use common gridComplete. Then you have choice to define some action after gridComplete used in the grid or before it. Depend on the choice you should use jqGridGridComplete or jqGridAfterGridComplete event. Let us jqGridAfterGridComplete is what you need. Then the code can looks as the following
$("#grid0").bind("jqGridAfterGridComplete", function () {
    // the event handler will be executed AFTER gridComplete
    ...
});
$("#grid0").jqGrid({
    // common options which you need
    pager: "#pager0",
    gridComplete:function() {
        var $self = $(this), p = $self.jqGrid("getGridParam"),
            pager0Center = $(p.pager + "_center"); //$("#pager0_center");
        ...
    }
});

The above code will work in both jqGrid (starting with version 4.3.2) and free jqGrid. If you would need to use an event which have options, like jqGridAfterLoadComplete then you should add first additional Event parameter and use the typical parameter starting with the second parameter:
$("#grid0").bind("jqGridAfterLoadComplete", function (e, data) {
    // the event handler will be executed AFTER loadComplete
    ...
});

By the way free jqGrid allows you to use pager: true and don't define an empty

. In the case free jqGrid generate the div with unique id automatically and modifies the pager option of jqGrid to id selecror. So you can use gridComplete callback exactly like in the above example. See the wiki article for more information.


text:
Q: Populate a String Array dynamically I'm trying to make an app for my parents business, but at this point I found a problem.
I'm trying to get some strings from a SQLite database and to store them into an array.
I'm trying this:
            //This opens the db
            SQLManager info = new SQLManager(this);
            info.open();

            String[] data = {"", "", "", ""};

            for (int i = 1; i == 3; i++)
            {
                data[i]=(info.getProduct(i));
            }

            info.close();
            tv.setText(data[0]);
            tv.setText(data[1]);
            tv.setText(data[2]);

info.getproduct is a method which gets a string from the database. This works fine. The problem is that i can't update the value of the array. It always shows the same.
Any idea?

A: You Do This,
  String[] data = new String[4];

        for (int i = 0; i <data .length; i++)
        {
            data[i]=(info.getProduct(i));
        }

It Helps You.

A: The second argument in the for loop is supposed to work as a while-condition, meaning the loop will run while it is true, as i starts as 1 it will not be 3 and thus the loop terminates at once.
You probably want a loop that looks like this:
for( int i = 1; i<=3; i++ ){ //Are you sure you want to start from 1? The first element in an array has index 0.
    //Loop
}

A: you should do this
String[] data = {"", "", "", ""};

            for (int i = 0; i <data .length; i++)
            {
                data[i]=(info.getProduct(i));
            }

A: this loop will never run you should change it to:
for(int i =0;i<3;i++){
}

A: the use of for loop is like this
for(initializatin;condition;increment)

while in your case it is not condition it is a statement, so work on it.
you can change to for (int i = 1; i <= 3; i++)

A: not i==3, use i<3 in the for loop


text:
Q: Solve system of congruences I see that using CRT one can solve systems of the form:
\begin{cases}
x \equiv a \pmod b\\
cx \equiv q \pmod w
\end{cases}
but how would you solve a system of the form:
\begin{cases}
x \equiv a \pmod b\\
x \equiv q \pmod c\\
x \equiv w \pmod d
\end{cases}
where 'x' is always the same, and all other variables change? The idea is to send b, c, d, a, q, w over the wire and recover x.

A: Use the CRT repeatedly. First solve the system for the first two equations and that should yield another congruence relation. Then solve the system of the new congruence relation and the third one.
It's obvious that no solutions are lost in the process, as CRT gives us all the solution that satisfy the first two equations and obviously the solutions of the initial system of 3 congruence relations is a subset of this set.


text:
Q: Where and how to show imputed data in manuscript? What are your thoughts on where or how to show (non-)imputed data?
Please regard this question as a more a general question. I am in the field of medical clinical research, where missing data is very common. It is most likely caused by mixed reasons (random/not-random). I would like to use multiple imputation to assess and impute missing data.
At the moment, many medical reports do not use imputation: https://pubmed.ncbi.nlm.nih.gov/27556528/
I want to do it the correct way, but also create a manuscript with good readability (for clinicians). In addition, most journals have very strict word, table or page limits.
For example (answers don't have to be limited to this example): Is it okay to show only the imputed data in table that summarizes the main outcomes? Or should one, for example, show the raw data in a table (including numbers that have missing data) and only use the imputed data in your analyses? Or do you have to show both (which reduces readability)?
Curious for your answers!


text:
Q: Computed Column - as Primary key I have the following Computed Column within the create table function:
Create table test
(
Code1 nchar(10),
Code2 nchar (10),
Type nchar(10),
Final AS CASE WHEN LEN(Code1)>0 THEN Code1 WHEN LEN(Code2)>0 THEN Code2 ELSE Type END
);

Alter table test
add constraint PK_Test1
Primary Key (Final)

But I am getting the following error

"Cannot define PRIMARY KEY constraint on nullable column in table".

This is because Code 1, Code 2 and Type can be NULL, but all the three will never be NULL. One of them will always have a value.
Is there anyway I can get define the computed column as a primary key with the above in mind?
Many thanks - JT

A: Your computed column needs to be persisted and NOT NULL to be used as a primary key;
Create table test
(
    Code1 nchar(10),
    Code2 nchar (10),
    Type nchar(10),
    Final AS CASE WHEN LEN(Code1)>0 THEN Code1
                  WHEN LEN(Code2)>0 THEN Code2
                  ELSE Type END
          PERSISTED NOT NULL
);

An SQLfiddle to test with.

A: Why not just use a unique constraint as it will allow null

Unlike PRIMARY KEY constraints, UNIQUE constraints allow for the value
  NULL. However, as with any value participating in a UNIQUE constraint,
  only one null value is allowed per column. A UNIQUE constraint can be
  referenced by a FOREIGN KEY constraint.


text:
Q: How to call Gradle task execution from outside task? I have code:
task instalNodeModules {
   doLast {
      npmInstall.execute()
      installGulp.execute()
   }
}

task runTasks {
   doLast {
      instalNodeModules.execute()
      gulpBuildWithOpts.execute()
   }
}

Gradle 4.5.1 warns about it as

The TaskInternal.execute() method has been deprecated and is scheduled
  to be removed in Gradle 5.0. There are better ways to re-use task
  logic, see
  https://docs.gradle.org/4.5.1/userguide/custom_tasks.html#sec:reusing_task_logic.

But link does not give me any hint how I could replace it because I can't just setup task dependencies like dependsOn or finalizdBy - it called not from other task but from end of build.

A: You are not supposed to call the execute method directly, but rather model your tasks dependencies. This allows gradle to perform up-to-date checks and only execute the tasks that are needed.
task runTasks {
   dependsOn installNodeModules
   dependsOn gulpBuildWithOpts
}


text:
Q: How do I log errors from variables in a bash shell script I have a working script which goes out and checks what O/S the client is running and then runs the code relating to that which is checking the difference in NTP offset of the client against a master server.
I would like to add some error logging into this around the NTP commands but don't know where to start.
Any pointers would be greatly appreciated.
#!/bin/bash

OS=`uname`

case $OS in
        [Linux]*)
Host=`hostname`
Offset=`ntpq -p | grep -e '*' | awk '{print $9}'`
Date=`date +%D`
CADate=`ntpdate -q 10.102.80.1 | awk '/nt/ {print $0}' | awk '{print $10}'`
TimeDiff=$(echo  $Offset - $CADate | bc )

#Output
echo "$Host" "|" "$Date" "|" "$TimeDiff" > NTP.mif

        ;;
        [SunOS]*)
Host=`hostname`
Offset=`ntpq -p | tail -1 | awk '{print $9}'`
Date=`date +%D`
CADate=`ntpdate -q 10.102.80.1 | tail -1 | awk '{print $10}'`
TimeDiff=$(echo $Offset - $CADate | bc)

#Output
echo "$Host" "|" "$Date" "|" "$TimeDiff" > NTP.mif
        ;;
        [AIX]*)
Host=`hostname -s`
Offset=`ntpq -p | grep -e '*' | awk '{print $9}'`
Date=`date +%D`
CADate=`ntpdate -q 10.102.80.1 | awk '/nt/ {print $0}' | awk '{print $10}'`
TimeDiff=$(echo  $Offset - $CADate | bc )

#Output
echo "$Host" "|"  "$Date" "|" "$TimeDiff" > NTP.mif
        ;;
esac

A: It's important to realise that there are two kinds of errors:

*

*You launch a UNIX/Linux command and this goes wrong.

*You launch a command and you see results you don't like.

In the first case, the error results go to the basic error stream, known as 1. The errors can be catched and written to a logfile, like this (I use >> as I prefer to append to the logfile, not recreate from scratch):
command 1>>logfile_error.txt

For the second case, you have something like:
bad_result=$(command)
// check that the result is bad indeed
bad_result >>logfile_error.txt

(In this second case, the basic error stream is not immediately relevant)
Obviously, you can combine both:
bad_result=$(command 1>>logfile_error.txt)
...
bad_result >>logfile_error.txt

A: In addition to output redirections you might want to conditionally decide what should be captured/printed out.
..so you might be interested in making a use of return codes given after executing a command which can be obtained by using $?
https://www.tldp.org/LDP/abs/html/exit-status.html
https://www.tldp.org/LDP/abs/html/exit-status.html#FTN.AEN2981
just a usage example:
(not really a "good" one - rewritten in notepad without further testing, but still might be helpful for you - could be better)
#!/bin/bash

Host=`hostname`
OS=`uname`
ntp_ip=10.102.80.1
Date=`date +%D`

Offset_data=`ntpq -p`
Offset_rc=$? # you can a
if [[ $Offset_rc -ne 0 ]]; then
  echo "Unable to.."
  #exit $Offset_rc # - uncomment if you don't want to continue
                   #   with the script if your ntp command failed
fi

CADate_data=`ntpdate -q $ntp_ip`
if [[ $? -ne 0 ]]; then # direct return code check
  echo "Unable to..,"
fi

case $OS in
        [Linux]*)
Offset=`echo $Offset_data | grep -e '*' | awk '{print $9}'`
CADate=`echo $CADate_data | awk '/nt/ {print $0}' | awk '{print $10}'`
        ;;
        [SunOS]*)
Offset=`echo $Offset_data | tail -1 | awk '{print $9}'`
CADate=`echo $CADate_data | tail -1 | awk '{print $10}'`
        ;;
        [AIX]*)
Offset=`echo $Offset_data | grep -e '*' | awk '{print $9}'`
CADate=`echo $CADate_data | awk '/nt/ {print $0}' | awk '{print $10}'`
        ;;
esac

TimeDiff=$(echo $Offset - $CADate | bc )
#Output
echo "$Host" "|" "$Date" "|" "$TimeDiff" > NTP.mif


text:
Q: iPhone dev - How far down should I cast? If I have a method that passes an argument of type void * (UIView animation did stop method, has to be a void pointer), or of type id, and I know that the argument is a UIBarButton item, and I need to disable it, [barbuttonitem setEnabled:NO];, should I cast the argument to a UIControl, which is as far as I need to be able to use setEnabled (without a warning), or should I cast it all the way down to UIBarButtonItem? Why?
Thanks!!

A: I'd say cast it to a UIControl, just in case the implementation changes at some point. I'd always cast to the most appropriate interface (not implementation), and UIControl is probably the way to go.

A: UIBarItem is not derived from UIControl, so casting to UIControl really isn't the correct thing to do.  It works because both classes happen to have setEnabled: methods.
Casts are just another form of documentation; they don't affect what happens at runtime.  If you're expecting a UIBarItem then cast it as such.

A: Casting is only telling the compiler that you are expecting a variable of a certain type: It does not cause any changes in the variable passed in. You can cast it to UIBarButtonItem without worries.

A: If i understand Objective-C correctly, you can call setEnabled directly on the object; you just won't get a guarantee that the call will go through. But if you know that the object returned is a UIBarItem then you can call it.


text:
Q: Spring Boot + Spring Data with multi tenancy Is it possible to configure Spring Boot to use a MultiTenantConnectionProvider so that each client of my system connects to their own private database?
Specifically I am looking to use the built-in hibernate support for multi-tenancy:

*

*http://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html_single/#d5e4561
And this is an example of the sort of config I am after, but I can't figure out how to use this in a Spring Boot setup:

*

*Manage Connection Pooling in multi-tenant web app with Spring, Hibernate and C3P0
I've tried adding these properties to application.properties:
spring.jpa.hibernate.multiTenancy=DATABASE
spring.jpa.hibernate.tenant_identifier_resolver=com.mystuff.MyCurrentTenantIdentifierResolver
spring.jpa.hibernate.multi_tenant_connection_provider=com.mystuff.MyMultiTenantConnectionProviderImplX

I've also tried coding up my own CurrentTenantIdentifierResolver and MultiTenantConnectionProvider and tried serving these up from my main @Configuration bean:
@Bean
public CurrentTenantIdentifierResolver currentTenantIdentifierResolver() {
    return new CurrentTenantIdentifierResolver() {
        public String resolveCurrentTenantIdentifier() {
            // this is never called ...
        }
        public boolean validateExistingCurrentSessions() {
            // this is never called ...
        }
    };
}

@Bean
public MultiTenantConnectionProvider multiTenantConnectionProvider() {
    return new AbstractMultiTenantConnectionProvider() {
        protected ConnectionProvider getAnyConnectionProvider() {
            // this is never called ...
        }
        protected ConnectionProvider selectConnectionProvider(String s) {
            // this is never called ...
        }
    };
}

None of this seems to have any affect so my question is really how to get spring-boot / spring-data to use these multi-tenant classes?
Thanks for your help!

A: Any property for JPA/Hibernate that isn't defined can be set using the spring.jpa.properties property in the application.properties.
The sample you link to has 3 properties for multitenancy:
<prop key="hibernate.multiTenancy">SCHEMA</prop>
<prop key="hibernate.tenant_identifier_resolver">com.webapp.persistence.utility.CurrentTenantContextIdentifierResolver</prop>
<prop key="hibernate.multi_tenant_connection_provider">com.webapp.persistence.utility.MultiTenantContextConnectionProvider</prop>

That converted to Spring Boot would be the following properties in the application.properties file.
spring.jpa.properties.hibernate.multiTenancy=SCHEMA
spring.jpa.properties.hibernate.tenant_identifier_resolver=com.mystuff.MyCurrentTenantIdentifierResolver
spring.jpa.properties.hibernate.multi_tenant_connection_provider=com.webapp.persistence.utility.MultiTenantContextConnectionProvider

For your situation (as stated in your question).
spring.jpa.properties.hibernate.multiTenancy=DATABASE
spring.jpa.properties.hibernate.tenant_identifier_resolver=com.webapp.persistence.utility.CurrentTenantContextIdentifierResolver
spring.jpa.properties.hibernate.multi_tenant_connection_provider=com.mystuff.MyMultiTenantConnectionProviderImplX

It will not work with Spring manged beans as hibernate controls the lifecycle of those instances.
For more properties see the the Spring Boot reference guide.


text:
Q: Java - Variable used in class constructor not being used I'm trying to make a connect-4 game and this is the class that is supposed to keep track of whose turn it is.
turnIdentify.java
public class turnIdentify{
public turnIdentify(){
    int turn = 0;
}

//prints whose turn it is to move, then increments the turn.
private void sayTurn(int a){
    if(a == 0 || a%2 == 0){
        System.out.print("It is X's Turn.");
    }else{
        System.out.println("It is O's Turn.");
    turnIncrement(a);
}}
//increments turn by 1+b
private void turnIncrement(int b){
    turn = b+1;
}}

What I plan to do is to call sayTurn(turn); in the main file to print whose turn it is to play, and by doing so call turnIncrement(Turn) to increase the turn. That way, when sayTurn is called during the text turn, the value for the turn will have already been incremented. The problem is that the int turn declared in the constructor is not being recognized as the same turn under turnIncrement. Eclipse says "turn cannot be resolved to a variable." How can I make sure that turnIncrement changes the actual turn, not some temporary instance of it? Also, why isn't it recognizing the variable turn?


text:
Q: In what header is rsize_t defined? I know the C11 standard defines rsize_t as size_t in the optional Annex K, but in what header file(s)? Where does the C standard say this type should be defined?

A: K.3.3  Common definitions <stddef.h>

*

*The header <stddef.h> defines a type.

*The type is rsize_t which is
  the type size_t .

Quoting the draft.
Reading further, this is also defined in <string.h>, <stdlib.h>, <stdio.h>, <wchar.h> and <time.h>. There may be others.

A: From https://en.wikibooks.org/wiki/C_Programming/stddef.h
stddef.h is a header file in the standard library of the C programming language that defines the macros NULL and offsetof as well as the types size_t, wchar_t, and ptrdiff_t.
rsize_t is define in stdlib.h


text:
Q: How to create a clear button out out imageview? So im currently doing a project that is due soon.
it consists of making a phone app with number buttons etc..
One of the questions that the teacher asked us is to add a Imageview and use it as a button to clear the TextView when there is 10 characters or over.
any help is appreciated, I'm still very new to Android coding so my knowledge is very bad haha
here is my Java code:
    Button no1,no2,no3,no4,no5,no6,no7,no8,no9,no0;
    TextView tv1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        no1=(Button) findViewById(R.id.no1);
        no2=(Button) findViewById(R.id.no2);
        no3=(Button) findViewById(R.id.no3);
        no4=(Button) findViewById(R.id.no4);
        no5=(Button) findViewById(R.id.no5);
        no6=(Button) findViewById(R.id.no6);
        no7=(Button) findViewById(R.id.no7);
        no8=(Button) findViewById(R.id.no8);
        no9=(Button) findViewById(R.id.no9);
        no0=(Button) findViewById(R.id.no0);
        tv1=(TextView)findViewById(R.id.tv1);

        no1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tv1.setText(tv1.getText()+"1");
            }
        });
        no2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tv1.setText(tv1.getText()+"2");
            }
        });
        no3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tv1.setText(tv1.getText()+"3");
            }
        });
        no4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tv1.setText(tv1.getText()+"4");
            }
        });
        no5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tv1.setText(tv1.getText()+"5");
            }
        });
        no6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tv1.setText(tv1.getText()+"6");
            }
        });
        no7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tv1.setText(tv1.getText()+"7");
            }
        });
        no8.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tv1.setText(tv1.getText()+"8");
            }
        });
        no9.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tv1.setText(tv1.getText()+"9");
            }
        });
        no0.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tv1.setText(tv1.getText()+"0");
            }
        });
    }
}

And here Is my XML:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/tv1"
        android:layout_width="262dp"
        android:layout_height="85dp"
        android:layout_marginTop="4dp"
        android:gravity="center|right"
        android:textSize="30sp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:maxLength="10"
        android:inputType="phone" />

    <ImageView
        android:id="@+id/btnclear"
        android:layout_width="79dp"
        android:layout_height="73dp"
        android:layout_marginStart="20dp"
        android:layout_marginTop="16dp"
        android:clickable="true"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:srcCompat="@drawable/phone_on" />

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="345dp"
        android:layout_height="404dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.994">

        <Button
            android:id="@+id/no7"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:text="7"
            android:textSize="30sp"
            app:layout_constraintBottom_toTopOf="@+id/no4"
            app:layout_constraintEnd_toStartOf="@+id/no8"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <Button
            android:id="@+id/no8"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:text="8"
            android:textSize="30sp"
            app:layout_constraintBottom_toTopOf="@+id/no5"
            app:layout_constraintEnd_toStartOf="@+id/no9"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/no7"
            app:layout_constraintTop_toTopOf="parent" />

        <Button
            android:id="@+id/no9"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:text="9"
            android:textSize="30sp"
            app:layout_constraintBottom_toTopOf="@+id/no6"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/no8"
            app:layout_constraintTop_toTopOf="parent" />

        <Button
            android:id="@+id/no4"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:text="4"
            android:textSize="30sp"
            app:layout_constraintBottom_toTopOf="@+id/no1"
            app:layout_constraintEnd_toStartOf="@+id/no5"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/no7" />

        <Button
            android:id="@+id/no5"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:text="5"
            android:textSize="30sp"
            app:layout_constraintBottom_toTopOf="@+id/no2"
            app:layout_constraintEnd_toStartOf="@+id/no6"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/no4"
            app:layout_constraintTop_toBottomOf="@+id/no8" />

        <Button
            android:id="@+id/no6"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:text="6"
            android:textSize="30sp"
            app:layout_constraintBottom_toTopOf="@+id/no3"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/no5"
            app:layout_constraintTop_toBottomOf="@+id/no9" />

        <Button
            android:id="@+id/no1"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:text="1"
            android:textSize="30sp"
            app:layout_constraintBottom_toTopOf="@+id/etoile"
            app:layout_constraintEnd_toStartOf="@+id/no2"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/no4" />

        <Button
            android:id="@+id/no2"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:text="2"
            android:textSize="30sp"
            app:layout_constraintBottom_toTopOf="@+id/no0"
            app:layout_constraintEnd_toStartOf="@+id/no3"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/no1"
            app:layout_constraintTop_toBottomOf="@+id/no5" />

        <Button
            android:id="@+id/no3"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:text="3"
            android:textSize="30sp"
            app:layout_constraintBottom_toTopOf="@+id/Hashtag"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/no2"
            app:layout_constraintTop_toBottomOf="@+id/no6" />

        <Button
            android:id="@+id/etoile"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:text="*"
            android:textSize="30sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/no0"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/no1" />

        <Button
            android:id="@+id/no0"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:text="0"
            android:textSize="30sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/Hashtag"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/etoile"
            app:layout_constraintTop_toBottomOf="@+id/no2" />

        <Button
            android:id="@+id/Hashtag"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:text="#"
            android:textSize="30sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.5"
            app:layout_constraintStart_toEndOf="@+id/no0"
            app:layout_constraintTop_toBottomOf="@+id/no3" />
    </androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

And heres a Screenshot of my design:
Design part
Thanks for the help

A: First, you will need to make your ImageView clickable in the XML:
android:clickable="true"

You can then set the OnClickListener on the ImageView like you did for the rest of your Buttons.


text:
Q: Running Windows 8 in Ubuntu 10.04 I would like to try Windows 8 on Ubuntu 10.04 in virtualbox ose I have Windows 7 previously installed along with Ubuntu in pc. Now when I started virtual machine I got the error.

I opened bios utility for checking VT-X and no-execute memory protection. But can't find it. My pc use AMD sempron.
This is what I see in securAble using Wine

How can I fix this error?

A: Your system doesn't support hardware virtualization. Windows 8 requires hardware virtualization enabled.
Short of changing your processor, there isn't you can do.

A: My AMD Sempron 140 does have hardware virtualization; however it may work only when the processor has been "unlocked".
Many AMD Sempron single-core chips are actually dual-core chips with the second core and some features (like virtualization) disabled at startup. The system BIOS can easily re-enable the second core along with the other features, and many desktop motherboards which support the AMD Sempron can perform this unlocking. Once unlocked, the processor will identify as an Athlon II X2 and should show virtualization enabled.
Note well that AMD does not advertise support for either virtualization or the second CPU core for Sempron chips, so your particular CPU may not actually have the support.


text:
Q: Find finite groups $G\cong Aut(G)$ I become interested in this problem because $G\cong Aut(G)$ suggests a special symmetry in $G$ (This kind of group describes its own symmetry).
From $G/Z(G)\cong Inn(G)$ we know complete group is the answer for the simplest case, though this class of group itself is quite weird.
What about the case when $Z(G)$ or $Out(G)$ are non-trivial? $G\cong D_8$ is a good example for non-complete group satisfy $G\cong Aut(G)$.
Is there any method to find such non-complete $Aut$-invariant $G$? Maybe we can try apply $Aut$ iteratively to some G and look for fixed points (some interesting results for centerless or non-abelian simple groups can be found at this MO post).
And what other interesting properties does this class of group have?

A: Let's call a group $G$ quasicomplete if $Z(G) \ne 1$ and $G \cong {\rm Aut}(G)$.
If $H$ is a complete group with a unique subgroup of index $2$, then $H \times C_2$ is quasicomplete. I have checked that all quasicomplete groups of small order (order less than $768$ so far) apart from $D_8$ have this form. There are lots of $H$ with this property, such as $S_n$ for $n>6$, or ${\rm PGL}(2,p)$ for odd primes $p \ge 5$, or the semidirect product $C_p \rtimes C_{p-1}$ (with faithful action) for odd primes $p$.
Another infinite class of examples is $H \times D_8$, where $H$ is a complete group with no subgroup of index $2$. Again, there are lots of examples of $H$, including some simple groups, such as ${\rm Sp}(2n,2)$ for $n \ge 3$, and there are also complete groups of odd order.
So the question is, are there are any (finite) quasicomplete groups that are not of one of these two types? Of course, this is a more general question than the one about $p$-groups in the Kourovka Notebook.


text:
Q: Eclipselink & Spring Data I am trying to implement a solution using a combination of eclipselink (2.4.0) and spring-data-jpa (1.1.0.RELEASE).  However, every time I deploy the solution (Tomcat 7), I get the following exception:
Caused by: java.lang.IllegalArgumentException: No [ManagedType] was found for
the key class [com.acme.domain.entities.User] in the Metamodel - please
verify that the [Managed] class was referenced in persistence.xml using a
specific <class>com.acme.domain.entities.User</class> property or a global
<exclude-unlisted-classes>false</exclude-unlisted-classes> element.

It appears to occur when the repository autowiring takes place (code examples below):
Service class
@Component
public class UserDataService {

    @Autowired
    private UserRepository userRepository;

    ...
}

Entity class
package com.acme.domain.entities;

...

@Entity
@Table(name = "users")
public class User implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "user_id")
    private Integer id;

    ...

}

persistence.xml
<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>com.acme.domain.entities.User</class>

    ...
</persistence-unit>

Can this be due to some conflict between spring and eclipselink?
UPDATE:
Stacktrace...
[#|2012-07-31 16:25:02,317|ERROR|pool-2-thread-40|org.springframework.web.context.ContextLoader|Context initialization failed|#]
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDataService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.acme.data.repositories.UserRepository com.acme.data.services.UserDataService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: No [ManagedType] was found for the key class [com.acme.domain.entities.User] in the Metamodel - please verify that the [Managed] class was referenced in persistence.xml using a specific <class>com.acme.domain.entities.User</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:897)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:873)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.acme.data.repositories.UserRepository com.acme.data.services.UserDataService.userRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: No [ManagedType] was found for the key class [com.acme.domain.entities.User] in the Metamodel - please verify that the [Managed] class was referenced in persistence.xml using a specific <class>com.acme.domain.entities.User</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:512)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:92)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284)
    ... 27 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: No [ManagedType] was found for the key class [com.acme.domain.entities.User] in the Metamodel - please verify that the [Managed] class was referenced in persistence.xml using a specific <class>com.acme.domain.entities.User</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1442)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:305)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:876)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:818)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:735)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:484)
    ... 29 more
Caused by: java.lang.IllegalArgumentException: No [ManagedType] was found for the key class [com.acme.domain.entities.User] in the Metamodel - please verify that the [Managed] class was referenced in persistence.xml using a specific <class>com.acme.domain.entities.User</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.
    at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.entityEmbeddableManagedTypeNotFound(MetamodelImpl.java:174)
    at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:489)
    at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:58)
    at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:65)
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:149)
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:87)
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:70)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:137)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:125)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:41)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
    ... 37 more

A: I was able to solve my issue but it was another setup as the one above, i just add a few things i stumbled across until i was able to solve it in my SE-Environment:

*

*Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=338837 affects EclipseLink Version 2.2.0 and below versions. Mostly happening in Local-Environment (RESOURCE_LOCAL). A EclipseLink version-Upgrade or the following workaround may help:

<exclude-unlisted-classes>false</exclude-unlisted-classes>

*

*Having multiple persistence.xml files in classpath (e.g. especially in 3th party JARs) that all define the same persistence-unit-name (above "default" may be very common). Try renaming your persistence-unit-name in this case as a first step

*In case of renaming the persistence-unit-name worked but changing it back to the old value reproduces the problem there is either above mentioned 3th party JAR or old JARs of your own project beeing included to your build (e.g. refactoring/ renaming on project level or similar changed the structure so for example a maven build could still take old build artifacts from the repository)
Finaly when it comes to my setup (Spring-Standalone Application, no persistence.xml but tons of Spring-configurations because a custom company Framework is used) it showed that i just forgot to add the the entity-package of the custom framework-core when i wanted to run one of their service-implementations (Spring-Bean implementation) in my local project rather than having their service-implementation from a JAR-dependency. So make sure that you have all of the required entity packages listed for your EntityManagerFactory:
    <bean id="customEntityManagerFactory" parent="abstractEntityManagerFactory">
        <property name="dataSource" ref="dataSource"/>

        <!-- Packages of EntityClasses -->
        <property name="packagesToScan">
            <list merge="true">
                <value>ch.company.div1.foo.bar.model</value>
                <value>ch.company.div1.foo.barnicle.model</value>
                <value>ch.company.div2.we.help.model</value>
            </list>
        </property>

        <property name="jpaProperties">
            <props merge="true">
                <prop key="eclipselink.target-database">org.eclipse.persistence.platform.database.SQLServerPlatform
                </prop>
                <prop key="javax.persistence.transactionType">RESOURCE_LOCAL</prop>
            </props>
        </property>
     </bean>

In my case i forgot to add the model packagege with the used entitys of another division (that writes the custom framework core) of our company.
Good luck, that error's a beast :/

A: Not sure if you are having the same problem I had: trying to create 2 different entity factories... The exception is the same, so maybe this will help. Essentially this exception was happening when it was instantiating an Entity on the wrong EntityManagerFactory.
My project was running fine with a single database connection but when I added a second one EclipseLink was confused on where to instantiate my entities. After a few debug my conclusion was to remove the property "packagesToScan" from my root-context.xml and replace it with a "persistenceXmlLocation". In that XML, I listed every class I needed to be scanned and excluded everything else with "<exclude-unlisted-classes>"
Here is my full XML configuration that is currently working:
root-context.xml
<bean id="dataSource1" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="org.postgresql.Driver" />
    <property name="url" value="jdbc:postgresql://server1.example.com:5432/db1" />
    <property name="username" value="username" />
    <property name="password" value="password" />
    <property name="defaultAutoCommit" value="false" />
    <property name="initialSize" value="5" />
    <property name="maxIdle" value="5" />
    <property name="validationQuery" value="SELECT 1" />
    <property name="timeBetweenEvictionRunsMillis" value="600000" />
    <property name="poolPreparedStatements" value="true" />
    <property name="maxOpenPreparedStatements" value="10" />
</bean>

<bean id="dataSource2" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="org.postgresql.Driver" />
    <property name="url" value="jdbc:postgresql://server2.example.com:5432/db2" />
    <property name="username" value="user" />
    <property name="password" value="password" />
    <property name="defaultAutoCommit" value="false" />
    <property name="initialSize" value="5" />
    <property name="maxIdle" value="5" />
    <property name="validationQuery" value="SELECT 1" />
    <property name="timeBetweenEvictionRunsMillis" value="600000" />
    <property name="poolPreparedStatements" value="true" />
    <property name="maxOpenPreparedStatements" value="10" />
</bean>

<bean id="emf1" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource1" />
    <property name="persistenceXmlLocation" value="classpath:META-INF/persistence1.xml" />
    <property name="jpaVendorAdapter">
        <bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
            <property name="showSql" value="false" />
        </bean>
    </property>
    <property name="jpaPropertyMap">
        <map>
            <entry key="eclipselink.weaving" value="false" />
            <entry key="eclipselink.logging.level" value="WARNING" />
            <entry key="eclipselink.logging.timestamp" value="false" />
            <entry key="eclipselink.logging.session" value="false" />
            <entry key="eclipselink.logging.thread" value="false" />
        </map>
    </property>
    <property name="loadTimeWeaver">
        <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
    </property>
</bean>

<bean id="emf2" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource2" />
    <property name="persistenceXmlLocation" value="classpath:META-INF/persistence2.xml" />
    <property name="jpaVendorAdapter">
        <bean class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
            <property name="showSql" value="false" />
        </bean>
    </property>
    <property name="jpaPropertyMap">
        <map>
            <entry key="eclipselink.weaving" value="false" />
            <entry key="eclipselink.logging.level" value="WARNING" />
            <entry key="eclipselink.logging.timestamp" value="false" />
            <entry key="eclipselink.logging.session" value="false" />
            <entry key="eclipselink.logging.thread" value="false" />
        </map>
    </property>
    <property name="loadTimeWeaver">
        <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
    </property>
</bean>

<bean name="transaction1" class="org.springframework.orm.jpa.JpaTransactionManager" p:entity-manager-factory-ref="emf1" />
<bean name="transaction2" class="org.springframework.orm.jpa.JpaTransactionManager" p:entity-manager-factory-ref="emf2" />

<jpa:repositories base-package="org.myproject.repository1" transaction-manager-ref="transaction1" entity-manager-factory-ref="emf1" />
<jpa:repositories base-package="org.myproject.repository2" transaction-manager-ref="transaction2" entity-manager-factory-ref="emf2" />

<tx:annotation-driven />

persistence1.xml
<persistence-unit name="persistence1" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>org.myproject.repository1.Repo1</class>
    <class>org.myproject.repository1.Repo2</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>

persistence2.xml
<persistence-unit name="persistence2" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>org.myproject.repository2.Repo1</class>
    <class>org.myproject.repository2.Repo2</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>

So, this works for me...
Apparently specifying each "persistence.xml" location prevents classes that are meant for another EntityManagerFactory to be instantiated on the first "emf". In fact, this looks like a bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=338837. All I could figure out from my debugging is that without the "persistenceXmlLocation" ALL classes that are found with "packageScan" were instantiated on the first created "emf", the second "emf" was completely ignored.
Hope this helps. Good luck!

A: Add the package (com.acme.domain.entities) with entities to packagesToScan.

A: Set the PersistenceUnitName, instead of the persistenceXmlLocation
No persistence.xml needed.
factory.setPersistenceUnitName("dummy1");
factory.setPersistenceUnitName("dummy2");


text:
Q: Preventing the user to re-open(click) a button after certain forms filled up I have a Management Information System for our Software Engineering. Here's what I want to happen. After I enter the customer's basic info, his/her record (with ID) will show up in the customer list. And next to it are 2 buttons, first button is for 'Contract 1' and the second one is 'Contract 2'. After I filled up either one of the contracts, I want the button not to be clickable.
(Another explanation)
If a contract is empty, make the 'button' clickable so the user can add. But after it is filled, the button will not be accessible anymore.
I think you may need this code
<?php
                    include 'connect-db.php';
                ?>

                    Customer
Number
                    CRC
                    Name
                    Service
Contract
                    Chapel
Contract

                <?php
                    $sql = "SELECT * FROM records ORDER BY CustomerNumber DESC LIMIT 5";
                    $result = mysql_query($sql);
                    if(mysql_num_rows($result) > 0 ){
                        while($row = mysql_fetch_assoc($result)){

                ?>

                                <?=$row['CustomerNumber']?>
                                <?=$row['CRC']?>
                                <?=$row['Name']?>

                                    **<a href="editprocess-service.php?CustomerNumber=<?=$row['CustomerNumber']?>">Add

                                    <a href="editprocess-chapel.php?CustomerNumber=<?=$row['CustomerNumber']?>">Add
                                	**

                <?php
                        }
                    }
                ?>

    <input type="button" value="New Record" style="margin-left: 785px;">

The codes in bold is where I want the magic to happen. Thank you in advance!

A: If you store the contract information in a table field then you can use PHP functions to check if value is set.
if(isset($row['contract'])) {
     //echo disabled button
} else {
     //eco interactable button
}

A: Yes simply disable onclick
<button id="myBtn"onclick="myFunction()">My Button</button>


text:
Q: remove/change selector value based on screen size I have 1 line of code that used a selector for my parallax image
here is the code

Interactive & Identity

ECTECIANT IS MADE UP OF A NETWORK OF FREELANCERS. OUTSTANDING CREATIVE DIRECTORS, ART DIRECTORS, WEB DESIGNERS, DEVELOPERS AND ILLUSTRATORS THAT ARE ABLE TO BRING TO OUR PROJECTS THE PERSONALITY AND QUALITY THAT SETS US APART.

the selector is

data-image-src="images/expertise/expertise-head.jpg"

the problem is the image is not responsive, the selector acts like

background-image

in css
So, I'm trying to change the selector src for the image based on the screen size
I know there is a way to get class or id in javascript by using getelementbyid, but is there a way to get the custom selector?


text:
Q: how to list child processes in nodejs How to see list of child processes created by Fork and Spawn in nodejs ?

A: You can either create a list of ChildProcesses, since spawn and fork return ChildProcess you can append a new item to the list just after creating it.
Second option would be to execute a command like ps and parse it's output. 1st option seems better for me, because it will be os independent and you will avoid parsing ps output manually. Also you will have the actuall ChildProcess class which could be usefull.


text:
Q: Google Collab csv file upload pathetically slow I am trying to upload csv file ~1.5 GB to google collab from my local system folder. It took 5 minutes to complete 1% of upload.
import pandas as pd
import datetime as DT
import io
import numpy as np

from google.colab import files
uploaded = files.upload()

Is there a faster way to upload? Thanks

A: Some time ago I also got the same issue
I know one way maybe that one can help you
convert into a zip file
upload it on google drive
extract it using python
!unzip -q file_path


text:
Q: Change the rigidbody constraints with a script I am building a game, I am trying to get it so that when it is touching the player the constraints are changed.
Here is my code
    {
        if (col.gameObject.tag == "player")
        {
            rb.constraints = RigidbodyConstraints.FreezePositionX;// | RigidbodyConstraints.FreezePositionY;
        }
    }

Assets\Scripts\Pick_up.cs(42,30): error CS0266: Cannot implicitly convert type 'UnityEngine.RigidbodyConstraints' to 'UnityEngine.RigidbodyConstraints2D'. An explicit conversion exists (are you missing a cast?)
Would you be able to help me get this working?
Thanks!

    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag == "player")
        {
            rb.constraints = RigidbodyConstraints.FreezePositionX;// |
            RigidbodyConstraints.FreezePositionY;
        }
    }
}

A: RigidbodyConstraints2D and RigidbodyConstraints are different enum types.
you should use
rb.constraints = RigidbodyConstraints2D.FreezePositionX;


text:
Q: how to get row having least value from a table in mysql I have a written a mysql query comprising a couple of joins, and the result is as follows.
id | title | type   |    rent
------------------------------
1    abc     low         100
2    xyz     low         200
2    xyz     mid         150
2    xyz     high        300
3    mno     low         600
3    mno     mid         200

I would like to have result that group (group by) title having 'least rent'.
PLZ help.

I would like to have the following result set
    id | title | type    |    rent
    ------------------------------
    1  |  abc  |   low  |     100
    ------------------------------
    2  |  xyz  |   mid  |     150
    ------------------------------
    3  |  mno  |   mid  |     200
    ------------------------------

A: You can do this:
SELECT t1.*
FROM tablename AS t1
INNER JOIN
(
   SELECT title, MIN(rent) AS minrent
   FROM tablename
   GROUP BY title
) AS t2  ON t1.title = t2.title
        AND t1.rent  = t2.minrent;

SQL Fiddle Demo
This will give you:
| ID | TITLE | TYPE | RENT |
----------------------------
|  1 |   abc |  low |  100 |
|  2 |   xyz |  mid |  150 |
|  3 |   mno |  mid |  200 |

This will give you the least rent for each title.

However: If you are looking for only the tile which has the latest rent then you can do this:
SELECT t1.*
FROM tablename AS t1
ORDER BY rent
LIMIT 1

Updated SQL Fiddle Demo
This will give you this row:
| ID | TITLE | TYPE | RENT |
----------------------------
|  1 |   abc |  low |  100 |

Note that: If there are duplicates Rent that has the same min rent, then this won't give you those duplicate. In this case use the way @user2009463 suggested.

A: select * from table_name
where rent = (select min(rent) from table_name)
group by title;


text:
Q: References for choosing Welch's over Fisher's 1W-ANOVA I learned that the Welch test is equivalent to, or better than, 1-Way ANOVA.
I read about this in this blog, which in turn cites a minitab report. I also found similar arguments in other private-company blogs such as XLSTAT
I want to justify the use of the Welch test over 1W-ANOVA in the manuscript I'm writing. Usually, we cite 'academia' articles, but I didn't find much. Could you advise? Is it acceptable to cite the above-mentioned blogs as references to justify the use of one method over another one which has been the standard for many decades?


text: Q: Where can I view the list of all the flags I have raised? I know I'm missing something now as I have seen this page before, but can somebody please provide the direct link to view the list of all the flags I have raised? Thanks.


text:
Q: Convert string to html format? Expecting value  I'm scraping Wikipedia articles. I create a function that returns the texts for each link, I just have to input the link. I want to apply this function to a data frame with links, but I'm getting an error (jsondecodeerror expecting value ) because the format of the links are not html… they are string instead. I have a dataset with multiple links.
Links
https://www.wikipedia.com/
https://www.wikipedia.com/
https://www.wikipedia.com/

I need to convert those links to html formal. Can somebody please suggest a solution?

A: Try this :
import pandas as pd

df = pd.DataFrame({'Links': ['https://www.wikipedia.com/', 'https://www.wikipedia.com/', 'https://www.wikipedia.com/']})

def make_clickable(val):
    return f'{val}'

out = df.style.format({'Links': make_clickable})

>>> display(out)


text:
Q: Springframework: Configure infrastructure bean via xml We need to configure a bean as an infrastructure bean BeanDefinition.ROLE_INFRASTRUCTURE so that it gets considered by the InfrastructureAdvisorAutoProxyCreator.
However we cannot find a way to configure the role of the bean via xml.
Currently we had the bean implement BeanFactoryAware and then set the role inside setBeanFactory, something like this:
    ConfigurableListableBeanFactory configurableListableBeanFactory = (ConfigurableListableBeanFactory) beanFactory;
    AbstractBeanDefinition beanDefinition = (AbstractBeanDefinition) configurableListableBeanFactory.getBeanDefinition("hibernateSessionAnnotationAdvisor");
    beanDefinition.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);

This is obviously not very nice and we would prefer to do this via xml.
Is there maybe a way to use the @Role annotation even though our beans are configured via xml?

A: You could use a BeanFactoryPostProcessor and configure the bean names (or types) that you want to change.
For example:
public class RoleBeanDefinitionConfigurer implements BeanDefinitionRegistryPostProcessor {

    private String[] beanNames;

    @Override
    public void postProcessBeanFactory(
            ConfigurableListableBeanFactory beanFactory) throws BeansException {

    }

    @Override
    public void postProcessBeanDefinitionRegistry(
            BeanDefinitionRegistry registry) throws BeansException {

        if (beanNames == null)
            return;

        for (String name : beanNames) {
            if (registry.containsBeanDefinition(name))
                ((AbstractBeanDefinition) registry.getBeanDefinition(name)).setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
        }
    }

    public String[] getBeanNames() {
        return beanNames;
    }

    public void setBeanNames(String[] beanNames) {
        this.beanNames = beanNames;
    }

}


text:
Q: Why is the value of 'this' undefined in a function inside a constructor? I'm trying to implement my own version of promises in Node.js for practice purposes. I'm getting results that I don't understand. I created the following code to show what my problem is about.
class Person {
  constructor(name) {
    this.name = name

    // console.log(this)

    function sayName() {
      console.log(this.name)
    }

    sayName()
  }
}

const joe = new Person('Joe')

I'm getting the error message 'TypeError: Cannot read property 'name' of undefined'. When I call the constructor, the value of 'this' is the newly created object, so if I would uncomment the commented line, I would log out at that line the object that is getting created.
When I call the sayName function, I would expect the value of 'this' to be the global object. In most cases that I've seen it's safe to assume that when you start defining a new function the value of 'this' is the global object. But here it is 'undefined', hence I get the error message.
If I do the same without using the class keyword, and I put the sayName function to the constructor, it behaves as expected, and logs 'undefined', as there is no name property defined on the global object.
function Person(name) {
  this.name = name

  function sayName() {
    console.log(this.name)
  }

  sayName()
}

const joe = new Person('Joe')

I know that there are some safety mechanisms that you trigger when you use the class keyword. My best guess that the difference between the two examples that one of those gets triggered without me knowing it.
Please tell me what causes the difference, why is the value of 'this' undefined in the first example! Thank you

A: It looks like function declarations function() {} lose this context when defined within a constructor. I imagine it has something to do with how constructor is implemented behind the scenes. You can add it back with
sayName = sayName.bind(this);
sayName();

or perhaps the better way is to just not to define functions in the constructor and define it as a class method:
sayName() {
  return this.name;
}


text:
Q: SQL - INSERT text into field WHERE ___ I'm looking to add a note to each of my accounts whenever I make contact via a mass email. I'm looking at something like this so far:
INSERT INTO Customer_notes (Note_text)
VALUES ('emailed June 1st')
WHERE Customer_Level = 'Alpha'

This obviously doesn't work, and UPDATE/SET will replace all of my previous notes.

A: Well, you could do something like this:
INSERT INTO Customer_notes (Note_text)
    Note_Text = COALESCE(Note_text + '
', '') + 'emailed June 1st')
    WHERE Customer_Level = 'Alpha';

However, it seems like you need more than one note per customer.  So perhaps:
INSERT INTO Customer_notes (Customer_Level, Note_text)
    VALUES ('Alpha', Note_Text);

This is assuming that Customer_Level is some sort of customer id.

A: If you mean add that text to whatever currently exists in Note_text for existing rows, then try this..
UPDATE Customer_notes
SET Note_text = ISNULL(Note_text, '') + ' emailed June 1st'
WHERE Customer_Level = 'Alpha'

{edit based on the fifth comment in this answer}
Ok, then instead of VALUES we are SELECTing off of the same table.  Try this (Holy Gawd make a backup first) if the idea is to create another row with EVERY row WHERE Customer_Level = 'Alpha' in this table.

INSERT INTO Customer_Notes (CustomerID, note_text)
SELECT CustomerID, 'emailed June 1st'
FROM CustomerNotes
WHERE Customer_Level = 'Alpha'

This does beg the question if Customer_Level is a subset of all customers, and if the idea here is to only insert one row for EACH of these customers, as opposed to ONE row for each customber/existing rows.  You'll have to describe this further for us if this is the case.


text:
Q: Count number of ones in an array of bits I want to count the number of ones in a packed array. I came up with the following code:
https://www.edaplayground.com/x/2Va6
I think it can be done easier. Any suggestion?
 typedef bit bit6_t[5:0];

 module test_rand;
     bit [5:0] mask_packed;
     bit mask_packed_bit[5:0];
     int mask_unpacked[5:0];
     initial begin
       mask_packed = $urandom_range(((2**6)-1),0);
       mask_packed_bit = bit6_t'(mask_packed);
       foreach (mask_packed_bit[i]) begin mask_unpacked[i] = int'(mask_packed_bit[i]); end
       $display("*********************************");
       $display("mask_packed   = %p",mask_packed);
       $display("mask_unpacked     = %p",mask_unpacked);
       $display("mask_unpacked.sum = %p",mask_unpacked.sum());
       $display("*********************************");
     end
 endmodule

A: 1) For plain verilog code:
Your last implicit $cast to 'int is unnecessary. Since you only want the sum, you can:
typedef bit bit6_t[5:0];

module test_rand;
    bit [5:0] mask_packed;
    bit mask_packed_bit[5:0];
    int sum = 0;
    initial begin
      mask_packed = $urandom_range(((2**6)-1),0);
      mask_packed_bit = bit6_t'(mask_packed);
      foreach (mask_packed_bit[i]) begin sum += mask_packed_bit[i]; end
      $display("*********************************");
      $display("mask_packed   = %p",mask_packed);
      $display("mask_packed_bit   = %p",mask_packed_bit);
      $display("sum = %p",sum);
      $display("*********************************");
    end
endmodule

Working example: https://www.edaplayground.com/x/5ZTW
2) If you are using systemverilog, you can use the simple $countones function.
module test_rand;
    bit [5:0] mask_packed;
    initial begin
      mask_packed = $urandom_range(((2**6)-1),0);
      $display("*********************************");
      $display("mask_packed   = %p",mask_packed);
      $display("countones = %p", $countones(mask_packed));
      $display("*********************************");
    end
endmodule

Working example: https://www.edaplayground.com/x/2Nsd

A: You can try the following
typedef bit bit6_t[5:0];

module test_rand;
    bit [5:0] mask_packed;
    bit6_t mask_unpacked;
    initial begin
      mask_packed   = $urandom_range(((2**6)-1),0);
      mask_unpacked = bit6_t'(mask_packed);
      $display("*********************************");
      $display("mask_packed   = %p",mask_packed);
      $display("mask_unpacked   = %p",mask_unpacked);
      $display("mask_unpacked.sum = %p",mask_unpacked.sum() with (int'(item)));
      $display("*********************************");
    end
endmodule

Working example: https://www.edaplayground.com/x/5cXx


text:
Q: Detect the event on page load jquery I have the following which is working fine, just need a bit of change that if i refresh a page and the dropdown already has a selcted of yes, just execute the code, right now, i am just doing the code on the change request.
$('#internalNoteopen').bind('change load',function() {
        var str = $('#internalNoteopen').val();
        if (str == 'Yes') {
            $('#note').show('slow');
        }
        else {
            $('#note').hide('slow');
        }
    });

I have myself added the load event to see if that works, but that is not working, maybe some kind of on event could work, but not sure how it will work.
Guide me please

A: You can trigger the change event on page load:
$('#internalNoteopen').bind('change load',function() {
    var str = $('#internalNoteopen').val();
    if (str == 'Yes') {
        $('#note').show('slow');
    }
    else {
        $('#note').hide('slow');
    }
}).trigger('change'); // or .change()


text:
Q: Hive - How can I stop logs displaying in console? I have been trying to omit logs from console while querying in hive, but still it is showing up.

A: If you are opening the hive console by typing
> hive

in your terminal and then write queries, you can solve this by simply using
> hive -S

This basically means that you are starting hive in silent mode.
Hope that helps.

A: You could increase the polling interval to minutes or hours:
SET hive.exec.counters.pull.interval=[millis];

The default is 1000 milliseconds, but you can increase it to anything you like. That should decrease the number of logs written to stdout.

A: If you don't want any logs on the console while starting the shell you can set the hive.root.logger property
$HIVE_HOME/bin/hive --config hive.root.logger=INFO,DRFA

hive.root.logger specifies the logging level as well as the log
  destination. Specifying console as the target sends the logs to the
  standard error (instead of the log file).

If you want to see ERROR messages on console you can set this command
$HIVE_HOME/bin/hive --config hive.root.logger=ERROR,console

A: Start hive in silent mode using
$ hive -S

then Set logger level to Error, which will avoid Warnings/Info from printing.
hive> set logger.PerfLogger.level = ERROR;

A: If there is "SLF4J: Class path contains multiple SLF4J bindings." in your log, it means that there are multiple log4j jars (different versions, different behaviors) in the class path
I don't know the principle of log4j, but according to the Hadoop configuration file, perform the following steps:
cd $HIVE_HOME/conf

cat > log4j.properties <<EOL
log4j.rootLogger=WARN, CA

log4j.appender.CA=org.apache.log4j.ConsoleAppender

log4j.appender.CA.layout=org.apache.log4j.PatternLayout
log4j.appender.CA.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
EOL

After starting hive (Hive 3.1.2 Apache), the log is set to WARN level, which may not necessarily work, but you can try it.