text:
Q: Split array by specific requirements I am learning to use underscore js. I grouped the array. But now i need split array.
I have a grouped JSON array. For example;
var arr = [{"key": "A", "value": ["erdem", "metin", "tamer", "hüseyin"]}]
I want this to be the result.
var arr = [{"key" : "A", "value" : "erdem"},{"key" : "A", "value" : "metin"},{"key" : "A", "value" : "tamer"},{"key" : "A", "value" : "hüseyin"}]

I'm happy if you show me how to do it.

A: Vanilla JS, without Underscore / lodash :

var arr = [
  {"key": "A", "value": ["erdem", "metin", "tamer", "hüseyin"]},
  {"key": "B", "value": ["foo", "bar"]}
];

// create modified array of objects
var result = arr.map(item => item.value.map(v => ({ key:item.key, value:v })) );

// print result
console.log( [].concat(...result) );

A: @forguta you can use this method to get your required output.
var arr = [{"key": "A", "value": ["erdem", "metin", "tamer", "hüseyin"]}]
_.map(arr,function(item){
     var temp=[];
     _.map(item.value, function(x){
      temp.push({key: item.key, value: x});
    });
  return temp;
});

You can achieve the result without temp variable also (short form)
   _.map(arr,function(item){
      return _.map(item.value, function(x){
         return {key: item.key, value: x};
        });
    });

A: How about reduce the main array and then concat each resulting array with a initial empty array
arr.reduce((i, o)=>i.concat(o.value.map(v=>({key: o.key, value: v}))), []);

var arr = [
  {"key": "A", "value": ["erdem", "metin", "tamer", "hüseyin"]},
  {"key": "B", "value": ["foo", "bar"]}
];

var res = arr.reduce((i, o)=>i.concat(o.value.map(v=>({key: o.key, value: v}))), []);

console.log(res);


text:
Q: Mouse hovering makes text and icons in the top bar to disappear from the website I wrote the below code into additional CSS on my WordPress website and the background changed to blue with white font. So far it's good but when I hover upon the text and icons they vanish and reappear when the mouse does not hover.
/* TOP BAR COLOR */
.top-bar {
    background-color: #2874f0;
    color: #ffffff;
}
.widget ul li a {
    color: #ffffff;
}

.social-links li a {
    color: #ffffff;
}
.top-bar li a {
    color: #ffffff;
}

/* MAIN MENU FONT COLOR */
.main-navigation a {
color: #2874f0;
}

