text:
Q: Cannot move object from one database to another I am trying to move an object from one database into another.  The mappings are the same but the tables are different.  This is a merging tool where data from an old database need to be imported into a new one.  Still, I think I am missing something fundamental about SQLAlchemy here.  What is it?
from sqlalchemy import Column, Float, String, Enum
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import orm
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

DeclarativeBase = declarative_base()
class Datum (DeclarativeBase):
    __tablename__ = "xUnitTestData"
    Key = Column(String, primary_key=True)
    Value = Column(Float)
    def __init__ (self, k, v):
        self.Key = k
        self.Value = v

src_engine = create_engine('sqlite:///:memory:', echo=False)
dst_engine = create_engine('sqlite:///:memory:', echo=False)
DeclarativeBase.metadata.create_all(src_engine)
DeclarativeBase.metadata.create_all(dst_engine)
SessionSRC = sessionmaker(bind=src_engine)
SessionDST = sessionmaker(bind=dst_engine)
item = Datum('eek', 666)

session1 = SessionSRC()
session1.add(item)
session1.commit()
session1.close()

session2 = SessionDST()
session2.add(item)
session2.commit()
print item in session2 # >>> True
print session2.query(Datum).all() # >>> []
session2.close()

A: I'm not really aware about what happens under the hood, but in the ORM pattern an object matches to a particular row in a particular table. If you try to add the same object to two different tables in two different databases, that doesn't sound like a good practice even if the table definition is exactly the same.
What I'd do to workaround this problem is just create a new object that is a copy of the original object and add it to the database:
session1 = SessionSRC()
session1.add(item)
session1.commit()

new_item = Datum(item.Key, item.Value)
session2 = SessionDST()
session2.add(new_item)
session2.commit()

print new_item in session2 # >>> True
print session2.query(Datum).all() # >>> [<__main__.Datum object at 0x.......>]
session2.close()
session1.close()

Note that session1 isn't closed immediately to be able to read the original object attributes while creating the new object.


text:
Q: How to reverse a String converting int to String? import java.util.Scanner;
public class Lab7 {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        System.out.println("Type the integer you'd like to be reversed:");

        int num = s.nextInt();
        String strNum = ""+num;
        reverse(s1);
        System.out.println(reverse(s1));
    }

    public static int reverse(int strNum) {

        String s1 = Integer.toString(strNum);
        for(int i=s1.length()-1;i>=0;i--){
              System.out.print(s1.charAt(i));
        }

        return 0;
    }
}

Pretty straight forward - I want to reverse my input of numbers, but I am unable to.
There are errors at 'reverse(s1);' and 'System.out.println(reverse(s1));' , as s1 is not recognized. I cannot figure out the cause.

A: Your code will not compile as is. s1 is not in main method and reverse method is accepting an int not String.
Also, if you need to return an int from your method why not the reversed int which is the answer.
Few edits to your code which will solve your issue.
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);

    System.out.println("Type the integer you'd like to be reversed:");

    int num = s.nextInt();
    System.out.println(reverse(num));
}

public static int reverse(int num) {
    String strNum = String.valueOf(num);
    StringBuffer sb = new StringBuffer();

    for(int i=strNum.length()-1;i>=0;i--)
        sb.append(strNum.charAt(i));

    return Integer.parseInt(sb.toString());
   }

A: You don't have any variable s1
you assigned value of string number to 'strNum', So use it instead
Also you have to use string as argument type in definition of reverse()
import java.util.Scanner;
public class Lab7 {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        System.out.println("Type the integer you'd like to be reversed:");

        int num = s.nextInt();
        String strNum = ""+num;
        reverse(s1);
        System.out.println(reverse(s1));
    }

    public static int reverse(String strNum) {

        for(int i=strNum.length()-1;i>=0;i--){
              System.out.print(strNum.charAt(i));
        }

        return 0;
    }
}

A: import java.util.Scanner;
public class Lab7 {
public static void main(String[] args) {
    Scanner s = new Scanner(System.in);

    System.out.println("Type the integer you'd like to be reversed:");

    int num = s.nextInt();
    String strNum = ""+num;
    reverse(strNum);
}

public static int reverse(String strNum) {

    String s1 =strNum;
    for(int i=s1.length()-1;i>=0;i--){
          System.out.print(s1.charAt(i));
    }

    return 0;
}

}

A: StringBuilder sb =  new StringBuilder("your string");
String result = sb.reverse().toString();

A: // ===============try the below code===============================
public static void main(String sr[])
{
     Scanner s = new Scanner(System.in);

     System.out.println("Type the integer you'd like to be reversed:");

     int num = s.nextInt();
     String strNum = ""+num;
     String inputString = String.valueOf(num);
     StringBuilder builder = new StringBuilder(inputString);
     System.out.println(builder.reverse());
}

A: You can easily use stack , below is a simple implementation of reversing a string    by using stack. You can easily change the code for Integer, The complexity is O(n) which is good i think.
public static void main(String[] args) {
    Stack<String> stack = new Stack<>();
    String retVal = "";
    Scanner s = new Scanner(System.in);
    try {

        String nextStr = String.valueOf(s.nextInt());

        for (int i = 0; i < nextStr.length(); i++) {
            stack.push(String.valueOf(nextStr.charAt(i)));
        }

        for (int i = 0; i < nextStr.length(); i++) {
            retVal+=stack.pop();
        }

        System.out.println(retVal);
    } finally {
        s.close();
    }

}

A: import java.util.Scanner;
public class Lab7 {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        System.out.println("Type the integer you'd like to be reversed:");
        int num = s.nextInt();
        System.out.println(new StringBuilder(String.valueOf(num)).reverse().toString());
    }
}

we can use stringBuffer or StringBuilder for reversing

redpajama_set_name: RedPajamaStackExchange


text:
Q: How we can send latitude and longitude to MySQL using Android? Currently I am working with a project to get current latitude and longitude, I got that. Now I want the latitude and longitude send to MySQL database using Android. HTTP part of this program is not working.
LocationManager locationManager;
String mprovider;
String lat="", lon="";
private String Tag="MainActivity";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button b1=(Button)findViewById(R.id.button);
    b1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            postData(lat, lon);

        }
    });

    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    Criteria criteria = new Criteria();

    mprovider = locationManager.getBestProvider(criteria, false);
    if (mprovider != null && !mprovider.equals("")) {
        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
            return;
        }
        Location location = locationManager.getLastKnownLocation(mprovider);
        locationManager.requestLocationUpdates(mprovider, 0, 0, this);

        if (location != null) {
            onLocationChanged(location);
        } else
            Toast.makeText(getBaseContext(), "No Location Provider Found Check Your Code", Toast.LENGTH_SHORT).show();
    }

}

private void postData(String la, String lo) {

    HttpClient httpclient = new DefaultHttpClient();

    HttpPost htget = new HttpPost("http://192.168.1.2/yy.php/"+la+"/"+lo);

    try {
        // Execute HTTP Post Request

        HttpResponse response = httpclient.execute(htget);

        String resp = response.getStatusLine().toString();
        Toast.makeText(this, resp, Toast.LENGTH_SHORT).show();

    } catch (ClientProtocolException e) {
        Toast.makeText(this, "Error", Toast.LENGTH_SHORT).show();
    } catch (IOException e) {
        Toast.makeText(this, "Error", Toast.LENGTH_SHORT).show();
    }
}

@Override
public void onLocationChanged(Location location) {
    lat = Double.toString(location.getLatitude());

    lon = Double.toString(location.getLongitude());

    TextView tv = (TextView) findViewById(R.id.textView2);

    tv.setText("Your Location is:" + lat + "--" + lon);
}

@Override
public void onStatusChanged(String provider, int status, Bundle extras) {

}

@Override
public void onProviderEnabled(String provider) {

}

@Override
public void onProviderDisabled(String provider) {

}

A: you can send data form android to server over http. here is more details

A: Use mysql's spatial extensions.
For making tables and using it with Google Maps api refer this:
Using MySQL and PHP with Google Maps
Before you start, I have few questions:

*

*Which version of gmaps API are you working with?

*How are you parsing the map marker (lat. long.) data?

*How are you triggering the save (lat long/ map marker data event).

Workable method:  create a JSON parser for parsing the Marker data (which is the JSON Object here).
  public class MarkerJSONParser {

/** gets a JSONObject and returns a list */
public List<HashMap<String,String>> parse(JSONObject jObject){

    JSONArray jMarkers = null;
   try {
        /** gets all the elements in the 'markers' array */
        jMarkers = jObject.getJSONArray("markers");
    } catch (JSONException e) {
        e.printStackTrace();
    }
    /** enjoining getMarkers with the array of json object
    * here each JSON object is a marker
    */
    return getMarkers(jMarkers);
}

private List<HashMap<String, String>> getMarkers(JSONArray jMarkers){
    int markersCount = jMarkers.length();
    List<HashMap<String, String>> markersList = new ArrayList<HashMap<String,String>>();
    HashMap<String, String> marker = null;

    /** Parsing and adding each marker to the list object */
    for(int i=0; i<markersCount;i++){
        try {
            /** Call getMarker with marker JSON object to parse the marker */
            marker = getMarker((JSONObject)jMarkers.get(i));
            markersList.add(marker);
        }catch (JSONException e){
            e.printStackTrace();
        }
    }
    return markersList;
}

/** Parsing the Marker JSON object */
private HashMap<String, String> getMarker(JSONObject jMarker){

    HashMap<String, String> marker = new HashMap<String, String>();
    String lat = "-NA-";
    String lng ="-NA-";

    try {
        // Latitude extraction
        if(!jMarker.isNull("lat")){
            lat = jMarker.getString("lat");
        }

        // Longitude extraction
        if(!jMarker.isNull("lng")){
            lng = jMarker.getString("lng");
        }

        marker.put("lat", lat);
        marker.put("lng", lng);

    } catch (JSONException e) {
        e.printStackTrace();
    }
    return marker;
}
}

