text:
Q: How to plot the markers which are stored in an ArrayList by a button click? The markers are put on the map by the user and they get stored in an ArrayList that is stored using SQLite. The markers are shown below.

When the user clicks on View, the data is recovered as below.

When the user clicks on Update Button the all the markers on the View should get plotted on the Map. How and what code should i use to plot the values that are in the ArrayList (LatLongposition)?
How do i plot the ArrayList (LatLongposition) on Map Marker?
private void UpdatData() {
    btnUpdate.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //LatLongPosition is a object of the ArrayList
            boolean isUpdate = myDb.updateData(id.getText().toString(), LatLongPosition);
            PolylineOptions polylineOptions = new PolylineOptions().addAll(LatLongPosition);
            Polyline p = GoogleMap.addPolyline(polylineOptions);
            p.setPoints(LatLongPosition);
            /*if (marker1 == null) {
                marker1 = GoogleMap.addMarker(new MarkerOptions()
                                .position(p)
                                .title("Start Position")
                                .snippet(String.valueOf(googleMap.getCameraPosition()))
                                .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE))
                );*/
            if (isUpdate == true)
                Toast.makeText(ActivityMapDisplay.this, "Data Updated", Toast.LENGTH_SHORT).show();
            else
                Toast.makeText(ActivityMapDisplay.this, "Data Not Updated", Toast.LENGTH_SHORT).show();

        }
    });
}

A: You just need to iterate over your List:
for (LatLng position : LatLongPosition) {
    GoogleMap.addMarker(new MarkerOptions()
            .position(position)
            .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)));
}

Anyway, take into account that you must follow code conventions, and variable names must begin with a lowercase character. Thus your GoogleMap must be named googleMap and your LatLongPosition variable must be named latLongPosition.


text:
Q: Is it possible to have an element's opacity carry through other elements to the background; like a window? I was imagining having boxes with a fixed position start at the bottom of the page over the background. Their opacity is set at .8 and they will stay fixed to the bottom of the page until they are scrolled onto the white background further down the page. Even though they're passing over this new white background, I still want to see the original background through the boxes as they scroll over the white. Is this at all possible?

A: [For a non-fixed non-scaled background image]
If I'm understanding correctly, the effect you are looking for is basically for the boxes to show a view through the white boxes and display the background of the page.  While this can't actually be done with just css, it can be simulated with javascript.
The basic idea is to set the background of the boxes to the same background as the page and then adjust their background positions to match their location on the page.
http://jsfiddle.net/o6z18o7e/1