A: Try this
.top-bar,
.top-bar:hover {
    background-color: #2874f0;
    color: #ffffff;
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: The method '[]' can't be unconditionally invoked because the receiver can be 'null'. Error My make a droneapp.I develop app from flutter.But ı new learned to flutter.My purpose is use firebase realtime and flutter_map and see drone location.But i am not solved to this error.Please help me
Project Code;

import 'package:google_fonts/google_fonts.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:droneapps/crud.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:droneapps/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart' /* as latLng*/;

class MapWidgetW extends StatefulWidget {
  @override
  _MyMapState createState() => _MyMapState();
}

class _MyMapState extends State<MapWidgetW> {
  late LatLng _currentLocation;

  @override
  void initState() {
    super.initState();
    _getCurrentLocation();
  }

  void _getCurrentLocation() {
    final databaseReference = FirebaseDatabase.instance.ref("Location");
    databaseReference.child("Location").onValue.listen((DatabaseEvent event) {
      setState(() {
        _currentLocation =
            LatLng(event.snapshot.value["Lat"], event.snapshot.value["Lng"]);
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return FlutterMap(
      options: MapOptions(),
    );
  }
}

When I changed the values in firebase, I wanted to reflect it to the location in the application.

A: You can get better answers if you say which line you are getting the error, and paste the build method. The only think i know about your code is that the initState run only once when the page that contains the widget show up, if _getCurrentLocation() is not in build method your widget will never update. I would like to help more but i dont know firebase.

A: Probably because event.snapshot.value["Lat"] can be null and the LatLng class instances are not null.
You can fix this by adding
_currentLocation = LatLng(event.snapshot.value?["Lat"] ?? 0, event.snapshot.value["Lng"] ?? 0);
?? is a null-aware operator, the expression means that, if the value of event.snapshot.value?["Lat"] in the prefs instance is null then assign an default value (which is 0) to LatLng class.


text:
Q: Reload ListView by an OnClickListener in a SimpleCursorAdapter I have 2 buttons on every item of the list view. One for editing and another for deleting the item of the listView. Now the problem is to reload the list. How can I do this?
        Button delete = (Button) v.findViewById(R.id.NewOrder_delete_Btn);

        if(delete.getTag()!=null)delete.setTag(ItemForEditing);
        delete.setOnClickListener(new OnClickListener() {
                 @Override
                 public void onClick(View view) {
                        SQLAdapter myDB = new SQLAdapter(act);
                        myDB.open();
                        myDB.DeleteOneOrderItem(view.getTag().toString());
                myDB.close();
                 }
                });

A: After deleting record from DB, you need to call the following method to refresh it's contents:
yourListAdapter.notifyDataSetChanged();

you may call it right after myDB.close();


text:
Q: How to validate Date input format I have a constructor that takes a Date input in this format "Nov 15 2015" then i use below method to convert it to an SQL date format. When i read from the DB I convert it back to java.util.Date to be stored in the bean.
public static java.sql.Date inDate(String Date) {
    String startDateInput = Date;
    try {
        // Start Date
        String sDate = new SimpleDateFormat("yyyy-MM-dd")
            .format(new SimpleDateFormat("MMM dd yyyy").parse(startDateInput));
        java.sql.Date starDate = new java.sql.Date(new SimpleDateFormat("yyyy-MM-dd").parse(sDate).getTime());
        return starDate;
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return null;
}

My Question is how can i check if the date was entered in this format "Nov 15 2015" and if not throw an exception?

A: let me try to answer this.

*

*Do not use 'Date' as a name for a variable (it's reserved for java) and do not start variables with capital letters.

*you can us regular expression before you go ahead with your string. (check this to find your regex patterns: Regular Expression to match valid dates)


text:
Q: Problem calculating line integral I have $\gamma=[0,1]\to\mathbb{R}^3$ defined by $\gamma(t)=(\cos(2\pi t), \sin (2\pi t), t^2-t)\;\forall t\in[0,1]$  and I'm asked to calculate $\displaystyle\int_{\gamma}\displaystyle\frac{2xy\mathrm{dx}-(x^2+z^2)\mathrm{dy}+2yz\mathrm{dz}}{(x^2+z^2)^2}$.
I have made an attempt to solve it but it seems that it leads to an integral hard to calculate (and very messy).
I thought that it would be a good idea make the following change of variables: $$x=\cos(2\pi t)\\y=\sin(2\pi t)\\z=t^2-t$$.
Then I'd have
$$\mathrm{dx} = -2\pi\sin(2\pi t) \mathrm{dt} \\ \mathrm{dy =-2\pi\cos(2\pi t)\mathrm{dt}} \\ \mathrm{dz} = 2t-1\;\mathrm{dt}$$.
Now, making the substitution returns a long integral:
$2xy\mathrm{dx}-(x^2+z^2)\mathrm{dy}+2yz\mathrm{dz} = [2\cos(2\pi t)\sin(2\pi t)(-2\pi\sin(2\pi t))dt]-(\cos^2(2\pi t) +t^4-2t^3+t^2)+2[\sin(2\pi t)(t^2-t)(2t-1)\mathrm{dt}]=-4\pi\sin^2(2\pi t)\cos(2\pi t)-\cos^2(2\pi t) -t^4+2t^3-t^2+4t^3\sin(2\pi t)-6t^3\sin(2\pi t)+2t\sin(2\pi t)\;\mathrm{dt} = [\sin(2\pi t)][-4\pi\sin(2\pi t)\cos(2\pi t)+\sin(2\pi t)+4t^3-6t^3+2t]+t^2(-t^2+2t-1)-1.$
And
$(x^2+z^2)^2= (\cos^2 (2\pi t)+t^2-2t^3+t^2)^2$
Which means I should calculate...
$$\int_0^1 \frac{[\sin(2\pi t)][-4\pi\sin(2\pi t)\cos(2\pi t)+\sin(2\pi t)+4t^3-6t^3+2t]+t^2(-t^2+2t-1)-1}{(\cos^2 (2\pi t)+t^2-2t^3+t^2)^2}dt$$.
Is that right?. How badly did I messed up?

A: (Expanding NotNotLogical's answer)
You got the $dy$ with the wrong sign. Correcting this would maybe lead to a simplification. At any rate, the original author of the problem had the following in mind: Analyzing the force field
$${\bf F}(x,y,z):=\left({2xy\over (x^2+z^2)^2},{-1\over x^2+z^2},{2yz\over (x^2+z^2)^2}\right)$$
one finds that ${\rm curl}\>{\bf F}\equiv{\bf 0}$. It follows that ${\bf F}$ is locally a gradient field, and indeed: The function
$$f(x,y,z):={-y\over x^2+z^2}$$
is well defined on $\gamma$ (check this!) and possesses the gradient
$$\nabla f(x,y,z)={\bf F}(x,y,z)\ .$$
It follows that the integral $J$ in question can be written as
$$J=\int_\gamma \nabla f({\bf x})\cdot d{\bf x}=f\bigl({\rm endpoint}(\gamma)\bigr)-f\bigl({\rm initial\ point}(\gamma)\bigr)=0\ .$$

A: HINT: $$\frac{-y}{x^2+z^2}$$ If you take the gradient of that function, what do you get? And what do you know about conservative line integrals over closed paths? Note that $$\gamma(0)=\gamma(1)=(1,0,0)$$.


text:
Q: Bootstrap - How to generate this? I have been trying and trying to reproduce this, but don't seem to be getting the hang of it as I am new to bootstrap.
Here is the image I am trying to replicate:

I already have the Header - that wasn't too bad.  But getting the checkmark in a nicely sized box that isn't relative width, putting a border around it, and getting the other content in that row is maddening to me :(  I can't even seem to get the checkmark in there right much less the rest.
Even centering a glyphicon in a shaded box with a border (with no padding) seems hard to me right now.
My code is probably horrible, but here it is so far:

            Contract is verified accurate and hasn't changed since 2015-01-01.

            VERIFIED 2015-11-06

My CSS is mostly background color, border color, text sizing, text color. Nothing special there.
Hopefully someone can steer me right. I feel flustered and I know it can't be that difficult.

A: You just needed to rearrange some things, one problem was you already took up 12 columns so bootstrap was pushing everything to the next line. Just remember that the bootstrap framework works on a 12 column grid system.
Add a border, box-shadow, and line height 0 to get rid of extra whitespace on the bottom.
img{
  border: 1px solid #000;
  box-shadow: 0 0 5px #000;
  line-height: 0;
}

Here is a working demo

              Contract is verified accurate and hasn't changed since 2015-01-01.

            VERIFIED 2015-11-06

CODEPEN DEMO


text:
Q: Getting DIV tags to extend to bottom of page or content I have a setup for a left navigation bar on our website that.  The way it is displayed is to have a header image (usually the client's name) at the top of the nav, then to have a table that holds a number of options about what to do.  These options vary depending on what the client is.  When displaying this nav, there are two images that run down the sides of the primary table, used as borders.  These are skinnable images that are one by one pixel images.  This way, each client's skin can be a different color while referencing the same image name in the CSS file.
Before we added doc types to these pages, the images were extending to the bottom of the page or the bottom of the content inside of the table, whichever was longer.  Now, adding doc types to make the page standard, I cannot get it to do the same thing.
My setup is that I have one DIV as the header which simply holds the header image.  Then, I have a DIV as a container with three DIV elements as children.  The first and last ones hold the one pixel image as the left and right border and the middle div holds the content table.
I can't set the border image DIVs to 100% height, because the page size will be 100% + the size of the header image.  And I can't just rely on the image going to the bottom of the content, because it needs to be the entire length of the page if the content doesn't take up the entire page.  I'm at a loss of what to do here, short of using javascript to calculate what the size of the DIVs should be when I resize the page.
By the way, I'm trying to shoot for all browsers, so both IE (at least 9) and Chrome are m test cases.  Linking code here to show what my problem is.  As you can see, the left, content, and right divs extend past the bottom of the page, which I do not want to happen.
//HTML

// CSS

html, body {
    height: 100%;
}
.NavHeader {
    height: 40px;
    width: 100%;
    background-color: blue;
}
#NavBody {
    height: 100%;
}
#NavLeft {
    height: 100%;
    float: left;
    background-color: black;
    width: 1px;
}
#NavContent {
    height: 100%;
    float: left;
    background-color: green;
}
#NavRight {
    height: 100%;
    float: right;
    background-color: black;
    width: 1px;
}

A: I've run into a similar case in the past and all I was able to come up with was using javascript...
CSS (as far as I know) doesn't really have that dynamic capability that you are looking for.


text:
Q: How to change textbox to dropdown list in asp.net mvc? I have the following code in asp.net mvc where it is a textbox and I want to change it to a Dropdown list.
text box in asp.net mvc

        @Html.LabelFor(model => model.name, htmlAttributes: new { @class = "control-label col-md-2" })

            @Html.EditorFor(model => model.name, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.name, "", new { @class = "text-danger" })

TextBox

        @Html.LabelFor(model => model.name, htmlAttributes: new { @class = "control-label col-md-2" })

           <select asp-for="name" asp-items="@Model.name" class="form-control"> </select>
            @Html.ValidationMessageFor(model => model.name, "", new { @class = "text-danger" })

A: You must replace
@Html.EditorFor(...

for this

<select asp-for="SupervisorId" asp-items="@Model.Supervisors" class="form-control">
</select>
<input name="SupervisorId" type="hidden" />


text:
Q: Applying .htaccess rules (mod_deflate, mod_expires, mod_headers, mod_mime, mod_rewrite) I'm hoping someone can help point us in the right direction, our website is currently very slow due to no GZIP or compression, after using an extension we are present when trying to enable the extension with this error.
I'm running opencart 2.x

Applying .htaccess rules for compression/browser cache is not
  compatible with your server setup. Please make sure you have the
  following Apache modules enabled: mod_deflate, mod_expires,
  mod_headers, mod_mime, mod_rewrite.

I've searched high and low for answers and have not come across a fix for this error. I've also added lines of text to your .htaccess with no success, so I'm unsure if I've added the correct text.

I also know my host accepts these rules,

Steven


text:
Q: Automatically Generates files in react native android folder I make a React-Native Application project. But in my react-native project automatically generates the following files in the android directory.
1) android/.project
2) android/app/.project
3) android/.settings
4) android/app/.classpath
5) android/app/.settings
I removed many times but it generated continuously.
I do not understand the reason behind this.
Please guide me on how to stop generating these files.

A: These files are system generated which helps to run and build android apk you can't  stop generating these files.


text:
Q: Sudden error in ReadOGR() for a shapefile of UK postcode areas I have been using readOGR() to load in a shapefile of UK postcodes by region (Areas), downloaded from this website : https://www.opendoorlogistics.com/downloads/
uk_maps <- readOGR(".", "Areas")

Which loaded in the .dbf, .fix, .prj, .shp, .shx files without any problem and I was able to plot the blank map of the UK. (notably a 124-row file documenting the broad region postcodes).
Then when I reset my code, as usual, to try out new flows, I now get the following error:

Error in readOGR(".", "Areas") : no features found
De plus : Warning message:
In ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv,  :
ogrInfo: all features NULL

And I have no idea why I get this because I haven't changed the files in any way. I've just tried to redownload the shapefiles from the website link above, put them in a new working directory, set it, and the same error happens.
What's going on?
Best,
Cameron

A: OMG I think I solved the issue which was pretty stupid, don't know if this question should be deleted or left for Mac users.
Users of iCloud may know that iCloud sometimes randomly stores files in the Cloud to optimise storage, and when that's the case the file still appears in your directory but is actually not there (cloud sign next to the file).

In my case all of my .shp files where "clouded" (including District and Sectors) so I was mistakenly thinking there was an issue elsewhere
You have to really make sure none of your files are stored in the Cloud if you want R to read them properly.


text:
Q: Populate group data to a particular series on Highcharts Trying to group tow columns and and populate it as a particular series on highcharts. my code not grouping columns, And showing all data as a single series.
$query = $db->Prepare("SELECT class, SUM(marks), DATE(date_column) as
dates FROM classes GROUP BY class,DATE(date_column)");
$query->execute();
while ( $row = $query->fetch(PDO:: FETCH_ASSOC)) {
    $date = $row['dates'];
    $dates[] = $row['dates'];
    $class[] = $row['class'];
    $marks[] = $row['SUM(marks)'];

    $output[] = array($date,(int)$marks);

 }

echo json_encode(array('date'=>$dates,'marks'=>$marks, 'name' => $class));

JS
<script>
  $(document).ready(function () {
    $(function() {
    $.getJSON('data.php', function(data) {
        // Create the chart
       Highcharts.chart('container', {
          title: {
          text: 'class Marks'
          },

            xAxis: {
                categories: data.dates
            },

        series : [{
            "name" : data.name,
            "data": data.marks
        }],

      });
   });
 });
});
</script>

Table

Expected output in JSFiddle
data response
date: ["2019-02-07", "2019-02-09", "2019-02-12", "2019-02-08", "2019-02-12",
"2019-02-13", "2019-03-13",…]
marks: ["45", "166", "78", "64", "64", "627", "87", "352"]
name: ["claas 1", "claas 1", "claas 1", "class 2", "class 2", "class 2", "class 3", "class 3"]

A: By seeing your fiddle the expected output you want for HighCharts is as follow:
1: Category Data:

*

*It should be an array of dates.

*Make sure you remove duplicates and order them in ascending/descending order whichever you want, to see a continuous graph.

"categories":["2019-02-07", "2019-02-08", "2019-02-09", "2019-02-12", "2019-02-13", "2019-02-14"]

2: Series Data:

*

*It would be an array of object, where each object contains two properties name and data.

*Data should have n no of values if your categories array has n values and each corresponds to same index.

*As we don't have data for each date for each class, we would add 0 there.

So data would look like
"series":[
      {
         "name":"class 1",
         "data":[45,0,166,78,0,0]
      },
      {
         "name":"class 2",
         "data":[0,64,0,64,627,0]
      },
      {
         "name":"class 3",
         "data":[0,0,0,0,87,352]
      }
   ]

Final Fiddle which can be achieved by PHP using below code:
$arrDates = [];
$arrClass = [];
$arrData  = [];

while ( $row = $query->fetch(PDO:: FETCH_ASSOC)) {
  $arrDates[] = $row['dates'];
  $arrClass[] = $row['class'];
  $arrData[$row['class'] . ':' . $row['dates']] = $row['marks']; // to identify for which date & class this marks belong to, we can directly search for index.
}

$arrDates = array_unique($arrDates);
sort($arrDates);
$arrClass = array_unique($arrClass);

// Create series data
$arrSeriesData = [];
foreach($arrClass as $strClass){
  $tempArr = ['name' =>  $strClass];
  foreach($arrDates as $strDate){
      $tempArr['data'][] = isset($arrData[$strClass . ':' . $strDate]) ? intval($arrData[$strClass . ':' . $strDate]) : 0;
  }

  $arrSeriesData[] = $tempArr;
}

$response = ['categories' => $arrDates, 'series' => $arrSeriesData];

echo json_encode($response);

Output:
{"categories":["2019-02-07","2019-02-08","2019-02-09","2019-02-12","2019-02-13","2019-02-14"],"series":[{"name":"class 1","data":[45,0,166,78,0,0]},{"name":"class 2","data":[0,64,0,64,627,0]},{"name":"class 3","data":[0,0,0,0,87,352]}]}

Update your javascript code to reflect the above
$(document).ready(function() {
    $(function() {
        $.getJSON('data.php', function(data) {
            // Create the chart
            Highcharts.chart('container', {
                title: {
                    text: 'class Marks'
                },

                xAxis: {
                    categories: data.categories
                },
                series: data.series,

            });
        });
    });
});


text:
Q: nock: can we have two scopes for two different hosts in nock unit testing? I'm using nock with  I'd like to know if I can mock api calls from two different hosts defined with their scopes like :
const scopeOne = nock('https://myurl1.com/users', allowUnmocked)
.persist();
const scopeTwo = nock('https://myurl2.com/orders', allowUnmocked)

API CALLS :
scopeOne.post('/users')
.reply(200, (uri, params) =>
({
  users: {
    mtu: 1450
  }
}));

scopeTwo.post('/orders')
.reply(200, (uri, params) =>
({
  orders: {
    mtu: 1420
  }
}));

I was able to mock only one url which scopeOne which i defined earlier than scopeTwo. And I also tried seperating scopes in two different files which did not work. Can some one guide me where I was going wrong .


text:
Q: setting up emacs shells I do this kind of things very often (Every week) in Emacs when I restart it:

*

*open a shell connecting to a RSH server, execute some commands, rename the buffer

*repeat step1 for a few different remote machines

I was thinking: is there a way so that I can hard code these setups in the start-up scripts?

A: Here's a function that starts a shell, ssh-es to a host, and runs a command before dropping into an interactive shell:
(defun start-remote-shell (host command)
  (shell (format "*shell-%s*" host))
  (sleep-for 0 500)  ; Wait half a second for the prompt to appear
  (insert (format "ssh -t %s %s'; exec bash -i'"
                  (shell-quote-argument host)
                  (shell-quote-argument (shell-quote-argument command))))
  (comint-send-input))

You can put this snippet into your .emacs file, followed by the specific calls you want, such as:
(start-remote-shell "server-one" "apache start")
(start-remote-shell "server-two" "mysql start")
(start-remote-shell "server-three" "foo start")

A: I think that something like this can help you:
(mapc (lambda (server)
    (shell (concat "*shell-" server "*"))
    (insert "ls")
    (comint-send-input)
    (insert "ps ax")
    (comint-send-input))
  '("server1" "server2"))

As you can see, with insert write to the console, and with comint-send-input is like hit the return key in the terminal.
In this example a ls and a ps will be execute on two shell buffers


text:
Q: max value in set z3 I'm a new guy to work with the Z3.
Would like to know how I can calculate the maximum value of a set and two different sets.
For example:
[1, 6, 5] - The greater is 6
[1, 6, 5] e [10, 7, 2] - The greater is 6
I use the following code to set:
    (declare-sort Set 0)

(declare-fun contains (Set Int) bool)

( declare-const set Set )
( declare-const distinct_set Set )

( declare-const A Int )
( declare-const B Int )
( declare-const C Int )

( assert ( =  A 0 ) )
( assert ( =  B 1 ) )
( assert ( =  C 2 ) )

( assert ( distinct A C) )
( assert ( distinct set distinct_set ) )

(assert
 (forall ((x Int))
         (= (contains set x) (or (= x A) (= x C)))))

And now would like to know how can I calculate the largest value in the set (set) and the largest value in sets (set and distinct_set).
If it was for all integers was only because it was easy to do:
(define-fun max ((x Int) (y Int)) Int
  (ite (< x y) y x))

But I can not leave with sets by their integers, ie, get the values that have set.
Can you help me?
Thanks

A: Is the following encoding reasonable for your purposes? It is also available online here.
; We Enconde each set S of integers as a function S : Int -> Bool
(declare-fun S1 (Int) Bool)
; To assert that A and C are elements of S1, we just assert (S1 A) and (S1 C)
(declare-const A Int)
(declare-const C Int)
(assert (S1 A))
(assert (S1 C))
; To say that B is not an element of S1, we just assert (not (S1 B))
(declare-const B Int)
(assert (not (S1 B)))

; Now, let max_S1 be the max value in S1
(declare-const max_S1 Int)
; Then, we now that max_S1 is an element of S1, that is
(assert (S1 max_S1))
; All elements in S1 are smaller than or equal to max_S1
(assert (forall ((x Int)) (=> (S1 x) (not (>= x (+ max_S1 1))))))

; Now, let us define a set S2 and S3
(declare-fun S2 (Int) Bool)
(declare-fun S3 (Int) Bool)
; To assert that S3 is equal to the union of S1 and S2, we just assert
(assert (forall ((x Int)) (= (S3 x) (or (S1 x) (S2 x)))))

; To assert that S3 is not equal to S1 we assert
(assert (exists ((x Int)) (not (= (S3 x) (S1 x)))))

(check-sat)

; Now let max_S3 be the maximal value of S3
(declare-const max_S3 Int)
(assert (S3 max_S3))
(assert (forall ((x Int)) (=> (S3 x) (not (>= x (+ max_S3 1))))))

; the set of constraints is still satisfiable
(check-sat)

; Now, let us assert that max_S3 < max_S1.
; It should be unsat, since S3 is a super set of S1
(assert (< max_S3 max_S1))
(check-sat)


text:
Q: Does Swift whole module optimization cause any issues when debugging? Some time ago (a year?) we ran into problems with debug builds that had whole module optimization enabled. When tracing, the debugger would jump to unexpected addresses. Since then, we've been shy about enabling this on our debug builds. We do enable it for our release builds.
Is anyone aware of any existing --- even subtle --- issues with debugging an executable that has been optimized this way?
Or, conversely, has everything been working fine for you with this configuration?

A: From what I understand it should not cause issues as whole module optimisation mainly means that Swift knows what it can directly address ( a straight up _call ) compared to a VTable lookup as well as reduce the costly retain release cycles.
Similar to this, it is a good idea in general to use access control in swift right when you writing your code. privatizie everything unless you really need to access it outside. Use final on classes that don't need subclassing etc.
Usually when you enter the assembly view in Xcode is because of symbols missing for the debugger on libraries being called.
A small tip for debugging: I recently found a bug in my own code when implementing a TLS socket by simply looking up the address and the referenced method, downloading the source and looking up what was missing or causing the issue.
Now that said, in general it will greatly increase debug build times so do you have any reasons for running -whmo in debug?


text:
Q: Enable tab autocompletion for a parameter's value, while still accepting a different value I'd like to use a set of predefined values for a parameter, so that tab autocompletion will be possible, while I still could pass a different value to that parameter.
So far all the pages I've visited mention ValidateSet, DynamicParam, or casting a custom enum, but it doesn't address what I want. Let's say I have:
function test {
    Param(
        [ValidateSet("Paris", "London", "Madrid", "Berlin")]
        $city
    )
}

But what if I then wanted to run test -city Rome?
Is there a way to have both the convenience of tab completion (running through "Paris", "London", "Madrid", and "Berlin") and the flexibility of being allowed to pass another value?
Maybe catching the corresponding exception and in the catch block passing it to the parameter? If so, how could it be done?

A: You could define a custom ArgumentCompleter instead of ValidateSet:
function test
    { Param (
    [ArgumentCompleter( {@( "Paris","London","Madrid","Berlin" ) -like $args[2] + '*'})]
    $city)
}

You can combine that with ValidateScript as well, not sure about ValidateSet.


text:
Q: What is the most user friendly dateformat? What is - from a usability point of view - the best way to format dates?
Should I rather use absolute dates like:

*

*05.07.2011

*07/05/2011

or would it be better to print dates relative to the current time:

*

*one week ago

*last Monday

*yesterday

A: The relative dates are in my opinion the most user friendly for the following reasons:

*

*It doesn't depend on the users locale

*You dont have to think about how old the post is. In principle you have to calculate if its absolute

I like the phrases, but I think it'll only work for dates <= one week ago. You don't wont "1 month three weeks and 2 days ago"

Well, you dont have to be that precise. But of cause it depends what the purpose is. If its just comments on a blog the 2 days would not matter.

A: As with all questions relating to the "best" way to do something there are no absolutes.
It will depend on how the dates are being used.
The only way to test what's best for your users is to ask them. That's one of the reasons for usability testing.


text:
Q: Add reference using GUID I am trying to activate Visual Basic For Applications Extensibility Library(version 5.3) programmatically using GUID. My code encounters the error "Object library not registered" when trying to do this. I have enabled access to VBProjects.
Any help would be appreciated!
Sub ActivateReferenceLibrary()

    'Activate Visual Basic for Applications Extensibility Library (version 5.3)
      ActiveWorkbook.VBProject.References.AddFromGuid "{002E157-0000-0000-C000-000000000046}", 0, 0

End Sub

A: Try this
ActiveWorkbook.VBProject.References.AddFromGuid _
GUID:="{0002E157-0000-0000-C000-000000000046}", _
Major:=5, Minor:=3

You may want to see This


text:
Q: Intel XDK cordova file api 1.3.3 file not found Simply the issue im calling the file system as :
window.resolveLocalFileSystemURL(cordova.file.applicationDirectory+'/www/icons', function(dirEntry){example=dirEntry}, onError);

and im 100% sure the directory exists in my source folders before building application , but after building application i can see that www/index.html exists but no other folders are found , only when i check particular files like www/img/example.svg cause im sure this will be included as they appear in application preview , and are included in css files , the problem is that i get the following error :
Error occurred during request to file system pointer. Error code is: 1

After lot of searching it appears to be that it is not only who has this issue check this post
a temporary solution is to fall back to old API ver 0.2.5 which works well without this bug , but just in case anyone knows what is going wrong , please provide a clear answer .

A: It appears to be a bug in 1.3.3 being resolved , for further details check this , and this , just in case anyone is searching for a solution sounds that version 1.3.4 will solve this.


text:
Q: BinaryExpression to Lambda This may be familiar to some. I have a wrapper class Ex that wraps an expression tree with a bunch of implicit conversions and operators. Here is simplified version
public class Ex
{
    Expression expr;

    public Ex(Expression expr)
    {
        this.expr = expr;
    }
    public static implicit operator Expression(Ex rhs) { return rhs.expr; }
    public static implicit operator Ex(double value)
    { return new Ex(Expression.Constant(value, typeof(double))); }
    public static implicit operator Ex(string x)
    { return new Ex(Expression.Parameter(typeof(double), x)); }
    public static Ex operator +(Ex left, Ex right)
    {
        return new Ex(Expression.Add(left, right));
    }
    public static Ex operator -(Ex rhs)
    {
        return new Ex(Expression.Negate(rhs));
    }
    public static Ex operator -(Ex left, Ex right)
    {
        return new Ex(Expression.Subtract(left, right));
    }
    public static Ex operator *(Ex left, Ex right)
    {
        return new Ex(Expression.Multiply(left, right));
    }
    public static Ex operator /(Ex left, Ex right)
    {
        return new Ex(Expression.Divide(left, right));
    }
}

So here is what I want to do:
{ ...
    Ex x = "x";
    Ex y = 10.0;
    Ex z = x + y;

    LambdaExpression lambda = BuildLambda(z);
    Func<double,double> f = (Func<double,double>)lambda.Compile();

    // f(5) = 15

}

But how to I transverse the tree propely and build my lambda's (or delegates)
    LambdaExpression BuildLambda(Expression e)
    {
        ConstantExpression cex = e as ConstantExpression;
        if(cex != null)
        {
            return Expression.Lambda<Func<double>>( cex );
        }
        ParameterExpression pex = e as ParameterExpression;
        if (pex != null)
        {
            Func<Expression, Expression> f = (x) => x;
            Expression body = f(pex);
            return Expression.Lambda<Func<double, double>>( body , pex);
        }
        BinaryExpression bex = e as BinaryExpression;
        if (bex != null)
        {
            LambdaExpression left = GetLambda(bex.Left);
            LambdaExpression rght = GetLambda(bex.Right);
   // Now what?
        }
        return null;
    }

I have tried several things to get to convert the BinaryExpression bex into a lambda, and all have been unsucessful up to now. I'd like some suggestions and pointers. Note that the operands of the operation might be other expression objects and only at the leafs of the tree they will either be ParameterExpression or ConstantExpression.
Thanks.

A: You can create the Expression Tree as you call the conversion operators:
public class Ex
{
    private readonly Expression expr;

    public Ex(Expression expr)
    {
        this.expr= expr;
    }

    public Expression Expression
    {
        get { return this.expr; }
    }

    public static Ex operator +(Ex left, Ex right)
    {
        return new Ex(Expression.Add(left.expr, right.expr));
    }                                       ↑           ↑

    // etc.
}

At each step, you "unpack" the Expression from the Ex instance(s), apply the Expression.* method, and wrap the result in a new Ex instance.
At the end, all you have to do is extract the Expression from the final Ex instance:
Ex x = new Ex(Expression.Parameter(typeof(double), "x"));
Ex y = new Ex(Expression.Constant(10.0, typeof(double)));
Ex z = x + y;

Expression<Func<double, double>> result =
    Expression.Lambda<Func<double, double>>(z.Expression, x.Expression);

Note that the C# compiler provides the feature to create an Expression Tree for you:
Expression<Func<double, double>> result = x => x + 10.0;

creates exactly the same Expression Tree as the code above.

A: If your expressions all derive from a common class, look up the "Visitor" pattern in Gamma, et al.  This is even the example they use.


text:
Q: send array data from ionic 3 app to php page please help me with this issue, i'm trying to send data in array form from ionic 3 app and need to receive it in php code
my code:
   this.listArray = [
     {'title': 'testTitle'},
     {'body': 'testbody'},
     {'footer': 'testfooter'},
   ];

    var headers = new Headers();
    headers.append("Accept", "application/json");
    let options = new RequestOptions({ headers: headers });

    let body = new FormData();

        body.append("file", this.listArray);

        this.http
        .post("https://android.test.com/test.php",
         body,options)
        .map(res => res.json())
        .subscribe(data => {
          console.log(data['_body']);

          alert("success")

        }, error => {
          console.log(error);
          alert("error")
        });
   });

php:
 $arrayLength = count($_POST['file']);
    $message = $message."
 ".$arrayLength."
";

    $i = 0;
    while ($i < $arrayLength)
    {
           echo $_POST['file'][$i] ."
";            $i++;
    }

any suggestions are appreciated


text:
Q: Axios PUT Data with Params My backend API route is /api/updateUser/:id
How am I supposed to POST data into this API? I'm familiar with POST request for non params APIs but this one has an /:id in the route.
Can someone show me an example with this demo code
state = {
    username: "random123",
    password: "random123",
    userid: "qwertyuiop",
  };

saveDetails = async () => {
    const { username, password, userid } = this.state;
    let data = new FormData();
      data.append('username',username);
      data.append('password',password);
    axios
      .put(apiEndPoint+'?id='+this.state.userid, data) //this is where I need help
      .then(async (response) => {
        if (response.data) {
          console.log("success");
        } else {
          console.log("issue");
        }
      })
      .catch((err) => {
        console.log("error",err);
      });
  };

A: This is the working example for Path Parameter Axios PUT request -
saveDetails = async () => {
    const { username, password, userid } = this.state;
    axios
      .put(apiEndPoint+"updateUser/"+userid, {
        username:username,
        password:password,
      })
      .then(async (response) => {
        if (response.data) {
          console.log("done");

        } else {
          console.log("error");
        }
      })
      .catch((err) => {
        console.log("error",err);
      });
  };


text:
Q: add views to a horizontal linearlayout next and below eachother dynamically I have a recyclerview in which i have to show a header and description. The descrtiption consists of n number of items(TextViews) that are to be added dynamically next to each other as shown in image. However if items width is greater than screen width it should go to next line.
Currently I have a horizontal linear layout and I want to add new item(TextView) on new line if there isnt enough room for it.My implementation gives below image error. I want the output to be like image 2
How do I implement it? Are there better ways to do this.
Is there a way to check TextViews screen width without adding view to hirarchy?

A: 1) create a linearlayout in your xml layout like below :
<LinearLayout
                android:id="@+id/llKeyword"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="25dp"
                android:layout_marginRight="10dp"
                android:layout_marginStart="15dp"
                android:layout_marginTop="10dp"
                android:orientation="vertical">

            </LinearLayout>

2) now create one xml layout view_textview.xml :
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tvName"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:padding="8dp"
    android:text="sadfjkhsdf"
    android:singleLine="true"
    android:textColor="@android:color/black" />

