text:
Q: What's the proper mathematical form for the sum of forces equation? I handed in a paper on the Second Law of Physics with a form I found in a textbook.  It described the Second Law as a "Sum of Forces":
$$\sum_i F_i=ma$$
My teacher says this is incorrect because the force law is a 'vector' law.  I'm confused about this because I thought the result of a sum was a scalar. What is the right way to think about the "sum of forces" equation?  Why does my textbook give this form if it's not correct?

A: A mathematical vector obeys two laws of algebra.

*

*Scalar law - The multiplication of a scalar value $\lambda$ with a vector $\mathbf{a}$ is a vector where each element is multiplied (individually).

$$ \lambda \mathbf{a} =\lambda \pmatrix{a_1 \\ a_2 \\ \vdots \\ a_n} = \pmatrix{\lambda a_1 \\ \lambda a_2 \\ \vdots \\ \lambda a_n} $$

*

*Adition law - The addition of two vectors $\mathbf{a}$ and $\mathbf{b}$ is a vector where each element is added (individually).
$$ \mathbf{a} + \mathbf{b} = \pmatrix{a_1 \\ a_2 \\ \vdots \\ a_n} +\pmatrix{b_1 \\ b_2 \\ \vdots \\ b_n} = \pmatrix{a_1+b_1 \\ a_2+b_2 \\ \vdots \\ a_n+b_n} $$

A force vector, or a velocity vector, or an acceleration vector still obey the same laws of a mathematical vector.
So the sum of forces is a vector where each component ($x$, $y$ and $z$) are added separately.
$$ \mathbf{F}_1 + \mathbf{F}_2 = \pmatrix{F_{1x} + F_{2x} \\ F_{1y} + F_{2y} \\ F_{1z} + F_{2z} } $$
So the proper form of Newton's second law is
$$ \sum_i \mathbf{F}_i = m\, \mathbf{a}_{\rm C} $$ where point C is the center of mass. This is direct result of the definition of linear momentum as $$\mathbf{p} = m\, \mathbf{v}_{\rm C} $$ and the second law $$\sum_i \mathbf{F}_i = \frac{\rm d}{{\rm d}t} \mathbf{p}$$

A: You are both right, when you work in an inertial frame of reference and the system of interest has a constant mass:
$$\sum_i \vec{F}_i=m\vec{a}$$
If $A=B$ then $B=A$ or "A is B", thus it has also the same dimensions.
In particular, if the forces satisfy: $\vec{F}_i \in \mathbb{R}^N$ then for any finite sum of forces $S = \sum_i \vec{F}_i $ this holds: $S \in \mathbb{R}^N$ (vector spaces are closed under addition). Therefore, we can conclude that $\vec{a} \in \mathbb{R}^N$.
In classical systems $N=3$.
Note: $S$ is also a vector, though I was sloppy to omit the $\vec{}$ sign intentionally.

In general, the second law takes the form $\vec{F} = \frac{d\vec{P}}{dt}$ where $\vec{P}= m \vec{V}$ is the momentum and $\vec{V}$ is the velocity.

A: Force is a vector. So you need to do vector addition i.e. you need to take into account the direction of each force. You may have to break down each force in to its horizontal and vertical components and then add them respectively(not forgetting the directions)
For example if there is an upward force of 10N and downward force of 6N then resultant is 4N
Similarly if one force is horizontal and the other vertical then you need to use the vector addition formula


text:
Q: indexes: update on save or manually? I am on Magento CE 1.8
I am using a 3rd party database to feed my database, as a source for products
that change every day in new issues or updates (availability o not, etc..).
The question is about indexing: should I leave to indexing manually or on save ?
Thanks...

A: By and large...

*

*Update on save will fire some (indexing related) events after a product is saved, so a full reindex won't be necessary after product updates.

*Manual mode won't fire anything, so product updates will run faster, but you'll need to re-index everything in order to see some changes in front end.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Would a high-explosive in a vacuum be less harmful? Putting aside shrapnel effects, I believe that high-explosives cause damage by producing a shockwave. How do shockwaves work in space? I've managed to convince myself that a high-explosive shockwave would work "about the same" by producing a shell of high-speed gas that would arrive at the surface with pretty much the same amount of energy that you'd get in air. Is that right?

A: What is a shock wave?
definition:

A shock wave (also called shock front or simply "shock") is a type of propagating disturbance. Like an ordinary wave, it carries energy and can propagate through a medium (solid, liquid, gas or plasma) or in some cases in the absence of a material medium, through a field such as the electromagnetic field.

This about covers it.
Your thought experiment speaks of an explosive, and it can create a shock wave only if a medium exists to be shocked: sudden almost instantaneous creation of vacuum in air/medium and immediate collapse of that as air/medium rushes to fill it.
The answer to your question

that would arrive at the surface with pretty much the same amount of energy that you'd get in air. Is that right?

is no, it is not right.
To reply to the title question:

Would a high-explosive in a vacuum be less harmful?

one would have to know the number of shrapnel from the explosion, and also if there is dust from the explosive or gas for some reason. From conservation of energy the fragments in vacuum will have larger energy because they will not be pushing against a medium ( to create the shock wave) and if they hit would do more damage. Any dust and gas would also move faster but one would need a detailed model and objective for the explosion to know whether the damage would be the same as in non vacuum.

A: Supposing that the explosive does not contain shrapnel, supposing too that even after the impelling fragments do not encounter liquid, solid or gaseous or electro magnetic field media which all resist and absorb to some degree the released energy--one must consider the fact that such released energy is not radioactive or electromagnetic radiation but merely is mechanical energy only that gives huge momentum to the broken fragments which then go on travelling forever like any other space object with the same amount of energy they start with. If you come across them, they will instantaneously transfer their energy to your body, affecting it to a proportional degree. If they penetrate the body, they will rest inside. Otherwise, they continue to float after the impact but motionlessly only. They will of course always  continue to travel with the speed of the universe.
So, if a media exists around, even though it resists or absorb to some degree the energy of explosion, it also transmits the slightly diminished energy or, as in the case air, the compressed airwaves comprise the shock wave that eventually destroys life or property if it has sufficient strength of force.

A: To every cause (the explosion, which we will limit to its energy it expounds) there has to be an effect. This 'effect' has to be through a 'recipient' which will absorb the energy (from the explosion) and in accordance of the recipients nature the affect will be seen (if Water - it will create waves, if a solid mass it will vibrat, which generates heat). If nothing then it will travel through the ever expanding universe, as you see with the light of the stars.


text:
Q: Translate Spark Schema to Redshift Spectrum Nested Schema Using Apache Spark on an EMR cluster, I have read in xml data, inferred the schema, and stored it on s3 in parquet format.  It is now, essentially, a nested table.
Using Spark, I have the schema.  I now want to be able to create an external table for Redshift Spectrum to query.
How do I convert the schema from the format provided by Spark to that required for a CREATE EXTERNAL TABLE statement for Redshift Spectrum?
As I'm dealing with multiple 'external tables', hand-jamming the schema is not an option.
I've not been able to find any existing tool to do the conversion from Spark schema format to Redshift Spectrum external table format (see Amazon Nested Table Tutorial )
The Spark schema is a pyspark.sql.types.StructType  I can convert a schema schema to json with schema.jsonValue() and write a tool that will do the conversion, but if there's an existing tool for doing this I'd prefer to use that.
Any thoughts / suggestions?

A: I ended up writing a tool to parse the schema from pyspark to Redshift Spectrum.


text:
Q: HTML and CSS how to stop elements rearranging? Hello I have a website that look like this in full window mode:
Before resizing
After resizing window
As you can see everything in the first photo looks good. However in the second photo everything looks good except for the navigation buttons(home, timeline, log in etc). I dont know why they want to resize. I would prefer them to not render like the rest of the html below it. Why does this happen and how can I fix it?


text:
Q: Trying to replace a value in a sheet.row list that I have created from xlrd I imported an excel spreadsheet and I am trying to clean up empty values with default values in all rows in my spreadsheet. I don't need to update the spreadsheet, I just need to set default values because I am using this information to insert into a local database. Whenever I try to do so, it never gets processed correctly. Here is my original iteration of the code:
for root,dirs,files in os.walk(path):
xlsfiles=['1128CNLOAD.xlsx']
#xlsfiles=[ _ for _ in files if _.endswith('CNLOAD.xlsx') ]
print (xlsfiles)
for xlsfile in xlsfiles:
    book=xlrd.open_workbook(os.path.join(root,xlsfile))
    sheet=book.sheet_by_index(0)
    cell=sheet.cell(1,1)
    print (sheet)

    sheet0 = book.sheet_by_index(0)
    #sheet1 = book.sheet_by_index(1)

    for rownum in range(sheet0.nrows):
        print sheet0.row_values(rownum)

    values=()

    print sheet0.nrows

    for row_index in range(1, sheet.nrows):
        if sheet.cell(row_index,4).value == '':
            sheet.cell(row_index,4).value = 0.0
        print sheet.row(row_index)

The code spits returns no errors but nothing gets updated and the cells I am trying to update are still empty.
I also tried to change the loop to just do a value replace for the list which is seen below:
                for row_index in range(1, sheet.nrows):
                if sheet.row(1)[4] == "empty:''":
                    sheet.row(1)[4] = "number:0.0"

When I print after running this update, the list has not changed.
print(sheet.row(1))

[text:u'FRFHF', text:u' ', number:0.15, number:0.15, empty:'', empty:'', number:2.5, number:2.5, empty:'', empty:'']
Thank you for any help and let me know if you have any questions.

A: xlrd isn't really set up to edit the spreadsheet once you have it in memory. You can do it, but you have to use the undocumented internal implementation.
On my version (0.7.1), cells are stored internally to the sheet in a couple of different two-dimensional arrays - sheet._cell_types and sheet._cell_values are the main two. The types are defined by a set of constants in biffh.py, which the xlrd module imports. When you call cell, it constructs a new Cell instance using the value and type looked up for the given row/column pair. You could update those directly, or you could use the put_cell method.
So it looks like this would work:
if sheet.cell_type(1, 4) == xlrd.XL_CELL_EMPTY:
    sheet._cell_types[1][4] = xlrd.XL_CELL_NUMBER
    sheet._cell_values[1][4] = 0.0

Alternately:
if sheet.cell_type(1, 4) == xlrd.XL_CELL_EMPTY:
    sheet.put_cell(1, 4, xlrd.XL_CELL_NUMBER, 0.0, sheet.cell_xf_index(1, 4))

You may need to review the code to make sure this didn't change if you're on a different version.


text:
Q: Proving ratio of sides of two triangles with congruent corresponding angles How to prove that, if each angle in one triangle is congruent to its corresponding angle in another triangle, then the ratios of their corresponding sides will be equal? Thanks in advance.

A: Due to the Sine rule, we know that $$\frac{a}{\sin A}  = \frac{b}{\sin B}  = \frac{c}{\sin C}  $$
(where the upper-case letter angle is opposite the lower-case side)
So the sides of any two triangles with congruent angles will have sides in the ratio $\sin A : \sin B : \sin C$


text:
Q: SQLAlchemy query construction I'm working with a Key model backed by Postgres that is a generic table to hold API keys:
class Key(Model):
    __tablename__ = "keys"
    id = Column(Integer, primarykey=True)
    user_id = Column(Integer, ForeignKey("users.id"))
    brokerage_id = Column(Integer, ForeignKey("brokerages.id"))
    account_id = Column(Integer, ForeignKey("accounts.id"))
    key = Column(String(128))
    value = Column(String(128))

