text:
Q: Node-RED: uibuilder node: Update html element (Vue.js) I am using the "uibuilder" node in Node-RED to create a floorplan, based on this one, where the light of a bulb should change the color based on the input (grey, red or green).
In the example the color is changed with true or false and works fine, but as i need three different colors, i have to get another solution or is it possible to use "undefined" as a third option?
I have no idea how or where i could build in a switch statement there.
Can someone lead me in the right direction?
My code snippets:
html-file:
    <script type="text/x-template" id="bulb-template">
        <svg @click="doClick" :style="ciconstyle" :height="height" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
            <defs>
                <filter id="shadow">
                    <feDropShadow dx="1" dy="1" stdDeviation="5" flood-opacity="50%" />
                </filter>
                <filter id="glow" filterUnits="userSpaceOnUse"
                        x="-40%" y="-50%" width="200%" height="200%">
                    <!-- blur the text at different levels-->
                    <feGaussianBlur in="SourceGraphic" stdDeviation="5" result="blur5"/>
                    <feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur10"/>
                    <feGaussianBlur in="SourceGraphic" stdDeviation="20" result="blur20"/>
                    <feGaussianBlur in="SourceGraphic" stdDeviation="30" result="blur30"/>
                    <feGaussianBlur in="SourceGraphic" stdDeviation="50" result="blur50"/>
                    <!-- merge all the blurs except for the first one -->
                    <feMerge result="blur-merged">
                        <feMergeNode in="blur10"/>
                        <feMergeNode in="blur20"/>
                        <feMergeNode in="blur30"/>
                        <feMergeNode in="blur50"/>
                    </feMerge>
                    <!-- recolour the merged blurs red-->
                    <feColorMatrix result="red-blur" in="blur-merged" type="matrix"
                                    values="1 0 0 0 0
                                            0 0.06 0 0 0
                                            0 0 0.44 0 0
                                            0 0 0 1 0" />
                    <feMerge>
                        <!--<feMergeNode in="red-blur"/>        largest blurs coloured red -->
                        <feMergeNode in="blur-merged"/>
                        <feMergeNode in="blur5"/>          <!-- smallest blur left white -->
                        <feMergeNode in="SourceGraphic"/>  <!-- original -->
                    </feMerge>
                </filter>
                <slot name="filter"></slot>
            </defs>
            <title>{{title}}</title>
            <slot name="icon"><path :fill="cfillcolor" d="M511.549861 803.293331H408.419043a73.232959 73.232959 0 0 1-67.1862-41.991375 59.795719 59.795719 0 0 1-6.71862-30.569722 207.60536 207.60536 0 0 0-33.593101-113.88061 196.519637 196.519637 0 0 0-27.882273-33.5931A463.248853 463.248853 0 0 1 217.274302 504.314738a399.086031 399.086031 0 0 1-36.95241-75.248544 242.542184 242.542184 0 0 1-15.116895-77.264131 349.032312 349.032312 0 0 1 8.062344-84.990544 314.76735 314.76735 0 0 1 51.733375-114.888403A367.172586 367.172586 0 0 1 361.724634 34.011334 327.532728 327.532728 0 0 1 433.949799 8.144647 369.524103 369.524103 0 0 1 528.682342 0.418234a333.579486 333.579486 0 0 1 126.310057 29.225997 326.860866 326.860866 0 0 1 70.881442 44.678824A382.625412 382.625412 0 0 1 808.848799 168.383736a314.095488 314.095488 0 0 1 41.991375 105.146403 312.751764 312.751764 0 0 1 6.382689 92.045095 275.799353 275.799353 0 0 1-20.15586 76.256338 449.139751 449.139751 0 0 1-61.139443 107.16199 497.513815 497.513815 0 0 1-33.5931 39.639858 160.575019 160.575019 0 0 0-31.241583 48.038134 215.331773 215.331773 0 0 0-18.812136 55.428615c-1.679655 11.757585 0 23.179239-2.687448 33.5931a171.660742 171.660742 0 0 1-3.695241 25.194826 69.873649 69.873649 0 0 1-33.593101 40.647651 74.576683 74.576683 0 0 1-39.639858 10.07793zM490.050277 88.768088c-11.085723 0-22.171446 2.351517-33.5931 4.031172a210.96467 210.96467 0 0 0-74.240752 26.538549 244.221839 244.221839 0 0 0-55.428616 44.342893 222.386324 222.386324 0 0 0-43.335099 63.82689 230.784599 230.784599 0 0 0-19.483998 94.732543 28.218204 28.218204 0 0 0 33.5931 28.890066 28.890066 28.890066 0 0 0 22.171446-26.202618v-13.773171a167.965501 167.965501 0 0 1 9.406068-49.045927 184.762052 184.762052 0 0 1 64.834684-83.98275 167.965501 167.965501 0 0 1 93.72475-33.593101 142.770676 142.770676 0 0 0 18.140274 0 23.851101 23.851101 0 0 0 19.148067-15.452826 33.5931 33.5931 0 0 0 0-19.483998 23.51517 23.51517 0 0 0-20.491791-18.140274 122.950747 122.950747 0 0 0-15.116895 0zM647.601917 943.040628a15.788757 15.788757 0 0 1-13.773171 15.116895H400.356699a17.468412 17.468412 0 0 1-16.460619-8.734206 18.812136 18.812136 0 0 1 0-20.15586 16.124688 16.124688 0 0 1 16.460619-4.703034h227.089358a19.148067 19.148067 0 0 1 19.148067 20.827722zM405.731595 899.369598a18.140274 18.140274 0 0 1-16.460619-12.765378 17.804343 17.804343 0 0 1 15.452826-23.851101H635.508401a18.812136 18.812136 0 0 1 17.804343 13.773171 19.819929 19.819929 0 0 1-10.749792 21.499584 24.187032 24.187032 0 0 1-8.734206 0H423.535938zM437.64504 1022.992207a17.132481 17.132481 0 0 1-15.452826-9.406068 18.140274 18.140274 0 0 1 15.116895-26.202618h139.411367a19.819929 19.819929 0 0 1 19.483998 17.804343 16.124688 16.124688 0 0 1-8.734206 15.788757 19.148067 19.148067 0 0 1-9.741999 3.023379H442.348074z" /></slot>
            <slot name="default"></slot>
        </svg>
    </script>

    <bulb id="a" :color="isona ? 'green' : 'red'" :glow="isona" :clickable="true" style="left: 33%; top: 24%" @bulbclicked="myClick" title="A: clicked"></bulb>
    <bulb id="b" :ison="isonb" :clickable="true"  style="left: 25%; top: 65%" @bulbclicked="myClick" title="B"></bulb>

