text:
Q: Trouble making more than one or two cells into UITableView with different sizes Swift I'm trying to build two (or more) custom cells into table View and without custom classes for each one, I'm using storyboard to cell prototyping and  tableView.dequeueReusableCell(withIdentifier: "customCellName", for: indexPath) to create different cell from cellForRowAt method.
I need cell type 1 with different height than cell type 2 but if a try to use func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat the cell type 2 is not displayed correctly.
I try to build a "dummy project" to understand the right way, here my code:
var cell = self.tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)

let value = dataArray[indexPath.row]

if (value == "second") || (value == "Hawaii") {
    cell = self.tableView.dequeueReusableCell(withIdentifier: "cellTwo", for: indexPath)
}
let lbl = cell.viewWithTag(100) as! UILabel
lbl.text = dataArray[indexPath.row]
return cell

In ViewDidLoad:
override func viewDidLoad() {
    super.viewDidLoad()

    self.tableView.dataSource = self
    self.tableView.delegate = self

    self.tableView.estimatedRowHeight = 200
}

This is the result:

Every cell with the same size, is not working for me.

A: If you want to create a custom cell appearance, you will have to create a subclass of UITableViewCell - there are some great tutorials on how to do that.
You then have to register your custom cell, so that your UITableView knows about it. See register(_:forCellReuseIdentifier:) method.
In your tableView(_:heightForRowAt:) you can do write the following code in order to figure out the height of particular cell:
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat

     let value = dataArray[indexPath.row]

     if (value == "second") || (value == "Hawaii") {
         return 180.0
     } else {
         return 40.0
     }
}


text:
Q: jQuery show next prev items when keypress i have list items:

content

content

.. etc

and jQuery:
$(document.documentElement).keyup(function (e) {

  if (e.keyCode == 39)
  {
  }

  if (e.keyCode == 37)
  {
  }

});

How can i show next items when click keyboard 'right' and when press keyboard 'left' show prev items?

A: HTML

content

content

.. etc

jQuery
$(document.documentElement).keyup(function (e) {
  var $activeslide = $('.slides.active'), $targetslide;

  if (e.keyCode == 39)
  {
    if ($activeslide.next('.slides').length) {
      $targetslide = $activeslide.next('.slides');
    } else {
      $targetslide = $('.slides:first');
    }
  }

  if (e.keyCode == 37)
  {
    if ($activeslide.prev('.slides').length) {
      $targetslide = $activeslide.prev('.slides');
    } else {
      $targetslide = $('.slides:last');
    }
  }

  $targetslide.addClass('active');
  $activeslide.removeClass('active');

});

CSS
.slides {
  display: none;
}

.slides.active {
  display: block;
}

Animate as you see fit.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Avoid Date Overlapping using JPA I have an entity class with properties 'code','fromDate' and 'toDate' and i need to insert one new record using JPA such a way that for given code date range should not overlap.
For example
If code- ABC of date range 01/Feb/2014-10/Feb/2014 exist in DB.
I am inserting code ABC again with date range
03/Feb/2014-07/Feb/2014 should not accept -  from date and to date is Within existing Date range
28/Jan/2014-02/Feb/2014 should not accept -   to date is Within existing Date range
05/Feb/2014-21/Feb/2014 should not accept -   From date is Within existing Date range
01/Jan/2014-28/Feb/2014 should not accept -   The existing date range is within the given date range so Overlapping will happen.

Suppose the data need to be inserted is in a viewObject with similar properties.
Please help me to do the validation for date overlapping using JPA predicates

A: Before saving the new object you can query the DB to check if an 'overlapping' records exists.
If, a record is returned, then do not save the new object, else save;
String query = "SELECT ent FROM Entity ent WHERE ent.fromDate <= :toDate AND ent.toDate >= :fromDate WHERE ent.id = :entId";

List<Entity> overlappingRecords = JPA.em().createQuery(query).setParameter("entId", id).setParameter("fromDate", fromDate).setParameter("toDate", toDate).getResultList();

if(overlappingRecords.isEmpty())
   //Over lap does not exist
else
   //Over lap exists

This query assumes rejection of edges overlapping exactly.


text:
Q: user interface guidelines for a website targeting kids We are planning to design a website for evaluating kids (games, quiz). Are there any specific user interface guidelines for targeting the kids (e.g. keyboard usage in a laptop or a standalone keyboard, ability to control a mouse, ability to navigate the user interface and its controls, size of buttons, page navigation)? We are looking for things which we need to be careful about.

A: Jakob Nielsen has a pretty decent Alert Box about usability for children. There's also a usability guide at the end of the alert box. In summary: kids don't scroll, they like reading, are suckers for advertising, and if Microsoft Bob was marketed to children, it would've been a hit.


text:
Q: Batch the "Extract Here" command I would like to batch the "Extract Here..." command on a complete folder. Every type of archive should be unzipped into the current folder with the name of the archive file. I have found some BATCH scripts for just *.zip, but I don't care what kind of archive it is, as long as my archiver can open it.
Does anyone know what kind of archiver has such a batching funcionality? I can't seem to find it in 7-zip or winrar.
In pseudo:
Given folder x
foreach archiveFile in x or descendant of x
unzip archiveFile.extension >> "folder of archiveFile/archiveFile"

Update
I have tried the following for only zip files:
dir /s /b *.zip > allzips.txt
for /F %%x in (allzips.txt) do unzip %%x

Where unzip is still an unknown function.

A: EDIT Given: Using batch script.
You may wish to use a third party zip tool (highly recommend 7-ZIP command line version called 7z.exe) to accomplish this.
with 7z, the syntax is as follows:
7z <command> [<switch>...] <base_archive_name> [<arguments>...]

To extract the command would be:
7z e file.zip -y

the -y switch assume "Yes" answer to any questions that may come up during extraction such as overwrite requests.
So your command will read
CD "C:\Location\Of\ZipFiles"
FOR /F "USEBACKQ tokens=*" %%F IN (`DIR /b *.zip`) DO (7z e "%%F" -y)

If you want to output them into a different location, you can use the -o switch and specify the directory:
7z e "%%F" -y -oC:\Some\Other\Folder\

EDIT:
To perform the extract with full paths and specifying all ZIP archives only, use this:
7z x -tzip "C:\Location\of\zips\*"

Or even nutzier... all ZIP files on C: drive:
7z x -r -tzip "C:\*"

EDIT2:
Making it compatible with your output file, this:
dir /s /b *.zip > allzips.txt
for /F %%x in (allzips.txt) do (7z x -tzip "%%x")


text:
Q: Compiling a Maven plugin using the help-mojo phase with maven-plugin-plugin I'm working on an extension of a MojoHaus plugin for Maven.
My project is at this GitHub repository.
When I try to run mvn clean install, the compilation fails with the following error message:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.4:helpmojo
(help-mojo) on project yaml-properties-maven-plugin: Execution help-mojo of goal
org.apache.maven.plugins:maven-plugin-plugin:3.4:helpmojo failed: syntax error @[11,22] in
file:/home/user/workspace/yaml-properties-maven-plugin/src/main/java/org/codehaus/mojo/properties/ResourceType.java -> [Help 1]

The class ResourceType looks like:
package org.codehaus.mojo.properties;

import java.util.HashSet;
import java.util.Set;

public enum ResourceType {

    PROPERTIES(".properties"),
    YAML(new String[]{".yml", ".yaml"});

    private final Set<String> fileExtensions;

    ResourceType(final String... fileExtensions) {
        this.fileExtensions = new HashSet<String>();
        for(final String fileExtension: fileExtensions){
            this.fileExtensions.add(fileExtension);
        }
    }

    public static Set<String> allFileExtensions(final ResourceType... resourceTypes) {
        final Set<String> extensions = new HashSet<String>();
        for (final ResourceType resourceType : resourceTypes) {
            extensions.addAll(resourceType.fileExtensions());
        }

        return extensions;
    }

    public static ResourceType getByFileName(final String fileName) {
        for (final ResourceType resourceType : ResourceType.values()) {
            for (final String extension : resourceType.fileExtensions()) {
                if (fileName.endsWith(extension)) {
                    return resourceType;
                }
            }
        }

        return null;
    }

    public Set<String> fileExtensions() {
        return new HashSet<String>(fileExtensions);
    }

}

What could be the issue?

A: I think you're hitting an issue with QDox, which probably has an issue with parsing the line YAML(new String[]{".yml", ".yaml"});. The stacktrace can confirm that.
The solution is actually quite simple since you're using varArgs: change the line to YAML(".yml", ".yaml");