$(function(){
    $(window).scroll(function(){
        $(".box").each(function(){
            var $this = $(this);
            var pos = $this.offset();

            $this.css("background-position", (pos.left * -1) + "px " + (pos.top * -1) + "px");
        });
    }).scroll();
});
body{
    background: url(http://placekitten.com/1000/3000);
    margin: 0;
    padding: 0;
}
.box{
    border: 3px solid gray;
    width: 100px;
    height: 100px;
    position: fixed;
    background: url(http://placekitten.com/1000/3000);
}
.content-box{
    margin-top: 300px;
    background-color: white;
    height: 300px;
}

A: I am adding a separate answer here because I believe the first may be useful to others, so I'd rather not remove it.  However, in comments the requirements of the question were further refined.
[For a fixed background]
With the background position of the body's background being fixed, it is actually much simpler.  You can simply add an inner div that has the same background properties as the body.  Pure css, no js needed.  It even works with background scaling with window size.
http://jsfiddle.net/6feraj7p/3/

body, .bg {
 background: url('http://www.junoon.co/sw-store/images/wallpapers/urdu.co-34163121.jpg') no-repeat center center fixed;
 -webkit-background-size: cover;
 -moz-background-size:cover;
 -o-background-size:cover;
 background-size: cover;
    overflow-x: hidden;
}
.longBox {
 height: 100vh;
 margin-top: 100vh;
 background-color: #FFFFFF;
 text-align: center;
 background-size: 100%;
 margin-right: -3000px;
 padding-right: 3000px;
 margin-left:  -3000px;
 padding-left:  3000px;
}
#propertyButton {
 bottom: 10px;
 border-bottom-left-radius: 10px;
 border-bottom-right-radius: 10px;
 border-top-right-radius: 10px;
 border-top-left-radius: 10px;
 background-size: 100%;
 position: fixed;
}
.button{
    border: 3px solid gray;
    height: 35vh;
 width: 35vh;
    position: fixed;
    overflow: hidden;
}
.bg{
    height: 100%;
    width: 100%;
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: When a function has a specific-size array parameter, why is it replaced with a pointer? Given the following program,
#include <iostream>

using namespace std;

void foo( char a[100] )
{
    cout << "foo() " << sizeof( a ) << endl;
}

int main()
{
    char bar[100] = { 0 };
    cout << "main() " << sizeof( bar ) << endl;
    foo( bar );
    return 0;
}

outputs
main() 100
foo() 4

*

*Why is the array passed as a pointer to the first element?

*Is it a heritage from C?

*What does the standard say?

*Why is the strict type-safety of C++ dropped?

A: Yes it's inherited from C.  The function:
void foo ( char a[100] );

Will have the parameter adjusted to be a pointer, and so becomes:
void foo ( char * a );

If you want that the array type is preserved, you should pass in a reference to the array:
void foo ( char (&a)[100] );

C++ '03 8.3.5/3:

...The type of a function is determined using the following rules. The type of each parameter is determined from its own decl-specifier-seq and declarator. After determining the type of each parameter, any parameter of type "array of T" or "function returning T" is adjusted to be "pointer to T" or "pointer to function returning T," respectively....

To explain the syntax:
Check for "right-left" rule in google; I found one description of it here.
It would be applied to this example approximately as follows:
void foo (char (&a)[100]);

Start at identifier 'a'

'a' is a

Move right - we find a ) so we reverse direction looking for the (.  As we move left we pass &

'a' is a reference

After the & we reach the opening ( so we reverse again and look right.  We now see [100]

'a' is a reference to an array of 100

And we reverse direction again until we reach char:

'a' is a reference to an array of 100 chars

A: Yes. In C and C++ you cannot pass arrays to functions. That's just the way it is.
Why are you doing plain arrays anyway? Have you looked at boost/std::tr1::array/std::array or std::vector?
Note that you can, however, pass a reference to an array of arbitrary length to a function template. Off the top of my head:
template< std::size_t N >
void f(char (&arr)[N])
{
  std::cout << sizeof(arr) << '\n';
}

A: There is magnificent word in C/C++ terminology that is used for static arrays and function pointers - decay.
Consider the following code:
int intArray[] = {1, 3, 5, 7, 11}; // static array of 5 ints
//...
void f(int a[]) {
  // ...
}
// ...
f(intArray); // only pointer to the first array element is passed
int length = sizeof intArray/sizeof(int); // calculate intArray elements quantity (equals 5)
int ptrToIntSize = sizeof(*intArray); // calculate int * size on your system


text:
Q: Convert builtin function type to method type (in Python 3) Consider a simple function like
def increment(self):
    self.count += 1

which is run through Cython and compiled into an extension module.  Suppose now I'd like to make this function a method on a class.  For example:
class Counter:
    def __init__(self):
        self.count = 0

from compiled_extension import increment
Counter.increment = increment

Now this will not work, as the calling convention at the C level will be broken. For example:
>>> c = Counter()
>>> c.increment()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: increment() takes exactly one argument (0 given)

But in Python 2, we can convert the function to an unbound method by doing:
Counter.increment = types.MethodType(increment, None, Counter)

How can I accomplish this same thing in Python 3?
One simple way is to use a slim wrapper:
from functools import wraps
def method_wraper(f):
    def wrapper(*args, **kwargs):
        return f(*args, **kwargs)
    return wraps(f)(wrapper)

Counter.increment = method_wrapper(increment)

Is there a more efficient way to do it?

A: First thing is getting the names correctly:
>>> def increment(obj):
...     obj.count += 1
...
>>> class A(object):
...     def __init__(self):
...         self.count = 0
...
>>> o = A()
>>> o.__init__
<bound method A.__init__ of <__main__.A object at 0x0000000002766EF0>>
>>> increment
<function increment at 0x00000000027797C8>

So proper names are functions and bound methods. Now you can look for how to Bind an Unbound Method and you will probably end up reading about descriptors:

In general, a descriptor is an object attribute with "binding
  behavior", one whose attribute access has been overridden by methods
  in the descriptor protocol. Those methods are __get__, __set__, and
  __delete__. If any of those methods are defined for an object, it is said to be a descriptor.

You can easily transform function to method by just using different invocation of __get__
>>> increment.__get__(None, type(None))
<function increment at 0x00000000027797C8>
>>> increment.__get__(o, type(o))
<bound method A.increment of <__main__.A object at 0x00000000027669B0>>

And it works like a charm:
>>> o = A()
>>> increment.__get__(None, type(None))(o)
>>> o.count
1
>>> increment.__get__(o, type(o))()
>>> o.count
2

You can easily add these newly bounded methods to objects:
def increment(obj):
    obj.count += 1

def addition(obj, number):
    obj.count += number

class A(object):
    def __init__(self):
        self.count = 0

o = A()
o.inc = increment.__get__(o)
o.add = addition.__get__(o)
print(o.count) # 0
o.inc()
print(o.count) # 1
o.add(5)
print(o.count) # 6

Or create your own descriptor that will will convert function to bound method:
class BoundMethod(object):
    def __init__(self, function):
        self.function = function

    def __get__(self, obj, objtype=None):
        print('Getting', obj, objtype)
        return self.function.__get__(obj, objtype)

class B(object):
    def __init__(self):
        self.count = 0

    inc = BoundMethod(increment)
    add = BoundMethod(addition)

o = B()
print(o.count) # 0
o.inc()
# Getting <__main__.B object at 0x0000000002677978> <class '__main__.B'>
print(o.count) # 1
o.add(5)
# Getting <__main__.B object at 0x0000000002677978> <class '__main__.B'>
print(o.count) # 6

And you also can see that this is nicely consistent with function/bound method principles:

Class dictionaries store methods as functions. In a class definition, methods are written using def and lambda, the usual tools for creating functions. The only difference from regular functions is that the first argument is reserved for the object instance. By Python convention, the instance reference is called self but may be called this or any other variable name.
To support method calls, functions include the __get__() method for binding methods during attribute access. This means that all functions are non-data descriptors which return bound or unbound methods depending whether they are invoked from an object or a class.

And functions becomes bound method during instance initialization:
>>> B.add
# Getting None <class '__main__.B'>
<function addition at 0x00000000025859C8>
>>> o.add
# Getting <__main__.B object at 0x00000000030B1128> <class '__main__.B'>
<bound method B.addition of <__main__.B object at 0x00000000030B1128>>

A: Import the extension like this:
import compiled_extension

In your class you write:
def increment: return compiled_extension.increment()

This seems more readable and might be more efficient.


text:
Q: Problemas con Android Leer data/data/com.****/database tengo un gran problemas, y es poder leer el archivo /data/data/com./databases/.db, el celular lo tengo con ROOT, busque en todo los foros y tengo agregado
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />

Pensando que si ya tiene el permiso de administrador deberia ller todo los datos, pero no al momento de copiar me dice "Permiso denegado"
try {
      File sd = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS);
      File data = Environment.getDataDirectory();

      if (sd.canWrite()) {
          String currentDBPath = "/data/data/com.***/databases/***.db";

          String backupDBPath = "data.db";

          File currentDB = new File(currentDBPath);
          File backupDB = new File(sd, backupDBPath);

          if (currentDB.exists()) {
               FileChannel src = new FileInputStream(currentDB).getChannel();
               FileChannel dst = new FileOutputStream(backupDB).getChannel();
               dst.transferFrom(src, 0, src.size());
               src.close();
               dst.close();
          }
      }
} catch (Exception e) {
      System.out.println("Error : "+e.getMessage());
}

Tambien probe con comando adb:
try {

            /*String fine = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)+"/msgstore.db";

            Runtime.getRuntime().exec(new String[]{"su","run-as com.whatsapp cat /data/data/com.whatsapp/databases/msgstore.db"
            }).waitFor();

            Toast.makeText(application,"Finalizo.", Toast.LENGTH_LONG).show();*/

            Runtime.getRuntime().exec(new String[]{"su","-c",
                    "mount -o rw,remount /system",
                    "chmod 777 /data/data/com.*****/databases/*.*" ,
                    "cp /data/data/com.*****/databases/***.db /sdcard/respaldo.db",

                    "mount -o ro,remount /system"
            }).waitFor();

            File currentDB = new File("/sdcard/respaldo.db");
            if (currentDB.exists()) {
                Toast.makeText(application,"El archivo existe", Toast.LENGTH_LONG).show();
            }else{
                Toast.makeText(application,"El archivo no existe", Toast.LENGTH_LONG).show();
            }

        } catch (InterruptedException e) {
            Toast.makeText(application,"Error : "+e.getMessage(), Toast.LENGTH_LONG).show();
        }

Y el error fue que las direcciones no existen, si existen las comprobé, alguien ayúdeme por favor

A: NO olvidar agregar el permiso para poder LEER/escribir en el almacenamiento externo:
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Si el sistema operativo es Android 6.0 o posterior, tienes que requerir permisos manualmente.
Error al mostrar el directorio externo de archivos en android 6.0 (READ_EXTERNAL_STORAGE / WRITE_EXTERNAL_STORAGE )

El permiso <uses-permission android:name="android.permission.ACCESS_SUPERUSER" /> me parece que es obsoleto desde android 5.0
Si deseas leer tu base de datos desde el dispositivo, lo puedes realizar desde la misma aplicación, en este caso define el nombre de la base de datos y obtendrás la ruta:
String pathDB = getDatabasePath(NOMBRE_DATABASE).toString();

En este caso no necesitas un dispositivo "Rooted", lo que necesitas es copiar la base de datos ubicada en el almacenamiento interno a un directorio en el externo, el procedimiento se explica aquí:
¿Como copiar una base de datos Sqlite o archivo desde el almacenamiento interno al externo?


text:
Q: Bitmap Heap Scan performance I have a big report table. Bitmap Heap Scan step take more than 5 sec.
Is there something that I can do? I add columns to the table, does reindex the index that it use will help?
I do union and sum on the data, so I don't return 500K records to the client.
I use postgres 9.1.
Here the explain:
 Bitmap Heap Scan on foo_table  (cost=24747.45..1339408.81 rows=473986 width=116) (actual time=422.210..5918.037 rows=495747 loops=1)
   Recheck Cond: ((foo_id = 72) AND (date >= '2013-04-04 00:00:00'::timestamp without time zone) AND (date <= '2013-05-05 00:00:00'::timestamp without time zone))
   Filter: ((foo)::text = 'foooooo'::text)
   ->  Bitmap Index Scan on foo_table_idx  (cost=0.00..24628.96 rows=573023 width=0) (actual time=341.269..341.269 rows=723918 loops=1)

Query:
explain analyze
SELECT CAST(date as date) AS date, foo_id, ....
from foo_table
where foo_id = 72
and date >= '2013-04-04'
and date <= '2013-05-05'
and foo = 'foooooo'

Index def:
Index "public.foo_table_idx"
   Column    |            Type
-------------+-----------------------------
 foo_id      | bigint
 date        | timestamp without time zone

 btree, for table "public.external_channel_report"

Table:
foo is text field with 4 different values.
foo_id is bigint with currently 10K distinct values.

A: Create a composite index on (foo_id, foo, date) (in this order).
Note that if you select 500k records (and return them all to the client), this may take long.
Are you sure you need all 500k records on the client (rather than some kind of an aggregate or a LIMIT)?

A: Answer to comment

Do i need the where columns in the same order of the index?

The order of expressions in the WHERE clause is completely irrelevant, SQL is not a procedural language.
Fix mistakes
The timestamp column should not be named "date" for several reasons. Obviously, it's a timestamp, not a date. But more importantly, date it is a reserved word in all SQL standards and a type and function name in Postgres and shouldn't be used as identifier.
You should provide proper information with your question, including a complete table definition and conclusive information about existing indexes. I might be a good idea to start by reading the chapter about indexes in the manual.
The WHERE conditions on the timestamp are most probably incorrect:
and date >= '2013-04-04'
and date <= '2013-05-05'

The upper border for a timestamp column should probably be excluded:
and date >= '2013-04-04'
and date <  '2013-05-05'
Index
With the multicolumn index @Quassnoi provided, your query will be much faster, since all qualifying rows can be read from one continuous data block of the index. No row is read in vain (and later disqualified), like you have it now.
But 500k rows will still take some time. Normally you have to verify visibility and fetch additional columns from the table. An index-only scan might be an option in Postgres 9.2+.
The order of columns is best this way, because the rule of thumb is: columns for equality first — then for ranges. More explanation and links in this related answer on dba.SE.
CLUSTER / pg_repack
You could further speed things up by streamlining the table according to this index, so that a minimum of blocks have to be read from the table - if you don't have other requirements that stand against it!
If you want it faster, yet, you could streamline the physical order of rows in your table. If you can afford to lock your table exclusively for a few seconds (at off hours for instance) to rewrite your table and order rows according to the index:
ALTER TABLE foo_table CLUSTER ON idx_myindex_idx;

If concurrent use is a problem, consider pg_repack, which can do the same without exclusive lock.
The effect: fewer blocks need to be read from the table and everything is pre-sorted. It's a one-time effect deteriorating over time, if you have writes on the table. So you would rerun it from time to time.
I copied and adapted the last chapter from this related answer on dba.SE.


text:
Q: I'm confused about COM and cross-platform compatibility I'm having an issue determining which technologies to use in a cross-platform environment. Here's my thoughts so far.

*

*Java is a fine programming language, although I'm not very used to it. And since I prefer having access to things like Linq, delegates and so on that I have gotten used to in C#, I would rather not use it that much. I'm also not a huge fan of how Beans work compared to User Controls.

*C# is my preferred language. I love it, and I would call myself an expert within the field (not an expert within COM obviously though).

*C++ is a city in Russia to me. I feel like I'm walking blind when using this programming language, and that things take longer to make compared to C#.
I am making a backup system for a 4 week school project. However, I have greater intentions for it in the future. And for a backup system to succeed, it must have cross-platform compatibility.
So if I made a Class Library in C# .NET COM visible, and used that COM within a Java project containing a GUI, would the whole application still work cross-platform?

A: COM is a microsoft technology, it is not cross platform.
You could use C# and the mono project to give you cross-platform deployment.
http://www.mono-project.com/Main_Page

A: Theoretically COM is cross platform but in implementation it depend on Windows. And beside it making a .NET assembly COM visible does not make it independent from .NET runtime(CLR) so you depend on both .NET(for your assembly) and Windows(for COM). But there are implementation for both COM and .NET there is POSIX implementations. AFAIK for .NET there is runtime named Mono that can installed on iOS, Android and POSIX but for school project I don't think that your teacher accept it as cross platform, so you should use Java or C++ that are cross platform in nature (Java is runtime compatible and C++ is source code compatible).

A:
I am making a backup system for a 4 week school project. However, I have greater intentions for it in the future. And for a backup system to succeed, it must have cross-platform compatibility.

My advice would be to focus exclusively on the goal of getting the 4 week school project done.  Don't add unnecessary complexity (such as cross-platform support) that might derail your project.  Use the (applicable) technology that you are most comfortable with right now.
Once you've finished your course, by all means revisit the project and try to turn it into something bigger / better / more saleable / whatever.
(We can all dream of being the next Bill Gates, but do you seriously think that you will get rich and/or famous with yet another backup program? )


text:
Q: Is Marketing Cloud Custom activity save() method supported by other programming language, like Java, pathon, other than Node.js? Since SFMC SMS/MMS service isn't available in some countries other than the U.S, we have to build our own custom activity within marketing cloud for SMS/MMS sending by calling out 3rd party SMS/MMS sending service.
As we learned, save() function is used for saving custom app configurations by sending data from custom app to salesforce marketing cloud. However, this save() function can only be invoking by using Node.js programming method. Regarding this fact, we have two questions need clarification from your side:
1. Is this save() method supported by other web programming language, like Java, pathon?
2. If other programming languages are not supported, can we execute Node.js SDK from the front-end, instead of executing it from the background?

A: Custom Activities can be written in any language or framework. They are certainly not limited to Node.js. There are two options for retrieving save data.
Save Endpoint
Journey Builder will make a request with the Activity parameters to the save URL defined in the configurationArguments object in your config.json file
Postmonger Event
Journey Builder uses Postmonger for cross-domain messaging between Journey Builder and the Custom Activity interface (displayed in an iframe on the Journey Canvas). this a lightweight Javascript utility (not Node.js) which should be able to be used with most application frameworks.
When a Custom Activity is added to the Journey Canvas, default values for arguments, configurationArguments and metaData are loaded from the Activity's config.json file. Any subsequent loading of a Custom Activity's configuration interface will load the data from the Activity's model. As the data is sent to the Custom Activity's configuration interface each time it is loaded, the entire object should be sent as a payload when the Custom Activity is saved.
The updateActivity event is called when the Custom Activity iframe needs to close and data from the Custom Activity interface needs to be saved. This event expects an Activity definition payload to be passed.
The toJbPayload parameter should be set to the payload received on initActivity and modified based on user inputs in the Custom Activity interface.
The parameter toJbPayload.metaData.isConfigured must be set to true for Journey Builder to recognize that the activity is fully configured (when the Journey is published).
var toJbPayload = {};
toJbPayload.metaData.isConfigured = true;
connection.trigger('updateActivity', toJbPayload);

SMS Alternative in Marketing Cloud
Before you run off and build your own SMS integration, I would encourage you to contact Pierry as they have built a HubExchange app for Marketing Cloud (with an interface very similar to MobileConnect). In APAC, Salesforce recommends Pierry's solution for countries where MobileConnect is not supported.


text:
Q: Deploying Spring PetClinic Microservices to AWS In the process of learning AWS, I decided to try and deploy spring petclinic microservice app build on top of the spring cloud netflix technology stack taken from here
https://github.com/spring-petclinic/spring-petclinic-microservices
But, the more I read about AWS I wonder if it makes sense. My understanding is that AWS offers most of the services like discover, gateway, load balancing natively. Is this correct?
If so, how would one go about deploying spring petclinic to AWS in a meaningful way?

A: Your question totally makes sense.
Netflix OSS was developed in a period of time where Container orchestration's maturity was not the one we know nowadays. Today, with Kubernetes, services like EKS (for AWS, Kubernetes Engine for GCP, AKS for Azure) and a lot of new services and requirements, we have a lot more of stuff to deal with.
For instance, the first problem that the Netflix OSS solves, the Service Discovery, requires Eureka server. If we think at a IaaS world, it totally makes sense: we need a block, in our architecture, that knows about all the services in our system. If we think to a system that uses containers and orchestrators, such as Kubernetes, we realize that K8S already offers funcionalities like the one that Eureka offers. With this in mind, it results clear that adding a pod in our K8S cluster just to serve Eureka server would be a total waste of resources. We can then rely on the underlying platform.
With this consideration (and a lot more), Spring Cloud project has evolved, becoming more of a standardization incubator, with a lot of implementations. I'll give you some examples and I'll also give you a complete list of Netflix OSS equivalents:

*

*Eureka, for Service Discovery. We can use Kubernetes's API Server for this, so we can switch to Spring Cloud Kubernetes

*Hystrix, the Circuit Breaker. Spring Cloud Circuit Breaker is the new project for this. It is an abstraction, and can uses some implementations, such as Hystrix itself, but also Resilience4J, that I kindly suggest, or Sentinel

*Feign, as REST Client. There is a new implementation, outside the Netflix stack: Spring Cloud OpenFeign

*Ribbon, for a client side load balancing. You can switch to Spring Cloud LoadBalancer

*Config. This is pretty nice, because we have the Spring Cloud Config project, but if we add the Spring Cloud Kubernetes dependency we can also rely on K8S's ConfigMaps and Secrets for this, and Spring Cloud Config automatically uses them

*Zuul, the router and gateway. You can migrate to Spring Cloud Gateway, and it is already integrated with all the new projects

--EDIT--
Forgot to mention: when you are using a PaaS, you can stick to a lot of services. An example could be AWS API Gateway. Have a look at this page for a full list of Spring Cloud project. A lot of them adds support and integration to basically almost every PaaS.


text:
Q: THREE JS draw line as a child of object pointing to Vector non related with object or parents I have scene with objects as a parent /child.
I need to define a Vector3 relative to (deepest) child object which pointing on vector in scene (look_point).
var grandParent = new THREE.Object3D();
var parent = new THREE.Object3D();
var child= new THREE.Object3D();

var look_point = new THREE.Vector3();

grandParent.position.set(9,5,3);
grandParent.rotation.set(1,2,3);

parent.position.set(5,8,3);
parent.rotation.set(2,1,3);

child.position.set(2,5,3);
child.rotation.set(3,2,1);

scene.add(grandParent);
grandParent.add(parent);
parent.add(child);

var m = new THREE.LineBasicMaterial({ color: 0xFF00FF, blending: THREE.AdditiveBlending,  transparent: true, opacity: 1, depthTest: false })

/// draw line in scene
var v = new THREE.Vector3().copy(child.position);
    v = parent.localToWorld(v);
    v = grandParent.localToWorld(v);

var g = new THREE.Geometry();

    g.vertices.push(new THREE.Vector3().copy(v));
    g.vertices.push(new THREE.Vector3().copy(look_point));

scene.add(new THREE.Line(g,m));

// how to get relative points to draw line with child object as a parent

var g2 = new THREE.Geometry();

    g2.vertices.push(???); //// how to get Vector3 relative to child pos and rot?
    g2.vertices.push(new THREE.Vector3());

child.add(new THREE.Line(g2,m));

A: If look_point is in world frame then you'll want to transform the points into the local coordinate frame of the child.
You can use the Object3D.worldToLocal function to achieve this. Here's a rough idea of how:
// ensure the world matrices are all up to date
scene.updateMatrixWorld(true);

g2.vertices.push(child.worldToLocal(new THREE.Vector3().copy(v)));
g2.vertices.push(child.worldToLocal(new THREE.Vector3().copy(look_point)));
child.add(new THREE.Line(g2,m));

It's important to ensure that all the world matrices have been calculated ahead of time. Let me know if that works out for you!


text:
Q: AKKA HTTP PathMatcher simplify Many of you seen this thing:
val route: Route = get {
  pathPrefix("hello" / String) { name =>
    pathEndOrSingleSlash {
      complete(s"Hello! $name")
    }
  }
}

i want a little simplify it, like this:
val route: Route = get {
  pathWithEndOrSlash("hello" / String) { name =>
    complete(s"Hello! $name")
  }
}

how i can do this?


text:
Q: How to use embedding_column with BoostedTreesClassifier I am learning the GBDT example on the tensorflow official website:https://www.tensorflow.org/tutorials/estimator/boosted_trees?hl=en
The example on the official website is one-hot processing of classification features.
But I want to convert discrete features into dense vectors through embedding. In the process, I encountered an unsolvable problem.
The following code is an example from the official website.
CATEGORICAL_COLUMNS = ['sex', 'n_siblings_spouses', 'parch', 'class', 'deck',
                       'embark_town', 'alone']
NUMERIC_COLUMNS = ['age', 'fare']

def one_hot_cat_column(feature_name, vocab):
return tf.feature_column.indicator_column(tf.feature_column.categorical_column_with_vocabulary_list(feature_name,vocab))

for feature_name in CATEGORICAL_COLUMNS:
    vocabulary = dftrain[feature_name].unique()
    feature_columns.append(one_hot_cat_column(feature_name, vocabulary))

for feature_name in NUMERIC_COLUMNS:
    feature_columns.append(tf.feature_column.numeric_column(feature_name,dtype=tf.float32))

But when I change the'indicator_column' to'embedding_column' and run the'boostedtreeclassifier', an error is reported.
def embedding_column(feature_name,vocab):
return tf.feature_column.embedding_column(categorical_column=tf.feature_column.categorical_column_with_vocabulary_list(
                                          feature_name,vocab),dimension=4,combiner='sum')
feature_columns = []
for feature_name in CATEGORICAL_COLUMNS:
    vocabulary = dftrain[feature_name].unique()
    feature_columns.append(embedding_column(feature_name,vocabulary))

for feature_name in NUMERIC_COLUMNS:
    feature_columns.append(tf.feature_column.numeric_column(feature_name,
                                           dtype=tf.float32))

Next, I have not made any changes to the data input method of the official website.
NUM_EXAMPLES = len(y_train)
def make_input_fn(X,y,n_epochs=None,shuffle=True):
    def input_fn():
        dataset = tf.data.Dataset.from_tensor_slices((dict(X),y))
        if shuffle:
            dataset = dataset.shuffle(NUM_EXAMPLES)
        dataset = dataset.repeat(n_epochs)
        dataset = dataset.batch(NUM_EXAMPLES)
        return dataset
    return input_fn

Then I start to initialize the model and train, and an error will be reported here.
n_batches = 1
est = tf.estimator.BoostedTreesClassifier(feature_columns,n_batches_per_layer=n_batches)
train_input_fn = make_input_fn(dftrain,y_train)

est.train(train_input_fn,max_steps=100)

The above says: '# NOTE: GBDT requires that all DenseColumns expose a dtype attribute.'
'AttributeError:'EmbeddingColumn' object has no attribute'dtype''.
I use 'estimator.LinearClassifier' and there is no problem, but when I use 'tf.estimator.BoostedTreesClassifier', this problem occurs.
enter image description here


text:
Q: Как получить пути ко всем домашним каталогам всех пользователей? Мне необходимо получить пути всех домашних каталогов пользователей.В принципе можно отталкиваться от того, что они лежат в /home/, но путь пользователя root находится в /root. Возможно есть какой-нибуть универсальный способ?
A: В /etc/passwd же всё написано, не устраивает такой вариант?


text:
Q: Did the Spider-man arcade game give Submariner abilities he doesn't have in the comics? In the Spider-Man arcade game made and released in the early 90's, players have the option of playing a character called Prince Namor, also known as Submariner (basically either Marvel's counter to DC's Aquaman or the other way around).
In the game Namor can, as a special attack, shoot what looks like lightning from either his hands or bands on his wrists (it's kind of hard to tell), but I haven't found him doing this in any other depictions of him- does he only have this particular ability in the video game?

A: No. Namor has had the ability to shoot electricity "like the electric eel" for about sixty years.

This site claims the first showing was in Fantastic Four #6, the aforementioned assault on Doctor Doom.
Sadly, I see no mention of the game using his power to swell up like a puffer fish. No doubt that was being held out for the sequel.


text:
Q: How to handle com.android.volley.NoConnectionError: java.net.UnknownHostException I am using Volley for webcalls in my application and everything is working fine and smooth except one state in which somehow my device is not getting Network Connection but checking connection via code is returning true using below code.
public static boolean isNetworkAvailable() {

    ConnectivityManager connectivityManager = SessionApplication.getConnectivityManager();
    if(connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED ||
            connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED) {
        //we are connected to a network
        return true;
    }
    else
        return false;
}

Instead of returning network state false using above code My volley web calls returning me this exception "handle com.android.volley.NoConnectionError: java.net.UnknownHostException".
I checked my internet connection by opening browser in my device and found it is also not working. So i am okay with application behavior but still i need to handle such condition because this is not user friendly user should be prompted a dialog that "Check Your Internet Connection!".
This should be a common issues in Android could any body please help me to give me best approach to handle such cases. Thanks in advance.
Network state is :

A: This exception indicates the problem in connectivity. In fact you can show some dialog about the connectivity. Overriding the onErrorResponse(VolleyError error) you can do like this -
public void onErrorResponse(VolleyError error) {
                        Log.d(TAG, error.toString());
                        if (error instanceof NoConnectionError)
                        new AlertDialog.Builder(this).setMessage(
                                "Unable to connect to the server! Please ensure your internet is working!").show();
                    }

A: Try this method might help
public boolean isConnectedToInternet(){
        connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
          if (connectivityManager != null){
              NetworkInfo[] info = connectivityManager.getAllNetworkInfo();
              if (info != null){
                  for (int i = 0; i < info.length; i++){
                      if (info[i].getState() == NetworkInfo.State.CONNECTED){
                          return true;
                      }
                  }
              }
          }
          return false;
    }


text:
Q: need code for execution automatically execution does anyone have an idea how to execute a code in SAS at a specific time of day automatically?
some code or a video that serves as a reference and understands how to program it


text:
Q: Long running chkdsk on Windows 7 1TB external hard drive We had a lightning storm and power fluctuated. External hard drive lost some files.  I thought I could run a chkdsk on the drive.  It has been running over a week.  I checked box, "Automatically fix file system errors". As of this moment it shows 56395 files records processed.  The progress bar is completely blank, as it was at the beginning.  How much longer will it run, or is it doing anything?  I have read that you don't want to stop chkdsk once it begins.

A: In the situation as described, taking way longer than it should, the user has to make a judgement call, and bail out of the situation, even if that means booting, or hard stopping the computer.
I have seen checkdisk fails where the work is mostly complete, but the program will not end, and even situations where the long running checkdisk was hurting more than helping.
In the situation you describe right here, I will call it for you, its dead :-) Being an external drive, you could try the "safe removal" first, but it may hang up also.
 Then reboot, check the integrity of your data now, which includes actually playing or viewing the files, not just looking at the file structure.  If everything looks ok, then back it up, and run the chkdsk again  to finish.
. . . you do have a backup? :-)

A: Check the Windows Event Log and see if there are disk errors, particularly "operation was retried". Open Computer Management (run compmgmt.msc) and in the left pane, nav to System Tools | Event Viewer | Windows Logs , click System. In the right pane, click Filter Current Log. In the Event Sources selector, select "disk" and "Disk". OK. Your middle pane should now show all disk-related events.
If there aren't any "warning" or "error" level, you're good. :) You may be good even if there are a few, depending on what they are.
If the text shows anything about "retries", though, that's bad. Retries should be extremely uncommon, like maybe one a day per drive that's being read and written continuously.  If you see flurries of retries from your external drive, just scrap it. Especially since it is only your backup, you have nothing to lose by this.