Paste this in your MySQL's MainActivity.java:
 // enjoining OnClick Event listener for the GoogleMap
        mGoogleMap.setOnMapClickListener(new OnMapClickListener() {
            @Override
            public void onMapClick(LatLng latlng) {
                addMarker(latlng);
                sendToServer(latlng);
            }
        });

        // enjoining location retrieval
        new RetrieveTask().execute();
    }

    // Marking lat. long. on the GoogleMaps
    private void addMarker(LatLng latlng) {
        MarkerOptions markerOptions = new MarkerOptions();
        markerOptions.position(latlng);
        markerOptions.title(latlng.latitude + "," + latlng.longitude);
        mGoogleMap.addMarker(markerOptions);
    }

    // Enjoining bg thread to save marker inMySQL server
    private void sendToServer(LatLng latlng) {
        new SaveTask().execute(latlng);
    }
    // bg thread to save the marker in MySQL server
    private class SaveTask extends AsyncTask<LatLng, Void, Void> {
        @Override
        protected Void doInBackground(LatLng... params) {
            String lat = Double.toString(params[0].latitude);
            String lng = Double.toString(params[0].longitude);
            String strUrl = "http://www.yourserverurllocation.com";
            URL url = null;
            try {
                url = new URL(strUrl);

                HttpURLConnection connection = (HttpURLConnection) url
                    .openConnection();
                connection.setRequestMethod("POST");
                connection.setDoOutput(true);
                OutputStreamWriter outputStreamWriter = new OutputStreamWriter(
                connection.getOutputStream());

                outputStreamWriter.write("lat=" + lat + "&lng="+lng);
                outputStreamWriter.flush();
                outputStreamWriter.close();

                InputStream iStream = connection.getInputStream();
                BufferedReader reader = new BufferedReader(new
                InputStreamReader(iStream));

                StringBuffer sb = new StringBuffer();

                String line = "";

                while( (line = reader.readLine()) != null){
                    sb.append(line);
                }

                reader.close();
                iStream.close();

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

            return null;
        }
    }


text:
Q: HTML select not working after AJAX call This is straight HTML/javascript. The page works fine when executed on its own, but through an AJAX call it does not work on IE11.
After clicking the 'show' button on the main page, it opens a list with options, read from an XML file; it accepts a double click to select an item and shows the selected number in an alert box.
(it also writes this value to a java properties file). On Chrome and FF it works as expected, but not in IE11.
On IE it refuses to select any item.
AJAX's return-page opens a div with absolute positioning, and dragging possibilities. After I drag the box with the list to another place, it suddenly does work in IE as well (but only after dragging more than just a few pixels).
I can only assume it's a type of bug in IE11, but is there a work around? Why would dragging the box make it work?
Here's the significant code:
in main.jsp:
<span id='showcurevent' onclick='showevent(<%=EVENTID%>, 0)'>Show


text:
Q: Why to use Dependency Injection components in PHP frameworks When I first saw dependency injection components like PHP-DI, Symfony2 DI, etc., I though, there is a way to automatically inject instance of any class to any just with one instantiation.
So
1. Create instance in root class like $foo = new Foo()
2. And then I can use this instance in any object (like global singleton) without passing reference to constructor or method of the class I want to call from.
But I found out, that basicly I can use Dependency Injection in 2 ways
1. Passing the reference of the instance to constructor
2. Creating container where all objects are located. This container could be injected to other classes, but "This is not recommended".
As both ways can be easily done in pure PHP, the first is clear, the second could be solved with static properties, so why to use PHP-DI or Symfony2 for this work?

A: Why should you use Dependency Injection over the Singleton pattern?
Let's assume we have a Singleton object named DatabaseConnection which wraps a connection to a MySQL database for us and does some other neat things, who knows. Because reusing code is a good thing, we use this object in a lot of projects.
What if at some point we decide to switch one of our projects from MySQL to another database product? We would have to modify every place where we call the DatabaseConnection object and replace it with our new implementation. Or, we could modify the class itself -- but we still want to use the original one with other projects, so we end up with two implementations with the same name which is just asking for trouble, really.
And what about unit tests? We do those, of course, because we are good developers! But if we unit test a function that uses the database, we don't want the test to actually rely on the database or even change things there. There's no way to replace the DatabaseConnection with a mock object (that just returns static data) because our project is tightly coupled to it.
That's what Dependency Injection does: It helps to prevent tight coupling. If we inject the connection with $someObject->setDatabaseConnection($databaseConnection), we can inject any object there that behaves like the original one. We can inject mock objects, alternative implementations or extensions that inherit the original class.
Now a Dependency Injection Container is just a nice helper to manage object instances and their dependencies more easily, but it's not needed for doing Dependency Injection.


text:
Q: Best way to convert array of objects into Object? I need to convert the array of objects into object. I've done with the below logic. Is there is a best way to handle this?
Fiddler Version

var before = [{
  "x": ["2015-10-14T01:59:59.999+05:30", "2015-10-14T03:59:59.998+05:30", "2015-10-14T05:59:59.997+05:30", "2015-10-14T07:59:59.996+05:30", "2015-10-14T09:59:59.995+05:30", "2015-10-14T11:59:59.994+05:30", "2015-10-14T13:59:59.993+05:30", "2015-10-14T15:59:59.992+05:30", "2015-10-14T17:59:59.991+05:30", "2015-10-14T19:59:59.990+05:30", "2015-10-14T21:59:59.989+05:30", "2015-10-14T23:59:59.988+05:30"]
}, {
  "CleanCoal": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
  "Middelings": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
  "Prime": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
  "SpiralProd": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}];

var after = {};

for (var i = 0; i < before.length; i++) {
  var keys = Object.keys(before[i]);

  after[keys] = before[i][keys];
}

console.log(after)
document.writeln(JSON.stringify(after))

A: You can use forEach to iterate over an array, and you forgot to iterate over the nested array if there are multiple elements inside of an object.
So, the code in question will not work for
var arr = [{'a': 'b', 'c': 'd'}];

Demo

var before = [{
  "x": ["2015-10-14T01:59:59.999+05:30", "2015-10-14T03:59:59.998+05:30", "2015-10-14T05:59:59.997+05:30", "2015-10-14T07:59:59.996+05:30", "2015-10-14T09:59:59.995+05:30", "2015-10-14T11:59:59.994+05:30", "2015-10-14T13:59:59.993+05:30", "2015-10-14T15:59:59.992+05:30", "2015-10-14T17:59:59.991+05:30", "2015-10-14T19:59:59.990+05:30", "2015-10-14T21:59:59.989+05:30", "2015-10-14T23:59:59.988+05:30"]
}, {
  "CleanCoal": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
  "Middelings": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
  "Prime": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
  "SpiralProd": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}];

var after = {};

before.forEach(function(obj) {
  // obj here is the element of the array, i.e. object

  // Looping over all the keys of the object
  Object.keys(obj).forEach(function(key) {
    // key here is the key of the object
    after[key] = obj[key];
  });
});

console.log(after);
document.writeln('
' + JSON.stringify(after, 0, 2) + '
');

A: We use the best of functional programming in JavaScript:
Using reduce we don't need to add temporary variables to the outer scope.
for (var i in obj) is generally faster than Obj.keys(obj).forEach: https://jsperf.com/for-in-versus-object-keys-foreach

var before = [{
  "x": ["2015-10-14T01:59:59.999+05:30", "2015-10-14T03:59:59.998+05:30", "2015-10-14T05:59:59.997+05:30", "2015-10-14T07:59:59.996+05:30", "2015-10-14T09:59:59.995+05:30", "2015-10-14T11:59:59.994+05:30", "2015-10-14T13:59:59.993+05:30", "2015-10-14T15:59:59.992+05:30", "2015-10-14T17:59:59.991+05:30", "2015-10-14T19:59:59.990+05:30", "2015-10-14T21:59:59.989+05:30", "2015-10-14T23:59:59.988+05:30"]
}, {
  "CleanCoal": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
  "Middelings": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
  "Prime": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
  "SpiralProd": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}];
var after = before.reduce(function(dst, src){
  // import every key: val in src into dst
  // and keep doing it for every element in the array.
  for (var key in src)
    if ({}.hasOwnProperty.call(src, key))
      dst[key] = src[key];
  return dst;
}, {}); // start with an empty object to avoid modifying items in before array.

document.writeln("
" + JSON.stringify(after, null, 4) + "
")

A: In latest browsers [ecmascript 5], we have reduce which returns an object
try below

var before = [{"x":["2015-10-14T01:59:59.999+05:30","2015-10-14T03:59:59.998+05:30","2015-10-14T05:59:59.997+05:30","2015-10-14T07:59:59.996+05:30","2015-10-14T09:59:59.995+05:30","2015-10-14T11:59:59.994+05:30","2015-10-14T13:59:59.993+05:30","2015-10-14T15:59:59.992+05:30","2015-10-14T17:59:59.991+05:30","2015-10-14T19:59:59.990+05:30","2015-10-14T21:59:59.989+05:30","2015-10-14T23:59:59.988+05:30"]},{"CleanCoal":["0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00"]},{"Middelings":["0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00"]},{"Prime":["0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00"]},{"SpiralProd":["0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00","0.00"]}];

var object = before.reduce(function(o, v, i) {
  o[i] = v;
  return o;
}, {});

console.log(object);

Fiddle here http://jsfiddle.net/pscytrgj/

A: You can do it through JSON.stringify()

var before = [{
  "x": ["1", "2"],
  y: {
    a: 3
  }
}, {
  "CleanCoal": ["0.00", "0.00"],
  b: 4
}, {
  "Middelings": ["0.00", "0.00"]
}, {
  "Prime": ["0.00", "0.00", "0.00"]
}, {
  "SpiralProd": ["0.00", "0.00", "0.00"]
}];

var after = {};
var b = "",
  i = -1;
while (before[++i]) {
  var str = JSON.stringify(before[i]);
  b += str.slice(1, str.length - 1);
  if (before[i + 1]) b += ",";
}
after = JSON.parse("{" + b + "}");
console.log(after);
document.write("
" + JSON.stringify(after, 0, 3) + "
")

A: How about Object.assign?

var before = [{
  "x": ["2015-10-14T01:59:59.999+05:30", "2015-10-14T03:59:59.998+05:30", "2015-10-14T05:59:59.997+05:30", "2015-10-14T07:59:59.996+05:30", "2015-10-14T09:59:59.995+05:30", "2015-10-14T11:59:59.994+05:30", "2015-10-14T13:59:59.993+05:30", "2015-10-14T15:59:59.992+05:30", "2015-10-14T17:59:59.991+05:30", "2015-10-14T19:59:59.990+05:30", "2015-10-14T21:59:59.989+05:30", "2015-10-14T23:59:59.988+05:30"]
}, {
  "CleanCoal": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
  "Middelings": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
  "Prime": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
  "SpiralProd": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}];

var after = {};

before.map(function(i){
  return  Object.assign(after,i);
})

console.log(after)
document.writeln(JSON.stringify(after))


text:
Q: Can someone help me separate a log file into a separate file for each hour & day? I want a script to extract logs from a file xyz.rawlog, then create a xyz directory full of files named:
Arp-14-00.rawlog
Apr-14-01.rawlog
Full example:
~/xyz/Apr-14-02.rawlog

One possible issue: Log lines may have the leading 0 in the day field, or it may be spaced out.
Example:
Apr 01 12:
Apr  1 12:

Sample Logs:
Apr 14 02:35:33 DC501.xx.org/10.1.7.145/1.13.136.2 MSWinEventLog,4,Security,3959142,Tue Apr 14 02:35:32 2015,4769,Microsoft-Windows-Security-Auditing,XX.ORG\PereyrR1@XX.ORG,N/A,Success Audit,DC501.xx.org,Kerberos Service Ticket Operations,,A Kerberos service ticket was requested. Account Information: Account Name: PereyrR1@XX.ORG Account Domain: XX.ORG Logon GUID: {2F6FCDED-FBA0-DBF5-88D2-0B048E612E21} Service Information: Service Name: AHCTXXML501$ Service ID: ... –  Joshua C. 44 mins ago

Apr 14 04:32:16 1232-devr01/127.0.0.1/1.14.0.65 kernel: iptables:IN= OUT=upstream1 SRC=2.7.1.238 DST=207.188.35.17 EN=52 TOS=0x00 PREC=0x00 TTL=64 ID=2574 DF PROTO=TCP SPT=34030 DPT=61613 WINDOW=112 RES=0x00 ACK PSH FIN URGP=0 –

This is how I want the command syntax.
 ~/Logsplit.sh xyz

Working Script:
#/bin/bash
mkdir $1
awk -v fpath="$1" -F":" '{
    filename = fpath "/" gensub("[ ]+", "-", "g", $1) ".rawlog";
    print >> filename
}' $1.rawlog

exit;

A: This should do:
awk -F: '{split($1,a," ");print $1 > a[1]"_"a[2]+0"_"a[3]+0".log"}' *.rawlog

A: If I did understand correctly your question, you want to split content by date, where the full line of content is to be inserted in that new file.
You can do something like:
`
mkdir $1
awk -v fpath="$1" -F":" '{
    filename = fpath "/" gensub("[ ]+", "-", "g", $1) ".rawlog";
    print >> filename
}' $1.rawlog

`


text:
Q: Нужно установить цвет конкретно изображению внутри div не задевая пустой участок вокруг Есть  с картинкой двери, который находится поверх фона. Нужно, чтобы при наведении на дверь конкретно изображение двери окрашивалось в другой цвет. При использовании background-color красный появляется в пустой области вокруг неё. Немного похожий эффект, на тот который мне нужен даёт свойство filter, но там нет возможности выбрать нужный цвет. Буду рад любым идеям.

A: Как вариант, добавить изображению clip-path. И работать уже с "усеченным" по определенной геометрии изображением. Почитать - тут.


text:
Q: spring using CGLIB proxy even when class implements interface I'm trying to use Spring AOP to intercept methods of my GWT-RPC application (using GWT-Server library, so RPC service doesn't extend RemoteServiceServlet). When I deploy my war to tomcat and start the application, CGLIB fails for some reason. But I don't understand why CGLIB is being used for proxying at the first place. Since my RPC class implements the interface, shouldn't it be using JDK dynamic proxies?
Is there anything I need to do to debug this issue? Kindly advise.
Note: FYI, Spring encounters this exception, but I believe that's a different problem, I'm unable to understand why CGLIB proxy is in the picture.
Caused by: net.sf.cglib.core.CodeGenerationException: net.sf.ehcache.CacheException-->Another unnamed CacheManager already exists
in the same VM. Please provide unique names for each CacheManager in the config
or do one of following:
1. Use one of the CacheManager.create() static factory methods to reuse same    CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.

A: Answering for the sake of other (rare) folks who might do the same mistake.
The aspect setup for spring AOP wasn't correct and was in fact trying to target almost all the classes in the context, which is why EhCache started causing problems as there were more than one CacheManager instances (because of CGLIB proxies as CacheManager doesn't implement an interface)


text:
Q: MySQL #1241 - Operand should contain 1 column(s) on counting I am running this query, and I am getting ** #1241 - Operand should contain 1 column(s)** error:
  SELECT `forumCategories`.`id`, `forumCategories`.`name`, `forumCategories`.`order`, `forumCategories`.`description`, `forumCategories`.`date_created`, COUNT(forumPosts.forumCategory_id) as postCount,
    (SELECT `forumPosts`.*, `forumChildPosts`.`id`, `forumChildPosts`.`forumPost_id`, COUNT(forumChildPosts.forumPost_id) as childCount FROM `forumChildPosts` LEFT JOIN `forumPosts` ON `forumPosts`.`id` = `forumChildPosts`.`forumPost_id` GROUP BY `forumPosts`.`id`) AS childCount
    FROM `forumCategories`
    LEFT JOIN `forumPosts` ON `forumCategories`.`id` = `forumPosts`.`forumCategory_id`
    GROUP BY `forumCategories`.`id`
    ORDER BY `forumCategories`.`order` DESC

I have 3 tables:
forumCategories
forumPosts | forumPosts.forumCategory_id = forumCategories.id
forumChildPosts | forumChildPosts.forumPosts_id = forumPosts.id

I want to count all posts for the forum category, and them I want to count all the child posts that belongs to that forum category. How can I do this?

A: You can't select several items with a subselect and then give them one name. Now you're getting everything from forumPosts, something from forumChildPosts etc and trying to put that into a single column, childCount. This is not allowed.
It might be enough to remove all other result columns from that select and only leave the count?

A: I couldn't try it, is that makes sense ? But you can't get nested results from mysql due to its limitation, MYSQL is a Matrix table.
SELECT `forumCategories`.`id`,
       `forumCategories`.`name`,
       `forumCategories`.`order`,
       `forumCategories`.`description`,
       `forumCategories`.`date_created`,
       COUNT(forumPosts.forumCategory_id) AS postCount,
      (SELECT COUNT(forumChildPosts.forumPost_id) AS childCount FROM `forumChildPosts` LEFT JOIN `forumPosts` ON `forumPosts`.`id` = `forumChildPosts`.`forumPost_id` GROUP BY `forumPosts`.`id`) AS childCount
FROM `forumCategories`
LEFT JOIN `forumPosts` ON `forumCategories`.`id` = `forumPosts`.`forumCategory_id`
GROUP BY `forumCategories`.`id`
ORDER BY `forumCategories`.`order` DESC


text:
Q: When value is 0, change checkbox - input only accept digits I have a checkbox that when clicked has an input value of 1. When it is unchecked the value is 0. That is ok.
The input only accepts digits, the validation is ok.
I want it to work in a way that when the value is 0 the checkbox is not checked.
My example sometimes fails when I play with values of one digit, or more than two.
  jQuery(document).on('keypress keyup blur', 'input.e-qty', function (event) {
        if ((((event.which > 47) && (event.which < 58)) || (event.which == 13)) ) {
            var qty = jQuery(this).val();
            if(qty.length == 1 && qty == 0){
                jQuery('.product').trigger('click');
            }

            return true;
        }
        return false;
    });

    jQuery(document).on("change", ".product", function () {
        var id = this.id.split("_").pop();
        var qty = jQuery('#qty_' + id);

        qty.val(+this.checked);

    });

https://jsbin.com/patekocuya/1

A: Additionally you can use the attr property, since attributes could be altered at runtime also, therefore your code would look like this..
jQuery(document).on('keypress keyup blur', 'input.e-qty', function (event) {
        if ((((event.which > 47) && (event.which < 58)) || (event.which == 13)) ) {
            var qty = Number(jQuery(this).val());

            if(qty == 0){

                $('.product').attr('checked', true);

            }else{

                $('.product').attr('checked', false);
            }

            return true;
        }
        return false;
    });

Note
Also take note that checking if you are working with classes it is best to tell the page which checkbox you are referring to since class referencing returns a collection. using this method you could modify the HTMLInputElements property directly,
therefore your code becomes -
 $('.product')[0].checked = true;
 or
 $('.product')[0].checked = false;

A: Use prop() function instead of click

*

*Add else statement with not equal 0 with checked true

*Just use parseFloat for the numeric problem

Updated
https://jsbin.com/coqutuzizo/1/edit?html,js,console,output
 jQuery(document).on('keypress keyup keydown blur', 'input.e-qty', function (event) {
    if ((((event.which > 47) && (event.which < 58)) || (event.which == 13) || (event.which == 8)) ) {
        var qty = parseFloat(jQuery(this).val());
        if(qty === 0 || !$.trim($(this).val())){
            jQuery('.product').prop('checked',false);
        }else{
            jQuery('.product').prop('checked',true);

        }

        return true;
    }
    return false;
});

A: Is this what you are looking for https://jsfiddle.net/qwy7ausj/
jQuery(document).on('keypress keyup blur', 'input.e-qty', function(event) {

var qty = jQuery(this).val();
if (qty != 0) {

    jQuery('.product').prop('checked', true);
} else {
    jQuery('.product').prop('checked', false);
}

});

A: You should seperate keypress and keyup otherwise you will get a double value.
Here i made you an example.

jQuery(document).on('keypress', 'input.e-qty', function (event) {
        if ((((event.which > 47) && (event.which < 58)) || (event.which == 13)) )
            return true;

        return false;
    });

jQuery(document).on('keyup', 'input.e-qty', function (event) {
            var qty = $(this).val();
            if(qty != "" ){
               var i = parseInt(qty);
                  jQuery('.product').prop("checked", i>0).trigger("change")
                }
    });

   jQuery(document).on("change", ".product", function () {
        var id = this.id.split("_").pop();
        jQuery('#qty_' + id).val(+this.checked).focus().select(); ;

    });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="checkbox" id="chk_1" class="product">
<input type="text" class="e-qty" name="qty" id="qty_1" value="0">


text:
Q: Вопрос по созданию меню Всем привет! Учу помаленьку разработку на Android. Создаю меню! Вроде получается! Создаю в методе

public boolean onCreateOptionsMenu(Menu menu).

Создаю через add. Возвращаю меню
retyrn super.onCreateOptionsMenu(menu);

Так вот вопрос. Что такое super.onCreateOptionsMenu(menu)? Хотелось бы понять логически, а не тупо писать код.
Спасибо всем!
A: super.onCreateOptionsMenu(menu);

Это вызов метода базового класса, чтобы корректная инициализация меню была.
Это относится и к остальным методам: onResume(), onStop() и т.п.


text:
Q: Moving TreeView items in Windows I've been working on a TreeView system using the WinAPI. I built wrappers around some functions which allow me to insert new items, remove items and move items in a control. However, moving items seems to be a real pain in the ass. I could not find any function in the MSDN (http://msdn.microsoft.com/en-us/library/aa925848.aspx) that could solve my problem.

Therefore, I had to create a dirty-hack which saves the attributes of an item, deletes the old item and inserts the item at the new location. Here's a little code snippet:
TVITEM tvitem;
char chrTextBuffer[33];

tvitem.mask = TVIF_TEXT;
tvitem.cchTextMax = sizeof(chrTextBuffer); // \0 termination included?
tvitem.pszText = chrTextBuffer;
tvitem.hItem = olditem; // different in the original code, don't want to post the entire function
TreeView_GetItem(GUIVars.Controls.GUI_Chat.ChannelTree, &tvitem);

The TVITEM struct is used to retrieve information about the item. I won't explain these structs in detail, because it's not important right now. Well, this information is now being inserted into a TV_INSERTSTRUCT and sent to the TreeView via
TreeView_Insert(mytreeview, &insertstruct);

The old item gets deleted:
TreeView_DeleteItem(mytreeview, olditem);

Obviously, this is quite dirty. Is there any other possibility to achieve the desired functionality? I am only using pure WinAPI in Pelles C for Windows (http://www.smorgasbordet.com/pellesc/), so libraries are no option.

Furthermore, I had to think about a way which allows to move all the children and the children's children too. Each item is saved in a structure (in the HTREEITEM Handle)
struct cTreeItem
{
    uint8 Type;
    uint8 Used;
    uint16 Depth;
    int32 ParentID;
    HTREEITEM Handle;
};

which provides information, especially the ParentID. I could just loop through all my items (which are all saved in a dynamically allocated growing array) and check if their ParentID matches one of the nodes that has to be moved until I reach the last level of item-depth, but a native alternative would be better of course.
I hope my questions are understandable, I need a way to move items in a TreeView, preferably also moving their children and children's children (...).

Edit: Btw, I found a lot of stuff solving this problem, but unfortunately only in C#, VB etc..

A: The TreeView common control does not support moving items to a new parent. If you want to move an item relative to its siblings (but remain under the same parent), you can use TreeView_SortChildrenCB and pass a custom sort function that orders the children the way you want.


text:
Q: Как записать структуру данных в файл в бинарном виде?     void Huffman::bitYaz(Dugum* alt_dugum)
{
    if(dosyaBit.is_open())
    {
        //dosyaBit.write((char*)&alt_dugum->kod,sizeof alt_dugum->kod);
        //dosyaBit<<alt_dugum->kod;
        //dosyaBit.write((char*)&alt_dugum->kod,sizeof(alt_dugum->kod));
        while (*alt_dugum) dosyaBit.put (*alt_dugum++);
        dosyaBit.close ();
    }
    else
    {
        dosyaBit.open("bit.dat",ios::binary|ios::out);
        bitYaz(alt_dugum);
    }
}

Цель:пытаюсь записать в bit.dat файл,структуру данных в бинарном виде,для сжатия файла,не получается.
Использую дерево Хафмана,сначала считывается текст из файла text.txt,затем все добавляется в дерево Хафмана,и каждого символа двоичный код(созданный при помощи Хафмана)записывается в table.txt,после с помощью этого всего записываю в bit.dat в "битовом" формате,но не получается,пишетто все,и правильно как надо,но размер файла больше чем обычный text.txt файл.


text:
Q: Search asmack answerForm I want to search a user in my local open fire server
But after make answerForm it crashed (in try catch go to catch)
It's my code:
      UserSearchManager search = new UserSearchManager(connection);

        try {

            Form searchForm = search.getSearchForm("search.mahan-pc");
            Form answerForm = searchForm.createAnswerForm();
            ...

        } catch (Exception e) {
            Log.e("error", "error");

        }

I am beginner in xmpp
can everybody help me ?


text:
Q: Can we have 2 phase power supply? Can I have a 2 phase power supply line with the phases separated by 180 degrees? I heard it is there with 90 degree phase apart with an active return path.
GL

A: Certainly you can have any number of phases with any phase angle between them.
Most power plants produce three phase power with the phases separated by 120 degrees because that is the minimum number of conductors configuration for which the power is constant over one cycle. Having constant power reduces mechanical vibration and improves the lifetime of the generator.


text:
Q: ifelse replace value if it is lower than previous I am working with a dataset which has some errors in the data. Numbers are sometimes registered wrong. Here is some toy data example:

The issue is that the Reversal column should only be counting up (per unique ID). So in a vector of 0,0,0,1,1,1,0,1,2,2,0,0,2,3, the 0's following the 1 and 2 should not be 0's. Instead, they should be equal to whatever value came before. I tried to remedy this by using the lag function from the dplyr package:
Data$Reversal <- ifelse(Data$Reversal < lag(Data$Reversal), lag(Data$Reversal), Data$Reversal) .
But this results in numerous issues:

*

*The first value becomes NA. I've tried using the default=Data$Reversal call in the lag function but to no avail.

*The Reversal value should reset to 0 for each Unique ID. Now it continues across ID's. I tried a messy code using group_by(ID) but could not get this to work, as it broke my earlier ifelse function.

*This only works when there is 1 error. But if there are two errors in a row it only fixes 1 value.

Alternatively, I found this thread in which the answer provided by Andrie also seems promising. This fixes problem 1 and 3, but I can't get this code to work per ID (using the group_by function).
Andrie's answer:

local({
  r <- rle(data)
  x <- r$values
  x0 <- which(x==0) # index positions of zeroes
  xt <- x[x0-1]==x[x0+1] # zeroes surrounded by same value
  r$values[x0[xt]] <- x[x0[xt]-1] # substitute with surrounding value
  inverse.rle(r)
})

Any help would be much appreciated.

A: I think cummax does exactly what you need.
Base R
dat$Reversal <- ave(dat$Reversal, dat$ID, FUN = cummax)
dat
#    ID Owner Reversal Success
# 1   1     A        0       0
# 2   1     A        0       0
# 3   1     A        0       0
# 4   1     B        1       1
# 5   1     B        1       0
# 6   1     B        1       0
# 7   1 error        1       0
# 8   1 error        1       0
# 9   1     B        1       0
# 10  1     B        1       0
# 11  1     C        1       1
# 12  1     C        2       0
# 13  1 error        2       0
# 14  1     C        2       0
# 15  1     C        3       1
# 16  2     J        0       0
# 17  2     J        0       0

dplyr
dat %>%
  group_by(ID) %>%
  mutate(Reversal = cummax(Reversal)) %>%
  ungroup()

data.table
as.data.table(dat)[, Reversal := cummax(Reversal), by = .(ID)][]

Data, courtesy of https://extracttable.com/
dat <- read.table(header = TRUE, text = "
ID  Owner   Reversal    Success
1   A   0   0
1   A   0   0
1   A   0   0
1   B   1   1
1   B   1   0
1   B   1   0
1   error   0   0
1   error   0   0
1   B   1   0
1   B   1   0
1   C   1   1
1   C   2   0
1   error   0   0
1   C   2   0
1   C   3   1
2   J   0   0
2   J   0   0")


text:
Q: Stylus/SpriteSmith - Serve 2x (Retina) images using same sprite file? I'm using Stylus + Rupture + SpriteSmith + Gulp.JS and I wanna know if its possible to serve 2x version of an image using same sprite.png file ?

A: Found the solution.
We actually can serve a 2x version of our image from the same sprite file.
The main idea is that inside the media query, we have to divide all the numbers by 2 and add the background-size property.
If you are using plain CSS or Stylus, you might use something like:
#logo {
    background-image: url("sprite.png");
    background-position: -230px -93px;
    height: 60px;
    width: 45px;
}
@media not all, only screen and (min-resolution: 1.5dppx), only screen and (min--moz-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi) {
#logo {
    background-position: -70px 0;
    background-size: 150px 93.5px;
    height: 60px;
    width: 45px;
}
}

Note : The real position, size and dimensions of our sprite is different, But we are actually scaling down the sprite image and changing positions accordingly.
If you are using Stylus + SpriteSmith, you could write a Sprite_2x function like this :
spriteWidth_2x($sprite) {
  width: ($sprite[4]/2);
}

spriteHeight_2x($sprite) {
  height: ($sprite[5]/2);
}

spritePosition_2x($sprite) {
  background-position: ($sprite[2]/2) ($sprite[3]/2);
}

spriteImage_2x($sprite) {
  background-image: url($sprite[8]);
}

sprite_2x($sprite) {
  spriteImage_2x($sprite)
  spritePosition_2x($sprite)
  spriteWidth_2x($sprite)
  spriteHeight_2x($sprite)
  background-size ($spritesheet_width / 2) ($spritesheet_height / 2)
}

By the way, I don't understand why many articles out there suggest to use a separate sprite file for 2x images. I believe this way we could reduce 1 extra request which is way more efficient. I don't know maybe I am wrong. I'm new to this.


text:
Q: Building WITH_QT gives various errors I'm building OpenCV 3.2 on Ubuntu 16.04
I'm including many libraries (extra modules, TBB, Eigen, etc..) and everything is compiling and working as it should
The only problem I have is when slecting the WITH_QT option
Although it is installed and the executable path is configured, I even tested creating QT apps, but it still gives me unfound reference errors when compiling the opencv_contrib examples
../../lib/libopencv_world.so.3.2.0: referência indefinida para `vtable for cvv::qtutil::KeyPointSettingsSelector'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `vtable for cvv::qtutil::SlotQString'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `vtable for cvv::view::TranslationMatchView'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `CvButtonbar::staticMetaObject'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `vtable for cvv::gui::FilterCallTab'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `vtable for cvv::view::ImageView'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `vtable for cvv::qtutil::MatchSettingsSelector'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `vtable for cvv::qtutil::Slot'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `vtable for cvv::qtutil::MatchManagement'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `typeinfo for cvv::qtutil::MatchSelection'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `vtable for cvv::qtutil::OverlayFilterWidget'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `vtable for cvv::qtutil::ChangedPixelsWidget'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `cvv::qtutil::SignalMatRef::signal(cv::Mat&) const'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `vtable for cvv::gui::OverviewPanel'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `cvv::qtutil::Signal::signal() const'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `vtable for cvv::qtutil::STFLQueryWidget'
../../lib/libopencv_world.so.3.2.0: referência indefinida para `vtable for cvv::qtutil::KeyPointSelectionSelector'

Any workaround?
UPDATE:
Tried to disable "cvv" module: cmake -DBUILD_opencv_cvv=OFF
and now I'm getting:
[ 47%] Linking CXX executable ../../bin/optflow-example-motempl
../../lib/libopencv_world.so.3.2.0: referência indefinida para .vtable for CvWinProperties' ../../lib/libopencv_world.so.3.2.0: refer�./../lib/�libopencv_world.so.3.2.0ncia: indefinidarefer paravtable for �CvCheckBox�ncia'
indefinida. para./ ..vtable/ libfor/ libopencv_world.so.3.2.0CvWinProperties: ' refer.�./�.ncia. indefinida/lib /libopencv_world.so.3.2.0: referênciapara indefinida para vtable for CvPushButton' .vtable. for/../lib/libopencv_world.so.3.2.0: referência indefinidaCvCheckBox ' paravtable for GuiReceiver'

A: I had to turn off opencv_cvv and opencv_world
-DBUILD_opencv_cvv=OFF
-DBUILD_opencv_world=OFF


text:
Q: Given $k$ points in $n$-dimensional space, is there always a continuous $n-1$ surface that can divide the points into two arbitrary groups? Say we have $k$ points in set $P\mid x_i\in\mathbb{Z}^n$, such that $k=\mathcal{O}(n!)$. We now arbitrarily divide the points into two sets, $A$, $B$. Note that $A\cup B = P$ and $A \cap B = \varnothing$.
Is there always $n-1$ dimensional surface in $\mathbb{R}^n$ that perfectly separates these two sets of points? Is there some transformation $T:\mathbb{R^n}\rightarrow\mathbb{R^n}$, such that this $n-1$ dimensional surface is a function $f(\vec x)$? If so is it always possible to find this function?
I know this is similar to the idea of SVN machine learning, but I'm more interested in the theoretical ideas about existence of these divides.

A: As quasi pointed out, the condition $n\geq 2$ is necessary.
We use induction on $n$. The statement holds for $n=2$. Indeed, connect the points in one of the two sets, say $A$, to make a closed, simple curve (no self-intersection). Use segments connecting the points in an appropriate order to obtain such a curve. (We don't want any Peano nonsense.)
If a point of $B$ happens to be on this curve, make a detour.
Then create a tube around this curve: using segments parallel to the ones in the curve, very close to the curve on both sides. If you pick these parallel segments close enough, only points in $A$ are inside this closed tube. Then cut the tube by breaking one of the pipes and seal the ends. That is, pick a pair of segments perpendicular to the pipe connecting the two walls of the pipe, and delete the part of the two walls between the segments. Then the walls of the broken tube and the two seals together form a polyhedron that separates $A$ from $B$.
Now let $n>2$ and assume that the statement holds for $n-1$.
There are finitely many points given, so there are finitely many (ordered) pairs of them. Each pair $(P,Q)$ specifies a vector: the vector $\overrightarrow{PQ}$.
Pick a vector $\overrightarrow{v}$ that is not parallel to any of these, and let $H$ be the hyperplane ($(n-1)$-dimensional subspace) with normal vector $\overrightarrow{v}$.
Project all the points onto $H$. Solve the problem in $H$ for the projected points (induction hypothesis):  an $(n-2)$-dimensional surface $S$ does the job.
Then $S'= \{s+c\overrightarrow{v} \mid s\in S, c\in \mathbb{R}\}$ is a good solution for the original points.

A: Solve the poisson equation,
$\Delta u = f$
with $f$ consisting of delta function sources at points in $A$ and sinks at points in $B$. The zero set of the solution $u$ separates the points. One should be able to prove that either this zero set is smooth, or the zero set associated with arbitrarily small perturbations of the points is smooth, by using elliptic regularity and Sard's theorem.
You could also compute the sensitivity of the surface to movement of the points with the implicit function theorem.
The surface may consist of several disconnected components though.


text:
Q: cannot find Opera binary error selenium+java using webdrivermanager while running the below program in eclipse, got an error "cannot find Opera binary".
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.opera.OperaDriver;

import io.github.bonigarcia.wdm.WebDriverManager;

public class Opera
{
public static void main(String[] args)
{
    WebDriverManager.operadriver().setup();
    WebDriver d = new OperaDriver();
    d.get("http://amazon.ae");
    d.close();
}
}

How to solve this , please help..

A: Try to specify the path of your Opera launcher binary:
    String operaBinary = "C:\\Program Files\\Opera\\launcher.exe"; // If Windows
    WebDriverManager.operadriver().setup();
    OperaOptions options = new OperaOptions();
    options.setBinary(operaBinary);
    WebDriver driver = new OperaDriver(options);

    // ...


text:
Q: How to convert string to object reference or add number value to object reference name? My question should be fairly straightforward.
If it helps to explain, I am currently using a javascript library called Leaflet. This library allows me to create a customizable online map that I can add markers to, which is what I am doing right here:
var iconId = null;

for (var i=1;i<4;i++)
{
  iconId = "mapMarker" + i; // L.marker does not accept this because it is a string and not an object
  var marker = L.marker([boulder.latitude, boulder.longitude], {icon: iconId}).addTo(map);
}

In another JS file, I have created 3 mapMarker objects with attributes compliant to Leaflet's documentation.
var mapMarker1 = L.icon({
    iconUrl: 'img/mapMarker1.png'
});
var mapMarker2 = L.icon({
    iconUrl: 'img/mapMarker1.png'
});
var mapMarker3 = L.icon({
    iconUrl: 'img/mapMarker1.png'
});

As you can see, I currently have a loop that creates a string with the name of the object I want to pass into the icon parameter, but the icon parameter is expecting an object, and not a string. Is there a way I can dynamically create object names and put them in "iconId"? I do not want to put this into a switch case, as it would be too large for my taste.
Thanks!

A: Whenever you find yourself creating a series of variables with similar names and incrementing numbers in the names, you should instead use the feature in JavaScript that's designed for this very purpose: an array.
Create an array of your map markers instead of the numbered variables:
var mapMarkers = [
    L.icon({
        iconUrl: 'img/mapMarker1.png'
    }),
    L.icon({
        iconUrl: 'img/mapMarker1.png'
    }),
    L.icon({
        iconUrl: 'img/mapMarker1.png'
    })
];

Now simply iterate through that array:
for( var i = 0;  i < mapMarkers.length;  i++ ) {
    var marker = L.marker(
        [ boulder.latitude, boulder.longitude ],
        { icon: mapMarkers[i] }
    ).addTo( map );
}


text:
Q: Ionic ion-text-wrap: remove elipsis and go to next line for label Hopefully this is a simple fix but I am very new to Ionic and I have searched through their docs and also a lot of posts on stack but cant seem to nail it.
So I have received a defect from the test team that a label I have which is

Decision Details

is being presented as

Decision..

across all platforms and devices.
I would like to be able to view the whole text or else the decisions part of it take to a new line instead of elipsis.
At the same time, I would like to keep the same formatting as the other labels that use ion-text-wrap are fine.
Here is some code:
  <ion-item>
    <ion-label class="ion-text-wrap" class="bold">Decision </ion-label>
    <ion-label class="ion-text-wrap"> {{ excursion.excursionDecision }} </ion-label>

    <ion-label *ngIf="showCommentArray[i]" class="ion-text-wrap" class="decision" class="bold" button (click)="presentModal(i)">Decision Details</ion-label>
    <ion-label *ngIf="showCommentArray[i]" button (click)="presentModal(i)"
      ><ion-icon name="arrow-forward" class="commentsArrow"></ion-icon
    ></ion-label>

    <ion-label *ngIf="showCommentArray[i] === false"></ion-label>
    <ion-label *ngIf="showCommentArray[i] === false"></ion-label>
  </ion-item>
</div>

Is there a simple way to remove the elipsis and ensure that label goes to the next line and displays fully?
Appreciate any help thanks!

A: Fixed it by adding CSS:
.decision {
white-space: pre-line;
font-weight: bold;
}


text:
Q: Command 'python' not found - after I've assigned it as an alias to python3 I'm in the early stages of learning django with python. Have done none of both before.
I'm following a course where the instructor has showed how to start a new project using vagrant, and one of the files in the main directory is called Vagrantfile, no file extension (same for the instructor).
These are the contents of the file:
# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
 # The most common configuration options are documented and commented below.
 # For a complete reference, please see the online documentation at
 # https://docs.vagrantup.com.

 # Every Vagrant development environment requires a box. You can search for
 # boxes at https://vagrantcloud.com/search.
 config.vm.box = "ubuntu/bionic64"
 config.vm.box_version = "~> 20200304.0.0"

 config.vm.network "forwarded_port", guest: 8000, host: 8000

 config.vm.provision "shell", inline: <<-SHELL
   systemctl disable apt-daily.service
   systemctl disable apt-daily.timer

   sudo apt-get update
   sudo apt-get install -y python3-venv zip
   touch /home/vagrant/.bash_aliases
   if ! grep -q PYTHON_ALIAS_ADDED /home/vagrant/.bash_aliases; then
     echo "# PYTHON_ALIAS_ADDED" >> /home/vagrant/.bash_aliases
     echo "alias python='python3'" >> /home/vagrant/.bash_aliases
   fi
 SHELL
end

From my understanding, this line echo "alias python='python3'" >> /home/vagrant/.bash_aliases tells vagrant that when I use the python command, it should regard it as if I wrote python3.
When I write the following command though python -m venv ~/env, I get in response this message:
Command 'python' not found, but can be installed with:

apt install python3
apt install python
apt install python-minimal

Ask your administrator to install one of them.

I call this command after I've ran the vagrant ssh command and I'm already inside the virtual machine, and navigate to the vagrant dir. I know it because in git bash this shows as my current location vagrant@ubuntu-bionic:/vagrant$.
I'm not sure if it's related, or if it's a different issue, but I'll add that even if I run this command instead python3 -m venv ~/env, I get this response:
The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt-get install python3-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Failing command: ['/home/vagrant/env/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']

If I run the install command it recommends (with sudo), I get this in response:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python3-venv is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

This blocks my learning, no idea how to move forward with his. Any help is appreciated.

A: The problem is probably aliasing python3 to python, by default Ubuntu 18 shipped both Python 2 (python) and Python 3 (python3) and changing that  carelessly can cause instabilities, ranging from subtle bugs, to your system not booting, you can:

*

*use update-alternatives to change it

*use python3 as it is

*install the package python-is-python3 (although I'm not sure if this is available in 18)

Anyway, by deleting the alias, everything should go back to normal.

A: I'm trying to reproduce this on Ubuntu 20.04.
sudo dpkg -i virtualbox-6.1_6.1.14-140239~Ubuntu~eoan_amd64.deb
mkdir vagrant
cd vagrant
vagrant init hashicorp/bionic64
vagrant up

At this point my Vagrantfile contains no alias. See https://github.com/michaelhochleitner/vagrant-test/blob/master/Vagrantfile.
Testing python in vagrant ssh without alias.
vagrant ssh
python
Python 2.7.15+ (default, Nov 27 2018, 23:36:35)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Testing python in vagrant ssh with alias.
At this point my Vagrantfile contains the alias from your post. See https://github.com/michaelhochleitner/vagrant-test/blob/master/Vagrantfile_with_alias.
vagrant reload
vagrant ssh
python
Python 2.7.15+ (default, Nov 27 2018, 23:36:35)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

I'm assuming the

Command 'python' not found, but can be installed with:

error is not caused by the alias in the Vagrantfile.
Try to resolve the issue by installing python3-venv.
What is the output of python in a terminal outside vagrant ssh?
What is the output of python3 in a terminal outside vagrant ssh?
Which operating system are you using?
Also see https://askubuntu.com/questions/958303/unable-to-create-virtual-environment-with-python-3-6.


text:
Q: ajax - Submitting multiple buttons with AJAX but getting first value only I am having an issue where I am trying to pass a submit buttons values along with the form to ajax but for some reason the only value that passes no matter which button I push is the first button. There is more to the form but I am just showing the buttons.
<form>
    <input type="submit" name"finalize_invoice" id="finalize_invoice" value="Delete" />
    <input type="submit" name"finalize_invoice" id="finalize_invoice" value="Save" />
    <input type="submit" name"finalize_invoice" id="finalize_invoice" value="Finalize" />
</form>

      $(document).ready(function(){
            $("form#submit").submit(function() {
            // we want to store the values from the form input box, then send via ajax below
            var invoice_temp_id = $('#invoice_temp_id').attr('value');
            var man_part_number = $('#man_part_number').attr('value');
            var customer = $('#customer').attr('value');
            var date = $('#date').attr('value');
            var shipdate = $('#shipdate').attr('value');
            var shipvia = $('#shipvia').attr('value');
            var ponumber = $('#ponumber').attr('value');
            var rep = $('#rep').attr('value');
            var invoicenotes = $('#invoicenotes').attr('value');
            var serial_number = $('#serial_number').attr('value');
            var skid = $('#skid').attr('value');
            var finalize_invoice = $('#finalize_invoice').attr('value');
            $.ajax({
            type: "POST",
            url: "includes/createfinalinvoice.php?",
            data: "invoice_temp_id="+ invoice_temp_id+
                "&man_part_number="+ man_part_number+
                "&customer="+ customer+
                "&date="+ date+
                "&shipdate="+ shipdate+
                "&shipvia="+ shipvia+
                "&ponumber="+ ponumber+
                "&rep="+ rep+
                "&invoicenotes="+ invoicenotes+
                "&serial_number="+ serial_number+
                "&skid="+ skid+
                "&finalize_invoice="+ finalize_invoice+
                $( this ).serialize(),
                success: function(data){
                    if (data == 1) {
                        var thiserror = 'You may not have any blank fields, please make sure there is a serial number in each field';
                        alert(thiserror);
                    }
                    if (data == 2) {
                        var thiserror = 'Your serial number(s) do not match with the Manufacture Part Numbers, please double check your list';
                        alert(thiserror);
                    }
                    if (data == 3) {
                        var thiserror = 'Some of your serial numbers are not located in the database, please make sure you entered the correct serial number';
                        alert(thiserror);
                    }
                    if (data == 4) {
                        var thiserror = 'This item has already been sold to another customer. Please report this to administration';
                        alert(thiserror);
                    }
                    if (data == 5) {
                        var thiserror = 'Everything went OK, you may continue and view the processed invoice';
                        alert(thiserror);
                    }
                    if (data == 6) {
                        var thiserror = 'There are no default prices setup for this customer matching the Manufacture Part Numbers. Please check and make sure they all exist before processing this list';
                        alert(thiserror);
                    }
                    if (data == 7) {
                        window.location = ('/admin/?mmcustomers=1&viewinvoice=1');
                    }

                }
            });
            return false;
            });
         });

A: <form>
    <input type="button" name"del_button" id="del_btn" value="Delete" />
    <input type="button" name"save_button" id="save_btn" value="Save" />
    <input type="button" name"finalize_button" id="finalize_btn" value="Finalize" />
</form>

<script>
    $(document).ready(function(){
        var clicked_btn = '';
        $('form').submit(function(){ return false; });
        $('form input[type=button]').click(function(){
             clicked_btn = $(this).attr('id');
             yourSubmitFunction(clicked_btn);
             return false;
        });
    }
</script>

A: You have three submit buttons with identical ids of finalize_invoice. ids must be unique however. This is the reason, jquery selects the first button only, no matter which one was clicked. If you want to send the request with the clicked button, bind a function to the button's click event
$('form#submit input[type="submit"]').click(function() {
    ...
    var finalize_invoice = $(this).attr('value');
    $.ajax(...);
    ...
    return false;
}

As @thaJeztah suggested, suppressing the submit event on form
$('form#submit').submit(function() {
    return false;
});


text:
Q: SRID in parametric SQL View in Geoserver I want to create parametric SQL View, which provide feature collection of my route, which bbox is in depending on entered parameters. I add some SQL Script which is returned some columns, and one of them is geometry column of type LineString with SRID 4326.
When I tried refresh atributes and check Guess geometry type and srid geometry was not set up as you can see on screen:

Type is still Geometry not Linestring, and SRID is -1. So my questions are:

*

*Should I set this manualy to LineString? And if yes, should I set SRID of my column in database (4326) or that SRID what I need (900913).

*Geoserver layer display this area which is covered in bbox, so if I understad, I have to set bbox of whole area, which is my route could contains? So if my data are whole planet so I need set bbox of whole planet or what ?

A: GeoServer "guesses" by asking the underlying database, which sometimes cannot provide a good answer, for example:

*

*PostGIS without a declaration of the subtype and srid in the table

*Oracle in most cases, as the information can be only provided as a constraint while creating the spatial index and very few people enter it

In case they are missing, it's up to you to enter the values (that's why they are editable):

*

*The right type of geometry

*The srid matching what you actually have in the table

Publishing should normally retain the native CRS, all OGC service can do reprojection on the fly.


text:
Q: NormalModuleReplacementPlugin is not working for replacing node_modules scss file with another scss file in assets _bg-theme.scss file is installed in node_modules after adding a package in package.json
I am trying to replace node_modules scss file  with the scss file(_bg-theme.scss) we added in assets folder bg-theme.scss .
I am using webpack.NormalModuleReplacementPlugin but its not working.
webpack.common.js
 plugins: [
     new webpack.NormalModuleReplacementPlugin(
          /\/node_modules\/@bg-file-menu\/core\/dist\/styles\/mixins\/_bg-theme.scss/,
          '../../../src/web/assets/styles/bg-theme.scss',
        )
  ]

What is the correct way to fix this. Any suggestion or solution is appreciated.

A: The second path (your assets file) is relative to the first.  So you'd have to go a few more levels up.
plugins: [
 new webpack.NormalModuleReplacementPlugin(
      /\/node_modules\/@bg-file-menu\/core\/dist\/styles\/mixins\/_bg-theme.scss/,
      '../../../../../../../src/web/assets/styles/bg-theme.scss',
    )

]


text:
Q: Securityd process uses 100% CPU when Mail app is open I have a Macbook Air mid 2011 with OS X Yosemite. For a couple of weeks, I have a process, called Securityd, that runs and uses 100% of my processor, making it hot and noisy.
After some time, I discovered that the process is launching when I open the (native) Mail application. However this is not always happening. I am not sure of what makes it run, but it stops instantly when I quit the Mail app.
Do you have any idea of why this process is running, and how to fix it?
The Console.app shows nothing when I filter it with "Security". However, without filtering, when the process launch, I have this, which is looping infinitely :
25/05/15 09:57:39,166 icbaccountsd[1816]:  SOSCCThisDeviceIsInCircle
SOSCCThisDeviceIsInCircle!! 418
25/05/15 09:57:39,531 icbaccountsd[1816]:  SOSCCThisDeviceIsInCircle SOSCCThisDeviceIsInCircle!! 419
25/05/15 09:57:39,846 accountsd[1807]: Enter ShareKitAccountEnabler  - didChangeWithType - type=2 for account myemail@address.com (E0AAB503-12B6-4E2D-B519-10A05E4C7A2A).
25/05/15 09:57:39,846 accountsd[1807]: AIDA Notification plugin running
25/05/15 09:57:39,972 accountsd[1807]: Enter ShareKitAccountEnabler  - didChangeWithType - type=2 for account myemail@address.com (E0AAB503-12B6-4E2D-B519-10A05E4C7A2A).
25/05/15 09:57:39,973 accountsd[1807]: AIDA Notification plugin running

A: Ok, my advice is that u should unlink your email accounts and iCloud accounts from your MacBook Air. These unlink operation are to be done on MBA's side. Here is how I reached this conclusion:

*

*securityd handles cryptographic operations on OS X. All processes communicate with securityd through SecurityAgent. That fact that these two are not throwing error in system log means something talking to them is the culprit.

*icbaccountsd has ur email/icloud authorization info stored. To see what I mean, terminal:
/usr/libexec/icbaccountsd raw
and you will see your addresses in the printout.

*An error in the icbaccountsd doesn't necessarily mean a wrong password. It could also be a incorrect/corrupted public/private key. Or a formating error in the file (hence, the infinite loop).

So you should uncouple your emails from MBA and recouple them later. These are the measures you can take to do that, from safest to more drastic. You can do only one each time, add back your emails, and wait to see if it works. Or you can undertake all at once and add back. Needless to say, before re-adding, restart your laptop.

*

*Deactivate all accounts under System Preferences -> iCloud and Internet Accounts. (This is probably too puny to work.)

*Delete those accounts System Preferences -> iCloud and Internet Accounts.

*Open Keychain app and delete any entry related to your email addresses and email servers. These entries can be passwords, keys, certificates, etc.

*open ~/Library/ and back up files in ~/Library/Containers/com.apple.mail/ and ~/Library/Mail/. Delete the originals.
These would give you a machine free from any association with your emails. You many wonder if you should simply/also purge /usr/libexec/icbaccountsd. I won't recommend it til all else fails.


text:
Q: Atmosphere Framework : broadcaster broadcast message multiple times I'm current developping a simple chat multi-room based on this example :
https://github.com/Atmosphere/atmosphere-samples/blob/master/samples/chat-multiroom/
My development environment :

*

*Tomee Plus 1.7.2 server

*Atmosphere-runtime version 2.4.0

*Atmosphere-cdi version 2.4.0

*Java EE 1.7

*Long-polling protocol used

Before explaining my problem, here the global mechanism of chat room I have implemented :

*

*User A is connected to the socket "chat/all". This socket allows to
send ou receive any notifications between him and his interlocutor.

*User A make a chat request from the first web app and wait for
(pop-up spinner) a response from user B.

*User B is also connected to the socket "chat/all". User B check
every time, from the second web app, if there is a new chat request
(SQL request from database). If he found a new request, he can or
not accept this request.

*User B accept chat request from user A. At this moment, throught
socket "chat/all", user B push a message indicate he accepted this
request. After that, user B is connected to the second socket
"chat/1" (random id for specific chat room). He's waiting now
(pop-up spinner like user B) for the user A to be connected to the same
socket.

*User A receive this message and is connect to the socket "chat/1".
From server, user A is now connected to this chat room.
There are two users in this chat room and I broadcast message to
only user B to notify that user A is connected and close pop-up
spinner.
I have no problem when I broadcast message for just one resource. But when I broadcast message for two users, "onMessage" method is called multiple times !
Here's my code about managing chat room :
@ManagedService(path = "/chat/{id_room}")
public final class ChatRoom {

 //many static final private attribute

 private static final Logger logger = LoggerFactory.getLogger(Chat.class);

 @PathParam("id_room")
 private String idChatRoom;

 private final static String CHAT = "/chat/";

 private final HashMap<Integer, List<String>> users = new HashMap<Integer, List<String>>();

 private Universe universe;

 private BroadcasterFactory broadcasterFactory = Universe.broadcasterFactory();

 private AtmosphereResourceFactory resourceFactory = Universe.resourceFactory();

 private ChatMessageEncoderDecoder chatEncodeDecode = new ChatMessageEncoderDecoder();

@Message(encoders = { ChatMessageEncoderDecoder.class }, decoders = { ChatMessageEncoderDecoder.class })
 public final void onMessage(AtmosphereResource r, final ChatMessage message) throws UnsupportedEncodingException {
    Integer chatRoomId = !NOTIFICATION_SOCKET_ALL.equals(idChatRoom) == true ? Integer.parseInt(idChatRoom) : 0;
    [...]
    if(...) {
        [...]
    }
    else {
        roomsList.add(idChatRoom);
        boolean messageEmpty = "".equals(message.getMessage());
        boolean chatConnectedWithTwoUsers = users.get(chatRoomId).size() > 1;
        boolean chatConnectedWithOneUser = users.get(chatRoomId).size() == 1;
            if(chatConnectedWithTwoUsers && MESSAGE_EVENT.equals(message.getEvent())) { //communication between two users to the chat room id
                Users user = CDIUtil.getBean(RechercheUserService.class).getUserChat(message.getMail());
                if(user != null){
                    try {
                        List<String> listUsersFromRoom = users.get(chatRoomId);
                        message.setUsers(listUsersFromRoom);
                        message.setEvent(MESSAGE_EVENT);
                        logger.info("{} a envoyé le message {}", message.getAuthor(), message.getMessage());

                        String messageToSend = chatEncodeDecode.encode(message);
                        broadcasterFactory.lookup(CHAT + idChatRoom).broadcast(messageToSend);

                        String messageUtf8 = new String(message.getMessage().getBytes(), "UTF-8");
                        CDIUtil.getBean(MessageRoomsService.class).createMessageContents(idChatRoom, user, messageUtf8);
                    } catch (IMException e) {
                        message.setEvent(MESSAGE_NOT_REGISTER_EVENT);
                        logger.error("Impossible d'enregistrer le message de l'utilisateur");
                    }
                }
                else{
                    message.setEvent(USER_NOT_EXIST_EVENT);
                    logger.error("Utilisateur Inconnu");
                }
            }
            else if(chatConnectedWithOneUser) { //two users connected to the chat room id
                users.get(chatRoomId).add(r.uuid());
                logger.info("L'utilisateur {} a rejoint le chat {}", r.uuid(), idChatRoom);

                AtmosphereResource resource = resourceFactory.find(users.get(chatRoomId).get(0)); //get the first user connected to the chat room

                List<String> listUsersFromRoom = users.get(chatRoomId);
                message.setUsers(listUsersFromRoom);
                message.setEvent(CHAT_COMPLETE_EVENT);

                String messageToSend = chatEncodeDecode.encode(message);
                broadcasterFactory.lookup(CHAT + idChatRoom).broadcast(messageToSend, resource);
            }
        }
   }
}

So, when broadcast is done, on interface user, there are 3 messages displaying. For example, User A send message "Hello, What can I do for you ?", User B see 3 times this message.
I think there are three messages because three resources are active on two socket. Indeed, the first socket "chat/all" is always active for one resource (user B) and the second socket "chat/1" is active for two resources (user A and user B). There are three resources.
Is there anyone who already face this problem ? Or is there anyone who have an idea about how to fix it ?

A: I had the same problem too..I have resolved reading this link Multiple messages arrive as single response body or message received are incomplete:
I have added to web.xml this init-param inside my Atmosphere Servlet
<init-param>
   <param-name>org.atmosphere.cpr.AtmosphereInterceptor</param-name>
   <param-value>org.atmosphere.client.TrackMessageSizeInterceptor</param-value>
</init-param>

and client-side I have added the trackMessageLength : true inside the request:
var request = { url: document.location.toString() + 'chat',
                contentType : "application/json",
                logLevel : 'debug',
                transport : 'long-polling' ,
                trackMessageLength : true,
                fallbackTransport: 'long-polling'};

As is reported in this link

If you broadcast multiple messages and the underlying server buffer them in memory, your atmopshere.js callback or function can be invoked with multiple messages instead of a single message. It may not be an issue if you are using text, but if you are using JSON the parsing may fail because your callback/function gets invoked with multiple JSON messages.

I hope this will work also for you!


text:
Q: Transfering app after membership expired My membership expired. And I want to trasnfer my app to my new teams account.
It keeps saying I didn't accept master agreement. I saw this topic - What is the Master Agreement when trying to transfer an iOS app? - but I can't seem to find this.
I get lots of warnings that my membership has expired.
Is it required to have active membership in order to transfer? (this would majorly stink, because we did all the payments on the new account)
The super weird part is, I don't have in app purchases in this app. I have no idea why it's doing this to me.

A: Contact developer support from the new account and ask if hey can help. I'm guessing a one time transfer if you know exactly what you need and aren't a pain in the Apple (pita) I could see them handling the transfer or re-activating the old account for a day to effect the transfer.
Seems like you could just scrape together the $100 as you didn't plan ahead as the worst case scenario, but perhaps work with support if you want to keep your $100 and don't mind waiting a bit to convince someone to help you out.
The risk is Apple can't tell you're who you say you are and then they have to deal with an improper transfer of someone else's intellectual property and personal information. If they are open to liability in this request, you'll likely never convince them to transfer and have to walk away from either the renewal fee or the abandoned apps.

A: Emailed them via their support form, got a response yesterday, saying both have to have a active membership. I asked for one time, and they said no. I even had active membership on this account over the last year. :( Apple as the worst customer service. How much will tricking $100 out of me benefit them?

A: I wrote to Apple support (Go to: https://developer.apple.com/contact/ -> App Set Up and Distribution -> App Transfer) and they gave me a 7-day extension of membership to transfer my app.


text:
Q: Optimize SQL query with three SELECT I have the following tables:
news
idNews | title
1      | Title 1
2      | Title 2
3      | Title 3
4      | Title 4

tags
idTag | name
1     | Name_tag1
2     | Name_tag2
3     | Name_tag3
4     | Name_tag4

The MappingTable:
tag_news
idTag | idNews
1     | 1
2     | 1
1     | 2
2     | 2
2     | 3
3     | 3
4     | 3
4     | 4

I want to fetch the title of the related news that have almost one tag in common by giving one idNews. I am be able to do this with three SELECT:
SELECT title FROM news WHERE idNews IN
 (SELECT DISTINCT idNews FROM tag_news
  WHERE idTag IN
  (SELECT idTag FROM tag_news WHERE idNews='$idNews'))

Where $idNews id the ID that I give by parameter.
This works well, but I thought if there is another way to improve the query.
Thanks in advance,
Iker

A: When you program in SQL, you really need to understand joins.  Joins are fundamental to SQL just as a while loop is fundamental to most other programming languages.
SELECT DISTINCT n.title FROM news n
INNER JOIN tag_news t1 ON t1.idNews = n.idNews
INNER JOIN tag_news t2 ON t1.idTag = t2.idTag
WHERE t2.idNews = $idNews;

Start with A Visual Explanation of SQL Joins

Re comments from @Beth:
I don't mean to contradict you, but I'm pretty sure my query is correct, and it doesn't need three joins.  Here's how it works:

*

*t2 is the set of rows in tag_news where t2.idNews=$idNews.  For example, if $idNews=1 then this produces the following rows:
idTag | idNews
1     | 1
2     | 1

*From there, we want all other rows in tag_news that match any of the same tags.  So t1.idTag=t2.idTag.  This produces gives us rows where t1.idTag IN (1,2):
idTag | idNews
1     | 1
2     | 1
1     | 2
2     | 2
2     | 3

*From there, return all the rows in news that match any value of t1.idNews.  In other words, where news.idNews IN (1,2,3).
idNews | title
1      | Title 1
2      | Title 2
3      | Title 3

A: Try:
SELECT distinct title
FROM
tag_news t1  inner join
tag_news t2 on
t1.idnews = t2.idnews inner join
tag_news t3 on
t2.idtag = t3.idtag inner join
news n on
n.idnews = t3.idnews
WHERE t1.idNews='$idNews'

sorry, missed it the first and second times:
CREATE TABLE [dbo].news(
    idnews [int] NOT NULL,
    title [varchar](50) NULL
) ON [PRIMARY]

insert into news(idnews, title) values(1,'title 1')
insert into news(idnews, title) values(2,'title 2')
insert into news(idnews, title) values(3,'title 3')
insert into news(idnews, title) values(4,'title 4')

CREATE TABLE [dbo].tag_news(
    idtag [int] NOT NULL,
    idnews [int] NOT NULL,
) ON [PRIMARY]

insert into tag_news(idtag, idnews) values(1,1)
insert into tag_news(idtag, idnews) values(2,1)
insert into tag_news(idtag, idnews) values(1,2)
insert into tag_news(idtag, idnews) values(2,2)
insert into tag_news(idtag, idnews) values(2,3)
insert into tag_news(idtag, idnews) values(3,3)
insert into tag_news(idtag, idnews) values(4,3)
insert into tag_news(idtag, idnews) values(4,4)

select * from news;
select * from tag_news;

SELECT title FROM news WHERE idNews IN
 (SELECT DISTINCT idNews FROM tag_news
  WHERE idTag IN
  (SELECT idTag FROM tag_news WHERE idNews=1));

SELECT distinct title
FROM
tag_news t1  inner join
tag_news t2 on
t1.idnews = t2.idnews inner join
tag_news t3 on
t2.idtag = t3.idtag inner join
news n on
n.idnews = t3.idnews
WHERE t1.idNews=1;


text: Q: Not Getting users details who are commenting on fb page using graph api Is there any way to get user contact details of who is commenting on my Facebook page post or image...I am using Facebook graph API. Able to get the name and unique id of the user only. Using Facebook page webhook it informs me when anyone comment or like my Facebook page post. If there is any reference or KB, very help full for me.


text:
Q: Rust: How to filter out "None" emissions? My use-case is that I want to scan over an iterator, and yield accumulated values over segments of the original iterator (this is for a tokenizer). In other words, it's not a 1-to-1 mapping between the input values and output values. Note that filter_map() won't work because I do need the accumulator value.
I found .scan(), which is almost what I want:
#![allow(unused)]
fn main() {
    let a = [1, 2, 3];

    let mut iter = a.iter().scan(1, |state, &x| {
        if x == 2 {
            return None;
        }

        // each iteration, we'll multiply the state by the element
        *state = *state * x;

        // then, we'll yield the negation of the state
        Some(-*state)
    });

    println!("{:?}", &iter.next());
    println!("{:?}", &iter.next());
    println!("{:?}", &iter.next());
}

Except that the above outputs
Some(-1)
None
Some(-3)

When I want it to output
Some(-1)
Some(-3)
None

And, despite what you might think, this doesn't work:
        Some(-*state)
    }).filter(|x| x.is_some());

Because I'm not actually iterating over Options:
error[E0599]: no method named `is_some` found for reference `&{integer}` in the current scope
  --> src/main.rs:15:21
   |
15 |     }).filter(|x| x.is_some());
   |                     ^^^^^^^ method not found in `&{integer}`

So it's like iterator methods are intentionally shielded from the "missing yield value" case.
Any ideas how I can a) filter out those missing yields, or b) accomplish the above in some totally different way?