3) now create methods like below :
void setKeywords(LinearLayout llKeyword, List<String> keywords) {

        llKeyword.setVisibility(View.VISIBLE);
        llKeyword.removeAllViews();
        List<String> keywordsList = keywords;

        int width = 0;
        LinearLayout parent = null;
        for (int i = 0; i < keywordsList.size(); i++) {

            if (width == 0) {
                parent = new LinearLayout(MainActivity.this);
                parent.setLayoutParams(new LinearLayout.LayoutParams(
                        LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
                parent.setOrientation(LinearLayout.HORIZONTAL);
                parent.setPadding(15, 0, 15, 0);
                measureView(parent);
            }

            LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                    new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                            ViewGroup.LayoutParams.WRAP_CONTENT));
            params.setMargins(0, 5, 15, 5);

            View someLayoutView = LayoutInflater.from(MainActivity.this).inflate(
                    R.layout.view_textview, null);
            final TextView tvKeyword = (TextView) someLayoutView.findViewById(R.id.tvName);
            tvKeyword.setText(keywordsList.get(i));
            //tvKeyword.setText(R.string.txt_period_location);
            tvKeyword.setBackgroundDrawable(getResources().getDrawable(R.drawable.btn_stroke_white));
            tvKeyword.setLayoutParams(params);

            measureView(tvKeyword);

            width += tvKeyword.getMeasuredWidth() + 5;

            Log.e("", "textview width " + tvKeyword.getMeasuredWidth()
                    + " width " + width);
            if (width < getWidth())
                parent.addView(tvKeyword);
            else {
                llKeyword.addView(parent);
                width = 0;
                parent = new LinearLayout(MainActivity.this);
                parent.setLayoutParams(new LinearLayout.LayoutParams(
                        LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
                parent.setOrientation(LinearLayout.HORIZONTAL);
                measureView(parent);

                width += tvKeyword.getMeasuredWidth();
                parent.addView(tvKeyword);
            }

            if (i == keywordsList.size() - 1)
                llKeyword.addView(parent);
        }

    }

    protected int getWidth() {
        WindowManager wm = (WindowManager) MainActivity.this.getSystemService(
                Context.WINDOW_SERVICE);
        Display display = wm.getDefaultDisplay();
        Log.e("", "Width " + display.getWidth());
        return display.getWidth() - 80;
    }

    protected void measureView(View view) {
        ViewGroup.LayoutParams params = view.getLayoutParams();
        int childWidth = ViewGroup.getChildMeasureSpec(0, view.getPaddingLeft()
                + view.getPaddingRight(), params.width);
        int childHeight = ViewGroup.getChildMeasureSpec(0,
                view.getPaddingBottom() + view.getPaddingTop(), params.height);
        view.measure(childWidth, childHeight);
    }

4) now use above method like below :
LinearLayout llKeyword = findViewById(R.id.llKeyword);//find linear layout

 setKeywords(llKeyword, keywords);// call this method

5) edit : for making background with colorful. make one drawable file btn_bgsolid_blue.xml add below drawable in background of view_textviews.xml file :
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#47bee6"></solid>
    <corners android:radius="15dp"></corners>
