text:
Q: How to knit directly to R object? I'd like to store a knit()ted document directly in R as an R object, as a character vector.
I know I can do this by knit()ing to a tempfile() and then import the result, like so:
library(knitr)
library(readr)
ex_file <- tempfile(fileext = ".tex")
knitr::knit(text = "foo", output = ex_file)
knitted_obj <- readr::read_file(ex_file)
knitted_obj

returns
# [1] "foo\n"

as intended.
Is there a way to do this without using a tempfile() and by directly "piping" the result to a vector?

Why on earth would I want this, you ask?

*

**.tex string will be programmatically saved to disc, and rendered to PDF later. Reading rendered *.tex from disc in downstream functions would make code more complicated.

*Caching is just a whole lot easier, and moving this cache to a different machine.

*I am just really scared of side effects in general and file system shenanigans across machines/OSes in particular. I want to isolate those to as few (print(), save(), plot()) functions as possible.

Does that make me a bad (or just OCD) R developer?

A: You can use con <- textConnection("varname", "w") to create a connection that writes its output to variable varname, and use output=con in the call to knit().  For example:
library(knitr)
con <- textConnection("knitted_obj", "w")
knit(text="foo", output = con)
close(con)
knitted_obj

returns the same as your tempfile approach, except for the newline.  Multiple lines will show up as different elements of knitted_obj.  I haven't timed it, but text connections have a reputation for being slow, so this isn't necessarily as fast as writing to the file system.

A: It should be as straightforward as a single line like this:
knitted_obj = knitr::knit(text = "foo")

You may want to read the help page ?knitr::knit again to know what it returns.


text:
Q: If $H$ is a hat matrix (symmetric and idempotent), then $h_{ii} = \sum^n_{j=1}h_{ij}^2$? In regression model, $H=X(X^TX)^{-1}X^T$ is a hat matrix (so it is  symmetric and idempotent), then we have
$$\text{tr}(H^2)=\text{tr}(H)=\text{rank}(H)=\text{rank}(X),$$
We can conclude that $\sum_{i=1}^nh_{ii} = \sum_{i=1}^n\sum_{j=1}^nh_{ij}^2$, but how can we conclude that
$h_{ii} = \sum^n_{j=1}h_{ij}^2$?

A: I get the answer now. That is because $H=H^2$ and it is symmetric, so we have $h_{ii}=\sum_{j=1}^nh_{ij}h_{ji}=\sum_{j=1}^nh_{ij}^2$.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Maven: must be a valid version but is 'RELEASE' I am very new to Maven and trying to use the CarbonFive DB Migration from Maven.
Following their documentation, I added the following in my pom.xml
<pluginRepositories>
    <pluginRepository>
        <id>c5-public-repository</id>
        <url>http://mvn.carbonfive.com/public</url>
    </pluginRepository>
</pluginRepositories>

and
     <plugins>
       <plugin>
            <groupId>com.carbonfive.db-support</groupId>
            <artifactId>db-migration-maven-plugin</artifactId>
            <version>RELEASE</version>
            <configuration>
                <url>jdbc:mysql://localhost:3306/bb</url>
                <username>bb</username>
                <password>bb</password>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>5.1.6</version>
                </dependency>
            </dependencies>
        </plugin>
      </plugins>

Now when I try to run migration
$ mvn db-migration:migrate

I see error saying
[ERROR]     'build.plugins.plugin.version' for com.carbonfive.db-support:db-migration-maven-plugin must be a valid version but is 'RELEASE'. @ line 165, column 26

and line 165 is
<version>RELEASE</version>

which is as per their documentation.
How do I resolve this issue?

A: Well, you need to fill in the release you want.  Looks like, from http://code.google.com/p/c5-db-migration/:

Latest Version: 0.9.9-m5 (check out the new check goal!)

So try 0.9.9-m5 in place of RELEASE.
Maven versions are always in the format x.y.z-DESCRIPTOR with y, z and DESCRIPTOR optional.

A: Maven has version rules. It is possible to change them, but normally there is no need.
If you look at their Nexus, you'll see that the latest stable version of db-migration-maven-plugin is 0.9.8.


text:
Q: "I am him" vs "I am he" A: "Cablegram for Mr.Smith"
B: "I am him."
B: "I mean, I am he."
Why the correction? What difference does it make?
Similarly: "I am not her" / "I am not she"?

A: Him and her are the objective case forms of the pronouns he and she, respectively. The objective case is used nearly exclusively for direct and indirect objects, objects of prepositions, and objective complements. In the sentence I am him, the pronoun is functioning as a predicate nominative, so it must be in the nominative case; hence, it takes its nominative form, he.


text:
Q: Cómo agregar tiempo de validez a un campo de una tabla en SQL Server Tengo esta tabla con temporalidad de transacción:
CREATE TABLE Empleado
(
    id CHAR(10) NOT NULL PRIMARY KEY CLUSTERED,
    nombre VARCHAR(50) NOT NULL,
    num_seguro INT,
    SysStartTime DATETIME2 GENERATED ALWAYS AS ROW START HIDDEN NOT NULL,
    SysEndTime DATETIME2 GENERATED ALWAYS AS ROW END HIDDEN NOT NULL,
    PERIOD FOR SYSTEM_TIME (SysStartTime, SysEndTime)
)
WITH (SYSTEM_VERSIONING = ON);

lo que necesito es poder registrar el tiempo de validez del campo num_seguro, como puedo hacerlo?

A: El versionado de tablas, que Sql Server introduce en la versión 2016, lo que realiza es generar un "histórico" de todos los movimientos que tengan los registros a posteriori de su inserción en la tabla de Empleado.
CREATE TABLE Empleado
(
    id CHAR(10) NOT NULL PRIMARY KEY CLUSTERED,
    nombre VARCHAR(50) NOT NULL,
    num_seguro INT,
    SysStartTime DATETIME2 GENERATED ALWAYS AS ROW START HIDDEN NOT NULL,
    SysEndTime DATETIME2 GENERATED ALWAYS AS ROW END HIDDEN NOT NULL,
    PERIOD FOR SYSTEM_TIME (SysStartTime, SysEndTime)
)
WITH (SYSTEM_VERSIONING = ON);
GO

Con la sentencia que has declarado, el motor se ha generado una tabla de empleados, pero adicionalmente también ha generado la tabla de versiones, con un nombre automatizado, pues no ha sido declarado en la insert.

Si realizas una insert en la tabla "principal", el resultado solo existe en la misma:
Insert into dbo.Empleado (id, nombre, num_seguro)
values
('a1','juan',1);
go

Pero cuando realizas una modificación o eliminación del registro, entonces, esta se ve anotada también en la tabla de historial.
Update e Set nombre = 'luis' from dbo.Empleado e where e.id = 'a1';
go
Select * From dbo.Empleado;
Select * From [dbo].[MSSQL_TemporalHistoryFor_830626002];

Ahora bien, esto no implica que el motor tenga que hacer nada, en ninguna fase de tiempo relativo a los registros, si no sufren ninguna modificación o borrado. En el caso de que se modifiquen o borren, entonces lo anotará en la tabla de historial. Y si realizamos una select podremos obtener el estado de los registros a determinadas fases de tiempo del mismo. Pero estos no se cambian.
Versionado de Tabla

lo que necesito es poder registrar el tiempo de validez del campo
num_seguro, como puedo hacerlo?

Eso es lógica sobre un campo. Por tanto lo primero sería, al menos añadir una columna que nos permitiese añadir una fecha o algún campo para poder realizar esa lógica.
Alter table dbo.Empleado
Add num_Seguro_FechaExpiracion datetime2;
go

Automáticamente al añadir el campo, el motor modificará las dos tablas (principal y versionada)

A partir de la anotación en los registros, podrás desarrollar la lógica que requiera esa columna, en función de una automatización, o al aplicar una sentencia al registro, o mediante un trigger, o mediante la infinidad de posibilidades que nos permite TSQL.


text:
Q: recalculate mean considering each count if the dataframe is given as below
index yearmon   college major   gpa     num
0     20140401  1       a       3.36    29
1     20180401  2       b       2.63    48
2     20160401  3       c       3.23    55
3     20170401  4       d       4.22    1
4     20140401  3       b       3.72    72

which gives the average gpa of each year, each college, each major.
i want to make a new data set as average gpa only considering the major.
for example for major b, there is 2 data in different time,
so i have to make a new
gpa average considering the num (number of students)
i have tried groupby function, but it only makes average as they have same num count (not considering num variable)
is there way to solve this problem?

A: A lazy way, given that the number of students are integers,
(df.loc[df.index.repeat(df['num']), ['major', 'gpa']]
   .groupby('major').mean()
)

Option 2 groupby().apply() and np.average:
(df.groupby('major')
   .apply(lambda x: np.average(x['gpa'], weights=x['num']))
)

Option 3 Most complicated but best performant is to assign the total score, and calculate the average manually:
df['total'] = df['gpa'] * df['num']
groups = df.groupby('major')
out = groups['total'].sum()/groups['num'].sum()

Output:
         gpa
major
a      3.360
b      3.284
c      3.230
d      4.220


text:
Q: FPGA non-volatile progamming I recently bought a Cyclone II FPGA here.  I have been able to program it with a USB Blaster cable and the Altera Quartus Software.  The problem is that when I disconnect power, I lose the program.  How do I program it so it will continue its operation after power is lost?
Note: this question is similar to this one, but the name of the question made it hard to search for, so I agree with "The Photon" that this one should be kept open.

A: While The Photon's answer answered my original question, I was able to figure out how to program the EEPROM chip in the board that I originally posted (EP2C5T144 Altera Cyclone II).
By plugging the USB Blaster into the port labeled AS (Active Serial) on the board, the EEPROM is written to.  In the Altera Programmer, select the programming method as Active Serial Programming.  Add a device and select EPCS4 which is the EEPROM chip on the board.  Add the file to the list so it will be programmed, and select start.  The process will take longer than standard programming.  When power is cycled, the boot program will be the one that was stored on the flash.
Note doing Active Serial Programming will not update the current program until the device is power cycled.

A: An FPGA (with some exceptions, which don't include the Cyclone family) does not have non-volatile storage, so it will lose its configuration when power is removed.
However, it can be programmed (by pull-up/down connections on its pin) to automatically reload a configuration data from another device on the PCB as soon as it's powered up.
You will need to look at the Configuration User Guide (sorry, that's the Xilinx name, Altera will have something similar) for your device to determine how to set your FPGA up to automatically re-load its program on power up.
And you will need to look at the design of your demo board to find out what kind of non-volatile storage device is provided for the FPGA to be programmed from.
Then you'll need to program your bitstream into the nonvolatile storage device, and reset the FPGA, to have your FPGA reconfigure automatically on power-up.


text:
Q: Inject requests into RingCentral queue Our company has a web app and is going to introduce online chat feature. Since we already use RingCentral service with their call queue. I am not sure whether it's possible to achieve the following actions:

*

*When users want to chat with customer service personnel, our web app can submit a request to RingCentral queue

*Available person from the queue is going to be brought into the chat dialog of our web app.

I did some research on developer site of RingCentral but cannot find a proper reference so please share links so I can start from there if it's feasible. Thank you.

A: If your agents are using RingCentral Engage Digital, this can be implemented using by adding your chat as a new channel with the Channel SDK:
https://developers.ringcentral.com/engage/digital/guide/sdks/source-sdk


text:
Q: Header() not working in my project
Possible Duplicate:
Reference - What does this error mean in PHP?

I have problem in Header function. I want to redirect the page to the paypal after the insertion in database. Insertion query is working correctly pay header function is not working.
Here is my code
{
mysql_query("INSERT INTO bookings (date,time,hired_consultant,status,user_id) VALUES ('$date','$time','$hired_consultant','pending','$user_id')",$link)or die("Invalid: " . mysql_error());
header("Location: https://www.paypal.com/cgi-bin/webscr");
exit();
}

After insert following error appears:

Warning: Cannot modify header information - headers already sent by
  (output started at
  /home/nausalho/public_html/HumanResource/selection1.php:2) in
  /home/nausalho/public_html/HumanResource/selection1.php on line 101

Its is working fine on my localhost. But on live site it didnot redirect me to the paypal, just appear error message on the same page.
Please figure out my mistake in code or any other redirect method.
Thanks in advance,

A: Add this to the top of your page:
ini_set('output_buffering', 'on');

A: Use the below code
echo "window.location.href = 'https://www.paypal.com/cgi-bin/webscr'";die;


text:
Q: Header file with constant arrays initialized with functions I have a header file in which I have some constants like uint64_t knight_attacks[64] or uint64_t king_attacks[64]. To initialize these constants, I first processed the values I needed with a Python script and then just wrote it directly like king_attacks[64] { ... explicit values }; but I had troubles with this so I decided to directly build the arrays in my code.
It gives this:
typedef uint64_t bitboard;

inline bitboard* get_knight_attacks()
{
    static bitboard attacks[64];
    for (int i = 0; i < 64; i++)
    {
        attacks[i] = 0;
        for (int m: {i - 17, i - 15, i - 6, i + 10, i + 17, i + 15, i + 6, i - 10})
            if (m >= 0 && m <= 63 && abs((i % 8) - (m % 8)) <= 2)
                attacks[i] |= m;
    }
    return attacks;
}

inline bitboard* get_king_attacks()
{
    static bitboard attacks[64];
    for (int i = 0; i < 64; i++)
    {
        attacks[i] = 0;
        for (int m: {i - 9, i - 8, i - 7, i + 1, i - 1, i + 7, i + 8, i + 9})
            if (m >= 0 && m <= 63 && abs((i % 8) - (m % 8)) <= 1)
                attacks[i] |= m;
    }
    return attacks;
}

const bitboard knight_attacks[64] { *get_knight_attacks() };
const bitboard king_attacks[64] { *get_king_attacks() };

However it looks makeshift to me and I would like to know if there is a cleaner way to do this.
I had to add the inline not to get a "multiple definition" error and the static to be able to initialize my arrays with the returns of my functions.
I thought about using vectors but I don't think it is cleaner, especially in the upcoming code where I will need 2D arrays (64 * 64).

A: To make it cleaner, i think you can :

*

*Use std::array STL container like this : const std::array<bitboard, 64> knight_attacks = get_knight_attacks(); and make your functions return std::array<bitboard, 64> data type. It has the advantages of erasing the use of pointer, and provinding the same thing C array provide, with the addition of several useful functions ( like begin(), end(), at(), which can be used with some other STL algorithms like std::for_each, std::find... )

*Define functions in cpp file, and let the function declaration in header files. If you had "multiple definition" errors, it's because you tried to define functions in header files, while functions and variable definitions should normaly be in cpp files ( except the inline and template functions ), like this :
in header file, the function declaration :
std::array<bitboard, 64> get_king_attacks();

and in cpp file, the function definition :
std::array<bitboard, 64> get_king_attacks()
{
    std::array<bitboard, 64> attacks;
    for (int i = 0; i < 64; i++)
    {
        attacks[i] = 0;
        for (int m: {i - 9, i - 8, i - 7, i + 1, i - 1, i + 7, i + 8, i + 9})
            if (m >= 0 && m <= 63 && abs((i % 8) - (m % 8)) <= 1)
                attacks[i] |= m;
    }
    return attacks;
}

and then, for the variable initialization :
const std::array<bitboard, 64> knight_attacks = get_knight_attacks();

I first processed the values I needed with a Python script and then just wrote it directly like king_attacks[64] { ... explicit values }; but I had troubles with this so I decided to directly build the arrays in my code. )

*

*If you still want to use this technique, you can do like that :

in header file, the global variable definition :
const std::array<bitboard, 64> knight_attacks;

and in the cpp file, the variable definition :
const std::array<bitboard, 64> knight_attacks = { ... explicit values };

Hope this help


text:
Q: What CSS feature would you use to show elevation on a 2D grid? I'm trying to port an out of print board game that I used to play while growing up, and I'm trying to determine the best graphical method to display on a 2D grid.  In real life, each board square has 2 terrain types (forest/plains), and also one of three elevation levels.  I'm currently using color to represent terrain type.  I'm leaving the center of the square open to show game pieces.  What would an idea be to show 3D elevation 2 dimensionally?
I tried using border thickness, but my CSS is failing me for that with my method of creating the board.  My technical lapse is understanding how to get the borders to display... so help figuring that out would be appreciated.  But the real end state I'm looking to get to is a 2D representation of height.
Sample CSS/Grid is here.

.square {
    float:left;
    position: relative;
    width: 11%;
    padding-bottom: 11%; /* = width for a 1:1 aspect ratio */
    margin: .2%;
    background-color: #1E1E1E;
    overflow: hidden;
}
.content
{
    position:absolute;
    height:80%; /* = 100% - 2*10% padding */
    width:90%; /* = 100% - 2*5% padding */
    padding: 10% 5%;
}
.forest
{
    background-color: rgb(7, 90, 5);
}
.plains
{
    background-color: rgb(245, 238, 136);
}
.hill
{
    border-width: medium;
}
.mountain
{
    border-width: thick;
    border-color: red;
}
.ground
{
    border-width: thin;
}

A: For a simple 3d effect to your squares to simulate layers I would suggest using box-shadow.
If you are using multiple layers (as I think you said there are 3 in your game) you can customise box-shadow to be different colours, sizes, etc. If you would like to read more about box-shadow click here.
This is the code I applied to an element: box-shadow: inset 0 0 20px #000000; under an HTML/CSS class layers.
Code Snippet for example:
*Note: Scroll to bottom of CSS section for added code with comment above it.

.square {
    float:left;
    position: relative;
    width: 11%;
    padding-bottom: 11%; /* = width for a 1:1 aspect ratio */
    margin: .2%;
    background-color: #1E1E1E;
    overflow: hidden;
}
.content
{
    position:absolute;
    height:80%; /* = 100% - 2*10% padding */
    width:90%; /* = 100% - 2*5% padding */
    padding: 10% 5%;
}
.forest
{
    background-color: rgb(7, 90, 5);
}
.plains
{
    background-color: rgb(245, 238, 136);
}
.hill
{
    border-width: medium;
}
.mountain
{
    border-width: thick;
    border-color: red;
}
.ground
{
    border-width: thin;
}

/* THIS IS FOR 3D LAYER EFFECT */
.layers {
  box-shadow: inset 0 0 20px #000000;
}


text:
Q: Generic entity into a string always with a `d` at the end I use a generic entitytype
Class<T> entityType;

and for a jqpl query I need the entityname Company/Depart etc.
I use the following statement:
+ entity.getClass().getSimpleName()

this returns almost the right string.
companyd / departmentd
       ^             ^

What's wrong with Java? why is there a d? and what method can help me to return the classname of the entity, but not full classified.


text:
Q: Uncheck value of Liferay Edit control by default for all users I have hidden liferay edit control by using way like....
$theme.include($body_top_include)

#if ($permissionChecker.isOmniadmin())

#dockbar()
#end

it will hide doc bar for all users except Admin.
But I am unable to hide portlet controls icons like plus,minus, close portlet icon.
As we know these icons will not displayed if we uncheck value of edit control checkbox.
Liferay might be storing that edit conrol checkbox value on/off in their session.
So how can we uncheck that value by default for all users?
In short I want set value of edit control checkbox by default false for users .

A: Remove the custom- and update-permissions for this page for "User", "Power User" and "Site Member" role.


text:
Q: displaying a line vs word in c++ I am working on my assignment and I have come across an error that i would like to understand (assuming this is an error and not just me overthinking the question).  My current output is giving me one word at a time whereas i would like to display a line at a time. Here is my code:
/*
///////////////////////////////////////////////////////////////////////////
Write a program that creates an array of 100 string objects. Fill the
array by having your program open a (text) file and read one line of the
file into each string until you have filled the array. Display the array
using the format "line #: <string>," where # is the actual line number
(you can use the array counter for this value) and <string> is the stored
string.
///////////////////////////////////////////////////////////////////////////
*/

#include <iostream>
#include <string>
#include <fstream>

using namespace std;

int main ()
{
    string story[100];  // create array of 100 string objects
    string filename = "testfile.txt";
    ifstream file(filename); //open file

    // go through array till index 100
    for( int x=0; x<= 100; x++)
    {
       file >> story[x]; // get line and store into array
       cout << "Line " << x << ":" << story[x] << endl; // display
    }

    return 0;
}

And here is the output:
I
ordered
this
sandwich
once
with
paper .....

whereas i want this:
I ordered this sandwich once with paper-thin carrots in it.
I can't remember what else.
I tried to recreate it.

A: A quick fix is to replace file >> story[x]; by
std::getline(file, story[x]);

as file >> story[x] reads word by word, whereas std::getline reads the whole line.
However, I'd change string story[100]; to a std::vector<std::string> story; instead, since you don't know in advance how many lines your file has, and you may go out of bounds. With a vector, there is no such issue, you can keep push_back into it inside a loop:
std::string line;
while(std::getline(file, line))
{
    story.push_back(line);
}

A: The default delimiter for operator>> is any whitespace. So file >> story[x]; reads a whitespace-delimited set of characters.
You can fix this on the input side either by changing the default delimiter (overly complex, but look at this question) or by using std::getline(file, story[x]);
Alternatively, if you want to store your array of words, you can change the code on the output side. Loop over lines, add a check so that if a word ends in '.' the line ends. Output a space after each word and std::endl at the end of the line.


text:
Q: WSO2 ESB Store and Forward Processor not obeying endpoint message format We have been testing the message processors and queues on wso2 esb. We have been using the sampling processor quite successfully to just log data to a DB. This POX end to end. The sampling processor correctly dequeues a message and sends it to the endpoint. The endpoint is defined as POX and non-chunked, and all this works well.
We decided to try the store and forward processor as we wanted to test out the guaranteed delivery mechanism. So we created a new processor and defined it as store and forward. In the main sequence that stores the message, we added the target.endpoint property before storing the message. The property was set to the same endpoint that was being used in the sampling scenario.
However - what have found is that in this mode, the message transformation does not happen correctly. The content type is set to text/html and the output is chunked. This causes our service to return a 415 error.
We have tried adding messageType, contentType etc to multiple place, to the axis http sender transport, etc, but it seems to make no difference at all.
Any guidance on this would be appreciated

A: Define the following property in the sequence before sending to the endpoint
<property name="DISABLE_CHUNKING" value="true" scope="axis2"/>

A: The JS code below simply inserts the messageID into the return payload to the caller. Using this with a sampling processor and sequence that simply sends to the same endpoint works fine.
    <?xml version="1.0" encoding="UTF-8"?>
    <definitions xmlns="http://ws.apache.org/ns/synapse">
        <registry provider="org.wso2.carbon.mediation.registry.WSO2Registry">
            <parameter name="cachableDuration">15000</parameter>
        </registry>

        <endpoint name="test_e">
            <address uri="http://192.168.45.168:8080/cgi-bin/esbcgi.pl" format="pox"/>
            <property name="DISABLE_CHUNKING" value="true" scope="axis2"/>
        </endpoint>

        <sequence name="fault" trace="enable">
            <log level="full">
                <property name="MESSAGE" value="Executing default 'fault' sequence"/>
                <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
                <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
            </log>
            <drop/>
        </sequence>

        <sequence name="main" onError="fault" trace="enable">
            <in>
                <log level="full"/>
                <property name="OUT_ONLY" value="true"/>
                <property name="FORCE_HTTP_1.0" value="true" scope="axis2"/>
                <script language="js">
                var message = mc.getMessageID();
                var messageId = message.substring(9,45);
                var payload = mc.getPayloadXML().*;
                mc.setPayloadXML(
                <payload>                                                                                <messageId>{messageId}</messageId>{payload}
                </payload>);
                </script>

                <switch xmlns:ns="http://org.apache.synapse/xsd" xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:ns3="http://org.apache.synapse/xsd" source="get-property('To')">

                    <case regex=".*/TEST/.*">
                        <property name="target.endpoint" value="test_e" scope="default"/>
                        <store messageStore="TEST"/>
                    </case>
                    <default/>
                </switch>

                <property name="OUT_ONLY" value="false"/>
                <script language="js">var serviceMessageId = mc.getMessageID();
                mc.setPayloadXML(
                   <tag xmlns="http://tagcmd.com">
                   <messageId>{serviceMessageId}</messageId>                                                                                </tag>);
                </script>

                <send>
                    <endpoint key="MessageService"/>
                </send>
            </in>

            <out>
                <script language="js">
                var messagePayload= mc.getPayloadXML().*.*;
                mc.setPayloadXML(
                <eventResponse>                                                                                <messageId>{messagePayload}</messageId>                                                                                </eventResponse>);
                </script>
                <send/>
            </out>

            <description>The main sequence for the message mediation</description>
        </sequence>

        <messageStore class="org.wso2.carbon.message.store.persistence.jms.JMSMessageStore" name="TEST">
            <parameter name="java.naming.factory.initial">org.apache.qpid.jndi.PropertiesFileInitialContextFactory</parameter>
            <parameter name="java.naming.provider.url">repository/conf/jndi.properties</parameter>
            <parameter name="store.jms.destination">APP8</parameter>
        </messageStore>

        <messageProcessor class="org.apache.synapse.message.processors.forward.ScheduledMessageForwardingProcessor" name="test_p2" messageStore="TEST">
            <parameter name="max.deliver.attempts">1</parameter>
        </messageProcessor>

    </definitions>


text:
Q: Model get stuck by using MirroredStrategy() Im trying to use multiple GPU(2) in Keras, using MirroredStrategy() from Tensorflow. However it leads to the following error:
Epoch 1/5
WARNING:tensorflow:From /home/user/conda36/lib/python3.6/site-packages/tensorflow/python/data/ops/multi_device_iterator_ops.py:601: get_next_as_optional (from tensorflow.python.data.ops.iterator_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.data.Iterator.get_next_as_optional()` instead.
2020-09-06 18:50:54.766930: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcublas.so.10
2020-09-06 18:50:55.069925: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudnn.so.7
2020-09-06 18:50:56.049400: W tensorflow/core/framework/op_kernel.cc:1767] OP_REQUIRES failed at depthwise_conv_op.cc:386 : Invalid argument: Computed output size would be negative: -1 [input_size: 3, effective_filter_size: 5, stride: 1]

At this point the model gets frozen. That means it still running but it does nothing.
If I run it without MirroredStrategy() it works totally fine, but of course it only uses 1 GPU.
I use MirroredStrategy() like this:
def get_model():
    .
    .
    .
    decoded = Conv2D(1, (3, 3), activation='linear', padding='same')(d)

    autoencoder = Model(input_img, decoded)
    autoencoder.summary()
    autoencoder.compile(optimizer='Adagrad', loss='mean_squared_error')
    return autoencoder

if __name__ == '__main__':
    # Model
    strategy = tf.distribute.MirroredStrategy()
    with strategy.scope():
        autoencoder = get_model()

What could be the error?


text:
Q: HTTP_X_FORWARDED_PORT &HTTP_X_FORWARDED_PORTO overrided by ALB infront of it My task is to forward the Port / proto to phpinfo.php file for that We are running haproxy which is in infront of ALB.
I tried below configuration on frontend part in haproxy.cfg but it's not working:

frontend
        http-request set-header X-Forwarded-Port %[src_port]
        #option forwardfor
        #http-request set-header X-Forwarded-Port_HA %[req.hdr(X-Forwarded-Port)]

when I checked that phpinfo.php it got overridden by ALB rule?
Any idea how resolve that?

A: If there is no solution to prevent the ALB from overriding those headers then you can
Switch to a TCP listener in the ALB and let HAProxy handle the HTTP logic.
A TCP listener won't mess with the HTTP content and will just forward it instead.


text:
Q: Multiple requests conflict time to read or copy a file Details:

*

*PHP Version: 5.3.0

*Apache 2.2.37

*Windows XP SP3

I am creating a system backup error (php error and custom error) in TXT, not user data but the dynamically generated page.
If you have already generated the LOG other user does not need to generate as ever existed.
I simulated 10 concurrent connections/requests and sometimes this error occurs:
No such file
Code:
<?php
$p = 'errs/'.$arqErr;
$o = 'temp/'.$arqErr;
if(file_exists($o) && is_readable($o) && is_writable($o)){
    if(!copy($o,$p)){
        echo 'Error copy "',$p,'" to "',$o,'"';
    }
    if(file_exists($o) && is_readable($o) && is_writable($o)){
        unlink($o);
    }
}
?>

sometimes the error occurs:
Warning: Unable to open 'temp/6039dd66559c9431004109202d279557.php' for reading: No such file or directory
and sometimes the error occurs:
Warning: Unlink failed (No such file or directory)
Is it a bug of PHP_5.3.0?
Note: In Windows Seven with PHP5.3.4 this failure does not occur.

A: The problem seems to be having multiple concurrent users trying to access the same files, it doesn't seem to be a PHP related problem.
Try to think of a different logging scheme, maybe using the error_log() function you can have PHP manage concurrency access issues for you.
<?php
error_log('Log message', 3, "md5(address of the page).LOG.txt");
?>


text:
Q: Scrollable plugin doesnt work I am using Jquery tools scrollable plugin.
I want to scroll through a list of images one at a time on mouse wheel movement.
But am not able to achieve this through the code I am working on.
Please help.
Edit : Scrolling occurs through press of UP and DOWN arrows but not through mousewheel.
The HTML :

Jquery code :
$(document).ready(function() {
    $('.scrollable').scrollable({vertical : true, mousewheel : true});
});

CSS :
.scrollable {
position:relative;
overflow:hidden;
height: 150px;
width: 150px;
}
.scrollable .items {
position:absolute;
height:20000em;
}


text:
Q: tensorflow 2.0: An op outside of the function building code is being passed I'm getting an error:
TypeError: An op outside of the function building code is being passed
a "Graph" tensor. It is possible to have Graph tensors
leak out of the function building context by including a
tf.init_scope in your function building code.
For example, the following function will fail:
  @tf.function
  def has_init_scope():
    my_constant = tf.constant(1.)
    with tf.init_scope():
      added = my_constant * 2

Using an NVP layer like follows:
import tensorflow_probability as tfp
tfb = tfp.bijectors
tfd = tfp.distributions
class NVPLayer(tf.keras.models.Model):

    def __init__(self, *, output_dim, num_masked, **kwargs):
        super().__init__(**kwargs)
        self.output_dim = output_dim
        self.num_masked = num_masked
        self.shift_and_log_scale_fn = tfb.real_nvp_default_template(
            hidden_layers=[2], # HERE HERE ADJUST THIS
            activation=None, # linear
            )
        self.loss = None

    def get_nvp(self):
        nvp = tfd.TransformedDistribution(
            distribution=tfd.MultivariateNormalDiag(loc=[0.] * self.output_dim),
            bijector=tfb.RealNVP(
                num_masked=self.num_masked,
                shift_and_log_scale_fn=self.shift_and_log_scale_fn)
            )
        return nvp

    def call(self, *inputs):
        nvp = self.get_nvp()
        self.loss = tf.reduce_mean(nvp.log_prob(*inputs)) # how else to do this?
        # return nvp.bijector.forward(*inputs)
        return nvp.bijector.inverse(*inputs)

I'm not calling tf.init_scope anywhere. A simple version training a layer like seems to work.
I will try to get more more granular trace but I suspect this is something to do with non-eager mode stuff.
UPDATE: so this is definitely coming from the self.loss inclusion in some gradient tape layer. What is the correct way of doing this?

A:
UPDATE: so this is definitely coming from the self.loss inclusion in some gradient tape layer. What is the correct way of doing this?

I think the correct way of doing this is by
self.add_loss(<your loss tensor>)

(https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer#add_loss for more on this)
(edit sorry, I wasn't paying attention to the date of your post, so I guess this wasn't very useful anymore lol)

A: Just had the same problem couple of minutes ago, in my case I wanted to modify state inside my loss function class, here is how I would solve it in your case.
BTW
@simon gave me an inspiration of how to properly asses this. So props to him!
It seems that you should create a tf.Variable for attributes you are going to change while training. Notice how you didn't have any problems with other attributes like self.output_dim, self.num_masked and other.
Try this:
import tensorflow_probability as tfp
tfb = tfp.bijectors
tfd = tfp.distributions
class NVPLayer(tf.keras.models.Model):

def __init__(self, *, output_dim, num_masked, **kwargs):
    super().__init__(**kwargs)
    self.output_dim = output_dim
    self.num_masked = num_masked
    self.shift_and_log_scale_fn = tfb.real_nvp_default_template(
        hidden_layers=[2], # HERE HERE ADJUST THIS
        activation=None, # linear
        )

    ###CHANGE HERE
    self.loss = tf.Variable(0.0)

def get_nvp(self):
    nvp = tfd.TransformedDistribution(
        distribution=tfd.MultivariateNormalDiag(loc=[0.] * self.output_dim),
        bijector=tfb.RealNVP(
            num_masked=self.num_masked,
            shift_and_log_scale_fn=self.shift_and_log_scale_fn)
        )
    return nvp

def call(self, *inputs):
    nvp = self.get_nvp()

    ### CHANGE HERE
    self.loss.assign(tf.reduce_mean(nvp.log_prob(*inputs)))
    # return nvp.bijector.forward(*inputs)
    return nvp.bijector.inverse(*inputs)

Check out this answer on github issue also, similar problem!


text:
Q: primaryStage cannot be resolved to a variable:,When using in other class: JavaFX I know There are many Questions related to this particular error, But I couldn't Find a solution that fits my Error.
So What I am doing is creating a javaFX Application and using the Modality library so that I can create a subwindow which opens always above of the Primary Stage. But the Error I am getting that I am not able set the primaryStage Variable inside the initOwner() function because of the Scope issue as PrimaryStage is outside the scope of SubModal Class.
let me put some code to make things clear..
//SubModal Class
class SubModal extends singleModal {

    SubModal()
    {
        Stage subStage1 = new Stage();
        subStage1.setTitle("New Stage1");
        FlowPane root = new FlowPane();
        root.setAlignment(Pos.CENTER);
        Scene scene1 = new Scene(root, 300, 200);
        Button btn2 = new Button("Button: Stage1");
        root.getChildren().add(btn2);
        btn2.setOnAction(eve-> System.out.println("Clicked on Stage 1 Button"));
        subStage1.initOwner(primaryStage);
        subStage1.initModality(Modality.NONE);
        subStage1.setScene(scene1);
        subStage1.show();
    }
}

//SingleModal Class
public class singleModal extends Application {

    public static void main(String[] args) {

        Application.launch(args);
    }

    public void start(Stage primaryStage) {

        primaryStage.setTitle("PrimaryStage");

        FlowPane root = new FlowPane();
        root.setAlignment(Pos.CENTER);
        Scene scene = new Scene(root, 700, 200);
        Button btn = new Button("Open New Stage");
        btn.setOnAction(eve-> new NewStage());
        root.getChildren().add(btn);
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}

From the above code..
subStage1.initOwner(primaryStage);
This particular line Shows the Error

primaryStage cannot be resolved to a variable

I Know it's because PrimaryStage() is not available in the subModal Class.
So My question is that How Can I fix this issue in JavaFX. How can I bring the primaryStage Value in the SubModal Class so that I can run this Code ErrorFree

A: For the needed functionality ("create a subwindow which opens always above of the Primary Stage") there is no need to extend singleModal.
Here is an mre demonstrating it:
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.FlowPane;
import javafx.stage.Modality;
import javafx.stage.Stage;

public class SingleModal extends Application {

    @Override
    public void start(Stage primaryStage)  {

        Stage subStage1 = new Stage();
        subStage1.setTitle("New Stage1");

        Button btn2 = new Button("Button: Stage1");
        FlowPane root2 = new FlowPane();
        root2.setAlignment(Pos.CENTER);
        root2.getChildren().add(btn2);
        btn2.setOnAction(eve-> System.out.println("Clicked on Stage 1 Button"));
        subStage1.initOwner(primaryStage);
        subStage1.initModality(Modality.NONE);
        Scene scene1 = new Scene(root2, 300, 200);
        subStage1.setScene(scene1);

        primaryStage.setTitle("PrimaryStage");
        FlowPane root = new FlowPane();
        root.setAlignment(Pos.CENTER);
        Scene scene = new Scene(root, 700, 200);
        Button btn = new Button("Open New Stage");
        btn.setOnAction(eve->  subStage1.show());
        root.getChildren().add(btn);
        primaryStage.setScene(scene);
        primaryStage.show();
    }

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

A: I think what u want is just add the code in the start method. I have no idea what the SubModule class is for.
Further Modality is not a library. Maybe call it a feature.
Maybe that example helps http://java-buddy.blogspot.com/2013/08/javafx-example-modality.html .
So add
Stage subStage1 = new Stage();
    subStage1.setTitle("New Stage1");
    FlowPane root = new FlowPane();
    root.setAlignment(Pos.CENTER);
    Scene scene1 = new Scene(root, 300, 200);
    Button btn2 = new Button("Button: Stage1");
    root.getChildren().add(btn2);
    btn2.setOnAction(eve-> System.out.println("Clicked on Stage 1 Button"));
    subStage1.initOwner(primaryStage);
    subStage1.initModality(Modality.NONE);
    subStage1.setScene(scene1);
    subStage1.show();

to the end of the start method.


text:
Q: Material UI transition out and in on single button click In the Material UI Transitions doc, there are examples where a button triggers a transition. I have a case where a button triggers a state change and I want the former data to transition out and then the new data to transition in. The only way I have found to do this is with setTimeout. Is there a better way?
In CodeSandbox
import React from "react";
import Slide from "@material-ui/core/Slide";
import Button from "@material-ui/core/Button";
import Typography from "@material-ui/core/Typography";

const words = ["one", "two", "three"];
const transitionDuration = 500;

class TransitionCycle extends React.Component {
  state = {
    activeIndex: 0,
    elementIn: true
  };

  onClick = () => {
    this.setState({
      elementIn: false
    });
    setTimeout(() => {
      this.setState({
        elementIn: true,
        activeIndex: (this.state.activeIndex + 1) % words.length
      });
    }, transitionDuration);
  };

  render() {
    const { activeIndex, elementIn } = this.state;

    return (
      <div>
        <Button onClick={this.onClick}>Cycle</Button>
        <Slide
          in={this.state.elementIn}
          timeout={transitionDuration}
          direction="right"
        >
          <Typography variant="h1">{words[this.state.activeIndex]}</Typography>
        </Slide>
      </div>
    );
  }
}

export default TransitionCycle;

Is this the best way to do back to back transitions in Material UI? It feels odd to use setTimeout.

A: It's possible to use CSS transitions directly and to use an event listener instead of setTimeout to detect when the transition has happened, Mozilla provides documentation on that here: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions#Detecting_the_start_and_completion_of_a_transition
class MyComponent extends React.Component {
  updateTransition = () => {
    this.setState({
      elementIn: true,
      activeIndex: (this.state.activeIndex + 1) % words.length
    });
  }

  componentDidMount() {
    elementRef.addEventListener("transitionend", updateTransition, true);
  }
}

Don't forget to add the event listener on mounting and remove it on unmounting the component.

A: I think conditionally render all 3 Slides could solve your problem, here.
I also checked the source codes of Transition and it also uses setTimeout in the end, so I think it's not that "weird" to use it, but if the component already wraps the low-level api (I mean setTimeout) for us then we surely don't want to use it.

Edit:
As OP's comment, I found that I misread his example and didn't notice the out transition, so I modified my codes to meet the requirement. Now the previous Slide exits completely, then the next one enters. Everything is done by the component's designed props. (Still, the underlying Transition source codes are just wrapping the Rudolf Olah's method, but I just try to use only the designed props)
However, by only using Transition's props, I think it's impossible to achieve the "delay" entering what OP did using setTimeout, so if OP still wants to have that small delay before "Two" enters, you might still have to use setTimeout.


text:
Q: Drag & Drop HTML 5 jQuery : how to fire the drop event? I would like to handle the Drag & Drop HTML 5 feature with jQuery. It's OK till the drop event which isn't fired. Look at my code :

A

B

C

$('#columns .column').on({
    dragstart: function() {
        $(this).css('opacity', '0.5');
    },
    dragleave: function() {
        $(this).removeClass('over');
    },
    dragenter: function() {
        $(this).addClass('over');
    },
    dragend: function() {
        $(this).css('opacity', '1');
    },
    drop: function() {
       alert('drop');
    }
});

My alert isn't fired but dragend is. What's the difference between dragend and drop?
I found something about jQuery and drop event which is jQuery.event.props.push('dataTransfer');
I'm stuck now, I made a fiddle, someone could help me to finalize my test?
http://jsfiddle.net/sylouuu/bNQeJ/3/

A: Check this one out: http://jsfiddle.net/bNQeJ/4/
According to this you need to call event.preventDefault on the last dragenter or dragover event to create a valid drop target.


text:
Q: How to empty console logs in webkit? Is there a way to empty the console in webkit? I have a function displaying debug data in the console, but it gets very unreadable because of the number of lines, is there a simple way to clear the console?
When I log the console itself, I only see these methods:
assert: function assert() {
count: function count() {
debug: function debug() {
dir: function dir() {
dirxml: function dirxml() {
error: function error() {
group: function group() {
groupCollapsed: function groupCollapsed() {
groupEnd: function groupEnd() {
info: function info() {
log: function log() {
markTimeline: function markTimeline() {
profile: function profile() {
profileEnd: function profileEnd() {
time: function time() {
timeEnd: function timeEnd() {
timeStamp: function timeStamp() {
trace: function trace() {
warn: function warn() {

any idea? without reloading the page obviously...

A: As a non-programmatic solution, you can just click the "clear" button:

A: You have a clear() to clear the console but if you want it programmatically you need to work around. There is answer in stackoverflow - clear javascript console in Google Chrome.
I hope this helps!


text:
Q: mobile responsive not working when rotated landscape So our website is in its last stages before we make it live, however we have just noticed when we were checking mobile responsive everything was working fine, until we rotated the mobile to landscape view and it displayed the same styles as on a desktop and the responsive media wearies weren't working!
  our responsive code is as follows:

@media screen and (max-width:600px){
.stats{
    display:none;
}
}

can anyone help please?

A: A landscape device ratio is bigger than 600px. If you use chrome, dev tools, when re sizing the viewport it shows you exactly the amount of pixels which is visible.
Off the top off my head, i would say you need to change your media query to;
@media screen and (max-width:787px){
.stats{
   display:none;
}
}

A: add
<meta name="viewport" content="width=device-width, initial-scale=1">

between head tags so you can get correct width from mobile devices (https://developer.mozilla.org/en/docs/Mozilla/Mobile/Viewport_meta_tag) and change your media query as
@media screen and (max-width:767px){
  .stats{
    display:none;
  }
}

for mobile devices (phones)


text:
Q: App doesn't open when click on FCM notification(Sent from FCM panel) Hi I am using FCM for push notification in my app.
libraries:
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-messaging:17.3.2'

When i am sending notification from FCM panel , it is not opening app on some devices (Oneplus 6t, 5t) in some cases.
It works when I am sending notification using postman (data payload)

A: you need to set pending intent to your notification i can see that your asking how to add pending intent to notification sent from fcm panel, you should handle notification in OnMessageRecived in FirebaseMessagingService as in the following link
https://github.com/firebase/quickstart-android/blob/4017aac2bdc591dc8b9702953702f09921a4e76d/messaging/app/src/main/java/com/google/firebase/quickstart/fcm/java/MyFirebaseMessagingService.java#L47-L90


text:
Q: android + mysql + login i am creating a test for login proccess using php and mysql to connect to the database on android but i got in my log cat errors and on the emulator a force close can anyone help me with this??
AndroidLogin.java
package com.sencide;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;

import android.os.Bundle;
import android.os.StrictMode;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class AndroidLogin extends Activity implements OnClickListener {

     Button ok,back,exit;
     TextView result;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);

     // Login button clicked
        ok = (Button)findViewById(R.id.btn_login);
        ok.setOnClickListener(this);

        result = (TextView)findViewById(R.id.lbl_result);

    }

    public void postLoginData() {
        // Create a new HttpClient and Post Header
        HttpClient httpclient = new DefaultHttpClient();
         Log.e("Responce-->","after httpclient");
        /* login.php returns true if username and password is equal to saranga */
        HttpPost httppost = new HttpPost("http://192.168.1.64/login.php");
        Log.e("Responce-->","after httppost");
        try {
            // Add user name and password
         EditText uname = (EditText)findViewById(R.id.txt_username);
         String username = uname.getText().toString();

         EditText pword = (EditText)findViewById(R.id.txt_password);
         String password = pword.getText().toString();

            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            nameValuePairs.add(new BasicNameValuePair("username", username));
            nameValuePairs.add(new BasicNameValuePair("password", password));
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            Log.e("Responce-->","after using the list name pair");

            // Execute HTTP Post Request
            Log.w("SENCIDE", "Execute HTTP Post Request");
            HttpResponse response = httpclient.execute(httppost);
            Log.e("Responce-->","after execute the http response");
          //  String str = inputStreamToString(response.getEntity().getContent()).toString();
            String str = EntityUtils.toString(response.getEntity(), HTTP.UTF_8);
            //Log.w("SENCIDE", str);

            Log.e("Responce-->",""+str);

            if(str.toString().equalsIgnoreCase("true"))
            {
             Log.w("SENCIDE", "TRUE");
             result.setText("Login successful");
            }else
            {
             Log.w("SENCIDE", "FALSE");
             result.setText(str);
            }

        } catch (ClientProtocolException e) {
         e.printStackTrace();
        } catch (IOException e) {
         e.printStackTrace();
        }
    }

    private StringBuilder inputStreamToString(InputStream is) {
        String line = "";
        StringBuilder total = new StringBuilder();
        // Wrap a BufferedReader around the InputStream
        BufferedReader rd = new BufferedReader(new InputStreamReader(is));
        // Read response until the end
        try {
         while ((line = rd.readLine()) != null) {
           total.append(line);
         }
        } catch (IOException e) {
         e.printStackTrace();
        }
        // Return full string
        return total;
       }

        /* login.php returns true if username and password is equal to saranga */

    @Override
    public void onClick(View view) {
        // TODO Auto-generated method stub
        if(view == ok){
             Thread t = new Thread(){
                    public void run(){
                        postLoginData();
                    }
                };
                t.start();

          }
    }

}

log_cat
    04-03 06:38:32.182: E/Responce-->(1222): after httpclient
04-03 06:38:32.472: E/Responce-->(1222): after httppost
04-03 06:38:32.522: E/Responce-->(1222): after using the list name pair
04-03 06:38:32.522: W/SENCIDE(1222): Execute HTTP Post Request
04-03 06:38:49.141: E/Responce-->(1222): after httpclient
04-03 06:38:49.151: E/Responce-->(1222): after httppost
04-03 06:38:49.163: E/Responce-->(1222): after using the list name pair
04-03 06:38:49.163: W/SENCIDE(1222): Execute HTTP Post Request
04-03 06:38:49.324: E/Responce-->(1222): after httpclient
04-03 06:38:49.324: E/Responce-->(1222): after httppost
04-03 06:38:49.331: E/Responce-->(1222): after using the list name pair
04-03 06:38:49.331: W/SENCIDE(1222): Execute HTTP Post Request
04-03 06:38:51.662: E/Responce-->(1222): after httpclient
04-03 06:38:51.662: E/Responce-->(1222): after httppost
04-03 06:38:51.662: E/Responce-->(1222): after using the list name pair
04-03 06:38:51.662: W/SENCIDE(1222): Execute HTTP Post Request
04-03 06:38:52.742: E/Responce-->(1222): after httpclient
04-03 06:38:52.742: E/Responce-->(1222): after httppost
04-03 06:38:52.762: E/Responce-->(1222): after using the list name pair
04-03 06:38:52.762: W/SENCIDE(1222): Execute HTTP Post Request

login.php
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="root"; // Mysql password
$db_name="testlogin"; // Database name
$tbl_name="members"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

// username and password sent from form
$myusername=$_POST['username'];
$mypassword=$_POST['password'];

// To protect MySQL injection
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);

// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
echo "true";
}
else {
echo "Login Failed";
}
?>

A: your code is perfect just do:
if you are using above 3.0 android OS then put this in onCreate
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);

or you can use AsyncTask check this link
Insted of this
String str = inputStreamToString(response.getEntity().getContent()).toString();

use
String str = EntityUtils.toString(response.getEntity(), HTTP.UTF_8);

Print log first check what you get
Log.e("Responce-->",""+str);

A: Looking at the times in the log_cat (even the old one before you edited) it seems that the httpclient.execute call never comes back/times out.
Do the emulator have access to the login.php, and login.php is working correctly?
Check with the Browser on the emulator
Beside that you should NOT do any time expensive stuff in the onClick handler.


text:
Q: Android Studio - Cannot select module from Edit Configuration I just checked out my project onto another system from GitHub. I have searched and could not find a solution. I have already tried to remake project and sync project with gradle files. This is my problem. When I press play (the green arrow), the 'Edit configuration' window pops up:

In the drop-down list for 'Module', there are no modules.
To try and check/fix this, I right clicked on my project, went to Module Settings, which brought up this window, and my Module seems to be registered here. So what is the problem? Thanks!


text:
Q: Laravel Valet Not Using Public Dir for Static Html I'm building up a Vue 3 app using the latest tooling which includes Vite.
I'm also using valet to render the built site, so I set my outDir in build to public
It creates a proper build html file with links to the assets folder, which is also created properly ... but Valet will not display anything in the public directory.
Do I seriously have to build my own driver? Why is this not working?


text:
Q: how to get space for image(4sides) which is in listview      <?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/linearLayout1"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:weightSum="1" android:orientation="vertical"
    android:background="#ffffff">

    <LinearLayout android:layout_height="80dp" android:id="@+id/linearLayout3"
        android:layout_width="match_parent" android:weightSum="1"
        android:layout_weight="0.02" android:background="#FFFFFF">
        <ImageView android:id="@+id/imageView1" android:src="@drawable/icon"
            android:layout_width="100dp" android:scaleType="centerCrop"
            android:layout_height="77dp" android:adjustViewBounds="true" android:padding="8sp"></ImageView>
        <LinearLayout android:layout_height="match_parent"
            android:id="@+id/linearLayout4" android:orientation="vertical"
            android:weightSum="1" android:layout_width="match_parent">
            <TextView android:text="TextView" android:id="@+id/textView2"
                android:gravity="left" android:padding="5dp" android:textColor="#000000"
                android:layout_height="43dp" android:layout_width="219dp"
                android:layout_weight="0.58"></TextView>

        </LinearLayout>
    </LinearLayout>
</LinearLayout>

I have a listview in which it consists of image and text i need space for image (4sides) how can i get this can any one say the answer.
Thanks

A:     <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:paddingLeft="16px"
        android:paddingTop="16px" android:paddingRight="16px"
        android:layout_width="fill_parent" android:layout_height="fill_parent">
        <LinearLayout android:orientation="vertical"
            android:background="#000000" android:padding="4px"
            android:layout_width="wrap_content" android:layout_height="wrap_content">
            <ImageView android:layout_width="wrap_content"
                android:background="#FFFFFF" android:layout_height="wrap_content"
                android:paddingLeft="10px"
                android:paddingRight="10px"
                android:paddingTop="4px"
                android:paddingBottom="4px"
                 android:id="@+id/imageView3" />
        </LinearLayout>
<LinearLayout android:layout_height="match_parent"
            android:id="@+id/linearLayout4" android:orientation="vertical"
            android:weightSum="1" android:layout_width="match_parent">
            <TextView android:text="TextView" android:id="@+id/textView2"
                android:gravity="left" android:padding="5dp" android:textColor="#000000"
                android:layout_height="43dp" android:layout_width="219dp"
                android:layout_weight="0.58"></TextView>

        </LinearLayout>

    </LinearLayout>

Try this.... It's Work For me...

A: you can use padding..
like as android:padding="20dip"
in your case
<ImageView android:id="@+id/imageView1" android:src="@drawable/icon"
            android:layout_width="100dp" android:scaleType="centerCrop"
            android:layout_height="77dp" android:adjustViewBounds="true" android:padding="20dip"></ImageView>


text:
Q: When joining a domain on Linux I get the error:Couldn't join realm: Insufficient permissions to join the domain
*

*This is weird because I could join via Adminsistrator but not via a user I created on the DC

*I can join normally on Windows clients


text:
Q: I want to perfect my controller-view interaction when i have multiple sets of data I feel the controller->view interaction miss something, so here is my question.
I have a controller action that is generating a bunch of data :
@first
@second
@third
Each variable is displayed in the view to one html block (partials).
Sometime one or more of these will be empty and i still want to display the other ones.
My solution to address this problem, is to set the variable to a string ("no data") in the controller, as usually the data is some kind of array, i test for string in the view to check if there is real data and respond accordingly.
On top of that, i also have use cases where my data will not always be displayed with the same partial. I know I can do it with a few conditions before calling the correct partial.
A good example of the kind of problem i have in mind would be a Dashboard where some items are sometimes missing or changing depending of the data displayed.
I am already making these use case working, but it feels that I am not doing MVC correctly by putting to much logic inside the view. Is there a better design pattern, rails specific or not, to address this situation?

A: you can check value present or not using present? in MVC.
In your controller/view check this condition.
if @first.present?
  do somthing
end

A: I don't see any serious problem with your approach. You have some logic that determines details of how the data is displayed. You cannot escape this. The only question is where this logic should go (it cannot go away, alas). I think putting it in the View is the best decision.
However I recommend making the interface between the Controller and the View as explicit as possible. Setting a variable to nil is clearer than setting it to "no data". You may need to add more variables to your Model so that the View knows what to do. This is better than having e.g. a variable that is usually an array but sometimes holds a string that tells the View how to display the data.

A: This seems like a job for the Draper
Draper inserts a View-Model into the MVC mix which sits between Controller and View and decorates a model, handling all custom view-logic in an object-oriented way while keeping it separate both from view and model layers.
Take a look at the RailsCast on Draper for example. Pretty nice (and logical if you think of it).


text:
Q: Dependency Injection into Roslyn analyzers I have a custom Roslyn analyzer which inherits from DiagnosticAnalyzer. It is packed in VSIX extension which contains custom Package class. I'd like to pass an instance of a class with the settings (CodeAnalysisSettings instance) from the package to my DiagnosticAnalyzer.
I've tried to use MEF for that purpose. I've registered an instance of my settings class in VS Package using the following code:
protected override void Initialize()
{
    base.Initialize();
    IComponentModel componentModel = Package.GetGlobalService(typeof(SComponentModel)) as IComponentModel;
    new CompositionContainer(componentModel.DefaultCatalog).ComposeExportedValue(
                new CodeAnalysisSettings(...));
}

Analyzer looks as follows:
[DiagnosticAnalyzer(LanguageNames.CSharp)]
public class MyAnalyzer : DiagnosticAnalyzer
{
    [Import]
    public CodeAnalysisSettings Settings { get; set; }
}

Settings class:
[Export]
public class CodeAnalysisSettings
{
    public CodeAnalysisSettings()
    {
    }

    public bool RecursiveAnalysisEnabled { get; }
}

For some reason Settings property is not imported - its value is always null.
Please help.

A: I've ended up using a service locator (CommonServiceLocator package) that consumes MEF container as a source.
Since VS infrastructure doesn't allow adding new registrations (IComponentModel.DefaultCatalog throws an exception which tells that this functionality is not supported anymore), I've created a new container inside Package.Initialize():
var container = new CompositionContainer(CompositionOptions.Default, componentModel.DefaultExportProvider);
container.ComposeExportedValue<CodeAnalysisSettings>(new CodeAnalysisSettings(...));
var serviceLocator = new MefServiceLocator(container);
ServiceLocator.SetLocatorProvider(() => serviceLocator);

Roslyn diagnostic consumes this dependency:
var settings = CodeAnalysisSettings.Default;
if (ServiceLocator.IsLocationProviderSet)
    settings = ServiceLocator.GetInstance<CodeAnalysisSettings>();


text:
Q: Devops Sprint board shows remaining hours in Closed state - how do I eliminate? I have a sprint board where the closed column shows up having a 2h remaining estimate - but the work items there are closed, so no work should remain - looked at all of the items there and none had any remaining time to show - how can I get a realistic value here?

A: If the type of work item which still display remaining hours after closed is Bug, then remaining hours will not be automatically cleared.
We clear the remaining hours for Tasks when the work item is Closed. However, bugs are slightly different because you have more flexibility with how you work with bugs and therefore we do not clear the remaining hours for the Bug work item type without a change to the process. Depending on whether you are an on-premises customer or not, you can add a rule to the Bug work item type to clear Remaining Hours. For details please refer to this docs and case.
If you are a cloud user, you could try adding this rule in organization setting -> Boards/Process -> Select the process you need to customize -> Select the work item type to add the rule -> Rules -> add "clear the value of Remaining Work" rule.

Hope this helps.


text:
Q: bitnami_wordpress update for https This one doesn't have the obvious solution! This is AWS Lightsail Wordpress by Bitnami.
Problem: Load this Wordpress site to HTTPS:
http://morrisdigital.studio/   -->   https://morrisdigital.studio/ (with all the css etc)
The database and UI don't match!
In the database, we have:

Which does not match the UI:

I tried: Updating the siteurl and home to https://morrisdigital.studio/ , then restarted the server.
What happened: Nothing, of course, so I changed it back to http://127.0.0.1/wordpress/
So, WHERE is the actual place to update the links in the database?

A: Bitnami Engineer here,
You can set the home and site url for WordPress in its configuration file (opt/bitnami/apps/wordpress/htdocs/wp-config.php)
define('WP_SITEURL', 'https://morrisdigital.studio/ ');
define('WP_HOME', 'https://morrisdigital.studio/');

That change should update all the links in the application. You can find more information here:
https://docs.bitnami.com/aws/apps/wordpress/administration/configure-domain/


text:
Q: Hibernate: bidirectionality vs. unidirectionality, depending on relationship Reading a wiki page about Hibernate I elaborated some perplexing conclusions:
1) Bidirectionality is reccomended in one-to-many

2) Bidirectionality is optional in many-to-one

3) Bidirectionality is normally present in many-to-many

4) Unidirectionality is reccomended in one-to-one relationships,
using as owner class the one with the primary key of the
relation (not the foreign key).

Are these statements true? Do you have any example to explain why in some cases unidirectionality is reccomended and in others bidirectionality is reccomended instead?
Here's the wiki page (read under "concepts"):
http://wiki.elvanor.net/index.php/Hibernate

A: Note that "bidirectionality" in the context of Hibernate means that in your Java classes, both sides of the relationship maintain a link to the other side. It has no impact on the underlying database schema (except in the case of indexed collections, see below), it's just whether or not you want the Java side to reflect that.
For all of your conclusions, "recommended" actually translates to "it usually ends up making sense, given your business logic, that you'd do it this way".
You really want to read through chapters 7 and 8 of the Hibernate Core Reference Manual.

*

*It's recommended if you need it. A lot of convenience comes from specifying a bidirectional relationship; particularly it becomes possible to navigate the relationship from both ends in your business logic. However, if you don't actually need to do this, there's nothing to gain. Use whatever is most appropriate for the situation. In practice I've found that I want to specify both ends of the relationship to Hibernate more often than not -- but it is not a rule, rather, it reflects what I want to accomplish.

*This is true. In a many-to-one (or one-to-many) relationship, it is optional. Consider the following schema:
table: users
fields: userId, userName

table: forumPosts
fields: postId, userId, content

Where forumPosts.userId is a foreign key into users. Your DAO classes might be (getters/setters omitted for brevity):
public class User {
    private long userId;
    private String userName;
}

public class ForumPost {
    private long postId;
    private User user;
    private String content;
}

As you can see, this is a unidirectional many-to-one relationship (ForumPost-to-User). The ForumPost links to the user, but the User does not contain a list of ForumPosts.

You could then add a one-to-many mapping to User to make it have a list of ForumPosts. If you use a non-indexed collection like a set, this has no impact on the database schema. Merely by specifying both sides to Hibernate, you have made it bidirectional (using exactly the same schema as above), e.g.:
public class User {
    private long userId;
    private String userName;
    private Set<ForumPost> forumPosts;
}

public class ForumPost {
    private long postId;
    private User user;
    private String content;
}

Hibernate will now populate User.forumPosts when necessary (essentially with SELECT * FROM forumPosts WHERE userId = ?). The only difference between bidirectional and unidirectional here is that in one case Hibernate fills a set of ForumPosts in User, and in the other case it doesn't. If you ever have to get a collection of any given user's posts, you will want to use a bidirectional relationship like this rather than explicitly constructing an HQL query. Depending on your inverse/insert/update/cascade options in your relationship, you can also add and remove posts by modifying the User's set of posts, which may be a more accurate reflection of your business logic (or not!).

The reason I specified that non-indexed collections don't impact the underlying schema is because if you want to use an ordered, indexed collection like a list, you do have to add an extra list index field to the forumPosts table (although you do not have to add it to the ForumPost DAO class).

*This is true, but is not a requirement and it's deeper than that. Same as above. Bidirectionality is usually present in many-to-many. Many-to-many relationships are implemented with a third join table. You specify the details of this table on both sides of the relationship. You can simply not specify the relationship on one side, and now it's a unidirectional relationship. Again, whether or not you tell Hibernate about the mapping is what determines if its unidirectional or bidirectional (in the context of Hibernate). In this case it also has no impact on the underlying schema unless you are using an ordered index collection. In fact, the many-to-many example in the Hibernate reference manual is a unidirectional setup.

In reality, it would be odd to have a unidirectional many-to-many relationship, unless perhaps you are working with an existing database schema and your particular application's business logic has no need for one of the sides of the relationship. Usually, though, when you've decided you need a many-to-many relationship, you've decided that because you need to maintain a collection of references on both sides of the relationship, and your DAO classes would reflect that need.

So the correct conclusion here is not merely that "bidirectionality is normally present in many-to-many", but instead "if you've designed a database with a join table, but your business logic only uses a unidirectional relationship, you should question whether or not your schema is appropriate for your application (and it very well may be)".

*This is not true. Exactly the same as all the points above. If you need to navigate the one-to-one relationship from both sides, then you'd want to make it bidirectional (specify both sides of the mapping to Hibernate). If not, then you make it unidirectional (don't specify both sides of the mapping to Hibernate). This again comes down to what makes sense in your business layer.
I hope that helps. I left a lot of intricacies out. You really should read through the Hibernate documentation - it is not organized particularly well but Chapter 7 and 8 will tell you everything you need to know about collection mapping.
When I'm designing an application and a database from scratch, personally, I try to forget about Hibernate and the database entirely. I set up my DAOs in a way that makes sense for my business requirements, design a database schema to match, then set up the Hibernate mappings, making any final tweaks to the schema (e.g. adding index fields for ordered collections) at that point if necessary.


text:
Q: Can cakephp have multiple 'content'? So in cakephp's layout we have the
$this->fetch('content')

right? does it mean i can only have one 'content' in one layout? I really need multiple content from multiple controller can it be done? how? please help me!!!

A: The layout isn't capable of pulling information from the controller. The controller is the place where the view is prepared to be placed within the layout.
When you access a CakePHP URL, it's in the following format:
http://example.com/controller/action
In other words, you're connecting directly to the controller, not the layout.
You use the controller to get data from the Models and then when everything is ready you set it to a view and then the view is displayed, with the layout wrapped around it. So, you only put HTML/CSS etc in your layout if you want it to appear in all of your views.
To answer your question, though, your controllers don't actually have any content. Your content is (presumably) in your database. Databases are accessed using Models and it's possible to pull data from multiple Models using a single controller, which is usually done by defining relationships between multiple Models.


text:
Q: How do I pass a variable created in a python script to be used in a bash script? I am using Python 3.6.3.
I have created a python script 'create.py'. This python script calls and runs a bash script 'verify.sh'.
The 'verify.sh' script sends an email:
#!/bin/sh
emailGroup="dummy@email.com"
echo "The variable of interest is x(insert here): $1 " | mail -s "The variable of interest is x(insert here)" ${emailGroup}

So in my python script 'x' is determined. I want to insert x into the 'verify.sh' script above so that it goes out with the email.

A: Here's an example of how to do that.
First the Python script:
#!/usr/bin/python3
import subprocess
recipient = "me@stackoverflow.com"
subject = "Python Script Calls Bash Script"
body = "This is a test, yes it is, yes it is."
notify_script = "/home/me/Scripts/notify"
subprocess.run([notify_script, recipient, subject, body])

Second the Bash script:
#!/bin/bash
recipient="$1"
subject="$2"
body="$3"
dummy_mailer -r "$recipient" -s "$subject" -b "$body"

Any number of args (see ARG_MAX) can be sent from the Python script using subprocess.run(), simply add or remove them from the list given to run(). e.g.
subprocess.run([path_to_script, arg_1])
subprocess.run([path_to_script, arg_1, arg_2])
subprocess.run([path_to_script, arg_1, arg_2, arg_3, arg_4])

A: If that's really the full extent of your verify.sh script, you can remove it entirely.
import subprocess

sent = subprocess.run(
    ['mail', '-s', 'The variable of interest is x(insert here)', 'dummy@email.com'],
    input='The variable of interest is x(insert here): {0}'.format(x),
    text=True, check=True)

If you are on an earlier version of Python than 3.7, you will want to use universal_newlines=True instead of text=True.
You don't really need mail -s either; see e.g. How to send an email with Python?


text:
Q: float: left property On my webpage when I'm using float: left for the navigation bar buttons (to line up horizontal) it makes content after that move to the right, such as:
[ Home About More ]
                   Text

I want it to be:
[ Home About More ]
Text

Any suggestions?

A: You need to use the clear attribute in Text. Like so:
.text {clear:left}

A: Use the clearfix solution to fix the issue.
http://themergency.com/css-clearfix-demystified/
UPDATE:
In the CSS file, add the following:
.clearfix:before, .clearfix:after { content: ""; display: table; }
.clearfix:after { clear: both; }
.clearfix { zoom: 1; }

Then in your HTML, add the clearfix class to the parent container of the floated elements. Not sure what your HTML markup looks like but it may be something along the lines of with the clearfix solution:

Home

About

More

A: This is a very common issue, I would recommend defining a css entry like so
.clear {clear:both;}
Then in the future you can simply add this class to an element that requires the above floats to be cleared, or simply add an empty div with this class like so.

A: Or this works to (overflow trick):

[ Home

About

More ]

Your other text


text:
Q: Android: load an other class when clicking a button? I have a project in eclipse called "mijnenveger". Of course, the file Mijnenveger.java was automatically created. It has for example the onCreate method wihch places buttons on the screen.
Now I want to make a menu in front of it, with, for example, menu.xml. With the buttons options, help and play. And when I click play, the normal view (which is main.xml and includes Mijnenveger.java).
I know I can set setContentView to menu:
public class Mijnenveger extends Activity implements View.OnClickListener{

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);  //main would be replaced by menu

And make an onClick action for the play button to show main.xml:
setContentView(R.layout.main);

But there is one problem with that. When I start the app, it doesn't need to load all the buttons and stuff which are in the onCreate() of Mijnenveger.java. Only the menu in this case.
So is it possible to throw everything from Mijnenveger.java in a new class (class1.java for example) and make Mijnenveger.java only load the menu, and then when the play button is clicked, it loads the class class1.java which opens main.xml with all the buttons and stuff.
I hope you understand it, it was hard to explain in English :)
EDIT:
Found a possible answer(http://stackoverflow.com/questions/2865238/how-do-i-call-a-java-file-on-click-in-another-java-class):
startActivity(new Intent(this, Game.class));

I've done what I said above, and called the file Game.java. But then it gives me this error:
The constructor Intent(new View.OnClickListener(){}, Class) is undefined
EDIT2:
I now have this:
 final Button startgame = (Button) findViewById(R.id.startknop);
    startgame.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent i = new Intent(this, Game.class);
            startActivity(i);
            setContentView(R.layout.main);
        }
    });

And it still gives this error:
The constructor Intent(new View.OnClickListener(){}, Class) is undefined
There is somthing wrong about "this".

A: create second acitvity class, for example GameActivity.java.
in method onClick for button play, start GameActivity class.
Intent i = new Intent(this, GameActivity.class);
startActivity(i);

A: put the menu screen in the activity which runs first and make your button start different activity for the relevant code.
learn more about activities and intents from the Android developer's documentation


text:
Q: 404 Page works on localhost but not on production (Azure Web App) I have a 404 page on my localhost which works just fine. However, when it's pushed to Azure Web App, it does not.
I pushed it originally through the Publish tool, and right now I use the built in feature that pushes from a branch in Github.
I have the following web.config:
<system.web>
    <customErrors mode="On" defaultRedirect="~/Error/Index">
      <error redirect="~/Error/NotFound" statusCode="404" />
      <error redirect="~/Error/Index" statusCode="500" />

    </customErrors>
    <!-- More stuff :-) -->
  </system.web>
  <system.webServer>

This is my error controller:
 public class ErrorController : Controller
    {
        public ViewResult Index()
        {
            return View("Error");
        }
        public ViewResult NotFound()
        {
            Response.StatusCode = 404;
            return View("NotFound");
        }
    }

My production web.config transformation file has not been changed at all (see how stuff is in comments):
<?xml version="1.0"?>

<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=301874 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <!--
    In the example below, the "SetAttributes" transform will change the value of
    "connectionString" to use "ReleaseSQLServer" only when the "Match" locator
    finds an attribute "name" that has a value of "MyDB".

    <connectionStrings>
      <add name="MyDB"
        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
    </connectionStrings>
  -->
  <system.web>
    <compilation xdt:Transform="RemoveAttributes(debug)" />
    <!--
      In the example below, the "Replace" transform will replace the entire
      <customErrors> section of your Web.config file.
      Note that because there is only one customErrors section under the
      <system.web> node, there is no need to use the "xdt:Locator" attribute.

      <customErrors defaultRedirect="GenericError.htm"
        mode="RemoteOnly" xdt:Transform="Replace">
        <error statusCode="500" redirect="InternalError.htm"/>
      </customErrors>
    -->
  </system.web>
</configuration>

However, while my 404 page works just fine in localhost, in production I get:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Instead of a nice looking 404 page.
Any idea?

A:
I have a 404 page on my localhost which works just fine. However, when it's pushed to Azure Web App, it does not.

I used your code and reproduced your results.
I add <httpErrors existingResponse="PassThrough" />  to <system.webServer> </system.webServer>  in the web.config ,then it works fine.
<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
      <remove name="ApplicationInsightsWebTracking" />
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
    </modules>
    <httpErrors existingResponse="PassThrough" />
</system.webServer>

You can refer to this article for more details.


text:
Q: Larger "Select Components" page in Inno Setup I have been trying for a while to make the "Select Components" page larger as in the picture below, including the components inner-window (the white one), because I have many components ... and it gets easier to select when it is larger window. If anyone could tell if that's even possible, please give me a hint or point me in a direction.

Thankfully,
BeGiN

A: Based on your original script I made the following changes. For storing original positions (top and height values) I have used an array of integers and made two general procedures for storing the current positions and for restoring them.
The restoring procedure has the HeightOffset parameter, where you can specify the value, by which all the values from the input array of integers will be increased before they are passed to the wizard form component properties. Except that, I've declared a separate flag indicating that wizard form has modified size.
I used all of this because it improves readability of the script and it's easily extendable for other pages:
[Code]

type
  TPositionStorage = array of Integer;

var
  CompPageModified: Boolean;
  CompPagePositions: TPositionStorage;

procedure SaveComponentsPage(out Storage: TPositionStorage);
begin
  SetArrayLength(Storage, 10);

  Storage[0] := WizardForm.Height;
  Storage[1] := WizardForm.NextButton.Top;
  Storage[2] := WizardForm.BackButton.Top;
  Storage[3] := WizardForm.CancelButton.Top;
  Storage[4] := WizardForm.ComponentsList.Height;
  Storage[5] := WizardForm.OuterNotebook.Height;
  Storage[6] := WizardForm.InnerNotebook.Height;
  Storage[7] := WizardForm.Bevel.Top;
  Storage[8] := WizardForm.BeveledLabel.Top;
  Storage[9] := WizardForm.ComponentsDiskSpaceLabel.Top;
end;

procedure LoadComponentsPage(const Storage: TPositionStorage;
  HeightOffset: Integer);
begin
  if GetArrayLength(Storage) <> 10 then
    RaiseException('Invalid storage array length.');

  WizardForm.Height := Storage[0] + HeightOffset;
  WizardForm.NextButton.Top := Storage[1] + HeightOffset;
  WizardForm.BackButton.Top := Storage[2] + HeightOffset;
  WizardForm.CancelButton.Top := Storage[3] + HeightOffset;
  WizardForm.ComponentsList.Height := Storage[4] + HeightOffset;
  WizardForm.OuterNotebook.Height := Storage[5] + HeightOffset;
  WizardForm.InnerNotebook.Height := Storage[6] + HeightOffset;
  WizardForm.Bevel.Top := Storage[7] + HeightOffset;
  WizardForm.BeveledLabel.Top := Storage[8] + HeightOffset;
  WizardForm.ComponentsDiskSpaceLabel.Top := Storage[9] + HeightOffset;
end;

procedure InitializeWizard;
begin
  CompPageModified := False;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurpageID = wpSelectComponents then
  begin
    SaveComponentsPage(CompPagePositions);
    LoadComponentsPage(CompPagePositions, ScaleY(200));
    CompPageModified := True;
  end
  else
  if CompPageModified then
  begin
    LoadComponentsPage(CompPagePositions, 0);
    CompPageModified := False;
  end;
end;

A: Inno Setup 6 has component alignment set correctly. So all you need to do is to set wizard form larger.
Thanks for that the code by TLama reduces to:
var
  CompPageModified: Boolean;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurpageID = wpSelectComponents then
  begin
    WizardForm.Height := WizardForm.Height + ScaleY(200);
    CompPageModified := True;
  end
    else
  if CompPageModified then
  begin
    WizardForm.Height := WizardForm.Height - ScaleY(200);
    CompPageModified := False;
  end;
end;


text:
Q: Working with SHA256 hashing on iOS I've looked at at least 6 pages on SO about iOS and SHA256, and I still can't figure out what's going on.
Generally, I'm used to doing SHA256 in PHP with the hash() function, and it returning a string value like: db1204372d8d9f14acc608b497227047d63ad868987883d0a29198be8e6ce853
I'm trying to implement SHA256 in my iOS app in order to beef up security between the app and the server, but the encoding part is giving me a headache...
I'm using an NSData category:
+ (NSData *)sha256:(NSData *)data {

NSMutableData *out = [NSMutableData dataWithLength:CC_SHA256_DIGEST_LENGTH];

CC_SHA256(data.bytes, data.length,  out.mutableBytes);

if ( CC_SHA256(data.bytes, data.length, out.mutableBytes) ) return out;

return nil;
}

However, no matter how I try to encode the resulting NSData object into an NSString (to send to the server), I end up with a string like this ã°ÄBüûôÈo¹$'®AädL¤xR¸U
My question - how can I implement a category that behaves the same as hash, such that passing the same value to either method should yield the same value?
Thanks for the helps

A: Sorry that I'm very late to the party.
The result you get from php is the concatenation of the hexadecimal values of each byte. The value you got from ios is the actual byte string.
I suspect you are using something like [[NSString alloc] initWithData:theData encoding:NSUTF8StringEncoding] to get the string.
But you should convert NSData to the form you require using [data description] as described in How can i convert NSdata to hex string?.


text:
Q: is there an effective (possibly) native way of JQuery and RaphaelJS intertwined? Where JQuery is (to my understanding) completely DOM based, and Raphael is just the opposite, how can I use the best of both worlds in the same document? is there any efficient way to achieve that?
further notes:
I know that Raphael would create actual DOM elements in the code but their IDs require me to go into every element I create and then try to incorporate it into the JQuery. is there any easy way to use Raphael on DOM elements rather then on scripted elements?
Thanks !

A: Unfortunatly Raphael can not work with DOM elements which it did not create. What you can do however, is to import svg using raphael-svg-import library, so in conjunction with jQuery it will look like this:
var mySvg = $('svg#IdOfMySVGElement')
var paper = Raphael(10, 10, 800, 500);
var set = paper.set();
paper.importSVG(mySvg.html(), set);
//the whole svg will be recreated so we need to remove the original
mySvg.remove();

Bear in mind that it will work with svg enabled browsers only. For VML you will need to look for another solution or write your own vml parser.


text:
Q: How do I mint multiple NFTs on Hedera calling TokenMintTransaction only once? I want to mint 100 NFTs. Do I need to call "TokenMintTransaction()" 100 times?
Is there some way to mint 100 NFTs in a single API call?
Here's the code I'm using:
let mintTx = new TokenMintTransaction().setTokenId(tokenId).setMetadata([Buffer.from(CID)]).freezeWith(client);

What can I pass in .setMetadata() to mint multiple NFTs?

A: Yes, it is possible to mint multiple NFT's in a single TokenMintTransaction() but there are things to note.
A transaction has a max size of 6,144 kb including signatures.
.setMetadata() accepts an array of NFT metadata. Each array element will result in an NFT with a unique serial number being created under the token type. The receipt for the transaction will include all the new serial numbers that were created by the transaction.
It is important to keep an eye on your metadata size because if you put too many items in the array, you will receive a TRANSACTION_OVERSIZE error and no NFT's will be minted.
Here is an example for minting multiple NFT's in a single transaction:
let metadata = [];
let CID = [];
for (let i = 0; i < 3; i++) {
  // NFT STORAGE
  const fileName = `LEAF${i + 1}.jpg`;
  metadata[i] = await nftClient.store({
    name: `LEAF${i + 1}`,
    description: "Leaf NFT.",
    image: new File([await fs.promises.readFile(fileName)], fileName, { type: "image/jpg" }),
  });

  CID[i] = Buffer.from(metadata[i].url);

  // IPFS URI FOR NFT METADATA - See HIP-412: https://hips.hedera.com/hip/hip-412
  let ipfsBaseUrl = "https://ipfs.io/ipfs/";
  let ipfsGatewayLink = ipfsBaseUrl + metadata[i].ipnft + "/metadata.json";
  console.log(`- IPFS link for serial ${i + 1}: ${ipfsGatewayLink} \n`);
}

// MINT NEW BATCH OF NFTs
let mintTx = new TokenMintTransaction().setTokenId(tokenId).setMetadata(CID).freezeWith(client);
let mintTxSign = await mintTx.sign(operatorKey);
let mintTxSubmit = await mintTxSign.execute(client);
let mintRec = await mintTxSubmit.getRecord(client);

console.log(`- Minting fees: ${mintRec.transactionFee._valueInTinybar.c[0] * 1e-8} hbar \n`);

While creating 100 NFT's at a time may not be possible, you should be able to do tens at a time (depending on the metadata size).


text:
Q: Editing field value of a parent I have my Case object linked to the Contact object with a lookup field (Contact__c). What is the best way to modify the value of a field in a Contact record from the Case record, when there's a contact selected?
For example, I have a Case with the Contact__c lookup populated. I want to modify the value of a picklist in the Contact, from the Case.

A: If you are looking to do this from the a Case page layout, unfortunately I don't believe this will be possible. A page layout uses a StandardController which doesn't have any functionality innately built into it to save any object but the main object of the controller.
Programmatically this is very simple. You just need to update each object separately, but that won't help you for a page layout.

A: Your question is a bit confusing. DO you want something to happen when user selects contact in the lookup? (what if he selects one, then another one, then maybe selects 1st one again?)... I think some problematic scenarios sit in this area so maybe think again what you want to achieve... And if that's really it - Visualforce Case creation page (don't expect it to work when Case comes from outside like Web-to-Case, Email-to-Case, customer portal...)
If it has to happen on Case save... I don't think you can make cross-object workflows between Case and Contact and besides picklist updates in workflows are annoying (select previous/next value on picklist... wow, awesome, thx SF).
Trigger I'm afraid? Or some Javascript'y hack in the sidebar... or batch job that periodically checks new / changed Cases... Trigger sounds most accurate for this task.
P.S. It's not exactly "Parent" ;) If you'd have a master-detail relation between the two you could cheat by either making it a rollup summary or make a workflow on Contact "count of cases changed -> do something". Alas standard object can't be a "detail".
EDIT: Or maybe you're on the Case viewing page? Then you're one click away from editing the contact (hover over the link, balloon pops up, [edit])... If you really really need to do it from detail page - embed a VF page in the layout:
<apex:page standardController="Case" extension="myclass">

and in the Controller extension query for contact etc.


text:
Q: how i can let the bot delete all messages in a specific channel then send's a message and loop this This piece of code deletes any message in a specific channel after 3 seconds
client.on("messageCreate", async message =>{
    if (message.channel.id === '899644830848798755')
    {
        setTimeout(() => message.delete(), 3000)
    }
});

What I want is that after 5 minutes, it will delete its own message and send a message without deleting it. Something like this:
client.on('ready', () => {
    setInterval(() => {
        message.channel.bulkDelete.then(() => {
          client.channels.cache.get('899644830848798755').send('Hello here!')
    }, 300000);
})

and can someone tell me what the difference between setTimeout() and setInterval() is?

A: You're using bulkDelete method, it will delete the message every 5 mins. You need to create a function to create your looping, you can also use setInterval aswell.
Using setInterval method:
client.on('ready', () => {
    setInterval(() => {
       const chan = client.channels.cache.get('899644830848798755');
        chan.send('Hello here!')
    }, 300000);

})

Using function method:
client.on('ready', () => {
   async function repeat() { //First loop of function declined.
     setTimeout(() => {
        const chan = client.channels.cache.get('899644830848798755');
        chan.send('Hello here!')

        repeat(); //Second loop Accepted for loop
     }, 300000)
   }
   repeat(); //First loop function accepted. Then ignore
})

SetInterval:

The setInterval() method, offered on the Window and Worker interfaces, repeatedly calls a function or executes a code snippet, with a fixed time delay between each call.

setInterval source link: Click Here
SetTimeout:

The global setTimeout() method sets a timer which executes a function or specified piece of code once the timer expires.

setTimeout source link: Click Here


text:
Q: how to delete row from grid ( CRUD ) in PHP without using jquery & $_GET? I want to delete row from grid without using jquery and $_GET. because I dont want to show Row ID.
<form action="" method="post">
<?php

$readsql= "select * from country";
$readresult=$conn->query($readsql);
if ($readresult->num_rows > 0) {
 while($row = $readresult->fetch_assoc()) {
   echo '
';
     echo ''. $row['country_id'] . '	';
     echo ''. $row['country_name'] . '	';
     echo ''. $row['country_phon'] . '	';
     echo '';
     echo '<button type="button" class="btn btn-success abc"  data-toggle="modal" data-cid='. $row['country_id'] .' data-cphone='.$row['country_phon'].' data-cname='.$row['country_name'].' >Update</button>';
     echo ' ';
     echo '<button type="submit" class="btn btn-danger del" name="delete" data-id='.$row['country_id'].'>Delete</button>';
     echo '	';
     echo '
';  } echo "
";
   } else {
   echo "0 results";
   }?></form>

A: If you want to hide the row, create a CSS class
.hidden { display:none;}

Then change the type of the delete button to button. Add an onclick attribute to the button:
onclick="this.parentNode.parentNode.className= 'hidden'"
If you want to delete it from the data table, you will need to send some term to the server to identify the record.