A: You can use filter_map and make your own accumulator in a variable outside the iterator:
fn main() {
    let a = [1, 2, 3];

    let mut state = 1;

    let mut iter = a.iter().filter_map(|&x| {
        if x == 2 {
            return None;
        }

        // each iteration, we'll multiply the state by the element
        state = state * x;

        // then, we'll yield the negation of the state
        Some(-state)
    });

    println!("{:?}", &iter.next()); // Some(-1)
    println!("{:?}", &iter.next()); // Some(-3)
    println!("{:?}", &iter.next()); // None
}

A: Just printing 3 iter.next() should be a very uncommon use case. Mostly one would loop until None or use a function like fuse or collect on the iterator. Each of these functions cuts all results after the first None. So returning None from an iterator means: terminate the iterator.
Consequently you should avoid to terminate the iterator in your scan closure, e.g.
    let mut iter = a.iter().scan(1, |state, &x| {
        if x == 2 {
            return Some(None); // continue, but without value
        }

        // each iteration, we'll multiply the state by the element
        *state = *state * x;

        // then, we'll yield the negation of the state
        Some(Some(-*state)) // continue with value
    }).flatten(); // remove all missing values

or by separating the scan from the filter:
let mut iter = a
    .iter()
    .scan(1, |state, &x| {
      if x == 2 {
        return Some((x, *state));
      }

      // each iteration, we'll multiply the state by the element
      *state = *state * x;

      // then, we'll yield the negation of the state
      Some((x, -*state))
    })
    .filter_map(|(x, state)| if x == 2 { None } else { Some(state) });