</shape>


text:
Q: Select the span in the table last row with id ends with Hi all I am having a table where my id is myTable what I am doing is would like to fetch the span element which is hidden, as I am using asp.net gridivew I am getting that control with some auto generate id as follows and when I try this I am getting  the value $("#myTable_ctl22_rowCount").text() what I am trying to do I would like to find that span dynamically I tried few like $("[id$='rowCount']") by finding the last row but no luck
$("#myTable tbody>tr>").last().find($("[id$='_rowCount']")).val() can some one help me

A: You were close to it, you need use text() instead of val() as span element don't have value but text, you can try below -
$("#myTable tbody tr:last").find("span[id$='_rowCount']").text();

$(function(){
  var value = $("#myTable tbody tr:last").find("span[id$='_rowCount']").text();
  console.log(value);
});

Id	Name

1	one

2	two


text:
Q: gfortran compiler flag for strict Fortran 77 compliance Is there any way to get gfortran to reject the Fortran 95 additions to Fortran 77?
I've tried using the -std=legacy flag but that only seems to remove deprecation warnings from f77 programs; the f95 enhancements still work fine.

A: I would have also tried it with a couple of gfortran compiler flags.
If you are flexible with additional libraries there is another Fortran 77 compiler besides f77.
It is called cf77 from Concurrent. It is a compiler including some real time libraries. Here you can find the Documentation
As I remember there is still a license fee. But this compiler supports pure f77 and still has the old libraries included.
Another option could be using the g77 compiler and eventually downgrading your available libraries. Here is a Manual for the g77 compiler.

A: You can set fixed format with
gfortran -ffixed-form -ffixed-line-length-none [sourcefiles]

And this can actually make a difference (I have a program here where this changes the output!).
I'm pretty sure that there are options, which disable at least most of the f95 features.


text:
Q: What does $K \Subset U$ mean? What does $K \Subset U$ mean? I think that $K$ is a compact set with, $K \subset \subset U$ (precompact), where $U$ is an open set. Am I right? Thank you.

A: I have seen $K\subset\subset G$ if $K$ is compact, $G$ is open and $K\subseteq G$.  I have seen it used in the context of locally compact topological spaces.


text:
Q: IF condition MySQL not working I am trying to execute a query into MySQL but it keeps telling me i am using the wrong syntax, I tried searching the MySQL community but I am not getting anything usefull.. most of the answers i find on google are for other databases yet they label them for "MySQL", yet it keeps failing.
This is the statement i am trying to execute:
        $statement = "IF (SELECT ttb_id FROM timetable WHERE ttb_week = $i AND ttb_time = $j) THEN
                        BEGIN
                          UPDATE types SET typ_name = '$subj'
                          WHERE typ_name = 'student';
                        END;
                      ELSE
                        BEGIN
                          INSERT INTO types VALUES (null,`Yo`);
                        END;
                    ";

error:
ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF (SELECT ttb_id FROM timetable WHERE ttb_week = 0 AND ttb_time = 0) THEN ' at line 1

I am using:

*

*PHP Script Language Version 5.2.6

*MySQL Database Version 5.0.51b

I have been looking around but to no avail, and the if condition stated on the MySQL dev website are not helping at all..
I am new to this and it is driving me mad! all the different queries i tried failed.. it is never the right syntax.
I found many answers for the problem on stackExchange and other websites but it is always wrong.. also I remember this structure from a VB.net lesson a while ago so maybe this is for MSSQL? then what about MySQL? everyone so far listed similar structure and said it works for MySQL, I took my answer from an answer on this community* labeled for MySQL and he claimed it worked. this is one of many i tried.
I would really appreciate your help
*: Usage of MySQL's "IF EXISTS"

A: My first thought would be you're not comparing your SELECT return to anything to actually utilize your conditional logic.  Are you just looking to see if your query returns values?  If it doesn't return a value then you insert a new record in otherwise you update.
Maybe use IS NOT NULL or a check to see count on the select to see how many rows and compare to see if that's greater than 0.
IF (SELECT ttb_id FROM timetable WHERE ttb_week = $i AND ttb_time = $j IS NOT NULL) THEN

IF (SELECT COUNT(*) FROM timetable WHERE ttb_week = $i AND ttb_time = $j) > 0 THEN


text:
Q: Passing anonymous function to a method, storing it and executing it? I need to pass a function to method, storing it on some variable visible inside the class, and lately executing it ( without parameters ).
In ActionScript 3 it would be :
private var lateCall : Function;
..

function getTheLateCall( o : Function ) : void
{
   lateCall = o;
}
...

function someFunction() : void
{
   lateCall();
}

*

*Is there something equal in Java ?

A: In Java you can't pass functions. What you can do though is create an interface with a method and make this interface a parameter of your function:
public interface MyInterface {
    void method();
}

public void myFunction(MyInterface itf) {
   // store itf reference
}

Now you can create anonmymous interface implementation and pass it when calling myFunction:
myFunction(new MyInterface() {
    void method() {
        // Your code here
    }
});