In the below example, user 2 has three keys. All three are associated with brokerage 2 and account 2. This is represented by IDs 4 through 6. For this site, the user has an authentication token plus two query IDs.
id  user_id brokerage_id    account_id      key         value
--------------------------------------------------------------------
4   2       2               2               token       999999999999
5   2       2               2               query_id    888888
6   2       2               2               query_id    777777
7   1       2               3               token       444444444444

I am trying to construct a query so that my result will be modeled as such:
[(user_id, brokerage_id, account_id, token, [query_id_1, query_id_2, ...]), ...]

So for the above example, it would look like this
[(2, 2, 2, 999999999999, [888888, 777777]), (1, 2, 3, 444444444444, [])]

I've got the following queries which select the token and the query_ids
tokens = db.session.query(
    Key.user_id, Key.brokerage_id, Key.account_id, Key.value
).filter(Key.key=='token').all()

query_ids = db.session.query(
    Key.user_id, Key.brokerage_id, Key.account_id, Key.value
).filter(Key.key=='query_id').all()

I've tried using subquery in various ways but cannot quite get the output to resemble what I need. How can I construct a query to return results in a way that align to my list of tuples, above?
Result
Adding the final working query here thanks to @rfkortekaas
from sqlalchemy.orm import aliased
from sqlalchemy import func, and_

from project.models import Key
from project.extensions import db

key_token = aliased(Key)

q = db.session.query(
    key_token.user_id,
    key_token.brokerage_id,
    key_token.account_id,
    key_token.value.label('token'),
    func.array_agg(Key.value).label('query_ids')
).join(
    Key,
    and_(
        key_token.user_id == Key.user_id,
        key_token.brokerage_id == Key.brokerage_id,
        key_token.account_id == Key.account_id,
        Key.key == 'query_id'
    )
).filter(
    key_token.key == 'token'
).group_by(
    key_token.user_id,
    key_token.brokerage_id,
    key_token.account_id,
    key_token.value
)
results = q.all()

A: You can use the array_agg function from PostgreSQL to create an array of the results:
from sqlalchemy.orm import aliased

key_token = aliased(Key)

stmt = select(key_token.user_id,
              key_token.brokerage_id,
              key_token.account_id,
              key_token.value.label('token'),
              func.array_agg(Key.value).label('query_ids')
              ).join(Key,
                     and_(key_token.user_id == Key.user_id,
                          key_token.brokerage_id == Key.brokerage_id,
                          key_token.account_id == Key.account_id,
                          Key.key == 'query_id'))\
               .where(key_token.key == 'token')\
               .group_by(key_token.user_id,
                         key_token.brokerage_id,
                         key_token.account_id,
                         key_token.value)
keys = session.execute(stmt).all()
for row in keys:
    print(row)

Results in:

user_id
brokerage_id
account_id
token
query_ids

1
2
3
'44'
['4']

2
2
1
'33"
['6']

2
2
2
'99"
['8', '7]

For the following dataset:

user_id
brokerage_id
account_id
key
value

2
2
2
token
'99'

2
2
1
token
'33'

2
2
1
query_id
'6'

2
2
2
query_id
'8'

2
2
2
query_id
'7'

1
2
3
token
'44'

1
2
3
query_id
'4'


text:
Q: Can I use direct 12V batteries to power PCs/cameras/Raspberries instead of converting to AC and then back to DC? I'm planning on building a new house.  One of the things I want to do is to set a special powerline for all high priority electronics like cameras, PCs, Raspberries (for domotic system.)
My idea is to have a power backup system, sort of a Tesla powerwall, but what I was thinking is, what happens if I just get the 12V I need for all those appliances directly from the baterry bank? Instead of converting it with the inverter then back to DC with each individual transformer. It seems like a waste of energy in those processes.
Would it be possible to do it this way? Do I need something to rectify the voltage of the batteries?
This is an example of the connection I want to do:

For Raspberries and cameras I imagine is quite possible to do it, but can I power computers directly in this way? Remove the power supply and connect them directly to the 12V powerline.

A: Conversion wastes energy. So does transferring energy at low voltages due to the high currents involved.
You just need to calculate if your system can do this, and how thick wires you need to provide the required current with low enough losses. So in general, low voltage transfer can cost more in the wiring than high voltage transfer with conversion done at point of load.
Also standard computers can't directly work with only 12V input, they need a power supply to convert input to multiple different voltages that are needed for operation, so you can't just remove the power supply and run it with 12V.

A:
can I power computers directly in this way? Remove the power supply
and connect them directly to the 12V powerline.

If they can work directly off 12 V then yes (I have done this with a laptop by replacing the cells in an 11.1 V battery with a 12 VDC connection) but most desktop computers have a power supply that produces multiple voltages. Boards are available that plug into the motherboard and produce these voltages from a 12 VDC supply.
Most laptop computers run from ~19 VDC. For these you may be able to use a suitably rated voltage booster. However some laptops communicate with the power supply and may not work with a bare DC connection. For these you would have to use an inverter to power them via their mains adapter.


text:
Q: How to put EditText into TextView I have a sentence, user has to put his data into sentence (one word).
I tried to use for it LinearLayout with TextView (beginning of the sentence), EditText with ems=5(here user should put his data), then TextView(end of the sentence) (See the code below). But in this realization it doesn't look appropriate, when we use long sentence and it moves part of it to the next line.
On emulator it looks like:
|Blablabla ________ blablabla|
|                   blabla.  |

It puts the end of the sentence under the second TextView. But I need that the second line starts from the beginning of new line, like:
|Blablabla ________ blablabla|
|blabla.                     |

I tried to use the solution from Git-Hub: flow-text but got that kind of result:

How can I solve this problem? Thanks for watching this post!
XML:
<LinearLayout
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="4dp"
        android:layout_marginTop="4dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingTop="15dp"
            android:paddingRight="5dp"
            android:textSize="20sp"
            android:text="@string/firstPart_1"
            android:id="@+id/textView1"/>

        <EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/name"
            android:textSize="20sp"
            android:inputType="textCapSentences"
            android:paddingTop="2dp"
            android:paddingBottom="6dp"
            android:ems="7"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingTop="15dp"
            android:paddingRight="5dp"
            android:textSize="20sp"
            android:text="@string/firstPart_2"
            android:id="@+id/textView2"/>

    </LinearLayout>

XML (flow-text):
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<ScrollView
    android:layout_width="match_parent"
    android:layout_height="0dip"
    android:layout_weight="1" >

    <uk.co.deanwild.flowtextview.FlowTextView
        android:id="@+id/ftv"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingRight="5dp"
            android:textSize="20sp"
            android:text="блабла"
            android:id="@+id/textView1"/>

        <EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/name"
            android:textSize="20sp"
            android:inputType="textCapSentences"
            android:ems="5"/>
        </LinearLayout>
    </uk.co.deanwild.flowtextview.FlowTextView>
</ScrollView>

A: I think you should use the linear layout (horizontal) for a single line.
     <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
         android:text="fill in the blanks:" />
  <LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal">
      <TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Your name is: "/>
      <EditText
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
            android:ems="5"/>
  </LinearLayout>
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
         android:text="Hello Brother, how are you"  />
</LinearLayout>

It is working as you want. :)

A: Since your text is going to be of rich format as shown in the picture, you can consider using a WebView.
In this case, you can arrange your elements using HTML and use rich texts using CSS styling.
Also you can use WebView mechanisms provided for communication between Java side and JavaScript side, in order to make a bridge from that text box to your Java logics. (Example)


text:
Q: PDO Limit Query Not Working using Binding in Execute I'm trying to get a limit query working. So far I've verified the following:
All input it valid and correct.
The Query works when manually run against MySQL
The Values are Cast to INT. I have even replcated the variables with the int value.
       try {
             $sql = "SELECT * FROM sensor_data WHERE sid=:sid ORDER BY id DESC LIMIT :starting_limit, :recordlimit";
             $core = CoreDB::getInstance();
             $sth = $core->dbh->prepare($sql);
             $sth->execute(array(':sid' => $sensor->getID(),  ':starting_limit' => (int)0, ':recordlimit' => (int)10));
            // $sth->execute(array(':sid' => $sensor->getID()));
             $results = $sth->fetchAll();
             var_dump($sth->rowCount());
             if ($sth->rowCount() > 0) {
                 foreach($results as $row){
                   $id = $row['id'];
                   var_dump($id);
                   }
                 }
               }
               catch(Exception $e){
               }

Any advice is appreciated

A: The only solution I've found is to manually bind params rather than put them in an array in the execute method.
         try {
             $sql = "SELECT * FROM sensor_data WHERE sid=:sid ORDER BY id DESC LIMIT :starting_limit, :recordlimit";
             $core = CoreDB::getInstance();
             $sth = $core->dbh->prepare($sql);
             $sth->bindValue(':sid', $sensor->getID(), PDO::PARAM_INT);
             $sth->bindValue(':starting_limit', 0, PDO::PARAM_INT);
             $sth->bindValue(':recordlimit', 10, PDO::PARAM_INT);
             $sth->execute();
             $results = $sth->fetchAll();
             var_dump($sth->rowCount());
             if ($sth->rowCount() > 0) {
                 foreach($results as $row){
                   $id = $row['id'];
                   var_dump($id);
                   }
                 }
               }
               catch(Exception $e){
               }

If anyone is aware of how to get it working in the execute method please let me know and I will update the answer.


text:
Q: When does pygame.init() ever return something other than (6,0)? Whenever I type pygame.init() in the Python shell, it always (for me) returns (6,0). Is there a reason why and when does it return something other than (6,0)? (From the documentation I think it means the initialization was perfect since there was no fails.)

A: From the documentation:
init() -> (numpass, numfail)

So that would mean that 6 submodules initiated successfully, and 0 failed. There could be more submodules in the future (or less). This is just feedback from the framework that everything is hunky dory, or should be at least.


text:
Q: Spring Batch persist data from step1 to step2 I have thoroughly searched the Spring docs and supporting sites, but have not found and answer to this inquiry; if I want to access and store some values in the ExecutionContext, do I have to write custom databaseItemReader and ItemWriter's that implement the ItemStream or can I use the "out-of-the-box" readers and writers and edit the beans in the spring-batch-context.xml file to do this? Any code examples would be greatly appreciated. Thanks!
http://www.springframework.org/schema/batch/spring-batch-3.0.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">
<import resource="classpath:context-datasource.xml" />

<!-- JobRepository and JobLauncher are configuration/setup classes -->
<bean id="jobRepository"
    class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean" />

<bean id="jobLauncher"
    class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
    <property name="jobRepository" ref="jobRepository" />
</bean>

<!-- ItemReader which reads from database and returns the row mapped by
    rowMapper -->
<bean id="databaseItemReader"
    class="org.springframework.batch.item.database.JdbcCursorItemReader">

    <property name="dataSource" ref="dataSource" />

    <property name="sql"
        value="SELECT PartnerID, ftpUserName, ftpPassword, ftpPath, jobRunTime, jobFrequency FROM tblRosterJobParams" />

    <property name="rowMapper">
        <bean class="com.explorelearning.batch.ParamResultRowMapper" />
    </property>

</bean>