text:
Q: Java code for finding non-null values in a column I'm using an ETL program called Talend to process an input file, and at the end of the process I have an automatic email component that will send statistical information about the process to my clients. I want to tell them how many people in their file were flagged as "Lenders" and how many were flagged as "Correspondents", which are listed in two separate columns that are created as a result of a CASE statement. In order to represent those figures, I need to perform a count of all non-null values in those columns.
Is it possible to do this using java?

A: The short answer to your question is:
Yes.
try using the following comparison to determine if a value is non-null
myVariable != null

this returns a boolean (true or false) value and can be used like:
int count = 0;

for(Column column : columns){
    if(column != null && column.getValue() != null){
        count++;
    }
}


text:
Q: UIWebView & ShouldStartLoadWithRequest I have set up an app that uses a UIWebView. The UIWebView is used to display text formatted with CSS. In the text are links (a href=...). The format of the href is like this: tags.tagname
When a user clicks a link, I'd like to intercept the request and use loadHTMLString based on the contents of the HREF.
I have successfully parsed the URL, but I'm stymied on how to tell the webview to not load the requested href and load the string I want instead.
I've tried the following within ShouldStartLoadWithRequest:
genHTML=[self genTagPage:parsedString]; // a string declared earlier
[self.noteHTML loadHTMLString:genHTML baseURL:nil];
return NO;