text:
Q: Pentaho database connection test button not working Whenever I try to make a database connection in transaction Pentaho, be it oracle or postgreSQL, although everything is correct in the last part, the test button does not show anything instead of saying the connection is complete. The necessary JDBC files are installed, can you help me?
enter image description here
I tried all the JDBC files, and I even prepared the file path for JDBCs, but nothing changed.

A: Yes, I solved the problem, my mistake was because of the old version pentaho I downloaded from sourceforge, when I downloaded the latest version pentaho pdi from hitachi vartana's own site, the problem was solved
https://i.stack.imgur.com/rQOXa.png

A: The test button doesn't work because you should download pentaho from https://www.hitachivantara.com/en-us/products/dataops-software/data-integration-analytics/pentaho-community-edition.html. Don't downloaded it from sourceforge, if you downloaded from here try the 8.3 version.
Tip:If the marketplace doesn't appear install pentaho 8.3 version.


text:
Q: Convert String to Byte(0x??) I've made a window form application that send keys but in order to send keys I do this:
To send 'A' I have to write down MyFunction(0x41). 0x41 is a byte.
I can get the 41 as a string, but how do I convert it to a byte (of this format - 0x41)

A: You can cast it to an integer type:
MyFunction((byte)'A');

A: You can use Convert.ToByte