text:
Q: Android rename: unable to find explicit activity class I have a live wallpaper based off of some open source code that I heavily modified.  As the last item, I right clicked on it in Eclipse to change the package name and all was well with the world.  The wallpaper works right.  The settings menu works right.  But when I try to click an item in the settings menu to launch another activity, I get:
 10-10 16:16:56.215: E/AndroidRuntime(13825): FATAL EXCEPTION: main
 10-10 16:16:56.215: E/AndroidRuntime(13825): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.nightscapecreations.orionkeysfree/ffvideolivewallpaper.frankandrobot.com.extLinkNC}; have you declared this activity in your AndroidManifest.xml?

Here is the manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.nightscapecreations.anim1"
    android:versionCode="1"
    android:versionName="0.9.0" >

    <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9" />

    <!-- Tell the system this app requires OpenGL ES 2.0. -->
    <uses-feature android:glEsVersion="0x00020000" android:required="true" />

    <uses-feature android:name="android.software.live_wallpaper" />

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name" >
        <service
            android:name="ffvideolivewallpaper.frankandrobot.com.VideoLiveWallpaper"
            android:label="@string/wallpaper"
            android:permission="android.permission.BIND_WALLPAPER" >
            <intent-filter>
                <action android:name="android.service.wallpaper.WallpaperService" />
            </intent-filter>

            <meta-data
                android:name="android.service.wallpaper"
                android:resource="@xml/wallpaper" />
        </service>

        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.VideoLiveWallpaper"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.VideoWallpaperSettings"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.About"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.License"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.SelectVideo"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>

        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.extLinkNC"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.extLinkZazzle"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.extLinkFacebook"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="ffvideolivewallpaper.frankandrobot.com.extLinkGooglePlus"
            android:exported="true"
            android:label="@string/app_name" >
        </activity>
    </application>

</manifest>

Here is the About activity, as an example, which was confirmed working before this change:
package ffvideolivewallpaper.frankandrobot.com;

import android.app.Activity;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.widget.TextView;
import android.content.Intent;
import android.view.View;
import com.nightscapecreations.anim1.R;

public class About extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.about);
        TextView t = (TextView) findViewById(R.id.about_box);
        t.setMovementMethod(LinkMovementMethod.getInstance());
    }

    public void showLicense(View view) {
    startActivity(new Intent(About.this, License.class));
    }
}

ffvideolivewallpaper.frankandrobot.com was the old package name.  Eclipse added the prefix to the android:name for all activities during the package name change.  What I don't understand is that if this is incorrect then why does the wallpaper work at all since the service name is qualified the exact same way?

EDIT
Dunamis made an excellent catch.  The original name was
ffvideolivewallpaper.frankandrobot.com, but it's been through several name changes since then.  One such name was com.nightscapecreations.orionkeysfree.  It looks like there was still a reference to that old name which I totally missed in the settings xml file.  Example:
<PreferenceCategory android:title="Links and Information" >
        <PreferenceScreen android:title="Visit Nightscape Creations"
            android:summary="See more live wallpapers, get free static wallpapers, and learn about NC by visiting us online." >
            <intent
                android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkNC"
                android:targetPackage="com.nightscapecreations.orionkeysfree" />
        </PreferenceScreen>

However, this still does not work.  I tried every combination of fully qualified name and simple dot notation ".extLinkFacebook" between this file and the manifest file, but without success.  Here is the error I'm receiving now with both names fully qualified:
10-11 08:19:43.176: E/AndroidRuntime(25204): FATAL EXCEPTION: main
10-11 08:19:43.176: E/AndroidRuntime(25204): android.content.ActivityNotFoundException: Unable to find explicit activity class {ffvideolivewallpaper.frankandrobot.com/ffvideolivewallpaper.frankandrobot.com.extLinkFacebook}; have you declared this activity in your AndroidManifest.xml?

Here is the settings file for reference:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >

    <PreferenceCategory android:title="Wallpaper Settings">
        <ffvideolivewallpaper.frankandrobot.com.PrefsSlider
            android:key="fps"
            android:title="Framerate"
            android:summary="Set the target framerate.  Lower framerates will decrease resource usage.  Requires wallpaper restart to take effect."
            android:layout_width="fill_parent"
            android:defaultValue="30"
            android:orientation="vertical" />

<!--        <ListPreference -->
<!--                android:enabled="true" -->
<!--                android:key="resolution" -->
<!--                android:title="Resolution" -->
<!--                android:summary="Ultra resolution may decrease framerate.  Only recommended for high end devices." -->
<!--                android:entries="@array/prefs_resolutionEntries" -->
<!--                android:entryValues="@array/prefs_resolutionValues" -->
<!--                android:defaultValue="512" /> -->

<!--        <ListPreference -->
<!--                android:enabled="true" -->
<!--                android:key="frameTonality" -->
<!--                android:title="Filters" -->
<!--                android:summary="Various effects and filters can be applied to the animation" -->
<!--                android:entries="@array/prefs_tonalityEntries" -->
<!--                android:entryValues="@array/prefs_tonalityValues" -->
<!--                android:defaultValue="1" /> -->
    </PreferenceCategory>

    <PreferenceCategory android:title="Links and Information" >
        <PreferenceScreen android:title="Visit Nightscape Creations"
            android:summary="See more live wallpapers, get free static wallpapers, and learn about NC by visiting us online." >
            <intent
                android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkNC"
                android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
        </PreferenceScreen>

        <PreferenceScreen
            android:title="@string/prefsProductsHeading"
            android:summary="@string/prefsProductsSummary" >
            <intent
                android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkZazzle"
                android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
        </PreferenceScreen>

        <PreferenceScreen android:title="Like on Facebook" >
            <intent
                android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkFacebook"
                android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
        </PreferenceScreen>

        <PreferenceScreen android:title="Like on Google+" >
            <intent
                android:targetClass="ffvideolivewallpaper.frankandrobot.com.extLinkGooglePlus"
                android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
        </PreferenceScreen>
    </PreferenceCategory>

    <PreferenceCategory android:title="About" >
        <PreferenceScreen android:title="About" >
            <intent
                android:targetClass="ffvideolivewallpaper.frankandrobot.com.About"
                android:targetPackage="ffvideolivewallpaper.frankandrobot.com" />
        </PreferenceScreen>
    </PreferenceCategory>

</PreferenceScreen>

A: Shortly after adding the bounty I found a workaround for this problem.  I'm still not sure what the original issue was, though.
To resolve this I renamed the ffvideolivewallpaper.frankandrobot.com package, which contained all the code, to match that of the manifest.  I had hesitated to do this as it required an update to the video.c file to change all "ffvideolivewallpaper_frankandrobot_com" references in native calls to "com_nightscapecreations_anim1" and the last time I had tried that I hosed the app so bad I had to return to a backup copy.  However, after doing so today, and then search/replacing through the app to find all other references, I was able to get it to work.
I would still like to know the answer to the above question as it stands, though.  It would be much easier to create new apps off this base in the future if I could just leave the main package name alone instead of bothering with a search/replace.  If no one knows, though, I will just mark this as the answer.


text:
Q: zip file download using php in ie8 I was able to zip a folder and download the zip file using PHP code in "chrome" and "FF" browsers. But when I try that in IE8 it shows the downloaded zip file as a file of unknown type. I will have to open it with rar application specifically but I am looking to make this zip file download directly as .zip file in IE8 as it is happening in the other browsers. The following are the headers I used for it:
header("Pragma: public");
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: application/zip");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($archive_file_name));
header("Content-Disposition: attachment; filename=$archive_file_name");
readfile("$archive_file_name");
unlink($archive_file_name);

Can someone please let me know where I need to correct the code? Thanks

A: header("Content-Disposition: attachment; filename=$archive_file_name");

Make sure $archive_file_name is just a name not a whole path, also it needs to be url encoded and should probably have a ".zip" extension at the end.
header("Content-type: application/zip");

Why is the t in "type" lower cased?

A: You are overwriting some headers, some are needed just for IE, some for other browsers, IE is more picky.
Look at this link:
http://www.boutell.com/newfaq/creating/forcedownload.html


text:
Q: When confidence interval goes to infinity, what's the problem? I run a Welch independent samples t-test and obtain the results of t(890.13) = 2.90, p < .01, but the 95% confidence intervals are between 0.045 to infinity.
t.test(y ~ A, paired = FALSE, alternative = "greater", data = data)

Does this necessarily mean that there is a problem? Do I go back to re-check that all the assumptions of the Welch t-test are met?


text:
Q: connect application with website I want to implement an application that connected with a site, if I upload files in this site ,it will directly appear in the application and will notify the user for new uploading files
then the user can download the files from the application
 My question is What are the main steps to start implementing the application.

A: try google cloud messaging.There are sample codes that can help you
....