But when the code is executed, I receive the following error:
2011-04-19 22:39:21.088 TestApp[27026:207] *** -[_PFArray release]: message sent to deallocated instance 0xaa3cf40

genHTML is getting populated with the right data, so I'm at a loss as to how to proceed.
Thanks.

A: It sounds like you just need to prevent the default action for the link like the following:
<a href="somewhere.html" onClick="doSomething(); return false">

Check out quirksmode for more details.
Edit:
Re-read your original code, and it would seem you've got an infinite loop going on.  shouldStartLoadWithRequest gets called once when they click on the link, then infinitely on your loadHTMLString line.  Making the call conditional on the navigationType should fix your problem:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    if(navigationType==UIWebViewNavigationTypeLinkClicked)
    {
        genHTML=[self genTagPage:parsedString]; // a string declared earlier
        [self.noteHTML loadHTMLString:genHTML baseURL:nil];
        return NO;
    }
    return YES;
}


text:
Q: Does fireplace screen work as Faraday Shield? I have never thought about it before as I got house with chimney just recently. And I have noticed, that simple metallic fireplace screen (which made as metallic grill/lattice) screens a really significant part of warm. At the same time it doesn't become hot.
I'm wondering, does it because it works as Faraday shield and screens in this way Thermal radiation, which is essentially is electromagnetic radiation, or I'm totally wrong?