text:
Q: Find rare characters with Python Assume I have a huge .txt file full of random characters and I want to find out the "rare ones". Is there some module (something at all, actually) in Python (possibly, version 3.x, but I have also a machine using Python 2.7, in case it's better) written for this purpose? In case of positive answer, where can I find some basic explanation of its functioning?
Thank you very much.

A: from collections import Counter

c = Counter("text")
print(c.most_common())

output
[('t', 2), ('e', 1), ('x', 1)]

A: d = {}
for c in open(filename, "r").read():
    if c in d:
        d[c] += 1
    else:
        d[c] = 1

print(d)

Then you can use d to search for the minimum letters.

A: Here's one way to do this, using a Counter dictionary. It prints the rare characters, along with their number of occurrences. We define a rare character to be one whose number of occurrences is less than a certain threshold, which is the mean number of occurrences multiplied by a weighting factor, which I've set to 0.5 in this example.
from collections import Counter

with open(fname, 'r') as f:
    text = f.read()

counter = Counter(text)
mean = len(text) / len(counter)
print('Mean:', mean)

weight = 0.5
thresh = mean * weight
print('Threshold:', thresh)

#Only print results for chars whose occurence is less than the threshold
for ch, count in reversed(counter.most_common()):
    if count <= thresh:
        print('{0!r}: {1}'.format(ch, count))
    else:
        break

If this is an actual text file you may wish to filter out certain characters, eg newlines and spaces.

A: Using the collections option to access the n least common elements c.most_common()[:-n-1:-1]
from collections import Counter
c = Counter("sadaffdsagfgdfaafsasdfs3213jlkjk22jl31j2k13j313j13")
res = c.most_common()[:-3-1:-1]
print "The 3 Rarest characters are:",res[0][0],",",res[1][0],"and",res[2][0]

Result:
The 3 Rarest characters are: l , g and k

A: To find 10 rarest characters in a text:
from collections import Counter

rarest_chars = Counter(text).most_common()[-10:]

"character" means a Unicode codepoint here for simplicity: It means "a" and "A" are considered as different characters. It means u'g̈' (U+0067 U+0308) is considered as two characters. See how these issues are handled in a related question: Most common character in a string.
counter.most_common()[-10:] could be written more efficiently using heapq.nsmallest(10, counter.items(), key=itemgetter(1))
: .items() returns pairs (character, its_count) and key=itemgetter(1) extracts the counts so that 10 pairs with the least counts are returned.


text:
Q: Counting the number of functions on a 4-element set whose composite with itself maps 1 to 2 Let $S = \{1, 2, 3, 4\}$, and let $F$ be the sets of all functions from $S$ to $S$.
How many functions exist such that $(f \circ f)(1) = 2$?
How many functions exist such that $(f \circ f)(1) = 2$, and $f$ is onto?
I'm not sure how to approach this problem really, any hints to help me count how many of these functions exist? Thanks in advance :)

A: Hint. If $f(f(1))= 2$ then $f(1)\not=1$. Hence $[f(1),f(2),f(3),f(4)]$ could be
$$[2,2,?,?],\;[3,?,2,?],\;[4,?,?,2].$$
For the first question we can replace any ? with $1$, $2$, $3$, or $4$.
For the second question note that any onto function from $S$ to $S$ is a bijection!

A: Count them. It's as simple as that.
For the first problem, count how many function from $S$ to $S$ are there which satisfy one of the following conditions:

*

*$f(1)=2$ and $f(2)=2$;

*$f(1)=3$ and $f(3)=2$;

*$f(1)=4$ and $f(4)=2$.

After this, try to solve the second problem.


text:
Q: How to enable SSL connection a NodeJS (Express) based Server Following is the script I found on NodeJS Official Website:
// curl -k https://localhost:8000/
const https = require('https');
const fs = require('fs');

const options = {
  key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
  cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};

https.createServer(options, (req, res) => {
  res.writeHead(200);
  res.end('hello world\n');
}).listen(8000);

I'm completely new to SSL thing. I read some tutorials on how to enable SSL on Nodejs but still quite not confident with the process.
I have a domain name (Godaddy), SSL (Namecheap) and Cloud Server (Digital Ocean with an application deployed on HTTP prefix).
Whenever I open my Login page of my website, Google Chrome mark it as "Not secure" so I wanted to add SSL to the website.
What things I need to do on the NodeJS server (Express) and what things I need to do on Namecheap? What will be the sequence of doing that? What are cmd lines to generate .pem .csr files?
I'm didn't found and comprehensive guide laying down all the steps in a concise manner so just laid down the steps concisely (if possible) with the links to the resources for further digging.
And also, how can I use express framework to create https server in liue of above script?

A: That script is correct for setting the certs for your https. If your site is public, as it seems, then you'll want to buy certs from your ssl service, Namecheap in your example. Then you would move them to your host and reference them in the options object in your example. However, you can generate your own ssl certs and that will work as well. Though, any users will be warned that they're not trusted since you self signed/created them. I suggest going with the Namecheap option.
Note: You only have an https server in your example and anyone attempting to access your site via http will receive a blank page. You'll need to also create an http server, via the following:
var http = require('http');
http.createServer(...);

I would suggest having the http server simply redirect to the https url.

A: My code and error is here:
no such directory found error:
  key: fs.readFileSync('../private.key'),

  cert: fs.readFileSync('../public.cert')

error, no such directory found
  key: fs.readFileSync('./private.key'),

  cert: fs.readFileSync('./public.cert')

Working code should be
key: fs.readFileSync(__dirname + '/private.key', 'utf8'),

cert: fs.readFileSync(__dirname + '/public.cert', 'utf8')

Complete https code is:
const https = require('https');
const fs = require('fs');

// readFileSync function must use __dirname get current directory
// require use ./ refer to current directory.

const options = {
   key: fs.readFileSync(__dirname + '/private.key', 'utf8'),
  cert: fs.readFileSync(__dirname + '/public.cert', 'utf8')
};

 // Create HTTPs server.

 var server = https.createServer(options, app);

This is my working code for express 4.0.
express 4.0 is very different from 3.0 and others.
4.0 you have /bin/www file, which you are going to add https here.
"npm start" is standard way you start express 4.0 server.
readFileSync() function should use __dirname get current directory
while require() use ./ refer to current directory.
First you put private.key and public.cert file under /bin folder,
It is same folder as WWW file.


text:
Q: The remote procedure call failed. (Exception from HRESULT: 0x800706BE) . visio crashes when accessing it using IIS7.5 I am new to .net & I am facing an unusual issue with my application. I am developing an application which opens up a visio file with certain shapes from a .net application. I am doing my development work in a Windows7 home premium 64 bit PC. I am using visual studio professional 2012 for development. I have installed Visio premium 2010. My application works fine when running from the visual studio (application runs in with the default IIS express which comes with visual studio). Now I am trying to deploy the application in to actual IIS server in the same development box. I enabled the IIS (version7.5) in my windows7 development box. I deployed the application in IIS without any issue(I followed this link http://www.codeproject.com/Articles/28693/Deploying-ASP-NET-Websites-on-IIS-7-0). But when I try to open the visio file from the application (by clicking a button.) I am getting the following error.

The remote procedure call failed. (Exception from HRESULT: 0x800706BE)
Description: An unhandled exception occurred during the execution of
  the current web request. Please review the stack trace for more
  information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: The
  remote procedure call failed. (Exception from HRESULT: 0x800706BE)
Source Error: An unhandled exception was generated during the
  execution of the current web request. Information regarding the origin
  and location of the exception can be identified using the exception
  stack trace below.

Stack Trace:
[COMException (0x800706be): The remote procedure call failed. (Exception from HRESULT: 0x800706BE)]
   Microsoft.Office.Interop.Visio.DocumentsClass.Add(String FileName) +0
   Export_Visio.Button1_Click(Object sender, EventArgs e) +294
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804

I am not sure why this error is happening only when I am running in IIS and not in IIS express which comes with Visual Studio. I checked at the event logs to see if I could get any further information on this. What I got from that is as follows.

Faulting application name: VISIO.EXE, version: 14.0.6122.5000, time
  stamp: 0x4fb499bf Faulting module name: VISLIB.dll, version:
  14.0.6122.5000, time stamp: 0x4fb499f9 Exception code: 0xc0000005 Fault offset: 0x001303ae Faulting process id: 0x14d0 Faulting
  application start time: 0x01ce3e171e27cc2f Faulting application path:
  C:\Program Files (x86)\Microsoft Office\Office14\VISIO.EXE Faulting
  module path: C:\Program Files (x86)\Microsoft
  Office\Office14\VISLIB.dll Report Id:
  5d12428f-aa0a-11e2-b7f3-e840f2736aca

Can someone please help me to find out what is causing this issue?
Note: my other office products installed in this computer are 2003 version(word, excel, power point etc) if that matters. Visio is 2010.
Thanks in advance.


text:
Q: Angular: Display nothing incase *ngIf fails I have two arrays fetchedData and cardCheckArray. I am using nested loop and displaying the data of the fetchedData if some certain element in the fetchedData equals the cardCheckArray. It's kind of displaying subitems of an array but by using two different arrays. I am getting an issue here. Incase, if the element of the first array doesn't match with the second array, the Angular prints nothing but still occupies an empty line for each iteration when the condition fails. This is putting a lot of space under each card header. I want to somehow don't print empty whitespace if *ngIf fails. I have tried using ng-template but still getting the same issue.
Here's my code:

HTML

{{data}}

{{data2.DOCUMENT_NAME}}

{{data2.DATE_SUBMITTED | date: 'medium'}}

{{data2.PROCESS_NAME}}

          <ng-template #printNothing>

empty
        //I am printing empty right now but it prints whitespaces if I leave it blank here
          </ng-template>

typescript

var swap = this.fetchedData[0].PROCESS_NAME;

      for (var x in this.fetchedData)
      {
        if(swap == this.fetchedData[x].PROCESS_NAME)
        {
          continue;
        }
        else
        {
          this.cardCheckArray.push(swap);
          swap = this.fetchedData[x].PROCESS_NAME;
        }
      }
this.cardCheckArray.push(swap);

How can I resolve this? Any help would be appreciated. Thanks!

A: Angular still renders the div element with the ngFor directive. Since you cannot put two structural directives (ngFor and ngIf) on the same element you should use an ng-container. Its an element where you can place a structural directive (ngFor in your case), but which will not be rendered in the html. Inside that put your div with card-body class and put the ngIf on it.

A: Use ng-container for *ngFor and do not use else and ng-template.
<ng-container "let data2 of fetchedData" >
  <div class="card-body" *ngIf = "data2.PROCESS_NAME == data; else printNothing">
     …


text:
Q: How to fix "Cannot use this in a static context" in a static code block? In my class there is a static code block, and in src folder there is a propertie file so I use below code to read it.
static
{
   InputStream iStream = null;
   try {

    iStream = this.getClass().getClassLoader()
                             .getResourceAsStream("config.properties");
    if(iStream == null){
     throw new IOException("File not found");
    }
    properties.load(iStream);
   } catch (IOException e) {
    e.printStackTrace();
   }
}

then there is error "Cannot use this in a static context". So how to fix it? Thx


text:
Q: Add a parent directory to a git repositoy I have created a git repository for the C implementation of a program.
I am about to add a Matlab implementation and I would like to have a single repository with two subdirectories: one for the C and one for matlab.
Of course, I would like to keep the full history too!
What should I do?

A: Do it in separate steps:

*

*Create two new folders:  C and Matlab.

*Move existing files from the current location into the C folder.

*Start adding new files in the Matlab folder.

A: https://stackoverflow.com/questions/614229/can-i-move-the-git-directory-for-a-repo-to-its-parent-directory/614254


text:
Q: How to join array values in jQuery but formatting them? I have the following input in Javascript: ["1213381233", "1213551233", "1213551255"] and I need to join them and format them. Take a look to the following example:

  <button id="add_condition">
    Click me
  </button>

var data_field = 'asset_locations_name';
var data_condition = 'in';
var data_values = ["1213381233", "1213551233", "1213551255"];

$("#segment_form").on('click', '#add_condition', function() {
  var li = '';
  var has_parenthesis = false;

  if (data_condition == 'in' || data_condition == 'not in' || data_condition == 'between' || data_condition == 'not between') {
    has_parenthesis = true;
  }

  if (data_values instanceof Array && data_values.length >= 1) {
    li += '
';
    li += data_field + ' ' + data_condition;

    if (has_parenthesis) {
      li += '( ';
    }

    $.each(data_values, function(index, value) {
      li += '' + value + '';
    });

    if (has_parenthesis) {
      li += ' )';
    }
    li += '
';
  }

  $('body').append(li);
});

The idea is to have the following output:
asset_locations_name in (1213381233,1213551233,1213551255)
My code is almost working but I am getting:
asset_locations_name in( 121338123312135512331213551255 )
The trick here is I can't do a data_values.join() because I need the value of each to add as a data-id property on the span itself.
Any other clean solution? Any help is welcome!
I forgot to mention there is a Fiddle here ready to play with.

A: Just add ',' after all your value and get the substring without the last ','.
https://jsfiddle.net/v562vst9/2/

  <button id="add_condition">
    Click me
  </button>

var data_field = 'asset_locations_name';
var data_condition = 'in';
var data_values = ["1213381233", "1213551233", "1213551255"];

$("#segment_form").on('click', '#add_condition', function() {
  var li = '';
  var has_parenthesis = false;

  if (data_condition == 'in' || data_condition == 'not in' || data_condition == 'between' || data_condition == 'not between') {
    has_parenthesis = true;
  }

  if (data_values instanceof Array && data_values.length >= 1) {
    li += '
';
    li += data_field + ' ' + data_condition;

    if (has_parenthesis) {
      li += '( ';
    }

    $.each(data_values, function(index, value) {
      li += '' + value + ',';
    });

    li = li.substr(0, li.length - 1);

    if (has_parenthesis) {
      li += ' )';
    }
    li += '
';
  }

  console.log('data_field =>', data_field, 'data_condition => ', data_condition, 'data_values =>', data_values, 'li =>', li);

  $('body').append(li);
});

A: What about this?
var data_field = 'asset_locations_name';
var data_condition = 'in';
var data_values = ["1213381233", "1213551233", "1213551255"];

$("#segment_form").on('click', '#add_condition', function() {
  var li = '';
  var has_parenthesis = false;

  if (data_condition == 'in' || data_condition == 'not in' || data_condition == 'between' || data_condition == 'not between') {
    has_parenthesis = true;
  }

  if (data_values instanceof Array && data_values.length >= 1) {
    li += '
';
    li += data_field + ' ' + data_condition;

    if (has_parenthesis) {
      li += '(';
    }

    $.each(data_values, function(index, value) {
      // Note the 'prefix' variable here
      var prefix = (index == 0) ? '' : ', ';
      li += '' + prefix + value + '';
    });

    if (has_parenthesis) {
      li += ')';
    }
    li += '
';
  }

  console.log('data_field =>', data_field, 'data_condition => ', data_condition, 'data_values =>', data_values, 'li =>', li);

  $('body').append(li);
});

I created a new fiddle with the solution.

A: Add a comma if it's not the last element.
Maybe something like this:
$.each(data_values, function(index, value) {
  li += '' + value + '';
  if (index !== data_values.length - 1) {
    li += ','
  }
});

Or remove the last comma after iterate.
$.each(data_values, function(index, value) {
  li += '' + value + '';
});
li.slice(0,-1)

A: You need to use the js method 'join'
You should have a look to something like handlebars

var data_values = ["1213381233", "1213551233", "1213551255"];

alert(data_values.join(','))


text:
Q: 3 row layout with signin-box using html, divs and css Using HTML, CSS and DIVs, I like to create a 3 row layout, like: here.
Additionally I need a signin-box with a fixed width in the top right of the first row.
I tried that:

body {
    margin:0;
    padding:0;
}
div#top {
    position:fixed;
    width:100%;
    height:65px;
    z-index:100;
    background-color:#AAA;
}
div#header {
    width:100%;
    height:65px;
    background-color:#F00;
    float:left;
}
div#signin {
    width:100px;
    height:65px;
    background-color:#0F0;
    float:right;
}
div#footer {
    width:100%;
    height:65px;
    position:fixed;
    bottom:0;
    background-color:#06F;
}
div#content {
    background-color:#111;
    width:100%;
    height:100%;
    position:absolute;
}