A: If your app is just rendering the content that comes from a website, you might want to consider the option of just having a customized web interface and access it from the web browser. It makes it much simpler to update the content, layout etc.
Another option is to use a WebView to create an app that lets you embed web content directly. Have a look here: http://developer.android.com/guide/webapps/overview.html
If these don't suit your need, you may have to create a regular standalone android app that talks to your web site. Then you will need to define some API/messaging for this communication. The specifics will depend on what exactly your application does, but the messaging could be as simple as a few http GET requests, assuming you have a webserver running on the other side. E.g., you could call an http GET to fetch the list of files you want to download. And then to download each file, you can issue separate GET requests on the appropriate urls. You can have an android service running in the background that does periodic http GETS to refresh the content.
See this link on running a background service to do http operations:
Android - httpclient as a backgroundservice


text:
Q: Ajax request to server, error function is not calling i am sending ajax request to server to get the database. But if i enter incorrect data (which is to be sent over server) nothing is happening, error function is not working, all i am doing is to verify credentials from the server
here is my code
$.ajax
    ({
        url: "URL",
        type: "GET",
        datatype: "jsonp",

        data: {type: 'login', id: C_id},
        ContentType: "application/json",

        success: function(res)
        {

            var simpleJson = JSON.parse(res);

            myDB.transaction(function (txe1)
            {
                for (var i = 0; i < simpleJson.User.length; i++)
                {
                    var Cli_id= simpleJson.User[i].id;
                    myDB.transaction(function (txe)
                    {
                        txe.executeSql('CREATE TABLE Client_data(Mobile integer , C_id integer, U_id integer , name text , ip integer )');
                    });

                    myDB.transaction(function (txe1)
                    {

                        var data_ins = 'INSERT INTO Client_data (Mobile,C_id,U_id) VALUES (?,?,?)';
                        txe1.executeSql(data_ins, [p,C_id,U_id]
                        ,function(tx, result)
                        {
                            navigator.notification.alert('Inserted' ,  onSignup, 'Info', 'ok');

                        },
                        function(error)
                        {
                            navigator.notification.alert('Already Registered');
                        });
                    });
                }
            });
        },
    });
});

my PHP code
<?php
header('Access-Control-Allow-Origin:*');
$conn = mysql_connect("***", "***", "****");
if (!$conn)
{
    echo "Unable to connect to DB: " . mysql_error();
    exit;
}

if (!mysql_select_db("ekspeser_pro"))
{
    echo "Unable to select mydbname: " . mysql_error();
    exit;
}

if(isset($_GET['type']))
{
    if($_GET['type'] == "login")
    {
        $id=$_GET['id'];
        $sql = "SELECT  * from client_master WHERE id='$id'";
        $result = mysql_query($sql);
        $num_rows = mysql_num_rows($result);
        if($num_rows!=0)
        {
            while($myrow = mysql_fetch_assoc($result))
            {
                $recipes[]=$myrow;
            }

            $output = json_encode(array('User' => $recipes));
            echo $output;

        }
        else
        {
             print "invalid key";
        }
    }
    else
    {
        print "invalid login";
    }
}

    else
    {
        echo "invalid";
    }

mysql_close();

?>

A: You should implement the error callback to perform some operation when the request fails. This is how you can implement request failure callback.
$.ajax({
  url: "/save/author",
  type: "POST",
  dataType: "json",
  data: { name: "John", age: "35" },
  success: function (data, status, jqXHR) {
    alert("request succeed");
  },
  error: function (jqXHR, status, err) {
    alert("request failed");
  }
})

as per this example, we are just showing an alert with text request failed. You can implement it accordingly as per your requirement.

A: If i get you correct,you want to validate the data passed to your url, if i am getting you correct you want to handle,please refer below:
Ajax error function will only be called if the request fails, see http://api.jquery.com/jQuery.ajax/
So if you return any response from your PHP server/API, the error function won't be triggered as The "error" setting of the ajax method is fired when the calls fails in the sending process. Errors like "timeout", "404", etc...
However, you can return a key from your PHP code as below to handle success and error in your ajax code:
$data['error'] = $success ? 0:1;// If success than set error to 0 else 1;

and in AJAX success you can handle it as :
success: function (data, status, jqXHR) {
    if(data.error)
      //do something
    else
      //do something else
}

Let me know if any queries
------EDIT------------------
<?php
header('Access-Control-Allow-Origin:*');
$conn = mysql_connect("***", "***", "****");
if (!$conn)
{
    echo "Unable to connect to DB: " . mysql_error();
    exit;
}

if (!mysql_select_db("ekspeser_pro"))
{
    echo "Unable to select mydbname: " . mysql_error();
    exit;
}

if(isset($_GET['type']))
{
    if($_GET['type'] == "login")
    {
        $id=$_GET['id'];
        $sql = "SELECT  * from client_master WHERE id='$id'";
        $result = mysql_query($sql);
        $num_rows = mysql_num_rows($result);
        $is_error=0;
        if($num_rows!=0)
        {
            while($myrow = mysql_fetch_assoc($result))
            {
                $recipes[]=$myrow;
            }

            $output = json_encode(array('User' => $recipes,'is_error'=>$is_error));
            echo $output;

        }
        else
        {
             $is_error=1;
             $error_message = "Invalid Key";
             $output = json_encode(array('is_error'=>$is_error,'error_message'=>$error_message));
             echo $output;
        }
    }
    else
    {
        $is_error=1;
        $error_message = "Invalid Login";
        $output = json_encode(array('is_error'=>$is_error,'error_message'=>$error_message));
        echo $output;
    }
}

    else
    {
        $is_error=1;
        $error_message = "Invalid";
        $output = json_encode(array('is_error'=>$is_error,'error_message'=>$error_message));
        echo $output;
    }

mysql_close();

?>

In AJAX Code access it like this :
Check for following in success
if(simpleJson.is_error!=1)
   //do your processing
else
   alert(simpleJson.error_message);

Let me know if anything unclear


text:
Q: Error in atom package installer, displaying searching failed Searching for <package_name> failed.Hide output…
i.filter is not a function
[object Object]
enter image description here

A: The servers are having issues today (I ran into the same problem). On linux you can install from command line using
apm install <package-name>

apm is the Atom package manager. Other OS' probably have equivalents.


text:
Q: Debian 8 Jessie with OpenVPN client I have a Debian 8 Jessie server that I need to connect to my home network and I'm using an OpenVPN server on a pfSense 2.2 box at home. I have done this fine under older Debian versions, so I'm guessing I'm missing something new with how systemd controls the service...
I have everything I need in /etc/openvpn/, with a reasonable simple setup:
client
dev tun
proto udp
remote home.dynamic-domain.com 1194
resolv-retry infinite
nobind
user nobody
group nobody
persist-tun
persist-key
ca /etc/openvpn/ca.crt
cert /etc/openvpn/hostname.crt
key /etc/openvpn/hostname.key
tls-auth /etc/openvpn/tls.key 1
cipher "AES-256-CBC"
comp-lzo
verb 3