<!-- This was supposed to change to a SavingItemWriter that persists these values to the Step ExecutionContext -->
<bean id="flatFileItemWriter" class="org.springframework.batch.item.file.FlatFileItemWriter"
    scope="step">

    <property name="resource" value="file:csv/ParamResult.txt" />

    <property name="lineAggregator">

        <!--An Aggregator which converts an object into delimited list of strings -->
        <bean
            class="org.springframework.batch.item.file.transform.DelimitedLineAggregator">

            <property name="delimiter" value="," />

            <property name="fieldExtractor">

                <!-- Extractor which returns the value of beans property through reflection -->
                <bean
                    class="org.springframework.batch.item.file.transform.BeanWrapperFieldExtractor">
                    <property name="names" value="PartnerID" />
                </bean>
            </property>
        </bean>
    </property>
</bean>

<!-- Optional JobExecutionListener to perform business logic before and after the job -->
<bean id="jobListener" class="com.explorelearning.batch.RosterBatchJobListener" />

<!-- Optional StepExecutionListener to perform business logic before and after the job -->
<bean id="stepExecutionListener" class="com.explorelearning.batch.ParamResultStepExecutionListener" />

<!-- Optional ItemProcessor to perform business logic/filtering on the input records -->
<bean id="itemProcessor" class="com.explorelearning.batch.ParamResultItemProcessor" />

<!-- Step will need a transaction manager -->
<bean id="transactionManager"
    class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" />

<!-- Actual Job -->
<batch:job-repository id="jobRepository"  data-source="dataSource" table-prefix="BATCH_"
    transaction-manager="transactionManager" isolation-level-for-create="SERIALIZABLE" />
<batch:job id="RosterBatchJob" job-repository="jobRepository">
 <batch:step id="readParams" >
    <batch:tasklet transaction-manager="transactionManager" allow-start-if-complete="true">
        <batch:chunk reader="databaseItemReader"  writer="flatFileItemWriter"
            processor="itemProcessor" commit-interval="10" />
    </batch:tasklet>
 </batch:step>
 <!--<batch:step id="grabCSVs" next="validateCSVs">

 </batch:step>
 <batch:step id="validateCSVs" next="filterRecords">

 </step>
 <batch:step id="filterRecords" next="determineActions">

 </batch:step>
  <batch:step id="determineActions" next="executeActions">

 </batch:step>
  <batch:step id="executeActions" next="">

 </batch:step>  -->

</batch:job>

A: Updated now that the question has more detail...
Okay, the way I'm reading your context file, you need to:

*

*Get some FTP login info from the Database

*Download some CSV files

*Validate the files (file-level? or just record-level validation?)

*Filter out some garbage records

*Determine some "actions"

*Execute some "actions"

The best way to accomplish this (in my opinion) is to create the following steps:

*

*Step 1: A simple Tasklet that queries the database for FTP login info and then downloads the CSV files to a local folder

*Step 2: Partitioned step that creates one partition per CSV in the folder

*

*Each partition will have a reader (FlatFileItemReader) that reads out records.

*Records will then go to an ItemProcessor that returns null if the record is garbage.

*Valid items will be written to some DB staging table for further action

*Optionally you can use a ClassifierItemWriter to do something w/ the junk records

*Step 3: The next step reads the valid data in the staging table and does "Actions"

*Step 4: Maybe another step to do something with the junk records


text:
Q: matplotlib legend at the bottom of the figure with twinx I am trying to draw a legend under two plots (created using twinx). I want the legend to draw at the bottom center aligned with 4 columns. So far no success.  How can I make the legend with respect to the entire plot, not just with a single axis object. Any help ?
import matplotlib.pyplot as plt;
import numpy as np;
from matplotlib import rc;

filename = 'ml.pdf';

fig, ax1 = plt.subplots(frameon=False);
rc('mathtext', default='regular');
rc('lines',lw=2.6);
rc('lines',mew=2.4);
rc('text', usetex=True);
x = np.array([5,10,20,50]);

dp_g = np.array([23.43, 29.93, 36.50, 46.07]);
mr_g  = np.array([25.33, 31.83, 38.39, 47.75]);
md_g  = np.array([24.94, 31.33, 37.80, 47.10]);
sb_g  = np.array([27.01, 34.86, 43.18, 54.35]);

lns1 = ax1.plot(x,dp_g,'bs:', label="MD\n($\lambda$=.8)");
lns2 = ax1.plot(x,mr_g,'bs--',label="MR\n($\lambda$=.1)");
lns3 = ax1.plot(x,md_g,'bs-.',label='MD');
lns4 = ax1.plot(x,sb_g,'bs-',label="SB\n($\gamma$=.1)");

ax1.set_ylabel('CG ($\times$ 100)',color='b',size=14);
ax1.set_ylim([20,57]);
ax1.set_xlim([4,51]);
ax1.set_xticks(x);
ax1.tick_params(axis='y', which=u'both', length=0, labelsize=14, colors='b');
ax1.tick_params(axis='x', which=u'both', length=0, labelsize=14);

ax2 = ax1.twinx();
dp_d = np.array([18.84, 19.55, 20.09, 20.08]);
mr_d  = np.array([19.42, 19.73, 20.06, 20.04]);
md_d  = np.array([19.02, 19.75, 20.28, 20.29]);
sb_d  = np.array([20.81, 19.77, 19.20, 19.03]);

lns6 = ax2.plot(x,dp_d,'rv:',label="MD\n($\lambda$=.8)");
lns7 = ax2.plot(x,mr_d,'rv--',label="MR\n($\lambda$=.1)");
lns8 = ax2.plot(x,md_d,'rv-.',label='MD');
lns9 = ax2.plot(x,sb_d,'rv-',label="SB\n($\gamma$=.1)");

lns = lns1 + lns2 + lns3 + lns4 + lns6 + lns7 + lns8 + lns9;
labs = [l.get_label() for l in lns];

ax2.set_ylabel('LD ($\times$ 100)',color='r',size=14);
ax2.set_ylim([15,23]);
ax2.set_xlim([4,51]);
ax2.set_xticks(x);
ax2.tick_params(axis='y', which=u'both', length=0, labelsize=14, colors='r');
ax2.tick_params(axis='x', which=u'both', length=0, labelsize=14);

ax1.set_xlabel('\# of items',size=14);
borderaxespad=2.5, ncol = 1, fontsize='11.5');
lgd = ax1.legend(lns, labs, bbox_to_anchor=(1.01,1.0), loc='lower center', borderaxespad=2.5, ncol = 4, fontsize='14');

fig.savefig(filename,format='pdf',transparent=True, bbox_extra_artists=(lgd,), bbox_inches='tight');

A: Apart from the broken line borderaxespad=2.5, ncol = 1, fontsize='11.5');, I believe what you want to do is to just remove the bbox_to_anchor=(1.01, 1.0) from the legend-definition.  Doing so will put the legend at the bottom center of the plot (however the legend is very wide so it will span the entire width of the plot).


text:
Q: Aliased an awk command successfully now won't use OFS So I was able to get a command finally with the ability to get and grep the information from a specific file I wanted and then I ran into a problem with alias:
find ./ -type f -name filename.ext  -exec grep 'information' {} + | sort | awk -v OFS='\n' '{print $5, $1, $2, $3 }'

From there I was able to figure out that I needed to change my alias after looking it up and I did it as such:
find ./ -type f -name filename.ext  -exec grep 'information' {} + | sort | awk -v OFS='\n' '{print \$5, \$1, \$2, \$3 }'

So now it prints but I still wanted to use the OFS but I am not sure the syntax to get the OFS to load. Thanks in advance!
 alias aliascommand="find ./ -type f -name filename.ext  -exec grep 'information' {} + | sort | awk -v \OFS='\t' '{print \$5 \$1 \$2 \$3 }'"

A variation of the above is what I put into my alias.

A: If you do:
alias foo="...'{print $5 $1 $2 $3 }'"

The positional parameters will be expanded when the alias is set. They are within a double-quoted string, after all. You don't want that, so you had to escape them with backslashes. Alternatively, you could have put the whole alias text in single-quotes, but since you want to use single quotes in the alias, that gets rather difficult.
That \n should be fine within the double quotes, though.
In any case, you should probably use a function instead. That way you don't need to think about the extra level of quoting around the commands.
mycommand() {
    find ./ -type f -name filename.ext -exec grep 'information' {} + |
       sort |
       awk -v OFS='\n' '{print $5, $1, $2, $3 }'
}


text:
Q: Paste filtered results on the next empty row in a column I am building a custom template for technicians to use while on the production floor.  What I am attempting to do is filter the results on separate sheets (FTP Results and ATP Results), copy those results to the next empty cell in a specific column in another sheet (Failure Report).  I have both the FTP Results and ATP Results as named ranges (Results and APTResults respectively) as is the Failure Report (Fail_Report_Table).  I need to paste the first two columns of the FTP Results/ATP Results sheets into the first two columns of the Fail_Report_Table(A22:B22) and then the last two columns and paste into the last two columns of Fail_Report_Table (H22:I22).
As for what I have right now, I can get it to work when only pulling from one sheet, but not both.  I can get it to apply the advanced filter to both sheets, but it will only copy the results from ATP Results.  I need to paste the filtered results from FTP Results first, find the next available cell in Columns A and H, then paste filtered results from ATP Results at that point.  The number of filtered values will vary, so the solution has to be dynamic.  I am relatively new to VBA and my code is a bit of a jumbled mess (and I am fairly sure that is part of the problem).
Sub AdvancedFilter()
' Script to apply an advanced filter to multiple worksheets and copy those results to copy to the Failure Report.

 'Declare Variables
  Dim rngCopy As Range
  Dim rngCopyNotes As Range
  Dim rngCopyFailCT As Range

  Dim rngATPCopy As Range
  Dim rngATPCopyNotes As Range
  Dim rngATPCopyFailCT As Range

  Dim NextRow As Long
  Dim Sht As Worksheet

'Filter ATP and FTP Results on (FTP)Results and ATP Results worksheets based on true/false criteria.
 Sheets("Results").Select
 Range("Results").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
    Range("Criteria"), Unique:=True

Sheets("ATP Results").Select
Range("A1:I392").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
    Range("APTCriteria"), Unique:=False

Sheets("Results").Activate
'Set Variables to copy the filtered FTP values to the Failure Report
 Set rngCopy = Sheets("Results").Range("Results_Part1").SpecialCells(xlCellTypeVisible)
 Set rngCopyNotes = Sheets("Results").Range("Results_Part2").SpecialCells(xlCellTypeVisible)

 'Set destination on the Failure Report for Copied FTP Values
  rngCopy.Copy Destination:=Sheets("Failure Report").Range("A21")
  rngCopyNotes.Copy Destination:=Sheets("Failure Report").Range("H21")

'Copy headers from Results to Failure Report
 Sheets("Results").Activate
 Range("A1:B1").Select
 Selection.Copy
 Sheets("Failure Report").Select
 Range("A21:B21").PasteSpecial

 Sheets("Results").Activate
 Range("G1,H1").Select '("J2:I2")
 Selection.Copy
 Sheets("Failure Report").Select
 Range("H21:I21").PasteSpecial