But the login box is placed below the first row; see here.
How can I place the login box at the right of the first row? TIA!

A: you need to add positon:absolute; and right:0px; to signin selector
try this
div#signin {
    width:100px;
    height:65px;
    background-color:#0F0;
    position: absolute;
    right:0px;
}

DEMO here

A: Simple code move signin div inside header div

A: You can put your

 inside


text:
Q: DateTime.TryParseExact(..... out var date) fails to build without errors, but (... out date) builds fine In an ASP.NET MVC project, I'm targeting .Net 4.7, and in trying to use the new features in C#7, I'm getting an odd silent failure to build.
I have the following method:
public class DateIsValid: ValidationAttribute
{
    public override bool IsValid(object value)
    {
        DateTime date;
        if (DateTime.TryParseExact(Convert.ToString(value), "d MMM yyyy", CultureInfo.CurrentCulture, System.Globalization.DateTimeStyles.None, out date))
            return date > DateTime.Now;
        else
            return false;
    }
}

This builds and runs fine, without any warnings or errors.
But, if I try to use the "out var xxx" as added in C#7, it fails to build, but does not throw any exceptions or show any errors or warnings:
public class DateIsValid: ValidationAttribute
{
    public override bool IsValid(object value)
    {
        if (DateTime.TryParseExact(Convert.ToString(value), "d MMM yyyy", CultureInfo.CurrentCulture, System.Globalization.DateTimeStyles.None, out var date))
            return date > DateTime.Now;
        else
            return false;
    }
}

Figuring this was just buginess in VS 2017, I tried restarting, but that did not help.  Is there a problem with what I wrote, or is this a bug that should be submitted to the VS team?
In this same project, I'm getting the same silent failure on ConcurrentQueue.TryDequeue(out var item), but using the older pattern works fine:
    int res;
    if (x.TryDequeue(out res))
    {
        res++;
    }

A: The problem wound up being with the compiler.  The project was created as an ASP.NET MVC project targeting .Net 4.5.2 (not 4.6.2, typo above), and when I changed the target framework to 4.7 and tried to use C#7 features, that's when things went wrong.  I had this problem on multiple dev machines, and I tried a few things, but the only fix that worked was also the simplest and quickest: reinstall the compiler:
In Package Manager Console, run Install-Package Microsoft.Net.Compilers.  It was suggested that I post the solutions as an answer, so here goes.  Special thanks to @jonskeet and @PanagiotisKanavos for identifying the issue (in the comments above).
Interestingly, changing just the compiler version in advanced build settings did not help.  I've also migrated WPF projects to C#7 on the same machines without issue, so it was odd that this problem cropped up with ASP.NET, but the compiler reinstall was simple and painless.


text:
Q: Storing and extracting pickle file from CSV or DataFrame I am storing sklearn models with pickle.
But the environment I am working in only allows the persistence of CSV and DataFrame Data.
I tried saving models to DataFrames with:
#create empty DataFrame
model_df = pd.DataFrame(columns=["modelstring"])

#Save one model to each row
for model in range(1, len(model_dict)):
    model_df.loc[model] = pickle.dumps(model_dict[model], protocol = 3)

...

#Store and reload csv file
model_df["modelstring"].to_csv("models.csv")
model_df2 = pd.read_csv("models.csv")

...
#Load Model from Pickle
model = pickle.loads(model_df2.loc[1].modelstring)

But when reading them out, the files are not byte codes anymore, but strings, which I can't convert back to byte.
input format: b'\x80\x03csklearn.svm.classes\nOneClassSVM\nq\x...'
output format: 'b\'\x80\x03csklearn.svm.classes\nOneClassSVM\nq...'
Is there any way to store the models in the csv and being able to read them back out?
Thanks.

A: I had several issues replicating your code (there are some bugs). But I managed to solve it :)
You can use hex when storing, and use bytes.fromhex() when reading from files.
It goes like this:
#create empty DataFrame
model_df = pd.DataFrame(columns=["modelstring"])