and the relevant certs/keys are present and correct.
Bringing up the config manually works great:
~# openvpn --config /etc/openvpn/servervpn.conf
Sat Jun 27 13:26:08 2015 OpenVPN 2.3.4 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [PKCS11] [MH] [IPv6] built on Dec  1 2014
Sat Jun 27 13:26:08 2015 library versions: OpenSSL 1.0.1k 8 Jan 2015, LZO 2.08
Sat Jun 27 13:26:08 2015 WARNING: No server certificate verification method has been enabled.  See http://openvpn.net/howto.html#mitm for more info.
Sat Jun 27 13:26:08 2015 Control Channel Authentication: using '/etc/openvpn/servervpn/tls.key' as a OpenVPN static key file
Sat Jun 27 13:26:08 2015 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Sat Jun 27 13:26:08 2015 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Sat Jun 27 13:26:08 2015 Socket Buffers: R=[212992->131072] S=[212992->131072]
Sat Jun 27 13:26:08 2015 NOTE: UID/GID downgrade will be delayed because of --client, --pull, or --up-delay
Sat Jun 27 13:26:08 2015 UDPv4 link local: [undef]
Sat Jun 27 13:26:08 2015 UDPv4 link remote: [AF_INET]x.x.x.x:1194
Sat Jun 27 13:26:08 2015 TLS: Initial packet from [AF_INET]x.x.x.x:1194, sid=531d85a9 2201aab6
Sat Jun 27 13:26:08 2015 VERIFY OK: depth=1, xxxxxxxx
Sat Jun 27 13:26:08 2015 VERIFY OK: depth=0, xxxxxxxx
Sat Jun 27 13:26:13 2015 Data Channel Encrypt: Cipher 'AES-256-CBC' initialized with 256 bit key
Sat Jun 27 13:26:13 2015 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Sat Jun 27 13:26:13 2015 Data Channel Decrypt: Cipher 'AES-256-CBC' initialized with 256 bit key
Sat Jun 27 13:26:13 2015 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Sat Jun 27 13:26:13 2015 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 2048 bit RSA
Sat Jun 27 13:26:13 2015 [hm-py-router-01] Peer Connection Initiated with [AF_INET]188.78.154.7:11193
Sat Jun 27 13:26:15 2015 SENT CONTROL [hm-py-router-01]: 'PUSH_REQUEST' (status=1)
Sat Jun 27 13:26:15 2015 PUSH: Received control message: 'PUSH_REPLY,route 192.168.10.0 255.255.255.0,topology net30,ping 5,ping-restart 60,ifconfig 192.168.11.6 192.168.11.5'
Sat Jun 27 13:26:15 2015 OPTIONS IMPORT: timers and/or timeouts modified
Sat Jun 27 13:26:15 2015 OPTIONS IMPORT: --ifconfig/up options modified
Sat Jun 27 13:26:15 2015 OPTIONS IMPORT: route options modified
Sat Jun 27 13:26:15 2015 ROUTE_GATEWAY 176.126.240.1/255.255.248.0 IFACE=eth0 HWADDR=00:16:3c:89:81:e0
Sat Jun 27 13:26:15 2015 TUN/TAP device tun0 opened
Sat Jun 27 13:26:15 2015 TUN/TAP TX queue length set to 100
Sat Jun 27 13:26:15 2015 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Sat Jun 27 13:26:15 2015 /sbin/ip link set dev tun0 up mtu 1500
Sat Jun 27 13:26:15 2015 /sbin/ip addr add dev tun0 local 192.168.11.6 peer 192.168.11.5
Sat Jun 27 13:26:15 2015 /sbin/ip route add 192.168.10.0/24 via 192.168.11.5
Sat Jun 27 13:26:15 2015 GID set to nogroup
Sat Jun 27 13:26:15 2015 UID set to nobody
Sat Jun 27 13:26:15 2015 Initialization Sequence Completed
^CSat Jun 27 13:28:17 2015 event_wait : Interrupted system call (code=4)
Sat Jun 27 13:28:17 2015 /sbin/ip route del 192.168.11.1/32
RTNETLINK answers: Operation not permitted
Sat Jun 27 13:28:17 2015 ERROR: Linux route delete command failed: external program exited with error status: 2
Sat Jun 27 13:28:17 2015 /sbin/ip route del 192.168.51.0/24
RTNETLINK answers: Operation not permitted
Sat Jun 27 13:28:17 2015 ERROR: Linux route delete command failed: external program exited with error status: 2
Sat Jun 27 13:28:17 2015 Closing TUN/TAP interface
Sat Jun 27 13:28:17 2015 /sbin/ip addr del dev tun0 local 192.168.11.6 peer 192.168.11.5
RTNETLINK answers: Operation not permitted
Sat Jun 27 13:28:17 2015 Linux ip addr del failed: external program exited with error status: 2
Sat Jun 27 13:28:17 2015 SIGINT[hard,] received, process exiting

Unfortunately, starting openvpn as a service doesn't seem to bring the tunnel up, or do much of anything I can see...
~# systemctl start openvpn.service
~# systemctl status openvpn.service
● openvpn.service - OpenVPN service
   Loaded: loaded (/lib/systemd/system/openvpn.service; enabled)
   Active: active (exited) since Sat 2015-06-27 13:29:12 EDT; 4min 3s ago
  Process: 13873 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 13873 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/openvpn.service

The tunnel just never seems to come up... So I try the 'old' way too:
~# /etc/init.d/openvpn start
[ ok ] Starting openvpn (via systemctl): openvpn.service.
~# /etc/init.d/openvpn status
● openvpn.service - OpenVPN service
   Loaded: loaded (/lib/systemd/system/openvpn.service; enabled)
   Active: active (exited) since Sat 2015-06-27 13:09:12 EDT; 8min ago
  Process: 13873 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 13873 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/openvpn.service

But it seems the SysV init script just call to systemctrl anyways.
I've look through the Debian wiki page for OpenVPN and when running as a service it should parse any *.conf file in /etc/openvpn and bring up the interfaces unless explicitly listed in /etc/default/openvpn.
Not sure of my next step.

A: As I have said before:

I'm guessing I'm missing something new with how systemd controls the service.

Yes, and it is explained in the commentary at the top of /lib/systemd/system/openvpn.service.  You, as the other questioner did, are calling a System 5 rc script directly.  Do not call System 5 rc scripts directly, especially on a system where System 5 rc isn't used, such as Debian version 8.
OpenVPN is a templatized service under systemd — be that with Fedora, Ubuntu, or Debian Linux.  The services are named openvpn@config.service.  So you should be starting your /etc/openvpn/servervpn.conf instance with systemctl start openvpn@servervpn.service
Further reading

*

*https://unix.stackexchange.com/a/206490/5132

*http://fedoraproject.org/wiki/Openvpn

A: You should install uml-utilities package.


text:
Q: CSS for two boxes with dynamic size on the same line I have two boxes (or you may call them columns) on the same line.
Both have dynamic widths, and they must be on the same line (or row).
Let me elaborate:
.----------container 570px-----------.
|[box1]                        [box2]|  The perfect situation
|                                    |
|[box1box1box1box1box1box1box1][box2]|  A nice situation
|                                    |
|[box1box1box1box1box1box1box1]      |  But when [box1] and [box2] are too big,
|              [box2box2box2box2box2]|  [box2] breaks to a new line
|                                    |
|[box1box1b...][box2box2box2box2box2]|  I need [box1] to get ellipsed
|____________________________________|

Is there a way to achieve this only with CSS? Because with Javascript, I can just take the size of box2 and set a new width of box1.

You you have a CSS rule that works for IE9, that's totally cool.

A: There are tools like sass that allow you to set variables inside the stylesheet, but that would be just as easy as using javascript. I'm afraid there is no way to make this calculation in css.
My only suggestion would be to set a max-width on both divs to ensure that the other div has its own space.

A: To replace elements in single row declare them as table-cell:
Markup:

First

Second

Style:
.horizontal > * {
  display:table-cell;
}

Here is an example:
http://jsfiddle.net/QYq2R/

A: Unfortunately dynamic styling based on the size of content is outside the scope of CSS; you would need some cunning jQuery to do this I think. Here is the approach I would take:
function SetWidths() {
    var TotalWidth = $('#Box1').OuterWidth() + $('#Box2').OuterWidth();
    var ContainerWidth = $('#Container').InnerWidth();

    if (TotalWidth > ContainerWidth)
        //truncate the width of Box1 if that is the one that should reduce
        $('#Box1').OuterWidth = ContainerWidth - $('#Box2').OuterWidth();
}

To add the ellipsis, I would reduce the width of Box1 by a futher amount (~5px?) and programatically add in the ....
Edit: on the re-read of your question I realise that this is exactly what you have already done; but I will leave the code here for future searchers.


text:
Q: permutations of two lists in python without combining or merging the lists using itertools in python possible? In the case of two sublists
`[[A,B],[1,2]]`

I would like to have the output
[[A,B],[1,2]
    [A,B],[2,1]
    [B,A],[1,2]
    [B,A],[2,1]]
In the case of three sublists
`[[A,B],[1,2], [c, d]]`

I would like to have the output
`[[A,B],[1,2], [c, d],
 [A,B],[1,2], [d, c],
 [A,B],[2,1], [c, d],
 [A,B],[2,1], [d, c],
 [B,A],[1,2], [c, d],
 [B,A],[1,2], [d, c],
 [B,A],[2,1], [c, d]
 [B,A],[2,1], [d, c]]`