UPD: besides simple measurement of temperature in the room, I've made some experiment: I've measured heating of black circle on paper, hanged on same distance from fireplace with screen and without (of course there were two similar papers, not same one). I've measured heating using infrared thermometer. It shown me that with screen heating was only 1 Celsius degree on 2 minutes, while without screen - almost 3.5. Is it because of absorption/reflection?

A: The wavelength of infrared is far too small to make the screen work as a Faraday shield.  Instead, the individual wires cast shadows.  The overall coverage does not seem all too large, however, so I don't expect much more than 10% to be absorbed/reflected.  The grid, however, will provide a convection barrier for hot air.
So you have a layer of hot air and a layer of colder air starting with the grid.  The transition to a more dense medium causes a certain amount of reflection to occur at the border.
For a similar reason one put radiators below single-pane windows: the layering of the moving sheet of warm air before the comparatively static cold air at the glass reflects warmth back into the room.

A: Photons from the fire are not coherent, and their e-field does not re-inforce - the e-field transitions are around the waveleght of the blackbody radiation from the fire - around 50$\mu$m depending on temperature. There will be electron displacement, but the magnitude is much smaller and less coherent than normally described in relation to the Faraday Shield. Microwaves and radio waves have much longer wavelength at least 1mm.
Three means of transmission of heat; conduction, convection and radiation. Your fireplace uses all three to some extent. Colour has an impact on radiation absorption, black absorbing most.