A: No
You can though have alternates, one could be via interface
interface IFunc {
   void someFunction();
}
class Func1 implements IFunc
{
   void someFunction(){..}
}
class Func2 implements IFunc
{
   void someFunction(){..}
}
void getTheLateCall(IFunc func)
{
   func.someFunction();
}

So caller would instantiate specific IFunc implementation and pass it to getTheLateCall. But this is just one way of doing it..


text:
Q: MvvmCross WPF - Multi-window application (MvxWindow) I have verified a lot of samples 'how to' create WPF apps using MvvmCross framework. But there is no showing how to create a multi-window application.
How can I create and show independent window with own ViewModel?
My project files looks like:
MainWindow.xaml => MainWindow.xaml.cs
public partial class MainWindow : MvxWindow
{
    public MainWindow()
    {
        InitializeComponent();
    }
}

LoginPageView.xaml => LoginPageView.xaml.cs
public partial class LoginPageView : MvxWpfView
{
    public LoginPageView()
    {
        InitializeComponent();
    }
}

MenuPageView.xaml => MenuPageView.xaml.cs
public partial class MenuPageView : MvxWindow // <-- I want use UserControl (MvxWpfView), and Window (MvxWindow)
{
    public MenuPageView()
    {
        InitializeComponent();
    }
}

