text:
Q: join multiple tables with "GROUP BY" and latest date in MySQL i have 2 mysql tables
table 1 is "qualitaet-inventar" and has 3000 rows with "sachnummer" as AUTO_INCREMENT

table 2 is "qualitaet" and has a couple of rows.. here is "id" set to AUTO_INCREMENT
the important thing is that "sachnummer" can be exist many times. (see the red marks in picture)

what i want to do is a left join from "qualitaet" to "qualitaet-inventar"
i want to group all "sachnummer" by showing the latest date of "created" on "qualitaet"
and when a "sachnummer" isn't available in "qualitaet" do an empty join to "qualitaet-inventar"

so i have this code
SELECT
    i.`sachnummer` AS id,
    MAX(q.`created`) AS letztemessung,
    i.`sachnummer-name` AS sachnummer
FROM
        `qualitaet-inventar` i
LEFT JOIN
        `qualitaet` q on i.`sachnummer` = q.`sachnummer`
GROUP BY
        sachnummer
ORDER BY
    sachnummer ASC

the problem is that it needs a long time to get this result

with this code it works faster
SELECT
    q.`sachnummer` AS id,
    MAX(q.`created`) AS letztemessung,
    i.`sachnummer-name` AS sachnummer
FROM
    qualitaet q
LEFT JOIN
    `qualitaet-inventar` i on q.`sachnummer` = i.`sachnummer`
GROUP BY
    sachnummer
ORDER BY
    sachnummer ASC

but i don't get the hole inventory and an empty date with this code

is it possible to get this table in a faster way for high table-rows? :D

edit:
here are my indexes

A: The following shouldn't work any faster than your existing query - but from your description, may do:
SELECT i.`sachnummer` AS id,
       MAX(q.`created`) AS letztemessung,
       i.`sachnummer-name` AS sachnummer
FROM `qualitaet-inventar` i
JOIN `qualitaet` q on i.`sachnummer` = q.`sachnummer`
GROUP BY sachnummer
UNION ALL
SELECT i.`sachnummer` AS id,
       q.`created` AS letztemessung,
       i.`sachnummer-name` AS sachnummer
FROM `qualitaet-inventar` i
LEFT JOIN `qualitaet` q on i.`sachnummer` = q.`sachnummer`
WHERE q.`sachnummer` IS NULL
ORDER BY sachnummer ASC

Another possibility:
select id, max(letztemessung) as letztemessung, max(sachnummer) as sachnummer
from
(SELECT `sachnummer` AS id,
        `created` AS letztemessung,
        '' AS sachnummer
 FROM `qualitaet` q
 UNION ALL
 SELECT `sachnummer` AS id,
        cast(null as datetime) AS letztemessung,
        `sachnummer-name` AS sachnummer
 FROM `qualitaet-inventar` i
) sq
group by id
ORDER BY sachnummer ASC

A: This is the general idea, with shorter table names.
select somefields
from table1 t1 left join table2 t2 on t1.something = t2.something
join (
select something, max(datetimefield) maxdt
from table1
where whatever
group by something
)  t3 on t1.something = t3.something
and t1.datetimefield = maxdt
where whatever


text:
Q: Safari Webkit animation (Rotation) not working Good afternoon.
Im playing around with webkit animations and somehow I can't get it to work in Safari. The animation worked in IE and Firefox but somehow not in Safari (8.0.2).
Can somebody spot any mistakes ?
I would be really happy if someone can help me out.
Many greetings :)
.buttonmit1anikasten:hover{

    width:280px;
    height:274px;
    background-color: green;
    float: left;
    margin-top: 82px;
    margin-bottom: 0px;
    padding-bottom:0px;
    margin-left: 12px;
    margin-right: 0px;
    opacity:1.0;
    position:absolute;
    animation-name: spinning;
    -webkit-animation-name: spinning;
    animation-duration: 3s;
    -webkit-animation-duration: 3s;
    animation-iteration-count: infinite;
    -webkit-animation-iteration-count: infinite;
}

@keyframes spinning {
  0%   {-webkit-transform: rotate(0deg);}

    50% {-webkit-transform: rotate(180deg);}

    100%   {-webkit-transform: rotate(360deg);}
  }

A: You're missing the keyframes definition that is specific for Safari. You have to use @-webkit-keyframes spinning as well. You should add the following:
@-webkit-keyframes spinning {
    0% {-webkit-transform: rotate(0deg);}
    50% {-webkit-transform: rotate(180deg);}
    100% {-webkit-transform: rotate(360deg);}
}

And adapt your previous keyframes removing the -webkit- prefix:
@keyframes spinning {
    0% {transform: rotate(0deg);}
    50% {transform: rotate(180deg);}
    100% {transform: rotate(360deg);}
}

Here you can find a JSFiddle I did with some simple (made up) HTML so you can test it there: http://jsfiddle.net/k289yy3x/
Hope I could help.

redpajama_set_name: RedPajamaStackExchange


text:
Q: problem with substring in mysql I have simple EAV like database which has 3 tables: products, attributes, attribute_values.
I am using below code to find all products that have attribute 'length' and then I am using substring function to get rid of 'inch' and after that I am using between to get all products that have 'length' between 0 and 5.
SELECT products.name,products.id
FROM products
JOIN attribute_value_product on products.id = attribute_value_product.product_id
JOIN attribute_values on attribute_value_product.attribute_value_id = attribute_values.id
JOIN attributes on attribute_values.attribute_id = attributes.id AND attributes.name = 'length'
WHERE substring_index(attribute_values.value,'inch',1) + 0 BETWEEN 0 AND 5

Everything works fine however I am getting plenty of warnings:
Warning: #1292 Truncated incorrect DOUBLE value: 'black'
Warning: #1292 Truncated incorrect DOUBLE value: 'phat farm'
Warning: #1292 Truncated incorrect DOUBLE value: '2 kg'
Warning: #1292 Truncated incorrect DOUBLE value: 'roca wear'

it looks to me like that substring is going through all attribute_values in the database, even those that are not reffering to attribute 'length' - is it possible to change that ?


text:
Q: Is there any way to decrypt encrypted properties in Spring Cloud config Server in other projects? Is there any way to decrypt encrypted properties in Spring Cloud config Server in other projects?
For example, I want to decrypt "test" = "{chip}asdasdasd" without using the crypto endpoint of the spring cloud server.
Thank you in advance for your reply.

A: If you are using Spring Boot application as a client, it's easy, just add
encrypt:
  key: your_key

to bootsrap.yaml and Spring will handle everything else.
Problems appear when you have other clients.
Then you can try to find some libraries or create your own: Example for TypeScript


text:
Q: basic python module design question I have:
lib/
lib/__init__.py
lib/game.py

In __init__.py I'd like to define a variable that can be accessed by any class inside lib, like so:
BASE = 'http://www.whatever.com'

And then inside game.py, acces it inside in the Game class:
class Game:

def __init__(self, game_id):
    self.game_id = game_id

    url = '%syear_%s/month_%s/day_%s/%s/' % (lib.BASE, year, month, day, game_id)

Yeah so clearly 'lib.BASE' isn't right- what's the convention here? Is there a tidier, more pythonic way to handle what I'd call package-global variables?

A: See http://docs.python.org/tutorial/modules.html#intra-package-references
So you could have a lib/settings.py file which contains the line
BASE = 'http://www.whatever.com'

and then say
from settings import *

in game.py you should then be able to write
url = '%syear_%s/month_%s/day_%s/%s/' % (BASE, year, month, day, game_id)


text:
Q: Mongodb loop through every distinct values and select tags using aggregate (facet) I have collection like this:
{
    "labels": [{
        "description": "Dog"
    }, {
        "description": "Red"
    }, {
        "description": "XXX"
    }]
}
{
    "labels": [{
        "description": "Cat"
    }, {
        "description": "XXX"
    }, {
        "description": "Yellow"
    }]
}
{
    "labels": [{
        "description": "Dog"
    }, {
        "description": "Red"
    }, {
        "description": "Yellow"
    }]
}
{
    "labels": [{
        "description": "Bird"
    }, {
        "description": "XXX"
    }, {
        "description": "XXX"
    }]
}

I want to filter for example only "Red" and "Yellow" colors from ALL elements and output document like this:
// because "Dog" appears 2 times so total = 2
{
  description: "Dog",
  total: 2,
  colors: [
      { "_id": "Red", total: 2 },
      { "_id": "Yellow", total: 1 }
  ]
}

{
  description: "Cat",
  total: 1,
  colors: [
      { "_id": "Yellow", total: 1 }
  ]
}

{
  description: "Bird",
  total: 1,
  colors: []
}

{
  description: "Red",
  total: 2,
  colors: [
    { _id: "Yellow", total: 1 }
  ]
}
{
  description: "XXX",
  total: 4,
  colors: [
    { _id: "Yellow", total: 1 }
  ]
}

I can do this by using collection.distinct('labels.description') and then iterating through every single element + make a separate collection.count({ 'labels.description': 'Dog' }) like this:
for (...)
db.collection.aggregate([
{
        "$match": {
            "labels.description": valueFromLoop // (e.g. Dog)
        }
},
{ $unwind : "$labels" },
{
    "$group": {
        "_id": "$labels.description",
        "count": { "$sum": 1 }
    }
},
{
    "$match": {
        "$or": [
            { "_id": "Red" },
            { "_id": "Yellow" }
        ]
    }
},
{
    "$sort": {
        "count": -1
    }
}
])

I want to do this in a single aggregation or mapReduce so that I could easily output it to new collection using $out instead of using Bulk operations separately, however I don't know if it's possible.

A: Try this:
let filter = ["Red", "Yellow"];

db.testcollection.aggregate([
    {
        $addFields: { bkp: "$labels" }
    },
    { $unwind: "$labels" },
    {
        $addFields: {
            bkp: {
                $filter: {
                    input: "$bkp",
                    as: "item",
                    cond: {
                        $and: [
                            { $ne: ["$$item.description", "$labels.description"] },
                            { $in: ["$$item.description", filter] }
                        ]
                    }
                }
            }
        }
    },
    {
        $unwind: {
            path: "$bkp",
            preserveNullAndEmptyArrays: true
        }
    },
    {
        $group: {
            _id: {
                key1: "$labels.description",
                key2: { $ifNull: ["$bkp.description", false] }
            },
            total: { $sum: 1 }
        }
    },
    {
        $group: {
            _id: "$_id.key1",
            description: { $first: "$_id.key1" },
            total: {
                $sum: {
                    $cond: {
                        if: { $first: [["$_id.key2"]] },
                        then: 1,
                        else: "$total"
                    }
                }
            },
            colors: {
                $push: {
                    $cond: {
                        if: { $first: [["$_id.key2"]] },
                        then: {
                            _id: "$_id.key2",
                            total: "$total"
                        },
                        else: "$$REMOVE"
                    }
                }
            }
        }
    },
    { $project: { _id: 0 } }
]);