text:
Q: How do you get the kernel config to compile a new kernel? I have patched several kernels in the past with GRsec but have always been able to find the config under /boot. This is a OVH box but I can't find any config located anywhere.
Is there a way to get the config or how do I compile a kernel blind without a prebuilt config?
Linux astro.srv.com 3.14.32-xxxx-grs-ipv6-64 #9 SMP Thu Oct 20 14:53:52 CEST 2016 x86_64 GNU/Linux

This is a Debian 8 machine.

A: You can download the .config file from here
wget ftp://ftp.ovh.net/made-in-ovh/bzImage/3.14.32/config-3.14.32-xxxx-grs-ipv6-64

A: I found out that you can do the following:
cp /proc/config.gz ~
gunzip config.gz
cp config ~/linux*/.config


text:
Q: Getting decimal from listbox sentence, then adding that decimal to a variable I have a method where I click on a button, and then it gets the sentence inside a listbox in the form of:
Person A made an appointment for $45 (for example)

The following code is executed when the button is clicked:
decimal totalAppointments
private void btnMakeAppointment_Click(object sender, RoutedEventArgs e)
            {
                string selectedListboxSentence;
                selectedListboxSentence= lstAppointments.SelectedItem.ToString();
                totalAppointments += GetPrice(selectedListboxSentence);

}