#Save one model to each row
for model in range(1, len(model_dict)):
    model_df.loc[model] = pickle.dumps(model_dict[model], protocol = 3).hex()

...

#Store and reload csv file
model_df["modelstring"].to_csv("models.csv")
model_df2 = pd.read_csv("models.csv")

...
#Load Model from Pickle
model = pickle.loads(bytes.fromhex(model_df2.loc[1].modelstring))


text:
Q: How to access class variables when class instances are stored in array I started object-oriented programming in python and in my program, I decided to store class instances in array, but I don't know how to access class variables now.
class apixel(object):
    def __init__(self):
        self.posx = random.randint(0, 300)
        self.posy = random.randint(0, 200)
    def do_i_exist():
        print("Yes i do!")

p = [apixel] * 10

for obj in p:
    obj.do_i_exist() #that works
    print(obj.posx)  #but that does not work

A: The issue is that you need to actually instantiate the objects, otherwise __init__ is never called.
Try:
p = [apixel() for _ in range(10)]

Per Craig's comment below, the list comprehension calls the constructor 10 times so you get 10 independent objects.
But, the reason your apixel didn't have a self.posx is that the constructor was never called by your code. You weren't creating a list of instances of your class, but rather a list of references to the class definition.
Per DanielPryden's comment on your OP, you should either change the signature of your do_i_exist method to accept self, or annotate it as static:
# as an instance method, which requires "self":
do_i_exist(self):
    ...

# as a static class method that is the same for all instances:
@staticmethod
do_i_exist():
   ... method body contains NO references to "self"


text:
Q: Reinstalling/ un-revoking digital certificate So I have a problem in Vista which I can't run certain applications (well, the entier MS suite, Office, Visual Studio, etc) as an Administrator.
From the looks of the problem it is caused by the Digital Certificate, and the fact that it has been "revoked".
So now I have a problem, how do I un-revoke the digital certificate? Alternatively I've got a copy of the digital certificate from a co-worker whos one is fine. I've tried right-click -> install certificate but it doesn't seem to change anything, nor can I work out how to select it when I try to install a certificate for Visual Studio/ Office.

A: I'd be very very surprised if Microsoft's code-signing certificate had been revoked.
I would first check your system's date and time, to ensure that Windows doesn't think the certificate isn't yet valid or has expired. Then I'd check that you still have the Microsoft Root Certificate Authority root certificate.
UPDATE 2013-05-23: Microsoft have in fact shipped some components whose digital signatures were not properly timestamped, meaning that they won't install properly after the certificate has expired. See Microsoft Security Advisory 2749655 - Compatibility Issues Affecting Signed Microsoft Binaries for more information.


text:
Q: How to add .html end of URL I'm new with Phalcon PHP. I can't figure out how can I add .html to end of url for every page. I already looked up docs. Nothing related to this isn't in docs
Thanks,

A: You can customise the routing parameter, e.g:
$router->add(
    "/documentation/{name}.{type:[a-z]+}\.html",
    array(
        "controller" => "documentation",
        "action"     => "show"
    )
);

would route  /documentation/color.doc.html to  showAction in DocumentationController with params $this->dispatcher->getParam("name") === "color" and $this->dispatcher->getParam("type") === "doc"
For further info please read the docs in http://docs.phalconphp.com/en/latest/reference/routing.html


text:
Q: Beginner in Laravel - Eager loading seems to not work? I'm new to Laravel and I'm trying to make a post where the user's post can receive likes from other users. But I'm trouble at when you click the user, it was suppose to direct to the users page where you can see all its post and the likes the it received. This is the code that suppose to do that work:
This is the controller:
 public function index(User $user)
  {

    $posts = $user->posts()->with('user', 'likes')->get();

    return view('users.posts.index', [
        'user' => $user,
        'posts' => $posts,
        ]);

  }
 }

and this is the view/template:

        {{$user->name}}

I don't know what's the problem though, or is it a bug with Laravel eager loading?
But unfortunately it only returns a blank page, there's no error though.
The thing is after putting this code inside dump and die, there's data showing from the database. I don't why it doesn't show. Can someone help me with this problem? Much appreciated
Following this tutorial: https://www.youtube.com/watch?v=MFh0Fd7BsjE
Tutorial Github: https://github.com/codecourse/posty-traversy-media

A: If you want to access the posts you can iterate through them:
@foreach($posts as $post)
    {{ $post->title }}
    {{ $post->likes->count() }}
@endforeach

Not sure what data or relationships you want to access.

A: Check your route whether it has a user id for model injection
eg:/index/{user}
also in your blade example, there is no posts are used.you are using the user object
public function index(User $user)
{

    $posts = $user->posts()->with('user', 'likes')->get();

    return view('users.posts.index')->with([
        'user' => $user,
        'posts' => $posts,
        ]);

 }


text:
Q: Unresolved attribute reference 'objects' for class 'Foo' in PyCharm Why am I seeing this warning for a class which is a subclass of models.Model (Foo is defined as class Foo(models.Model))? This is wherever I use Foo.objects.filter(...).
Responding to request for more detail with a simplified example:
# ------ models.py ---------
from django.db import models

class Foo(models.Model):
    pass

# ------ views.py ---------
from models import Foo

inquiry = Foo.objects.filter(...)  # PyCharm gives warning for objects here
    ...

PyCharm gives no warnings for the import statements in either file.

A: There is a better way to resolve this problem
When you enable the Django support in PyCharm it automatically detects that this is a model and objects refers to the Model manager
Instead you can specify that in your models.py itself, which is the preferred method and the best way to code
update your code like
class Foo(models.Model):
    // column definitions
    objects = models.Manager()

A: Is your pycharm version community or professional? If your pycharm is community, maybe it needs a pluggin to support django. If your pycharm is professional, make sure that in: Preferences > Languages&Frameworks > Django > Enable Django Support the option is chosen. Here is the image:


text:
Q: How can I compress and encrypt a large file without using external DLLs or runtimes? I am looking for a component or other technique to compress and encrypt multiple large files (files which exceed 4gb in size, and thus will not fit in the memory available to a win32 process) into a single file.  I would like the encryption to be very strong (256 bit AES or better) but the compression doesn't matter to me.
Right now, I'm using the TJvZlibMultiple component which creates its own non-Zip file format, but I have to create the archive, then encrypt it in a separate step (I'm using DcpCrypt right now).  I'd like to do the same in a single pass, using streams, without using memory equal to the size of the file (ergo, the compression and encryption should happen with streams, and not in memory).
I have seen, and don't want to use, anything that requires an external DLLs like the 7zip dll. Commercial tools are okay, or any code or sample Delphi sources, but I'm looking for a thorough implementation within Delphi not a thing that imports and invokes functions in a dll.

A: Take a look at DIZipWriter.
Supports 256 bit AES, streaming and compression.
Update:
Version 5 claims to have support for large sized (64bit) entries, DIZipWriter History.

A: You could take a look at FlexCompress by ComponentAce: http://www.componentace.com/compression_component_compression_delphi_encryption_delphi_flexcompress.htm

A: Check FlexCompress:
FlexCompress is a compression delphi component designed for creating archives with strong encryption and better compression rate than WinZip and RAR. Native VCL, no DLLs, no OCXs, provides compression for files, buffers, streams and strings, supports in-memory archives, compresses large files > 4 Gb with low memory consumption and lots of other useful features.
http://www.componentace.com/flexcompress_features.htm
by this link: http://delphi.about.com/od/toppicks/tp/delphi_zip.htm


text:
Q: How to solve java.net.URISyntaxException error I want to get path of a music file and than add that file in my MP3-player using this code bellow:
addSong.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (fileChooser.showSaveDialog(MainFrame.this) == JFileChooser.APPROVE_OPTION) {
                File song = fileChooser.getSelectedFile();

                mainPanel.addSongs(song.getAbsolutePath()); // getting file path

                JOptionPane.showMessageDialog(MainFrame.this,
                        "Song has been successfully added to your music track!", "Information",
                        JOptionPane.INFORMATION_MESSAGE);
            }
        }
    });

Than I pass it like this:
public void addSongs(String path) {
    musicPlayer.addSongs(path);
}

And in the end it comes here:
public void addSongs(String path) {

    Media media = new Media(path); // this is place where error occurs

    MediaPlayer mediaPlayer = new MediaPlayer(media);

    songList.add(mediaPlayer);

}

And I got an error:
Exception in thread "AWT-EventQueue-0"        java.lang.IllegalArgumentException: java.net.URISyntaxException: Illegal character in opaque part at index 2: C:\Users\Jovan\Desktop\DEAF KEV - Invincible [NCS Release].mp3
at javafx.scene.media.Media.<init>(Media.java:385)
at mp3.MusicPlayer.addSongs(MusicPlayer.java:86)
at mp3.MainPanel.addSongs(MainPanel.java:40)
at mp3.MainFrame$2.actionPerformed(MainFrame.java:78)

How to solve this problem ?


text:
Q: simplexml and xpath, read sibling I have the following XML file :
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
    <item>
        [...]
        <wp:postmeta>
            <wp:meta_key>_wp_old_slug</wp:meta_key>
            <wp:meta_value><![CDATA[item-1-slug]]></wp:meta_value>
        </wp:postmeta>
        <wp:postmeta>
            <wp:meta_key>_yoast_wpseo_title</wp:meta_key>
            <wp:meta_value><![CDATA[item-1-title]]></wp:meta_value>
        </wp:postmeta>
        [...]
    </item>
    <item>
        [...]
        <wp:postmeta>
            <wp:meta_key>_wp_old_slug</wp:meta_key>
            <wp:meta_value><![CDATA[item-2-slug]]></wp:meta_value>
        </wp:postmeta>
        <wp:postmeta>
            <wp:meta_key>_yoast_wpseo_title</wp:meta_key>
            <wp:meta_value><![CDATA[item-2-title]]></wp:meta_value>
        </wp:postmeta>
        [...]
    </item>
</channel>
</rss>

I'm looping through my items with
$xmlurl = file_get_contents($xmlFile);
$xml = simplexml_load_string($xmlurl, null, LIBXML_NOCDATA);
$items = $xml->channel->item;
foreach( $items as $item ) {

}

Inside this loop, i'd like to read the value of the sibling of the <wp:meta_key>_yoast_wpseo_title</wp:meta_key> node. For example, for item 1, i'd like to get "item-1-title".
I probably have to use xpath, but i really dont know how to proceed.
How can I do this ?

A: $xpath = './/wp:meta_key[text()="_yoast_wpseo_title"]/following-sibling::wp:meta_value[1]/text()';
$items = $xml->channel->item;
foreach( $items as $item ) {
  $result = $item->xpath($xpath);
  print "$result[0]\n";
}

// => item-1-title
// => item-2-title

Explanation of the XPath expression:
.                               - from the current node...
//wp:meta_key                   - get all descendant wp:meta_key nodes
[text()="_yoast_wpseo_title"]   - whose text content is _yoast_wpseo_title
/following-sibling::            - then get the siblings that come after this
wp:meta_value[1]                - with tag wp:meta_value; only take the first
/text()                         - and read its text

A: This solution includes reference to the Wordpress XML namespace:
$doc = new SimpleXmlElement($xml);
$doc->registerXPathNamespace ('wp', 'http://wordpress.org/export/1.0/');