When I use MvxWindow class for MenuPageView, there is exception such as below.
mvx: Diagnostic: 11,83 Showing ViewModel MenuPageViewModel
mvx: Error: 11,84 Error seen during navigation request to MenuPageViewModel - error InvalidOperationException: Window must be the root element of the tree. The Window element can not be added as a child element of Visual.
in System.Windows.Window.OnAncestorChanged ()
   in System.Windows.FrameworkElement.OnAncestorChangedInternal (TreeChangeInfo parentTreeState)
   in System.Windows.TreeWalkHelper.OnAncestorChanged (DependencyObject d, TreeChangeInfo info, Boolean visitedViaVisualTree)
   in System.Windows.DescendentsWalker`1.StartWalk (DependencyObject startNode, Boolean skipStartNode)
   in MS.Internal.PrePostDescendentsWalker`1.StartWalk (DependencyObject startNode, Boolean skipStartNode)
   in System.Windows.TreeWalkHelper.InvalidateOnTreeChange (FrameworkElement fe, FrameworkContentElement fce, DependencyObject parent, Boolean isAddOperation)
   in System.Windows.FrameworkElement.ChangeLogicalParent (DependencyObject newParent)
   in System.Windows.FrameworkElement.AddLogicalChild (Object child)
   in System.Windows.Controls.ContentControl.OnContentChanged (Object oldContent, Object newContent)
   in System.Windows.Window.OnContentChanged (Object oldContent, Object newContent)
   in System.Windows.Controls.ContentControl.OnContentChanged (DependencyObject d, DependencyPropertyChangedEventArgs e)
   in System.Windows.DependencyObject.OnPropertyChanged (DependencyPropertyChangedEventArgs e)
   in System.Windows.FrameworkElement.OnPropertyChanged (DependencyPropertyChangedEventArgs e)
   in System.Windows.DependencyObject.NotifyPropertyChange (DependencyPropertyChangedEventArgs args)
   in System.Windows.DependencyObject.UpdateEffectiveValue (EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry & newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   in System.Windows.DependencyObject.SetValueCommon (DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   in System.Windows.DependencyObject.SetValue (DependencyProperty dp, Object value)
   in MvvmCross.Wpf.Views.Presenters.MvxSimpleWpfViewPresenter.Present (FrameworkElement frameworkElement) in D: \ git \ MvvmCross \ MvvmCross \ Windows \ Wpf \ Views \ Presenters \ MvxSimpleWpfViewPresenter.cs: line 41
   in MvvmCross.Wpf.Views.Presenters.MvxBaseWpfViewPresenter.Show (MvxViewModelRequest request) in D: \ git \ MvvmCross \ MvvmCross \ Windows \ Wpf \ Views \ Presenters \ MvxBaseWpfViewPresenter.cs: line 27


text:
Q: Showing reflection in a plane containing origin is represented by symmetric orthogonal matrix I'm sure this question is pretty straightforward but I've been scratching my head at this for a small while

Assuming that any isometry $T: \mathbb{R}^3 \rightarrow \mathbb{R}^3$ may be written in the form $T({\bf{v}}) = P{\bf{v}} + {\bf{q}}$ where ${\bf{q}} \in \mathbb{R}^3$ and $P$ is a $3 \times 3$ orthogonal matrix show that a reflection in a plane containing the origin is represented by a symmetric orthogonal matrix.

I've been trying to use the fact that if we've got some ${\bf{v}} \in \mathbb{R}^3$ then we can write reflection as $T({\bf{v}}) = P{\bf{v}}$ (for some reason I feel like the constant vector isn't needed for reflection) - then since we're referring to reflection we must have
$TT({\bf{v}}) = T^2({\bf{v}}) = P^2{\bf{v}}= I{\bf{v}}$ (essentially saying reflection twice will give us the original vector)
We know that $P$ is orthogonal, so $P^TP = I$, then using $P^2 = I$ we get $P^TP = P^2 \implies P^T = P$ hence it is a symmetric orthogonal matrix.
Is this correct? Thanks for any help.

A: Looks ok to me. Vector $q$ equals $0$ because $T(0)=P(0)+q$ i.e. $0=0+q$.


text:
Q: Chrome Drop Folder - incomplete files i'm working on an uploader with drop folder support, it was ok, but i'm failing a use case.
I have a folder with multiple files and folders inside, the amount of files are 2511, and 2451 folders. I dont know the reason, but after the drop function it only recognize 1576 files with their parents folders.
Simplified this is the drop function i'm using:
        filescnt=0;
        nop=0;
        $("#dropingArea").on('dragover',function(e){
            e.preventDefault();
            e.stopPropagation();
        });
        $("#dropingArea").on('dragenter',function(e){
            e.preventDefault();
            e.stopPropagation();
        });
        $("#dropingArea").on('drop',function(e){
            console.log(e);
            if(e.originalEvent.dataTransfer){
                if(e.originalEvent.dataTransfer.files.length) {
                    e.preventDefault();
                    e.stopPropagation();
                    /*UPLOAD FILES HERE*/
                    console.log(e.originalEvent.dataTransfer.items);
                    items = e.originalEvent.dataTransfer.items;
                    for (var i=0; i<items.length; i++) {
                        var item = items[i].webkitGetAsEntry();
                        if (item) {
                            traverseFileTree(item);
                        }
                    }
                }
            }
        });

        function traverseFileTree(item, path) {
              path = path || "";
              if (item.isFile) {
                // Get file
                filescnt++;
                item.file(function(file) {
                  console.log("File:", path + file.name);
                });
              } else if (item.isDirectory) {
                // Get folder contents
                var dirReader = item.createReader();
                dirReader.readEntries(function(entries) {
                  for (var i=0; i<entries.length; i++) {
                    traverseFileTree(entries[i], path + item.name + "/");
                  }
                });
              }
        }

Now the problem seems to be also on dropzone and plupload.
i've tested the same folder on
http://protonet.github.io/plupload/examples/drag_and_drop.html
same ammount as result.
http://www.dropzonejs.com/
same ammount as result.
I appreciate any help
thanks.

A: From http://www.html5rocks.com/en/tutorials/file/filesystem/

To read the contents of a directory, create a DirectoryReader and call
  its readEntries() method. There is no guarantee that all of a
  directory's entries will be returned in a single call to
  readEntries(). That means you need to keep calling
  DirectoryReader.readEntries() until no more results are returned.

And again from the above page:
function onInitFs(fs) {

  var dirReader = fs.root.createReader();
  var entries = [];

  // Call the reader.readEntries() until no more results are returned.
  var readEntries = function() {
     dirReader.readEntries (function(results) {
      if (!results.length) {
        listResults(entries.sort());
      } else {
        entries = entries.concat(toArray(results));
        readEntries();
      }
    }, errorHandler);
  };

  readEntries(); // Start reading dirs.

}

Notice that in the case where we've read some results (results.length != 0), we invoke readEntries against the same dirReader to get the next "chunk" of files.


text:
Q: What's the influence of noises when electromagnetic waves are used as a power source I am relatively new to this field, and please understand if my question seems ridiculous.
As far as I know, the passive RFID tag is supposed to harvest energy from radio waves emitted from other devices. The radio waves are electromagnetic signals. The passive RFID tag has a coiled antenna that also serves as a filter, which selects signals of a certain range of frequencies (for example, from 13.46 to 13.66 MHz)
This is where my question rises. Even after filtering the signal received, the filtered signal may contain noises.
I am guessing that power source does not have to be as sensitive as data communication between two devices. However, even so, I wonder if having noises in a signal doesn't have any effect on its role as a power source.
Thank you.

A: RF noise doesn't affect power delivery - random noise can't cancel out the transmission power of the RF signal since the noise and the signal are uncorrelated. In fact, the power of the noise gets added to the power of the signal, although the noise power is very small compared to the signal and doesn't make a difference in reality. (There's many, many orders of magnitude between noise and signal. The hard part is getting enough power so the device can operate properly, not avoiding the noise.)
Also, most passively-powered RFID devices are coupled magnetically, effectively creating an air-core transformer between the RFID reader and card. It's very difficult to receive enough power via regular radio waves in order to power a microcontroller like in those cards.


text:
Q: Kendo UI: Incorrect tool tip show if grid cell contains " (quotes) Kendo grid breaks tool-tip if " is present in the cell data
e.g. Data = asdasd"asdasd
Tool-tip = asdasd
Any advice?

A: You have to use " instead of quote sign.
Here is demo - check Los Angeles on the left.
Check also this link to see other codes


text:
Q: How to do Parsing JSON string in Java with nested arrays Starting from the similar question,
Nested JSON Array in Java
I have a somewhat odd json as a response from a REST api(POST) call. I need to find out the id and name of the sub_items array in each items array element.
I tried like given below for which I am getting error like

org.json.JSONException: JSONObject["items.sub_items"] not found.

I also tried just 'sub_items' as the parameter also,  but no. I am using GSON. No choice use others.
final JSONObject jsonObj = new JSONObject(JSON_STRING);
final JSONArray subItems = jsonObj.getJSONArray("items.sub_items");
final int       n       = subItems.length();
for (int i = 0; i < n; ++i) {
    final JSONObject subI= subItems.getJSONObject(i);
    System.out.println("id="+subI.getString("id"));
    System.out.println("name="+subI.getString("name"));
}

The following is my json as a response from a REST api call.
{
  "menu": {
    "items": [{
            "id": 1,
            "code": "hot1_sub1_mnu",
            "name": "Mutton",
            "status": "1",
            "sub_items": [{
                "id": "01",
                "name": "Mutton Pepper Fry",
                "price": "100"
            }, {
                "id": "02",
                "name": "Mutton Curry",
                "price": "100"
            }]
        },
        {
            "id": "2",
            "code": "hot1_sub2_mnu",
            "name": "Sea Food",
            "status": "1",
            "sub_items": [{
                "id": "01",
                "name": "Fish Fry",
                "price": "150"
            }]
        },
        {
            "id": "3",
            "code": "hot1_sub3_mnu",
            "name": "Noodles",
            "status": "1",
            "sub_items": [{
                "id": "01",
                "name": "Chicken Noodles",
                "price": "70"
            }, {
                "id": "02",
                "name": "Egg Noodles",
                "price": "60"
            }]
        }
    ]
}}

A: As I said, my JSON is a response from an REST api call, and it is 7300 lines long, like shown below with the outline,  as shown in code beautifier.
object      {3}
    infoTransferReqResp     {1}
paramExtens :   null
    pageGroups      {1}
    pageGroups      [1]
    0       {4}
page_group_name :   LFG - LG - Insured Summary
page_group_id   :   8100
    **pages     [3]**
    repeatingBlocks     {1}

I needed to extract a string value 'questionText' from inside 'Pages' array. I used jsonPath() method with navigation path as given below which solved the problem.
JsonPath                 jsonPathEvaluator = response.jsonPath();
List<List<List<String>>> questions         = jsonPathEvaluator.getList("pageGroups.pageGroups.pages.questions.questionText");

It gave me 3 ArrayLists one embedded in another corresponding to 3 arrays of 'pages'


text:
Q: Iterator of associative container is not dependent on Comparator template argument The Compiler is not able to diffrentiate between iterators of two different type.
See the two types here.
typedef std::set<int, std::greater<int> >             PriceBookBuy;
typedef std::set<int, std::less<int> >                PriceBookSell;

typedef PriceBookBuy::iterator PriceBookBuyIter;
typedef PriceBookSell::iterator PriceBookSellIter;

I want to overload a template method based on the two iterator types.
class LVOrderBookBin
{
    int a;
    int b;
    public:

   template<typename PriceBookBuy>
   void erasePriceLevel(std::vector<PriceBookBuyIter> remover) throw()
   {
            b++;
            remover.begin();
        }
        template<typename PriceBookSell>
        void erasePriceLevel(std::vector<PriceBookSellIter> remover) throw()
        {
            a++;
            remover.begin();
        }
};

A typical usage:
int main()
{
    std::vector< PriceBookBuyIter> vecBuy(3);
    std::vector< PriceBookSellIter> vecSell(3);

    LVOrderBookBin lv;
    lv.erasePriceLevel<PriceBookBuy>(vecBuy);
    lv.erasePriceLevel<PriceBookSell>(vecBuy);
}

Same code used to work with Vs2008, but does not compile with VS2013. It does not compile with gcc also.
error: 'template void LVOrderBookBin::erasePriceLevel(std::vector, std::allocator > >)' cannot be overloaded
Is there a workaround?

A: The standard library implementations are well within their rights to do this, and it was nearly made mandatory. The effect you're seeing is known as SCARY iterators and it's a good thing.
You would have to wrap the iterator in a custom struct- effectively tag them with your own custom type to use OR in this way.

A: That is not the correct way to specialize templates; you are just declaring function overloads. You need to specialize like this:
class LVOrderBookBin
{
public:
    template<typename T>
    void erasePriceLevel(std::vector<typename T::iterator> remover) throw();
};

template<>
void LVOrderBookBin::erasePriceLevel<PriceBookBuy>
     (std::vector<PriceBookBuyIter> remover) throw()
{
    //...
}
template<>
void LVOrderBookBin::erasePriceLevel<PriceBookSell>
     (std::vector<PriceBookSellIter> remover) throw()
{
    //...
}


text:
Q: Making the text in an align environment italic How can I make all the text in an align environment italic? As you can see from the code below I have started by adding \textit to each row but then when I get to making the fraction italic I get an error. Is there a better way?
\begin{align*}
\textit{27 + 183}
& \textit{= 210}\\
\textit{27 + 2}
& \textit{= 29}\\
\frac{1}{2} \times 29
&= 14.5\\
14.5 × 14.5
& = 210.25\\
210.25 - 210
& = 0.25\\
(0.25)
 & = 0.5
\end{align*}

A: assuming you just want numbers not all symbols in italic I'd just use your editor to replace  ([0-9.]+) by  \\mathit{\1} resulting in

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{align*}
\mathit{27} + \mathit{183}
&= \mathit{210}\\
\mathit{27} + \mathit{2}
& = \mathit{29}\\
\frac{\mathit{1}}{\mathit{2}} \times \mathit{29}
&= \mathit{14.5}\\
\mathit{14.5} × \mathit{14.5}
& = \mathit{210.25}\\
\mathit{210.25} - \mathit{210}
& = \mathit{0.25}\\
(\mathit{0.25})
 & = \mathit{0.5}
\end{align*}
\end{document}


text:
Q: DataGrid with AutoCompleteBox crashes Silverlight when scrolling I have a Silverlight 4 application with a DataGrid. The rows of the datagrid contain two AutoCompleteBoxes.

Whenever the DataGrid shows a scrollbar and the user scrolls the grid, the entire Silverlight plug-in will freeze and crash. When I run it from the debugger, I usually get the following error right before the freeze/crash:

"Error: Unhandled Error in Silverlight Application Code: 4009
  Category: ManagedRuntimeError Message: Element is already the child of
  another element."

I have seen several suggestions on possibly related issues on the silverlight.net forums, like avoiding inline item templates, but I have not yet found a working solution.
What I'm looking for is any information related to this: causes, fixes, work-arounds, methods to further analyse the cause of the problem, anything that could help.

A: One workaround that I'm currently testing, and that seems to work in my scenario, is to put the DataGrid inside a ScrollViewer. This effectively makes the DataGrid as high as it needs to be and delegates the scrolling to the ScrollViewer, so any DataGrid-scrolling-related problems are hereby avoided.
The only drawback I have found yet (other than that it is a very ugly workaround): the header row of the DataGrid now scrolls out of view, of course, when scrolling down.


text:
Q: APP_INITIALIZER in library causes "Lambda not supported" error When defining an APP_INITIALIZER in a library module, the build fails with the Lambda not supported error. The build error is thrown when the function is exported as per docs:
import { NgModule, APP_INITIALIZER } from '@angular/core';
import { MylibComponent } from './mylib.component';

export function myLibInit() {
  return () => console.log('Hi from exported function');
}

@NgModule({
  providers: [
    {
      provide: APP_INITIALIZER,
      multi: true,
      useFactory: myLibInit
    }
  ]
})
export class MylibModule { }

The build error is thrown in both dev and prod.
I have alternatively also tried defining the factory function using ES6 object method shorthand notation:
import { NgModule, APP_INITIALIZER } from '@angular/core';
import { MylibComponent } from './mylib.component';

@NgModule({
  providers: [
    {
      provide: APP_INITIALIZER,
      multi: true,
      useFactory() {
        return () => console.log('Hi from ES6 object method shorthand')
      }
    }
  ]
})
export class MylibModule { }

This passes both the dev and prod build, but the app throws the ERROR TypeError: this.appInits[r] is not a function error at runtime when the library and app is built with the prod flag.
How does one correctly use the APP_INITIALIZER in a library and not get build or runtime errors?
A reproduction can be found here:

*

*git clone https://github.com/samherrmann/angular-sandbox.git

*cd angular-sandbox

*git checkout lambda-not-supported

*npm install

*npm run build
GitHub issue regarding this problem can be found here.

A: What I understand is that while compiling, the typescript compiler tries to resolve as much as it can.
So when you are doing it like this:
export function myLibInit() {
  return () => console.log('Hi from exported function');
}

It tries to resolve it to simply () => console.log('Hi from exported function'); because nothing else is being done in the function.
Now, let us make the function do a little more:
export function myLibInit() {
  var x = 2+2; //let us just do something to keep this original function
  return () => console.log('Hi from exported function');
}

This one compiles without error, because it is not returning the only and exactly lamda function.
Also the below one works as well because there is an extra assignment.
export function myLibInit() {
  var x = () => console.log('Hi from exported function');
  return x;
}

You can of course return a promise.
I did see your links to some tutorials and they are doing exactly what you have problem with and I think they are probably old or not done with the version of angular you are working. Because documentation clearly states that

"The compiler does not currently support function expressions or
  lambda functions. "

And they are doing somewhat similar to that. One reason could be that they actually never performed the build because it doesn't give you error on ng serve
I can see that they have closed your issue on github but I think they should review it because of my above explanation.

A: Try using this code sample above your function myLibInit(). See this for more info.
/**
 * @dynamic
 */


text:
Q: Will not return false, or display the alert for function combine() when true. Does someone see a mistake I don't? //  I apologize for giving the whole code, with omission of the urls, but my code will be returning false just fine, then the next time I try to add a new function, it will no longer return false, and upon removing the new function, it does not return to working again as it did before.  I have tried onsubmit=return and onclick=return both.
The other issue is for function combine() in my code.  It doesn't ever seem to work, and I have tried numerous different methods.  I have tried just alerting with "Test", and the alert doesn't even work.
UPDATED:  Now we have it returning false properly for invoices not matching, with alert.  It also gives alert for Emails not matching, however it does not return false for emails not matching, and continues to the url.  I am showing no errors in the console now.  It also does correctly combine and alert to show the invoice and name together.
UPDATE:  Now have it working completely.  See my final comment below to see how I fixed this last issue.  Hope this helps someone!
<!DOCTYPE html>

  <title>INFORMATION FORM</title>

<form name=theform action= "https://hos###/Index" method ="POST" target="_blank" onsubmit="return checkInvoice(this);"  >
<input type="hidden" name="HostedKey" id="HostedKey" value="####" />
<input type="hidden" name="Gateway_ID" id="Gateway_ID" value="#####" />
<input type="hidden" name="IndustryCode" id="IndustryCode" value="2" />

<input type="hidden" name="PaymentType" id="PaymentType" value="CC" />

INVOICE Number: <input type="text" name="invoice1" required id="invoice1" value="" size="40" maxlength="40" />

Please Confirm your INVOICE number: <input type="text" name="invoice2" required id="invoice2" value="" size="40" maxlength="40" />

Patient Full Name (as it appears on your paper bill): <input type="text" name="FName" id="FName" required value="" size="40" maxlength="40" />

PHONE (###-###-####): <input type="text" pattern="^\d{3}-\d{3}-\d{4}$" name="PhoneNumber" required id="PhoneNumber" value="" />

<input type="hidden" name="Amount" id="Amount" value="" />

<input type="hidden" name="RecurringType" id="RecurringType" value="N" />
<input type="hidden" name="RecurringAmount" id="RecurringAmount" value="" />

<input type="hidden" name="RURL" id="RURL" value="http://www.######.com/thankyou/"  />

<input type="hidden" name="CURL" id="CURL" value="http://www.########.com/cancelled/" />

<input type="hidden" name="AVSRequired" id="AVSRequired" value="Y"/>

<input type="hidden" name="CVV2Required" id="CVV2Required" value="Y"/>

<input type="hidden" name="EmailRequired" id="EmailRequired" value="Y"/>

<input type="hidden" name="PostRspMsg" id="PostRspMsg" value="N"/>

 Enter Your Email Address:

<input type="TEXT" name="EMAIL_1" value="" id=EMAIL_1 required size="40" maxlength="40">

Please Confirm Your Email Address:

<input type="TEXT" name="Email" required  value= "" size="40" maxlength="40" />

<input type="hidden" name="CustRefID"  id="CustRefID" value="" />

<input type="SUBMIT" name="Button" id="Button" value="Make Payment Now" >

</form>


text:
Q: AngularJS - ngFocus and ngBlur Error I tried adding a code for ngFocus and ngBlur but everytime i start it, it wont seem to function, heres my js code:
function focusCtrl($scope) {
    $scope.hasFocus = false;
}
angular.module('app', [])
    .directive('ngFocus', ['$parse', function ($parse) {
        return function (scope, element, attr) {
            var fn = $parse(attr['ngFocus']);
            element.on('focus', function (event) {
                scope.$apply(function () {
                    fn(scope, {$event: event});
                });
            });
        };
    }])
    .directive('ngBlur', ['$parse', function($parse) {
        return function(scope, element, attr) {
            var fn = $parse(attr['ngBlur']);
            element.on('blur', function(event) {
                scope.$apply(function() {
                    fn(scope, {$event:event});
                });
            });
        };
    }]);

I'll add my html as well:
<div class="col-lg-10">
<input ng-blur="hasFocus=false" ng-focus="hasFocus=true" type="text"  required="required" class="form-control form-validation" id="name" placeholder="Name" ng-model="artist.name" />
</div>

It gives me this error every time i reload the page, and i can't seem to understand the problem!
Uncaught TypeError: Object #<Object> has no method 'module' Focus.js:4
(anonymous function)

Thanks for the help!

A: Those directive come with angular (not sure which version they were introduced in
ngFocus
ngBlur
That being said, when you are creating directives, do not prefix them with ng. That prefix is reserved by angular.
"do not prefix your own directives with ng or they might conflict with directives included in a future version of Angular" reference
If you want the functionality of setting focus to a control via a field on your controller's scope take a look at this question.

A: The Brocco answer is ok,
if you want to make custom directive of focus or blur, you can look at example


text:
Q: libpng can't find zlib As I did ./configure for libpng-1.6.18 on MinGW following message was shown.

configure: error: zlib not installed

I installed zlib-1.2.8 into /usr/local and tried ./configure libpng again.
However, error wasn't solved.
Does anyone know how to fix this problem?


text:
Q: Как растянуть html страницу на всю высоту экрана Всем доброго времени суток.
Столкнулся с такой проблемой - сайт не на всю высоту экрана,без понятия, что делать. Юзаю Bootstrap,возможно из-за него
Тоесть надо,чтобы body был 100% по высоте.
Заранее благодарю за ответы.

A: Добавьте body минимальную высоту равную высоте экрана:
 body{min-height:100vh}

A: html{height: 100%;}
body {position:relative; min-height: 100%;}
.container{padding-bottom:5rem;}
footer{position:absolute; bottom: 0; left: 0; right: 0;}


text:
Q: tail -f using PuTTY hangs I am using PuTTY command line to connect to a server and tail a log file. On local machine I've created a file "tail-exec" which contains following text:
tail -f /var/log/test.log
I am starting putty through command line as:
putty -ssh -t -pw  -m tail-exec user@server
This opens up the terminal window with log tail. But the problem is that this terminal hangs after there are few hundred lines added to the log.
If I open putty manually, and then run the tail command from the bash prompt, then it is not hanging for thousands of lines also.
I've tried using following text in tail-exec file, but same issue is happening:
bash -i tail -f /var/log/test.log
Any idea what could be the issue?

A: Try to use a saved session where you set the Option "Keepalive". The use the session like this:
putty -ssh -t -pw -m tail-exec -load 'session-name'


text:
Q: Datatype have changed from Text10 -> Code10, what is the equivalent type in mysql? I have a ssis package that reads data from a third party database, and then writes that data to my database.
I have received an email from them that the following from their database is changing:

*

*Table 6014407 Audit Roll:

*

*Field 11 - "Unit":

*Name change: "Unit" -> "Unit of Measure Code"

*

*Data type change: Text10 -> Code10

my current definition in sql when creating the table for Unit is  NVARCHAR(10) for Text10, but I'd like to know what the equivalent datatype is for Code10, as I'm not familiar with that type

A: I think you are working with Microsoft Dynamics NAV since it supports TEXT and CODE data types.
Referring to Text Data Type in Dynamics NAV documentation:

This simple data type denotes a text string.
  ...
  The Text data type supports Unicode.

In addition, from Code Data Type in Dynamics NAV documentation:

It denotes a special type of string that is converted to uppercase and removes any trailing or leading spaces.
  ...
  The Code data type supports Unicode.

Based on that you can still use NVARCHAR(10) for this data type.


text:
Q: A word for "good state of the world"
Having multiple theories is not necessarily a good state of the world.

(naively, one might have thought that abundance of theories is good; but in fact, multiple theories means it is not clear which one is appropriate for a given case)
Is there a single word or phrase that could replace the " good state of the world" in the sentence above?

A: Another option is, 'Having multiple theories is not necessarily desirable.'


text:
Q: Xamarin dynamic forms The idea is to create an app in Xamarin with dynamic forms. The form definition is taken from any source like local DB or Web API.
The definition contains the set of fields and theirs's default values.
Currently my question is about view model.
Let's say the situation is clear with a view. I mean that user controls can be added to a view programmatically based on the form definition.
But how view model should look like in this case?
As a set of dynamic properties ? How to support user controls binding to respective view model properties ?
Any ideas or links to respective articles are welcomed.
Thank you in advance.


text:
Q: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo' when I use ifdown or ifup When using ifdown or ifup for the lookback interface in CentOS 7:
[root@localhost etc]# ifup lo

I have got the error below:

Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
  Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
  Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
  Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'

However if I use the ifconfig command, it shows the command(ifdown or ifup) works with success.

As I tested, the use of the ifconfig lo up/down does not show any signs of errors.
What is happening?

EDIT
I checked the ifcfg-lo file, it shows the info below:
[root@localhost etc]# ls -la /etc/sysconfig/network-scripts/ifcfg-lo
-rw-r--r--. 1 root root 254 Jun 26 20:07 /etc/sysconfig/network-scripts/ifcfg-lo

A: First of all stop Using ifconfig command anymore with Centos 7 version and later versions because it doesnt give you full information about your network card parameters (For example if you assigened 2 IP addresses to your Card)
instead use ipa command or ip addr show command.
Second This problem is currently being tracked as a bug by Red Hat.
To Fix this problem: Add NM_CONTROLLED=no to /etc/sysconfig/network-scripts/ifcfg-lo.
Root Cause: ifcfg-rh plugin in NetworkManager does not support loopback interface type and logs a message about it in system log.

A: If you want to fully resolve this issues, update to higher version.
And in current version you can fix it by adding "NM_CONTROLLED=no" to /etc/sysconfig/network-scripts/ifcfg-lo configuration file, then restart the network following this link https://access.redhat.com/solutions/1549693


text:
Q: Basic authentication with play2-auth in Play 2.5.x In the example below, the intent is to build a simple play2-auth program  that authenticates a user keeps a session until they log out.
Problem is that I get the following compilation error in ManageSession.scala:

object creation impossible, since: it has 6 unimplemented members

This is the source code, I took the sample from play2-auth website and simplified, but the function signatures are the same:
AuthConfigImpl.scala:
import play.api.mvc._
import scala.reflect._
import play.api.mvc.RequestHeader
import play.api.http.Status
import play.api.mvc.Results._
import jp.t2v.lab.play2.auth._

trait AuthConfigImpl extends AuthConfig {

  type Id = String
  type User = Account
  val idTag: ClassTag[Id] = classTag[Id]
  val sessionTimeoutInSeconds: Int = 3600

  def loginSucceeded(request: RequestHeader): Result = Redirect("/main",Status.OK)
  def logoutSucceeded(request: RequestHeader): Result = Redirect("/main",Status.OK)
  def authenticationFailed(request: RequestHeader): Result = Redirect("/main",Status.OK)
  def authorizationFailed(request: RequestHeader): Result = Forbidden("no permission")
  def authorize(user: User, authority: Authority): Boolean = true

//override lazy val cookieSecureOption: Boolean =
//  play.api.Play.current.configuration.getBoolean("auth.cookie.secure").getOrElse(true)

}

ManageSession.scala:
import play.api.mvc._
import play.api.data._
import play.api.data.Forms._
import scala.concurrent.ExecutionContext.Implicits.global
import jp.t2v.lab.play2.auth._

object ManageSession extends Controller with LoginLogout with AuthConfigImpl {

  val loginForm = Form {
    mapping("email" -> email, "password" -> text)(Account.authenticate)
    (_.map(u => (u.email, "")))
      .verifying("Invalid email or password", result => result.isDefined)
  }

  def login = Action { implicit request =>
    Ok(views.html.showlogin())
  }

  def logout = Action { implicit request =>
    //gotoLogoutSucceeded
    Ok("logged out")
  }

  def authenticate = Action { implicit request =>
    loginForm.bindFromRequest.fold(
      formWithErrors => BadRequest(views.html.showlogin()),
      user => Ok("logged in") // gotoLoginSucceeded(user.get.email)
    )
  }
}

Account.scala:
case class Account(id: Int, email: String, password: String, name: String)

object Account  {

  def authenticate(email: String, password: String): Option[Account] = {
      if (email == "test")
          Some(Account (1, "test", "abc", "Paul"))
      else
          None
  }

A: gotoLoginSucceeded and gotoLogoutSucceeded in play2-auth return Future[Result], but Action expects a Result. You can fix this by using Action.async:
def logout = Action.async { implicit request =>
  // do something...
  gotoLogoutSucceeded
}

import scala.concurrent.Future

def authenticate = Action.async { implicit request =>
  loginForm.bindFromRequest.fold(
    formWithErrors => Future.successful(BadRequest(views.html.showlogin())),
    user => gotoLoginSucceeded(user.get.id)
  )
}

The same must be done with your AuthConfig. All of these methods are expected to return Future[Result]. For example
def loginSucceeded(request: RequestHeader): Future[Result] =
    Future.successful(Redirect("/main", Status.OK))

And so on.


text:
Q: Matching whole words only for Greek I am trying to match a whole polytonic Greek word via the Replace Text extension in MW 1.31 (server running MariaDB 10.3.22).
When I want to match a whole word (one word only) in ASCII characters I use something like
Example Text: suspicion
Find: ([\w]+)<\/b>
Replace: [[$1]]

Or for two words:
Example Text: suspicion, feeling
Find: ([\w]+), (([\w]+)<\/b>
Replace: [[$1]], [[$2]]

But with Greek words word boundaries to not work. I tried:
Example Text 1: λογισμὸς, ἑστὼς, καὶ νουνεχής
Example Text 2: λογισμὸς

(.*?[Α-Ωα-ωίϊίΐἶἶἴῖἰἱἵἰὶἱἸόὀὁόὅὍὄάἄἅᾳἀἁᾴὰάᾷέέἐἑἕἕἔύϋύΰὖῦῆἠἡἥἦἤἤἩῃήήῇώῳώῶῷὠὦὧὠᾠὤὥὡπῥσὑὐὕφΧψ]+?.*?)<\/b>

But this matches more than one word, i.e. it will match both the first example and the second.

A: You may enable Unicode awareness for the \w char by using (*UTF)(*UCP) PCRE verb sequence at the start of the pattern:
(*UTF)(*UCP)(\w+)<\/b>

See the regex demo.
As per the PCRE documentation:

The original operation of PCRE was on strings of one-byte characters. However, there is now also support for UTF-8 strings in the original library, an extra library that supports 16-bit and UTF-16 character strings, and a third library that supports 32-bit and UTF-32 character strings. To use these features, PCRE must be built to include appropriate support. When using UTF strings you must either call the compiling function with the PCRE_UTF8, PCRE_UTF16, or PCRE_UTF32 option, or the pattern must start with one of these special sequences:
(*UTF8)
(*UTF16)
(*UTF32)
(*UTF)
(*UTF) is a generic sequence that can be used with any of the libraries. Starting a pattern with such a sequence is equivalent to setting the relevant option.
Another special sequence that may appear at the start of a pattern is (*UCP). This has the same effect as setting the PCRE_UCP option: it causes sequences such as \d and \w to use Unicode properties to determine character types, instead of recognizing only characters with codes less than 128 via a lookup table.


text:
Q: How to fill select options from a directive? Here is a simple select:
<select [(ngModel)]="..." name="..." id="..." required ...>
   <option *ngFor="let o of options" [ngValue]="o.value">{{o.label}}</option>
</select>

Options is initialised like this:
class MyComponent() {
    options;
    constructor(someService: MyService) {
        this.options = someService.getAllOptions();
    }
}

So far, so good. Everything works fine. However the problem is that I need this select with exactly the same options at various locations. So there are many components which all have this options-Property and load it from my service. That's a lot of code repetition I would like to avoid.
Obviously a component is an option, so that I can just write <mySelect ...>, but the downside is, that I need to pass thru many other variables such as id, class, name, required and possibly more attributes. So I'd prefer a directive-solution, so I can write <select [(ngModel)]="..." name="..." ... myDirective> and myDirective should just add the options as needed. How can I do that?

A: In a directive you have easy access to the HTML element using an ElementRef-Parameter and thus adding the element options is no problem. The key is, that you need to register the options with the SelectControlValueAccessor. Usually an <option>-Element is recognized by angular at compile time and an NgSelectOption is created which registers itself in the constructor. Since you created that option element dynamically you need to do this step manually:
@Directive({
    selector: '[myDirective]'
})
export class MyDirective {
    constructor(someService: MyService,
                element: ElementRef<HTMLSelectElement>,
                renderer: Renderer2,
                @Optional() @Host() select: SelectControlValueAccessor) {

        someService.getAllOptions().forEach(co => {
            const option = document.createElement('option');
            option.text = co.displayName;
            option.value = co.id;
            element.nativeElement.add(option);
            new NgSelectOption(new ElementRef(option), renderer, select);
        });
    }
}

A: Answering an old question, but I think it's worth the share.
Improving on the existing answer, the Angular way is not to interact directly with the global document, but instead, use its built-in Renderer API.
@Directive({
  selector: '[myDirective]'
})
export class MyDirective {
  constructor(
    someService: MyService,
    element: ElementRef<HTMLSelectElement>,
    renderer: Renderer2,
    @Optional() @Host() select: SelectControlValueAccessor
  ) {
    // remove previous options
    this.element
      .nativeElement
      ?.childNodes
      .forEach((node) => this.renderer.removeChild(this.element.nativeElement, node));

    someService.getAllOptions().forEach(co => {
      // prepare the option element
      const option = this.renderer.createElement('option');
      const text   = this.renderer.createText(co.displayName);
      this.renderer.setValue(option, `${co.id}`);

      // add the option text under option, and option element under select
      this.renderer.appendChild(option, text);
      this.renderer.appendChild(this.element.nativeElement, option);

      // make the directive play nice with Angular forms
      const ngOption = new NgSelectOption(new ElementRef(option), renderer, select);
      ngOption.ngValue = value;
    });
  }
}

Advantage of this is that it's easier to port your code to run in environments that don't have DOM access, such as when you do server-side rendering, or build for native mobile, or run as a service worker.


text:
Q: AbstractMethodError when adding file download control to xpage In one of our apps we currently are facing the a strange issue involving download controls. When we add a file download control to the xpage and bind it to the datasource ( normal Document source) we receive the following error ( see stacktrace on bottom of the question.
We are using Domino 9.0.1 FP3 and the domino openntf api plugins. Because a search on this issue didn't give us any insight into the issue we hope that someone can explain what is happening and how to solve it.
javax.servlet.ServletException: java.lang.AbstractMethodError: lotus/domino/EmbeddedObject.getFileModified()Llotus/domino/DateTime;
    at com.ibm.xsp.webapp.FacesServlet.handleError(FacesServlet.java:648)
    at com.ibm.xsp.webapp.FacesServlet.renderErrorPage(FacesServlet.java:482)
    at com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:183)
    at com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:138)
    at com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
    at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:576)
    at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1335)
    at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:853)
    at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:796)
    at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:565)
    at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1319)
    at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:662)
    at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:482)
    at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:350)
    at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:306)
    at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
Caused by: java.lang.AbstractMethodError: lotus/domino/EmbeddedObject.getFileModified()Llotus/domino/DateTime;
    at com.ibm.xsp.model.domino.wrapped.DominoDocument$AttachmentValueHolder.<init>(DominoDocument.java:1939)
    at com.ibm.xsp.model.domino.wrapped.DominoRichTextItem.buildAttachmentListRT(DominoRichTextItem.java:2224)
    at com.ibm.xsp.model.domino.wrapped.DominoRichTextItem.getAttachmentList(DominoRichTextItem.java:2200)
    at com.ibm.xsp.model.domino.wrapped.DominoDocument.readFieldAttachments(DominoDocument.java:2080)
    at com.ibm.xsp.model.domino.wrapped.DominoDocument.getAttachmentList(DominoDocument.java:2152)
    at com.ibm.xsp.model.domino.DominoAttachmentDataModel.getAttachments(DominoAttachmentDataModel.java:58)
    at com.ibm.xsp.model.domino.DominoAttachmentDataModel.<init>(DominoAttachmentDataModel.java:39)
    at com.ibm.xsp.model.domino.DominoDataModelFactory.createDataModel(DominoDataModelFactory.java:68)
    at com.ibm.xsp.application.ApplicationExImpl.createDataModel(ApplicationExImpl.java:461)
    at com.ibm.xsp.component.UIFileDownload.isRendered(UIFileDownload.java:485)
    at javax.faces.component.UIComponentBase.fillShadowedFlags(UIComponentBase.java:880)
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:948)
    at javax.faces.component.UIData.encodeBegin(UIData.java:788)
    at com.ibm.xsp.component.UIDataEx.encodeBegin(UIDataEx.java:425)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:842)
    at com.ibm.xsp.util.FacesUtil.renderChildren(FacesUtil.java:873)
    at com.ibm.xsp.renderkit.html_extended.HtmlBasicRenderer.encodeChildren(HtmlBasicRenderer.java:206)
    at com.ibm.xsp.renderkit.ReadOnlyAdapterRenderer.encodeChildren(ReadOnlyAdapterRenderer.java:162)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:979)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:844)
    at com.ibm.xsp.util.FacesUtil.renderChildren(FacesUtil.java:873)
    at com.ibm.xsp.renderkit.html_extended.HtmlBasicRenderer.encodeChildren(HtmlBasicRenderer.java:206)
    at com.ibm.xsp.renderkit.ReadOnlyAdapterRenderer.encodeChildren(ReadOnlyAdapterRenderer.java:162)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:979)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:844)
    at com.ibm.xsp.util.FacesUtil.renderChildren(FacesUtil.java:873)
    at com.ibm.xsp.renderkit.html_extended.HtmlBasicRenderer.encodeChildren(HtmlBasicRenderer.java:206)
    at com.ibm.xsp.renderkit.ReadOnlyAdapterRenderer.encodeChildren(ReadOnlyAdapterRenderer.java:162)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:979)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:844)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:853)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:853)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:853)
    at com.ibm.xsp.util.FacesUtil.renderChildren(FacesUtil.java:873)
    at com.ibm.xsp.renderkit.html_extended.HtmlBasicRenderer.encodeChildren(HtmlBasicRenderer.java:206)
    at com.ibm.xsp.renderkit.ReadOnlyAdapterRenderer.encodeChildren(ReadOnlyAdapterRenderer.java:162)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:979)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:844)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:853)
    at com.ibm.xsp.util.FacesUtil.renderChildren(FacesUtil.java:873)
    at com.ibm.xsp.renderkit.html_extended.HtmlBasicRenderer.encodeChildren(HtmlBasicRenderer.java:206)
    at com.ibm.xsp.renderkit.ReadOnlyAdapterRenderer.encodeChildren(ReadOnlyAdapterRenderer.java:162)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:979)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:844)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:853)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:853)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:853)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:853)
    at com.ibm.xsp.util.FacesUtil.renderComponent(FacesUtil.java:853)
    at com.ibm.xsp.component.UIViewRootEx._renderView(UIViewRootEx.java:1317)
    at com.ibm.xsp.component.UIViewRootEx.renderView(UIViewRootEx.java:1255)
    at com.ibm.xsp.application.ViewHandlerExImpl.doRender(ViewHandlerExImpl.java:651)
    at com.ibm.xsp.application.ViewHandlerExImpl._renderView(ViewHandlerExImpl.java:321)
    at com.ibm.xsp.application.ViewHandlerExImpl.renderView(ViewHandlerExImpl.java:336)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:103)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:210)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:120)
    at com.ibm.xsp.controller.FacesControllerImpl.render(FacesControllerImpl.java:270)
    at com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:261)
    at com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:157)
    at com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160)
    ... 13 more

A: java.lang.AbstractMethodError occurs if the definition of some class has incompatibly changed since the currently executing method was last compiled.
I think the the underlying method is returning an array of Llotus/domino/DateTime objects but the source code @ https://github.com/OpenNTF/org.openntf.domino/blob/master/org.openntf.domino/src/org/openntf/domino/impl/EmbeddedObject.java says it expects single object


text:
Q: How can I get Depth(Distance) Data using Depth(ToF) Camera?(Galaxy Note 10+, Camera2 API) I'm working with Galaxy Note 10+ and Android Camera2 API.
What I want to do is to get depth(distance) data while I'm taking pictures.(on Preview, View Finder screen)
Like this screenshot of Quick Measure app, I think it's Samsung default app.
Quick Measure
When I tested my device on Google Camera2Basic Sample, I found out that the depth(ToF) camera isn't included to availableCameras list because it doesn't have CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE among its characteristics.
And the characteristic says

Devices with the DEPTH_OUTPUT capability might not list this capability, indicating that they support only depth measurement, not standard color output.

I have no clue how to use this camera to get depth information.
Should I open more than one camera simultaneously?
Any helps or comments are appreciated!
Regards,
Lee