A: Using itertools is the right way of doing this (it's part of the standard library so why not?). For example:
from itertools import permutations, product

values = [['A', 'B'], [1, 2]]
sub_permutations = ([list(p) for p in permutations(l)] for l in values)
values_perms = [list(v) for v in product(*sub_permutations)]

However, it is of course possible to implement a permutation function and a product function:
def permutations(values):
    if not values:
        return
    for i in range(len(values)):
        for p in all_perms(values[1:]):
            yield [*p[:i], values[0], *p[i:]]

def product(lists):
    result = [[]]
    for pool in lists:
        result = [r + [p] for r in result for p in pool]
    return result

Which we can then use to achieve the same goal:
values = [['A', 'B'], [1, 2]]
values_perms = product(list(permutations(l)) for l in values)

But this will be slower, prone to bugs and it means more code to maintain. The only interesting thing here I think is to implement it yourself and see what you end up with, then simply use itertools.


text:
Q: Extending Asp.Net MVC routing mechanism I've found a limitation in the routing mechanism for ASP.Net mvc and I'm trying to find a workaround.
I posted a related question here about the issue I was having.
The gist of the problem is that routes that end with a . (period) are never handled by the default routing mechanism. A "Resource Cannot Be Found" error is always thrown. For example it cannot handle these urls:
http://www.wikipediamaze.com/wiki/Washington,_D.C.
http://www.wikipediamaze.com/wiki/anythingendinglikethis.

if I change it to querystring parameter like this it works fine:
http://www.wikipediamaze.com/wiki/?topic=Washington,_D.C.

I'm trying to find an extensibility point in the routing mechanism that will help me resolve this issue. I've tried other solutions like this:
//Global.asax.cs
protected void Application_Error()
{
     var url = HttpContext.Current.Request.RawUrl;
     if(TopicRegex.IsMatch(url))
     {
         var fixedUrl = FixUrlPath(url);

         //This throws an error
         Response.Redirect(fixedUrl);

         //This also throws an error
         Server.Transfer(fixedUrl );
      }
}

I'm guessing that the Response.Redirect and Server.Transfer throw errors because in MVC you should be calling the RedirectToAction methods from the controller. Of course I can't even get to the controller.
This seems to be a pretty big limitation considering the Apache server that Wikipedia uses handles this just fine. try it out http://en.wikipedia.org/wiki/Washington,_D.C. If anyone could please offer some help here I would appreciate it.

A: Could you turn of checking file exists in the routes but allow certain extensions through?
routes.RouteExistingFiles = true;

// Ignore the assets directory which contains images, js, css & html
routes.IgnoreRoute("Assets/{*pathInfo}");

// Ignore text, html, files.
routes.IgnoreRoute("{file}.txt");
routes.IgnoreRoute("{file}.htm");
routes.IgnoreRoute("{file}.html");
routes.IgnoreRoute("{file}.aspx");


text:
Q: Trojaned version of file "egrep" detected by OSSEC HIDS I have installed the latest stable version of OSSEC (2.8.1), and I have also enabled email notifications and today I got this alert through email:
OSSEC HIDS Notification.
2015 Apr 03 17:40:26

Received From: Bath-Towel->rootcheck
Rule: 510 fired (level 7) -> "Host-based anomaly detection event (rootcheck)."
Portion of the log(s):

Trojaned version of file '/bin/egrep' detected. Signature used: 'bash|^/bin/sh|file\.h|proc\.h|/dev/|^/bin/.*sh' (Generic).

 --END OF NOTIFICATION

Is this something to worry about, and if so then what should I do about it?
Information Update:
This is the contents of the file /bin/egrep:
#!/bin/bash
grep=grep
case $0 in
  */*)
    dir=${0%/*}
    if test -x "$dir/grep"; then
      PATH=$dir:$PATH
      grep=grep
    fi;;
esac
exec $grep -E "$@"

OS Information:
Description:    Ubuntu 14.10
Release:    14.10

A: I have OSSEC installed on some 14.04 servers, but I never got such notification.
It turns out that until Ubuntu 14.04 /bin/egrep is an ELF executable, but in 14.10 and later it is a shell script. Probably OSSEC was not updated yet to reflect this change.


text:
Q: Maintaining ratio of a DIV using JavaScript I'm trying to create a 16:9 canvas which remains 16:9 regardless of screen size. It works! But only in one direction...
function ratio () {
    var w = window.innerWidth;
    var newH = w * 0.5625;

    document.getElementById('design').style.height = (newH + 'px');
}

window.onload = ratio;
window.onresize = ratio;

So it works when the window's height is too large, but not when the width is too large. My tiny brain can't fathom how to make it work the other way round - when the window is too wide.
I'm aware there's a CSS workaround with padding, but that doesn't work in my case - and I'd prefer to use JS anyway.
FYI.. here's the page: https://clever-carbon.webflow.io/

A: If I understood you correctly, this might help:
function ratio () {
    var w = window.innerWidth
    var h = window.innerHeight
    var actualRatioW = w/h
    var actualRatioH = h/w
    var desiredRatioW = 16/9
    var desiredRatioH = 9/16
    var maxW = Math.min(window.innerWidth, (desiredRatioW/actualRatioW)*window.innerWidth)
    var maxH = Math.min(window.innerHeight, (desiredRatioH/actualRatioH)*window.innerHeight)

    document.getElementById('design').style.height = (maxH + 'px');
    document.getElementById('design').style.width = (maxW + 'px');
}

window.onload = ratio;
window.onresize = ratio;

We're getting the ratio between the desired ratio and the actual ratio, applying it to the height/width, and getting the minimum value between that and the actual height/width. This helps enforce the ratio when either of the sides is too long/narrow.
You might also want to keep the height of the wrapper at 100vh


text:
Q: Trouble dumping into HTML string into Rails view I'm playing around with a Rails application that intends to display an HTML rendering of some XML data that I have.
I used Nokogiri to transform an XML document to a string of HTML markup in my controller, and then, in the view, I am try to display it. But when I load the page, all of the HTML markup
, etc., are being treated as part of the string rather than as HTML markup.
The transformation logic looks like this:
def xslt_apply_to(xml_open_uri_file, xsltfile, xslt_param_array)
    xml  = xml_open_uri_file
    xslt = Nokogiri::XSLT(open(xsltfile))
    result_doc = xslt.apply_to(xml, xslt_param_array)
    return result_doc
end

Where xml_open_uri_file is the XML file I'm transforming and xsltfile is the file I'm using to transform it.
This method returns a String containing
"

Test test test test test

"

captured below in @transform:
@transform = xslt_apply_to(xmldoc,xsltdoc,xslt_param_array)

Then I am trying to include this in my view as follows:

    <%= @transform %>

But the result appearing in the browser is:

Test test test test test

When what I really want is the text wrapped in a
 and
 that the browser recognizes. So all I should see in the browser is:
Test test test test test

Any ideas what is going on?

A: Try this:
<%= raw(@transform) %>

raw() is a wrapper around html_safe() that forces the input to String and then calls html_safe() on it.
You can refer to "SafeBuffers and Rails 3.0" for more information.

A: Another option. Have you tried html_safe? It's one less processing step than raw, which is like a call to_s then html_safe appended. A shortcut, but use only if you know your string is non-nil.
<%= @transform.html_safe %>


text:
Q: UIScrollView with pagination + showing part of the previous/following pages I'm trying to create a kind of a "game mode" menu similar to the one used by the "Cut the Rope" game to select the level pack:

What I want in particular is to achieve the same effect of showing the "current item" (in this case, the "2. Fabric Box" item) plus a bit of the previous and following items (to make sure the user is aware that there are more modes available by scrolling), with pagination enabled (to make the scroll view automatically "center" on these items).
This seems like a natural job for a UIScrollView with pagination enabled, however from the documentation it seems the pagination occurs on multiples of the view bounds.
So: if pagination occurs on multiples of the view bounds, is there any way to achieve this effect with a UIScrollView?
The fact that we see the full width of the screen would suggest that the UIScrollView frame's width would be 320px in this case, but each individual item would need to be smaller than that in order to show that little bit of the previous and next items, thus messing up the pagination...

A: For your reference, you can see a sample implementation of a page control from here.
https://developer.apple.com/library/content/samplecode/PageControl/Introduction/Intro.html
For the implementation you want,
to your surprise, the scrollview's width is actually smaller than 320 (or 480). The magic property to set is:
scrollView.clipsToBounds = NO

The only problem with this implementation is that the scrollview get no touch events if the touch is outside the bounds of the scrollView. This can be fix by passing its parent hitTest event to scrollView.
Just to link to to a better explanation:
UIScrollView horizontal paging like Mobile Safari tabs
Slightly different from what I recommend but does the same thing.
Edit:
I have a small project called LXPagingViews that does the above, hopefully in an out of the box manner (Do drop me a pull request or feedback in issue): https://github.com/lxcid/LXPagingViews


text:
Q: Springboot Application working in Tomcat 8.5 but not working when deployed in Tomcat 9.0.3 MainClass
package com.example.app;

@SpringBootApplication
public class MainApplication extends SpringBootServletInitializer{

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(MainApplication.class);
    }

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        SpringApplication.run(MainApplication.class, args);

    }
}

In pom.xml added following dependencies...
<packaging>war</packaging>
  <properties>
        <java.version>1.8</java.version>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.4.RELEASE</version>
    </parent>
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

same code when deployed on Tomcat 8.5 works fine. But when deployed on Tomcat 9/10 application does not start.
what else to be added to deploy same in tomcat 9/10.
Thanks in Advance..


text:
Q: Stop regex from removing decimal points In my equation, I'm trying to remove the first word that appears after a specific word that I have mentioned in the regex code. For example:
In the sentence:

Hello my name is Roger

I'm extracting the word "Roger" with this regex:
Regex reg3 = new Regex("is\\s\\w+");
MatchCollection match3 = reg3.Matches(result);
foreach (Match match in match3)
{
    var val = match.Value;
    val = val.Replace("is", "");
    val = val.Trim();
}

But in a case such as this:

My answer is 3.05

and when I apply the same regex, I end up with this:

3

That is because the regex removes all characters after the "is", how do I change the regex so that it  in a case such as what I mentioned above, it keeps the decimal number as it is and prints 3.05?

A: It stops after printing the first number because the following . is not a word character. To match also the literal dot, you need to put \w and . inside a character class.
Regex reg3 = new Regex("is\\s[.\\w]+");

OR
Regex reg3 = new Regex(@"is\s[.\w]+");


text:
Q: read and return text file with def function i want to input the file name in this case books.txt and get the lines but i cant get it work, i have the files in the same directory but when i run this nothing happens, any way to fix this? or to call that function in another .py file
books.txt

7,1,2,3,4,3
2,6,1,3,1

file_name = input("type the file name: ")
def read_txt(file_name)
    file = open(file_name, "r")
    lines = file.readlines()
    file.close()
    return lines

read_txt(file_name)

but this return nothing and i dont know what to do :(

A: You need to add this line to the end, so it actually prints out the values:
print(read_txt(file_name))

So the full code would be (I also changed some code as the OP said what to change):
file_name = input("type the file name: ")
def read_txt(file_name):
    file = open(file_name, "r")
    lines = [x for i in file.readlines() for x in list(map(int, i.strip().split(',')))]
    file.close()
    return lines
print(read_txt(file_name))

Output:
[7, 1, 2, 3, 4, 3 2, 6, 1, 3, 1]


text:
Q: Identify Time Spent in Rendering in Swing Application We have Swing Application and its slow. It fetches data using web services. This data fetching is done by SwingWorker in a separate thread. When data arrives its rendered.
I would like to identify whether fetching data or its rendering is the culprit. Tried profiling with YJP but could not make much headway. Though it identifies time spent in "paint()" method but I think that's not sufficient.
Any pointers to demarcate the boundaries and find time spent in rendering will be appreciated.
How to do performance testing of a swing application ?


text:
Q: Merge Array object elements using comparison We have a requirement where we need to feed data into an empty json array element from another array object using element comparison.
The sample payloads and required results are mentioned below for better understanding.
Payload1: (Input Payload)
{
    "data": [
            {
            "name":"ram",
            "eno":"100",
            "dept":"Sales",
            "sal":null
            },
            {
            "name":"gopal",
            "eno":"101",
            "dept":"Sales",
            "sal":null
            },
            {
            "name":"hari",
            "eno":"102",
            "dept":"Sales",
            "sal":null
            },
            {
            "name":"pankaj",
            "eno":"103",
            "dept":"Sales",
            "sal":null
            },
            {
            "name":"raju",
            "eno":"104",
            "dept":"Sales",
            "sal":null
            }
            ]
}

Payload2: (Response From a third party webservice)
{
    "data": [
        {
            "eno": "100",
            "sal": 2000
        },
        {
            "eno": "101",
            "sal": 2300
        },
        {
            "eno": "102",
            "sal": 1800
        },
        {
            "eno": "104",
            "sal": 2500
        }
    ]
}

Required Result:
{
    "data": [
            {
            "name":"ram",
            "eno":"100",
            "dept":"Sales",
            "sal":2000
            },
            {
            "name":"gopal",
            "eno":"101",
            "dept":"Sales",
            "sal":2300
            },
            {
            "name":"hari",
            "eno":"102",
            "dept":"Sales",
            "sal":1800
            },
            {
            "name":"raju",
            "eno":"104",
            "dept":"Sales",
            "sal":2500
            }
            ]
}

.................................................................

A: Here is how you can do this by only using synapse. I hardcoded the second response.
<?xml version="1.0" encoding="UTF-8"?>
<api context="/HelloWorld" name="HelloWorld" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="POST">
        <inSequence>
            <enrich>
                <source clone="true" type="body"/>
                <target property="inputBody" type="property"/>
            </enrich>
            <payloadFactory media-type="json">
                <format>
                    {
                      "data": [
                          {
                              "eno": "100",
                              "sal": 2000
                          },
                          {
                              "eno": "101",
                              "sal": 2300
                          },
                          {
                              "eno": "102",
                              "sal": 1800
                          },
                          {
                              "eno": "104",
                              "sal": 2500
                          }
                      ]
                  }
                </format>
                <args/>
            </payloadFactory>
            <foreach expression="json-eval($.data)" id="foreach_1">
                <sequence>
                    <property expression="json-eval($.eno)" name="eno" scope="default" type="STRING"/>
                    <property expression="json-eval($.sal)" name="sal" scope="default" type="STRING"/>
                    <enrich>
                        <source clone="true" property="inputBody" type="property"/>
                        <target type="body"/>
                    </enrich>
                    <enrich>
                        <source clone="true" property="sal" type="property"/>
                        <target xpath="//data[eno=$ctx:eno]/sal"/>
                    </enrich>
                    <enrich>
                        <source clone="true" type="body"/>
                        <target property="inputBody" type="property"/>
                    </enrich>
                </sequence>
            </foreach>
            <enrich>
                <source clone="true" property="inputBody" type="property"/>
                <target type="body"/>
            </enrich>
            <property name="messageType" scope="axis2" type="STRING" value="application/json"/>
            <respond/>
        </inSequence>
        <outSequence/>
        <faultSequence/>
    </resource>
</api>


text:
Q: Python, why print nothing with print function, is there any wrong? Is there any problems? when I use print function, sometimes it works, however, sometimes not. I am confused. the following is my code, and is typing in jupyter notebook(ipython), every variables have defined before, there is no matter with variables. there is also no error output. but no result neither.
from __future__ import print_function

print("Top terms per cluster:")
print()
#sort cluster centers by proximity to centroid
order_centroids = km.cluster_centers_.argsort()[:, ::-1]

for i in range(num_clusters):
    print("Cluster %d words:" % i, end='')

    for ind in order_centroids[i, :6]: #replace 6 with n words per cluster
        print(' %s' % vocab_frame.ix[terms[ind].split(' ')].values.tolist()[0][0].encode('utf-8', 'ignore'), end=',')

    print() #add whitespace
    print() #add whitespace

    print("Cluster %d labels:" % i, end='')
    for title in frame.ix[i]['label'].values.tolist():
        print(' %s,' % title, end='')
    print() #add whitespace
    print() #add whitespace


text:
Q: Strange exception is thrown when the Spring data method is called I have a Spring Data method in my
@Repository
public interface ChildRepository extends JpaRepository<Child, Long>, JpaSpecificationExecutor<Child> { ...
...
Optional<Child> findByUser(User user);

@Query("select child from Child child left join fetch child.kindergartenclasses where child.user =:user")
Optional<Child> findByUserWithEagerRelationships(User user);

Everything is good at compile time, while in the runtume I got the exception like those:
2019-09-12 11:52:29.981  WARN 8 --- [ XNIO-1 task-15] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.dao.InvalidDataAccessApiUsageException: For queries with named parameters you need to use provide names for method parameters. Use @Param for query method parameters, or when on Java 8+ use the javac flag -parameters.; nested exception is java.lang.IllegalStateException: For queries with named parameters you need to use provide names for method parameters. Use @Param for query method parameters, or when on Java 8+ use the javac flag -parameters.]

and before the conslode output has the full stack:
mental-app_1            | org.springframework.dao.InvalidDataAccessApiUsageException: For queries with named parameters you need to use provide names for method parameters. Use @Param for query method parameters, or when on Java 8+ use the javac flag -parameters.; nested exception is java.lang.IllegalStateException: For queries with named parameters you need to use provide names for method parameters. Use @Param for query method parameters, or when on Java 8+ use the javac flag -parameters.
mental-app_1            |   at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:370)
mental-app_1            |   at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:255)
mental-app_1            |   at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:527)
mental-app_1            |   at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
mental-app_1            |   at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)
mental-app_1            |   at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:153)
mental-app_1            |   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
mental-app_1            |   at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:138)
mental-app_1            |   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
mental-app_1            |   at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)
mental-app_1            |   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
mental-app_1            |   at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:61)
mental-app_1            |   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
mental-app_1            |   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)
mental-app_1            |   at com.sun.proxy.$Proxy191.findByUserWithEagerRelationships(Unknown Source)
mental-app_1            |   at com.github.eljah.mental.service.ChildBusinesslogicService.findChildForCurrentUser(ChildBusinesslogicService.java:61)
mental-app_1            |   at com.github.eljah.mental.service.ChildBusinesslogicService$$FastClassBySpringCGLIB$$8f4111d7.invoke(<generated>)
mental-app_1            |   at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
mental-app_1            |   at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749)
mental-app_1            |   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
mental-app_1            |   at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)
mental-app_1            |   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
mental-app_1            |   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
mental-app_1            |   at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
mental-app_1            |   at com.github.eljah.mental.service.ChildBusinesslogicService$$EnhancerBySpringCGLIB$$1dd6a7d2.findChildForCurrentUser(<generated>)
mental-app_1            |   at com.github.eljah.mental.web.rest.ChildBusinesslogicResource.getChildForCurrentUser(ChildBusinesslogicResource.java:56)
mental-app_1            |   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
mental-app_1            |   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
mental-app_1            |   at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
mental-app_1            |   at java.base/java.lang.reflect.Method.invoke(Unknown Source)
mental-app_1            |   at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
mental-app_1            |   at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
mental-app_1            |   at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
mental-app_1            |   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)
mental-app_1            |   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
mental-app_1            |   at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
mental-app_1            |   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039)
mental-app_1            |   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
mental-app_1            |   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
mental-app_1            |   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)
mental-app_1            |   at javax.servlet.http.HttpServlet.service(HttpServlet.java:645)
mental-app_1            |   at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
mental-app_1            |   at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
mental-app_1            |   at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
mental-app_1            |   at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
mental-app_1            |   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:103)
mental-app_1            |   at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
mental-app_1            |   at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
mental-app_1            |   at org.zalando.logbook.servlet.NormalStrategy.doFilter(NormalStrategy.java:41)
mental-app_1            |   at org.zalando.logbook.servlet.LogbookFilter.doFilter(LogbookFilter.java:39)
mental-app_1            |   at org.zalando.logbook.servlet.HttpFilter.doFilter(HttpFilter.java:31)
mental-app_1            |   at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
mental-app_1            |   at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
mental-app_1            |   at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:88)
mental-app_1            |   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109)
mental-app_1            |   at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
mental-app_1            |   at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
mental-app_1            |   at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
mental-app_1            |   at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
mental-app_1            |   at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
mental-app_1            |   at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
mental-app_1            |   at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
mental-app_1            |   at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
mental-app_1            |   at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
mental-app_1            |   at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)
mental-app_1            |   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
mental-app_1            |   at com.github.eljah.mental.security.jwt.JWTFilter.doFilter(JWTFilter.java:38)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
mental-app_1            |   at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96)
mental-app_1            |   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
mental-app_1            |   at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
mental-app_1            |   at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:74)
mental-app_1            |   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
mental-app_1            |   at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
mental-app_1            |   at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
mental-app_1            |   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
mental-app_1            |   at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
mental-app_1            |   at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
mental-app_1            |   at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
mental-app_1            |   at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
mental-app_1            |   at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
mental-app_1            |   at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
mental-app_1            |   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109)
mental-app_1            |   at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
mental-app_1            |   at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
mental-app_1            |   at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)
mental-app_1            |   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109)
mental-app_1            |   at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
mental-app_1            |   at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
mental-app_1            |   at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
mental-app_1            |   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109)
mental-app_1            |   at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
mental-app_1            |   at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
mental-app_1            |   at org.zalando.logbook.servlet.SecurityStrategy.doFilter(SecurityStrategy.java:33)
mental-app_1            |   at org.zalando.logbook.servlet.LogbookFilter.doFilter(LogbookFilter.java:39)
mental-app_1            |   at org.zalando.logbook.servlet.HttpFilter.doFilter(HttpFilter.java:31)
mental-app_1            |   at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
mental-app_1            |   at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
mental-app_1            |   at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:114)
mental-app_1            |   at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:104)
mental-app_1            |   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109)
mental-app_1            |   at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
mental-app_1            |   at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
mental-app_1            |   at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
mental-app_1            |   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:109)
mental-app_1            |   at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
mental-app_1            |   at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
mental-app_1            |   at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
mental-app_1            |   at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
mental-app_1            |   at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
mental-app_1            |   at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
mental-app_1            |   at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
mental-app_1            |   at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
mental-app_1            |   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
mental-app_1            |   at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
mental-app_1            |   at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
mental-app_1            |   at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
mental-app_1            |   at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
mental-app_1            |   at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
mental-app_1            |   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
mental-app_1            |   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
mental-app_1            |   at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:119)
mental-app_1            |   at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
mental-app_1            |   at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
mental-app_1            |   at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
mental-app_1            |   at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
mental-app_1            |   at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
mental-app_1            |   at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
mental-app_1            |   at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
mental-app_1            |   at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
mental-app_1            |   at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
mental-app_1            |   at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364)
mental-app_1            |   at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
mental-app_1            |   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
mental-app_1            |   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
mental-app_1            |   at java.base/java.lang.Thread.run(Unknown Source)
mental-app_1            | Caused by: java.lang.IllegalStateException: For queries with named parameters you need to use provide names for method parameters. Use @Param for query method parameters, or when on Java 8+ use the javac flag -parameters.
mental-app_1            |   at org.springframework.data.jpa.repository.query.QueryParameterSetterFactory$BasicQueryParameterSetterFactory.lambda$getName$3(QueryParameterSetterFactory.java:252)
mental-app_1            |   at java.base/java.util.Optional.orElseThrow(Unknown Source)
mental-app_1            |   at org.springframework.data.jpa.repository.query.QueryParameterSetterFactory$BasicQueryParameterSetterFactory.getName(QueryParameterSetterFactory.java:252)
mental-app_1            |   at org.springframework.data.jpa.repository.query.QueryParameterSetterFactory$BasicQueryParameterSetterFactory.lambda$findParameterForBinding$2(QueryParameterSetterFactory.java:243)
mental-app_1            |   at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
mental-app_1            |   at java.base/java.util.Spliterators$IteratorSpliterator.tryAdvance(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.ReferencePipeline.findFirst(Unknown Source)
mental-app_1            |   at org.springframework.data.jpa.repository.query.QueryParameterSetterFactory$BasicQueryParameterSetterFactory.findParameterForBinding(QueryParameterSetterFactory.java:244)
mental-app_1            |   at org.springframework.data.jpa.repository.query.QueryParameterSetterFactory$BasicQueryParameterSetterFactory.create(QueryParameterSetterFactory.java:216)
mental-app_1            |   at org.springframework.data.jpa.repository.query.ParameterBinderFactory.lambda$createQueryParameterSetter$1(ParameterBinderFactory.java:139)
mental-app_1            |   at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
mental-app_1            |   at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.ReferencePipeline.findFirst(Unknown Source)
mental-app_1            |   at org.springframework.data.jpa.repository.query.ParameterBinderFactory.createQueryParameterSetter(ParameterBinderFactory.java:141)
mental-app_1            |   at org.springframework.data.jpa.repository.query.ParameterBinderFactory.lambda$createSetters$0(ParameterBinderFactory.java:131)
mental-app_1            |   at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
mental-app_1            |   at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
mental-app_1            |   at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
mental-app_1            |   at org.springframework.data.jpa.repository.query.ParameterBinderFactory.createSetters(ParameterBinderFactory.java:132)
mental-app_1            |   at org.springframework.data.jpa.repository.query.ParameterBinderFactory.createQueryAwareBinder(ParameterBinderFactory.java:103)
mental-app_1            |   at org.springframework.data.jpa.repository.query.AbstractStringBasedJpaQuery.createBinder(AbstractStringBasedJpaQuery.java:103)
mental-app_1            |   at org.springframework.data.util.Lazy.getNullable(Lazy.java:211)
mental-app_1            |   at org.springframework.data.util.Lazy.get(Lazy.java:94)
mental-app_1            |   at org.springframework.data.jpa.repository.query.AbstractStringBasedJpaQuery.doCreateQuery(AbstractStringBasedJpaQuery.java:93)
mental-app_1            |   at org.springframework.data.jpa.repository.query.AbstractJpaQuery.createQuery(AbstractJpaQuery.java:210)
mental-app_1            |   at org.springframework.data.jpa.repository.query.JpaQueryExecution$SingleEntityExecution.doExecute(JpaQueryExecution.java:221)
mental-app_1            |   at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:91)
mental-app_1            |   at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:136)
mental-app_1            |   at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:125)
mental-app_1            |   at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:605)
mental-app_1            |   at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$invoke$3(RepositoryFactorySupport.java:595)
mental-app_1            |   at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:595)
mental-app_1            |   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
mental-app_1            |   at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:59)
mental-app_1            |   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
mental-app_1            |   at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)
mental-app_1            |   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
mental-app_1            |   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
mental-app_1            |   at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139)
mental-app_1            |   ... 144 common frames omitted

Is it because of Spring Data method contains parameter associated with the real entity fields, and the method name isn't ignored when having a @Query above it?
UPD:
changing the method name which don't have entity field mentions like ...ByUser... still doesn't help, the same error.
...
Optional<Child> findOneWithEagerRelationships(User user);

A: @Query("select child from Child child left join fetch child.kindergartenclasses where child.user =:user")
Optional<Child> findByUserWithEagerRelationships(@Param("user") User user);

that is a required code, thanks to M. Deinum's answer. All I was missing here is @Param("user")


text:
Q: nfl data API error I'm trying to parse a simple amount of data using the NFL data API. Grabbing current season.
EG: http://developer.fantasydata.com/docs/services/300/operations/1114/console
I'm using the sample JavaScript code provided directly on that page with a valid, premium, API key and I'm getting an error dialog. Any one familar?
<!DOCTYPE html>
<html>
<head>
<title>JSSample</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
    $(function() {
        var params = {
            // Specify your developer key
            key: '1234actualkeyisrighthere',
        };

        $.ajax({
            // Specify values for path parameters (shown as {...})
            url: 'http://api.nfldata.apiphany.com/premium/XML/CurrentSeason?' + $.param(params),
            type: 'GET',
            beforeSend: function (xhr) {
                debugger;
            }
        })
        .done(function(data) {
            alert("success");
        })
        .fail(function() {
            alert("error");
        });
    });
</script>
</body>
</html>

Error Details:
It's an error dialog pop-up. 'Error' Console reports: XMLHttpRequest cannot load http://api.nfldata.apiphany.com/premium/XML/CurrentSeason?key=XXXXXXXXXXX. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.sample.com' is therefore not allowed access. currentseason.html:1

A: Looks like you're out of luck. The server hasn't enabled cross origin requests (as indicated by the error message). And, at least on my brief rummage through their documentation, they don't seem to support JSONP. You could see if there's undocumented support for JSONP by trying it. You'd have to guess at the callback query string parameter name, though many sites uses callback so that's what I'd try.
OTOH, you probably wouldn't implement this call in a browser anyway, since that would expose your premium API key to any user of your web site. Most likely, the NFL server expects you to proxy the data through your own server. In that architecture, CORS wouldn't be an issue.


text:
Q: how to add sorted elements in the filter dropdown in activeadmin rails I have a Post model, PostSource model. A PostSource has many posts, a post belong to one PostSource.
Using ActiveAdmin, in the Index action of the Post, I am displaying a filter of PostSource this way:
filter :post_source, label: 'Source'
filter :category, as: :select, collection: Category.order(:name).collect { |cat| [cat.name, cat.id] }

with the controller as:
controller do
  def scoped_collection
    end_of_association_chain.includes(:post_source)
  end
end

It displays the source, but does not display in a sorted order. How to sort the filter in this case?
I tried adding sortable, order on filter but it does not seem to work

A: If you're trying to sort the first filter ('post_source'), you could just add a collection as you have in your second line, and sort within a block.
filter :post_source, label: 'Source', collection: proc { PostSource.order(:name) }

This syntax might be used as an alternative in the second example as well.


text:
Q: Does gain affect stability of a Transfer Function? I have a control system that we are working on with a forward transfer function of:-
\$ \dfrac{K(2s+3)}{s^2(s^4+2s^3+4s^2+2s+7)}\$
So I've set up the routh table for this, I've found there are 2 sign changes, therefore, two poles. But does a value of k=4 affect the control system? Or any value for that matter?
I can't think why multiplying the transfer function by a constant would affect the stability in any way

A: This system has 6 poles and one zero.
fully factored it becomes:
\$ \dfrac{K(2s+3)}{(s-(0.329881+1.27963 i)) (s-(0.329881-1.27963 i)) (s+(1.32988-1.49665 i)) (s+(1.32988+1.49665 i))}\$
Zeros:
\$s=\dfrac{-3}{2}\$
Poles:
\$2^{nd}\$ order at \$s=0\$
\$1^{st} \$ order @ \$s=  0.329881+1.27963 i\$
\$1^{st} \$ order @ \$s=  0.329881-1.27963 i\$
\$1^{st} \$ order @ \$s=  -1.32988+1.49665 i\$
\$1^{st} \$ order @ \$s=  -1.32988-1.49665 i\$
So this is non-causal, unstable in a strict sense.  However, someone who has more recent practise in this area should be able to use the info above and tell you the limits.  I would be answering "It isn't stable anyways so the K factor doesn't matter" but then I'm rusty but I did the factoring so I thought I'd put it up here for others to use.

A: The position of the poles change with K, that is why it can affect stability.
Your system is unstable because there are poles on the right-hand plane. You can see if you can make the system stable by adjusting K with a root locus plot.
The root locus of your system is like this:

As you can see the poles on the right hand side will always be on the right-hand side for all K. So, that means the system cannot be stabilized with a proportional controller.
You can also do that with Routh table as you've tried, but I do not remember how that was done. Using root locus is always easier if you have MATLAB (or other root locus plotting software) at hand.


text:
Q: ¿como unir dos consultas select en php? hola tengo un problema relativamente fácil pero ya me confundi en como estructurar la consulta quiero hacer una consulta para aplicar un sum con su respectivo where y otra para simplemente traerme datos de la BD con su respectivo where se podría hacer todo en una misma consulta pero tengo diferentes condiciones en ambas consultas por eso tiene que ser por separado
lo que intento es mostrar los datos de una tabla de la base de datos en una tabla html y mostrar un total del campo monto total
mis datos los obtengo correctamente solo me falta saber generar la consulta que me trae la suma y colocarlo en la tabla html
<?php
$factura=$_POST['factura'];
$empresa=$_POST['empresa'];

$con=mysqli_connect(
  "localhost",
  "root","",
  "controldeflotilla") or die (mysqli_error());

$query="SELECT vehiculo, fecha_carga, rendimiento_kilometro,
  rendimiento_real, ticket, factura, costo_total, empresa
  FROM carga_combustible
  WHERE factura='$factura' AND empresa='$empresa'
  ORDER BY fecha_carga DESC
";
$result=mysqli_query($con, $query) or die (mysqli_error());

$suma="SELECT SUM(costo_total) AS monto
  FROM carga_combustible
  WHERE factura ='$factura'
";
$resultado=mysqli_query($con, $suma) or die (mysqli_error());

echo "

Reporte de Consumos de Gasolina

Vehículo
Fecha de Carga
Rendimiento x km
Rendiemiento Real
Ticket
Factura
Monto Total

";

$total=0;
while ($row=mysqli_fetch_array($result))
{
  $totalmonto=$total+$row[0];
  $empresa=$row[7];
  echo "
";
  echo "
";
  echo "".$row[0]."	";
  echo "".$row[1]."	";
  echo "".$row[2]."	";
  echo "".$row[3]."	";
  echo "".$row[4]."	";
  echo "".$row[5]."	";
  echo "".$row[6]."	";
  echo "
";
  echo "
";

}
echo "
";
echo "	";
echo "
";

echo "
";
echo"$empresa	";
echo "TOTAL:	";
echo "$totalmonto	";
echo "
";
echo "
";
mysqli_query( $con, $query ) or die ("Problemas al llamar tabla".mysqli_error());
mysqli_close( $con );

A: respecto a tu pregunta "se podría hacer todo en una misma consulta" la respuesta es si, seria de esta forma
SELECT f.vehiculo, f.fecha_carga, f.rendimiento_kilometro, f.rendimiento_real,f.ticket, f.factura, f.costo_total, f.empresa
FROM (
    SELECT vehiculo, fecha_carga, rendimiento_kilometro, rendimiento_real, ticket, factura, costo_total, empresa
         FROM carga_combustible
         WHERE factura = '1'
           AND empresa = '1'

    UNION ALL
    SELECT 'TOTALES', max(fecha_carga), '', '', '', '', SUM(costo_total), empresa
         FROM carga_combustible
         WHERE factura ='1'
           AND empresa='1'
     ) AS f ORDER BY f.fecha_carga DESC

Pero con esto el total estaria dentro del loop al final.


text:
Q: How correct set PropertyPath How correct add PropertyPath ?
I need binding usercontrol DataContext to DataContext, TwoWay.
    var binding = new Binding()
                          {
                              Mode = BindingMode.TwoWay,
                              Source = ((FrameworkElement)sender),
                              Path = new PropertyPath(FrameworkElement.DataContextProperty)
                          };
    binding.Source = ((FrameworkElement) sender);
    changeImage.SetBinding(FrameworkElement.DataContextProperty, binding);

A: binding.Path = new PropertyPath("DataContext")

Also it would help if you will say what is wrong with your code.

A: PropertyPath has a string consructor, which takes the property path as follows:
  var binding = new Binding()
                {
                   Mode = BindingMode.TwoWay,
                   Source = ((FrameworkElement)sender),
                   Path = new PropertyPath("DataContext")
                };

Alternatively, Binding has a constructor which will create a PropertyPath from the gives string argument:
  var binding = new Binding("DataContext")
                {
                   Mode = BindingMode.TwoWay,
                   Source = ((FrameworkElement)sender)
                };


text:
Q: Hyphenated and non-hyphenated words that are homophones? We know of many cases where hyphens are necessary to distinguish a compound word (man-eating) from a pair of separate words (man and eating). But are there any cases where a hyphenated word has a different meaning than a like-sounding, non-hyphenated word? (Note that this excludes examples like coop and co-op, because they are not homophones.)
The only possibility I can think of would be in constructs such as pro-test (meaning "in favor of tests") versus the noun protest. Any other examples, contrived or otherwise?
EDIT: A colleague of mine came up with a better one: run-down (adj.) versus rundown (n.).