js-file:
        template: '#bulb-template',
        props: {
            color: {
               type: String,
               required: false,
               default: 'grey',
            },
            ...

            ison: {
                type: Boolean,
                required: false,
                default: false,
            },
    ...

    var app1 = new Vue({
        el: '#app',
        data: {
            isonb: false,
            isona: false,
            isonc: false,
            isond: false,
        },
        // Get things started
        mounted: function(){

            /** **REQUIRED** Start uibuilder comms with Node-RED */
            uibuilder.start()

        // msg is updated when a standard msg is received from Node-RED
            uibuilder.onChange('msg', function(msg){

                if ( msg.payload.hasOwnProperty('A') ) {
                    app1.isona = msg.payload.A
                }
                if ( msg.payload.hasOwnProperty('B') ) {
                    app1.isonb = msg.payload.B
                }
                if ( msg.payload.hasOwnProperty('C') ) {
                    app1.isonc = msg.payload.C
                }
                if ( msg.payload.hasOwnProperty('D') ) {
                    app1.isond = msg.payload.D
                }
            })
        } // --- End of mounted hook --- //
    }) // --- End of app1 --- //


text:
Q: sas macro for appending 24 tables Hi I need help to append 24 sas tables. I would like to write a macro that appends 24 tables.
How do I create a do loop with the least amount of typing.
Thanks
proc sql;
create table master as
select * from table1
 union all
select * from table2
union all
select * from table3;
quit;

A: I think you did not need a macro. Just type
data master;
set table1-table24;
run;

redpajama_set_name: RedPajamaStackExchange


text:
Q: Using jruby-openssl in Mule Studio I need to use openssl in Ruby in Mule Studio. Mule Studio comes pre-packaged with JRuby. As I'm sure you know, JRuby doesn't include openssl. I downloaded the jruby-openssl gem and included the files in my Mule project. I can require the files, all except for jopenssl.jar. Actually I can require it, but it doesn't seem to do anything. I see the following error:
uninitialized constant OpenSSL::Digest::OPENSSL_VERSION_NUMBER

This is of course referring to the OpenSSL::OPENSSL_VERSION_NUMBER.
Just for fun I manually defined it, but then it kept finding more and more uninitialized constants. I've read some articles saying that the only way to use jruby-openssl is to unzip and combine jruby-complete.jar and jopenssl.jar. Since Mule is using its own copy of JRuby, that's not feasible, not to mention a ridiculous kludge.
So please, does anyone know how to use jruby-openssl in Mule Studio? (FYI I am new to both Mule and JRuby, but am quickly learning to dislike both.)
Addendum
A bit of background: We need to transport files over FTPS with Mule. Since it's not directly supported, and we have an existing Ruby implementation, we decided to simply move the Ruby code into Mule. But it requires openssl, which is where this problem began. The require 'openssl' line above is what triggers the error.
Here is the relevant Mule/Ruby code:
<scripting:transformer name="SetData" doc:name="Set Data">
    <scripting:script engine="jruby">
        <scripting:text><![CDATA[
          require 'socket'
          require 'openssl'
          require 'net/ftp'
          require 'implicit_ftps'
          ...
        ]]></scripting:text>
    </scripting:script>
</scripting:transformer>

At your suggestion, I rebuilt the Mule Environment Library, substituting a new JRuby version which includes jopenssl.jar. However I now receive the following error when running my app. As far as I know, except for jruby-complete.jar, nothing else has changed.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/consolo/bin/MuleStudio/plugins/org.mule.tooling.server.3.2.1_1.0.0.201201200937/mule/boot/mule-module-logging-3.2.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/consolo/bin/MuleStudio/plugins/org.mule.tooling.server.3.2.1_1.0.0.201201200937/mule/boot/mule-module-logging-3.2.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

Update
Sadly after days of wasted effort, my company has decided that supporting FTPS via Mule is not worth it.

A: Scripting language support in Mule is pluggable and achieved via JSR-223-compliant providers. Mule CE only embeds Groovy, ie you will have to add JRuby to Mule, which will give you the opportunity to pick whatever JAR(s) are needed to achieve your goal.
On the other hand, Mule Studio embeds extra scripting providers, including JRuby. This is convenient but may create issues if a specific version is needed (which seems to be your case).
In Studio, if you open the Mule Runtime library, you'll find jruby-engine-1.1-jdk14.jar and jruby-complete-1.0.jar. Unfortunately Studio doesn't allow modifying this library, so your best option would be to create a new one, picking all the JARs under /plugins/org.mule.tooling.server.3.2.1_1.0.0.201201200937/mule except the jRuby ones (in ./user) and then add the ones you really need.


text:
Q: Vue: Accessing elements of a bound variable containing an array I have a variable in my Vue object containing an array, and when I try to access it in mustache notation it's an empty array.
I've tried showing it with array notation, and I've successfully surfaced a scalar variable from the same vue object and scope.
I have a Vue instance (trimmed down a bit):
MyVueInstance = new Vue({
    el: '#application-component',
    data() {
        return {
            form_in_progress: [],
            myvar: "foo"
        }
    },
    methods: {
        setFormInProgress: function(key, value){
            this.form_in_progress[key] = value;
        },
        addAllFieldsToFormInProgress: function (step, currentform) {

            console.log('addAllFieldsToFormInProgress: step:' + step);

            console.log(MyVueInstance.$refs);
            console.log(MyVueInstance.$refs[currentform].length);
            for (i = 0; i < MyVueInstance.$refs[currentform].length; i++) {
                MyVueInstance.setFormInProgress(MyVueInstance.$refs[currentform][i].name,
                MyVueInstance.$refs[currentform][i].value);
                console.log('Name: ' + MyVueInstance.$refs[currentform][i].name + " value: " + MyVueInstance.$refs[currentform][i].value);

            }
            console.log("form_in_progress:");
            console.log(MyVueInstance.form_in_progress)
            console.log("end of addAllFields...");
        }
    }
 }

IN a caught event, I'm able to do:
mounted: function () {
    Event.$on('step2', function () {
        console.log('caught event step2');
        // applicantform is a ref= on the form.
        MyVueInstance.addAllFieldsToFormInProgress(2, 'applicantform')
    });
}

I can see my console logs producing a good dump of MyVueInstance.form_in_progress.  (The events do not have "this" in scope,
so I have to specify the Vue instance. )
The dump looks like so:
[_token: "dyUPurwtLLrXsxEBOsCfZULfETjW3auSI9utn1GH", hoh-first-name: "", hoh-middle-initial: "", hoh-last-name: "", hoh-ssn: "111-11-1111", …]
button: ""
hoh-citizenship: ""
hoh-dob: "month day, year"
hoh-email: ""
hoh-ethnicity: ""
hoh-first-name: ""
hoh-home-number: ""
hoh-last-name: ""
hoh-middle-initial: ""
hoh-mobile-number: ""
hoh-needs-accommodation: ""
hoh-needs-accommodation-type[]: "Sight"
hoh-notifications: "1"
hoh-race[]: "5"
hoh-sex: ""
hoh-ssn: "111-11-1111"
hoh-work-number: ""
physical-apt-suite-other: ""
physical-city: ""
physical-mailing-check: "1"
physical-state: ""
physical-state_input: ""
physical-street-address: ""
physical-zip: ""
_token: "dyUPurwtLLrXsxEBOsCfZULfETjW3auSI9utn1GH"
length: 0

When I get past step 2, I try to echo out the variables using mustache notation or a v-for.
    {{ myvar }} - {{ form_in_progress}}

{{key}}

I discover that (on the first line above, I can successfully surface myvar, but form_in_progress displays an empty array,
and the v-for loop does not run, behaving as if form_in_progress is empty, which is consistant with echoing out a
pair of empty square brackets.
So I wonder why my scalar variable (myvar) is in scope, but my array (form_in_progress) is in scope but empty.
If it were out of scope I'd expect an error, not a pair of empty square brackets.
Just for fun I tried echoing out form_in_progress.length, and indeed, it's zero.
One thing I notice is that myvar was initialized as "foo" in code, while form_in_progress was dynamically filled in a method.
Can somebody explain how to get the values in form_in_progress to be in scope?
Thanks,
Ed

A: Directly assigning to a particular index in an array is not reactive: List rendering caveats:

Due to limitations in JavaScript, Vue cannot detect the following
changes to an array:

*

*When you directly set an item with the index, e.g. vm.items[indexOfItem] = newValue

*When you modify the length of the array, e.g. vm.items.length = newLength

Instead, try this.form_in_progress.splice(key, 1, value);.

Consider the following example:
changeWithBrackets will do what your code does effectively:
this.form_in_progress[key] = value;

changeWithSplice will do what I propose:
this.form_in_progress.splice(key, 1, value);

Demo:

const app = new Vue({
  el: "#app",
  data() {
    return {
      items: ["foo", "bar", "fizz", "buzz"]
    };
  },
  methods: {
    changeWithBrackets() {
      this.items[0] = "world";
    },
    changeWithSplice() {
      this.items.splice(0, 1, "world");
    }
  }
});

{{item}}

  <button @click="changeWithBrackets">Change with brackets</button>
  <button @click="changeWithSplice">Change with splice</button>


text:
Q: Type inference from enum with ORM-like model I have an enum DataType { NUMBER, STRING } and an object const example: Record<string, DataType> = { id: DataType.NUMBER, name: DataType.STRING }.
I would like the TypeScript to understand that example.id is a number (instead of DataType.NUMBER), and the same with example.name being seen as string instead of DataType.STRING through a generic converter() function.
It's not necessary to implement the function, just the type inference according to the passed argument for it:
function converter(...): infer type here { ... }

const example = converter({ id: DataType.NUMBER, name: DataType.STRING });

ts.typeof example.id === number
ts.typeof example.name === string

My goal is that the user should pass a data model ("schema") and the function will return a value compatible with the data model, similar to an ORM.
class Model {
    public get(... columns: string[]) {
        // ...
    }
}

class User extends Model {
    public columns: {
        id: DataType.NUMBER,
        name: DataType.STRING,
        age: DataType.NUMBER
    }
}

const user = new User.get("id", "name")

ts.typeof user === { id: number, name: string }

Edit #1: as a complement, in reality, I can get the result easily like this:
function convert<T extends Record<string, DataType>>(schema: T) {
     return {} as ConvertedType = { [K in keyof T]: T[K] extends DataType.NUMBER ? number : T[K] extends DataType.STRING ? string : never };
}

And although it works fine, it doesn't work in more complex codes like:
interface Schema {
  [k: string]: DataType
}

type SchemaReturn<S extends Schema, C extends keyof S> = {
    [K in C]: S[K] extends DataType.NUMBER ? number : S[K] extends DataType.STRING ? string : never;
};

abstract class Model {
  public schema: Schema = {};

  public select<C extends keyof this["schema"]>(... columns: C[]) {
    return {} as SchemaReturn<typeof this["schema"], C>;
  }
}

class User extends Model {
  public schema = {
    id: DataType.NUMBER,
    name: DataType.STRING,
    age: DataType.NUMBER
  }
}

const user = new User;
const data = user.select("id", "name");

data.id; // Must be `number` but got `never`
data.name; // Must be `string` but got `never`

A: I got a result very close to what I would like, despite having replaced the enum by a const and generating a certain "strangeness" in the type of the schema property:
const DataType = {
  NUMBER: 0,
  STRING: 1,
} as const;

interface Schema {
  [k: string]: typeof DataType[keyof typeof DataType];
}

type SchemaReturn<S extends Schema, C extends keyof S> = {
  [K in C]
    : S[K] extends typeof DataType.NUMBER ? number
    : S[K] extends typeof DataType.STRING ? string
    : never;
};

class User extends Model {
  public schema = {
    // And here are the odd ones:
    id: DataType.NUMBER, // ts.typeof id === 0 (but expected to keeped DataType.NUMBER)
    name: DataType.STRING, // ts.typeof id === 1 (but expected to keeped DataType.STRING)
    age: DataType.NUMBER, // ts.typeof id === 0 (but expected to keeped DataType.NUMBER)
  };
}

// ...
// But here I get exactly the result I would like:
data.id; // ts.typeof data.id === number
data.name; // ts.typeof data.name === string

I am open to new suggestions since I would like to keep working with enum instead of JS const.


text:
Q: Hive (or MySQL): Finding event of different type with maximum timestamp I am trying to write a hive query where I am interested in the relationship between two different even types that are in the same table.  For example, say my table is built like this:
event_type     timestamp             source
completion     2013-03-04 12:00:55   NULL
completion     2013-03-04 11:55:55   NULL
impression     2013-03-04 11:53:45   A
impression     2013-03-04 11:57:55   A
impression     2013-03-04 11:58:00   B

For every completion, I would like to grab the timestamp of the most recent impression, and its source.  For example, what I would hope to get out of a query on the above sample would be:
completion_timestamp    most_recent_impression    source
2013-03-04 12:00:55     2013-03-04 11:58:00       B
2013-03-04 11:55:55     2013-03-04 11:53:45       A

Any tips?

A: This relies on times being unique. You should probably add an id column to get around that.
The subquery gets each completion time (GROUP BY c.ts) and the latest impression time (MAX(i.ts)) that was before the completion time (i.ts < c.ts).
SELECT
  completionTime, impressionTime, s.source
FROM
(SELECT
  c.ts AS completionTime, MAX(i.ts) AS impressionTime
FROM t AS c
JOIN t AS i
WHERE c.event_type = 'completion'
AND i.event_type = 'impression'
AND i.ts < c.ts -- impressions happen before completions
GROUP BY c.ts) AS t2
JOIN t AS s ON s.ts = t2.impressionTime
ORDER BY completionTime DESC

Good ole SQLFiddle


text:
Q: Windows processes; how to find orphans from known dead parents? This question may be slightly academic; but yet something puzzling.
Assume on a windows (8+) machine you have a process (in this case a service), say proc_0. I can send a request to this to run something specific. This is done by proc_0 starting (say) proc_a. proc_a then spawns proc_b which in turn may spawn proc_c, which again may spawn proc_d
We'll end up in this process tree:
proc_0
|_proc_a
|____proc_b
|______proc_c
|________proc_d
Let's say I have only influence what happens in proc_b.
Ok, what we want is if proc_a dies, every child of proc_a should die too.
The problem arises if proc_0 kills proc_a. On windows this "orphan" proc_b and it (and its children) stay alive.
Now, proc_b, the one and only process I can decide what to do in, is actually watching what happens, i.e. if proc_a dies it will kill its children. Fine. proc_b may know about proc_c's child proc_d, so it kills that, and then kills proc_c.
But here it goes theoretical.... before proc_c actually got killed by proc_b, proc_c just spawned another child proc_z. proc_b has now no idea of proc_z... which will get orphaned when proc_c eventually dies (remember, I cannot do anything on how proc_c behaves or even if it got killed the hard way for some other reason). Now the processes looks like this:
proc_0
proc_b (orphaned, but I know)
proc_z (orphaned, but I dunno)
proc_b I can terminate my self, but is there any way to detect that proc_z was actually started by a process I knew about and just killed (i.e. it should die too).
Ok, I can find the orphaned proc_z, but yet, how can I decide if it is ok to kill? proc_z will have no parent process, but might have an old parent pid. Even I could know this pid was actually the one I knew from proc_c, but I have no chance to actually detect if proc_z was actually started by proc_c or a completely different process that also died, where the OS just happened to reuse the pid from my dead proc_c
To relate to reality, this is about what I see on a windows jenkins slave; which caused me to insert proc_b, because cancelling a job leaves subprocesses running. There might be an update to jenkins on this, but the "theoretical" problem - to decide whether to kill this orphan or not - is still in play, I think.


text:
Q: Transfer Compression with Cloudfront and nginx SSI Is there any way to enable GZIP / Brotli compression on Cloudfront if the origin is a nginx server with SSI (Server Side Includes) enabled?
The issue seems that nginx SSI drops the Content-Length header, as it doesn't know the content length at the time of sending the headers as the file hasn't been parsed. However, Cloudfront apparently requires the Content-Length header to compress the request:

The response must include a Content-Length header so CloudFront can determine whether the size of the file is in the range that CloudFront compresses. If the Content-Length header is missing, CloudFront won't compress the file.

Cloudfront Documentation
Is there any way to enforce nginx to parse the whole file (and apply the SSI) before sending the headers and therefore including the Content-Length as well? Or even better: Force Cloudfront to compress subsequent cache hits for which it obviously already knows the content length?


text:
Q: MONTHS_BETWEEN / NTH_VALUE I have some unique logic I am hoping to put into a query, rather than have to call out to a function.
In this application, I am looking at the last 4 reported quarters for a given ticker symbol.  The dates in the table are represented as YYYYMM as in this case:
201804,
201801,
201710,
201704

Now, it is possible there may be a quarter missing.  Maybe the company did not submit the quarterly report, or whatever.
So, what I am trying to do is see if there is a gap, or missing quarter:
201804,
201710,
201704,
201701

Here, 201801 is missing........I guess somehow I have to be able to compare the MONTHS_BETWEEN the current record date, and LEAD 1, or NTH_VALUE 1 date value, and see that the difference is 3 months.......for the last 4 records back (4 quarters).  If not, some record is missing, and I'll return a NULL value, which is what the application requires.
Any thoughts or unique logic?  Or would I need to code a function, and call out to it?
Thanks!!!

A: Just convert everything to date and use date manipulation with self joins
SQL Fiddle
With cte as (
  SELECT "val",
          TO_DATE("val", 'YYYYMM') as original
  FROM Table1
)
SELECT c1."val", c1.original,
       c2.original as next_quarter,
       c3.original as previous_quarter
FROM cte c1
LEFT JOIN cte c2
  ON c1.original = ADD_MONTHS(c2.original, -3)
LEFT JOIN cte c3
  ON c1.original = ADD_MONTHS(c3.original, 3)

ORDER BY c1."val"

OUTPUT
|    val |             ORIGINAL |         NEXT_QUARTER |     PREVIOUS_QUARTER |
|--------|----------------------|----------------------|----------------------|
| 201701 | 2017-01-01T00:00:00Z | 2017-04-01T00:00:00Z |               (null) |
| 201704 | 2017-04-01T00:00:00Z |               (null) | 2017-01-01T00:00:00Z |
| 201710 | 2017-10-01T00:00:00Z |               (null) |               (null) |
| 201804 | 2018-04-01T00:00:00Z |               (null) |               (null) |

A: You can create a calendar of quarters and outer join this data with your quarter data. This is how the query looks. The p_start_year is the year where your calendar starts and the p_no_of_qtrs counts the how many quarters show up in the calendar.
WITH
    mydata
    AS
        (SELECT '201804' AS quarter FROM DUAL
         UNION
         SELECT '201801' AS quarter FROM DUAL
         UNION
         SELECT '201710' AS quarter FROM DUAL
         UNION
         SELECT '201704' AS quarter FROM DUAL),
    calendar
    AS
        (SELECT TO_CHAR (
                    ADD_MONTHS (
                        TO_DATE (:p_start_year || '-01-01', 'YYYY-MM-DD'),
                        (LEVEL
                         - 1)
                        * 3
                    ),
                    'YYYYMM'
                )
                    AS quarter
         FROM DUAL
         CONNECT BY LEVEL <= :p_no_of_qtrs)
SELECT c.quarter, d.quarter AS status
FROM mydata d,
     calendar c
WHERE c.quarter = d.quarter(+)
ORDER BY c.quarter;

This is the result.
QUARTER | STATUS
201701  |
201704  | 201704
201707  |
201710  | 201710
201801  | 201801
201804  | 201804
201807  |
201810  |

The missing quarters show up as NULLs.


text:
Q: What does w3c : false under chrome options assert? I am trying to run a protractor test, and had to include the following
chromeOptions: {
            args: ["--incognito"],
            w3c : false
        }

Had to set w3c flag to false, as it was affecting the keyboard events. But by doing so, the test is failing in other scenario. I want to know what is happening when w3c is set to false.


text:
Q: php parse xml problems I'm trying to parse an xml generated by excel, but i'm hitting a stag.
I cant get anywhere below the Workbook node:
$benregxml = simplexml_load_file('00_ben_reg_main.xml');
$wrkbook = $benregxml->Workbook->Worksheet;
print_r($wrkbook);

If i log Workbook, that works (output is SimpleXMLElement Object ( )).
I'm actually trying to get the row node, but nothing i try appears to work.
Excel XML code looks like this:
<?xml version="1.0" ?>
<?mso-application progid="Excel.Sheet" ?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">
    <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
        <Author>Ognen Plavevski</Author>
        <LastAuthor>Ognen Plavevski</LastAuthor>
        <Created>2013-05-24T20:28:09Z</Created>
        <Version>14.00</Version>
    </DocumentProperties>
    <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
        <AllowPNG/>
    </OfficeDocumentSettings>
    <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
        <WindowHeight>10035</WindowHeight>
        <WindowWidth>22995</WindowWidth>
        <WindowTopX>480</WindowTopX>
        <WindowTopY>45</WindowTopY>
        <ProtectStructure>False</ProtectStructure>
        <ProtectWindows>False</ProtectWindows>
    </ExcelWorkbook>

    </Styles>
    <Worksheet ss:Name="Sheet1">

            <Row>
                <Cell ss:StyleID="s62">
                    <Data ss:Type="String">ID</Data>
                </Cell>
                <Cell ss:StyleID="s62">
                    <Data ss:Type="String">PARENT_RECORD_ID</Data>
                </Cell>
                <Cell ss:StyleID="s62">
                    <Data ss:Type="String">PARENT_PAGE_ID</Data>
                </Cell>
                <Cell ss:StyleID="s62">
                    <Data ss:Type="String">PARENT_ELEMENT_ID</Data>
                </Cell>
                <Cell ss:StyleID="s62">
                    <Data ss:Type="String">CREATED_DATE</Data>
                </Cell>
                <Cell ss:StyleID="s62">
                    <Data ss:Type="String">CREATED_BY</Data>
                </Cell>
                <Cell ss:StyleID="s62">
                    <Data ss:Type="String">CREATED_LOCATION</Data>
                </Cell>
                <Cell ss:StyleID="s62">
                    <Data ss:Type="String">CREATED_DEVICE_ID</Data>
                </Cell>
                <Cell ss:StyleID="s62">
                    <Data ss:Type="String">MODIFIED_DATE</Data>
                </Cell>
                <Cell ss:StyleID="s62">
                    <Data ss:Type="String">MODIFIED_BY</Data>
                </Cell>
                <Cell ss:StyleID="s62">
                    <Data ss:Type="String">MODIFIED_LOCATION</Data>
                </Cell>
                <Cell ss:StyleID="s62">
                    <Data ss:Type="String">MODIFIED_DEVICE_ID</Data>
                </Cell>
            </Row>

        <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
            <PageSetup>

                <PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75" />
            </PageSetup>
            <Selected/>
            <Panes>
                <Pane>
                    <Number>3</Number>
                    <RangeSelection>R1C1:R101C19</RangeSelection>
                </Pane>
            </Panes>
            <ProtectObjects>False</ProtectObjects>
            <ProtectScenarios>False</ProtectScenarios>
        </WorksheetOptions>
    </Worksheet>
    <Worksheet ss:Name="Sheet2">

        <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
            <PageSetup>

                <PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75" />
            </PageSetup>
            <ProtectObjects>False</ProtectObjects>
            <ProtectScenarios>False</ProtectScenarios>
        </WorksheetOptions>
    </Worksheet>
    <Worksheet ss:Name="Sheet3">

        <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
            <PageSetup>

                <PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75" />
            </PageSetup>
            <ProtectObjects>False</ProtectObjects>
            <ProtectScenarios>False</ProtectScenarios>
        </WorksheetOptions>
    </Worksheet>
</Workbook>

A: Try this
$benregxml = simplexml_load_file('00_ben_reg_main.xml');
$wrkbook = $benregxml->Worksheet[0]->Table->Row;
print_r($wrkbook);

It's your level that is the problem and of course that you have 3 Worksheet tags (so it's an array). The workbook tag is the head, so
$benregxml = Workbook from the start
UPDATE
$benregxml = simplexml_load_file('00_ben_reg_main.xml');
$cells = $benregxml->Worksheet[0]->Table->Row[0];
//You need Row[0] because Row will return object, but you want just the content,
    //which is the array of cells.
echo "
"; print_r($cells); echo "
";

echo "
----------------------------------------------------------------
";
foreach( $cells as $cell ) {

    echo "
"; print_r($cell); echo "
";
}

Just to clarify, Row returns SimpleXMLElement Object which as you see in the output consists of an array of SimpleXMLElement Object of cells. If you want the object you want Row, but if you want the actual array you need Row[0]. If you find this difficult to understand I advise you to check the json format. It will help a lot. Hope this helps.


text:
Q: Equal bar widths in ggplot2 histogram using facet_wrap() I have data which looks similar to example data below and I am attempting to draw a histogram of the measurement column faceted on the Genotype column. Ultimately I would like the colours of the bars to be conditional on the Genotype and Condition columns.
Crucially Genotype B individuals were never measured under condition L.
This is what the data looks like:
library(ggplot2)
library(dplyr)

set.seed(123)
DF <- data.frame(Genotype = rep(c("A", "B"), 500),
                 Condition = sample(c("E", "L"), 1000, replace = T),
                 Measurment = round(rnorm(500,10,3), 0))

DF <- anti_join(DF, filter(DF, Genotype == "B" & Condition != "E"))'

head(DF)

  Genotype Condition Measurment
1        A         L         18
2        A         L          2
3        B         E         18
4        B         E         18
5        B         E         16
6        B         E         16

Now I to specify the colours of the bars I thought it easiest to create a new column of hexcodes such that all individuals of Genotype B are one colour, and individuals of Genotype A are a second colour if measured under Condition E and a third colour if measured under Condition L.
DF <- DF %>% mutate(colr = ifelse(Genotype == "B", "#409ccd",
                           ifelse(Condition == "E", "#43cd80", "#ffc0cb")))

I can then draw a histogram faceted on the Genotype column like so:
ggplot(data=DF, aes(Measurment, fill = Condition)) +
  geom_histogram(aes(y=..count.., fill = colr), position='dodge', binwidth = 1) +
  facet_wrap(~Genotype, nrow=2) +
  scale_fill_manual(values = c("#409ccd","#ffc0cb","#43cd80")) +
  theme(legend.position="none")

and it like like this:

However as you can see the columns for Genotype B are twice the size of Genotype A. How can I shrink the Genotype B to the same size as Genotype A?
I considered adding dummy entries to my data where Genotype B has Condition L entries but the binning function then counts these as Measurements which is misleading. I also have a version of this using geom_bar() but that results in a similar problem. ggplot must have a way of doing this.
Any help appreciated.

A: something like this maybe?
ggplot(data=DF, aes(Measurment, fill = Condition)) +
  geom_histogram(data=subset(DF, Genotype!="B"),aes(y=..count.., fill = colr), position='dodge', binwidth = 1) +
  geom_histogram(data=subset(DF, Genotype=="B"),aes(x = Measurment, y=..count.., fill = colr), position=position_nudge(x=0.25), binwidth = 0.5) +
  facet_wrap(~Genotype, nrow=2) +
  scale_fill_identity() +
  theme(legend.position="none")

A: Do you want something like the following? I assumed by size of the column you meant bar width.
library(grid)
library(gridExtra)
p1 <- ggplot(data=DF[DF$Genotype=='A',], aes(Measurment, fill = Condition)) +
  geom_histogram(aes(y=..count.., fill = colr), position='dodge', binwidth = 1) +
  scale_fill_manual(values = c("#43cd80","#ffc0cb")) +
  theme(legend.position="none")
p2 <- ggplot(data=DF[DF$Genotype=='B',], aes(Measurment, fill = Condition)) +
  geom_histogram(aes(y=..count.., fill = colr), binwidth = 0.5, boundary = 1) +
  scale_fill_manual(values = c("#409ccd")) +
  theme(legend.position="none")
grid.arrange(p1, p2)


text:
Q: AdMob using diffrent banner for one app I am using admob in my android apps to get a little money,in my apps I use mostly a top banner, but I'm wondering do I create a banner for each activity or only one banner for all the activities ? and if that can touch the earned money so which technic I use to get more money than the other

A: If you aren't using the same layout containing the banner for all activities, you'd have to define the banners for each activity's layout.
To maximize revenue, you should place one banner on each activity, set the refresh rate between 45 - 60 seconds and use ad mediation. Check this out for more
Importantly, make sure you follow the official implementation dos and don'ts so you don't get your account banned.


text:
Q: PHP replace all symbol in the beginning and the end of string or array Hello I have this variable
$str="101,102,103,104,105,@,106@107"
//or array
$str_arr = array(  0 => '101',  1 => '102',  2 => '103',  3 => '104',
                   4 => '105',  8 => '@' ,  9 => '106@ 107');

I want to remove the symbol @ between comma
The symbol may be /,\,-,| not comma
The symbol between number is correct, so it remains (key 9)
I do not know, if I had these cases but I will study it
$str="101,102,103,104,105@, 106" // One of the symbols  in the end of number
$str="101,102,103,104,105,@106" // One of the symbols in the  the beginning of number

This is The different possibilities
$str="101,102,103,/,104|,@105,106@107" //replace all symbol in the beginning and the end of number not betwwen number

this is result
$str="101,102,103,104,105,106@107";

Thanks

A: Convert the string to array using explode by ,. Parse the array using foreach loop. trim() the @ or any set of characters like @-|\/ from the beginning and end of every string, then check for empty values and push non empty values to the $arr array. Then you can join the array into a string using implode. You can do it like this:
 $arr = array();
 $str="101,102,103,104,105,@,106@107";
 $str = explode(',', $str);
 foreach($str as $s){
     $s = trim($s, "@-|\/");
     if(!empty($s)){
        $arr[] = $s;
     }
 }
$final_str = implode(',', $arr);
var_dump($final_str);


text:
Q: ibatis LazyQueryContainer - how to create QueryDefinition for a SQL? I have a set of classes that can generate SQL code for me. I would like to use a generated SQL to implement the Query interface found in ibatis. I'm trying to create a special Query component that caches all results in memory.
I'm having trouble writing this method:
public void loadAllItems() {
    String sql = buildSQL();
    List<Map<String, Object>> query = DB.rows(sql, new RowBounds(0, maxRows+1));
    this.rows = new ArrayList<Item>();
    for (Map<String,Object> row : query) {
        Item item = new PropertysetItem();
        // How can I create a QueryDefinition for my query???
        Collection<Object> propertyIds = definition.getPropertyIds();
        for (Object propertyId : propertyIds) {
            Object value = row.get(propertyId);
            if (value!=null) {
                item.addItemProperty(propertyId, new ObjectProperty(value));
            }
        }

        this.rows.add(item);
    }
}

Here, the DB.rows method returns a List of rows. For each row, column names are mapped to column values. I have the rows and values for all columns. The only problem is that I cannot put results into a list of Item instances. I don't know how to create a QueryDefinition instance for an arbitrary SQL.
I know that there is an SQL builder ( http://mybatis.github.io/mybatis-3/statement-builders.html ) but I DO NOT want to use it. I want to use a plain SQL that was already generated, and put the results into a list of Item instances. How do I do that? What kind of properties do I need to assign before I could use these items to implement the Query interface of ibatis?

A: Okay, this was silly. They are named "properties" but actually they are just column names. So if I have a plain SQL and I know the names of the colum names then I don't need a QueryDefinition at all. Suppose we have a list of column names called "colNames" for a SQL query:
public void loadAllItems() {
    String sql = buildSQL();
    List<Map<String, Object>> query = DB.rows(sql, new RowBounds(0, maxRows+1));
    this.rows = new ArrayList<Item>();
    for (Map<String,Object> row : query) {
        Item item = new PropertysetItem();
        for (Object colName : this.colNames) {
            Object value = row.get(colName);
            if (value!=null) {
                item.addItemProperty(colName, new ObjectProperty(value));
            }
        }

        this.rows.add(item);
    }
}


text:
Q: blank Kendo Window in second window opening attempt Kendo Window opening normally only in first attempt. After closing window, another attempts result in blank window without data.
      }).success(function (ContractID) {
        $('#save-contract-edit').
          append(
            '')
        $('#print-edit').kendoButton({
          click: function (e) {
            openWindowEdit($('#contract-edit').data('contract_id_edit'))
          },
        })

  function openWindowEdit (contract_id) {
      $("#dialogEdit").kendoWindow({
        width: '34%',
        minWidth: 100,
        title: 'Umowa',
        actions: [
          'Close'
        ],
        close: onClose,
        visible: false,
        position: {
          top: 100,
          left: '33%'
        },
        content: {
          url: API_URL + contract_id,
          dataType: 'json',
          iframe: false,
          template: $('#tmpPrint').html()
        }
      }
    );

    var windowEdit = $('#dialogEdit').data("kendoWindow");

    windowEdit.refresh({
      dataType: "json",
      url: API_URL + contract_id,
      template: $('#tmpPrint').html()
    });
    windowEdit.open().center()
  }

 ...


text:
Q: Java spring post form one to many relationship I'm trying to get POST form data on controller of the object have one to many relationship. Like below code
My Notification Model
private long id;
@NotBlank(message = ERROR.NOT_EMPTY)
private String title;
@NotBlank(message = ERROR.NOT_EMPTY)
private String content;
// One Notification has many User
private List<NotificationUser> listNotificationUser;;

// Getter and setter method

My controller
@RequestMapping(value = "notification/add", method = RequestMethod.GET)
public String create(ModelMap model) {
    ArrayList<User> listUser = userService.getAllUsername();
    model.put("user", listUser);
    model.addAttribute("notification", new Notification());

    return "notification/add";

}
@RequestMapping(value = "notification/add", method = RequestMethod.POST)
public String create(ModelMap model, HttpServletRequest request,
        @Valid @ModelAttribute(value = "notification") Notification notification, BindingResult bindingResult) {
    ....
}

My .jsp
<form:form method="POST" action="add" name="addForm" commandName="notification">
        <!-- Other input -->
        <form:select path="listNotificationUser" multiple="multiple" id="name" name="itemValue">
          <form:options />
          <form:options items="${user}" itemValue="id" itemLabel="name" />
        </form:select>
      <!-- Other input -->
      </form:form>

When I submit POST form to controller, the field notification.listNotificationUser always is null (other field is fine).
I was search and try some solution but it not working.

A: I guess your problem its you have a typo in your form:select. You are defining 2 options blocks, and I guess you want to define just an empty option. So should be like this
<form:select path="listNotificationUser" multiple="multiple" id="name" name="itemValue">
     <!-- Some value you can identify as empty option-->
     <form:option value="0" label="--Options--"/>
     <form:options items="${user}" itemValue="id" itemLabel="name" />
</form:select>


text:
Q: C - nested for loop patern how to get output like flipped floyds triangle? and how's the best way to solve it?
Example :
5555
_555
__55
___5

note : _ is a space
already tried lot of code but still I cant get output like that.
one of my code:
#include<stdio.h>

int main () {
    int a,b,c,n;
    scanf("%d",&n);
    for(a=1;a<=n;a++) {
        for(b=n;b>=a;b--) {
            printf(" ");
        }
        for(c=1;c<=a;c++) {
            printf("*");
        }
        printf("\n");
    }
}

A: This is not the best way... but the code is similar to the one posted by you.
int main()
{
    int a, b, c, n;
    scanf("%d", &n);
    for (a = n; a > 0; a--)
    {
        for (b = n; b >= a; b--)
        {
            printf(" ");
        }
        for (c = 1; c <= a; c++)
        {
            printf("*");
        }
        printf("\n");
    }
}

In the original post you first for loop was
for(a=1;a<=n;a++)

which meant the 2nd for loop would print n*space and the 3rd for loop would print 1 star.
By changing the first for loop to
for (a = n; a > 0; a--)

Everything gets inverted so first loop will print no space and last for loop n*stars.

A: As a joke;)
#include <stdio.h>

int main( void )
{
    int n = 5555;

    while (n)
    {
        printf("%5d\n", n);
        n /= 10;
    }

    return 0;
}

The program output is the same as required.:)
 5555
  555
   55
    5

If to use loops then the program for example can look like
#include <stdio.h>

int main( void )
{
    const char c = '5';

    while (1)
    {
        printf("Enter a non-negative number (0 - exit): ");

        unsigned int n;

        if (scanf("%u", &n) != 1 || n == 0) break;

        putchar('\n');

        for (unsigned int i = 0; i < n; i++)
        {
            unsigned int j = i + 1;
            printf("%*c", (int)j, c);
            while (j++ < n) putchar(c);
            putchar('\n');
        }

        putchar('\n');
    }

    return 0;
}

Its output might look like
Enter a non-negative number (0 - exit): 10

5555555555
 555555555
  55555555
   5555555
    555555
     55555
      5555
       555
        55
         5

Enter a non-negative number (0 - exit): 0

The inner while loop can be substituted for the for loop
for ( ; j < n; j++ )


text:
Q: How to change the background of a table cell if it meets a requirement with a button
Write a program that dynamically creates a 100x100 table. Each element
in the table will have a unique number, starting at 1 and increasing
by 1.
This page will also have a button that will be "Calculate almost prime
numbers." This button will cause all the cells in the table that have
"Almost Prime" numbers to have a yellow background.
Almost prime number: it is a number that is only divisible by itself,
the unit and by a single number that is neither the unit nor itself.

Hello, I am relatively new to the world of JavaScript and I am trying to solve this JavaScript exercise and as you can see the first part is to make a 100x100 table, which I have been able to do, the problem is the second part in which I have to change the background of the cells to the "almost prime numbers"
Here I leave my code, probably many things can be improved apart from finding a solution to putting the background color of the cells, anyway thanks if you can help me.

window.addEventListener("DOMContentLoaded", main);

function main() {
  var body = document.getElementsByTagName("body")[0];

  var tabla = document.createElement("table");
  var tblBody = document.createElement("tbody");

  for (var i = 0; i < 100; i++) {

    var fila = document.createElement("tr");

    for (var j = 0; j <= 100; j++) {
      var columna = document.createElement("td");
      var numero = document.createTextNode(j + i * 100);
      columna.appendChild(numero);
      fila.appendChild(columna);
    }
    tblBody.appendChild(fila);
  }

  tabla.appendChild(tblBody);
  body.appendChild(tabla);
  tabla.setAttribute("border", "2");
}

function casiprimos() {

  let contador = 0;

  for (var i = 0; i < 100; i++) {

    for (var j = 0; j <= 100; j++) {
      let num = (j + i * 100)
      for (var z = 1; z <= num; z++) {
        let resultado = num % z;
        if (resultado == 0) {
          contador = contador + 1;
        }
      }
      if (contador == 3) {
        // num.setAttribute("style","background-color: yellow;"); ? Idk
        contador = 0;
      } else {
        contador = 0;
      }
    }
  }
}


text:
Q: Trying to send email automatically of a Google Docs created through apps script Using script I replaced body txt in a copied doc. I want to get that doc id and send that via email automatically after doc was created. Not sure if its possible but my current code is below. Please help.
var templateFile = DriveApp.getFileById("1baIoahNT9YJ84mnUcp1pyWR0U5v235z29vPCkiv4rIc");
var templateResponseFolder = DriveApp.getFolderById("1mmFKjNnbTy2k8ZWobtcvdtIcwyse3NVd");
var copy = templateFile.makeCopy(deptName + " " + "Cost Recovery Agreement", templateResponseFolder);
var doc = DocumentApp.openById(copy.getId());
var body = doc.getBody();
body.replaceText("{{DeptName}}", deptName);
body.replaceText("{{DeptCo}}", deptCo);
body.replaceText("{{FirstName}}", firstName);
body.replaceText("{{LastName}}", lastName);
doc.saveAndClose();
var id = doc.getId();
var subject = "Welcome to ResponseMaster!";
var message = title + " " + lastName + "," + "\n\n" + "Thank you for choosing ResponseMaster as your dedicated software for your fire department.";
var costRecoveryForm = DriveApp.getFileById();
MailApp.sendEmail(userEmail, subject, message, { attachments: [costRecoveryForm] });

I am already have the e.values set up properly further above the script but this is all the script that deals with the issue.

A: By putting the Google Doc URL in the email body, Gmail will show it as an attachment (if the recipient has access to the file).
Like in the following image.

So here is my approach:
let templateFile = DriveApp.getFileById("1hNJ8SUybJn8nnJg87Pm22dzI0_3L0N17ZbYhV1HeUrM");
let templateResponseFolder = DriveApp.getFolderById("1Xzs1k-e8q2NYCTHg-4yit7zFWTF7L33h");
let copy = templateFile.makeCopy(`${deptName} Cost Recovery Agreement`, templateResponseFolder);
let copyId = copy.getId();

// Here I give the user permission to view the file I'm sending him
DriveApp.getFileById(copyId).addViewer(userEmail);

let doc = DocumentApp.openById(copyId);
let copyUrl = doc.getUrl();
let body = doc.getBody();
body.replaceText("{{DeptName}}", deptName);
body.replaceText("{{DeptCo}}", deptCo);
body.replaceText("{{FirstName}}", firstName);
body.replaceText("{{LastName}}", lastName);
doc.saveAndClose();

let subject = "Welcome to ResponseMaster!";
let message = `${title} ${lastName},\n\nThank you for choosing ResponseMaster as your dedicated software for your fire department.\n\n${copyUrl}`;
MailApp.sendEmail(userEmail, subject, message);


text:
Q: Can I play Destiny 2 without PS Plus? Can I play Destiny 2: Forsaken without a PS Plus subscription?
Some of my friends say I can't but then others say I can and I went to EB games but the worker there was useless.

A: You can play Destiny 2 without PS Plus however most of the game modes and features will not be available.
You will be able to do:

*

*Story missions for the main Destiny 2 campaign and each of the DLC's you own.

*Planet activities such as Adventures, Patrols, Public Events & Lost Sectors but on your own, no other players will join you.

You will not be able to do the following:

*

*Strikes

*Raids

*Crucible PvP

*Gambit PvEvP

*Forges

*Reckoning

*Menagerie

*Vex Offensive

*Nightmare Hunts

*Join fireteams with other players

Even though you can do things like public events, these are designed to be completed by groups and will be difficult on your own.
The stuff you will not be able to do includes most of the late game content and IMO the real fun and rewarding part of playing Destiny 2.
My advice is that you need a PS Plus subscription to make Destiny 2 worthwhile.
Edit 1: Alternatively you can play on PC where online play is available without a subscription, however there is no cross play if your friends are on another platform and you will need a PC powerful enough to run it.
Edit 2: Destiny 2 New Light is now available for free so you can try out a lot of the content to help you decide.
Edit 3: Destiny 2 starting season 15 —which is now— finally has cross-play fully enabled. you can jump on Bungie's website and enable cross-save and add your steam account. You can then open the game on steam and add friends on console using the "Bungie Name" which is similar to a discord tag (User#1234). simply invite or join others, Cross-play is fully functional and has finally arrived. No need for console subscriptions.


text:
Q: Firebase - Losing Auth Session After An Hour I added Firebase auth to my Reactjs (and Redux) web app and everything works perfectly.  I'm using email / password sign in, and call firebase.auth().signInWithEmailAndPassword which persists on reloads, tab changes, etc.  However, after about an hour, the auth session appears to expire and currentUser is set to null.  It feels like there should be a setting somewhere in the Firebase console, but after searching through it, I can't find anything.
Any help would be really appreciated!

A: I had the exact same issue, onAuthStateChanged was always triggered after 1 hour and the user was disconnected. And firebase.auth().currentUser.getIdToken(true) didn't help either, all because... Token Service API had to be enabled for my Google API key in the Google console. Problem solved!
Go to Google Cloud platform, type "Token Service API" in the search bar, click on it in the results, and click "Manage" on the new page, and finally "Enable API".


text:
Q: One Font Awesome Icon Specifically has stopped displaying on my wordpress site I have a site with a number of font awesome icons on a page. They all loaded correctly until recently, I noticed today that the handshake icon has stopped displaying the element is ##.fa-handshake-o.fa.vc_icon_element-icon. I have tried replacing it with other FA icons and they display fine. Only the handshake icon has stopped.
Can anyone help me with a fix to get it to display again?
I can provide any more info if needed. Thank you.


text:
Q: Angularjs - Throw error with stack trace I am trying to throw exceptions and trace its path.
The only path i'm currently getting is that of angular's source code itself
But I want to trace my code it's path
Screenshot:


text:
Q: iOS add share extension on maps I want to add share extension on Apple's Maps, does anyone know how to do. I try to set NSExtensionAttributes as below but it don't work, my APP doesn't show in the Maps's share sheet.
NSExtensionAttributes

NSExtensionActivationRule
  NSExetnsionActivationSupportsWebURLWithMaxCount
  NSExetnsionActivationSupportsWebPageWithMaxCount

A: I'm not sure why NSExtensionActivationSupportsText doesn't work with Maps, but I get the same result when I try.
What you need is a more complex activation rule. Set the type of the activation rule to "string", and set up the value using the SUBQUERY format described in the App Extension Programming Guide. When you do that you can request one or more specific UTIs. Maps will provide plain text (public.plain-text), which should be equivalent to NSExtensionActivationSupportsText but apparently is not. It also provides a location card (public.card) and a URL (public.url).
An activation rule that checks for any of these by the UTIs would look like
SUBQUERY(extensionItems, $extensionItem, SUBQUERY($extensionItem.attachments, $attachment, ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text").@count >= 1).@count >= 1 OR SUBQUERY(extensionItems, $extensionItem, SUBQUERY($extensionItem.attachments, $attachment, SUBQUERY($attachment.registeredTypeIdentifiers, $uti, $uti UTI-CONFORMS-TO "public.url" AND NOT $uti UTI-CONFORMS-TO "public.file-url").@count >= 1).@count >= 1).@count >= 1 OR SUBQUERY(extensionItems, $extensionItem, SUBQUERY($extensionItem.attachments, $attachment, ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.vcard").@count >= 1).@count >= 1

That's just three SUBQUERY clauses that check for each of those UTIs, OR-ed together.
Depending on what data you can handle, you might want to reduce that to cover only UTIs that your extension knows how to deal with. For example if all you want is the URL, only use that part:
SUBQUERY(extensionItems, $extensionItem, SUBQUERY($extensionItem.attachments, $attachment, SUBQUERY($attachment.registeredTypeIdentifiers, $uti, $uti UTI-CONFORMS-TO "public.url" AND NOT $uti UTI-CONFORMS-TO "public.file-url").@count >= 1).@count >= 1).@count >= 1

This version just checks that you're getting a URL which is not a file URL.
Maps provides an Apple Maps URL which will be something like http://maps.apple.com/?q=37.332331,-122.031219&sll=37.332331,-122.031219
If you use the vcard UTI, you'll get an NSString encoded into an NSData. If you decode it, it looks something like this:
BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//iOS 8.2//EN
N:;Shared Location;;;
FN:Shared Location
item1.ADR;type=HOME;type=pref:;;;;;;
item2.URL;type=pref:http://maps.apple.com/?q=37.332331\,-122.031219&sll=37.332331\,-122.031219
item2.X-ABLabel:map url
END:VCARD


text:
Q: KnockoutJS race condition during ajax call Here is a weird race condition happening with knockoutjs. I'm setting two observables independantly using ajax calls. One is a list, the other is a single value. The weird thing is when I load the single value before the list, it won't bind correctly. Any suggestions?
JsFiddle: http://jsfiddle.net/JasonMore/bxfXd/110/
View

    <form data-bind='submit:addItem'>
        Add item: <input data-bind='value:itemToAdd, valueUpdate: "afterkeydown"' type='text' />
        <button data-bind='enable: isAddButtonEnabled' type='submit'>Add</button>
    </form>

Your values:

    <select data-bind='options:allItems, value:selectedItems' height='5'> </select>

        <button data-bind='click: removeSelected'>Remove</button>
        <button data-bind='click: function() { allItems.sort() }, enable: allItems().length > 1'>Sort</button>

Code
var betterListModel = function() {
    var self = this;

    // properties
    this.itemToAdd = new ko.observable("");
    this.allItems = new ko.observableArray();
    this.selectedItems = new ko.observable('');

    // computed
    this.isAddButtonEnabled = ko.computed(function() {
        return self.itemToAdd().length > 0
    });

    //methods
    this.addItem = function() {
        if ((this.itemToAdd() != "") && (this.allItems.indexOf(this.itemToAdd()) < 0)) this.allItems.push(this.itemToAdd());
        this.itemToAdd("");
    }

    this.removeSelected = function() {
        this.allItems.removeAll(this.selectedItems());
        this.selectedItems();
    } };

var view = new betterListModel();

ko.applyBindings(view);

// load $.ajax({
    url: '/echo/json/',
    type: 'post',
    data: {
        json: $.toJSON("Ham"),
        delay: 1
    },
    success: function(data) {
            view.selectedItems(data);
    } });

$.ajax({
    url: '/echo/json/',
    type: 'post',
    data: {
        json: $.toJSON(["Fries", "Eggs Benedict", "Ham", "Cheese"]),
        delay: 2
    },
    success: function(data) {
        $.each(data, function(index, value) {
            view.allItems.push(value);
        });
    } });

A: Try this-->
// Whenever the states changes, reset the selectedState selection
this.allItems.subscribe(function () {
this.selectedItems(arrayOfMySelectedItems);
});


text:
Q: How can I get my C++ program to compile on Unix? I am working on a school project in C++ and am using our schools unix server to write it as instructed by the professor. I am using vim and g++ to compile.
This project is built off another project, Lab0 which I had no trouble getting to build after some help from the TA, but had to do some weird stuff to get it to build  (#include LinkedSortedList.cpp file at the bottom of LinkedSortedList.h). Everyone in the class did this weird stuff with #include .cpp file.
First, here are the files and what #includes they have for Lab0 which is compiling fine:
(The post is not showing my tabs in my makefile but they're there!)
makefile:
main: *.cpp *.h

g++ -o LSL main.cpp

clean:

rm -f *.o LSL*

Lab0 (The one that builds), is like this:
Files:
main.cpp (NOT Templated):
#include "LinkedSortedList.h"
#include <iostream>
using namespace std;

SortedList.h (Templated):
    Nothing
LinkedNode.h (Templated):
#include <iostream>
using namespace std;

LinkedSortedList.h (Templated):
#include "SortedList.h"
#include "LinkedNode.h"
#include <iostream>
using namespace std;

#include "LinkedSortedList.cpp" // At the bottom fo this file above the #endif to get the program to compile from what the TA told me to do for lab0 due to the templated class.

LinkedSortedList.cpp (Templated):
    Nothing
No problems building and running this project.
Here is my issue:
Below is lab1, the one I am having trouble with and Lab1 uses all the files from Lab0 just adds Employee.h and Employee.cpp.
Lab1 (The one that won't build) is like this:
Files:
lab1.cpp:
#include <iomanip>
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <stdexcept>
#include "Employee.h"
#include "LinkedSortedList.h"

SortedList.h (Templated):
    Nothing
LinkedNode.h (Templated):
#include <iostream>
using namespace std;

LinkedSortedList.h (Templated):
#include "SortedList.h"
#include "LinkedNode.h"
#include "Employee.h"
#include <iostream>
using namespace std;

#include "LinkedSortedList.cpp" // At the bottom fo this file above the #endif to get the program to compile from what the TA told me to do for lab0 due to the templated class.

LinkedSortedList.cpp (Templated):
    Nothing
Employee.h (NOT templated):
#include <iostream>
#include <sstream>
using namespace std;

Employee.cpp (NOT templated):
#include <stdio.h>
#include <string.h>

(The post is not showing my tabs in my makefile but they're there!)
makefile:

main: *.cpp *.h

g++ -o LSL lab1.cpp

clean:

rm -f *.o LSL*

Errors I get:
Here are the errors I am getting. It seems like the Employee.cpp/Employee.h files are not being seen. Any ideas??

unixserver:Lab1> make
g++ -o LSL lab1.cpp
/tmp/ccamnaqx.o: In function createRecord()':
lab1.cpp:(.text+0x3fb): undefined reference toEmployee::Employee()'
lab1.cpp:(.text+0x477): undefined reference to Employee::setLastName(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
lab1.cpp:(.text+0x4f2): undefined reference toEmployee::setFirstName(std::basic_string, std::allocator >)'
lab1.cpp:(.text+0x589): undefined reference to Employee::setId(int)'
lab1.cpp:(.text+0x5ce): undefined reference toEmployee::setSalary(int)'
lab1.cpp:(.text+0x60e): undefined reference to Employee::setDepartment(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
lab1.cpp:(.text+0x67c): undefined reference toEmployee::setPhoneNumber(std::basic_string, std::allocator >)'
lab1.cpp:(.text+0x6ea): undefined reference to Employee::setAddress(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
lab1.cpp:(.text+0x758): undefined reference toEmployee::setHireDate(std::basic_string, std::allocator >)'
lab1.cpp:(.text+0x7c6): undefined reference to `Employee::setEmailAddress(std::basic_string, std::allocator >)'
collect2: ld returned 1 exit status
make: * [main] Error 1

Any help would be greatly appreciated!

A: You have to compile Employee.cpp and link it into the executable:
g++ -o LSL lab1.cpp Employee.cpp

It could be that the same goes for LinkedSortedList.cpp (its purpose is not entirely clear to me).

A: Your makefile for your second project only compiles lab1.cpp and not your other cpp files.  You have two others (Employee.cpp and LinkSortedList.cpp) that you need to account for.
Also, please learn how to properly format code here on this site.  https://stackoverflow.com/editing-help


text:
Q: Uploading a file Google App - Python Hoping someone can help cure my stupidity. I am creating a webapp where I need to upload csv files and process them. I am struggling to get my code to work in its simplest form. I can get the page to load up but as soon as I press the submit button to post the file I get a 403 Forbidden Error: Access was denied to this resource.
When I run it in the google app interactive console it does not give me any errors. Can some one point me in the right direction please.
HTML:
{% extends base_layout %}

{% block header_title %}
        {% trans %}Upload Documents{% endtrans %}
{% endblock %}

{% block content %}

  <form action="/upload" method="post" enctype="multipart/form-data">
  <input type="file" name="myfile">
  <br>
  <input type="submit" name="submit" value="Submit">

{% endblock %}

Handler class:
class Upload(BaseHandler):
    def get(self):
        return self.render_template('upload.html')

    def post(self):

        file = self.request.POST.getall('myfile')

        #file will be process with data going into models here.

        self.response.out.write("success")

A: You cannot simply upload a file to app engine since the file system is read only. You have to upload to either cloud storage or blob storage. When using either you have to use the facilities for each.
The easiest and fastest way to upload files via a form is with the blobstore api.


text:
Q: How we can combine multiple rows in a single row in Pig I need to combine this multiple tuples in a single one using Pig script. Could you please provide some guidelines?
dump requestFile;

Current Output
(Logging Transaction ID:21214,/var/log/tibco/,NESS-A-1-LPNameRequesttoNESS.log,tibcoTest log)

(Default Data:LP Name Request Message Executed Successfully)

(LoanPath Request ID:  88128640)

(RequestGroupID#:   )

(SplitCount#:  2 )

(SplitIndex:  1)

(Correlation ID : 88128640-1 )

Desired output
(Logging Transaction ID:21214,/var/log/tibco/,NESS-A-1-LPNameRequesttoNESS.log,tibcoTest log,Default Data:LP Name Request Message Executed Successfully,LoanPath Request ID:  88128640,RequestGroupID#:   ,SplitCount#:  2,SplitIndex:  1)
(Correlation ID : 88128640-1 )

A: What about:
requestFile = foreach requestFile generate flatten(tuple);
G = GROUP requestFile ALL;
F = FOREACH G generate requestFile;


text:
Q: How to process Stripe payment authentication in iOS (Swift)? I don't know if there's a lot of people people in here who are familiar with Stripe, but I hope someone can help me out. I'm setting up iDEAL payment in my app using Sources, and I'm using the guide on the Stripe website to help me out. Everything was explained very clear about how to set up the source, but the problem I'm running into is that the guide is very unclear about how I should continue after the source has been created and the user has authenticated the payment. It only describes how to continue when you're a web developer, but it's very unclear how to continue when you're an iOS developer. Basically what I want to do, is to get notified on whether the source object became chargeable (successful authentication) or failed. It only says you can get notified about the authentication status through client-side polling, but it's poorly described how to set up client-side polling in iOS. Can someone give me some directions on how I should continue after the authentication has been completed and the user returns back to the app? How can I get access to the new status of the source object after I return to the app?

A: It's not possible to charge a given source or create a customer in your iOS application as those calls require your Secret API key. You should never have the Secret API key in your iOS application otherwise an attacker could get his hands on it and then create charges, refunds or transfers on your behalf.
Once the source is created client-side, you need to send its id src_XXXX to your server. There, you will be able to call the Create Charge API to charge your source with your Secret API key.
Since you plan to use iDeal, the source is not chargeable immediately. Instead, you need to either poll the source client-side until it's ready to be charged or you need to listen for the source.chargeable webhook event indicating that the source is ready to be charged.
Once it is ready, you will be able to charge the source on your server.


text:
Q: RackSpace CreateImage API using curl is not working Whenever i m trying to create image from the given api using curl -:

curl -i -X POST https://lon.servers.api.rackspacecloud.com/v1.1/xxxxxxxxx/servers/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx/createImage -H "X-Auth-Token:
  xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-xxxxxxxxx" -d '{"createImage" : {"name"
  : "test_image"}}' -H "Content-type: application/json"

It throws me error -:

{"itemNotFound":{"message":"An unexpected fault
  occurred.","details":"javax.ws.rs.WebApplicationException","code":404}}*
  Closing connection #0

I need help in this,how to create a server image using curl. But all other rackspace server api's are working fine for me.
I trie same api with version 1.0, 1.1 and 2.0 but ni success.
Thanks

A: This question was answered over at ServerFault (https://serverfault.com/questions/495087/rackspace-createimage-api-using-curl-is-not-working).
In summary, you will need to change the URL that you are POSTing to to have /action after the UUID, as opposed to /createImage. An example cURL command can be structured as follows:
curl -X POST -H "X-Auth-Token: AUTH-TOKEN" -H "Content-type: application/json" -d '{"createImage" : {"name" : "test"}}' https://lon.servers.api.rackspacecloud.com/v2/ACCOUNT-ID/servers/SERVER-UUID/action

A: Thanks to Dave Kuldt. Correct api call is -:

curl -X POST -H "X-Auth-Token: AUTH-TOKEN" -H "Content-type:
  application/json" -d '{"createImage" : {"name" : "test"}}'
  https://lon.servers.api.rackspacecloud.com/v2/ACCOUNT-ID/servers/SERVER-UUID/action


text:
Q: Akka.net cluster broadcast only received by one node I learned from the Akka.net WebCrawler and created my own cluster test. I have a Processor node(Console App) and an API node(SignalR). Here are the configurations.
Processor node:
akka {
    actor{
        provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
        deployment {
            /dispatcher/signalR {
                router = broadcast-group
                routees.paths = ["/user/signalr"]
                cluster {
                    enabled = on
                    #max-nr-of-instances-per-node = 1
                    allow-local-routees = false
                    use-role = api
                }
            }
        }
    }
    remote {
        log-remote-lifecycle-events = DEBUG
        helios.tcp {
                port = 0
                hostname = 127.0.0.1
        }
    }
    cluster {
        seed-nodes = ["akka.tcp://stopfinder@127.0.0.1:4545"]
        roles = [processor]
    }
}

API node: (Non seed-node will have port = 0)
akka {
    actor{
        provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
    }
    remote {
        log-remote-lifecycle-events = DEBUG
        helios.tcp {
                port = 4545
                hostname = 127.0.0.1
        }
    }
    cluster {
        seed-nodes = ["akka.tcp://stopfinder@127.0.0.1:4545"]
        roles = [api]
    }
}

Inside of the API node, I created a normal actor called SignalR.
Inside of the processor node I created a normal actor and used the Scheduler to Tell() the API node's signalR actor some string.
This works great when I have one Processor and one API. It also works when I have multiple Processor nodes and a single API node. Unfortunately, when I have multiple API node, no matter how I setup the configuration, the "tell" won't tell all of the API nodes; the message only goes to one of them. Which node receives the message is based on the API node start sequence. It seems that I have the all API nodes registered in the cluster correctly, but I could be wrong.
I'm starting to feel that this is a configuration or understanding issue. Can anyone share any insights?
I did some additional testing. The behavior remains the same when I replace the ASP.NET SignalR API node with a normal console application.
UPDATE: I contacted Akka.NET team. This behavior is a known bug. It will be fixed in 1.1 release.
UPDATE 2: The issue has been marked as fixed for the proejct on GitHub.


text:
Q: Powershell scripts will not work with Jenkins plugin on Windows I'm writing some pretty simple scripts in Powershell 32-bit and they are working fine.
For instance, I want to open internet explorer to a webpage and start typing in keys. The following code works fine when I run it in powershell ISE.
Add-Type –AssemblyName System.Windows.Forms
$url = "http://WebAddress"
$ie = New-Object -com "InternetExplorer.Application"
$ie.Navigate($url)

sleep 30

[System.Windows.Forms.SendKeys]::SendWait("{2}{tab}{H}{E}{L}{L}{O}")

I have downloaded a Windows PowerShell plugin and have executed the same code through it and received the following errors:
Building on master in workspace C:\Program Files\Jenkins\workspace\Jenkins Test
[Jenkins Test] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\WINDOWS\TEMP\hudson257018662776252417.ps1'"
New-Object : Creating an instance of the COM component with CLSID {0002DF01-000
0-0000-C000-000000000046} from the IClassFactory failed due to the following er
ror: 80004005.
At C:\WINDOWS\TEMP\hudson257018662776252417.ps1:4 char:17
+ $ie = New-Object <<<<  -com "InternetExplorer.Application"
    + CategoryInfo          : ResourceUnavailable: (:) [New-Object], COMExcept
   ion
    + FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Comman
   ds.NewObjectCommand

You cannot call a method on a null-valued expression.
At C:\WINDOWS\TEMP\hudson257018662776252417.ps1:5 char:13
+ $ie.Navigate <<<< ($url)
    + CategoryInfo          : InvalidOperation: (Navigate:String) [], RuntimeE
   xception
    + FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "SendWait" with "1" argument(s): "Access is denied"
At C:\WINDOWS\TEMP\hudson257018662776252417.ps1:9 char:42
+ [System.Windows.Forms.SendKeys]::SendWait <<<< ("{2}{tab}{H}{E}{L}{L}{O}")
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Is there a reason why my code will not work through Jenkins like it does in Powershell? I tried some simple echo scripts which worked fine, but any more complex and it throws an error.

A: You may need to set execution policy once: https://technet.microsoft.com/library/hh849812.aspx
Set-ExecutionPolicy Unrestricted

Run PowerShell as admin and run that command. There may be security concerns using Unrestricted. But if it works, read the link above and find the policy that works best in your context. Options are (copy/pasted from the link):

*

*Restricted. Does not load configuration files or run scripts. Restricted is the default execution policy.

*AllSigned. Requires that all scripts and configuration files be signed by a trusted publisher, including scripts that you write on
the local computer.

*RemoteSigned. Requires that all scripts and configuration files downloaded from the Internet be signed by a trusted publisher.

*Unrestricted. Loads all configuration files and runs all scripts. If you run an unsigned script that was downloaded from the Internet,
you are prompted for permission before it runs.

*Bypass. Nothing is blocked and there are no warnings or prompts.

*Undefined. Removes the currently assigned execution policy from the current scope. This parameter will not remove an execution policy
that is set in a Group Policy scope.


text:
Q: Can't bind to 'chartType' since it isn't a known property of 'canvas' I'm developing an Angular 6 application using ng2-charts.
However I receive the following error when I debug the project with Visual Studio Code and I see a blank page when I type "ng serve" and hit Enter:
Can't bind to 'chartType' since it isn't a known property of 'canvas'
I have tried adding "import {ChartsModule} from 'ng2-charts/ng2-charts';" to the component.ts. However I still receive the same error.
Here is the HTML code for chart from the my-bar-chart.component.html file:
<div style="display: block">
  <canvas mdbChart
      [chartType]="chartType"
      [datasets]="chartDatasets"
      [labels]="chartLabels"
      [colors]="chartColors"
      [options]="chartOptions"
      [legend]="true"
      (chartHover)="chartHovered($event)"
      (chartClick)="chartClicked($event)">
  </canvas>
</div>

Here is the my-bar-chart.commponent.ts file:
import { Component, OnInit } from '@angular/core';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
import {ChartsModule} from 'ng2-charts/ng2-charts';

@Component({
  selector: 'app-my-bar-chart',
  templateUrl: './my-bar-chart.component.html',
  styleUrls: ['./my-bar-chart.component.css']
})

export class MyBarChartComponent implements OnInit {
  public chartType: string = 'horizontalBar';

  public chartDatasets: Array<any> = [
    { data: [65, 59, 80, 81, 56, 55, 40], label: 'My First dataset' }
  ];

  public chartLabels: Array<any> = ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'];

  public chartColors: Array<any> = [
    {
      backgroundColor: [
        'rgba(255, 99, 132, 0.2)',
        'rgba(54, 162, 235, 0.2)',
        'rgba(255, 206, 86, 0.2)',
        'rgba(75, 192, 192, 0.2)',
        'rgba(153, 102, 255, 0.2)',
        'rgba(255, 159, 64, 0.2)'
      ],
      borderColor: [
        'rgba(255,99,132,1)',
        'rgba(54, 162, 235, 1)',
        'rgba(255, 206, 86, 1)',
        'rgba(75, 192, 192, 1)',
        'rgba(153, 102, 255, 1)',
        'rgba(255, 159, 64, 1)'
      ],
      borderWidth: 2,
    }
  ];

  public chartOptions: any = {
    responsive: true
  };
  public chartClicked(e: any): void { }
  public chartHovered(e: any): void { }

  constructor() { }
  ngOnInit() {
  }

}

Here is the app.module.ts file:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { ChartsModule } from 'ng2-charts/ng2-charts';
import { MyBarChartComponent } from './my-bar-chart/my-bar-chart.component';
import { MyDoughnutChartComponent } from './my-doughnut-chart/my-doughnut-chart.component';
import { MyRadarChartComponent } from './my-radar-chart/my-radar-chart.component';
import { MyPieChartComponent } from './my-pie-chart/my-pie-chart.component';
import { Routes, RouterModule } from '@angular/router';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';

const routes: Routes=[
  {path:'bar-chart',component:MyBarChartComponent},
  {path:'doughnut-chart',component: MyDoughnutChartComponent},
  {path:'radar-chart',component:MyRadarChartComponent},
  {path:'pie-chart',component:MyPieChartComponent},
  {path:'**',component:MyBarChartComponent}
];

@NgModule({
  declarations: [
    AppComponent,
    MyBarChartComponent,
    MyDoughnutChartComponent,
    MyRadarChartComponent,
    MyPieChartComponent
  ],
  imports: [
    BrowserModule,
    RouterModule.forRoot(routes),
    NgbModule.forRoot(),
    ChartsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

I expect to see the chart when I type "ng serve" and hit Enter

A: You are not using the right directive.
Please consider this directive: baseChart according to the doc


text:
Q: UDP server/client not working with 127.0.0.1 on Ubuntu bind call returning an error number 99 I am trying to implement the UDP client /server on Ubuntu, I tried to bind the socket to local host (127.0.0.1) but bind is returning the error number 99. I tried different ports also but in vain. Please find the code udpserver.c and udpclient.c respectively
#include<stdio.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<string.h>
#include<errno.h>

int main()
{
    int udpsocket = 0, ret = 0 , length = 0;
    struct sockaddr_in server, client;
    char buffer[1024];
    udpsocket = socket (AF_INET,SOCK_DGRAM , 0 );
    if ( udpsocket == -1)
    {
        printf("Error in creating udp socket \n");
        return -1;
    };
    memset(&server, 0 , sizeof(struct sockaddr_in) );
    server.sin_family = AF_INET;
    server.sin_port = htons(16000);
    server.sin_addr.s_addr = htonl(INADDR_ANY);

    ret = bind ( udpsocket, (struct sockaddr*)&server, sizeof(struct sockaddr_in) );
    if (ret == -1)
    {
        printf("Errno is %d \n", errno);
        printf("Error in binding the socket \n" );
        close(udpsocket);
    }
    memset(buffer, 0 , 1024);
    length = sizeof(struct sockaddr_in);
    while (1)
    {
        recvfrom(udpsocket, buffer , 1024, 0,(struct sockaddr*)&client, (socklen_t *)&length);
        if (! strcmp(buffer,"bye") )
        break;
        if ( buffer[0] != '\0' )
        printf("message is %s \n", buffer );
        memset(buffer, 0 , 1024);
    }
    close(udpsocket);
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>

int main()
{
    int udpsocket = 0, ret = 0 , length = 0;
    struct sockaddr_in server;
    char buffer[1024];
    udpsocket = socket(AF_INET , SOCK_STREAM, 0 );
    if ( udpsocket == -1 )
    {
        return -1;
    }
    memset(&server, 0 , sizeof(struct sockaddr_in ) );
    server.sin_family = AF_INET ;
    server.sin_port = htons(16000);
    server.sin_addr.s_addr = htonl(inet_addr("127.0.0.1") );
    memset(buffer, 0 ,1024);
    while ( 1 )
    {
        printf("Enter message \n");
        scanf("%s",&buffer );
        if ( buffer[strlen(buffer)] == '\n' )
        buffer[strlen(buffer)] = '\0';
        length = strlen(buffer) + 1;
        sendto(udpsocket, buffer, length, 0 , (struct sockaddr_in*)&server, (socklen_t*)&length);
        if ( !strcmp(buffer,"bye") ) break;
    }
    close(udpsocket);
    return 0;
}


text:
Q: IBM DB2 Bundle with IIS using HADR and Tivoli I want confirm whether DB2 ESE bundled with IIS can be used to set up the DB2 repository as cluster DB2 using HADR and Tivoli system Automation manager. Is the bundled license permit supported for configuration?

A: Take a look at the licensing docs for your purchase (standalone DataStage, Data Quality bundle, Data Integration bundle, or Enterprise Edition bundle).
Here is a search for 'Information Server Enterprise' on the license documents: http://www-03.ibm.com/software/sla/sladb.nsf/searchlis/?searchview&searchorder=4&searchmax=0&query=(Information+Server+Enterprise)


text:
Q: True values become 1 when a value in pandas column is changing to nan I have a dataframe similar to the below example, with a column that contains True or Nan:
df = pd.DataFrame({'Data': [1, 2, 3, 4, 5], 'T/F':[True, True, True, True, True]})

Data   T/F
0     1  True
1     2  True
2     3  True
3     4  True
4     5  True

I want to try and remove the true from the final row in this dataframe, but when I do all the other Trues become 1:
df.loc[df.last_valid_index(), 'T/F'] = np.nan

   Data  T/F
0     1  1.0
1     2  1.0
2     3  1.0
3     4  1.0
4     5  NaN

I was wondering if anyone knows why this happens? and any way I can stop it? I'm thinking I might need to change my code to use False instead of nan.

A: you can use pd.NA instead:
df.loc[df.last_valid_index(), 'T/F'] = pd.NA

output of df:
    Data    T/F
0   1       True
1   2       True
2   3       True
3   4       True
4   5       <NA>

Note: Since the type of np.nan is float so that why it is convering boolean True to 1.0 and boolean False to 0.0
Also pd.NA preserve datatype you can check that by:
print(df['T/F'].map(type))

#output of above code:

0                           <class 'bool'>
1                           <class 'bool'>
2                           <class 'bool'>
3                           <class 'bool'>
4    <class 'pandas._libs.missing.NAType'>
Name: T/F, dtype: object

A: One column, one type, when you  set value np.nan, program will convert this column to float. In my memory , df.astype() function just process column, not ceil.

A: This is due to the fact that the T/F column contains bool data and the value you try to assign is of type numpy.float64, so the column is being casted to the highest mutual dtype, which is numpy.float64 in this case.
If you would like to contain a mixed values in this column, i.e., both bool and numpy.float64, you should cast this column to object before updating it, as follows:
import pandas as pd
import numpy as np

df = pd.DataFrame({'Data': [1, 2, 3, 4, 5], 'T/F':[True, True, True, True, True]})
df['T/F'] = df['T/F'].astype('object')
df.loc[df.last_valid_index(), 'T/F'] = np.nan
df

Output:
    Data    T/F
0   1   True
1   2   True
2   3   True
3   4   True
4   5   NaN

Note:
Holding mixed values in pandas.DataFrames is ussualy not a good practice, as it slows down considerably the performance, so it should be avoided whenever possible.
Cheers


text:
Q: Laravel groupBy with select multiple field I can select country and groupBy the result as following with an alias total :
Data::select('country', DB::raw('count(*) as total'))
->groupBy('country')
->get();

The above code works well.
Here I can select only country filed, But I need to select aslo name, positions field,  How can I select multiple field here?

A: First, you need to specify what error/exception you're getting but you can add additional column by doing
DB::table('table_name')->select([DB::raw('count(*) as total'), 'name', 'positions', 'country'])
->groupBy('country')
->get());

it is also likely you get an access violation exception which requires you to change sql_mode

A: You have to use like below settings and change code.

*

*Open config/database.php

*Find strict key inside mysql connection settings

*Set the value to false
Use code below like
ModelName::groupBy('country')
->selectRaw('count(*) as total, country, name, positions')
->get()


text:
Q: Swift 3 - Animation I am animating an image across the bottom of my iPad app.  Currently the imageView is animated using the following code snippet:
UIView.animate(withDuration: 5, delay: 0,
                   options: [.repeat, .curveEaseIn, .curveEaseOut],
                   animations: {

             self.imageView.center.x += self.view.bounds.width

    },
             completion: nil
)

I have an integer intVal = 0;
I need to change the image of my image view based on the value of intVal.  How can I compare the intVal and change the image before the animation starts?
Ideally, the final code snippet would look like this:
UIView.animate(withDuration: 5, delay: 0,
                   options: [.repeat, .curveEaseIn, .curveEaseOut],
                   animations: {

             self.imageView.center.x += self.view.bounds.width

    },
             completion:
             if(intVal == 1){
                imageView.image = differentImg.png;
             }
             ...
             else if(intVal == 10){
                imageView.image = AnotherDifferentImg.png;
             }
)

EDIT:
This method is called ONCE in ViewDidAppear.  The animation repeats (as the .repeat option indicates) every 5 seconds (as the duration indicates). The picture must determine if it needs to change every time the animation repeats.

A: You need to use a timer to accomplish your goal, because you not only need the animation, but also some other logic. So ask timer to handle your repeat, and then do other jobs inside
var timer = Timer.scheduledTimer(withTimeInterval: 6, repeats: true) {
    (_) in
    //Set image first base on intVal
    if inVal == 1 {
        self.imageView.image = UIImage(named: "a.png")
    }else{
        self.imageView.image = UIImage(named: "b.png")
    }

    //Then start animation
    UIView.animate(withDuration: 5, delay: 0, options: [.curveEaseIn, .curveEaseOut], animations: {
            self.imageView.center.x += self.view.bounds.width
        }, completion: nil)
}

A: Try to create a method that will first check the value and then animate view without repeating option but call itself in completion block.
func animateImageView {
    if(intVal == 1){
        imageView.image = differentImg.png;
    }
     ...
    else if(intVal == 10){
        imageView.image = AnotherDifferentImg.png;
    }
    UIView.animate(withDuration: 5, delay: 0,
               options: [.curveEaseIn, .curveEaseOut],
               animations: {

         self.imageView.center.x += self.view.bounds.width

},
         completion: animateImageView())

And call this method in viewDidAppear


text:
Q: What is the difference between if and whether?
Let me know if I picked up the right file
Let me know whether I picked up the right file

Could anyone tell me the differences between them?
Can we use 'if' and 'whether' in present, past, and future tenses as well?

A: 'Whether' implies more than one alternative (e.g. 'whether the day is wet or fine') so the addition 'or not' is understood even if it isn't included. Most people would understand both your sentences in the same way, but, as H2ONaCl implies, the first one is literally asking for a reply only if you picked up the right file, the second asks for you to be told whether it was the right one or not.


text:
Q: Form input from index.html with Shiny I am trying to use index.html to take in dates and hours from the user and I am having some problems.
For hours as a number the index.html of
<input type="number" name="var">

and later
 Output Text

and then in server.R
data <- reactive({
...
dist(input$var)
})

output$text1 <- renderText({
  paste("You have selected", input$var)
})

displays the number input back in index.html fine.
But when I replace the number input type with a date
<input type="date" name="var">

nothing gets displayed.
Am I going about this all wrong? Any help you can give me or just point me in the right direction would be great.
This question seems close Button submit R with shiny but a "date" does not seem like a custom input.

A: date and number are not input types. you need to use a text type.


text:
Q: Does placing an address tag inside of a section tag conform to html5 guidelines? Is placing the address tag within a section like this following the html5 guidelines?

Call Us: 1-800-576-7449

       <address>

4660 N. University Drive
 Lauderhill, FL 33351 United States

       </address>

A: That's fine except for the fact that the address element is not for arbitrary postal addresses: address element so you could simply use p instead.

A: You can use an address tag inside of a section tag, there is nothing wrong with that. However, you cannot place a section tag inside of an address tag. This MDN article on address has more information.
The one caveat is that you are using section as a generic container. It is suggested to use a div if you are going to just be using the element as a placeholder.

A: The use cases of some of the new HTML5 elements may still be open to interpretation, as W3C typically just has "suggested use cases" or something similar for them.
The
 tag's W3C wiki page does, however, have a specific use case applicable to you:

A Web site's home page could be split into sections for an introduction, news items, and contact information.

Obviously the <address> element should contain some sort of contact infromation.
Given your markup and the information on the linked wiki pages, I would say the placement of <address> inside of
 is not only allowed, but one of the encouraged use cases.
I'm not entirely sure the
 tag inside of the <address> element is necessary, or completely semantically correct.


text:
Q: Adding new data to Jquery after clicking a div Here is a code of FullCalendar that I am using:
$(document).ready(function() {
    var date = new Date();
    var d = date.getDate();
    var m = date.getMonth();
    var y = date.getFullYear();
    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'agendaWeek,agendaDay'
        },
        editable: true,
        events: [
            {
                title: 'All Day Event',
                start: new Date(y, m, 1),
            },
            {
                title: 'Long Event',
                start: new Date(y, m, d-5),
                end: new Date(y, m, d-2)
            }
        ]
    });
});

I have a <a> element in the page and when I click on that link, I need to add following data to event of the calendar and the event should be became like this
events: [
    {
        title: 'All Day Event',
        start: new Date(y, m, 1),
    },
    {
        title: 'Meet Thomas Antony',
        start: new Date(y, m, 1),
    },
    {
        title: 'Meet Mathew',
        start: new Date(y, m, 1),
    },
    {
        title: 'Long Event',
        start: new Date(y, m, d-5),
        end: new Date(y, m, d-2)
    }
]

Which means this...:
{
    title: 'Meet Thomas Antony',
    start: new Date(y, m, 1),
},
{
    title: 'Meet Mathew',
    start: new Date(y, m, 1),
},

... should be added to events at the time of clicking a link tag. How can I do that?

A: There's a renderEvent method in fullCalendar for this:
$('#calendar').fullCalendar('renderEvent', {
  title: 'Meet Thomas Antony',
  start: new Date(y, m, 1)
}, true).fullCalendar('addEvent', {
  title: 'Meet Mathew',
  start: new Date(y, m, 1)
}, true);

In a full example you'd be looping though a collection, but you get the idea, just call .fullCalendar('renderEvent', eventObject, true).  For a full event object property listing, look here.  The last parameter is optional, depending of if you refresh the event data source later...if you want it to say in that case, set it to true, otherwise you can leave it off.


text:
Q: Two instances of AppDelegate, how to fix it? I just noticed a rather severe bug in my iPhone/iPad app: I have a class called AppDelegate that implements the UIApplicationDelegate protocol - like every iPhone app has. I'm using Core Data, and the AppDelegate sets up my managed object context (I mostly just left the default methods of the Xcode template in place).
Now I need the managed object context in a few places in my app and I would also like to call the -saveContext method from a few places. So I used the singleton pattern and added a class method + (AppDelegate *)sharedAppDelegate that is implemented like this:
+ (AppDelegate *)sharedAppDelegate
{
    static dispatch_once_t pred = 0;
    __strong static id _sharedObject = nil;
    dispatch_once(&pred,^{
        _sharedObject = [[self alloc] init];
    });
    return _sharedObject;
}

Everything worked fine so far. Now however, I tried to access the sharedAppDelegate's UIWindow property and noticed it was nil. At first I was quite confused, but then I realized that first my main method creates an instance of AppDelegate, which creates the UIWindow and view controllers in -application:didFinishLaunchingWithOptions: and then, -sharedAppDelegate creates another one! I find it very strange that my app seemed to work quite well so far, because for instance only the first instance calls -saveContext when the app exists.
Anyway, I would like to change it so that the main method also uses the sharedAppDelegate. Does that mean that I need to override the -init method? How can I prevent an infinite loop (-sharedAppDelegate also calles init after all)? Should I make the _sharedObject variable of global scope?

A: You don't create your own instance of the app delegate. The UIKit Framework creates one for you when the application starts up. You get the current app delegate from the delegate method on UIApplication. So when you want to get your shared managed object context:
// Get the instance of your delegate created by the framework when the app starts
AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];

// Assuming you're using the default methods from the template...
NSManagedObjectContext* context = [appDelegate managedObjectContext];

You can always get the current singleton UIApplication objected with the sharedApplication method and you can always get the proper instance of your app delegate using the delegate method on the application instance.