$wp_meta_title = $doc->xpath("//wp:postmeta[wp:meta_key = '_yoast_wpseo_title']/wp:meta_value");

foreach ($wp_meta_title as $title) {
    echo (string)$title . "\n";
}

result:
item-1-title
item-2-title

See http://ideone.com/qjOfIW
The path //wp:postmeta[wp:meta_key = '_yoast_wpseo_title']/wp:meta_value is pretty straight-forward, I don't think it needs special explanation.


text:
Q: What would this the derivative be? I'm trying to find $\frac{d}{dt}[f(\textbf{c}(t))]\rvert_{t=0}$
Where $\textbf{c}(t)$ is such that $\frac{d}{dt}\textbf{c}(t) = \textbf{F}(c(t))$, with $\textbf{F} = \nabla f$, $\textbf{c}(0) = (-\frac{\pi}{2}, \frac{\pi}{2})$ and $f(x,y) = \sin(x + y)xy$
At the moment I'm thinking that I would need to use the chain rule to find it, that is:
$\frac{d}{dt}[f(\textbf{c}(t))] = \frac{df}{d\textbf{c}}\frac{d\textbf{c}}{dt}$
I think that $\frac{d\textbf{c}}{dt} = \textbf{F}(\textbf{c}(t)) = \nabla f$
However I am not sure exactly how to find $\frac{df}{d\textbf{c}}$, what would I need to do from here? Am I correct up tiil this point?
Thanks very much in advance.

A: The chain rule can be extremely misleadingly taught and/or written down. I sympathize. Here, an application of the chain rule should look like
$\frac{d}{dt} f(\mathbf{c}(t)) = \nabla f (\mathbf{c}(t)) \cdot \frac{d\mathbf{c}}{dt}(t)$


text:
Q: Python regex matching URLs I have a list in text file of URLs with some unwanted texts I have wrote a regex which will meet my needs and that is work fine but I am facing a problem where the regex add to the output unwanted samples [''] below the examples:
file content a list of URLs:
http://www.example.com/52                   (Status: 403) [Size: 919]
http://www.example.com/details              (Status: 403) [Size: 919]
http://www.example.com/h                    (Status: 403) [Size: 919]
http://www.example.com/affiliate            (Status: 403) [Size: 919]
http://www.example.com/56                   (Status: 403) [Size: 919]

the regex I used is: "^[://.a-zA-Z0-9-_]*"
the output as below:
['http://www.example.com/52']
['http://www.example.com/details']
['http://www.example.com/h']
['http://www.example.com/affiliate']
['http://www.example.com/56']

I need the output to be like the following:
http://www.example.com/52
http://www.example.com/details
http://www.example.com/h
http://www.example.com/affiliate
http://www.example.com/56

the code used for this program below:
import re

with open("test.txt","r") as test:
    for i in test:
        x = re.findall("^[://.a-zA-Z0-9-_]*",i)
        print(x)

A: findall produces a list of strings, you can either print out the first element in the result print(x[0]) or just use match instead for this use case since there is 1 url per line.
with open("test.txt","r") as test:
    for i in test:
        x = re.match(r"[://.a-zA-Z0-9-_]*", i)
        print(x.group(0))


text:
Q: Return list of all non standard nodes (duplicate) from xml column in sql database Can you help?
I have a table 'ED' with columns NAME and XMLOUTPUT
Example of the table is
Name              XMLOUTPUT
Person1           Snippet below

XMLOUTPUT is
<Fields>
        <f Name="FIRSTNAME" ColumnOrder="0" SortSequence="-1">
            <FieldWasFlattened>false</FieldWasFlattened>
            <ParentView/>
        </f>
        <f Name="KEYNAME" ColumnOrder="1" SortSequence="-1">
            <FieldWasFlattened>false</FieldWasFlattened>
            <ParentView/>
        </f>
        <f Name="AGE" ColumnOrder="2" SortSequence="-1">
            <FieldWasFlattened>false</FieldWasFlattened>
            <ParentView/>
        </f>
        <f Name="BIRTHDATE" ColumnOrder="3" SortSequence="-1">
            <FieldWasFlattened>false</FieldWasFlattened>
            <ParentView/>
        </f>
        <f Name="LOOKUPID" ColumnOrder="4" SortSequence="-1">
            <FieldWasFlattened>false</FieldWasFlattened>
            <ParentView/>
        </f>
        <f Name="MIDDLENAME" ColumnOrder="5" SortSequence="-1">
            <FieldWasFlattened>false</FieldWasFlattened>
            <ParentView/>
        </f>
        <f Name="Blue (color)" ColumnOrder="6" SortSequence="-1">
            <FieldWasFlattened>false</FieldWasFlattened>
            <ParentView/>
        </f>
          <f Name="Red (color)" ColumnOrder="6" SortSequence="-1">
            <FieldWasFlattened>false</FieldWasFlattened>
            <ParentView/>
        </f>
          <f Name="Yellow (color)" ColumnOrder="6" SortSequence="-1">
            <FieldWasFlattened>false</FieldWasFlattened>
            <ParentView/>
        </f>
          <f Name="Green (color)" ColumnOrder="6" SortSequence="-1">
            <FieldWasFlattened>false</FieldWasFlattened>
            <ParentView/>
        </f>
    </Fields>

What Im trying to do is select the Name column in ED table as well as any Names from the XMLOUTPUT that have (color)
Ideally the output would be
NAME          XMLOUTPUT
Person1       Blue (color)
Person1       Red (color)
Person 1      Yellow (color)
Person1       Green (color)

the closest I have come so far is
select NAME as EDNAME,

    CAST(REPLACE(REPLACE(CONVERT(nvarchar(max),  XMLOUTPUT), '', ''), '', '')
    AS xml).value('(//*:f/@Name) [1] ', 'varchar(50)')
    as Color

    from ED

    where NAME = 'Person 1'

But this does retrieve but only retrieves the 1st  due to the [1] in the statement.
Im looking for something that will pull all values where @Name like '%color%'
Thanks for looking.