private decimal GetPrice(string selectedItem)
        {
            return decimal.Parse(selectedItem.Split(" ").Last().Substring(1));
        }

And when all is said and done, the amount in dollars gets added to a counter:
 "Appointments made for a total of $...."

This works fine for round numbers, but when there's a comma involved, the program crashes when trying to add it to the counter of total appointments made. How do I resolve this? Thanks.

A: Parsing real world text is tricky!
Fortunately, the .NET team have implemented handling for many of the common circumstances, such as conventional currency formats. The built-in decimal.Parse() has an overload that accepts NumberStyles as the second argument, used like so:
decimal value = decimal.Parse("$1,200.00", System.Globalization.NumberStyles.Currency)

The NumberStyles argument specifies accepted number patterns, such as if currency symbols or group separators are allowed, but not what or where they should be. By default the current system culture is used, in my case US English, but this can be overridden with one of the IFormatProvider methods:
var culture = System.Globalization.CultureInfo.GetCultureInfo("ja-JP");
decimal value = decimal.Parse("¥800", System.Globalization.NumberStyles.Currency, culture);

You may find that none of the default cultures match what you need, for example if a country recognizes two currencies. For this you can create a custom CultureInfo to support the second currency:
var culture = new System.Globalization.CultureInfo("en-GB");
culture.NumberFormat.CurrencySymbol = "€";
decimal value = decimal.Parse("€3.50", System.Globalization.NumberStyles.Currency, culture);

A: Try to use Decimal.TryPare
if (Decimal.TryParse(lstAppointments.SelectedItem.ToString(), NumberStyles.AllowCurrencySymbol, CultureInfo.CurrentCulture, out number)) totalAppointments += number;