A: db.test2.aggregate([
              {
                $project: {
                  labels:1,
                  colours: {
                    $filter: {
                    input: "$labels",
                    as: "label",
                    cond: {
                      $or: [
                        {$eq:["Yellow","$$label.description"]},
                        {$eq:["Red", "$$label.description"]}
                      ]
                    }
                  }
                }
              }
              },
              {$unwind:"$labels"},
              {$group:{
                _id: "$labels.description",
                total: {$sum:1},
                colours: {$addToSet:"$colours.description"}
              }},
              {
                $project:{
                _id:0,
                description:"$_id",
                total:1,
                colours: {
                  $reduce:{
                    input: "$colours",
                    initialValue: [],
                    in: {$concatArrays: ["$$value", "$$this"]}
                  }
                }
              }
              },
              {
                  $unwind: {
                   path:"$colours",preserveNullAndEmptyArrays: true
                   }
              },
              {
                $group:{
                _id:{
                  description:"$description",
                  total:"$total",
                  colour:"$colours"
                 },
                 count: {
                    $sum: {$cond:[{$ifNull:["$colours",false]},1,0]}
                  }
              }
              },
              {
                  $group:{
                      _id:{
                       description:"$_id.description",
                       total:"$_id.total"
                      },
                    colours: {
                        $push: {
                            $cond: [{$gt:["$count",0]},
                            {
                                "_id":"$_id.colour",
                                total:"$count"
                            },
                            "$$REMOVE"
                            ]
                        }
                    }
                  }
              },
              {
                  $project: {
                      _id:0,
                      description: "$_id.description",
                      total: "$_id.total",
                      colours: 1
                  }
              }
            ]);

**Edit In your answer, you are missing the Yellows for Red and Dog because you are taking the first item from $result with $arrayElemAt: ["$result.description", 0].
If description is a colour, do you also want to include the counts for itself in colours?
Never mind, you've updated the answer

A: For some reason with code from both answers it does not count all tags properly.
I'm posting what works:
db.collection.aggregate([
    {
        $project: {
            labels: 1,
            result: {
                $filter: {
                    input: "$labels",
                    as: "label",
                    cond: {
                        $or: [
                            { $eq: ["$$label.description", "Blue"] },
                            { $eq: ["$$label.description", "Red"] },
                            { $eq: ["$$label.description", "Black-and-white"] },
                            { $eq: ["$$label.description", "Purple"] },
                            { $eq: ["$$label.description", "Orange"] },
                            { $eq: ["$$label.description", "Yellow"] },
                            { $eq: ["$$label.description", "Green"] },
                            { $eq: ["$$label.description", "Teal"] }
                        ]
                    }
                }
            }
        }
    },
    {
        $unwind: "$labels"
    },
    {
        "$group": {
            _id: "$labels.description",
            x: {
                $push: "$result.description"
            },
            total: { "$sum": 1 }
        }
    },
    {
        $project: {
            x: {
              $reduce: {
                input: '$x',
                initialValue: [],
                in: {$concatArrays: ['$$value', '$$this']}
              }
            },
            total: 1
        }
    },
    {
        $project: {
            x: 1,
            y: { $setUnion: "$x" },
            total: 1
        }
    },
    {
        $project: {
            _id: 0,
            description: "$_id",
            "colors": {
                $map: {
                    input: "$y",
                    as: "item",
                    in: {
                        _id: "$$item",
                        count: {
                            $size: {
                                $filter: {
                                    input: "$x",
                                    as: "itemx",
                                    cond: {
                                        $eq: ["$$item", "$$itemx"]
                                    }
                                }
                            }
                        }
                    }
                }
            },
            total: 1
        }
    },
    {
        $out: "backgrounds_meta"
    }
])


text:
Q: Accessing Arrays in dataLayer and sending to a Custom Dimension I do have an event called Purchase, in which features product & subCategory parameters. Here's how the event is set in dataLayer. Please keep in mind that the value of product & subCategory parameters are always changing. Also sometimes the index will have 5 items, sometimes only 1.
  dataLayer.push({
  event: 'Purchase',
  products: [
    {product: 'abc-111-aaaaa-1198', subCategory: 'Dresses'},
    {product: 'def-222-aaaaa-0002', subCategory: 'Skirts'},
    {product: 'ghz-333-aaaaa-0002', subCategory: 'Jackets'}
  ],
  gtm.uniqueEventId: 9999
})

I would like to be able to concatenate product & subCategory parameters into single custom dimension as a single value. The way to do is probably creating a Custom Javascript variable, since I don't have proficiency in JS, I am unable to produce the below output.
Final output should be:
"'abc-111-aaaaa-1198|Dresses','def-222-aaaaa-0002|Skirts', 'ghz-333-aaaaa-0002|Jackets'"

Would be great to have your JS code to produce the desired output!

A: Have a look at
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flatMap
I have also included an example.
const products = [
    {product: 'abc-111-aaaaa-1198', subCategory: 'Dresses'},
    {product: 'def-222-aaaaa-0002', subCategory: 'Skirts'},
    {product: 'ghz-333-aaaaa-0002', subCategory: 'Jackets'}
  ]

  const result = products.flatMap(x => x.product + "|" + x.subCategory);

  console.log(result);


text:
Q: How do you create a UTC time in C for a specific day, month and year? How do I create a UTC time in C for the following date:
1st July 2038
using standard ANSI C function calls (given that the tm_year element of the tm structure cannot be greater than 137) ?

A: You don't.  The 32-bit ANSI C time_t rolls over in 2038.  It's like asking how you create July 23, 2003 in your old 2-digit-year COBOL system.

A: Others have noted that the particular date you give as an example falls beyond the maximum date/time representable by a 32-bit time_t, often referred to as the Year 2038 problem. One solution is to use a 64-bit time_t, which some 64-bit POSIX systems do (linux amd64), and call mktime.
#include <time.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
        struct tm future;       /* as in future date */
        time_t t;

        future.tm_sec = 0;
        future.tm_min = 0;
        future.tm_hour = 0;
        future.tm_mday = 1;     /* 1st */
        future.tm_mon = 6;      /* July */
        future.tm_year = 2038 - 1900; /* 2038 in years since 1900 */
        future.tm_isdst = 0;          /* Daylight Saving not in affect (UTC) */
#ifdef _BSD_SOURCE
        future.tm_zone = "UTC";
#endif

        t = mktime( &future );
        if ( -1 == t ) {
                printf("Error converting 1 July 2038 to time_t time since Epoch\n");
                return EXIT_FAILURE;
        }

        printf("UTC time and date: %s\n", asctime( &future ) );

        return EXIT_SUCCESS;
}

A: You can try, making use of the following example :
#include <time.h>
#include <stdio.h>

int main(void)
{
  struct tm *local;
  time_t t;

  t = time(NULL);
  local = localtime(&t);
  printf("Local time and date: %s\n", asctime(local));
  local = gmtime(&t);
  printf("UTC time and date: %s\n", asctime(local));

  return 0;
}

It should give you, the expected result.