'Copy format from original header cell from Failure Report to imported headers
 Range("D21").Select
 Selection.Copy
 Range("A21:B21").Select ' note that we select the whole merged cell
 Selection.PasteSpecial Paste:=xlPasteFormats

 Range("D21").Select
 Selection.Copy
 Range("H21:I21").Select ' note that we select the whole merged cell
 Selection.PasteSpecial Paste:=xlPasteFormats

 Range("F12").Select
 Sheets("Results").Activate
 Application.CutCopyMode = False
 Range("N34").Select
 Sheets("Failure Report").Activate

    'Set Variables for source ATP Results.
 Set rngATPCopy = Sheets("ATP      Results").Range("APTResults1").SpecialCells(xlCellTypeVisible)
 Set rngATPCopyNotes = Sheets("ATP Results").Range("APTResults2").SpecialCells(xlCellTypeVisible)

 Set Sht = ThisWorkbook.Worksheets("Failure Report")
 NextRow = Sht.Range("Fail_Report_Table").Rows.Count

'Set destination for Copied Values on Failure Report
'Must be set to paste under the last occupied row (copied previously from FTP)
 rngATPCopy.Copy Destination:=Sheets("Failure Report").Range("A21")
 rngATPCopyNotes.Copy Destination:=Sheets("Failure Report").Range("H21")

 Range("F12").Select
 Sheets("ATP Results").Activate
 Application.CutCopyMode = False
 Range("N34").Select

End Sub

A: I think all you need to do is find the next available row for each set of copy and paste you need, then use that row as a variable of where to place the data.
See the code below (notice that you do not need to use Select all the time, but can just work directly with the object itself).
Sub AdvancedFilter()
' Script to apply an advanced filter to multiple worksheets and copy those results to copy to the Failure Report.

     'Declare Variables
    Dim rngCopy As Range, rngCopyNotes As Range
    Dim NextRow As Long
    Dim wsFTP As Worksheet, wsATP As Worksheet, wsFail As Worksheet

    Set wsFTP = Sheets("Results")
    Set wsATP = Sheets("ATP Results")
    Set wsFail = Sheets("Failure Report")

    'Filter ATP and FTP Results on (FTP)Results and ATP Results worksheets based on true/false criteria.
    wsFTP.Range("Results").AdvancedFilter xlFilterInPlace, Range("Criteria"), , True
    wsATP.Range("A1:I392").AdvancedFilter xlFilterInPlace, Range("Criteria"), , True

    'copy FTP results to Failure Report
    Set rngCopy = wsFTP.Range("Results_Part1").SpecialCells(xlCellTypeVisible)
    Set rngCopyNotes = wsFTP.Range("Results_Part2").SpecialCells(xlCellTypeVisible)

    NextRow = wsFail.Range("Fail_Report_Table").Cells(1,1).Row
    rngCopy.Copy wsFail.Range("A" & NextRow)
    rngCopyNotes.Copy wsFail.Range("H" & NextRow)

    'Copy headers from Results to Failure Report
    '### - WHY DO YOU NEED TO COPY HEADERS EACH TIME???? Isn't once sufficient???
    wsFail.Range("A" & NextRow & ":B" & NextRow).Value = wsFTP.Range("A1:B1").Value
    wsFail.Range("G" & NextRow & ":H" & NextRow).Value = wsFTP.Range("G1:H1").Value

    'Copy format from original header cell from Failure Report to imported headers
    wsFTP.Range("D1").Copy
    wsFail.Range("A" & NextRow & ":B" & NextRow).PasteSpecial xlPasteFormats
    wsFail.Range("G" & NextRow & ":H" & NextRow).PasteSpecial xlPasteFormats

    'copy ATP results to Failure Report
    Set rngCopy = wsATP.Range("ATPResults1").SpecialCells(xlCellTypeVisible)
    Set rngCopyNotes = wsATP.Range("ATPResults2").SpecialCells(xlCellTypeVisible)

    NextRow = wsFail.Range("Fail_Report_Table").Cells(1,1).End(xlDown).Offset(1).Row
    rngCopy.Copy wsFail.Range("A" & NextRow)
    rngCopyNotes.Copy wsFail.Range("H" & NextRow)

End Sub


text:
Q: How to touch a file if another file changes I'm looking for something like an event listener on the file system. I want to touch a file (restart.txt to signal Phsuion Passenger to restart) everytime I save another file.
Does anyone know how to accomplish this on Linux (Ubuntu 14.04)?
This is just for Ruby development not for production!

A: from google. There's other solutions available also (fschanged, fileschanged, inotify solutions etc):
https://gist.github.com/mikesmullin/6401258


text:
Q: Exclude vendor files from Simplecov reports I just want to exclude the vendor gems from being shown with the coverage report, how to do that?
Here is how my coverage report looks like:

A: You can exclude the vendors folder adding a filter in the spec_helper.rb or where you define the configuration for SimpleCov
SimpleCov.start 'rails' do
  add_filter 'vendor'
end

A: Here is how I handled it, figured out with their documentation!
SimpleCov.profiles.define 'no_vendor_coverage' do
  load_profile 'rails'
  add_filter 'vendor' # Don't include vendored stuff
end

SimpleCov.start 'no_vendor_coverage'


text:
Q: Powershell get-server -exclude those in a list I have to query 400+ servers to find the business applications/services installed,there is no need for all the default services.
I obtained a list of services from a default system and put those in a csv file, but it doesn't seem to want to exclude them. Here is what I have so far:
{$excludelist = "c:\powershell\service_name.csv"
get-service -ComputerName servername -Exclude $excludelist
| Out-File C:\PowerShell\services.txt}

A: after trying this myself …  Ifound that the exclude property wants the name of the service:
get-service -Exclude (get-service w*).name

Could it be that you are getting more than just the name?

A: Its going to depend on how the CSV is structured. If its simply a list of names you can use Get-Content, as in:
Get-Content -Path $Excludelist

get-service -ComputerName servername -Exclude (Get-Content -Path $Excludelist) | Out-File C:\PowerShell\services.txt

If the CSV is actually a structured CSV, you can use Import-CSV but the property name will depend on the structure.
get-service -ComputerName servername -Exclude (Import-CSV -Path $Excludelist).name | Out-File C:\PowerShell\services.txt

Use get-help to understand what type of data a parameter expects.
Get-Help Get-Service -Parameter ComputerName
-ComputerName <String[]>
    Gets the services running on the specified computers. The default is the local computer.

    Type the NetBIOS name, an IP address, or a fully qualified domain name of a remote computer. To specify the local
    computer, type the computer name, a dot (.), or "localhost".

    This parameter does not rely on Windows PowerShell remoting. You can use the ComputerName parameter of Get-Service
    even if your computer is not configured to run remote commands.

    Required?                    false
    Position?                    named
    Default value                Local computer
    Accept pipeline input?       true (ByPropertyName)
    Accept wildcard characters?  false

In this case its an array of strings (or a single string).


text:
Q: Why doesn't Terraform see my manually installed provider? I'm trying to install the RKE provider as part of the Rancher AWS quickstart. The Terraform documentation says that plugins should be installed at ~/.terraform.d/plugins. The RKE documentation says that the plugin should be installed at ~/terraform.d/plugins/<your_platform>.
Trying to reconcile the conflicting information, I tried copying the binary to all of the following locations, but Terraform never saw any of them:
~/.terraform.d/plugins/terraform-provider-rke
~/.terraform.d/plugins/rke
~/.terraform.d/plugins/darwin_amd64/terraform-provider-rke
~/.terraform.d/plugins/darwin_amd64/rke
~/terraform.d/plugins/terraform-provider-rke
~/terraform.d/plugins/rke
~/terraform.d/plugins/darwin_amd64/terraform-provider-rke
~/terraform.d/plugins/darwin_amd64/rke

In each case, when I ran terraform init, I got the following error:
Provider "rke" not available for installation.

A provider named "rke" could not be found in the Terraform Registry.

This may result from mistyping the provider name, or the given provider may
be a third-party provider that cannot be installed automatically.

In the latter case, the plugin must be installed manually by locating and
downloading a suitable distribution package and placing the plugin's executable
file in the following directory:
    terraform.d/plugins/darwin_amd64

Terraform detects necessary plugins by inspecting the configuration and state.
To view the provider versions requested by each module, run
"terraform providers".

Error: no provider exists with the given name

As a last resort, I could use terraform init -plugin-dir=<something>. But then Terraform doesn't see any of the automatically downloaded plugins, and I have to manually install everything.
Is there some path variable that's missing, or some other naming convention that I am failing to follow?

A: It turns out that the error message didn't tell the whole story. Terraform was finding the provider, but it didn't think it was a new enough version.
According to Terraform's documentation, the provider needs to be named as terraform-provider-<NAME>_vX.Y.Z. The documentation for the RKE provider said that the file should be called terraform-provider-rke (no version number).
In a comment in the Terraform source code for plugin discovery, it says that this versionless format is supported for reverse compatibility. However, Terraform interprets the version to be v0.0.0.
When I ran terraform plan after the failed terraform init, it gave me a more informative error message:
Error: provider.rke: no suitable version installed
  version requirements: "0.14.1"
  versions installed: "0.0.0"

That version is presumably a requirement from another provider that depends on the RKE provider.
I went back and manually downloaded that exact version from the Github repo and copied it into the plugins directory with the name terraform-provider-rke_v0.14.1. It worked!
So there you go. When in doubt, look at the source code. Now to submit an issue report to Rancher, telling them to update their documentation. :-)

A: For Windows Users on Corporate Firewall, where direct download of provider zip file is not permitted.

*

*Simply download provider ZIP file by visiting corresponding URL.

*

*Parent-URL: https://releases.hashicorp.com/

*AWS-URL: https://releases.hashicorp.com/terraform-provider-aws/3.37.0/

*

*Now, in the root directory - main.tf file which contains providers section.

*Create folder structure like registry.terraform.io\hashicorp\aws\3.37.0\windows_amd64 and place extracted exe file from above zip in this location.

*Go to the command line and run:

terraform init -plugin-dir .

Directory structure:

*

*main.tf

*registry.terraform.io\hashicorp\aws\3.37.0\windows_amd64\terraform_provider_aws_v3.37.0_x5.exe

aws_v3.37.0_x5.exe


text:
Q: Why does my C# Process sometimes work, and sometimes hang indefinitely? I've got a block of code that runs inside C# and creates a Process for decompressing (un-gzipping and un-taring) a file. On a fresh reboot of my computer, I can call the block of code below and my file is decompressed within a second or two. However, at some point, the code below completely stops working (until I do a reboot).
Process bashProcess = new Process();
bashProcess.StartInfo.FileName = ConfigurationManager.AppSettings["Util.CygwinPath"];
bashProcess.StartInfo.Arguments = String.Format(
    "--login -c \"tar --overwrite --gzip --directory={0} -xf {1}\"",
    unixPath.Replace(fileName, ""), unixPath);
bashProcess.StartInfo.RedirectStandardError = true;
bashProcess.StartInfo.RedirectStandardInput = true;
bashProcess.StartInfo.RedirectStandardOutput = true;
bashProcess.StartInfo.CreateNoWindow = true;
bashProcess.StartInfo.UseShellExecute = false;
bashProcess.StartInfo.ErrorDialog = false;

bashProcess.Start();
bashProcess.WaitForExit(10000);

I've tried a few things, including:

*

*Grabbing the StandardOutput and logging it, to clear its buffer. (nothing was logged)

*Grabbing the StandardError and logging it, to clear its buffer. (nothing was logged)

*Killing the process afterwards (manually and programatically) in case a previous process was holding on to the file I'm decompressing.

*Deleting and reinstalling the file I'm decompressing, in case it was being held onto by a zombie process.