A: Please try  the following solution.
The XPath XQuery contains() function is very handy for your scenario.
SQL
-- DDL and sample data population, start
DECLARE @tbl TABLE (ID INT IDENTITY PRIMARY KEY, [Name] VARCHAR(20), XMLOUTPUT XML);
INSERT INTO @tbl ([Name], XMLOUTPUT) VALUES
('Person1', N'<Fields>
    <f Name="FIRSTNAME" ColumnOrder="0" SortSequence="-1">
        <FieldWasFlattened>false</FieldWasFlattened>
        <ParentView/>
    </f>
    <f Name="KEYNAME" ColumnOrder="1" SortSequence="-1">
        <FieldWasFlattened>false</FieldWasFlattened>
        <ParentView/>
    </f>
    <f Name="AGE" ColumnOrder="2" SortSequence="-1">
        <FieldWasFlattened>false</FieldWasFlattened>
        <ParentView/>
    </f>
    <f Name="BIRTHDATE" ColumnOrder="3" SortSequence="-1">
        <FieldWasFlattened>false</FieldWasFlattened>
        <ParentView/>
    </f>
    <f Name="LOOKUPID" ColumnOrder="4" SortSequence="-1">
        <FieldWasFlattened>false</FieldWasFlattened>
        <ParentView/>
    </f>
    <f Name="MIDDLENAME" ColumnOrder="5" SortSequence="-1">
        <FieldWasFlattened>false</FieldWasFlattened>
        <ParentView/>
    </f>
    <f Name="Blue (color)" ColumnOrder="6" SortSequence="-1">
        <FieldWasFlattened>false</FieldWasFlattened>
        <ParentView/>
    </f>
    <f Name="Red (color)" ColumnOrder="6" SortSequence="-1">
        <FieldWasFlattened>false</FieldWasFlattened>
        <ParentView/>
    </f>
    <f Name="Yellow (color)" ColumnOrder="6" SortSequence="-1">
        <FieldWasFlattened>false</FieldWasFlattened>
        <ParentView/>
    </f>
    <f Name="Green (color)" ColumnOrder="6" SortSequence="-1">
        <FieldWasFlattened>false</FieldWasFlattened>
        <ParentView/>
    </f>
</Fields>');
-- DDL and sample data population, end

SELECT ID, [Name]
    ,c.value('@Name', 'VARCHAR(30)') AS Result
FROM @tbl
    CROSS APPLY XMLOUTPUT.nodes('/Fields/f[contains(@Name, "(color)")]') AS t(c);

Output
+----+---------+----------------+
| ID |  Name   |     Result     |
+----+---------+----------------+
|  1 | Person1 | Blue (color)   |
|  1 | Person1 | Red (color)    |
|  1 | Person1 | Yellow (color) |
|  1 | Person1 | Green (color)  |
+----+---------+----------------+


text:
Q: Partial page refresh using an UpdatePanel I have  a page associated with master page. I need to implement the Ajax(basically wanted to to do partial page refresh).
In this page I have grid and paging buttons(first/previous/last/next), dropdowns and also search.
So all these updates the grid.
Right now I have below code
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>

under
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>

Here is the html like grid/buttons/search after ContentTemplate tag starts
So finally the page has left menu/footer/header and contents
</ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

But this is still refreshing the page.

A: I am a little confused as to you have and what you want.
It sounds like you have a Content control with an UpdatePanel in it.  Within the UpdatePanel ContentTemplate you have all your grid, buttons etc along with your menu.
You only need to have the controls that you want to do the refresh in your UpdatePanel ContentTemplate.  All the other stuff you should have outside of the UpdatePanel.  If you have any controls outside of the UpdatePanel that you need to trigger a refresh with setup a Trigger for each control in the UpdatePanel and tell it which event to trigger off of.
Example:
<asp:Button ID="btnTest" runat="server" Text="Test" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <!-- only your content that needs refreshing goes here -->
    <ContentTemplate>
    <Triggers>
       <asp:AsyncPostBackTrigger ControlID="btnTest" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>

In the above example the btnTest click event will cause the content of the UpdatePanel to refresh but the Button or anything outside of the UpdatePanel will not refresh.  If the Trigger was not setup, the whole page would refresh.  You don't need Trigger setup for controls within an UpdatePanel as all control events will be captured by the UpdatePanel for a refresh.
You can read up more on MSDN.


text:
Q: Is wp_login_form secure on a non secure page? I am using the wp_login_form on a non-secure (http) website. The form is in a modal window, so that you can log in from any page on the website.
Is using the wp_login_form() in this way safe?
Thanks,
Sascha

A: It doesn't matter what function you use to generate the form markup, if you write the code by hand, or if it's in a modal or not. For it to be secure, you absolutely need an SSL certificate.

A: A man-in-the-middle can eavesdrop all the HTTP requests to a non-secure (HTTP) website, in plain text.
But one of the things that you need to consider is, do a wp_login_form() alone vulnerable to brute force attacks? If it is, then you need to limit the number of login attempts and implement a secure CAPTCHA. For more info visit Brute Force Attacks.


text:
Q: css a:hover to a:focus I am making a website for my brother and I did a dropdown CSS menu for him which worked on the :hover to display the secondary options. Then he decided he wanted people to click on the main navigation box which would then dropdown the menu to show the secondary levels...
I tried changing the :hover to :focus (also the a:active) on the a element and this worked fine in IE9, but Firefox, Safari, Chrome and Opera wouldn't recognise the new commands. I read about a Javascript alternative but I'm not familiar with it too much to really feel confident about going down that route.
Just wondering if someone could help:
Link to web: http://www.doogledesigns.co.uk/prime%20elements/website/
HTML Code:

Home

Plumbing & Gas Work

Electrical Work

Extensions

Internal & External Developments

Garden

Garden Maintenance

Landscaping

Patios & Driveways

Walls & Fencing

Ponds & Water Features

Lighting

Drainage

Construction

Home Redevelopment

New Builds

Driveways

CSS Code:
.nav1 {
float: left;
background: #404041;
height: 500px;
line-height: 1.5;
width: 170px;
-webkit-box-shadow: 2px 2px 5px rgba(0,0,0,2);
-moz-box-shadow: 2px 2px 5px rgba(0,0,0,2);
box-shadow: 2px 2px 5px rgba(0,0,0,2);
}

.menu-item-home, .menu-item-garden, .menu-item-construction {
background: #404041;
width: 170px;
}

.menu-item-home h4, .menu-item-garden h4, .menu-item-construction h4 {
color: #fff;
font-size: 13px;
font-weight: 500;
padding: 7px 12px;
background: #10702a;
}

.menu-item-home h4 a, .menu-item-garden h4 a, .menu-item-construction h4 a {
color: #fff;
display: block;
text-decoration: none;
width: 170px;
}

/* Menu Header Styles */
.menu-item-home h4, .menu-item-garden h4, .menu-item-construction h4 {
border-bottom: 1px solid rgba(0,0,0,3);
border-top: 1px solid rgba(225,225,225,0.2);
color: #fff;
font-size: 13px;
font-weight: 500;
padding: 7px 12px;

/* Gradient */
background: #a90329; /* Old browsers */
background: -moz-linear-gradient(top, #02942a 0%, #0b872d 44%, #0f722a 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#02942a), color-stop(44%,#0b872d), color-stop(100%,#0f722a)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #a90329 0%,#80b872d 44%,#0f722a 100%); /*   Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #02942a 0%,#0b872d 44%,#0f722a 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #02942a 0%,#0b872d 44%,#0f722a 100%); /* IE10+ */
background: linear-gradient(top, #02942a 0%,#0b872d 44%,#0f722a 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#02942a',   endColorstr='#0f722a',GradientType=0 ); /* IE6-9 */
}

/* ul styles */
.menu-item-home ul, .menu-item-garden ul, .menu-item-construction ul {
background: #404041;
font-size: 12px;
line-height: 30px;
height: 0px;
list-style-type: none;
overflow: hidden;
padding: 0px
}

.menu-item-home ul a, .menu-item-garden ul a, .menu-item-construction ul a {
margin-left: 2.5px;
text-decoration: none;
color: #404041;
diplay: block;
width: 173px;
}

/* li styles */
.menu-item-home li, .menu-item-garden li, .menu-item-construction li {
border-bottom: 1px solid #eee;
}

.menu-item-home li:hover, .menu-item-garden li:hover, .menu-item-construction li:hover {
background: #eee;
}

/* ul styles */
.menu-item-home ul, .menu-item-construction ul, .menu-item-garden ul {
background: #fff;
font-size: 12px;
line-height: 30px;
min-height: 0px;
max-height: 0px /* collapses the menu */
list-style-type: none;
overflow: hidden;
padding: 0px;

/* Animation */
-webkit-transition: height 1s ease;
-moz-transition: height 1s ease;
-o-transition: height 1s ease;
-ms-transition: height 1s ease;
transition: height 1s ease;
}

.menu-item-home:hover ul {
height: 155px;
}

.menu-item-garden:hover ul {
height: 220px;
}

.menu-item-construction:hover ul {
height: 90px;
}

CSS sheet needs cleaning up a bit but you get the general jist!

A: You want that menu to appear on click event.
To make that possible and to also make that cross browser compatible i would recommend using a jquery library jQuery just download the library and attach the link in the  section of your page and simply write jquery code to attach click event handler.
jQuery Download Link
basically you need to code only this much
after you link the jquery to your page write this in

and a little change to css is also required.and thats it you wana do.
have changed your css code and witten the jquery code  for you for your website
check this link and you will have both your changed code.
and on the right side is the working website with click enabled.
http://jsfiddle.net/znsZu/
Hope it helps.


text:
Q: Android debug keystore hash key failure in facebook I use Java 1.8 version and OpenSSL 1.0.2f.
But when I generate a hash key it will not match with Facebook hash key.
I regenerate an Android debug key manually and through Eclipse but no effect.
My Google+ API is also not working.
I am using a MAC system.

A: Try running the following code in your Activity's onCreate()
try {
    PackageInfo info = getPackageManager().getPackageInfo(
                           getPackageName(),
                           PackageManager.GET_SIGNATURES);
    for (Signature signature : info.signatures) {
        MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(signature.toByteArray());
        Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
    }
}
catch (NameNotFoundException e) {

}
catch (NoSuchAlgorithmException e) {

}

see if that gives you anything like my tool gives.
note that you should run the tool on the debug.keystore file, the same one
that Android studio uses.
if it does, than it's the right one.


text:
Q: data Binding with Nativescript I'm starting a project with Nativescript and I'm trying to make a page to create the user. This is my create.user.component.ts
import { Component } from '@angular/core';

import { RouterExtensions } from 'nativescript-angular/router';

import firebase = require('nativescript-plugin-firebase');

@Component({
    selector:'create-user',
    template:`
                <StackLayout>
                    <Label class="titulo" text="Create User"></Label>
                    <TextField hint="Email" keyboardType="text" [(ngModel)]="email"
                        autocorrect="false" autocapitalizationType="none"></TextField>
                    <TextField hint="Password" secure="true" [(ngModel)]="password"
                        autocorrect="false" autocapitalizationType="none"></TextField>
                    <Button class="submit-botton" (tap)="create()" text="Crear usuario"></Button>
                </StackLayout>
        `,
    styleUrls:['login/login.component.css']
})
export class CreateUserComponent{

    email:string;
    password:string;

    constructor(private routerExt: RouterExtensions ){}

        create(){
            firebase.createUser({
                email:this.email,
                password: this.password

            }).then(
                (result)=>{

                    this.routerExt.navigate(["/chatListado"],{
                        transition:{
                            name: "flip",
                            duration:500,
                            curve:"linear"
                        }
                    });
                    console.log("User Created");
                },
                (errorMessage)=>{
                    alert('error: ' + errorMessage);
                }
            );

        }
}

At the beginning when I tap the button to create it, it returns undefined. I couldn't get the email and the password and after searching I observed that I needed to import the NativeScriptFormsModule in my app.module.ts so I made it.
app.module.ts
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";

//use the data binding
import { NativeScriptFormsModule} from "nativescript-angular/forms"

import { AppRoutingModule } from "./app.routing";
import { AppComponent } from "./app.component";

//login
import { LoginComponent } from "./login/login.component";
import { Login} from './login/login';
import { CreateUserComponent } from './login/create.user.component';

@NgModule({
    bootstrap: [
        AppComponent
    ],
    imports: [
        NativeScriptModule,
        AppRoutingModule,
        NativeScriptFormsModule
    ],
    declarations: [
        AppComponent,
        LoginComponent,
        CreateUserComponent

    ],
    providers: [
    ],
    schemas: [
        NO_ERRORS_SCHEMA
    ]
})
export class AppModule { }

With this theoretically it should work but now when I start the app I get this error on my console:

JS: ERROR Error: Uncaught (in promise): Error: No value accessor for
  form control with unspecified name attribute JS: Error: No value
  accessor for form control with unspecified name attribute JS:     at
  _throwError (file:///data/data/com.Mystory.android/files/app/tns_modules/@angular/forms/bundles/forms.umd.js:1838:11)
  [angular] JS:     at setUpControl
  (file:///data/data/com.Mystory.android/files/app/tns_modules/@angular/forms/bundles/forms.umd.js:1751:9)
  [angular] JS:     at NgModel._setUpStandalone
  (file:///data/data/com.Mystory.android/files/app/tns_modules/@angular/forms/bundles/forms.umd.js:4320:9)
  [angular] JS:     at NgModel._setUpControl
  (file:///data/data/com.Mystory.android/files/app/tns_modules/@angular/forms/bundles/forms.umd.js:4306:37)
  [angular] JS:     at NgModel.ngOnChanges
  (file:///data/data/com.Mystory.android/files/app/tns_modules/@angular/forms/bundles/forms.umd.js:4237:18)
  [angular] JS:     at checkAndUpdateDirectiveInline
  (file:///data/data/com.Mystory.android/files/app/tns_modules/@angular/core/bundles/core.umd.js:10715:19)
  [angular] JS:     at checkAndUpdateNodeInline
  (file:///data/data/com.Mystory.android/files/app/tns_modules/@angular/core/bundles/core.umd.js:12097:17)
  [angular] JS:     at checkAndUpdateNode
  (file:///data/data/com.Mystory.android/files/app/tns_modules/@angular/core/bundles/core.umd.js:12065:16)
  [angular] JS:     at debugCheckAndUpdateNode
  (file:///data/data/com.Mystory.android/files/app/tns_modules/@angular/core/bundles/core.umd.js:12694:59)
  [angular] JS:     at debugCheckDirectivesFn
  (file:///data/data/com.Mystory.android/files/app/tns_modules/@angular/core/bundles/core.umd.js:12635:13)
  [angular] JS:     at Object.eval [as updateDirectives]
  (ng:///AppModule/LoginComponent.ngfactory.js:363:5) [angular] JS:
  at Object.debugUpdateDirectives [as updateDirectives]
  (file:///data/data/com.Mystory.android/files/app/tns_modules/@angular/core/bundles/core.umd.js:12620:21)
  [angular] JS:     at checkAndUpdateView
  (file:///data/data/com.Mystory.android/files/app/tns_modules/@angular/core/bundles/core.umd.js:12032:14)
  [angular] JS:     at callViewAction
  (file:///data/data/com.Mystory.android/files/app/tns_modules/@angular/core/bundles/core.umd.js:12347:17)
  [angular]

And now I can not go to the page to create the user...
Someone knows what is happening here? If I'm missing something or something like that?
Thanks and sorry for my bad English!


text:
Q: Delete unused generated ResponseEntityReq schema in swagger apidoc or in swagger ui I tried adding the ResponseEntity as a response to my endpoint
@ApiResponse(responseCode = "200", description = "Success", content = {@Content(mediaType = "application/json", schema = @Schema(implementation = ResponseEntity.class))})

But in my apidoc I was getting
Error-ModelName{namespace='org.springframework.http', name='ResponseEntity'}

under my response section.
After some digging the solution I found was adding that model in my bean
.additionalModels(
      typeResolver.resolve(ResponseEntity.class)
)

And I was able to get the correct schema for ResponseEntity called ResponseEntityRes, but now swagger had generated another schema ResponseEntityReq.
This has nothing in it and I don't need this schema, so is there a way to remove this from the apidoc or better way to appraoch the Error-ModelName problem?
My swagger ui. I don't need this ResponseEntityReq schema: