text:
Q: How to plot species richness against altitude for these columns in R? I'm new to R. I'm just trying to familiarise myself with this language for the future and was looking for some help with manipulating and plotting data. So I have imported data from excel with a set number of columns, and I'm looking to plot the species richness of birds against altitude. The data within the two columns looks something like this:
Species Altitude (m)
Species A 100
Species B 100
Species C 100
Species D 100
Species E 100
Species C 200
Species D 200
Species E 200
Species A 300
Species C 300
Species D 300
Species E 300
Species B 400
Species E 400
Species B 500
Species D 500

My question is how would I manipulate the data to sum the number of species found at each altitude and present it as a plot without using ggplot2? Thanks.

A: You can use aggregate to sum Altitude for each Species and then use barplot to plot it.
tmp <- aggregate(Altitude~Species, df, sum)
barplot(tmp$Altitude, names.arg = tmp$Species,xlab = 'Species', ylab = 'Altitude')

data
df <- structure(list(Species = c("SpeciesA", "SpeciesB", "SpeciesC",
"SpeciesD", "SpeciesE", "SpeciesC", "SpeciesD", "SpeciesE", "SpeciesA",
"SpeciesC", "SpeciesD", "SpeciesE", "SpeciesB", "SpeciesE", "SpeciesB",
"SpeciesD"), Altitude = c(100L, 100L, 100L, 100L, 100L, 200L,
200L, 200L, 300L, 300L, 300L, 300L, 400L, 400L, 500L, 500L)),
class = "data.frame", row.names = c(NA, -16L))

A: ## loding the data
species <- read.csv(text='Species,Altitude
Species A,100
Species B,100
Species C,100
Species D,100
Species E,100
Species C,200
Species D,200
Species E,200
Species A,300
Species C,300
Species D,300
Species E,300
Species B,400
Species E,400
Species B,500
Species D,500', header=T)
species
#>      Species Altitude
#> 1  Species A      100
#> 2  Species B      100
#> 3  Species C      100
#> 4  Species D      100
#> 5  Species E      100
#> 6  Species C      200
#> 7  Species D      200
#> 8  Species E      200
#> 9  Species A      300
#> 10 Species C      300
#> 11 Species D      300
#> 12 Species E      300
#> 13 Species B      400
#> 14 Species E      400
#> 15 Species B      500
#> 16 Species D      500
## transforming species to data.table
data.table::setDT(species)

species = species[, .(`Number of Species` = .N), by = c("Altitude")]

barplot(species$`Number of Species`, names.arg=species$Altitude, xlab='Altitude', ylab='Number of Species')

the .N gives the count of the rows for the current group, the by specifies by which column to group. this returns a data.table with Altitude and Number of Species columns.
for an introduction on the data.table arguably one of the fastest packages for data.frame manipulation check the vignette.

A: You can use the function aggregate() to aggregate your dataset by species or by altitude, using any existing function or defining a new one.
In your case, I would just use the function length() to aggregate as it returns the number of cases in each group. If you have multiple counts of the same species in one altitude, it might be wise to define a function that returns the number of different species.
You could also use a function to compute the entropy of species (if you want to get the diversity) or the gini coefficient (if you want a measure for dominance).
luniq = function(v){
  return(length(unique(v)))
}

d = data.frame("Species"=c("Species A","Species B","Species C","Species D",
                           "Species E","Species C","Species D","Species E",
                           "Species A","Species C","Species D","Species E",
                           "Species B","Species E","Species B","Species B"),
               "Altitude (m)"=c(100,100,100,100,
                                100,200,200,200,
                                300,300,300,300,
                                400,400,500,500))

agg1 = aggregate(d[["Species"]]~d[["Altitude..m."]],FUN=length)
agg2 = aggregate(d[["Species"]]~d[["Altitude..m."]],FUN=luniq)

d = data.frame("Number.Species"=agg1[,2],
               "Number.Different"=agg2[,2],
               row.names=agg[,1])

barplot(t(as.matrix(d)),beside=T,legend.text=names(d))

Note that I changed the altitude 500 to contain two exemplars of the same species. So, the count still is 2, but the number of different species is 1.


text:
Q: How to write WordPress if_user_login I am fairly new to WordPress and php and I am trying to show different links based on if the user is logged in or not
How can I make below code to work?
<?php
$new_post = $redux_demo['new_post'];
if ( is_user_logged_in() ) {
    <a href="<?php echo $new_post; ?>" ><?php echo $header_post_btn; ?>
?>
<?php } else {
    <?php echo $header_post_btn; ?>
?>
<?php } ?>

A: PHP code should not be mixed with HTML code within the <?php ?> tag.
<?php
    $new_post = $redux_demo['new_post'];
    if ( is_user_logged_in() ) {
?>
    <a href="<?php echo $new_post; ?>" ><?php echo $header_post_btn; ?>
<?php } else { ?>
    <?php echo $header_post_btn; ?>
<?php } ?>

redpajama_set_name: RedPajamaStackExchange


text:
Q: IF EXISTS then Update else do Nothing - SQL SERVER 2012 I have a table which assigns roles to particular users. I am doing mass update to this table where in I am end dating some users previous roles and after that is completed assigning them new roles by inserting into this table.
I am doing both these actions separately. For my first action my code goes like this.
UPDATE userrolelist
SET effectiveend = '2016-01-20 00:00:00.000'
where userid IN ('150920','160847','160848','160849')
and roleid = '1037' and effectiveend IS NULL

This works if there is no end date assigned to that role but if there is an end date for even 1 user the whole update statement terminates. I want to use an IF EXISTS statement to first check if an end date for this user and this role exists if not then do the update else do nothing.
Inserting is similar. I am running a 100 inserts based on the user that need to have new roles. Now again when i run these insert statements if it finds any duplicates it errors out.
Insert into userrolelist (Userid, Roleid, IsDefault, EffectiveStart,
EffectiveEnd, Clientid, LastmodifiedUserId, LastmodifiedTimestamp)
Values
(161514,1011,1,'2016-01-21 00:00:00.001',Null,16785,0,'2016-01-21
00:00:00.001')

Table structure:

A: I am not sure I understood correctly your question, but maybe you can try this:
UPDATE A SET EFFECTIVEEND = '2016-01-20 00:00:00.000'
FROM USERROLELIST A
WHERE A.USERID IN ('150920','160847','160848','160849')
AND A.ROLEID = '1037' AND A.EFFECTIVEEND IS NULL
AND NOT EXISTS(SELECT 1 FROM USERROLELIST B WHERE B.USERID IN ('150920','160847','160848','160849') AND B.effectiveend IS NOT NULL) ;

Sample data:
CREATE TABLE USERROLELIST  (USERID INT, ROLEID INT, EFFECTIVEEND DATETIME);
INSERT INTO USERROLELIST VALUES (150920, 1037,NULL);
INSERT INTO USERROLELIST VALUES (160847, 1037,NULL);
INSERT INTO USERROLELIST VALUES (160848, 1037,NULL);
INSERT INTO USERROLELIST VALUES (160849, 1037,NULL);
INSERT INTO USERROLELIST VALUES (160850, 1037,NULL);

Output:
USERID  ROLEID  EFFECTIVEEND
150920  1037    2016-01-20 00:00:00.000
160847  1037    2016-01-20 00:00:00.000
160848  1037    2016-01-20 00:00:00.000
160849  1037    2016-01-20 00:00:00.000
160850  1037    NULL

Sample2:
TRUNCATE TABLE USERROLELIST
INSERT INTO USERROLELIST VALUES (150920, 1037,NULL);
INSERT INTO USERROLELIST VALUES (160847, 1037,NULL);
INSERT INTO USERROLELIST VALUES (160848, 1037,NULL);
INSERT INTO USERROLELIST VALUES (160849, 1037,NULL);
INSERT INTO USERROLELIST VALUES (160850, 1037,NULL);
UPDATE USERROLELIST SET EFFECTIVEEND='20160119' WHERE USERID=150920;

Output:
USERID  ROLEID  EFFECTIVEEND
150920  1037    2016-01-19 00:00:00.000
160847  1037    NULL
160848  1037    NULL
160849  1037    NULL
160850  1037    NULL


text:
Q: Polymer child attached event listener on parent I want to call public api methods on my child element once its attached to my parent. I tried using parent's attached event but its called before child attached event. Tried wiring event like this, doesn't work.
<my-element on-attached="childAttached"></my-element>

Is there a polymer solution to it, only solution I can see is raising my own event once child is attached.
this.fire('child-attached');
<my-element on-child-attached="childAttached"></my-element>

A: If you call this.fire('child-attached') in the child element then the binding should be
<my-element on-child-attached="childAttached"></my-element>

assuming childAttached() is a method on the parent.


text:
Q: Left join vs inner join ksqldb I am very new to kafka streams and ksqlDB. I am trying to join two streams using ksqldb.
WITH(KAFKA_TOPIC='joined_stream',
    VALUE_FORMAT='JSON',
    PARTITIONS = 2) AS
SELECT a.id,
       a.timestamp_init,
       a.status,
       a.mobilenumber,
       b.SubType
FROM sample_1 a LEFT JOIN sample_2 b
WITHIN 5 MINUTES
ON a.id = b.id;

When the data is produced in the first stream, the new streams gets new record with second record as null. After the right table gets the data new record is produced in the stream with the joined data, thus there comes two records.
I want to get only one record. If the matching record does not come in the right stream after 5 mins then it should produce null else it should join and produce to the new stream. Inner join might loss some record that from the left stream if there is no matching record is produced in the right stream, which I cannot afford.
Thank you in advance for your answer.


text:
Q: request matching with RewriteRule returns permission denied I am experiencing a bizarre apache error. I'd like to rewrite all requests from /api/media/fi/le/path.jpg to /media/fi/le/path.jpg
This are rewrite rules setup in virtual host:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule /api/v1/* /src/api/v1/index.php [L]
RewriteRule /api/media/(.*) /media/$1 [L]

If I point the browser to /media/fi/le/path.jpg, the image gets server successfully. If I go to /api/media/fi/le/path.jpg it complains that I do not have permission to access the resource. I must have permission, because I can access the file if no rewrites are done. How should I rewrite the last RewriteRule so that it would serve the images?
I added logging directive LogLevel alert rewrite:trace6 to see what the apache is doing under the covers. This are the results:
 init rewrite engine with requested uri /api/media/32/ee/0e60731bcb220c7c7b.jpg
 applying pattern '/api/v1/*' to uri '/api/media/32/ee/0e60731bcb220c7c7b.jpg'
 applying pattern '/api/media/(.*)' to uri '/api/media/32/ee/0e60731bcb220c7c7b.jpg'
 rewrite '/api/media/32/ee/0e60731bcb220c7c7b.jpg' -> '/media/32/ee/0e60731bcb220c7c7b.jpg'
 local path result: /media/32/ee/0e60731bcb220c7c7b.jpg
 go-ahead with /media/32/ee/0e60731bcb220c7c7b.jpg [OK]

I can visit the url mydomain.com/media/32/ee/0e60731bcb220c7c7b.jpg manually and the image gets server with no problem. What am I missing?
Complete .conf file:
<IfModule mod_ssl.c>
  <VirtualHost *:443>
        DocumentRoot /home/user/project/src
        ServerName project.com
        ErrorLog logs/project-error_log
        CustomLog logs/project-access_log common
        DirectoryIndex index.php

        <Directory /home/user/project/src>
            Options -Indexes +FollowSymLinks
            AllowOverride None
            Require all granted
        </Directory>

        LogLevel alert rewrite:trace6
        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule /api/v1/* /api/v1/index.php
        RewriteRule /api/media/(.*) /media/$1 [L]

        SSLCertificateFile /etc/letsencrypt/live/project.com/cert.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/project.com/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateChainFile /etc/letsencrypt/live/project.com/chain.pem
    </VirtualHost>
</IfModule>

A: There is weird behaviour with rewrite engine.
RewriteRule /api/media/(.*) /media/$1 [L]

Will always return forbidden. After mv media images and changing the above directive to RewriteRule /api/media/(.*) /images/$1 [L], permission error is gone.


text:
Q: React native ERROR Packager can't listen on port 8081 Have set up React native on my Windows box and it continually gives me this message when running react-native start:
ERROR  Packager can't listen on port 8081
Ok, so I change it per instructions to:
react-native start --port=8088
This works great and I receive this:
[12/24/2016, 10:03:33 AM]         HMR Server listening on /hot
React packager ready.
[12/24/2016, 10:03:41 AM] <START> Initializing Packager
[12/24/2016, 10:03:41 AM] <START> Building in-memory fs for JavaScript
[12/24/2016, 10:03:41 AM] <END>   Building in-memory fs for JavaScript (103ms)
[12/24/2016, 10:03:41 AM] <START> Building Haste Map
[12/24/2016, 10:03:41 AM] <END>   Building Haste Map (64ms)
[12/24/2016, 10:03:41 AM] <END>   Initializing Packager (221ms)

So as instructed I then run this:
C:\ReactProjects\AwesomeProject>react-native run-android
And get this:
JS server not recognized, continuing with build...
Running C:\Users\<user>\AppData\Local\Android\sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
JS server not recognized, continuing with build...
Running C:\Users\<user>\AppData\Local\Android\sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
.
.
.
BUILD SUCCESSFUL
Total time: 19.304 secs
Starting the app on emulator-5554 (C:\Users\<user>\AppData\Local\Android\sdk/platform-tools/adb -s emulator-5554 shell am start -n com.awesomeproject/.MainActivity)...
Starting: Intent { cmp=com.awesomeproject/.MainActivity }

Sadly the emulator then gives me:
"Could not get BachedBridge, make sure your bundle is packaged correctly"

So there are instructions that state you must change the port on the emulator, but I am using the Nexus 5 running Marshmellow and cannot find that setting:
     You will also need to update your applications to load the JavaScript bundle
     from the new port. Open the in-app Developer menu, then go to Dev Settings → Debug
 server host for device and replace 8081 with your port of choice.

Anyone have an idea of how to set the emulator up to recognize the packager?

A: Sadly the Rect native error messages are not that user friendly. :(
The error "Could not get BachedBridge, make sure your bundle is packaged correctly" means your device is not connected to your system.
Basically, when we start the react-native it deploy stuffs into the mobile/emulator, but when the app runs in mobile/emulator it does not know from where it need to pull code stuffs eg, assests, bundle packages etc.
So, we need to tell emulator that, boss please pick all your stuffs from blahblah server at blah blah port.
We have to do exactly what you have mentioned in the question.

Open the in-app Developer menu, then go to Dev Settings → Debug server host for device

Ok so we need to achieve 2 things:

*

*Open Developer menu in emulator:
Developer menu is a modal pop up with bunch of options like, Reload, Debug JS Remotely, Enable Live Reload, Enable Hot Reload, Toggle Inspector ... , Dev Setting (this is the one we are interested in).
There are number of ways to do that (mentioned below), see what works for you

*

*If you are Mac user simply press CMD + M. It will open up a pop up for you

*If you are a non Mac try CTRL + M

*For some people pressing F2 worked. "fn + F2"

*If you are frustrated and nothing is working try running below command in terminal (obviously while the emulator is up) Running on Device:

adb shell input keyevent 82

*Set up Dev Settings -> Debug to server host and port for device**
After opening Developer Menu navigate to "Dev Settings -> Debug to server host and port for device".
This place is the holy grail for solution to your problem.
Get your machine IP address and port where you have started react-native (i.e. 8088) and enter here. It will look something like "192.168.1.105:8088".
Checkout the image link here
Click OK and reload the app (by pressing R twice or by clicking Reload in Developer Menu) and voila you are up.

A: I was facing a similar issue since even my Windows laptop has McAfee installed on it. The issue was fixed for me by following the steps mentioned below :
1) Navigate to the project root and start react-native on a different port by hard-coding this value in server.js ( Please refer  this answer )
react-native start

2) Now, open another instance of command prompt in the root directory and run the below commands one after the other, ( optionally you can create a bat file with the following commands and then place it at the root directory ). Please replace the port number of the emulator ( in my case 5554 ) and port number for your react-native server ( in my case 8088 ) with appropriate values.
adb -s emulator -5554 reverse tcp:8088 tcp:8088
node node_modules/react-native/local-cli/cli.js bundle --platform android --dev true --reset-cache --entry-file index.android.js --bundle-output android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest android/app/build/intermediates/res/merged/debug
cd android && gradlew.bat installDebug

The node command is explained by sumit6b
3) After executing the above command, the react-native server would throw an error and stop, however, the apk file would be installed in our AVD. The name of the file would be the same as the name of our project. Open this file manually in the AVD. When the app opens, we can access Dev Settings by pressing Ctrl + M. Over here, go to Debug server host & port for device and type in localhost:8088 ( replace as needed with the appropriate port number ) and hit OK. Now, repeat steps 1 and 2 again. This time the react-native server would not terminate. Close the app opened earlier and again open the app manually in AVD. It should say "Fetching JS bundle" and the react-native server should say something like "Transforming Files"
4) At this point your react-native server and your AVD are synched. You can verify this by making some changes in index.android.js, and then douple tap R in the emulator.
5) If you still face any issues, try changing localhost with the IP address of your machine in the Debug server host & port for device settings present in AVD.

A: You can use following command for run packager on another port
react-native start --port=8082
OR You can find the process which is use port 8081 by
netstat -a -b -o
netstat give you PID of process. kill that process by
taskkill /F /pid 8081
If you use physical device then Uninstall app before run
react-native run-android


text:
Q: Adding value to output value I'm trying to set up my php script to add to a value to the previous value that is returned in the loop. Below is an example. The number on the left is the number that comes from the loop and is returned as $axle. The number on the right is the total as is the number from above added to the number on the right '$totalAxle'. I tried a few examples that I found online but they did not seem to work for me. My latest attempt which is the code below resulted in an error Notice: Array to string conversion
6/6
6/12
4/16
echo "<td>";

    $axle = "Not Found!";
    foreach ($railunit->railUnit as $ru) {
        if((string)$ru->rvXMLfilename == $rvXMLfilename){
            $axle = (string)$ru->axleCount;
            $array = array("axle" => $axle);
            $axleTotal = array();
            $i = 1;
            $previous = 0;
            foreach($array as $key => $val) {
            $axleTotal['number'.$i] = $val+$previous;
             $previous += $val;
             $i++;
            };
        }

    }
    echo $axle, "/", $axleTotal;
    echo "</td>";

A: Turns out that your foreach could be way simpler. I was able to solve it together with OP after a discussion in chat.
// add $total = 0; OUTSIDE of any loops so it doesnt get overwritten
$total = 0;

foreach($railunit->railUnit as $ru) {
    $axle = $ru->axleCount;

    $total = $total + $axle;
}

echo $axle . "/" . $total;


text:
Q: Two boolean properties in one radio choice I have two properties
public bool IsSelOne {get; set;}
public bool IsSelTwo {get; set;}

currently there are inside view represented trough checkbox.
How can without changing properties represent those choices trough radio button (IsSelOne, IsSelTwo)

A: The best way to use a RadioButton is to map it with an enum.
Anyway, you can use this kind of trick which needs an additional property :
public bool IsSelOne {get; set;}
public bool IsSelTwo {get; set;}

public bool Selection {
   get {
       return IsSelOne ;
   }
   set {
       IsSelOne = value;
       IsSelTwo = !value ;
   }
}

Then in your view :
@Html.RadioButtonFor(m => m.Selection, true) ; // Radio for IsSelOne true
@Html.RadioButtonFor(m => m.Selection, false) ; // Radio for  IsSelTwo true


text:
Q: I want to write a code in vba with would split the arrays in a cell to multiple rows I am trying to split data from a single cell to multiple rows as shown below.

I am using the below mentioned code:
Sub TransposeRange()

Dim rng As Range
Dim InputRng As Range, OutRng As Range
xTitleId = "Splitcell"
Set InputRng = Application.Selection.Range("A1")
Set InputRng = Application.InputBox("Range(single cell) :", xTitleId, InputRng.Address, Type:=8)
Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)
Arr = VBA.Split(InputRng.Range("A1").Value, Chr(9))
OutRng.Resize(UBound(Arr) - LBound(Arr) + 1).Value = Application.Transpose(Arr)
End Sub

A: Make sure your input cell has horizontal tabs.  Your code:
Sub TransposeRange()
    Dim rng As Range
    Dim InputRng As Range, OutRng As Range

    xTitleId = "Splitcell"
    Set InputRng = Application.Selection.Range("A1")
    Set InputRng = Application.InputBox("Range(single cell) :", xTitleId, InputRng.Address, Type:=8)
    Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)

    Arr = VBA.Split(InputRng.Range("A1").Value, Chr(9))
    OutRng.Resize(UBound(Arr) - LBound(Arr) + 1).Value = Application.Transpose(Arr)
End Sub

Typical result:


text:
Q: Contact form sends blank emails My contact form is not including message and other informations in emails.
There is 'Unknown sender' and 'No subject'. Email contains my tags (from:, subject:, message:) but no content is written after them.
I have tried a few other scripts, but they gave the same result.
My JS code
(function($){
$(document).ready(function() {
    $('#submit-form').click(function(e){

        e.preventDefault();
        var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
        var name  = $('#rp_name').val(),
            email  = $('#rp_email').val(),
            subject  = $('#rp_subject').val(),
            message  = $('#rp_message').val(),
            data_html,
            success = $('#success');

        if(name === ""){
            $('#rp_name').val('Please enter your name.');
        }

        if(subject === ""){
            $('#rp_subject').val('Please enter your name.');
        }

        if(email === ""){
            $('#rp_email').val('Your email is required.');
        }else if(reg.test(email) === false){
            $('#rp_email').val('Invalid Email Address.');
        }

        if(message === ""){
            $('#rp_message').val('Message is required.');
        }

        if(message !== "" && name !== "" && reg.test(email) !== false) {
            data_html = "name=" + name + "&email="+ email + "&message=" + message + "&subject="+ subject;

            alert(data_html);
            $.ajax({
                type: 'POST',
                url: 'php_helpers/contact_form.php',
                data: data_html,
                success: function(msg){

                    if (msg == 'sent'){
                        success.html('
Message successfully sent!
')  ;
                        $('#rp_name').val('');
                        $('#rp_email').val('');
                        $('#rp_message').val('');
                    }else{
                        success.html('
Message not sent! Please Try Again!
')  ;
                    }
                }
            });

        }
        return false;
    });
});
})(jQuery);

My PHP code
<?php

$to = 'email'; // I changed it

$subject = $_POST['subject'];

if($to) {
$name = $_POST['name'];
$email = $_POST['email'];

$fields = array(
    0 => array(
        'text' => 'Imie',
        'val' => $_POST['name']
    ),
    1 => array(
        'text' => 'Email',
        'val' => $_POST['email']
    ),
    2 => array(
        'text' => 'WIADOMOSC',
        'val' => $_POST['message']
    )
);

$message = "";

foreach($fields as $field) {
    $message .= $field['text'].": " . htmlspecialchars($field['val'], ENT_QUOTES) . "
\n";
}

$$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'From: '. $email . "\r\n" . 'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

if ($message){
echo 'sent';
}else{
echo 'failed';
}
} else {
echo "Don't access this file directly";
}
?>

I'll be glad for any hints.

A: There as i check your contact.php file code is ok. But you need one thing if use firefox. please console your code.I mean when you open firebug there will be one option console. with help you can check is your value along with variable is going or they empty.
I think your value is not going to PHP file. use console and you can easily bug your value.
I hope this make sense for you.

A: Check if your php script receives name, email and message. You can check it using
var_dump($_POST);

If server doesn't receive these variables, try to send data_html as an object:
change
data: data_html,

to
data: {name: name, email: email, message: message}

I didn't test it, but I always use this way of sending data from js to server.

A: You are using two dollar symbols in the line: $$headers  = 'MIME-Version: 1.0' . "\r\n"; Please remove "$" and try again.

A: Thanks for all your responses. I finally manage to find a solution. I haven't used firebug before, but thanks to it I could find the error message. Now the script is working fine.
It wasn't in code, but in .htaccess rewrite rule for .php files which was couseing 301 error for ajax request (../contact instead of ../contact.php).
I have one .php page (file uploader) and I thought that adding another seo-friendly link rule for it would be a good idea.


text:
Q: How do I pipe `file` after `which` in unix-like os $which python
/usr/bin/python
$file /usr/bin/python
/usr/bin/python: Mach-O universal binary with 2 architectures ...

I tried to use which python | file but  it won't work.

A: There are more than one way to do this. Off the top of my head here are a couple:

*

*file $(which python)

*which python | xargs file


text:
Q: Resizeable quadratic grid I would like to display a quadratic GridPane inside a window. The window can have every possible size and normally width and height are not equal. Anyway I would like to display the GridPane as square centered like this:

respectively

Ideally there is a configurable padding around the square. The pictures are taken from a canvas approach, but I want to switch to standard controls. Can anyone give me some hints how to achieve this?

A: One way to achieve an squared layout for your grid for any resolution of your window is rescaling it to use the maximum size of the window (after some padding), while keeping the squared size.
Instead of a GridPane, a simple Group is more flexible for moving its children, though it requires manual layouting of them.
This simple snippet is based on the JavaFX implementation of the 2048 game you can find here. It uses styleable rectangles to create a grid, and over them the 'tiles' are added. To find out more about styling, layouting or tile movement, go to the refered link.
private static final int NUM_CELLS = 15;
private static final int CELL_SIZE = 50;
private static final int TILE_SIZE = CELL_SIZE-15;
private final static int MARGIN = 20;

@Override
public void start(Stage primaryStage) {
    // create background square grid
    Group gridGroup = new Group();
    IntStream.range(0,NUM_CELLS).boxed().forEach(i->
        IntStream.range(0,NUM_CELLS).boxed().forEach(j->{
            Rectangle cell = new Rectangle(i * CELL_SIZE, j * CELL_SIZE, CELL_SIZE, CELL_SIZE);
            cell.setFill(Color.WHEAT);
            cell.setStroke(Color.GREY);
            gridGroup.getChildren().add(cell);
        })
    );
    // Add grid to board
    Group board = new Group(gridGroup);

    // add random tiles to board
    IntStream.range(0,NUM_CELLS).boxed().forEach(i->
        IntStream.range(0,NUM_CELLS).boxed().forEach(j->{
            if(i==j || NUM_CELLS-i-1==j){
                Label label = new Label();
                label.setMinSize(TILE_SIZE, TILE_SIZE);
                label.setPrefSize(TILE_SIZE, TILE_SIZE);
                label.setMaxSize(TILE_SIZE, TILE_SIZE);
                label.setStyle("-fx-background-color: red; -fx-background-radius: 50");
                label.setLayoutX((i+0.5)*CELL_SIZE-TILE_SIZE/2);
                label.setLayoutY((j+0.5)*CELL_SIZE-TILE_SIZE/2);
                board.getChildren().add(label);
            }
        })
    );

    Bounds gameBounds = board.getLayoutBounds();

    StackPane root = new StackPane(board);

    // Listener to rescale and center the board
    ChangeListener<Number> resize = (ov, v, v1) -> {
        double scale = Math.min((root.getWidth() - MARGIN) / gameBounds.getWidth(),
                                (root.getHeight() - MARGIN) / gameBounds.getHeight());
        board.setScaleX(scale);
        board.setScaleY(scale);
        board.setLayoutX((root.getWidth() - gameBounds.getWidth()) / 2d);
        board.setLayoutY((root.getHeight() - gameBounds.getHeight()) / 2d);
    };
    root.widthProperty().addListener(resize);
    root.heightProperty().addListener(resize);

    Scene scene = new Scene(root);

    // Maximum size of window
    Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
    double factor = Math.min(visualBounds.getWidth() / (gameBounds.getWidth() + MARGIN),
            visualBounds.getHeight() / (gameBounds.getHeight() + MARGIN));
    primaryStage.setScene(scene);
    primaryStage.setWidth((gameBounds.getWidth() + MARGIN) * factor);
    primaryStage.setHeight((gameBounds.getHeight() + MARGIN) * factor);
    primaryStage.show();
}

And this is how it will look like after some window resizing:


text:
Q: MysqlDump Long Load Times I am using mysqldump database > output.sql to dump all the data in a database. The size of the output file is around 3.3 GB. I am importing it using mysql < output.sql however it has been running for more than 24 hours and still hasn't finished.
Is this normal? Is there some way to speed up the import?
mysql> SHOW VARIABLES LIKE '%innodb%';
+-----------------------------------------+------------------------+
| Variable_name                           | Value                  |
+-----------------------------------------+------------------------+
| have_innodb                             | YES                    |
| ignore_builtin_innodb                   | OFF                    |
| innodb_adaptive_hash_index              | ON                     |
| innodb_additional_mem_pool_size         | 1048576                |
| innodb_autoextend_increment             | 8                      |
| innodb_autoinc_lock_mode                | 1                      |
| innodb_buffer_pool_size                 | 8388608                |
| innodb_checksums                        | ON                     |
| innodb_commit_concurrency               | 0                      |
| innodb_concurrency_tickets              | 500                    |
| innodb_data_file_path                   | ibdata1:10M:autoextend |
| innodb_data_home_dir                    |                        |
| innodb_doublewrite                      | ON                     |
| innodb_fast_shutdown                    | 1                      |
| innodb_file_io_threads                  | 4                      |
| innodb_file_per_table                   | OFF                    |
| innodb_flush_log_at_trx_commit          | 1                      |
| innodb_flush_method                     |                        |
| innodb_force_recovery                   | 0                      |
| innodb_lock_wait_timeout                | 50                     |
| innodb_locks_unsafe_for_binlog          | OFF                    |
| innodb_log_buffer_size                  | 1048576                |
| innodb_log_file_size                    | 5242880                |
| innodb_log_files_in_group               | 2                      |
| innodb_log_group_home_dir               | ./                     |
| innodb_max_dirty_pages_pct              | 90                     |
| innodb_max_purge_lag                    | 0                      |
| innodb_mirrored_log_groups              | 1                      |
| innodb_open_files                       | 300                    |
| innodb_rollback_on_timeout              | OFF                    |
| innodb_stats_on_metadata                | ON                     |
| innodb_support_xa                       | ON                     |
| innodb_sync_spin_loops                  | 20                     |
| innodb_table_locks                      | ON                     |
| innodb_thread_concurrency               | 8                      |
| innodb_thread_sleep_delay               | 10000                  |
| innodb_use_legacy_cardinality_algorithm | ON                     |
+-----------------------------------------+------------------------+
37 rows in set (0.12 sec)

mysql> SHOW VARIABLES LIKE '%key_buffer%';
+-----------------+----------+
| Variable_name   | Value    |
+-----------------+----------+
| key_buffer_size | 16777216 |
+-----------------+----------+
1 row in set (0.03 sec)

mysql> SHOW VARIABLES LIKE '%table%';
+----------------------------+----------+
| Variable_name              | Value    |
+----------------------------+----------+
| big_tables                 | OFF      |
| innodb_file_per_table      | OFF      |
| innodb_table_locks         | ON       |
| lower_case_table_names     | 0        |
| max_heap_table_size        | 16777216 |
| max_tmp_tables             | 32       |
| old_alter_table            | OFF      |
| sql_big_tables             | OFF      |
| table_definition_cache     | 256      |
| table_lock_wait_timeout    | 50       |
| table_open_cache           | 64       |
| table_type                 | MyISAM   |
| tmp_table_size             | 16777216 |
| updatable_views_with_limit | YES      |
+----------------------------+----------+
14 rows in set (0.00 sec)

A: I can't imagine that much data taking more than an hour or two on a reasonably modern machine. I'd use MySQL Administrator (found in MySQL GUI Tools) or mtop to make sure it's not just hanging.

A: Probably your mysqld settings have been tuned to contain too low settings for memory usage.
For MyISAM tables, make sure you have key_buffer_size and table_cache properly tuned.
For InnoDB tables, make sure you have innodb_buffer_pool_size properly tuned. With InnoDB it also can be helpful to wrap the insert statements around a transaction.
Please post here output from the following commands:
SHOW VARIABLES LIKE '%innodb%';
SHOW VARIABLES LIKE '%key_buffer%';
SHOW VARIABLES LIKE '%table%';

A: With
show full processlist;
you can see all process running, so if it's still inserting data, you should see it.
SHOW OPEN TABLES
SHOW TABLE STATUS
Should also give you some info. Give it a try and show us the results.
Should not take more than 2h. I agree.

A: This actually turned out to be a disk space issue on my end. Nothing to see here.


text:
Q: Grid view item menu I would like to ask how to add a menu(three points with options like the actionBar has) to a grid view item? I need it to look similar to youtube's mobile application videos: they all have these three points with a couple of options inside of them. How can I achieve this?
Here's the code:
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ListAdapter;

import java.util.ArrayList;

public class teamTasks extends Activity{

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.team_individual_tasks);

    Button btn3 = (Button) findViewById(R.id.addTasks);

    final ArrayList<String> listItemsTasks=new ArrayList<String>();
    final ListAdapter addAdapterTasks = new ArrayAdapter<String>(this, R.layout.custom_box,
            R.id.customBox, listItemsTasks);
    GridView gvtask = (GridView) findViewById(R.id.gvTasks);
    gvtask.setAdapter(addAdapterTasks);

    btn3.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            listItemsTasks.add("New Task");
        }
    });
    gvtask.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        }
    });
}
}

The layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<Button
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:text="+"
    android:textSize="20sp"
    android:id="@+id/addTasks"/>

<GridView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/addTasks"
    android:id="@+id/gvTasks"
    android:numColumns="2">
    </GridView>

</RelativeLayout>

Custom gridView item:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="120dp"
    android:id="@+id/customBox"/>


text:
Q: Java Incorrect type returned from method: Can't assign void value to java.lang.String I am importing records to my Solr database, and am using a .bsh script to pre-process the URL field. The script works fine except for the cases where the record does not have a URL field, and then it throws the following error:
Error while trying to evaluate script: getURLs.bsh
java.lang.IllegalArgumentException: Error while trying to evaluate script: getURLs.bsh
        at org.solrmarc.index.SolrIndexer.handleScript(SolrIndexer.java:1170)
        at org.solrmarc.index.SolrIndexer.addFieldValueToMap(SolrIndexer.java:914)
        at org.solrmarc.index.SolrIndexer.map(SolrIndexer.java:821)
        at org.solrmarc.marc.MarcImporter.addToIndex(MarcImporter.java:398)
        at org.solrmarc.marc.MarcImporter.importRecords(MarcImporter.java:312)
        at org.solrmarc.marc.MarcImporter.handleAll(MarcImporter.java:605)
        at org.solrmarc.marc.MarcImporter.main(MarcImporter.java:865)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.simontuffs.onejar.Boot.run(Boot.java:334)
        at com.simontuffs.onejar.Boot.main(Boot.java:170)
Caused by: Incorrect type returned from method: getURLDOICan't assign void value to java.lang.String: Can't assign void value to java.lang.String: <at unknown location>

at bsh.UtilEvalError.toEvalError(Unknown Source)
at bsh.BshMethod.invokeImpl(Unknown Source)
at bsh.BshMethod.invoke(Unknown Source)
at bsh.BshMethod.invoke(Unknown Source)
at org.solrmarc.index.SolrIndexer.handleScript(SolrIndexer.java:1162)
... 12 more

My script is as follows:
import org.marc4j.marc.Record;

public String getURLDOI(Record record) {
    String url = indexer.getFirstFieldVal(record,"856u");
    if (url != null) {
        if (url.substring(0,7).equals("urn:doi")) {
            String result = "http://hdl.handle.net/"+url.substring(9);
            return result;
        } else {
            String result = url;
            return result;
        }
        return null;
    }
}

How would I handle those records that don't have the URL field ("856u")? I've tried setting result = null at the start of the method, and then returning the result (rather than return null) at the end, but I still get the same error. Thank you for any tips or pointers you can provide.

A: If the function has a string as the return type, you must return one or throw an exception.  As the other post says, you can return an empty string or some other special value and then have the calling code deal with it.
Your other problem is that the function you provided won't compile. I rewrote it to get rid of the dependency and I get:
public static String getURLDOI(String record) {
    String url = record;
    if (url != null) {
        if (url.substring(0,7).equals("urn:doi")) {
            String result = "http://hdl.handle.net/"+url.substring(9);
            return result;
        } else {
            String result = url;
            return result;
        }
        return "";
    }
}

And these errors when I try to compile:
Main.java:18: error: unreachable statement
  return "";
  ^
Main.java:20: error: missing return statement
}
^

Following what I think is your intention, I would rewrite your function like this:
public static String getURLDOI(Record record) {

    String url = indexer.getFirstFieldVal(record,"856u");

    if (url == null)
        return "";

    if (url.substring(0,7).equals("urn:doi"))
        return "http://hdl.handle.net/"+url.substring(9);

    return url;

}

It reads much nicer than with the nested if statements, which you made a mistake with! It's easy to do, that's why you shouldn't nest them.

A: you can return an empty string ""


text:
Q: Substituting an expression inside another one I have a formula, which I read as a string from a file:
file_eq = pd.read_excel("Equations.xlsx")
formula1 = file_eq["Formula1"]
eq1 = parse_expr(formula)

The equation, when printed, looks like this: 1/sqrt(1 - v**2/c **2).
Then I read a second expression
formula2 = file_eq["Formula2"]
eq2 = parse_expr(formula2)

which is: v**1.0/c
I want to replace the second formula with a new variable whenever it appears in the first formula. So I tried this:
x = symbols('x')
eq1 = eq1.subs(eq2, x)

But nothing changes. What I should have obtained in the end is: 1/sqrt(1 - x**2)
On the other hand, if I do it manually (but I can't do this for the purpose of my project, because I have many equations), like this:
v = symbols('v')
c = symbols('c')
eq1 = eq1.subs(v/c, x)

I get the right answer. Can someone tell me what to do to get what the expression I want? Thank you!


text:
Q: Lightning Design Classes Not Included on Visualforce page I am using the lightning design system for creating a visualforce page. However some classes are not included in the slds.css.
I have copied and pasted a 'Setup assistant' from the lightning design system and lot of the styling classes are missing.
In the visualforce page I have included:
<apex:page lightningStylesheets="true">
<apex:slds />

Any idea how I can apply these styles?
The only alternative is copying the styles individually from the lightning design system website, but hoping there's a better way!

A: Setup Assistant is a new component in v2.6 (Summer '18) of the Lightning Design System.
Try updating the API version on your Visualforce page to 42 or 43 (Summer '18). The SLDS version of the CSS imported with  is currently set to v2.3 for pages with API versions up through 41. From API v42 and above, the latest SLDS CSS version is served.


text:
Q: hammerDB libmysqltcl.dll couldn't load I installed hammerDB v4.6 on a AWS vm and I'm trying to connect to my aurora/mysql database on RDS, but when I start the schema build, I get this error
Error in Virtual User 1: Error: Failed to load mysqltcl - couldn't load library "D:/Users/xyz/HammerDB-4.6-Win/HammerDB-4.6/lib/mysqltcl3.052/libmysqltcl.dll": this library or a dependent library could not be found in library path
The libmysqltcl.dll is there. So it is probably a dependent library that is missing.
So I tried to install mysql server on the vm, expecting that this would install some missing dll. But no luck.

A: I simply copied libmysql.dll in HammerDB-4.6/bin


text:
Q: Make search bar responsive when screen size is narrowed? Im working on a search bar for a website, on a laptop screen/computer screen the search bar width seems fine. Next I want to also make the search bar mobile, tablet responsive as well, im trying to do something below using @media tag, but doesn't seem to be working. when I apply below and I open my website url on a mobile the whole page shrinks adding white spaces, please advice, how to apply the media property?
Below is my code.
.form-search{
  width: 50%;
  margin-left:auto;
  margin-right:auto;
}

@media (max-width:480px) {
  .form-search {
    width: 60%;
    margin-left:auto;
    margin-right:auto;
  }
}

A: make sure you add .form-search to the input box like below..
<input type="text" class="form-search" />

A: Try setting a height for the form element. Try modifying your code to something like this:
.form-search {
    height: 150px;
}

@media (max-width:480px) {
    .form-search {
       height: 70px;
}

A: Use calc css, and substract other elements width and margins from it.
//if for example search button takes fixed 80px on screen:
.form-search {
width: calc(100% - 80px);
}


text:
Q: Is there grep regex class that contains € Is  there specific regex class including the euro sign?
According to the grep manual the [:print:] class (AFAIK € is printable) and [:punct:] classes don't contain the euro sign as they contain only the locale (en_US.UTF-8) and ASCII punctuation characters (including $)
$ echo "I can has 5€ ?"  | grep -o "[[:print:]*"
I can has 5

Is there another solution (as I guess this problem will accouter with every currency char other than the dollar) that will allow me to catch every printable char?
EDIT
After playing with putty settings, I managed to display the € when I print the file, but grep-ing it acts weird. Initially I couldn't even print the "€" bbut after changing the putty encoding to cp1252 (rather than Unicode) I can see the sign. grepping still doesn't work though
$ cat test.bah
I can has 5€ ?
$ cat test.bah | grep -o '[[:print:]]*'
I can has 5
 ?
$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
...

A: Apparently, on my machine:
Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-32-virtual i686)
grep --version grep (GNU grep) 2.10
bash --version GNU bash, version 4.2.24(1)-release (i686-pc-linux-gnu)

The solution was to use the -P switch and match  [[:print:]] or non printable [^[:print:]] chars:
$ cat test.bah
I can has 5€  or 5£?
$ cat test.bah | grep -P -o '[[:print:]]*'
I can has 5
  or 5
?

(btw, the new lines are result of the multiple matches and not misprinting the currency signs)
$ cat test.bah | grep -P -o '[^[:print:]]*'
€
£
$ cat test.bah | grep -P -o '([[:print:]]|[^[:print:]])*'
I can has 5€  or 5£?

Few notes:

*

*@melpomene showed in his answer that his console or version of grep handles the currency signs better. I am using the aws stock version of ubuntu 12.04

*In my qustion I mentioned that I needed to change the putty settings in case
somebody needs the settings - under Window->Translation-> set the recived data to Win1252 (Western) counter intuitive as it may seem, setting the encoeding to UTF-8 made the € and £ appear as # or  ▒ de
pending on the drawing char selected option)

A: $ echo "I can has 5€ ?" | grep -o '[[:print:]]*'
I can has 5€ ?
$ echo $LANG
en_US.utf8


text:
Q: Alarm Manager: cache Cleaner stops App i am making a simple alarm app and i want to show an activity after the given time has passed. here is the code i am trying.
  public void onReceive(Context c, Intent i) {
            Log.v("XXXX", S);
              Toast.makeText(c,  S+" minute(s) passed", Toast.LENGTH_LONG).show();

              Intent myIntent = new Intent(Main.this, AlarmBuzzer.class);
              myIntent.putExtra("ActivityName", activity_name);
              myIntent.putExtra("ActivityTime", S); //Optional parameters
              Main.this.startActivity(myIntent);
              }

       };

here if application is closed, the system showa toast but no BuzzerActivity is not shown. And if run cache cleaner neither toast nor Activity  is shown. I want my app to run alarm manger even closed and show BuzzerActivity as a popUp when given time passes,
By the way i am using OneClean App to clean device memory.
Code for Setting Alarm
public void onClick(View v) {
     EditText et = (EditText) findViewById(R.id.editText1);
     EditText Activity_Name = (EditText) findViewById(R.id.editText2);
     activity_name = Activity_Name.getText().toString();
     S = et.getText().toString();
     long USER_TIME = Long.parseLong(S);
     TOTAL_TIME= (ONE_MINUTE*USER_TIME);
   //  DbConn();

     am.set( AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() +
TOTAL_TIME, pi );

}

LOG:
12-30 10:53:31.879: V/AlarmManager(232): set: Alarm{41b1a008 type 2 com.android.phone}
12-30 10:53:31.879: V/AlarmManager(232): Adding alarm Alarm{41b1a008 type 2 com.android.phone} at 1
12-30 10:53:31.879: V/AlarmManager(232): alarms: 15 type: 2
12-30 10:53:31.880: V/AlarmManager(232): 0: Jan 02 08:14:00 pm com.example.alarmmanager
12-30 10:53:31.880: V/AlarmManager(232): 1: Jan 02 08:14:11 pm com.android.phone
12-30 10:53:31.880: V/AlarmManager(232): 2: Jan 02 08:15:00 pm android
12-30 10:53:31.880: V/AlarmManager(232): 3: Jan 02 08:30:00 pm com.google.android.apps.maps
12-30 10:53:31.880: V/AlarmManager(232): 4: Jan 02 08:30:00 pm com.google.android.talk
12-30 10:53:31.880: V/AlarmManager(232): 5: Jan 02 08:30:00 pm com.google.android.talk
12-30 10:53:31.881: V/AlarmManager(232): 6: Jan 02 10:00:00 pm com.facebook.katana
12-30 10:53:31.881: V/AlarmManager(232): 7: Jan 02 11:15:00 pm com.google.android.talk
12-30 10:53:31.881: V/AlarmManager(232): 8: Jan 03 12:30:00 am com.google.android.talk
12-30 10:53:31.881: V/AlarmManager(232): 9: Jan 03 01:45:00 am com.google.android.talk
12-30 10:53:31.881: V/AlarmManager(232): 10: Jan 03 03:00:00 am com.google.android.talk
12-30 10:53:31.881: V/AlarmManager(232): 11: Jan 04 07:45:00 am com.google.android.talk
12-30 10:53:31.882: V/AlarmManager(232): 12: Jan 23 11:01:37 pm com.google.android.gms
12-30 10:53:31.882: V/AlarmManager(232): 13: Jan 23 11:01:37 pm com.google.android.gms
12-30 10:53:31.882: V/AlarmManager(232): 14: Jan 23 11:01:37 pm com.google.android.gms
12-30 10:53:31.961: I/SurfaceFlinger(95): [SurfaceFlinger] frames:2, duration:1.002000, fps:1.994219
12-30 10:53:32.245: D/Settings/Provide(232): lookupValue, table secure cache.containsKey sys_free_storage_log_interval
12-30 10:53:32.245: D/Settings/Provide(232): lookupValue, table secure cache.fullyMatchesDisk() sys_free_storage_log_interval
12-30 10:53:32.245: D/Settings/Provide(232): lookupValue, table secure cache.containsKey disk_free_change_reporting_threshold
12-30 10:53:32.245: D/Settings/Provide(232): lookupValue, table secure cache.fullyMatchesDisk() disk_free_change_reporting_threshold
12-30 10:53:59.935: I/InputDispatcher(232): wait for the command to run!
12-30 10:53:59.935: D/InputManager-JNI(232): pokeUserActivity : eventType=1
12-30 10:53:59.935: D/WindowManager(232): interceptKeyTi keyCode=3 down=false repeatCount=0 keyguardOn=false mHomePressed=true canceled=false
12-30 10:53:59.936: V/ActivityManager(232): Broadcast: Intent { act=android.intent.action.CLOSE_SYSTEM_DIALOGS flg=0x40000010 (has extras) } ordered=false
12-30 10:53:59.937: I/ActivityManager(232): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.gionee.launcher/.GNLauncherActivity} from pid 232
12-30 10:53:59.938: V/ActivityManager(232): At 5 ckp TaskRecord{41443498 #119 A com.example.alarmmanager}: ActivityRecord{41b82248 com.example.alarmmanager/.Main}
12-30 10:53:59.938: V/ActivityManager(232): At 4 ckp TaskRecord{417413a8 #2 A com.gionee.launcher}: ActivityRecord{4177e7e8 com.gionee.launcher/.GNLauncherActivity}
12-30 10:53:59.938: V/ActivityManager(232): Removing and adding at 5
12-30 10:53:59.938: V/ActivityManager(232): At 3 ckp TaskRecord{41c74c08 #118 A gn.com.android.theme}: ActivityRecord{41953dd0 gn.com.android.theme/.ThemeGridActivity}
12-30 10:53:59.938: V/ActivityManager(232): At 2 ckp TaskRecord{41a1f9f0 #37 A com.android.systemui}: ActivityRecord{41a1f828 com.android.systemui/.usb.UsbStorageActivity}
12-30 10:53:59.938: V/ActivityManager(232): At 1 ckp TaskRecord{421ac650 #48 I android/com.android.internal.app.ResolverActivity}: ActivityRecord{41754380 android/com.android.internal.app.ResolverActivity}
12-30 10:53:59.938: V/ActivityManager(232): At 0 ckp TaskRecord{41cdcca0 #8 A com.android.phone}: ActivityRecord{4151eab0 com.android.phone/.InCallScreen}
12-30 10:53:59.969: I/InputDispatcher(232): setInputWindows
12-30 10:53:59.973: D/PhoneStatusBar(311): onReceive, action=android.intent.action.CLOSE_SYSTEM_DIALOGS
12-30 10:53:59.976: D/NetworkPolicy(232): onRecv: MSG_FOREGROUND_ACTIVITIES_CHANGED pid:uid:act=21651:10028:true
12-30 10:53:59.980: V/WindowManager(232): Changing focus from Window{419ae628 com.example.alarmmanager/com.example.alarmmanager.Main paused=true} to null
12-30 10:53:59.981: I/InputDispatcher(232): setInputWindows
12-30 10:53:59.981: I/WindowManager(232): Losing focus: Window{419ae628 com.example.alarmmanager/com.example.alarmmanager.Main paused=true}
12-30 10:53:59.983: D/loc(21651): location=[0, 0]
12-30 10:53:59.988: I/InputDispatcher(232): setInputWindows
12-30 10:53:59.989: I/InputDispatcher(232): setInputWindows
12-30 10:53:59.990: I/InputDispatcher(232): setInputWindows
12-30 10:53:59.990: D/loc(21651): location=[0, 0]
12-30 10:53:59.991: D/jipf-a(21651): onNewIntent intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10600000 cmp=com.gionee.launcher/.GNLauncherActivity },mIsOnStop=true
12-30 10:53:59.991: D/04-07(21651): onNewIntent
12-30 10:53:59.991: D/jipf-a(21651): onNewIntent getWindow().isActive()=true
12-30 10:54:00.001: V/AlarmManager(232): Checking for alarms... rtc=1388382840001, elapsed=141219693
12-30 10:54:00.001: V/AlarmManager(232): Checking active alarm when=141219692 Alarm{41d798d8 type 3 android}
12-30 10:54:00.001: V/AlarmManager(232): Alarm triggering: Alarm{41d798d8 type 3 android}
12-30 10:54:00.001: V/AlarmManager(232): Checking active alarm when=141300000 Alarm{416f57b8 type 3 android}
12-30 10:54:00.001: V/AlarmManager(232): Native set alarm :Alarm{416f57b8 type 3 android}
12-30 10:54:00.002: I/AlarmManager(232): bootpackage = com.android.deskclock set Prop 1
12-30 10:54:00.003: D/setVisible(21651): this=CategoryMainMenuLayer: pos[]=[0, 0, 320, 480, 0, 0, 320, 480];isVisible=false;alpha=1.0;bVisible=false;curVisible=false
12-30 10:54:00.003: D/mengqj-area(21651): desktop-rect=Rect(-320, 35 - 640, 416)
12-30 10:54:00.003: D/04-11(21651): setObserverArea
12-30 10:54:00.003: D/04-11(21651): registerArea
12-30 10:54:00.004: D/0518(21651): registerArea dragObserver=com.gionee.launcher.layers.DesktopLayer$3@413f5a00
12-30 10:54:00.005: D/Input(311): VelocityTracker: int datax = 10
12-30 10:54:00.005: D/Input(311): VelocityTracker: int m_velocity_magnify_x = 1.000000
12-30 10:54:00.005: D/Input(311): VelocityTracker: int datay = 10
12-30 10:54:00.005: D/Input(311): VelocityTracker: int m_velocity_magnify_y = 1.000000
12-30 10:54:00.011: D/setVisible(21651): this=ContentLayer: pos[]=[-320, 35, 1920, 376, 0, 0, 1920, 376];isVisible=true;alpha=1.0;bVisible=true;curVisible=true
12-30 10:54:00.011: D/setVisible(21651): this=ImageSView: pos[]=[1, 0, 53, 5, 0, 0, 53, 5];isVisible=false;alpha=0.0;bVisible=false;curVisible=false
12-30 10:54:00.011: D/IcsIndicator(21651): indicatorW:53
12-30 10:54:00.011: D/04-20(21651): w=53;h=5;width=53;height=5
12-30 10:54:00.011: D/setVisible(21651): this=ImageSView: pos[]=[1, 0, 53, 5, 0, 0, 53, 5];isVisible=true;alpha=255.0;bVisible=true;curVisible=true
12-30 10:54:00.012: D/setVisible(21651): this=IcsIndicator: pos[]=[0, 411, 320, 5, 0, 0, 320, 5];isVisible=true;alpha=1.0;bVisible=true;curVisible=true
12-30 10:54:00.012: D/0527(21651): hotseat setVisible bVisible=true
12-30 10:54:00.012: D/0522(21651): size=5
12-30 10:54:00.012: D/mengqj-hs-area(21651): rect=Rect(-320, 416 - 640, 960)
12-30 10:54:00.012: D/mengqj-base(21651): hotSeatLayer-monitorDragArea base=Point(0, 416)
12-30 10:54:00.012: D/04-11(21651): setObserverArea
12-30 10:54:00.012: D/04-11(21651): registerArea
12-30 10:54:00.012: D/0518(21651): registerArea dragObserver=com.gionee.launcher.layers.HotSeatLayer$3@41615328
12-30 10:54:00.012: D/setVisible(21651): this=HotSeatLayer: pos[]=[0, 416, 320, 64, 0, 0, 320, 64];isVisible=true;alpha=1.0;bVisible=true;curVisible=true
12-30 10:54:00.012: D/jipf-onDragDrop(21651): setPageIndex start pageIndex=1;curScreen=1
12-30 10:54:00.012: D/jipf-ind(21651): l=-320;mPageCount=6;displayWidth=320
12-30 10:54:00.012: D/setVisible(21651): this=ImageSView: pos[]=[1, 0, 53, 5, 0, 0, 53, 5];isVisible=false;alpha=255.0;bVisible=false;curVisible=false
12-30 10:54:00.012: D/IcsIndicator(21651): indicatorW:53
12-30 10:54:00.013: D/04-20(21651): w=53;h=5;width=53;height=5
12-30 10:54:00.013: D/setVisible(21651): this=ImageSView: pos[]=[1, 0, 53, 5, 0, 0, 53, 5];isVisible=true;alpha=255.0;bVisible=true;curVisible=true
12-30 10:54:00.013: D/WallPaperProxy(21651): mIsWallpaperScroll:true
12-30 10:54:00.013: D/WallPaperProxy(21651): xStep:0.2
12-30 10:54:00.013: D/WallPaperProxy(21651): xOffset:0.2
12-30 10:54:00.013: D/jipf-ind(21651): l=-320;mPageCount=6;displayWidth=320
12-30 10:54:00.013: D/0606(21651): l=-320;mPageCount=6;displayWidth=320
12-30 10:54:00.013: D/WallPaperProxy(21651): xStep:0.2
12-30 10:54:00.013: D/WallPaperProxy(21651): xstep:0.2,xoffset:0.2
12-30 10:54:00.013: D/jipf-onDragDrop(21651): setPageIndex end pageIndex=1;curScreen=1
12-30 10:54:00.013: I/SurfaceFlinger(95): [SurfaceFlinger] frames:2, duration:1.012000, fps:1.974699
12-30 10:54:00.014: D/setVisible(21651): this=ImageSView: pos[]=[1, 0, 53, 5, 0, 0, 53, 5];isVisible=true;alpha=255.0;bVisible=true;curVisible=true
12-30 10:54:00.015: D/0601(21651): GNLauncher onRestart
12-30 10:54:00.015: D/jipf-a(21651): onRestart mIsOnStop=false
12-30 10:54:00.015: D/0601(21651): GNLauncher onStart
12-30 10:54:00.015: D/jipf-a(21651): onStart mIsOnStop=false
12-30 10:54:00.015: D/0601(21651): GNLauncher onResume
12-30 10:54:00.015: D/jipf-a(21651): onResume mIsOnStop=false
12-30 10:54:00.016: D/WallPaperProxy(21651): drawable.getIntrinsicWidth() =640,drawable.getIntrinsicHeight()=480
12-30 10:54:00.017: D/WallPaperProxy(21651): MultiSpan wallpaper...
12-30 10:54:00.017: D/loc(21651): location=[0, 0]
12-30 10:54:00.018: I/InputDispatcher(232): setInputWindows
12-30 10:54:00.018: D/inv-profiling(21651): mInvRecords.size()=5
12-30 10:54:00.019: D/inval(21651): calcScreenArea dirtyInOut=Rect(0, 0 - 320, 64)
12-30 10:54:00.020: D/inval(21651): calcScreenArea dirtyInOut=Rect(0, 0 - 53, 5)
12-30 10:54:00.020: D/inval(21651): calcScreenArea dirtyInOut=Rect(0, 0 - 320, 480)
12-30 10:54:00.020: D/inval(21651): calcScreenArea dirtyInOut=Rect(0, 0 - 1920, 376)
12-30 10:54:00.020: D/inval(21651): calcScreenArea dirtyInOut=Rect(0, 0 - 320, 5)
12-30 10:54:00.021: D/DRAW-profiling(21651): calc use 2ms; dirty=Rect(0, 0 - 320, 480)
12-30 10:54:00.021: D/wallpaper-cmd(21651): update offset
12-30 10:54:00.021: D/loc(21651): location=[0, 0]
12-30 10:54:00.025: I/InputDispatcher(232): setInputWindows
12-30 10:54:00.026: I/InputDispatcher(232): setInputWindows
12-30 10:54:00.037: I/InputDispatcher(232): setInputWindows
12-30 10:54:00.039: I/AlarmManager(232): rest power off alarm is com.android.deskclock
12-30 10:54:00.041: D/Provider/Setting(232): NameValueTable putString power_off_alarm_package_name in content://settings/system value com.android.deskclock
12-30 10:54:00.042: D/Settings/Provide(232): isRedundantSetValue, oldValuecom.android.deskclockvaluecom.android.deskclock
12-30 10:54:00.042: D/Settings/Provide(232): SettingsCache.isRedundantSetValue power_off_alarm_package_name com.android.deskclock
12-30 10:54:00.042: V/AlarmManager(232): sending alarm Alarm{41d798d8 type 3 android}
12-30 10:54:00.042: V/ActivityManager(232): Broadcast: Intent { act=android.intent.action.TIME_TICK flg=0x40000014 (has extras) } ordered=true
12-30 10:54:00.045: I/InputDispatcher(232): channel '42355730 RecentsPanel (server)' ~ abortBrokenDispatchCycle - notify=false

12-30 11:53:42.675: V/Provider/Setting(30018): invalidate [system]: current 163 != cached 0

A: try like this
Intent myIntent = new Intent(Main.this, AlarmBuzzer.class);
myIntent.putExtra("ActivityName", activity_name);
myIntent.putExtra("ActivityTime", S); //Optional parameters
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, myIntent, 0);


text:
Q: Is it possible to run reduce on a stream in elixir? Is it possible to reduce a Stream in elixir?
I see Stream.scan but it does not return the accumulator.
file_stream
|> Stream.each(&parse_line/1)
|> Enum.reduce(&reduce_fn/2)

I seem to be running into issues with the follow but was wondering if it is okay to do?

A: There is no sense in reducing a stream. The core difference between functions in Enum module vs Stream would be, the former is greedy while the latter is lazy.
That said, Stream produces a set of transformations that could be lazily applied on per collection's element basis, passing through.
But reduce (aka foldl) is already an effectively greedy operation, one cannot get to the result without going through the whole collection. (That is why Stream.scan/3 does not return the accumulated value back, by the way.)

Enum
#  ===== code =====        ===== piped through =====
[1, 2, 3]                        # [1, 2, 3]
#                                #     ⇓
|> Enum.map(&IO.inspect/1)       # [1, 2, 3]
#                                #     ⇓
|> Enum.map(&IO.inspect/1)       # [1, 2, 3]

#⇒ 1 2 3 1 2 3

Stream
#  ===== code =====        ===== piped through =====
[1, 2, 3]                        # 1  2  3
#                                # ⇓  ⇓  ⇓
|> Stream.map(&IO.inspect/1)     # 1  2  3
#                                # ⇓  ⇓  ⇓
|> Stream.map(&IO.inspect/1)     # 1  2  3
|> Enum.to_list()                # termination!
#                                # ⇒  ⇒  ⇒

#⇒ 1 1 2 2 3 3


text:
Q: Laravel 5 queue listener exceptions I'm trying to get queues working in laravel 5 and the queue listener is outputting:
php artisan queue:listen
[ErrorException]
  Undefined index: table
The "jobs" and "failed_jobs" tables are present, config.php is set to "database".
A search of the laravel forum and google has not yielded a solution, amy ideas where to look?

A: This is most likely not a fault of the Laravel Queue system. Instead, this error is thrown by PHP when an array is to be accessed by an unknown/unset element.
"Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" using PHP
For example:
    // Initialise an empty array
    $myArray = [];

    // Attempt to access an element that hasn't been set yet
    echo $myArray['breadCake'];

In your case, have a look through your code that deals with queueing and search for ['table'], ["table"] or anything that would need a "table" set.
It may be handy to anyone reading this and considering using Laravel Queues to remember a few things:

*

*Queues are asynchronous and do not have access to the variables you once set in the application unless you pass them into something queue-able.

*In Laravel 5, capture all the data you require for a job to exist in the Event __construct() method. Events have access to a trait called SerializesModels. You can pass your models as instances (with attributes) to the __construct() method (such as __construct(User $user). Assign your variables to the Event class scope (for example: $this->user = $user). This is passed to the EventListener handle(Event $event) method. This is called when the queue is being processed. The __construct() should be blank (or filled in with repositories / services / other handy bits and pieces).

*You can access the objects passed to the handle(Event $event) method:
public function handle(MyEvent $myEvent)
{
    $this->user = $myEvent->user;
    $mailData = ['user'=>$this->user];
    Mail::queue('viewdir.view',$mailData, function($message) use ($mailData) {
        $message->to($mailData['user']->email);
        // other stuff
    });
}

I hope this helps anyone reading.

A: So I had the same problem but I discovered that I had set my driver to sync while using the database as the sync driver. setting my driver as database solved it for me


text:
Q: Error when coping object from one table to another in Hibernate I'm having one class ShopOrder with 2 xml mappings that have only different entity name:
<class name="...ShopOrder" [...] entity-name="shopOrder">...
<class name="...ShopOrder" [...] entity-name="shopOrderArchival">...

What I want to achieve is to read object from table bounded to class with entity-name = shopOrder and save it to the other table (entity-name = shopOrderArchival). My code looks like that:
public void archive(long orderNumber, Model model) {
    final ShopOrder order = shopOrderQueries.getShopOrderByOrderNumber(orderNumber);
    shopOrderQueries.flushAndClearCurrentSession();
    shopOrderRepository.save("shopOrderArchival", order);
}

Sadly I get an exception Don't change the reference to a collection with delete-orphan enabled : shopOrder.collectionName
How can i do it in a proper way?
Full stack trace:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.orm.hibernate4.HibernateSystemException: Don't change the reference to a collection with delete-orphan enabled : shopOrder.orderedLimitedServiceAvailabilities; nested exception is org.hibernate.HibernateException: Don't change the reference to a collection with delete-orphan enabled : shopOrder.orderedLimitedServiceAvailabilities
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:948)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
xxx.terracotta.websessions.ReloadSessionsObjectsFilter.doFilterInternal(ReloadSessionsObjectsFilter.java:55)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
xxx.logic.orders.cart.RequestDataFilter.doFilterInternal(RequestDataFilter.java:40)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
xxx.util.RequestCacheControlFilter.doFilterInternal(RequestCacheControlFilter.java:44)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
xxx.logic.httpfilters.RequestPartnerModeFilter.doFilterInternal(RequestPartnerModeFilter.java:44)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
xxx.logic.wc.RequestWcSettingsFilter.doFilterInternal(RequestWcSettingsFilter.java:81)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
xxx.logic.configurations.RedirectToEmptyFilter.doFilterInternal(RedirectToEmptyFilter.java:56)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
xxx.httpfilters.SessionLog.doFilter(SessionLog.java:39)
org.webdroid.catnip.filter.BadInputFilter.doFilter(BadInputFilter.java:398)
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:186)
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
xxx.logic.mobile.MobileVersionByDomainFilter.doFilterInternal(MobileVersionByDomainFilter.java:61)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
xxx.httpfilters.ThreadFriendlyNameFilter.doFilterInternal(ThreadFriendlyNameFilter.java:42)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
xxx.httpfilters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:133)

Hbm mapping (for archival is the same, only change is in entity-name)
<class name="xxx.orders.impl.ShopOrder"  table="xxx" discriminator-value="S" entity-name="shopOrder">

    <id name="id" column="id" type="long" unsaved-value="0">
        <generator class="native"/>
    </id>

    <discriminator column="class" type="char"/>

    <property name="operatorSource">
      <column name="operator_source" sql-type="varchar"/>
      <type name="org.hibernate.type.EnumType">
        <param name="enumClass">xxx.orders.OperatorSource</param>
        <param name="type">12</param><!-- to jest java.sql.Types.VARCHAR -->
      </type>
    </property>
    <property name="orderNumber" column="order_number" not-null="true"/>
    <property name="dateCreate" column="date_create" not-null="true"/>
    <property name="orderFinalizeDate" column="order_finalize_date"/>
    <property name="from" column="customer_from"/>
    <property name="partner"/>
    <property name="invoiceNeeded" column="invoice_needed"/>
    <property name="deliveryEqualsHome" column="delivery_equals_home"/>
    <property name="peselNeeded" column="pesel_needed"/>
    <property name="phone"/>
    <property name="phoneType" column="phone_type"/>
    <property name="smsNotify" column="sms_notify"/>
    <property name="instalmentOnlySmallCaseSwitch" column="instalment_only_small_case_switch"/>
    <property name="blockedForUserEdit" column="blocked_for_user_edit"/>
    <property name="tdUrl" column="td_url"/>
    <property name="tdSuccess" column="td_success" not-null="true"/>
    <property name="canceledByUser" column="canceled_by_user"/>
    <property name="pesel"/>
    <property name="visitId" column="visit_id"/>
    <property name="userId" column="user_id"/>
    <property name="sygmaCreditMotionId" column="sygma_credit_motion_id"/>
    <property name="sygmaCreditMotionUpdateAttempts" column="sygma_credit_motion_update_attempts"/>
    <property name="statusCodesThatEmailNotificationWasSend" column="status_codes_that_email_notification_was_send" />
    <property name="statusCodesThatSmsNotificationWasSend" column="status_codes_that_sms_notification_was_send" />
    <property name="reserveAndCollectMode" column="reserve_and_collect_mode"/>
    <property name="ePaymentTransactionId" column="e_payment_transaction_id"/>
    <property name="historicalEPaymentTranactionIds" column="historical_e_payment_tranaction_ids"/>
    <property name="lastUpdateDate" column="last_update_date"/>
    <property name="ePaymentStatusChangeDate" column="e_payment_status_change_date"/>
    <property name="warrantyRegulationsReaded" column="warranty_regulations_readed"/>
    <property name="userInstalmentNumber" column="user_instalment_number"/>
    <property name="paperInvoice" column="paper_invoice"/>
    <property name="proforma" column="proforma"/>

    <component name="abTestsVariables">
        <property name="simpleOrderPath" column="simple_order_path"/>
        <property name="gridDeliveryPricesIncludesItemsPayments" column="grid_delivery_prices_includes_items_payments" />
        <property name="displayServiceCalculator" column="display_service_calculator" />
        <property name="hideInstalmentOptions" column="hide_instalment_options"/>
    </component>

    <component name="aliorData" access="field">
        <property name="status">
            <column name="alior_status" sql-type="varchar"/>
                <type name="org.hibernate.type.EnumType">
                    <param name="enumClass">xxx.orders.impl.AliorStatus</param>
                    <param name="type">12</param>
                </type>
        </property>
        <property name="applicationNumber" column="alior_application_number" />
        <property name="instalmentCodeSequence" column="alior_instalment_code_sequence" />
        <property name="creditApplicationStatusCode" column="alior_credit_application_status_code" />
        <property name="confirmLoanAgreementSend" column="alior_confirm_loan_agreement_send" />
    </component>

    <component name="platnosciData" access="field">
        <property name="status">
            <column name="platnosci_status" sql-type="varchar"/>
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">xxx.orders.impl.PlatnosciTransactionsStatus</param>
                <param name="type">12</param>
            </type>
        </property>
        <property name="amount" column="platnosci_amount" />
    </component>

    <property name="confirmationStatus">
        <column name="confirmation_status" sql-type="varchar"/>
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">xxx.orders.impl.ConfirmationStatus</param>
                <param name="type">12</param><!-- to jest java.sql.Types.VARCHAR -->
            </type>
    </property>

    <property name="sygmaCreditMotionStatus">
        <column name="sygma_credit_motion_status" sql-type="varchar"/>
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">xxx.orders.sygma.SygmaCreditMotionStatus</param>
                <param name="type">12</param><!-- to jest java.sql.Types.VARCHAR -->
            </type>
    </property>

    <property name="state" not-null="true">
        <column name="state" sql-type="varchar"/>
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">xxx.orders.impl.ShopOrderState</param>
                <param name="type">12</param><!-- to jest java.sql.Types.VARCHAR -->
            </type>
    </property>

    <property name="appVersion" not-null="true">
        <column name="app_version" sql-type="varchar"/>
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">xxx.app.AppVersion</param>
                <param name="type">12</param><!-- to jest java.sql.Types.VARCHAR -->
            </type>
    </property>

    <property name="sf1Status">
        <column name="sf1_status" sql-type="varchar"/>
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">xxx.orders.sf1.Sf1Status</param>
                <param name="type">12</param><!-- to jest java.sql.Types.VARCHAR -->
            </type>
    </property>

    <component name="insuranceData">
        <property name="insuranceNumber" column="insurance_number"/>
        <property name="insuranceDamageNumber" column="insurance_damage_number"/>
        <property name="productReturnRequired" column="product_return_required"/>
        <property name="additionalCharge" column="additional_charge"/>
        <property name="insurerPayment" column="insurer_payment"/>
        <property name="customerPayment" column="customer_payment"/>

        <property name="insuranceType">
            <column name="insurance_type" sql-type="varchar"/>
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">xxx.orders.euro.InsuranceType</param>
                <param name="type">12</param><!-- to jest java.sql.Types.VARCHAR -->
            </type>
        </property>
    </component>

    <component name="googleCookie">
        <property name="utmcsr" not-null="true"/>
        <property name="utmccn" not-null="true"/>
        <property name="utmcmd" not-null="true"/>
        <property name="utmcct" not-null="true"/>
        <property name="utmctr" not-null="true"/>
        <property name="utmgclid" not-null="true"/>
        <property name="utmx" not-null="false"/>
        <property name="utmxx" not-null="false"/>
        <property name="cookieHeader" column="cookie_header" not-null="true"/>
    </component>

    <component name="transportData">
        <parent name="shopOrder"/>
        <property name="transportDate" column="transport_date"/>
        <property name="actualDeliveryDate" column="actual_delivery_date"/>
        <property name="transportInterval" column="transport_interval"/>
        <property name="transportIntervalIndex" column="transport_interval_index"/>
        <property name="additionalTransportPrice" column="additional_transport_price"/>
        <property name="realTransportInterval" column="real_transport_interval" />
        <property name="realTransportIntervalIndex" column="real_transport_interval_index" />
        <property name="transportCode" column="transport_code" />
        <property name="sellDocumentResponseCode" column="sell_document_response_code"/>

        <property name="deliveryPaymentPriceType">
            <column name="delivery_payment_price_type" sql-type="varchar"/>
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">xxx.orders.impl.DeliveryPaymentPriceType</param>
                <param name="type">12</param><!-- to jest java.sql.Types.VARCHAR -->
            </type>
        </property>

        <property name="type">
            <column name="transport_data_type" sql-type="varchar"/>
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">xxx.orders.impl.TransportDataType</param>
                <param name="type">12</param><!-- to jest java.sql.Types.VARCHAR -->
            </type>
        </property>

        <many-to-one
            name="instalmentOption"
            column="transport_data_instalment_option_id"
            not-null="false"
            cascade="none"
            foreign-key="b24_instalment_option_transport_data_fkey"
            class="xxx.products.impl.InstalmentOption"
        />
    </component>

    <component name="actionData">
        <property name="actionStateCode" column="action_state_code"/>
        <property name="actionReservationId" column="action_reservation_id"/>
        <property name="actionReservationLabel" column="action_reservation_label"/>
        <property name="actionReservationMessage" column="action_reservation_message"/>
        <property name="actionToRelease" column="action_to_release" not-null="true"/>
        <property name="actionOrderId" column="action_order_id"/>
    </component>

    <component name="sf1Data">
        <property name="checkCounter" column="check_counter" not-null="true"/>
        <property name="uid" column="uid" not-null="true"/>
        <property name="amount" column="sf1_amount" not-null="true"/>
    </component>

    <component name="abData">
        <property name="abOrderId" column="ab_order_id"/>
        <property name="abErrorCode" column="ab_error_code"/>
        <property name="abErrorDescription" column="ab_error_description"/>
        <property name="abStatusCode" column="ab_status_code"/>
        <property name="abStatusDescription" column="ab_status_description"/>
        <property name="abToRelease" column="ab_to_release" not-null="true"/>
        <property name="abOrderState">
            <column name="ab_order_state" sql-type="varchar"/>
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">xxx.orders.impl.AbOrderState</param>
                <param name="type">12</param>
            </type>
        </property>
    </component>

    <many-to-one access="field"
            name="kredytLineData"
            column="kredyt_line_data_id"
            not-null="false"
            cascade="all"
            foreign-key="b24_shop_orders_kredyt_line_data_fk"
            unique="true"
            class="xxx.orders.impl.ShopOrderKredytLineData"
            entity-name="shopOrderKredytLineData"
        />

    <set name="orderedLimitedServiceAvailabilities" lazy="true" cascade="all-delete-orphan">
        <key column="order_id" foreign-key="b24_order_to_li_se_av_fkey" not-null="true"/>
        <one-to-many class="xxx.orders.impl.OrderedLimitedServiceAvailability" entity-name="orderedLimitedServiceAvailability"/>
    </set>

    <list name="orderItems" lazy="true" inverse="false" cascade="all-delete-orphan">
        <key column="order_id" foreign-key="b24_order_to_item_fkey" not-null="true"/>
        <list-index column="index" />
        <one-to-many class="xxx.orders.impl.OrderItem" entity-name="orderItem"/>
    </list>

    <list name="orderedSuites" lazy="true" inverse="false" cascade="all-delete-orphan">
        <key column="order_id" foreign-key="b24_ordered_suite_to_order_fkey" not-null="true"/>
        <list-index column="index" />
        <one-to-many class="xxx.orders.impl.OrderedSuite" entity-name="orderedSuite"/>
    </list>

    <list name="headDeliveryPayments" lazy="true" inverse="false" cascade="all-delete-orphan">
        <key column="order_id" foreign-key="b24_order_to_delivery_payment_instance_fkey"/>
        <list-index column="index" />
        <one-to-many class="xxx.orders.impl.DeliveryPaymentInstance" entity-name="deliveryPaymentInstance"/>
    </list>

    <set name="smses" cascade="none" inverse="true">
        <key column="shop_order_id" foreign-key="b24_sms_to_shop_order_fkey" not-null="false"/>
        <one-to-many class="xxx.orders.impl.Sms"/>
    </set>

    <set name="euroOrders" cascade="none" inverse="true" order-by="time_stamp">
        <key column="shop_order_id" foreign-key="b24_euro_order_to_shop_order_fkey" not-null="false"/>
        <one-to-many class="xxx.orders.euro.EuroOrder" />
    </set>

    <many-to-one
        name="ePaymentBank"
        column="e_payment_bank_id"
        not-null="false"
        cascade="none"
        foreign-key="b24_order_to_e_payment_bank_fkey"
        class="xxx.banks.EPaymentBank"
    />

    <many-to-one
        name="frontUser"
        class="xxx.customers.IFrontUser"
        column="front_user_id"
        cascade="none"
        not-null="true"
        unique="false"
        foreign-key="b24_order_to_front_user_fkey"
    />

    <many-to-one
        name="orderInvoice"
        class="xxx.orders.IOrderInvoice"
        column="order_invoice_id"
        cascade="all"
        not-null="true"
        unique="true"
        foreign-key="b24_order_to_oinvoice_fkey"
        entity-name="iOrderInvoice"
    />

    <many-to-one
        name="delivery"
        class="xxx.orders.IDelivery"
        column="delivery_id"
        cascade="all"
        not-null="true"
        unique="true"
        foreign-key="b24_order_to_delivery_fkey"
        entity-name="iDelivery"
    />

    <many-to-one
        name="payment"
        class="xxx.orders.IPayment"
        column="payment_id"
        cascade="all"
        not-null="true"
        unique="true"
        foreign-key="b24_order_to_payment_fkey"
        entity-name="iPayment"
    />

    <many-to-one
        name="operator"
        class="xxx.users.IOperator"
        column="operator_id"
        cascade="none"
        not-null="false"
        unique="false"
        foreign-key="b24_order_to_operator_fkey"
    />

    <many-to-one
        name="toDepository"
        class="xxx.dictionaries.IDictionaryItem"
        column="to_depository_id"
        cascade="none"
        not-null="false"
        unique="false"
        lazy="false"
        foreign-key="b24_order_to_td_di_fkey"
    />

    <many-to-one
        name="holidayPromotionStatus"
        class="xxx.products.impl.HolidayPromotionStatus"
        column="holiday_promotion_status_id"
        not-null="false"
        unique="false"
        foreign-key="b24_order_to_hps_fkey"
    />

    <many-to-one
        name="smsNotificationService"
        class="xxx.orders.impl.OrderedService"
        column="sms_notification_service_id"
        cascade="all"
        not-null="false"
        unique="false"
        foreign-key="b24_order_to_sms_service_fkey"
        entity-name="orderedService"
    />

    <many-to-one
        name="instalmentOption"
        column="instalment_option_id"
        not-null="false"
        cascade="none"
        foreign-key="b24_instalment_option_shop_order_fkey"
        class="xxx.products.impl.InstalmentOption"
    />

    <many-to-one
        name="userInstalmentOption"
        column="user_instalment_option_id"
        not-null="false"
        cascade="none"
        foreign-key="b24_user_instalment_option_shop_order_fkey"
        class="xxx.products.impl.InstalmentOption"
    />

    <many-to-one
        name="synchronizedData"
        class="xxx.orders.ShopOrderSynchronizedData"
        column="shop_order_synchronized_data_id"
        cascade="all"
        not-null="true"
        unique="true"
        access="field"
        foreign-key="b24_shop_order_to_euro_order_date_fkey"
        entity-name="shopOrderSynchronizedData"
    />

    <component name="voucherData">
        <many-to-one
            name="voucher"
            class="xxx.vouchers.Voucher"
            column="voucher_id"
            cascade="none"
            not-null="false"
            foreign-key="b24_voucher_voucher_to_product_id_fkey"
        />
        <many-to-one
            name="alias"
            class="xxx.vouchers.VoucherAlias"
            column="voucher_alias_id"
            cascade="none"
            not-null="false"
            foreign-key="b24_order_to_voucher_alias_id_fkey"
        />
        <property name="discountValueSplit" column="voucher_data_discount_value_split"/>
        <property name="usageUpdated" column="voucher_data_usage_updated"/>

        <property name="deliveryPaymentDiscountType" not-null="true">
            <column name="voucher_delivery_payment_discount_type" sql-type="varchar"/>
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">xxx.vouchers.VoucherDeliveryPaymentDiscountType</param>
                <param name="type">12</param><!-- to jest java.sql.Types.VARCHAR -->
            </type>
        </property>

    </component>

    <component name="consolidateData" access="field" >
        <many-to-one
            name="order"
            class="xxx.orders.impl.ShopOrder"
            column="consolidate_data_order_id"
            cascade="all"
            not-null="false"
            foreign-key="b24_consolidate_order_id_fkey"
            entity-name="shopOrder"
        />
    </component>

    <property name="IPAddress" column="ip_address"/>

    <property name="ecardStatus">
        <column name="ecard_status" sql-type="varchar"/>
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">xxx.orders.impl.ECardStatus</param>
                <param name="type">12</param><!-- to jest java.sql.Types.VARCHAR -->
            </type>
    </property>

    <property name="ePaymentToErpStatus">
        <column name="e_payment_to_erp_status" sql-type="varchar"/>
            <type name="org.hibernate.type.EnumType">
                <param name="enumClass">xxx.orders.impl.EPaymentToErpStatus</param>
                <param name="type">12</param><!-- to jest java.sql.Types.VARCHAR -->
            </type>
    </property>

    <many-to-one
        name="partnerClient"
        class="xxx.orders.impl.PartnerClient"
        column="partner_client_id"
        cascade="all"
        not-null="false"
        unique="false"
        foreign-key="b24_partner_client_id_fkey"
    />

     <many-to-one
        name="euroPartner"
        class="xxx.users.impl.Partner"
        column="euro_partner_id"
        cascade="none"
        not-null="false"
        unique="false"
        foreign-key="b24_partner_id_fkey"
    />

    <many-to-one
        name="partnerOperator"
        class="xxx.users.IOperator"
        column="partner_operator_id"
        cascade="none"
        not-null="false"
        unique="false"
        foreign-key="b24_partner_operator_id_fkey"
    />

    <one-to-one
        name="consoleData"
        access="field"
        class="xxx.orders.impl.ShopOrderConsoleData"
        cascade="save-update, delete"
        lazy="false"
        entity-name="shopOrderConsoleData"
    />

    <one-to-one
        name="status"
        access="field"
        class="xxx.orders.impl.ShopOrderStatus"
        cascade="save-update, delete"
        lazy="false"
        entity-name="shopOrderStatus"
    />

</class>

A: This seems to me like you're replacing the whole reference of a Collection by another. But if "shopOrderArchival" is not null, then you should clear the collection and add all new elements.
Take a look at this: Click


text:
Q: Convert the Specific string to date and check it is greater than current date I have a string s="2020-04-07T13:43:49-05:00"
i have to check if its greater than current date and i tried using instant date
Instant timestamp = Instant.parse(string);

But did not work and i tried with LocalDate
LocalDate date = LocalDate.parse(string, format);

this is also not working, how to parse it and check

A: You should parse it into OffsetDateTime since date string has an offset

A date-time with an offset from UTC/Greenwich in the ISO-8601 calendar system, such as 2007-12-03T10:15:30+01:00.

String s="2020-04-07T13:43:49-05:00";

OffsetDateTime dateTime = OffsetDateTime.parse(s);

and then check weather it is greater than or not using isBefore or isAfter by converting into LocalDateTime
LocalDateTime.now().isBefore(dateTime.toLocalDateTime())

You can also compare OffsetDateTime directly using isBefore and isAfter
OffsetDateTime.now().isBefore(dateTime)

A: This works fine for me using Java (jshell) 13:
jshell> import java.time.Instant

jshell> Instant.parse("2020-04-07T13:43:49-05:00")
$2 ==> 2020-04-07T18:43:49Z

A: Use SimpleDateFormat for this. Take your string and format it to the date and then check for it.
Date date= new Date();
String targetDate="2020-04-07 13:43:49";
Date date2= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(targetDate);

Now you can just check the two date by
if(date.getTime()>date2.getTime())

If you want to do it opposite way you can do that too.
Date date= new Date();
String currentDate=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date)

now just check the two strings with if condition.