text:
Q: Can not change delimiters in vue.js 3.x In vue.js 2.x I used to simply do
new Vue({
    delimiters: ['${', '}'],
    ...
}

But now it does not seem to work anymore in vue 3.0.2 or 3.1.2 :
 const app = Vue.createApp({
 delimiters: ['${', '}'],
     data() {
         return {

             display: 'redbox',

         }
     },

Follinwg the docs, I also tried adding it after constructor like:
 const app = Vue.createApp({...});
 app.compilerOptions.delimiters = ['${', '}'];
 app.mount("#vue-enhanced-page");

But it did not work either and the delimiters are shown literally like ${p.title}. So appreciate your help to fix this.
It may worths noting that I import vue from cdn to my html page:
<script src="https://unpkg.com/vue@3.1.2"></script>


text:
Q: Calculating round trip distance in python My task is to calculate the round trip distance from the start location to all of the event locations that I have grabbed from Facebook in miles and back to the start.
My code so far:
import json
import re
from urllib import urlopen
import math

def getLatRad(latitude):
    return float(latitude) * (math.pi/180.0)
def getLongRad(longitude):
    return float(longitude) * (math.pi/180.0)
tuplist =[]
finaltuplist = []
#start_latitude = float(input('Pls enter the latitude co-ordinate of your starting location:'))
#start_longitude = float(input('Pls enter the longitude co-ordinate of your starting location:'))
start_latitude = 41.721194054071
start_longitude = -73.934258235003
longRad1= getLongRad(start_longitude)
latRad1 = getLatRad(start_latitude)
def main():

    eventids = [
                '264100516989470',
                '129843580476568',
                '158475914271199',
               ]
    for event in eventids:
        f = urlopen('http://graph.facebook.com/%s' % event)
        d = json.load(f)
        name = d['name']
        longitude = d["venue"]["longitude"]
        latitude = d["venue"]["latitude"]
        tuplist.append((name,longitude,latitude))
    for coordinates in tuplist:
        longRad2= getLongRad(coordinates[1])
        latRad2= getLatRad(coordinates[2])
        dlon = longRad2 - longRad1
        dlat = latRad2 - latRad1
        a = math.sin(dlat/2)**2 + math.cos(latRad1) * math.cos(latRad2) * math.sin(dlon/2)**2
        c = 2 * math.asin(math.sqrt(a))
        m = 3960 * c
        sum = m + m
        print sum
if __name__ == '__main__':
    main()

This is as far as I know how to do on my own. Is there any chance someone could point me in the right direction to get the total round trip distance instead of the individual distances from the start location?

A: So decompose your problem vs your solution.
Currently you can get the distance between start and event1, but you cant get the distance between event1 and event2.  You can also get the distance between start and event2.  What do you need to change in your calculation to get the distance from event1 to event2?
Edit for Elaboration Request:
latRad1 = getLatRad(start_latitude)
longRad1= getLongRad(start_longitude)
dlon = longRad2 - longRad1
a = math.sin(dlat/2)**2 + math.cos(latRad1) * math.cos(latRad2) * math.sin(dlon/2)**2
The upper 2 are outside of your for loop and are not changed (that I noticed).  Therefore when you move to a new location to calculate the distance, your still calculating it against the starting coords.


text:
Q: Rename username label on woocommerce login page i want to rename username label "Username or email' on woocommerce login page, is there any working hook to achieve this,
function login_function() {
add_filter( 'gettext', 'username_change', 20, 3 );
function username_change( $translated_text, $text, $domain )
{
    if ($text === 'Username')
    {
        $translated_text = 'customLoginName';
    }
    return $translated_text;
}

}
add_action( 'login_head', 'login_function' );

A: There is not any hook for change Username Or email label change but yes you can put in your theme /woocommerce/auth/form-login.php for override default plugin form.
and you can replace label text in form-login.php by finding below line.
<?php esc_html_e( 'Username or email address', 'woocommerce' ); ?> *


text:
Q: Need a Stack Exchange site for discussion about Hinduism I think in this network (Stack Exchange) there should be a site for  Q&A about Hinduism! I saw two pages for Christianity and Islam. Hinduism is the third  largest religion and having 115cr+ followers. Then why not for Hinduism?

A: There is already a Proposal for that on Area51 – the staging site for new SE Q&A sites.
You can commit to it and help shaping the content of that future site.

Update: Hinduism Stack Exchange is in public beta for some time now.


text:
Q: Cannot read property 'screen' of undefined when using quasar components in storybook story I'm having an issue with rendering quasar components in the storybook with Vue and Quasar. I suspect it's not finding the quasar tags in the story. I just followed these steps to set up the project https://quasar.dev/start/vue-cli-plugin and then I ran npx sb init to set up the storybook in my app. After all, compilation works fine but when I view my story on the storybook screen I got the below error that appears. You check the screen here https://prnt.sc/1qd3ywr
I tried all possible solutions but none had worked. Any suggestions would be appreciated.
TypeError: Cannot read property 'screen' of undefined
    at setup (http://localhost:6006/vendors~main.iframe.bundle.js:89474:322262)
    at callWithErrorHandling (http://localhost:6006/vendors~main.iframe.bundle.js:37183:22)
    at setupStatefulComponent (http://localhost:6006/vendors~main.iframe.bundle.js:44151:29)
    at setupComponent (http://localhost:6006/vendors~main.iframe.bundle.js:44107:11)
    at mountComponent (http://localhost:6006/vendors~main.iframe.bundle.js:42108:13)
    at processComponent (http://localhost:6006/vendors~main.iframe.bundle.js:42083:17)
    at patch (http://localhost:6006/vendors~main.iframe.bundle.js:41698:21)
    at componentEffect (http://localhost:6006/vendors~main.iframe.bundle.js:42220:21)
    at reactiveEffect (http://localhost:6006/vendors~main.iframe.bundle.js:36022:24)
    at effect (http://localhost:6006/vendors~main.iframe.bundle.js:35997:9)

Here is my story for the quasar component: (quasar.stories.js)
import { QLayout, QPageContainer, QPage, QSelect, QBtn } from 'quasar'

export default {
  title: 'Quasar'
}

export const Components = () => ({
  title: 'QuasarComponents',
  components: { QLayout, QPageContainer, QPage, QSelect, QBtn },
  template: `<q-layout>
    <q-page-container>
      <q-page class="full-height full-width justify-center items-center q-pa-xl">
        <div class="col-auto">
          <q-input v-model="name" label="Full name" />
          <q-select v-model="role" :options="options" label="User Role" />
        </div>
      </q-page>
    </q-page-container>
  </q-layout>`,
  data () {
    return {
      name: null,
      role: 'User',
      options: ['Admin', 'Supervisor', 'User']
    }
  }
})

main.js
module.exports = {
  "stories": [
    "../src/**/*.stories.mdx",
    "../src/**/*.stories.@(js|jsx|ts|tsx)"
  ],
  "addons": [
    "@storybook/addon-links",
    "@storybook/addon-essentials"
  ]
}

preview.js
export const parameters = {
  actions: { argTypesRegex: "^on[A-Z].*" },
  controls: {
    matchers: {
      color: /(background|color)$/i,
      date: /Date$/,
    },
  },
}

A: This looks like  GitHub issue #7263, which is caused by an app extension.
One user discovered a solution:

em-qui is an app-extension that was also declaring quasar as a devDependency (for IDE support...), though on the same version this was somehow causing a confict:
{
  "devDependencies": {
    "graphql-tag": "^2.10.3",
    "quasar": "^1.12.6"
  },
}

So I had to separate the two by declaring it in peerDependencies in the app extension:
{
  "devDependencies": {
    "graphql-tag": "^2.10.3"
  },
  "peerDependencies": {
    "quasar": "^1.12.6"
  }
}

and the error went away.


text:
Q: how to convert csv file to tfrecord I am actually working with miniconda and tensorflow and trying to train a model for object detection and I'm facing a problem when running generate_ tfrecord.py to convert csv to tfrecord the error is:
"generate_tfrecord.py", line 90, in <module>
               tf.app.run()

I used this link
 https://github.com/datitran/raccoon_dataset/blob/master/generate_tfrecord.py
(tensorflow) C:\Users\OctaNet\Miniconda3\envs\tensorflow\models\research\object_detection>python generate_tfrecord.py --csv_input=images/train.csv  --output_path=data/train.record --image_dir=images/train/

Iterating train
Traceback (most recent call last):
  File "generate_tfrecord.py", line 90, in <module>
    tf.app.run()
  File "C:\Users\OctaNet\Miniconda3\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
    _sys.exit(main(argv))
  File "generate_tfrecord.py", line 80, in main
    tf_example = create_tf_example(group, path)
  File "generate_tfrecord.py", line 67, in create_tf_example
    'image/object/class/label': dataset_util.int64_list_feature(classes),
  File "C:\Users\OctaNet\Miniconda3\envs\tensorflow\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\utils\dataset_util.py", line 26, in int64_list_feature
    return tf.train.Feature(int64_list=tf.train.Int64List(value=value))
TypeError: None has type NoneType, but expected one of: int, long


text:
Q: Configure Calendar time scale to 15 minutes in Outlook (via Group Policy) Outlook by default allows users to book meetings in 30 minute increments; this can be manually changed to allow 15 minute increments (Change the calendar time scale).
I need to deploy/control this across my organisation (ideally via group policy).  I have checked Microsoft's group policy administration template but could not find anything suitable to perform this.
Any ideas on how this can be deployed/controlled?

A: Here is a script that you can tune.... It need to be run with the current user, outlook must be closed, and does not work for new teams or skype meetings.
*tested on outlook 2016
<#
2=10 minutes
3=15 minutes
4=30 minutes
0=5 minutes
5=60 minutes
1=6 minutes
#>

   $minutes = 3

if (!(Get-Process OUTLOOK -WarningAction SilentlyContinue))
{
     #Set outlook calendar time scale default
     Add-type -assembly "Microsoft.Office.Interop.Outlook" | out-null
     $olFolders = "Microsoft.Office.Interop.Outlook.OlDefaultFolders" -as [type]
     $outlook = new-object -comobject outlook.application
     $namespace = $outlook.GetNameSpace("MAPI")
     $Calendar = [Microsoft.Office.Interop.Outlook.OlDefaultFolders]::olFolderCalendar
     $folder = $namespace.getDefaultFolder($Calendar)

     while ($folder.CurrentView.DayWeekTimeScale -ne $minutes)
     {
        $folder.CurrentView.DayWeekTimeScale = $minutes

     }
     Write-Host "Set to" $folder.CurrentView.DayWeekTimeScale
     $folder.CurrentView.Save()
     $outlook.Quit()

     #Set new meeting outlook range to 15 min
     Set-ItemProperty -Path "HKCU:\Software\Microsoft\Office\16.0\Outlook\Options\Calendar" -Name "EndEventsEarly" -Value 1
     Set-ItemProperty -Path "HKCU:\Software\Microsoft\Office\16.0\Outlook\Options\Calendar" -Name "EndEarlyShort" -Value 15

 }
else
{
    Write-Host "Outlook is open! The setting wasn't set....." -ForegroundColor red
}


text:
Q: Codeigniter controller and model with same name collison I'm try something from this comment idea Code Igniter Controller/Model name conflicts
find class name variable on core/CodeIgniter.php :
$class  = $RTR->fetch_class(); and change like that:
$class  = 'Controller' . $RTR->fetch_class();
now change controller name:
class ControllerUser extends CI_Controller { ...
It works, now I can use User model and User controller. But my question is, Does it make sense? or Does the problem? (sorry my bad English)

A: I would not modify the core of CodeIgniter. When you upgrade, you'll loose that change.
I've done two things in the past:
1. Named my models User_model
2. Named my controllers as plural, and my models as singular.
I do the latter now. This semantically makes sense too, because the controller name is in the URL, so paths look like app_path/users/username. Also, the model usually models a single user, so that makes sense too.
You can also follow some discussion from the community on this question here: http://codeigniter.uservoice.com/forums/40508-codeigniter-reactor/suggestions/1269847-controller-prefixes

A: To get around this issue, normally most people add the '_model' suffix to the Model class names
I think it is better to add a suffix to the Controllers instead, since they are almost never referenced by their class names in your code.
First we need to extend the Router class.
Create this file: "application/libraries/MY_Router.php"
class MY_Router extends CI_Router {
    var $suffix = '_controller';

    function __construct() {
        parent::CI_Router();
    }

    function set_class($class) {
        $this->class = $class . $this->suffix;
    }

    function controller_name() {

        if (strstr($this->class, $this->suffix)) {
            return str_replace($this->suffix, '', $this->class);
        }
        else {
            return $this->class;
        }

    }
}

Now edit "system/codeigniter/CodeIgniter.php"
line 153:
if ( ! file_exists(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->controller_name().EXT))

line 158:
include(APPPATH.'controllers/'.$RTR->fetch_directory().$RTR->controller_name().EXT);

Next, edit: "system/libraries/Profiler.php", line 323:
$output .= "

".$this->CI->router->controller_name()."/".$this->CI->router->fetch_method()."
";

Source

A: Yup this makes sence. Codeigniter is a strict Object Oriented framework. This means that when you have 2 or more objects with the same name, the name of the object is not unique enough.
In your case a model is a data processor and a controller the class that connects your view to the model. So logically you must name it something like this:
Your model will be: "Model_User", "Db_User" or "UserList"
Your controller will be: "User", Controller_User or UserController
In case of the model I suggest you use Db_User (short but clear names) and in the controllers case I suggest you use "User" (short and the class which defines the user when its combined with the model and view for that user)
I never have problems using my Codeigniter systems like this

A: Why dont you just make your controllers singular and your models/db tables plural ?


text:
Q: In PostgreSQL, what to do after VALIDATE CONSTRAINT succeeds on a constraint marked with NO VALID? So, I get the rough gist of changing constraints on existing columns with PostgreSQL:

*

*Use NO VALID to ensure the new constraint does not lock the table.

*Migrate the old data at your leisure.

*Run VALIDATE CONSTRAINT at some point to check if the column is consistent.

My question is then, do you ever remove NO VALID? If the point is to avoid locking the table with ADD CONSTRAINT, it seems like no? After all, if you drop NO VALID after the success of VALIDATE CONSTRAINT, won't you still lock the table?

A: As @jjanes said, this question makes no sense, as VALIDATE removes NOT VALID. I did not realize that, but now I do!


text:
Q: Django template error while rendering a unicode string I am passing a python list to a django template like this:
in views.py:
dat = [-77.448599999999999, 37.536900000000003, u'Virginia War Memorial', 1.0]
result={"dat":dat}
return render(request,'result_map.html', {'form': form,'result':result})

and in my template:
var dat = {{ result.dat }}

but in the rendered html I get:
var dat = [-77.448599999999999, 37.536900000000003, u'Virginia War Memorial', 1.0]

which gives an error.
How can I get:
var dat = [-77.448599999999999, 37.536900000000003, 'Virginia War Memorial', 1.0]

thanks

A: I think you need to pass it through the safe filter if you want the raw string:
{{ result.dat|safe }}
You can also use the {% autoescape off %} block if you want to affect a larger block of the template.

A: var dat = {{ result.dat }}

You're trying to inject into JavaScript, presumably in a <script> block. You need output that is formatted in JavaScript syntax, but you're implicitly converting a Python list to a string, which will give a Python-syntax list literal, not a JavaScript one. There are a number of differences, including text (Unicode) strings in the list being prefixed with u in Python 2 but not JS.
You're also using the default autoescaping for Django templates, which is HTML-escaping. That would be right for injecting into HTML content, but you're injecting into JavaScript, so you get wrong escapes like ' for '. You can prevent this by adding the |safe filter to avoid the HTML-escaping, but then you have no escaping at all, so your page will be vulnerable to script injection (cross-site scripting).
The right way to output a structured value into a <script> block is:

*

*json.dumps to turn it into a JSON string

*replace any instances of the character < in the string with the JSON string literal escape \u003C, so that the string </script> can't be used to escape from the <script> block and inject HTML

*mark as safe.

You can combine these operations into a custom filter. Unfortunately Django itself doesn't ship one.
A better approach is to avoid injecting into JavaScript at all. Instead write the json.dumps output into the HTML document using the standard escaping and read it from there using DOM:
return render(request, 'result_map.html', {'form': form, 'dat': json.dumps(dat)})
...
<body data-dat="{{ dat }}">
...
var dat= JSON.parse(document.body.getAttribute('data-dat'));

this allows you to keep your JS completely out of your HTML pages, which would also allow you to use more secure Content-Security-Policy settings.


text:
Q: Notation for Taking the Sign of a Number I'm curious whether there's an accepted notation for a function that takes in a number and returns only $\pm 1$ where the sign is the same as the sign of the input. What I'm trying to achieve feels similar to normalizing a vector where the "direction" is only either positive or negative.
$$ \text{sign}(n) = \frac{n}{\left|n\right|} $$
Examples being that $\text{sign}(-4) = -1$ and $\text{sign}(\pi^e) = 1$ .
I ask the question because of a problem where I'm taking a square root of number that has been squared ($\sqrt{a^2}$ where $a$ is not directly known) with the sign of $a$ being indicated by a different but related number $b$. I'm wanting, if one exists, a recognizable way of concisely writing what I've defined as $\sqrt{a^2}=\text{sign}(b) \times a$ without having to define my own notation where some may already exist.

A: The sign function is commonly written $\text{sgn}$.
https://en.wikipedia.org/wiki/Sign_function

What you discuss in your post seems to be related to the "sign transfer" operation,
$$\text{sgn(b)}|a|,$$ for which I don't think there is a usage (it is defined along with some programming languages).

A typical use of the sign function is in the expression of the numerically stable solution of the quadratic equation,
$$x_0=\frac{-b-\text{sgn}(b)\sqrt{b^2-4ac}}{2a},\\x_1=\frac{2c}{{-b-\text{sgn}(b)\sqrt{b^2-4ac}}}.$$


text:
Q: Stenciljs @Method not working I'm struggling to get @Method in stenciljs working - any help would be appreciated.
Here's my component code with a function called setName that I want to expose on my component:
import { Component, Prop, Method, State } from "@stencil/core";

@Component({
  tag: "my-name",
  shadow: true
})
export class MyComponent {

  @Prop() first: string;
  @Prop() last: string;
  @State() dummy: string;

  @Method() setName(first: string, last: string): void {
    this.first = first;
    this.last = last;
    this.dummy = first + last;
  }
  render(): JSX.Element {
    return (
      <div>
        Hello, World! I'm {this.first} {this.last}
      </div>
    );
  }
}

Here's the html and script that references the component:
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0">
  <title>Stencil Component Starter</title>
  <script src="/build/mycomponent.js"></script>

</head>
<body>

  <my-name  />

  <script>
    var myName = document.querySelector("my-name");
    myName.setName('Bob', 'Smith');
  </script>
</body>
</html>

Here's a screen shot of the error I'm getting which is Uncaught TypeError: myName.setName is not a function:

A: Methods are not immediately available on a component; they have to be loaded/hydrated by Stencil before you can use them.
Components have a componentOnReady function that resolve when the component is ready to be used. So something like:
var myName = document.querySelector("my-name");
myName.componentOnReady().then(() => {
  myName.setName('Bob', 'Smith');
});

A: Just posting another answer because this has since changed, with Stencil One.
All @Method decorated methods are now immediately available on the component, but they are required to be async, so that you can immediately call them (and they resolve once the component is ready). The use of componentOnReady for this is now obsolete.
However, you should make sure that the component is already defined in the custom element registry, using the whenDefined method of the custom element registry.
<script>
(async () => {
  await customElements.whenDefined('my-name');

  // the component is registered now, so its methods are immediately available
  const myComp = document.querySelector('my-name');

  if (myComp) {
    await myComp.setName('Bob', 'Smith');
  }
})();
</script>

A: Here you should not use @Method , it is not a best practice. We should always minimize the usage of @Method. This helps us to  scale the app easily.
Instead pass data through @Prop and @Watch for it.
Ok , in your case , Please add async before the method name


text:
Q: How to run two profiles in one maven command? I have a pom.xml file having surefire:test plugin and have two profiles to run diffrent test modules/tests. Iam trying to run these by command "mvn surefire:test -PfirstProfile,secondProfile".
But here only the second profile written in pom.xml gets executed. This command is recommended by apache maven website. Here is my pom.xml file:
 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${maven.plugin.surefire.version}</version>
    <configuration>
      <forkMode>always</forkMode>
      <!-- <testFailureIgnore>true</testFailureIgnore> -->
      <failIfNoTests>false</failIfNoTests>
      <skipTests>${skipTests}</skipTests>
      <runOrder>${testRunOrder}</runOrder>
    </configuration>
    </execution>
    </executions>
  </plugin>
  <profile>
  <id>firstProfile</id>
  <properties>
        <skipTests>false</skipTests>
  </properties>
  <build>
      <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>${maven.plugin.surefire.version}</version>
              <configuration>
                  <includes>
                    <include>**/AbcTest.java</include>
                  </includes>
              </configuration>
          </plugin>
      </plugins>

  </build>
</profile>
<profile>
  <id>SecondProfile</id>
  <properties>
        <skipTests>false</skipTests>
  </properties>
  <build>
      <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>${maven.plugin.surefire.version}</version>

              <configuration>
                  <includes>
                      <include>**/xyzTest.java</include>
                  </includes>
              </configuration>
          </plugin>
      </plugins>

  </build>
</profile>

so how do i run both these profiles together? I tried execution IDs also. But it is not working.

A: Try to change the configuration for maven-surefire-plugin in both profiles like this:
   <build>
      <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>${maven.plugin.surefire.version}</version>
              <configuration>
                  <includes combine.children="append">
                    <include>**/AbcTest.java</include>
                  </includes>
              </configuration>
          </plugin>
      </plugins>

  </build>

Apart from this it's not a good idea to select unit tests by profiles. If those tests are integration test you should go with maven-failsafe-plugin instead.


text:
Q: Job failed using Gitlab I have used the Gitlab for run the CI plan.
Problem sequence:

*

*Run the CI plan, with below yaml script, now CI getting passed

*Again run the CI plan, now CI getting failed with below error code
warning: failed to remove MediaDrmCts/app/build/outputs/apk/debug/output.json: Invalid argument
Environment:
Gitlab runner in Windows PC
Shell
Yaml Code:
assembleDebug:
  stage: build
  script:
    - echo 'start building...'
    - cd MediaDrmCts
    - ./gradlew clean assemble
  artifacts:
    paths:
      - MediaDrmCts/app/build/outputs/

debugTests:
  stage: test
  script:
    - cd MediaDrmCts
    - ./gradlew -Pci --console=plain :app:testDebug

Error Log:

Please help us to resolve the issue?

A: This could be related to the issues in GitLab with killing processes on Windows:
tl;dr the windows runner (current version is around ~13.6 with no fix yet) can't kill the full tree of processes started in the job properly, so processes holding file locks are left around for the next job/pipeline to fail on when it attempts to clean up

*

*https://gitlab.com/gitlab-org/gitlab-runner/-/issues/3185

*https://gitlab.com/gitlab-org/gitlab-runner/-/issues/3121
I've had similar issues in the past and a workaround is to clean up troublesome directories in the job that makes them, rather than letting the git clean command clean them up in the next job.
One option:
debugTests:
  stage: test
  script:
    - cd MediaDrmCts
    - ./gradlew -Pci --console=plain :app:testDebug
  after_script:
    - if (Test-Path ./MediaDrmCts/app/build) { Remove-Item ./MediaDrmCts/app/build -Recurse -Force; }
...

Another option
If your builds aren't sensitive to how clean the repo folder is, then you can try turning off the git clean -ffdx step in your .gitlab-ci.yml file:
...
variables:
  GIT_CLEAN_FLAGS: none
...

which will tell the GitLab runner not to attempt cleaning up the repository of extra files before each run.
Keep in mind that this may have some unintended consequences, such as the wrong files being left over from previous runs on other branches, so be wary, and have good tests!


text:
Q: How do I route menu actions to an NSViewController inside a window? I have a menu item inside the main app menu and I'd like to route its action to a view controller (NSViewController). The interface hierarchy looks like this: There's a main app window controller by an NSWindowController. Inside the window there's a split view, and the right view in the split view is controlled by the NSViewController.
Window + NSWindowController
    `-- NSSplitView
           `-- NSView
           `-- NSView + NSViewController

The menu item is connected to First Responder in the Interface Builder. The view controller in question implements the appropriate method, but the menu item stays disabled. When I move the method to the NSWindowController, the menu item gets enabled.
I figured I need to get the view controller to the responder chain, so I set it as the nextResponder for the window controller; no cigar. What am I doing wrong?

A: In the end I added a base class for my window controllers and made it forward calls to the "child" controllers:
- (id) childControllerForSelector: (SEL) selector
{
    for (id controller in [childControllers copy])
        if ([controller respondsToSelector:selector])
            return controller;
    return nil;
}

- (BOOL) respondsToSelector: (SEL) selector
{
    return [super respondsToSelector:selector] ? YES :
        [self childControllerForSelector:selector] ? YES :
            NO;
}

- (void) forwardInvocation: (NSInvocation*) invocation
{
    id child = [self childControllerForSelector:[invocation selector]];
    [invocation invokeWithTarget:child];
}

- (NSMethodSignature*) methodSignatureForSelector: (SEL) selector
{
    NSMethodSignature *signature = [super methodSignatureForSelector:selector];
    if (!signature) {
        id child = [self childControllerForSelector:selector];
        signature = [child methodSignatureForSelector:selector];
    }
    return signature;
}

It's a lot of code, but it's a general solution that keeps the controller code free from ad-hoc forwarding. Hopefully it's not too much magic.

A: You can set the window controller as the delegate of the window so it will now be a part of the responder chain.
Assuming that you have your own subclass of NSWindowController, you can then simply catch the menu event there and call your appropriate methods in your controllers.
Unfortunately, the docs advice against trying to insert anything in the responder chain between the various views and subviews, so you can't just squeeze your view controller in there.
More here, but I take it you have already consulted that.


text:
Q: "Index was outside the bounds of the array" when accessing variable Trying to make it where, you click a button, it lets you pick a directory, the directory, and then that directory, .file, is changed by the specific line. Current code. Sorry i'm a noob.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim dialog As New OpenFileDialog()
    If DialogResult.OK = dialog.ShowDialog Then
        TextBox1.Text = dialog.FileName
        Dim Directory1 As String
        Directory1 = Trim(TextBox1.Text)
        Dim Item1 As String
        Item1 = Trim(TextBox2.Text)
        Dim thefile As String = Directory1
        Dim lines() As String = System.IO.File.ReadAllLines(Directory1)
        // This gets the error. Item1.
        // {"Index was outside the bounds of the array."}
        lines(2) = Item1

        System.IO.File.WriteAllLines(thefile, lines)
    End If
End Sub

A: The problem is that the file is not allocating enough lines on the array lines(), probably because System.IO.File.ReadAllLines(Directory1) is reading less than three lines. Try using a file with more than 3 lines and it should work.
You could also do something like this (sorry, I'm no vb.net coder so my syntax could be wrong):
If lines.Length < 3 Then
   ReDim Preserve lines(2)
End If
lines(2) = Item1

I'm not exactly sure what do you want to achieve with this so I can't give a "solution". This would be just a "patch" to make your code work.
Update
From requirements in the comments, if you want the line to be changed in a variable (which would be in TextBox3.Text, starting from zero), you'd need to do this:
Dim LineToBeChanged As Integer = Convert.toInt32(TextBox3.Text)
If lines.Length < LineToBeChanged+1 Then
   ReDim Preserve lines(LineToBeChanged)
End If
lines(LineToBeChanged) = Item1


text:
Q: Another word for "opportunities"? As in "job opportunities"
I found some synonyms, but they just don't fit:

"openings, chances, possibilities, etc."

Inserting one of those words in a sentence like this doesn't work, that is, without changing the meaning.

A college degree can get you more job opportunities.

I'm writing something where I have to use that phrase quite a bit. I don't want it to sound redundant.

A: "prospects" is a good replacement. Is is close in meaning to "possibilities".

A college degree can open you to new (job) prospects.

Oxford English Dictionaries definition:

Chances or opportunities for success or wealth: 'the poor
  prospects for the steel industry'

A: Some alternatives:

*

*A college degree has more scope.

*A college degree enables higher job potential.

*A college degree provides more job openings.

*A college degree enables job flexibility.

A: The following should also work as alternatives:

A college degree can get you a better choice (of jobs).
A college degree can get you more (career) choices.

From oxforddictionaries.com:

choice
NOUN
1.2 A range of possibilities from which one or more may be chosen: you can have a sofa made in a choice of forty fabrics
The Boeing business jet also comes with a choice of interior
  decoration ranging from the basic to sumptuous.
The choice of bar can
  range from a close-knit pub setting to a party animal's dream.
Walkers
  set off from Cudham village on a choice of routes ranging from three
  to eight miles.
Synonyms: range, variety, selection,
  assortment; array, display
1.3 A thing or person which is chosen: this disk drive is the perfect choice for your computer
Garry was an ideal
  choice to present the prize on behalf of the slimming group because he
  lost two stones through their plan earlier this year.
Particularly,
  chopsticks are also a good choice when people send presents to
  relatives and friends.
The flight prize was an easy choice for the
  leading lawman with a long-standing interest in aviation.
Synonyms: appointee; nominee, candidate, selection


text:
Q: Postgresql - increase WAL retention to avoid slave go out of sync with master I've setup a master / slave Postgresql (13.4) group, 1 master and 1 slave, using WAL warm standby.
(refer: https://postgresql.org/docs/current/warm-standby.html#STANDBY-SERVER-SETUP)
The slave gone out of sync, and can't recover due to WAL not exists anymore on master, refer another question for details: Postgresql - recover slave after out of sync with master using WAL
Now, I'am re-doing the slave. There are 3.7T data on master, and it's increasing pretty quickly, roughly 30Gb per day ?
To avoid slave go out of sync again, I'm trying to increase the WAL retention.
Here is what I plan to do:

*

*max_wal_size = 20Gb

*min_wal_size = 10GB
Questions:

*

*A-1. Are the above param values proper?

*A-2. Does increasing these param has a bad side effect ?

*A-3. I only need to apply these 2 params to master, right?

*B. Is there more parameter that I should config?

*C. Any better way to avoid slave out of sync ?

Thank you.

A: No, that won't help at all.
You have three alternative options:

*

*increase wal_keep_size to a big enough value
That is a simple, but coarse solution, in that it makes the primary always retain a certain amount of WAL, regardless if it is too much or not enough (because the downtime is longer than expected).

*set a restore_command on the, so that it can use the WAL archive to catch up
That may be the best option if you have a WAL archive.

*use a physical replication slot
Such an object marks a certain position in the WAL stream and prevents the primary from discarding WAL that is still needed by the standby. While being an elegant solution, this bears the risk of breaking the primary if the standby stays down too long. Consequently, it is a good idea to monitor replication in this case and/or to set max_slot_wal_keep_size to put a cap on the amount of WAL retained on the primary.


text: Q: Labels of locator's results in ArcGIS Pro I have a composite address locator by Create Locator geoprocessing in ArcGIS Pro 2.6 and I have a problem with a style of search results. The default is the schema: House Number, Street Name, City, Subregion, Region, Postal. In Poland we use: Street Name, House Number, Postal, City, Subregion, Region. Is possible to change a display method of locator's results?


text:
Q: Can we use our own method to directly pass url with parameters to login yammer I want to login to Yammer using my website credentials. Whenever I login to my website I must be logged in to Yammer to view the feed.
Is this possible or is there any API for automatically logging in a user?

A: It isn't possible to automatically authenticate users to the Yammer Embed feed for various reasons, including the modes that are supported for authentication to Yammer today and security. Depending on how the Yammer network and the O365 identity configuration is setup, you may be able to improve the experience.


text:
Q: JSF Security Libraries What technologies and libraries are available for JSF security? I want to protect my admin pages of a JSF application from public access.

A: It's a rather difficult question but these days I would go for Spring Security or Apache Shiro. In case you are not using Spring, I would take a look at Shiro. It's pretty easy to set this up and also to use. There are also few tutorials, like this one from BalusC.
Another option are Realms which can have container specific (Tomcat, Glassfish, ...) settings which would make them not portable. You could also use a Phase Listener which can be very neat way to secure small projects (if your application is going to be small, I would go for this option). There are other frameworks and workarounds too, try to google little more about Java EE security and you will see.

A: You can simply use spring:
Add spring security dependencies in your pom.xml, then change springSecurity-taglibs.xml (add function names like areAnyGranted)
Then, in your web.xml, add the context param:
<context-param>
    <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
    <param-value>/WEB-INF/springSecurity-taglibs.xml</param-value>
  </context-param>

After that add roles in your applicationContext-security.xml
<security:intercept-url pattern="/pages/admin.xhtml" access="ROLE_ADMIN" />


text:
Q: Pattern and Matcher in Java in CDATA tag I want to replace & with & in my xml file.
Here is my code :
//On match sur tous les <!CDATA[ ... ]>
Pattern p = Pattern.compile("<!\\[CDATA\\[((&)|[^\\]]|\\][^\\]]|\\]\\][^>])*\\]\\]>");
Matcher m = p.matcher(l_retour.toString());

String temp2 ="";
temp2 = l_retour.toString();
while(m.find()){
        //Si il y a un '&'
        if(m.group(2) != null){
                //On remaplace les & remplacés précédement par un '&' simple car on se trouve dans une balise <!CDATA[]>
                temp2 = temp2.replaceFirst(Pattern.quote(m.group()),m.group().replaceAll("&", "&"));
        }
}

There are an error in execution :
04 26 17:02:48,733 FATAL ExporteXml: Illegal group reference
04 26 17:02:48,733 FATAL ExporteXml: java.util.regex.Matcher.appendReplacement(Matcher.java:808)
04 26 17:02:48,733 FATAL ExporteXml: java.util.regex.Matcher.replaceFirst(Matcher.java:955)
04 26 17:02:48,733 FATAL ExporteXml: java.lang.String.replaceFirst(String.java:2119)

I suppose it's my regex but y didn't find solution..
Thanks by advance for your answers

A: Guessing that l_retour is a String variable containing the whole XML file:
l_retour = l_retour.replaceAll("&", "&"); should be enough for you.

A: If you have a look at your stacktrace you'll note that it's in replaceFirst(...). Thus I assume that your problem is what you pass to temp2.replaceFirst(Pattern.quote(m.group()),m.group().replaceAll("&", "&")); - most probably it's the second parameter that is interpreted in regex terms (to allow for group references such as $1).
However, you don't need to do that, just replace & inside the match:
StringBuffer result = new StringBuffer();
while( m.find() ) {
  String replacement = m.group();
  if(m.group(2) != null){
    replacement = replacement.replace( "&", "&" );
  }
  m.appendReplacement( result, replacement );
}
m.appendTail( result );

You might not even need to check for & in your expression, just get all CDATAs and replace any &. If none is present nothing will be replaced.
However, I'll issue a warning: applying regular expressions to irregular languages such as XML is a receipe for disaster! Unless you know what your CDATA can contain it's likely you won't find a pattern that matches everything (e.g. I know of some people who put XML into CDATA ... ouch). When dealing with XML you're normally better off using a proper XML parser.

A: I listen to you and i simply do this :
//On match sur tous les <!CDATA[ ... ]>
Pattern p = Pattern.compile("<!\\[CDATA\\[.+\\]\\]>");
Matcher m = p.matcher(l_retour.toString());
String result = l_retour.toString();
String replacement = "", replacementTmp = "";
while(m.find()){
    replacementTmp = m.group();
    //On remaplace les & remplacés précédement par un '&' simple car on se trouve dans une balise <!CDATA[]>
    replacement = replacementTmp.replace("&", "&");
    int indexBegin = result.indexOf(replacementTmp);
    int indexEnd = result.length() - 1;
    result = result.substring(0, indexBegin) + replacement + result.substring(indexBegin + replacementTmp.length(), indexEnd);
}

Thanks


text:
Q: Linux 2.6.36.4, GCC 4.7.2, getting lots of "variable set but not used" warnings I am trying to compile the Linux kernel 2.6.36.4 on Linux Mint 14 running a 3.5 kernel by default. Using gcc version 4.7.2. Tried googling it, but didn't quite work out.
The warning is:
warning: variable 'gfp' set but not used [-Wunused-but-set-variable]

I have tons of these warnings all over the compilation. The compilation does NOT fail anywhere at all. And the worst part is the compiled kernel doesn't boot successfully either.
Do I need to set any more gcc options? Or should I simply ignore it?
Note: I am working on virtualbox. The stock kernel works just fine.

A: "Variable set but not used" warnings are informational.
According to the official documentation, -Wunused-but-set-variable controls the behavior of:

Warn[ing] whenever a local variable is assigned to, but otherwise unused (aside from its declaration). This warning is enabled by -Wall.

The purpose is to catch situations where the programmer assigns a value to a variable and then never does anything more with it. The kernel is fairly special in that in the deep trenches of low-level operating system programming, even I can imagine situations where doing something like that can be perfectly legitimate and even necessary to achieve the result you are after.
If the variable assignment statement is truly unneeded, the compiler is likely to optimize it away.
Bottom line, unless you are the developer, it should be safe to ignore this class of warnings. If you are the developer, you should consider whether the assignment is necessary. If portability to non-GCC compilers is not a priority, consider adding the __attribute__((unused)) to the declaration to suppress the warning for that variable; see also Variable Attributes.

A:
Or should I simply ignore it?

Unused variables could be an indication of a coding mistake.  If you are satisfied this is not the case and want to suppress the warning for a particular variable, you can use a (GCC specific) __attribute__ tag, e.g.:
/* Unused parameter (in definition, not declaration): */
void somefunc (int x __attribute__ ((unused))) {
    [...]
}

/* Unused variable. */
int x __attribute__ ((unused));
/* But set... */
x = 1;

The first case is not unusual if you are fulfilling an API -- e.g., writing a callback where you ignore the parameter, but must match the callback signature.  The second case seems a little oxymoronic, but might be useful temporarily if you've declared and set something you haven't used yet and don't want to be distracted by the warning, etc.
This is probably better than turning off -Wunused-parameter and/or -Wunused-but-set-variable.


text:
Q: Android ListView and Keyboard I have created a custom ListView with custom rows. They work just fine when using the touchscreen; however, when I attempt to click on the items in the row with the keyboard D-Pad nothing happens. By that I mean my OnClickListener is not called. Does anyone know of any good references or tutorials on how to add keyboard support for new custom rows in a ListView?

A: Use  setOnItemClickListener instead of setOnClickListener
Edit
Use an attribute like  on your list item
android:focusable="false"


text:
Q: PHP SoapClient __getLastResponse - how to display only one param When I run

echo $client->__getLastResponse();

result is:
0 123 simple error

but

var_dump($client->__getLastResponse());

result is:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header/><soap:Body><p1:FunctionResponse xmlns:p1="http://www.domain.com"><p1:TArrayFunctionResult><p1:Status>0</p1:Status><p1:ErrorCode>123</p1:ErrorCode><p1:ErrorMessage>simple error</p1:ErrorMessage></p1:TArrayFunctionResult></p1:CreateFunctionResponse></soap:Body></soap:Envelope>

Just need display ErrorMessage param
"simple error"

A: As a very dirty hack, you could use a regular expression.
<?php

$xml = <<<XML
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header/><soap:Body><p1:FunctionResponse xmlns:p1="http://www.domain.com"><p1:TArrayFunctionResult><p1:Status>0</p1:Status><p1:ErrorCode>123</p1:ErrorCode><p1:ErrorMessage>simple error</p1:ErrorMessage></p1:TArrayFunctionResult></p1:CreateFunctionResponse></soap:Body></soap:Envelope>
XML;

preg_match("/\<p1:ErrorMessage\>(.*)\<\/p1:ErrorMessage\>/", $xml, $arrMatches);

echo $arrMatches[1];

https://eval.in/199000


text:
Q: PHP: how to detect items with and without values in foreach Consider this example:
$arr = array('bla', 'foo', 'baz' => 2);

foreach ($arr as $arrKey => $arrValue) {
    echo $arrValue . PHP_EOL;
}

This will output:
bla
foo
2

But how can I detect within the foreach loop which items have had a value and which ones have had a key + value defined?

A: The reason you are confused is you don't have a complete understanding of how arrays work.
$arr = array('bla', 'foo', 'baz' => 2);

This evaluates to an array of 3, all of them having values.
That's its output:
Array
(
    [0] => bla
    [1] => foo
    [baz] => 2
)

When you push a value without specifying a key, it's key is the first available numeric index.
That's why in your case, the indexes 0 and 1 get the values 'bla' and 'foo'. 2 is the third value you push to the array, and its value isn't 2 but 'baz', because that's the value you specify.
This line:
$arr = array('bla', 'foo', 'baz' => 2);

and this one:
$arr = array(0 => 'bla', 1 => 'foo', 'baz' => 2);

are the exact same thing.
If you want an empty key, do this:
$arr = array('bla', 'foo', 'baz' => '');

Output:
Array
(
    [0] => bla
    [1] => foo
    [baz] =>
)

A: Your array would work better as:
$arr = ['bla', 'foo', ['baz' => 2]];

Then you could construct your foreach like so:
foreach ($arr as $a) {
    if (is_array($a)) {
        foreach ($a as $key => $val) {
            echo $val . PHP_EOL;
        }
    } else {
        echo $a . PHP_EOL;
    }
}

A: You can test if the $arrKey is not numeric then display it.
Try this :
$arr = array('bla', 'foo', 'baz' => 2);

foreach ($arr as $arrKey => $arrValue) {
    if(is_numeric($arrKey))
        echo $arrValue . PHP_EOL;
    else
        echo $arrKey."  ".$arrValue . PHP_EOL;
}

This will output :
bla
foo
baz 2

A: If there is no associated key for any element, it will have default numeric keys such as 0, 1, 2... etc.
So, array('bla', 'foo', 'baz' => 2) is exactly array(0=>'bla', 1=>'foo', 'baz' => 2).
So, if you want to single out elements having associated key, you can try like,
 $arr = array('bla', 'foo', 'baz' => 2);

foreach ($arr as $arrKey => $arrValue) {
    if(!is_numeric($arrKey))
    {
        //do your code here
    }
    else
    {
        //additional code
    }
}

A: if key is not mentioned, php will assign default key for value.
eg : $arr = array('bla', 'foo', 'baz' => 2); will be
     $arr = array(0=>'bla', 1=>'foo', 'baz' => 2);

if you want to separate, then you can check whether key is numeric or not.
Othercase - check both numeric and index.
$arr = array('bla', 'foo', 'baz' => 2,'test');

$cnt = 0;
foreach ($arr as $arrKey => $arrValue) {

    if(is_numeric($arrKey) && $cnt == $arrKey) {
        echo $arrValue . PHP_EOL;
        $cnt = $cnt + 1;
    } else {
        echo $arrKey . ':' .$arrValue . PHP_EOL;
    }

}

Edited : Array integer value index is already present, then just assign the cnt value so it will autoincrement from there..
if(is_numeric($arrKey)) {

    if($cnt == $arrKey) {
      echo $arrValue . PHP_EOL;
      $cnt = $cnt + 1;
   } else {
     echo $arrKey . ':' .$arrValue . PHP_EOL;
     $cnt = $arrKey;
   }
} else {

  echo $arrKey . ':' .$arrValue . PHP_EOL;
}


text:
Q: Why am I getting an Error when starting terminal in mac I get an eclipse error whenever I start my terminal in mac.
I get also an alert window saying:
The Eclipse executable launcher was unable to locate its companion launcher.jar
in the terminal window the following error:
/Applications/IBM\ Notes.app/Contents/MacOS/rcp/eclipse/plugins/com.ibm.rcp.base_10.0.0.20181128-1343/macosx/x86/eclipse ; exit;
ttt:~ husseinsalem$ /Applications/IBM\ Notes.app/Contents/MacOS/rcp/eclipse/plugins/com.ibm.rcp.base_10.0.0.20181128-1343/macosx/x86/eclipse ; exit;
Unable to find any JVMs matching architecture "x86_64".
No Java runtime present, try --request to install.
I did not update the system recently.
i did not upgrade my Notes.

A: I have the exact same situation and google leads me to this unanswered thread. Plenty of steps I've made and here I can just provide two cents instead of confident resolution.
The real question would be: Why is Eclipse executed when we purely click on the regular mac native "Terminal" app?
To make long story short, my conclusion is, maybe my Terminal shortcut in the Dock is hijacked somewhere somehow. I always have a habit to keep Terminal in Dock, instead of pressing F4 key and launching it from the "Other" folder in Launchpad. Eventually I removed the old Terminal icon from the Dock, execute a native one from Launchpad and pin this new icon from "Keep in Dock." Then my problem is gone. Reboot a couple of time and the one in Dock doesn't jump out Eclipse error any more.

Ideas of troubleshoot
My symptom was, Eclipse run and came out the error only for one time after a reboot. The error never happened again unless I reboot the mac.
What I did recently was

*

*Upgraded IBM Notes from version 9 to 10. (Thanks to my laggy IT.)

*Updated my Java through Java Control Panel inside System Preferences.

My immediate thought was "Does any environment get changed from the bash configuration profiles?" MacOS has a complicated initial steps. And I walked through all of the bash_profile and bashrc files for system-wide and user space. Can't find any trace of Eclipse. Then I tried to switch the execution between Dock and Launchpad. Replacing the shortcut in the Dock seems to fix my problem.
Yes. This still doesn't make sense why Eclipse error only pop up once if I always run the Terminal through the Dock. But I can't replicate this issue no longer. Here I just share some experiences since IBM sold Notes to the other company, their Q&A web pages get more and more broken and Google tends to show results of recent timeline but not helpful if the issue is tangled, unpopular or ancient.
Reference:

*

*https://scriptingosx.com/2017/04/about-bash_profile-and-bashrc-on-macos/

*The Eclipse executable launcher was unable to locate its companion launcher jar windows

*https://support.apple.com/en-us/HT208050


text:
Q: Am I counting wrong? Why does the space of Skew-Hermitian have $n^2- 1$ elements? Let $A = \{ B : B = -B^* \}$ be the set of skew-hermitiain matrices with square $n \times n$ $B$ matrices. This is also the Lie Algebra of $SU(n)$.
So this is how I am counting.
Since it is skew-hermitian $b_{ij} = -b_{ij}^* = -\overline{b_{ji}}$. This means one triangle is completely determined and so the diagonal.
So $n^2 - n$ denotes the dimension of the matrix subtracting the diagonal of $n$ leaving us with 2 triangles. But since one side has been determined, we divide by $2$. Shouldn't the Lie Algebra and Lie Group have the same dimension?

A: You're looking for a dimension over $\mathbb R$, not $\mathbb C$.  For each $b_{ij}$ above the diagonal you have two real dimensions, e.g. the real and imaginary parts.


text:
Q: Add Events to Controls Nested in a Repeater ASP-C# I'm currently working with a repeater which has some number of drop down lists in it determined by how many items are databound to it. I wanted to add an event to each of these drop down lists in the scenario that a user changes the selected index.
Here is what I have for the repeater (Note that I am doing all of the databinding in the codebhind.):

        <ItemTemplate>

                    <asp:DropDownList ID="DropDownList1" runat="server" Text='<%# Eval("Data") %>' AutoPostBack="True" OnTextChanged="TextChanged">
                        <asp:ListItem>Hello World</asp:ListItem>
                        <asp:ListItem>GoodBye Cruel World</asp:ListItem>
                    </asp:DropDownList>

        </ItemTemplate>

        <FooterTemplate>

        </FooterTemplate>
    </asp:Repeater>

I am setting the OnTextChanged event here, however I did some experimenting with using the different events. I found that my method will not run when I am using the OnTextChanged or OnSelectedIndexChanged events. However, if I use some other events like OnLoad or OnPreRender, the method I have it set to actually runs.
So in short, why is it that when I put this drop down list in the repeater only SOME of the events seem to work?

A: This is likely happening because you're rebinding the repeater in Page_Load. If you bind the repeater in CreateChildControls or OnPreRender, the OnTextChanged or OnSelectedIndexChanged events (both of which rely on ViewState) will fire correctly; otherwise, the control is rebound too early and no event is fired because no change is detected.
The other events are firing because they don't rely on ViewState.
Hope this helps.


text:
Q: Explicitly disallow heap allocation in C++ I have a number of classes that I would like to explicitly disallow heap allocation for. It occurred to me this weekend that I could just declare operator new private (and unimplemented)... Sure enough, this results in compile errors when you attempt to new the class... My question is: Is there more to this? Am I missing something or is this a good way of doing what I want?
#include <stdio.h>

class NotOnTheHeap
{
public:
  NotOnTheHeap() : foo( 0 )
  {
  }

private:
  void *operator new( size_t );
  void operator delete( void* );
  void *operator new[]( size_t );
  void operator delete[]( void* );

  int foo;
};

class Heapable
{
private:
  NotOnTheHeap noth;
};

int main( int argc, char* argv[] )
{
  NotOnTheHeap noth;

  Heapable* heapable = new Heapable;

  return 0;
}

A: Depends on what you mean with "explicitly disallow heap allocation".
If you just want to prevent direct allocation on the heap, i.e.:
NotOnTheHeap *n = new NotOnTheHeap();

it is good enough. But it will not prevent that your object exists on the heap in general.
For example, it won't prevent people from using std::vector <NotOnTheHeap>, which will allocate objects from your class on the heap.
It will also not prevent people from using a NotOnTheHeap as member variable in another class, that is allocated on the heap.

A: That will mostly achieve what you're trying.
What your solution does not cover is in-place new, which may or may not be on the heap.

A: You could disable the copy or even default construction, and operator= etc for a more strict scenario (some cases of embedding values or container use).
However, that will move you out of some useful constructs and force you to introduce your own semantics (something more visible in VM impls; lack/induction of similar operator and ambiguous equivalence/equality mechanisms). You will likely see a few compiler warnings too, it won't go all the way, but if its of any consolation it can have a use or two.

A: Can't you just make the implementation of operator new an assert(0)?


text:
Q: Authorization and authentication in MVC application Authorization and authentication in MVC application
I have an internal web app developed in C# using MVC 2. I want to use AD roles/groups to do authorization. Thus I have 3 access group Admin, Basic, Readonly. The access to the application will be controlled through these groups.
Now when I hit an action/page of my MVC app, the requirements are:
1) Check level of access (is in either group Admin, Basic or Readonly)
2) If in a group - serve the page.
If not - serve the 401 Unauthorized page.
I am probably confusing myself with the concepts authorization/authentication, but this is how it is set up so far (from answers, google and my own efforts flowing from this question:
public static class AuthorizationModule
    {
        public static bool Authorize(HttpContext httpContext, string roles)
        {
            ...
            //Check Configuration.AppSettings for the roles to check

            //using httpContext.User check .IsInRole for each role and return true if they are

            ...

            //other wise throw new HttpException(401,.....)
        }

        ...
    }

    public class AuthorizeByConfigurationAttribute : AuthorizeAttribute
    {
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            //Essentially at the moment this is pretty much the same as AuthorizationModule.Authorize(HttpContext httpContext, string roles)
        }

    }

    //This code from http://paulallen.com.jm/blog/aspnet-mvc-redirect-unauthorized-access-page-401-page
    public class RequiresAuthenticationAttribute : AuthorizeAttribute
    {
        protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
        {
            if (filterContext.HttpContext.User.Identity.IsAuthenticated)
            {
                filterContext.Result = new ViewResult {ViewName = "AccessDenied"};
            }
            else
            {
                base.HandleUnauthorizedRequest(filterContext);
            }
        }
    }

The problems with this are that I seem to need to decorate my action methods twice now, ala:
[AuthorizeByConfiguration(Roles = "Admin, Basic, Readonly")]
        [RequiresAuthentication(Roles = "Admin, Basic, Readonly")]
        public ActionResult Index(string msg)
        {
            ...
        }

And the next problem is that it seems I have three separate methods all trying to do the same thing. I am overriding methods based on advice and not entirely sure how they were meant to work originally. How could I go about implementing my requirements?
edit: Since this is an IntrAnet app, all users who sign on with their network accounts will be able to access this app.  I need to restrict the access so that only those who belong to certain Active Directory security groups can access this app

A: I have wrapped all the methods concerning auth with the interface IAuthorization.
Here is an example custom attrbiute you would need to add the Roles property and your own implementaion.
Attribute calls the filter itself for testability reasons.
public class SomeAuthorizeAttribute : AuthorizeAttribute
{
    public override void OnAuthorization(AuthorizationContext filterContext)
    {
        var filter = new SomeAuthorizeFilter(DependencyLookup.Resolve<IAuthorization>());
        filter.OnAuthorization(filterContext);
    }
}

public class SomeAuthorizeFilter : IAuthorizationFilter
{
    private readonly IAuthorization _authorization;

    public SomeAuthorizeFilter(IAuthorization authorization)
    {
        _authorization = authorization;
    }

    protected virtual ActionResult ResultWhenNotAuthenticated(AuthorizationContext filterContext)
    {
        //snip..

        //default
        RouteValueDictionary redirectTargetDictionary = new RouteValueDictionary
                                                            {
                                                                {"action", "Index"},
                                                                {"controller", "Home"}
                                                            };
        return new RedirectToRouteResult(redirectTargetDictionary);
    }

    #region IAuthorizationFilter Members

    public void OnAuthorization(AuthorizationContext filterContext)
    {
        if (!_authorization.GetCurrentUserIdentity().IsAuthenticated)
        {
            filterContext.Result = ResultWhenNotAuthenticated(filterContext);
        }
    }

    #endregion
}


text:
Q: Set Jenkins parameters from AWS Parameter Store I am trying to get environment variables from AWS Parameter Store for Jenkins CI/CD pipeline. I have assigned IAM role to this instance, so no credentials are required to be passed.
This is my parameter
{
    "Parameters": [
        {
            "Name": "Test",
            "Type": "String",
            "Value": "Hello World",
            "Version": 1,
            "LastModifiedDate": 1639400445.755,
            "ARN": "arn:aws:ssm:########:#########:parameter/Test",
            "DataType": "text"
        }
    ],
    "InvalidParameters": []
}

I have installed AWS Parameter Store Build Wrapper plug-in and using withAWSParameterStore method to capture the value.
This is how I am trying
val = withAWSParameterStore(namePrefixes: "Test", regionName: '#######'){}
echo val

Variable var returns null.
How do I capture the value "Hello World" here.

A: IAM role assigned to EC2 instance where Jenkins is running doesn't help. We still need to create a credential in Jenkins with IAM Access and Secret key.
In order to capture the data, you may follow something like the below:
withAWSParameterStore(credentialsId: 'myjenkins-id',
namePrefixes: 'Test',
regionName: '########') {
         echo "${env.Test}"
         echo "${env.TEST}"
         echo TEST} ```

A: Performed below list as part of integration of AWS parameter store with jenkins.
1)AWS Parameter store build wrapper plugin installed on jenkins running on aws ec2 instance
2)Attached IAM Role with SSM policy(parameter store comes under) to the jenkins aws ec2 instance
3)created secret credentials to communicate with aws account on the jenkins
4)created one of the parameter with values and trying to retrieve the value from jenkins via pipeline as well freestyle jenkins job
5)jenkins is unable to make api calls to aws account
Note: able to make a call via aws cli and retrieve the values
enter image description here
enter image description here


text:
Q: How to write two record to NFC tag, one Custom URI and one Text data? I wrote a small test application using the "NDEF Library for Proximity APIs / NFC" in codeplex.
I am writing 2 records into a tag: the first record is NdefUriRecord with custom scheme and the second is NdefTextRecord.
When tapping the NFC tag, my test application starts as exprected (based on the scheme defined in the first record).
However in order for my application to read the second record on the tag (after being started automatically), I have to move the tag away and re-tap, otherwise the application will not read the tag's second record.
Is this a normal behavior? How can I overcome this issue?
If anybody has another way to put 2 records on a tag, one custom URI record to start the application and the second a Text record to have some JSON data (as text) please let me know.
Thanks,
using System.Diagnostics;
using System.Windows;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Windows.Networking.Proximity;
using NdefLibrary.Ndef;
using System.Runtime.InteropServices.WindowsRuntime;
using Microsoft.Phone.Tasks;

namespace NfcShare
    {
    public partial class MainPage : PhoneApplicationPage
        {
        private ProximityDevice _device;
        long _subscribedMessageId;

        // Constructor
        public MainPage()
            {
            InitializeComponent();

            // -> Initialize proximity device
            _device = ProximityDevice.GetDefault();

            TxtStatus.Text = "Initialized";
            }

        private void LogStatusMessage( string newStatus )
            {
            // Update the status output UI element in the UI thread
            // (some of the callbacks are in a different thread that wouldn't be allowed
            // to modify the UI thread)
            Dispatcher.BeginInvoke( () =>
                                        {
                                            if ( TxtStatus != null ) TxtStatus.Text = newStatus;
                                        } );
            }

        private void MessageWrittenHandler( ProximityDevice sender, long messageId )
            {
            LogStatusMessage( "Message published!" );
            _device.StopPublishingMessage( messageId );
            }

        // -----------------------------------------------------------------------------------
        // Custom URI Scheme

        // -> Override OnNavigatedTo() and check QueryString
        protected override void OnNavigatedTo( NavigationEventArgs e )
            {
            base.OnNavigatedTo( e );

            if ( NavigationContext.QueryString.ContainsKey( "ms_nfp_launchargs" ) )
                {
                LogStatusMessage( "Launched Args: " + NavigationContext.QueryString[ "ms_nfp_launchargs" ] );
                }
            }

        // -----------------------------------------------------------------------------------
        // Write tags
        private void BtnWriteTag_Click( object sender, RoutedEventArgs e )
            {
            NdefUriRecord rec1 = new NdefUriRecord
                                    {
                                        Uri = "nfcshare:Hello+World"
                                    };

            NdefTextRecord rec2 = new NdefTextRecord();
            rec2.Text = "Record 2";

            NdefMessage msg = new NdefMessage();

            msg.Add( rec1 );
            msg.Add( rec2 );

            _device.PublishBinaryMessage(
                "NDEF:WriteTag",
                msg.ToByteArray().AsBuffer(),
                MessageWrittenHandler );

            LogStatusMessage( "Publishing message ..." );
            }

        // -----------------------------------------------------------------------------------
        // Read tags
        private void BtnSubscribeTag_Click( object sender, RoutedEventArgs e )
            {
            _subscribedMessageId = _device.SubscribeForMessage( "NDEF", MessageReceivedHandler );
            LogStatusMessage( "Subscribed for tag ..." );
            }

        private void MessageReceivedHandler( ProximityDevice sender, ProximityMessage message )
            {
            var rawMsg = message.Data.ToArray();
            var ndefMessage = NdefMessage.FromByteArray( rawMsg );

            // Loop over all records contained in the NDEF message
            foreach ( NdefRecord record in ndefMessage )
                {
                if ( NdefUriRecord.IsRecordType( record ) )
                    {
                    // Convert and extract URI info
                    var uriRecord = new NdefUriRecord( record );
                    LogStatusMessage( "Read tag, URI: " + uriRecord.Uri );
                    }
                else if ( NdefTextRecord.IsRecordType( record ) )
                    {
                    // Convert and extract URI info
                    var textRecord = new NdefTextRecord( record );
                    LogStatusMessage( "Read tag, Text: " + textRecord.Text );
                    }
                }
            // Only read one tag
            _device.StopSubscribingForMessage( _subscribedMessageId );
            }
        }
    }

A: I got an answer from the developer of the library through CodePlex.com. I copy his response here:
"Hi,
 this is normal behaviour of the Windows Phone operating system. If you register to be launched via a custom URI protocol, the OS only sends the app the URI string.
 The only possibility to read the whole tag including multiple records is to read the tag while the app is running.
 As this is a limitation of the OS, there is unfortunately nothing that this library can do about it, and there is currently no way to overcome the limitation.
 Br,
 Andreas Jakl"
If somebody else knows another way to implement and solve the problem I presented, please do.
Thanks


text:
Q: React window resize doesn't work on mobile The code only runs when i actively resize the window, and not when I load the page say on a smartphone for example.
handleResize() {
        if(window.innerWidth <= 650 && this.state.skipLenght !== 2){
            this.setState({portLength: 2})
        }
        else if (window.innerWidth <= 950 && window.innerWidth >= 650 && this.state.portLength !== 4){
            this.setState({portLength: 4})
        }else if (window.innerWidth <= 1250 && window.innerWidth >= 950 && this.state.portLength !== 6){
            this.setState({portLength: 6})
        } else if (window.innerWidth >= 1250 && this.state.portLength !== 8){
            this.setState({portLength: 8})
        }
    }

 componentDidMount() {
     window.addEventListener("resize", this.handleResize);
 }

 componentWillUnmount() {
     window.removeEventListener("resize", this.handleResize);
 }


text:
Q: Derive a General formula for each term of this periodic sequence? I have a sequence $a_0 = 1, a_1, a_2, a_3, \dots$ such that $a_4 = a_{24}$ which implies that period repeats after $a_{24}$ to $a_{43}$. Each $a_n$ depends on $a_{n-1}$ only. I need general term for this sequence for any value of $t$ whether $t < 4,\ t > 4,\ t$ can be as large as $10^{25}$.
There is another sequence such that $b_n = b_{n-1} + a_n$, how do I find the general term for this sequence $b$? Please note I am calculating all $a_n$ till the the cycle is found. I am very confused by this question? Currently I am getting answers close to the final answer but not exact ones? Please help.
PS: This is not a homeowork problem, its a algorithmic problem on spoj.

A: You have sequences $(a_n)$ and $(b_n)$ which satisfy recurrence relations
$$a_{n}=f(a_{n-1})$$
with some function $f$ and
$$b_n=b_{n-1}+a_n.$$
Moreover you found an index $k=4$ and a positive step size $d=20$ with $a_{k+d}=a_k$.
It follows by induction that $a_{n+d}=a_n$ holds for all $n\ge k$.
Therefore it is sufficient to calculate the values $a_1, a_2, \ldots, a_{k+d-1}$, the values $b_1,b_2, \ldots b_{k+d-1}$ and the "period sum" $$s=a_k+a_{k+1}+\cdots + a_{k+d-1}.$$ Then for $n\ge k+d$ we can write $n-k=q\cdot d+r$ with $q\in\mathbb N_0$ and $0\le r<d$ by division with remainder. With these $q,r$ we have
$$a_n = a_{k+r},$$
$$b_n = b_{k+r}+q\cdot s.$$
The proof is easily done by induction.
(Of course, for $n<k+d$, you simply lookup in your precomputed table of values).


text:
Q: What is the origin of the term 'inverse probability'? Inverse probability relates strongly, or is synonymous to, Bayesian probability.
Thomas Bayes applied the idea in 'An Essay towards solving a Problem in the Doctrine of Chances' (published in 1763).
Who was the first to use the term 'inverse probability' and why did they call it 'inverse probability' instead of 'reverse probability'?

A: Reading verbatim from Dale's History of Inverse Probability he mentions that the first occurrence of the term in English is due to Augustus de Morgan in the 1830's as for instance in his 1834 Encyclopædia Metropolitana but he considers that the first "inverse" perspective was to be in Abraham de Moivre's 1756 edition of his Doctrine of Chances, which contains as an Appendix his 1733 Approximatio ad summam terminorum binomii $\overline{a+b}^n$ in seriem expansi and uses the term conversely

...upon the Supposition of a certain determinate Law according to
which any Event is to happen, we demonstrate that the Ratio of
Happenings will continuously approach to that Law, as the Experiments
or Observations are multiplied: so, conversely, if from numberless
Observations we find the Ratio of the Events to converge to a certain quantity...[1756, p.251]

David Hartley in his 1749 Observations on Man, His Frame, His Duty and His Expectations called the above resolution by Mr. de Moivre, a "Solution of the inverse Problem" [p.338-339], mentioning in the same paragraph recovering the probability of " unknown Causes by a sufficient Observation of their Effects"
Dale also points out the use of a priori and a posteriori [in a Bayesian sense] by Jakob Bernoulli much earlier in Ars Conjectandi (posthumously published in 1713).
Richard Price in his 1763 introduction to Bayes' Essay also mentions the "converse problem".


text:
Q: Tslint on latest Ionic I am trying to lint my ionic project and abort the commit if lint fails. Running npm run lint in the console shows the error. I have installed precommit and lately husky ("husky": "^0.15.0-rc.6") with the below code inside package.json
"husky": {
    "hooks": {
      "pre-commit": "npm run lint"
    }
}

I have read a number of tutorials and the closest I got is linting but still commits if there are errors. Have also reverted the git hooks. How can I share the modified hooks with a team and run lint on every commit?
At the moment git does commit event though npm run lint returns errors. I have remote the precommit hooks so the husky installation can successfully set up new ones.

A: Check out the comments in this GitHub issue. Adding --bailOnLintError true to lint script did the trick.


text:
Q: How does the compiler choose between/rank multiply defined labels? I'm in the process of importing independent papers into a thesis document. Since I'm not as forward-looking as I wish I were, I have used some of the same labels in the papers (for introduction section, conclusions section, probably some equations too).
Now, when compiling the whole thesis, how does the compiler choose between which, say, \ref{sec:intro}, to refer to? Is it the closest \label{sec:intro} it will refer to? Or will it rank labels within the same chapter over same labels in other chapters?

A: The \label command uses \newlabel in the background which does a check (well, actually \@newl@bel does this) about the labels (issues a warning if the label is already known) and generates the label anyway, using the last 'entity' that has provided the label name. (See the \label and \newlabel commands in latex.ltx.
The crucial point here is the \global\@namedef usage here:
\def\@newl@bel#1#2#3{{%
  \@ifundefined{#1@#2}%
    \relax
    {\gdef \@multiplelabels {%
       \@latex@warning@no@line{There were multiply-defined labels}}%
     \@latex@warning@no@line{Label `#2' multiply defined}}%
  \global\@namedef{#1@#2}{#3}}}

i.e. the label name is 'overwritten' again if the label already exists and only the last value is stored.
This means that preceding values are overwritten and always the last value us used.
In the following example, the value of 2 is printed, since the 2nd chapter label overrules the first one.
\documentclass{book}

\begin{document}

In \ref{firstchapter} we will see that

\chapter{Chapter First}\label{firstchapter}

\chapter{Second Chapter} \label{firstchapter}

\end{document}

Here's the corresponding .aux file:
\relax
\@writefile{toc}{\contentsline {chapter}{\numberline {1}Chapter First}{3}}
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
\newlabel{firstchapter}{{1}{3}}
\@writefile{toc}{\contentsline {chapter}{\numberline {2}Second Chapter}{5}}
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
\newlabel{firstchapter}{{2}{5}}

Some edit -- The reference to the conclusion label will print 3.1 since this has been made for the section 3.1 (in this example)
\documentclass{book}

\begin{document}

In \ref{firstchapter} we will see that -- use the \ref{conclusion} for this!

\chapter{Chapter First}\label{firstchapter}

\section{Conclusion} \label{conclusion}
\chapter{Second Chapter} \label{firstchapter}

\section{Other conclusion} \label{conclusion}

\chapter{Last chapter}

\section{Conclusion that's not wanted} \label{conclusion}

\end{document}


text:
Q: Non-finitely generated groups with $|\text{Aut}(G)| = p$ It is a fun exercise to prove that if $G$ is finitely generated, and $|\text{Aut}(G)| = p$ for some prime $p$, then $G$ is one of $\Bbb Z_3, \Bbb Z_6, \Bbb Z$, or $\Bbb Z \times \Bbb Z_2$. The finitely generated is essential (at least, in my proof), since the very end reduces to doing casework with the structure theorem on finitely generated abelian groups. But what about the more general case?

Are there any non-finitely generated groups $G$ with $|\text{Aut}(G)| = p$?

Some immediate comments: $G$ must still be abelian (because $\text{Inn}(G)$ is cyclic iff trivial); $p$ must be 2 (because being abelian means implies $a \mapsto a^{-1}$ is an automorphism, and this map is an involution, so $2\mid p$); and $G$ must be either indecomposable or an indecomposable times $\Bbb Z_2$ (because if $G = A \times B$, then $\text{Aut}(G) \times \text{Aut}(G)$ is a subgroup of $\text{Aut}(G)$; and the only groups with trivial automorphism group are the trivial group and $\Bbb Z_2$; and you can only stick one copy of $\Bbb Z_2$ in there, since otherwise there's an extra automorphism given by swapping two copies of $\Bbb Z_2$). But that's all I know.

A: The group of rational numbers with square-free denominator has automorphism group of order $2$. (EDIT: As noted in the comments, there there aren't examples for odd $p$.)


text:
Q: Is there a way we can reset the macro variable value to null in SAS I am creating this macro variable LOG_LIST and feeding it with a list of values and using it later for my logistic regression. The code is below.
    proc sql;
    select name into :LOG_LIST separated by ' '
    from WORK.logcolumnslist;
    quit;

    proc logistic data=test_dataset;
    model logistic_var= age sex &LOG_LIST.;
    run;

There are few cases in which the dataset work.logcolumnslist would be empty, in which case I would like the LOG_LIST to take a value of null so that my logistic regression does not screw up. I tried %Let statements and even changing the value of the macro variable in sashelp.vmacro table but it did not work. Is there a way to reset the value to null?
Thanks!

A: Before the PROC SQL, assign a null value to it using %let.
%let log_list=;
proc sql;
    select name into :LOG_LIST separated by ' '
    from WORK.logcolumnslist;
    quit;
%put &=log_list.;


text:
Q: UITextView Data Selectors Without User Interaction Enabled I have a UITableView of custom cells that contain a UITextView.
I want the UITextView to have data detectors (so that you can tap on URLs), however, I also want the user to be able to tap on the table view cell to select it. With the data dectors, I must have user interaction enabled, but to select the cell when tapping on the UITextView, I must have it disabled.
Is there any easy way to go about doing this? Thanks!

A: Add a UITableViewCellAccessory (checkmark, disclosure indicator or others) to your cells. Then use the method tableView: accessoryButtonTappedForRowWithIndexPath: in order to detect click on the accessory.