What could cause the Process to just not work? It doesn't error out, it just hangs indefinitely until the timeout from WaitForExit(10000) is hit.
UPDATE
I'm not logging the final value of bashProcess.StartInfo.Arguments but I have grabbed that value and ensured Cygwin can run it. When ran from Cygwin, the file decompresses as expected. The full command looks like this:
bash.exe --login -c "tar --overwrite --gzip --directory=/cygdrive/mypath/mydir -xf /cygdrive/mypath/mydir/myfile.tar.gz"

I am running the code above straight from Visual Studio 2015.
One other weird thing I've noticed on my machine is that Cygwin's boot time is variable. Right after a fresh reboot, Cygwin can be opened in seconds. After my computer has been running for a while, Cygwin can take upwards of 3 or 5 minutes to open. I wonder if Cygwin's load time and my problem in this question are related?
UPDATE 2
It does appear that my computer's increased slowdown of Cygwin is the source of the problem, although I don't know why Cygwin slows down over time. I noticed that my code above did eventually complete but it took several minutes longer than expected (code above should complete in 1-2 seconds).


text:
Q: Output a custom message during a dpkg package installation I am trying to install create a simple .deb dpkg package.
I have seen multiple packages where, during installation, they output custom messages like Reboot after installation! or Clearing caches or (in the case of iOS) Thanks to [developer]!.
I can't seem to find any way to replicate this myself during installation of my package.
How do I output a custom message to the terminal while dpkg is installing my package?

A: You can do this by providing a postinst script to the package.
See section 7.6 What is a Debian preinst, postinst, prerm, and postrm script?


text:
Q: When to use camera calibration in object detection? I am trying to find the realistic location of an object using yolov5. but idk if I should use OpenCV camera calibration before running detect.py or use it after the model gave me center x and center y of the detected object. if I need to use camera calibration after detection then what function do I have to use?
[Result without camera calibration] (https://i.stack.imgur.com/kLrLB.jpg)
the image on the right is an output of my model. I am focus on the object with details shown in the last line of the text file on the left. since my camera didn't take the image right above these objects then the results.txt shouldn't give the exact location.


text:
Q: Suppose $P\in Syl_p(G)$ is self-centralizing of order $p$. Let $[N_G(P):P]=e$. Then $G$ has at most $e+(p-1)/e$ irred. characters with $p'$-degree. This is Problem 7.6 in M Isaacs' Character Theory of Finite Groups. I'm given $P=\langle x\rangle\in Syl_p(G)$ of order $p$ such that $P=C_G(P)$. Let $N=N_G(P)$ and suppose $[N:P]=e$, which clearly divides $p-1$. Our objective is to show that $G$ has at most $e+(p-1)/e$ irred. characters of degree coprime to $p$.
Any subgroup of $G$ which is a T.I. set (trivial intersection), proper in its own normalizer, and contains the centralizer of every non-identity element is called a T.I.F.N. (trivial intersection Frobenius normalizer) subgroup of $G$. $P$ is T.I.F.N. if $e>1$. If further $1<e<p-1$, Corollary 7.18. of Brauer-Suzuki implies that $\mathscr{S}=\{\chi\in\mathrm{Irr}(N):P\nleq\mathrm{ker}(\chi)\}$ (where $N$ is a Frobenius group with Frobenius kernel $P$.) is coherent (with resepect to induction to $G$). So, the induction map defined on the degree-zero subspace of $\mathbb{Z}[\mathscr{S}]$ can be extended to a linear isometry $*$ on $\mathbb{Z}[\mathscr{S}]$. Moreover, $\chi(1)=e$ for all $\chi\in\mathscr{S}$ and $|\mathscr{S}|=(p-1)/e\geq2$. (It is rather trivial to construct the character table of $N$.)
Fix a $\chi_0\in\mathscr{S}$. Now, if $\psi\in \mathrm{Irr}(G)-\mathscr{E}$, where $\mathscr{E}$ denotes the set of exceptional characters associated with $\mathscr{S}$ and $*$. Lemma 7.19(a) shows that $$\psi_N=[\psi_N,\chi_0]\sum_{\chi\in\mathscr{S}}\chi+\vartheta$$ where $[\vartheta,\chi]=0$ for all $\chi\in\mathscr{S}$.
Clearly $\psi(1)=[\psi_N,\chi_0](p-1)+\vartheta(1)$, whereas$$\psi(x)=[\psi_N,\chi_0]\sum_{\chi\in\mathscr{S}}\chi(x)+\vartheta(x)=-[\psi_N,\chi_0]+\vartheta(x).$$Thus, $$p\mid(\psi(1)-\psi(x))=p[\psi_N,\chi_0]$$ as $\vartheta(x)=\vartheta(1)$.
The author hinted that one should show that $\sum_{\psi\in\mathscr{E}}|\psi(x)|^2\geq p-e$ (equivalently $\sum_{\psi\in\mathrm{Irr}(G)-\mathscr{E}}|\psi(x)|^2\leq e$). I think I know $\sum_{\psi\in\mathscr{E}}|\psi(x)|^2$ is $\mathscr{G}$-invariant, where $\mathscr{G}=Gal(\mathbb{Q}(\zeta_{|G|})/\mathbb{Q})$, & therefore is a rational integer. Since $0\leq\sum_{\psi\in\mathscr{E}}|\psi(x)|^2<p$, it remains to compute $\sum_{\psi\in\mathscr{E}}\psi(1)^2\pmod p$. (Note that I never claimed that $p\mid(\psi(1)-\psi(x))$ for $\psi\in\mathscr{E}$.) Why is it that the least residue of $\sum_{\psi\in\mathscr{E}}\psi(1)^2$ modulo $p$ should be $\geq p-e$? I'm absolutely clueless.
(Edit 1) Just realized that coherence implies Theorem 7.20(d), so that $\psi(1)$ is independent of the choice of $\psi\in\mathscr{E}$. By Thm. 7.20(a), this $\psi(1)$ is the degree of an irred. character of $G$ which is non-constant on $P-\{1\}$. Not sure what to say about this.

A: Thm. 2.13 in Chap. 5 of M. Suzuki's Group Theory tells us that$$\sum_{g\in P-\{1\}}|\psi(g)|^2\geq e(p-e)$$ for all $\psi\in\mathscr{E}$. Summing up over all of $\mathscr{E}$ and noting that$$\sum_{\psi\in\mathscr{E}}|\psi(g)|^2=p-\sum_{\psi\in\mathrm{Irr}(g)-\mathscr{E}}|\psi(g)|^2=p-\sum_{\psi\in\mathrm{Irr}(g)-\mathscr{E}}|\psi(g^\sigma)|^2=\sum_{\psi\in\mathscr{E}}|\psi(g^\sigma)|^2$$for all automorphisms $\sigma$ of $P$, (second equality is due to the fact that non-exceptional characters are constant on $P-\{1\}$.) we see that $\sum_{\psi\in\mathscr{E}}|\psi(x)|^2\geq p-e$ or equivalently $\sum_{\psi\in\mathrm{Irr}(G)-\mathscr{E}}|\psi(x)|^2\leq e$. This & the fact that $p\mid (\psi(1)-\psi(x))$ for all nonexceptional $\psi$ shows that there are at most $e$ nonexceptional irred. characters with $p'$-degree. The result follows.
The case $e=p-1$ is similar since here $p\mid (\psi(1)-\psi(x))$ for all $\psi\in \mathrm{Irr}(G)$ by noting that $p\mid (\chi(1)-\chi(x))$ for all $\chi\in \mathrm{Irr}(N)$. In the case $e=1$, $G$ has a normal $p$-complement(, which is a Frobenius kernel of $G$) by transfer. Here, all the nonlinear characters of $G$ are induced from the Frobenius kernel.
(Edit 1) For the sake of completeness, I worked out the proof of Suzuki's result: Let $\pm\chi^*\in\mathscr{E}$. Then $\chi^*-\chi$ is an integral constant $m$ on $P-\{1\}$ by Thm. 7.20(b). So,\begin{align}
\sum_{g\in P-\{1\}}|\chi^*(g)|^2 & =\sum_{g\in P-\{1\}}|\chi(g)+m|^2\\      & =\sum_{g\in P-\{1\}}|\chi(g)|^2+m^2+2m\mathrm{Re}\chi(g) \\
& =\sum_{g\in P}|\chi(g)|^2 -\chi(1)^2+(p-1)m^2+2m\mathrm{Re}(\sum_{g\in P}\chi(g)-\chi(1))\\& =ep-e^2+(p-1)m^2-2me\geq e(p-e),
\end{align}
where the cases $m\geq0$ and $m<0$ are treated separately.


text:
Q: Liquibase + Spring Data: How to create entities from JPA Is there possibility to create Liquibase scripts from @Entity declaration?
What I want?
When I run 'gradle diffI suppouse liquibase check there is no tableOwneron database, and create record inchangelog` file, then based on this record create table in the database.
I try to use this lib:
https://github.com/liquibase/liquibase-hibernate/wiki
build.gradle:
buildscript {
    dependencies {
        classpath "org.liquibase:liquibase-gradle-plugin:2.0.2"
    }
}

plugins {
    id 'org.springframework.boot' version '2.2.2.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'
    id "org.liquibase.gradle" version "2.0.2"
}

apply plugin: 'org.liquibase.gradle'

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
    compileOnly 'org.projectlombok:lombok'
    implementation 'org.liquibase:liquibase-core'
    runtimeOnly 'javax.xml.bind:jaxb-api'
    compile group: 'io.springfox', name: 'springfox-swagger2', version: swaggerVersion
    compile group: 'io.springfox', name: 'springfox-swagger-ui', version: swaggerVersion
    runtimeOnly 'mysql:mysql-connector-java'
    liquibaseRuntime 'org.liquibase:liquibase-core'
    liquibaseRuntime 'mysql:mysql-connector-java'
    liquibaseRuntime('org.liquibase.ext:liquibase-hibernate5:3.8')
    liquibaseRuntime('org.springframework.boot:spring-boot-starter')
    liquibaseRuntime('org.springframework.boot:spring-boot-starter-data-jpa')
    annotationProcessor 'org.projectlombok:lombok'
}

liquibase {
    activities {
        main {
            driver 'com.mysql.cj.jdbc.Driver'
            url 'jdbc:mysql://localhost:3306/homebudget'
            username 'user'
            password 'pass'
            changeLogFile 'src/main/resources/db/db.changelog-master.xml'
            defaultSchemaName 'homebudget'
            logLevel 'debug'
            changeLogFile 'src/main/resources/db/db.changelog-master.xml'
            referenceUrl 'hibernate:spring:com.homebudget.domain?dialect=org.hibernate.dialect.MySQL5Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy'
        }
    }
}

In my project I have Entity:
com.homebudget.domain.Owner
@Getter
@Setter
@Entity
public class Owner extends BaseEntity {
    private String name;
}

When I run gradle diff I had message:
Reference Database: null @ hibernate:spring:pl.homebudget.domain?dialect=org.hibernate.dialect.MySQL5Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy (Default Schema: HIBERNATE)
Comparison Database: user@172.21.0.1 @ jdbc:mysql://localhost:3306/homebudget (Default Schema: homebudget)
Compared Schemas: HIBERNATE -> homebudget
Product Name:
     Reference:   'Hibernate'
     Target: 'MySQL'
Product Version:
     Reference:   '5.4.9.Final'
     Target: '8.0.18'
Missing Catalog(s): NONE
Unexpected Catalog(s): NONE
Changed Catalog(s):
     HIBERNATE
          name changed from 'HIBERNATE' to 'homebudget'
Missing Column(s): NONE
Unexpected Column(s):
     homebudget.DATABASECHANGELOG.AUTHOR
     homebudget.DATABASECHANGELOG.COMMENTS
     homebudget.DATABASECHANGELOG.CONTEXTS
     homebudget.DATABASECHANGELOG.DATEEXECUTED
     homebudget.DATABASECHANGELOG.DEPLOYMENT_ID
     homebudget.DATABASECHANGELOG.DESCRIPTION
     homebudget.DATABASECHANGELOG.EXECTYPE
     homebudget.DATABASECHANGELOG.FILENAME
     homebudget.DATABASECHANGELOG.ID
     homebudget.DATABASECHANGELOGLOCK.ID
     homebudget.DATABASECHANGELOG.LABELS
     homebudget.DATABASECHANGELOG.LIQUIBASE
     homebudget.DATABASECHANGELOGLOCK.LOCKED
     homebudget.DATABASECHANGELOGLOCK.LOCKEDBY
     homebudget.DATABASECHANGELOGLOCK.LOCKGRANTED
     homebudget.DATABASECHANGELOG.MD5SUM
     homebudget.DATABASECHANGELOG.ORDEREXECUTED
     homebudget.DATABASECHANGELOG.TAG
Changed Column(s): NONE
Missing Foreign Key(s): NONE
Unexpected Foreign Key(s): NONE
Changed Foreign Key(s): NONE
Missing Index(s): NONE
Unexpected Index(s):
     PRIMARY UNIQUE  ON homebudget.DATABASECHANGELOGLOCK(ID)
Changed Index(s): NONE
Missing Primary Key(s): NONE
Unexpected Primary Key(s):
     PRIMARY on homebudget.DATABASECHANGELOGLOCK(ID)
Changed Primary Key(s): NONE
Missing Sequence(s): NONE
Unexpected Sequence(s): NONE
Changed Sequence(s): NONE
Missing Table(s): NONE
Unexpected Table(s):
     DATABASECHANGELOG
     DATABASECHANGELOGLOCK
Changed Table(s): NONE
Missing Unique Constraint(s): NONE
Unexpected Unique Constraint(s): NONE
Changed Unique Constraint(s): NONE
Missing View(s): NONE
Unexpected View(s): NONE
Changed View(s): NONE
19:52:21.564 INFO  [liquibase.integration.commandline.Main]: Liquibase command 'diff' was executed successfully.


text:
Q: Toast Not sending parameter to page when clicked and app is already open C# I have a Windows Phone 8.1 Universal App that receives a push notification. When the toast is clicked, it opens the app and sends the parameter to a specific page. My problem is that it only works if the app is off when I click the toast. If the app is open when I receive the notification, and I click it, it directs me to the app, but does not send the parameter to the specific page (ImageFullScreen). Do you know what needs to be done to accomplish this?
App.Xaml.Cs:
sealed partial class App : Application
{
    public string NavigateText { get; set; }

    public App()
    {
        this.InitializeComponent();
        this.Suspending += OnSuspending;

    }

    protected override void OnLaunched(LaunchActivatedEventArgs e)
    {
        var launchString = e.Arguments;
        (App.Current as App).NavigateText = launchString.ToString();

        if (System.Diagnostics.Debugger.IsAttached)
        {
            this.DebugSettings.EnableFrameRateCounter = true;
        }

        Frame rootFrame = Window.Current.Content as Frame;

        if (rootFrame == null)
        {
            // Create a Frame to act as the navigation context and navigate to the first page
            rootFrame = new Frame();
            // Set the default language
            rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

            rootFrame.NavigationFailed += OnNavigationFailed;

            if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                //TODO: Load state from previously suspended application
            }

            // Place the frame in the current Window
            Window.Current.Content = rootFrame;
        }

        if (rootFrame.Content == null)
        {
            // When the navigation stack isn't restored navigate to the first page,
            // configuring the new page by passing required information as a navigation
            // parameter
            rootFrame.Navigate(typeof(MainPage), e.Arguments);
        }
        // Ensure the current window is active
        Window.Current.Activate();

    }

MainPage.Xaml.Cs:
    protected override async void OnNavigatedTo(NavigationEventArgs e)
    {
        if ((App.Current as App).NavigateText == "")
        {
            await RefreshTodoItems();
        }
        else
        {
            items2 = await todoTable
                .Where(todoItem => todoItem.Text == (App.Current as App).NavigateText)
                .ToCollectionAsync();
            TodoItem myItem = items2[0] as TodoItem;
            Frame.Navigate(typeof(ImageFullScreen), myItem);
        }
    }

ImageFullScreen.Xaml.Cs:
    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        var myObject = (TodoItem)e.Parameter;
        img.Source = new BitmapImage(new Uri(myObject.ImageUri));

        (App.Current as App).NavigateText = "";
    }

A: The problem is that the if (rootFrame.Content == null) in the OnLaunched method is not executed because the app was already open (the content of the frame was the page). Only the window is activated and the OnNavigatedTo method in MainPage is not called.
You can try to initiate the navigation in the OnLaunched method always like this (without the if statement):
rootFrame.Navigate(typeof(MainPage), e.Arguments);
// Ensure the current window is active
Window.Current.Activate();


text:
Q: Simulating button click in Tcl/TK R package I would like to simulate a button click to switch from one tab to another after a specific action has been performed. I.e. say there are two tabs, and I am currently located in the second tab. I click a button in the second tab which calls a function that changes the second tab to the first tab. I am not sure how to "mimic" the button click that Tcl/TK handles when switching tabs using the mouse. Is there a way to do this? Thank you!

A: Tab notebooks have a select method that does tab selection. Which tab to switch to can be chosen by a few schemes, but the important ones for most code are:

*

*By index (counting from zero; 0 for the first tab, 1 for the second, ...)

*By handle of managed child widget (often a frame, but not necessarily)


text:
Q: Error 1064 MySql Syntax Error I have this following code to create an Order table in my database:
create table order(
order_id int primary key not null auto_increment,
product_id int not null,
customer_id int not null,
date_created datetime not null default now(),
date_modified datetime not null default now(),
order_status varchar(25),
foreign key(product_id) references product(product_id),
foreign key(customer_id) references customer(customer_id));

but when I execute it I get this error:

You have an error in you SQL syntax:check the manual that corresponds
  to your Mysql server version for the right syntaxt to use
  near'order(order_id int primary key not null auto_increment,product_id
  int not null,c'

Please help e figure out what's the issue.


text:
Q: Performance Issue in SSRS - Multiple Dataset I have one complex report which fetches records from multiple tables.
I saw at many places that SSRS does not allow multiple data tables returned from single stored procedure, that is the reason I created one stored procedure and I created six dataset for report that was filtered from shared dataset, but when I ran below query it shows that my procedure was executed for six times and that might causing the performance issue.
SELECT TOP 100 *,Itempath,parameters,
     TimeDataRetrieval + TimeProcessing + TimeRendering as [total time],
     TimeDataRetrieval, TimeProcessing, TimeRendering,
     ByteCount, [RowCount],Source, AdditionalInfo
FROM ExecutionLog3 where ItemPath like '%GetServiceCalls%'
ORDER BY Timestart DESC

To get rid of this, I removed all dataset filters and applied filter on tablix. After that I can see that procedure was called only one time. But that does not affect the performance much.
Now, question that is coming to me is how exactly I can improve performance of SSRS report.
Note: My Query executes in 13 seconds of time and report takes almost 20 mins to execute.
Please help me to resolve this issue.
Regards,
Dhaval

A: I always found that SSRS filters on large tables to take forever and that any text wildcards performed even more poorly.
My advise would be to do all the "grunt work" except sorts in SQL and then do any sorts in SSRS.
Part of you problem may be that you have a large dataset and you are performing wildcard searches which don't play well with Indexes when you have the wildcard at the start of the like statement (e.g. like '%... ).


text:
Q: jQuery ~ Function not working Im trying to call my javascript function on click:

<button onclick='alertClose()' class='alert'>Close</button>

Here is the function:
function alertClose(){
    $("#alert").animate({
        left: "107%"
    });
}

EDIT: The console keeps saying that there is no function called alertClose

A: I'm going to post what I think is your issue:
First, you are getting a js error in ajax.js here:
var room = document.getElementsByClassName("selected")[0].innerHTML;

the document.getElements call is returning nothing and failing
Then, you need to adjust your code to use jquery and not inline events:
HTML:

<button class='alert'>Close</button>

JS:
function alertClose(){
    $("#alert").animate({
        left: "107%"
    });
}
 $("#alert button").click(alertClose);

Try that out and see how it works.  Here is a Fiddle
Edit: removed inline function left by mistake

A: call the function
function alertClose();


text:
Q: how to write information to sysfs from kernel? I am modifying and debugging the Linux Kernel about the schedule on multicore board. I need to check some information and I find the printk cost too much and the system can go wrong. So I try to send these information via sysfs. Then I can get this information from Android APP by using the "cat" command. However I did not find any tutorial to show how to send information to sysfs. How can I write information to sysfs from kernel?
Thanks in advance.


text:
Q: Von Neumann Correspondence In Popa's preprint https://www.math.ucla.edu/~popa/popa-correspondences.pdf his initial definition of an $N-M$ correspondence between two von Neumann algebras is a Hilbert space $\mathcal{H}$ and a seperately weakly continuous commuting action of two Von Neumann algebras $N$ and $M$ on $\mathcal{H}$. Could somebody clarify what is meant here by weakly continuous as if $N$ is not already seen as a Von Neumann algebra on $\mathcal{H}$ there is no way to define a weak topology on it as it depends on the Hilbert space it is acting on. Does Popa instead mean $\sigma$-weakly continuous?

A: Most likely. If you look at the other equivalent definitions he gives, he talks about normal. So yes, it has to be $\sigma$-weak. Most of the time the distinction doesn't matter, because when an element in $N$ is a sot limit of a net in $N$, by Kaplanski's Density Theorem the net can be replaced by a bounded net, and then the convergence is also $\sigma$-sot.


text:
Q: Running old project on Spring Tool Suite I have a spring boot project based on JDK 1.8 and Gradle 2.14.1 . I am struggling get it running on my Apple Silicone M1 Mac. When I try to import the project using Spring Tool suite it fails with following error.
org.gradle.tooling.GradleConnectionException: Could not fetch model of type 'GradleBuild' using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-2.14.1-bin.zip'.
    at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:55)
    at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:29)
    at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:43)
    at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:69)
    at org.gradle.inte

Any inputs on how to resolve the issue is much appreciated as I am struggling on this for sometime now. Works without an issue on Intel Macs.

A: Eclipse above 4 replaces Gradle with a non-string value in the system properties. You can update Gradle above version 3 from here


text:
Q: Почему x = x++ не приводит к увеличению значения x в цикле? int x = 0;
while (x < 3) {
    x = x++;
    System.out.print(x + " ");
}

Я понимаю, что если написано y = x++, то сначала y присваивается значение х, после чего х увеличивается на единицу. Почему этого не происходит с выражением х = х++?

A: Если рассмотреть, байткод который генерируется из выражения :
int x = 0;
x = x++;

То получим следущее:
 0: iconst_0     // положить на стек 0
 1: istore_1     // сохранение значения в переменную 1
 2: iload_1      // положить на стек значение из переменной 1
 3: iinc  1, 1   // увеличение значения переменной с индексом 1 на 1
 6: istore_1     // сохранение значения 0 в переменную 1
 7: return

Что эквивалентно:
byte var10000 = x;
int x1 = x + 1;
x = var10000;

A: x = x++;

эквивалентно
int tmp = x;
x++;
x = tmp;

Сначала присваивается старое значение, делается инкрементирование, присваивается старое значение - поэтому цикл бесконечный, x = 0 всегда.

A: x++ увеличивает x и возвращает старое значение (т.е. 0). x = присваивает старое значение обратно. И x снова становится равным 0. В следующей итерации все повторяется;
В итоге x всегда будет 0
Посмотрите в отладчике.

A: Потому что у вас стоит постфиксный инкремент, то есть сначала присваивается, а потом инкрементируется. Чтобы работало нужно использовать префиксный инкремент ++x
погуглите про отличия постфиксного и префиксного инкремента/декремента.


text:
Q: Show file/line from a "[timestamp] TypeError: .." Sometimes my API in node.js throws a (for example)
// Forever error log
[2015-05-20 08:07:48] TypeError: Cannot read property 'length' of undefined

As you see, I don't have a clue where it comes from, Is there any way to get that information?

A: I fixed adding an Error handler to my app.js
process.on('uncaughtException', function(err) {
    // Log the error as you want
    log(err.stack || err.message, 'error');
});

For more info about error handling with expressjs: http://expressjs.com/guide/error-handling.html


text:
Q: MySQL Server InnoDB posix_fallocate() error after update to 8.0.22 After I updated MySQL Server to 8.0.22 version, I get an issue with my mysqld settings and I can't start MySQL server.
Here is the error log :
2020-10-20T16:35:36.489961Z 1 [ERROR] [MY-012128] [InnoDB] posix_fallocate(): Failed to preallocate data for file ./#innodb_temp/temp_1.ibt, desired size 81920 Operating system error number 22. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Refer to your operating system documentation for operating system error code information
2020-10-20T16:35:36.490507Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Out of disk space.
2020-10-20T16:35:36.807468Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2020-10-20T16:35:36.808412Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2020-10-20T16:35:36.809642Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-10-20T16:35:36.811459Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.22)  MySQL Community Server - GPL.

My OS is Debian 9.

A: I've filed a similar bug as mysql bug.
Basically, just like https://bugs.mysql.com/bug.php?id=74167, EXT3 filesystem doesn't support posix_fallocate, and it will return EINVAL.


text:
Q: Updating checkboxGroupInput based off selection from previous checkboxGroupInput I have multiple inputs for a ggplot function that creates a heatmap of a strikezone.
What I am trying to do is to have the "HitType" and "PlayResult" checkbox inputs appear if ONLY the "In Play" box is selected within the "PitchResult" checkbox.
With my current code, the "HitType" and "PlayResult" checkboxes are overruling the other checkboxes above and affecting the ggplot's data shown to only be data that is "In Play".
I want to be able to select all data, whether the data is "In Play" or not in play ("StrikeCalled","BallCalled",etc.).
I've read about the shinyjs package but I'm not sure if that's what I need here.
data$Date <- as.Date(data$Date, "%m/%d/%Y")
PitchTypeList <- c("Fastball","Cutter","Sinker","Curveball","Slider","Changeup" = "ChangeUp","Splitter")
PitchResultList <- c("Hit By Pitch" = "HitByPitch","Ball Called" = "BallCalled","Strike Called" = "StrikeCalled",
                     "Strike Swinging" = "StrikeSwinging","Foul Ball" = "FoulBall","In Play" = "InPlay")
HitTypeList <- c("Bunt","Groundball" = "GroundBall","Line Drive" = "LineDrive","Fly Ball" = "FlyBall","Popup")
PlayResultList <- c("Out","Single","Double","Triple","Home Run" = "HomeRun")

ui = fluidPage(
  titlePanel("Heatmaps - 2019 Big Ten Conference Database"),

  sidebarLayout(
    sidebarPanel(
      selectInput(inputId="TeamInput", label="Select Team", choices = sort(unique(data$BatterTeam)), selected = "IOW_HAW"),
      selectInput(inputId="BatterInput", label="Select Player", choices = ""),
      dateRangeInput(input="DateRange", label="Select the date range", start=min(data$Date), end=max(data$Date)),
      checkboxGroupInput(inputId = "PitcherHandedness", label = "Pitcher Handedness", inline = TRUE,
                         choices = c("LHP"="Left","RHP"="Right"), selected = c("LHP"="Left","RHP"="Right")),
      fluidRow(
      column(5, wellPanel(
       checkboxGroupInput(inputId = "PitchType", label= "Pitch Type", choices = PitchTypeList, selected = PitchTypeList) ) ),
      column(5, wellPanel(
       checkboxGroupInput(inputId = "PitchResult", label = "Pitch Result", choices = PitchResultList, selected = PitchResultList) ) )
               ),
      fluidRow(
      column(5, wellPanel(
       checkboxGroupInput(inputId = "HitType", label= "Hit Type", choices = HitTypeList, selected = HitTypeList) ) ),
      column(5, wellPanel(
       checkboxGroupInput(inputId = "PlayResult", label = "Play Result", choices = PlayResultList, selected = PlayResultList) ) )
               )
      ), #sidebarPanel closing

    mainPanel(
      plotOutput("myZone")
             )))

server = function(input, output, session) {

  observeEvent(
    input$TeamInput,
    updateSelectInput(session, "BatterInput", "Select Player",
                      choices = sort(unique(data$Batter[data$BatterTeam==input$TeamInput])))
  )

  output$myZone <- renderPlot({

    data$PlateLocSide <- (data$PlateLocSide * -1)

    dataFilter <- reactive({
      data %>% filter(
        between(Date, input$DateRange[1], input$DateRange[2]),
        BatterTeam %in% c(input$TeamInput),
        Batter %in% c(input$BatterInput),
        PitcherThrows %in% c(input$PitcherHandedness),
        TaggedPitchType %in% c(input$PitchType),
        PitchCall %in% c(input$PitchResult),
        HitType %in% c(input$HitType),
        PlayResult %in% c(input$PlayResult))
    })

    ggplot(data = dataFilter(), aes(x = PlateLocSide, y = PlateLocHeight)) +
      stat_density_2d(geom = "tile", aes(fill = ..density..), contour = FALSE, na.rm = TRUE) +
      xlim(-2.5,2.5) + ylim(0,5) + geom_point(na.rm = TRUE) +
      labs(x = "", y = "") + facet_wrap(~ Batter, ncol = 2) +
      theme(strip.text = element_text(size=20, face="bold")) +
      scale_fill_gradientn(colors = c("white", "blue", "yellow", "red"),
      values = scales::rescale(c(0, .05, 0.10, 0.15, .20))) + theme(legend.position="none")
  },
  width=425, height=500)

}

shinyApp(ui, server)


text:
Q: Spring invalid dynamic attributes when updating to Java 7 I am in charge of a quite old website who was at first compiling with Java 5 and now Java 6. I'm using Spring 3.1.
I'm trying to update from Java 6/ Tomcat 6 to Java 7 / Tomcat 7 and I have a lot of problems regarding the form tags.
For this code:
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
...
<form:textarea path="myPath" placeholder="hello world" id="myId" rows="1" />

I get that error:
Attribute placeholder invalid for tag textarea according to TLD

It seems that a lot of the attributes I was using before updating Java don't work anymore. Do you have any idea why? Thanks!

A: It looks like the WAR contains accidentally several versions of the TLD, and in Tomcat 6 the correct version is found, but on Tomcat 7 the wrong version is loaded instead.
If two different versions of the same jar are present in WEB-INF/lib, there is no way to predict which one will be chosen, the results are dependent on the classloader implementation details, and so different Tomcat versions might yield different results.
To verify this, try looking in your IDE by the multiple versions of file spring.schemas. These files contain the mapping between url's such as http://www.springframework.org/tags/form and the XSDs /TLDs shipped inside the same jar.
This mechanism exists for XSDs/TLDs that are not published online such as the url of this case, if you paste the url to a browser the file does not exist.
In this case there should be two spring.schemas both with mention to  url http://www.springframework.org/tags/form. Remove the one with the wrong version of the XSD/TLD and it should work correctly in both Tomcat versions.


text:
Q: Laravel Dusk reporting production.ERROR: It is unsafe to run Dusk in production, but i am testing on local I'm running laravel dusk on my development machine.
The dusk tests run fine but at points during the process, a production error will be reported as shown below in the .log snippet
This typically causes the browser tests to fall over at the point that the production.error is reported in the log.
I believe everything is set up correctly.
I have created a .env.dusk.local env file.
Dusk tests are persisting to an sql database specifically created for dusk testing .
The env variable in the .env.dusk.local file is set to APP_ENV=testing
The env variable in the .env file is set to APP_ENV=local
Putting
"extra": {
    "laravel": {
        "dont-discover": [
            "laravel/dusk"
        ]
    }
},

into composer.json just prevents the dusk tests from running.
I've replicated the problem on two separate Windows 10 dev machines.
I've replicated on laravel 5.8 and 5.7 for the same application i'm building.
Everything else is running fine in the application: unit tests etc.
The dusk tests all run fine apart from this intermittent error.
[2019-09-06 11:47:28] testing.DEBUG: >test1: start

[2019-09-06 11:47:39] testing.DEBUG: messages reporting assert passes etc.
[2019-09-06 11:47:39] testing.DEBUG: messages reporting assert passes etc.
[2019-09-06 11:47:39] testing.DEBUG: messages reporting assert passes etc.
[2019-09-06 11:47:39] testing.DEBUG: messages reporting assert passes etc.
[2019-09-06 11:47:39] testing.DEBUG: messages reporting assert passes etc.

...about 12 seconds in to the test each time...
[2019-09-06 11:47:39] testing.DEBUG: SearchController.filter:
[2019-09-06 11:47:40] production.ERROR: It is unsafe to run Dusk in production. {"exception":"[object] (Exception(code: 0): It is unsafe to run Dusk in production. at C:\\xampp\\htdocs\\assetH\\vendor\\laravel\\dusk\\src\\DuskServiceProvider.php:43)
[stacktrace]
#0 C:\\xampp\\htdocs\\assetH\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(607): Laravel\\Dusk\\DuskServiceProvider->register()
#1 C:\\xampp\\htdocs\\assetH\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\ProviderRepository.php(75): Illuminate\\Foundation\\Application->register(Object(Laravel\\Dusk\\DuskServiceProvider))
#2 C:\\xampp\\htdocs\\assetH\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(584): Illuminate\\Foundation\\ProviderRepository->load(Array)
#3 C:\\xampp\\htdocs\\assetH\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\RegisterProviders.php(17): Illuminate\\Foundation\\Application->registerConfiguredProviders()
#4 C:\\xampp\\htdocs\\assetH\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(210): Illuminate\\Foundation\\Bootstrap\\RegisterProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#5 C:\\xampp\\htdocs\\assetH\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(162): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#6 C:\\xampp\\htdocs\\assetH\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(146): Illuminate\\Foundation\\Http\\Kernel->bootstrap()
#7 C:\\xampp\\htdocs\\assetH\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#8 C:\\xampp\\htdocs\\assetH\\public\\index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#9 {main}
"}
[2019-09-06 11:47:40] testing.DEBUG: SearchController.filter:
[2019-09-06 11:47:40] testing.DEBUG: SearchController.getAlert:

I can't understand why dusk considers that i am running in a production environment. I am running in local normally and testing during the dusk tests.


text:
Q: Can anyone explain, step by step, the interaction between my android client, and the server running PHP in my example? <?php
$json = $_SERVER['HTTP_JSON'];
echo "JSON: \n";
echo "---------------\n";
var_dump($json);
echo "\n\n";

$data = json_decode($json);
echo "Array: \n";
var_dump($data);
echo "\n\n";

$username = $data->username;

echo "Result: \n";
echo "---------------\n";
echo "username : ", $username, "\n";

?>

public String postJSON() throws JSONException{
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost(ec2Url + "testjson.php");
    JSONObject json = new JSONObject();

    try {
        json.put("username", "Michael");
        JSONArray postjson = new JSONArray();
        postjson.put(json);

        httppost.setHeader("json", json.toString());
        Log.d(DEBUG_TAG, "toString() " + json.toString());
        httppost.getParams().setParameter("jsonpost", postjson);

        HttpResponse response = httpclient.execute(httppost);

        if(response != null) {
            InputStream is = response.getEntity().getContent();
            BufferedReader reader = new BufferedReader(new InputStreamReader(is));
            StringBuilder sb = new StringBuilder();

            String line = null;

            try {
                while((line = reader.readLine()) != null) {
                    sb.append(line + "\n");
                }
            } catch(IOException e){

            }
            text = sb.toString();
        }
    return text;}

    catch (ClientProtocolException e) {

    } catch(IOException e){

    }
    return "BROKE";
}

The code works, but I do not entirely understand it.  Can anyone explain what httppost.setHeader("json", json.toString()) is doing and how $_SERVER['HTTP_JSON'] gets set equal to json.toString() ?  Also what, httppost.getParams().setParameter("jsonpost", postjson) does?  It seems to pair together "jsonpost" and the JSON array itself, but where in the PHP does that get received and where does it get interpreted?
I've asked a few bad questions in the past, so if this is not considered "on topic" or is unclear, don't hesitate to tell me and I will edit it.

A: Practically thinking, this code is a little weird, and it's not a example of good practices, but fortunately it's good to think about the concepts involved.
To understand it, it requires a HTTP introduction. But to let thinks less painful, I will try to simplify. Client(Android App) and server(PHP running on a HTTP server) send strings (streams of textual data, to be more precise) to one another, one at a time. This strings are called HTTP Messages.
HTTP Messages always have an initial part, called HTTP Header. After the header, it's posible, not necessary, to contain a HTTP Body. Those parts are separated from each other with two sequential new lines.
The Android code is sending a specific type of HTTP Message: a POST (HTTP Messages does not exists in fact, it's an 'abstract concept'). A POST can contains a body, and generally it does.
The fist part of you questions it's about POST preparation, so let starts with final results (here is an approximation of the POST that your Android code is sending to server):
POST /testjson.php HTTP/1.1
Host: content.of.your.ec2Url.string
User-Agent: Android Http Client User-Agent
Content-Length: 0
json: {"username": "Michael"}
                                     <- new line here, end of headers, no body

First line defines the type of the message (POST), the resource to be reach on server (/testjson.php) and HTTP version of the client (HTTP/1.1). It is followed by HTTP Headers. Headers are a simple set of colon separated key-pair. They are essentials for HTTP to deal with a lot of issues involving negotiate capabilities between client and servers, cache-control, permissions, defining the size, type of, and ways to read bodies.
What is really unconventional about Android code (and consequently the POST generated), is that application data is sent inside a HTTP Header, not in the body nor in HTTP first line. It's not a proper way to do it, but it's posible. httppost.setHeader("json", json.toString()) is about that: sets a header called json with the value of json.toString().
So, there is that httppost.getParams().setParameter("jsonpost", postjson), and I confess that I am not certain about its effects. It seems misused. httppost.getParams() returns an object of HttpParams that is used to change HTTP protocol-specific stuff defined here and here, not to set arbitrary application data. Anyway, it seems a common mistake.
Finally, the PHP stuff, but that is much simpler: on PHP, all HTTP Headers are converted in a $_SERVER[HTTP_NAME_OF_HEADER] variable (capitalising header key and replacing '-' by '_'). It's not a documented feature (in fact, it is partially documented), but I've been using it on last ten years without noticed it. So:
$_SERVER['HTTP_HOST'];            // equals to content.of.your.ec2Url.string
$_SERVER['HTTP_USER_AGENT'];      // equals to Android Http Client User-Agent
$_SERVER['HTTP_CONTENT_LENGTH'];  // equals to 0
//and finally
$_SERVER['HTTP_JSON'];            // equals to {"username": "Michael"}


text:
Q: audio stops playing after some minutes when screen is lock I've designed a PWA that the user can play some audio files.
The problem is that when the users play one of the sounds on Android and lock their screen to prevent wasting their charge, the player stops playing after approximately 5 minutes and it is funny that when they unlock the screen and click on the play button to play the rest of the audio, it starts playing from the beginning of the file!!!
Is there a way to prevent Chrome from stopping the sound when the screen is locked?

A: This is actually normal behaviour for android browsers. there really isn't a workaround for this. sorry.


text:
Q: How to filter data in a JSON file based on one of the properties? So my JSON file has the following format:
"ecycle_data": [
    {
      "id": "1",
      "naam": "Stichting Kringloop Zwolle",
      "latitude": "52.491091",
      "longitude": "6.106703",
      "adres": "Nieuwe Deventerweg 6",
      "klein": "0",
      "groot": "0",
      "lamp": "0",
      "mobiel": "0",
      "batterij": "1"
    },
    {
      "id": "2",
      "naam": "Spar City Zwolle",
      "latitude": "52.511761",
      "longitude": "6.095226",
      "adres": "Oude Vismarkt 46",
      "klein": "1",
      "groot": "0",
      "lamp": "1",
      "mobiel": "0",
      "batterij": "1"
    }
]

In my HTML i have a  object with which the user can choose what location he's looking for. For example, when the user picks the option 'Battery', he needs to be supplied with all the locations in the JSON file with batterij === 1.
  var keuze = document.getElementById("soortafval").value;
  if (keuze = "batterijen"){

  }
  else if (keuze = "elektronica"){

  }
  else if (keuze = "grootelektronica"){

  }
  else if (keuze = "lampen"){

  }
  else if (keuze = "mobieltjes"){

  }
  else {
    console.log("maak een keuze!");
  }

}

I'm now stuck at the part of filtering my JSON data. I've tried the .filter() method, but that either doesn't work anymore or I can't find a proper source on how to use it. My ultimate goal is to get a variable returned by the function in which only the filtered JSON data is included, so I can put the filtered data through my other code.
Thanks in advance!
(sorry for my variables in Dutch btw, 'keuze' means choice)

A: You could use a simple lookup function and look up anything.  This even works in very old browsers.

var data = {
  "ecycle_data": [{
      "id": "1",
      "naam": "Stichting Kringloop Zwolle",
      "latitude": "52.491091",
      "longitude": "6.106703",
      "adres": "Nieuwe Deventerweg 6",
      "klein": "0",
      "groot": "0",
      "lamp": "0",
      "mobiel": "0",
      "batterij": "1"
    },
    {
      "id": "2",
      "naam": "Spar City Zwolle",
      "latitude": "52.511761",
      "longitude": "6.095226",
      "adres": "Oude Vismarkt 46",
      "klein": "1",
      "groot": "0",
      "lamp": "1",
      "mobiel": "0",
      "batterij": "1"
    }
  ]
};
var myApp = myApp || {};
myApp.functions = {
  lookup: function(myArray, searchTerm, property, firstOnly) {
    var found = [];
    var i = myArray.length;
    while (i--) {
      if (myArray[i][property] === searchTerm) {
        found.push(myArray[i]);
        if (firstOnly) break; //if only the first
      }
    }
    return found;
  },
  lookupAll: function(myArray, searchTerm, property) {
    return this.lookup(myArray, searchTerm, property, false);
  },
};

let term = "Spar City Zwolle";
let propertyName = "naam";
let firstOnly = true;
let weFound = myApp.functions.lookup(data["ecycle_data"], term, propertyName, firstOnly);
console.log(term, weFound);

let term2 = "Oude Vismarkt 46";
let propertyName2 = "adres";
let firstOnly2 = true;
let weFound2 = myApp.functions.lookup(data["ecycle_data"], term2, propertyName2, firstOnly2);
console.log(term2, weFound2);

// get array with all matches
let bat = myApp.functions.lookupAll(data["ecycle_data"], "1", "batterij");
console.log(bat);

A: Like this
You can use it as
document.getElementById("soortafval").addEventListener("input",function() {
   document.getElementById("output").value = filt(this.value).map(item => item.naam).join(", ")
})

(wit a few tests to see if anything is returned)

const ecycle_data =  [
    {
      "id": "1",
      "naam": "Stichting Kringloop Zwolle",
      "latitude": "52.491091",
      "longitude": "6.106703",
      "adres": "Nieuwe Deventerweg 6",
      "klein": "0",
      "groot": "0",
      "lamp": "0",
      "mobiel": "0",
      "batterij": "1"
    },
    {
      "id": "2",
      "naam": "Spar City Zwolle",
      "latitude": "52.511761",
      "longitude": "6.095226",
      "adres": "Oude Vismarkt 46",
      "klein": "1",
      "groot": "0",
      "lamp": "1",
      "mobiel": "0",
      "batterij": "1"
    }
]

function filt(type) {
  return ecycle_data.filter(item => item[type] === "1");
}

console.log("batterij",filt("batterij"))

console.log("lamp",filt("lamp"))

A: Run the following snippet

let data={
"ecycle_data": [
    {
      "id": "1",
      "naam": "Stichting Kringloop Zwolle",
      "latitude": "52.491091",
      "longitude": "6.106703",
      "adres": "Nieuwe Deventerweg 6",
      "klein": "0",
      "groot": "0",
      "lamp": "0",
      "mobiel": "1",
      "batterij": "0",
      "elektronica":"1"
    },
    {
      "id": "2",
      "naam": "Spar City Zwolle",
      "latitude": "52.511761",
      "longitude": "6.095226",
      "adres": "Oude Vismarkt 46",
      "klein": "1",
      "groot": "0",
      "lamp": "0",
      "mobiel": "0",
      "batterij": "1",
      "elektronica":"0"
    },
       {
      "id": "3",
      "naam": "Hehe bro",
      "latitude": "52.491091",
      "longitude": "6.106703",
      "adres": "Nieuwe Deventerweg 6",
      "klein": "0",
      "groot": "0",
      "lamp": "0",
      "mobiel": "0",
      "batterij": "1",
      "elektronica":"1"
    },
    {
      "id": "4",
      "naam": "Hey yo",
      "latitude": "52.511761",
      "longitude": "6.095226",
      "adres": "Oude Vismarkt 46",
      "klein": "1",
      "groot": "0",
      "lamp": "1",
      "mobiel": "0",
      "batterij": "1",
      "elektronica":"1"
    }
]
};

function changeInSelection(value){
let message=document.querySelector(".Message")
message.innerHTML="";
let filtered=data.ecycle_data.filter((shop) => shop[value] == 1);
filtered.forEach((shop)=>{
message.innerHTML+=`Item "${value}" is available at shop name "${shop.naam}" , address: "${shop.adres}"<br>`;
});
}
changeInSelection('batterij');//for first value
<select onchange="changeInSelection(value)" >
<option value="batterij">batterijen</option>
<option value="elektronica">elektronica</option>
<option value="lamp">lampen</option>
<option value="mobiel">mobieltjes</option>
</select>