text:
Q: Why isnt my jquery changing my div? I'm trying to change the top div so when either button is selected, it will change it according to the button that is clicked on.
HTML

    <button id="blue">blue</button>
    <button id="yellow">yellow</button>

JQUERY
$( document ).ready(function() {

    // initial load up coverts to this colour
    $('.bulb1').css("background-color","black");

    //call the colour change functions when clicked
    $('#blue').click("background-color", "setBlue");
    $('#yellow').click("background-color", "setYellow");

});

function setYellow(){

    $('#bulb1').css("background-color","#yellow");

}

function setBlue(){

    $('#bulb1').css("background-color","#blue");

}

A: Try something like this:
$('#blue').click(function() {
    $('#bulb1').css({
        'background-color' : 'blue'
    });
});

Or
$('#blue').click(function() {
    setBlue();
});

function setBlue() {
    $('#bulb1').css({
       'background-color': 'blue'
     });
}

You can refactor your code like:
$(document).ready(function() {

    // initial load up coverts to this colour
    setColor('black');

    //call the colour change functions when clicked
    $('#blue').click(function() {
      setColor('blue');
    });

    $('#yellow').click(function() {
      setColor('yellow');
    });

});

function setColor(color) {
    $('#bulb1').css({
       'background-color': color
     });
}

A: You're selecting the wrong element initially:
$('.bulb1').css("background-color","black");

should be
$('#bulb1').css("background-color","black");

or
$('.bulb').css("background-color","black");

depending on which element(s) you're trying to select.

A: Correction and Solution based on your code-
$( document ).ready(function() {

    // initial load up coverts to this colour
    $('#bulb1').css("background-color","black");

    //call the colour change functions when clicked
    $('#blue').click(function(){
        setBlue();
    });

    $('#yellow').click(function(){
        setYellow();
    });
});

function setYellow(){
    $('#bulb1').css("background-color","yellow");
}

function setBlue(){
    $('#bulb1').css("background-color","blue");
}

A: Demo
$( document ).ready(function() {

    // initial load up coverts to this colour
    $('.bulb').css("background-color","black");

    //call the colour change functions when clicked
    $('#blue').click(function()
    {
        $('#bulb1').css("background-color","blue");
    });
    $('#yellow').click(function()
    {
        $('#bulb1').css("background-color","yellow");
    });

});

A: Try this:
$('#yellow').click(setYellow);
$('#blue').click(setBlue);

or delegate the click command to listen for the 'click' event for your element on your document:
$(document).delegate('#yellow', 'click', setYellow);
$(document).delegate('#blue', 'click', setBlue);


text:
Q: Determing the base SHA of a .patch file I have a .patch file with two commits in it:
From 6551a3bb
From <redacted>
Date: Tue, 23 Jun 2015 13:42:58 -0700
Subject: <redacted>

From 224fbe
From: <redacted>
Date: Tue, 30 Jun 2015 21:15:16 +0100
Subject: <redacted>

How can I tell what SHA the patch was generated from? Assume I know the branch.

A:
but am not sure what commit the HEAD was on when it was generated

Looking at git format-patch, the patch was generated in a way which included 224fbe and 6551a3bb:

*

*either by specifying a range of commits which includes those two.
In that case, HEAD could have been anywhere.

*or by specifying a <since> commit, where are included the commits leading to the tip of the current branch that are not in the history that leads to the <since>.
In that sec ond case, HEAD might have been 224fbe

redpajama_set_name: RedPajamaStackExchange


text:
Q: Entity Framework One To One using Third table Here are my models
public class A
{
    public int AId { get; set; }
    public string Prop1 { get; set; }
    public string Prop2 { get; set; }
    public string Prop3 { get; set; }
    public B B { get; set; }
}
public class B
{
    public int BId { get; set; }
    public string Prop1 { get; set; }
    public string Prop2 { get; set; }
    public string Prop3 { get; set; }
    public A A { get; set; }
}
public class AB
{
    public int AId { get; set; }
    public int BId { get; set; }
}

How Can I write fluent api to map A to B as one to one relationship using Entity Framework 5 code first?


text:
Q: Odds of something specific happening multiple times in sequence..? More explanation below, struggling to phrase properly I feel really dumb for not figuring this out myself, don't bash me too hard, it's been a while since I've had a stats class.
I'm playing a mobile game, and simply put, you summon heroes with currency. The odds of summoning an "elite hero" are 4.61%, while the odds of let's say a "common hero" is the opposite, 95.39%. You can also do a 10-summon, which is just what it sounds, a bundle of 10 summons all at one time. Using 1-(.9539^10), you can see that in a 10-summon, you have a ~37.6% chance of pulling one elite.
My question is... What would be the formula for finding multiple elite heroes in a 10-summon? What would the odds be of 2 elites in a 10-summon, or 3 or 4?
My first instinct would be something like... (4.61 x 4.61 x (95.39^8)) / 100^10, but this yields a ~.14% chance, and it seems like too drastic of a jump to go from one elite in a 10-summon = ~37.6%, to two elites in a 10-summon is ~0.14%.
Thank you, sorry this probably simple statistics question is blowing my mind!! It's too late for this...

A: This isn't a dumb question at all, this is a fairly common type of probability question. Assuming that each summon is independent and identically distributed (which basically means that each summon does not depend on other summons and that the odds of each summon are always the same) then this is a Binomial Distribution. I'll try to explain very simply what that is and how we intuitively get the formulas while trying to involve the least amount of math/stat and jargon.
If you were to ask for example, what is the probability of getting 2 elites in a 5-summon given that the probability of getting an elite is p. Then we can list out all possible outcomes of that happening (let's denote E as an elite and C as a common)

*

*E E C C C (this is basically saying, draw an elite, then another elite then 3 commons)

*E C E C C (this is drawing an elite, then a common, then an elite, then 2 commons)

*E C C E C (etc...)

*E C C C E

*C E E C C

*C E C E C

*C E C C E

*C C E E C

*C C E C E

*C C C E E
Now that we listed all possible outcomes of 2 elites in 5 drawings (that's quite a lot), we can now calculate the probability of each outcome happening and then sum those probabilities to get the answer to the question (probability of getting 2 elites in a 5-summon)

*

*$P('EECCC') = P('E')*P('E')*P('C')*P('C')*P('C')=p^2*(1-p)^3$

*$P('ECECC') = P('E')*P('C')*P('E')*P('C')*P('C')=p^2*(1-p)^3$

*$P('ECECC') = ...=p^2*(1-p)^3$
We can see that no matter which of those 10 patterns we calculate the probability for, we end up getting $p^2*(1-p)^3$
So the answer is to what is probability of getting 2 elites in a 5-summon =
$10*p^2*(1-p)^3 = 10*(0.0461)^2*(1-0.0461)^3 = 0.018446348 \approx 1.8 \% $
But now a logical next question is: In this example we could easily list out the all possible outcomes of 2 elites in 5 summons, count them and get 10, but what if we wanted to calculate the probability in 152 elites in 528 summons? Or any other arbitrary number? That's when mathematics comes in and saves us with the Binomial Coefficient. Thus the formula for K elites in N summons is
$\frac{n!}{k!(n-k)!}p^k(1-p)^{(n-k)}$
Where that weird factorial fraction is from the binomial coefficient.
If you want to just plug numbers and get answers, you can use this simple calculator here. If you want to know for example the probability of getting 3 or more elites in a 10 summon, put the numbers 0.0461, 10, and 3 in the first 3 boxes, press calculate and you'll get P(X > x)=0.00920669192 which means in 10 summons there's a 0.92% chance that you'll get 3 or more elites


text:
Q: Get MAX() on column in two tables I have two tables which both have the column DateTime.
How can I get the MAX() DateTime?
The shorter/simpler the better, because this is just part of a larger query.

A: SELECT MAX(thedate) FROM (
    SELECT mydate as thedate FROM TABLE1

    UNION

    SELECT anotherdate as thedate FROM TABLE2
) as tablealias

A: You could use the GREATEST function:
SELECT GREATEST((SELECT MAX(column)
                   FROM TABLE_1),
                (SELECT MAX(column)
                   FROM TABLE_2))

Using UNIONs:
SELECT MAX(col)
  FROM (SELECT col FROM TABLE_1
        UNION ALL
        SELECT col FROM TABLE_2)

Use UNION ALL for this - it's faster because it doesn't remove duplicates, and it doesn't matter if duplicates are returned by the subquery in this example.


text:
Q: Loading image from http request I'm developing a profile card that has to get different value's. I'm getting all the value's but i also want to load a network image. I'm using a filemaker server and i had noticed that i needed coockies to load this. When i make a request copy paste the image url into my browser it just loads. But whenever i'm loading it into my application i get the 401 statusCode with my image.
I have tried just a valid network image that's working, i have readed something about coockies but i'm not sure if i need to use them and how. I also find it weird that whenever i load the image in my browser it works but not on my application.
Future makeRequest() async {
    var url4 =
        "https://fms.xxxxxx.nl/fmi/data/v1/databases/Roscom Management Systeem/layouts/medewerker pa api/_find";
    var body = json.encode({
      "query": [
        {"Emailadres(1)": "xxxx@xxx.nl"}
      ],
    });
Map<String, String> headers = {
  'Content-type': 'application/json',
  'Accept': 'application/json',
  "Authorization":
      'Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
};

var response = await http.post(url4, body: body, headers: headers);
setState(() {
  var responseJson = json.decode(response.body);
  data = responseJson['response']['data'][0];
  profielfoto = data['fieldData']['iMedewerker Foto'];

  print(profielfoto);
});

Value i get in the terminal
I expect that i can load the image in a networkimage with just the var $profielfoto. I don't know what to do with the coockies or maybe there's a much easier way to do it. I hope someone can help me please let me know if i need to provide more information about the server or anything else. ;)

A: A few things. Please do not put any type of heavy processing in setState
https://docs.flutter.io/flutter/widgets/State/setState.html

Generally it is recommended that the setState method only be used to
  wrap the actual changes to the state, not any computation that might
  be associated with the change. For example, here a value used by the
  build function is incremented, and then the change is written to disk,
  but only the increment is wrapped in the setState:

setState tells the widget when it needs to be redrawn
https://flutter.dev/docs/cookbook/images/network-image
String _profilePhoto = "";
//Change await into an async operation
http.post(url4, body: body, headers: headers).then( (response) {
   var responseJson = json.decode(response.body);

   print(data['fieldData']['iMedewerker Foto']);
   setState(() {

      _data = responseJson['response']['data'][0];
     _profilePhoto = data['fieldData']['iMedewerker Foto'];
   });
})

Widget build(BuildContext context){
      //Check if string is empty
     if ( _profilePhoto == "" ){
          return CircularProgressIndicator();
     }else {
           return Image.network( _profilePhoto );
     }
}

https://flutter.dev/docs/cookbook/images/network-image
https://pub.dartlang.org/packages/cached_network_image
You have two choices to grab images from the network. I believe I presented one way.

A: the authorization token must be the issue. a secure server will return this token when a user logs in. then all ensuing  request must have this token in the 'authorization header'. if it is not there or incorrect the server returns a 401


text:
Q: Is there a way to check if its safe to copy or assign an object in C++? I have the following problem. I'm using the C library igraph (http://igraph.sourceforge.net/) in a program I must do in c++. So I found a c++ wrapper of this C library (http://code.google.com/p/igraphhpp/) that provides some nice interface I wanted to use, in a class called Graph.
I have the following class in my program:
class Agent
{
private:
  double beta;
  Graph * innerGraph;
public:
  Agent(int N, double beta_) {
    innerGraph = new Graph;
    *innerGraph = Graph::full(N);
    beta = beta_;
  };
  ~Agent() {delete innerGraph;}
  void MCStep();
};

The function MCStep() must do the following:

*

*make a copy of the Graph contained in *innerGraph,

*do some stuff to this copy, without altering the original,

*check if the altered copy satisfy some condition and, if yes, update *innerGraph with this new modified graph.

If I knew that the library implements a safe copy constructor, I'd do it in the obvious way, but I don't. How can I check it?

A: Check the source of Graph, see whether the copy constructor calls this function:
http://igraph.sourceforge.net/doc/html/ch04s02s01.html#igraph_copy
There's no general way - the C++ language itself knows nothing about "deep copies" or "shallow copies", so copy constructors are all the same to it as far as that's concerned. In an ideal world, anyone publishing a C++ wrapper like this would document it, and in this case probably should make it a complete deep copy.

A: Since you're working with pointers to Graph, can't you just swap the pointers in step 3? (Don't forget to delete the temporary after swap)


text:
Q: In PyCharm Django version How can I use Django 1.11 as default version in pycharm ?
Letting you know that I'm using macOS and default Django version is 2.0.3 !

A: Pycharm has nothing to do with Django version. You can just install django version you need.
Use: pip3 install django==1.11

Note:

You can check your globally installed django version by typing:
python3
import django
django.VERSION

You will probably get 2.0.3 as global django version. So now you have to type:
pip3 install django==1.11

That will install django with version 1.11 as global. From now, whenever you will create new project via:
django-admin startproject your_project
Django version of that new project will be 1.11 by default

And some advice:

Next time just use virtualenv or virtualenvwrapper, by using it you will set your libraries locally for each project

A: You can use python virtualenv to create a custom environment for your project with django version 1.11.

*

*https://docs.python.org/3/library/venv.html

*https://www.jetbrains.com/help/pycharm-edu/creating-virtual-environment.html
In your project folder :
python3 -m venv env
source env/bin/activate
pip install django=1.11

This will create a folder named env (source command activates this environment). You may need to install all your other dependencies.
In PyCharm, under project settings Project Interpreter, select this environment.


text:
Q: c# updating only the values with inputs on the view with razor page with entity framework CORE I'm using razor pages and EF CORE and have retrieved values from the database and put them in the view like so
<input asp-for="theModel.theValue1" class="form-control" />

using BindProperty
[BindProperty]
public theModel theModel { get; set; }

So far, so by-the-documentation.   I have another value in the model called theValue2 which is to remain unchanged when this view is submitted.   If I save the view using
_context.Attach(theModel).State = EntityState.Modified;
await _context.SaveChangesAsync();

then theModel.theValue2 is null as I don't have a corresponding input on the view itself which is as you'd expect with statelessness.
Is the only way to persist values between edits to put a hidden input on the view for each property in the model like so
<input type="hidden" asp-for="theModel.theValue2" />

or is there a more elegant way of saying either "only update theModel.theValue1" or "don't update theModel.theValue2"?

A: This is the only way to transfer your data between postbacks but it is not safe. It is very easy for the visitor of you web application to change the value of a hidden input.
I usually read the data from database again when the user posts data and I set the new values for the entity that I retrieved from database (for your case you will set the value for theModel property) and save the modified entity back to the database.

A: Not on my pc now, but I'm pretty sure you could so something like
_context.Entry(theModel).Property(t => t.theValue2).IsModified = false;

Before calling the save.


text:
Q: Calculate time difference in percentage I'm trying to make some statistical data on the performance of a specific task.
One of the data points gathered is how long time it took to run. I'd then like to compare that against the expected time to run and thereby know in percentage if the task performed better or worse than expected.
See example below:

Thanks in advance :)

A: The formula on cell C3 should be:
=(B3/$B$2)-1

Copy down this formula to cells C2, C3, C4 and so on.
Select column C, right-click and select Cell format -> Percentage


text:
Q: Find the sum of amount for particular transasaction type for 2 consecutive days I have two tables 1. Transactions and 2. Transaction type
e.g. of transaction table with dummy data
account_key  Transaction_key    date        amount
1                 11          03/22/0219     5000
1                 12          03/23/2019     6000
1                 13          03/22/2019     4000
1                 14          03/23/2019     3000

e.g. of Transaction_type table with dummy data
transaction_key    transaction_type
11                      in
12                      in
13                      out
14                      out

I have to find the ratio of sum of amount for 2 consecutive days of similar transaction type for the same account key. for eg (5000+6000)/(4000+3000)
the database is oracle and datatype is datetime
This is what I have tried
select t1.account_key,
       trunc(t1.date),
       sum(t1.amount) as in,
       sum(t2.amount) as out
from   transactions t1
inner join transactions t2 on t1.accountkey=t2.accountkey
where t1.date between '01-jun-2017' and '30-nov-2017'
and   t2.date between '01-jun-2017' and '30-nov-2017'
and   t1.transaction_key in (select a.transaction_key
                             from   transaction_type a
                             where  a.transaction type in 'in')
and   t2.transaction_key in (select b.transaction_key
                             from   transaction_type b
                             where  b.transaction type in 'out')
group by t1.account_key,
         trunc(t1.date)
having   max(trunc(t1.date))-min(trunc(t1.date)) = 1
and      max(trunc(t2.date))-min(trunc(t2.date)) = 1

A: You can use a WITH clause, also called a "common table expression" or "CTE" to break your problem down into manageable chunks.
Here is one way to do that:
WITH txn_by_date AS (
  SELECT t.account_key,
         t.txn_date,
         tt.transaction_type,
         sum(t.amount) amount
  FROM   txns t
  INNER JOIN txn_types tt on tt.transaction_key = t.transaction_key
  GROUP BY t.account_key, t.txn_date, tt.transaction_type )
SELECT tin.account_key,
       tin.txn_date,
       tin.amount amount_in,
       tout.txn_date,
       tout.amount amount_out,
       tin.amount / tout.amount ratio
FROM   txn_by_date tin
INNER JOIN txn_by_date tout ON tout.txn_date = tin.txn_date + 1
                           AND tout.transaction_type = 'out'
                           AND tout.account_key = tin.account_key
WHERE tin.transaction_type = 'in';

The CTE first computes the total txn amount by account, transaction type, and day.  Once you have that, the main SELECT gets each 'in' total, joins it with the 'out' total from the consecutive day, and the computes the ratio.
Here is a full example, with test data (also expressed using the WITH clause):
with txns (account_key,  Transaction_key,    txn_date,    amount) AS
(
SELECT 1, 11, TO_DATE('03/22/2019','MM/DD/YYYY'), 5000 FROM DUAL UNION ALL
SELECT 1, 12, TO_DATE('03/23/2019','MM/DD/YYYY'), 6000 FROM DUAL UNION ALL
SELECT 1, 13, TO_DATE('03/22/2019','MM/DD/YYYY'), 4000 FROM DUAL UNION ALL
SELECT 1, 14, TO_DATE('03/23/2019','MM/DD/YYYY'), 3000 FROM DUAL ),
txn_types ( transaction_key, transaction_type ) AS
(
SELECT 11, 'in' FROM DUAL UNION ALL
SELECT 12, 'out' FROM DUAL UNION ALL
SELECT 13, 'in' FROM DUAL UNION ALL
SELECT 14, 'out' FROM DUAL ),
txn_by_date AS (
  SELECT t.account_key,
         t.txn_date,
         tt.transaction_type,
         sum(t.amount) amount
  FROM   txns t
  INNER JOIN txn_types tt on tt.transaction_key = t.transaction_key
  GROUP BY t.account_key, t.txn_date, tt.transaction_type )
SELECT tin.account_key,
       tin.txn_date,
       tin.amount amount_in,
       tout.txn_date,
       tout.amount amount_out,
       tin.amount / tout.amount ratio
FROM   txn_by_date tin
INNER JOIN txn_by_date tout ON tout.txn_date = tin.txn_date + 1
                           AND tout.transaction_type = 'out'
                           AND tout.account_key = tin.account_key
WHERE tin.transaction_type = 'in';

+-------------+-----------+-----------+------------+------------+-------+
| ACCOUNT_KEY | TXN_DATE  | AMOUNT_IN | TXN_DATE_1 | AMOUNT_OUT | RATIO |
+-------------+-----------+-----------+------------+------------+-------+
|           1 | 22-MAR-19 |      9000 | 23-MAR-19  |       9000 |     1 |
+-------------+-----------+-----------+------------+------------+-------+

ALTERNATE VERSION, FOR ANCIENT VERSIONS OF ORACLE
For really old versions of Oracle, you may need to avoid both the WITH clause and ANSI-style joins.  Here is the above query rewritten to avoid those features.
SELECT tin.account_key,
       tin.txn_date,
       tin.amount amount_in,
       tout.txn_date,
       tout.amount amount_out,
       tin.amount / tout.amount ratio
FROM   ( SELECT t.account_key,
                t.txn_date,
                tt.transaction_type,
                sum(t.amount) amount
         FROM   txns t,
                txn_types tt
         WHERE  tt.transaction_key = t.transaction_key
         GROUP BY t.account_key, t.txn_date, tt.transaction_type ) tin,
       ( SELECT t.account_key,
                t.txn_date,
                tt.transaction_type,
                sum(t.amount) amount
         FROM   txns t,
                txn_types tt
         WHERE  tt.transaction_key = t.transaction_key
         GROUP BY t.account_key, t.txn_date, tt.transaction_type ) tout
WHERE tin.transaction_type = 'in'
AND tout.transaction_type(+) = 'out'
AND tout.account_key(+) = tin.account_key;

A: I would try to use to Temporary Tables. Store the sums of each in Transaction type in two temp tables, then use them to calculate your ratio. I have not tested this query but this is basically what you are looking for:
 CREATE PRIVATE TEMPORARY TABLE as In_TempTable
 Select T2.Transaction_Type, sum(T1.amount) In_Total
 from Transactions T1
 left join Transaction_Type T2 on T2.Transaction_key = T1.Transaction_Key
 where T1.date between '01-jun-2017' and '30-nov-2017'
      AND T2.Transactio_Type = 'In'
 group by T2.Transaction_Type;

 CREATE PRIVATE TEMPORARY TABLE as Out_TempTable
 Select T2.Transaction_Type, sum(T1.amount) Out_Total
 from Transactions T1
 left join Transaction_Type T2 on T2.Transaction_key = T1.Transaction_Key
 where T1.date between '01-jun-2017' and '30-nov-2017'
      AND T2.Transactio_Type = 'Out'
 group by T2.Transaction_Type;

 Select Sum(a.In_Total)/Sum(b.Out_Total)
 from In_TempTable a
 Full Outer Join Out_TempTable b on b.Transaction_Type = a.Transaction_Type

I would personally change this:
T1.date between '01-jun-2017' and '30-nov-2017'

To something like this
T1.date between startdate and startdate+2

Depending on your needs of course and you will have to declare your startdate


text:
Q: Why am I getting different behaviours for scollview between emulators and physical devices? I'm a newcomer to NativeScript. I was playing around to replicate a common UI pattern used by weather apps. I achieved a similar look working fine on the emulator (I've tested on Android versions 4.4, 6 and 9 and all works fine) but it doesn't work as I expected on physical devices ( Bottom pane doesn't scroll, tested on 3 different devices with Android versions 4.4, 6 and 7). I've created a playground project. My question is why am I getting different behaviours for the bottom scollview between emulators and physical devices?

A: I could use a little more info, but this might be due to the nature of ScrollView.
If the screen is large enough to display all of the content declared inside of the ScrollView tags, then it will not be scroll-able.
Is that the issue you are experiencing?
Hope this helps!

A: Android Emulators may not give the accuracy in some cases, after all you are not really dealing with a real touch interface there.
Also Android has an extended version of ScrollView just to support nested scrolls, you will have to extend the NativeScript ScrollView to use androidx.core.widget.NestedScrollView
var __extends = this.__extends || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};

var scrollView = require("tns-core-modules/ui/scroll-view");

var NestedScrollView = (function (_super) {
    __extends(NestedScrollView, _super);
    function NestedScrollView() {
        _super.call(this);
    }
    NestedScrollView.prototype.createNativeView = function () {
        if (typeof android !== void 0) {
            return new androidx.core.widget.NestedScrollView(this._context);
        }
        return _super.prototype.createNativeView.call(this);
    };
    return NestedScrollView;
})(scrollView.ScrollView);

exports.NestedScrollView = NestedScrollView;

Updated Playground


text:
Q: Create list with expandable element - Android I would like to create a list of elements that can be expandable and looks like the Google Clock app

Which Android element should I use ?
Thanks a lot by advance for your answers.

A: use recyclerview.The google clock app is using recyclerview.


text:
Q: Compare harris feature points against saved image I have a image (.fig) saved with feature points plotted using the harris corner detector, I then want to map the feature points on a second image and compare them to the saved image to show the matched feature points. I would like some help on how to go about this.
Code to map "template" image:
I1 = rgb2gray(imread('/home/colin/downloads/matlabImages/template.jpg'));
points1 = detectHarrisFeatures(I1);
imshow(I1); hold on;
plot(points1);

I just saved this image using the "File -> saveas" option when it was plotted.
I am then trying to run a separate script to plot the features on the new image and compare them, this is where I'm having problems.
Compare Script:
I1 = hgload('/home/colin/tmp/untitled.fig');
I2 = rgb2gray(imread('/home/colin/downloads/matlabImages/small.jpg'));
points2 = detectHarrisFeatures(I2);
[features2, valid_points2] = extractFeatures(I2, points2);
indexPairs = matchFeatures(I1, features2);
matched_points2 = valid_points2(indexPairs(:, 2), :);
figure; showMatchedFeatures(I1, I2, matched_points2);

As you can imagine I am getting a series of errors:
Error using coder.internal.errorIf (line 9)
Expected FEATURES1 and FEATURES2 to be the same class.

Error in matchFeatures>assignFeaturesAndMetric (line 356)
coder.internal.errorIf(~isequal(class(f1), class(f2)),...

Error in matchFeatures>parseInputs (line 343)
[features1, features2, metric] = assignFeaturesAndMetric(f1, f2, metric);

Error in matchFeatures (line 196)
    [features1, features2, metric, match_thresh, method, maxRatioThreshold, ...

Error in comparePoints (line 6)
indexPairs = matchFeatures(I1, features2);

A: You are not saving the correct information. When you save a .fig, you are only saving the plot.
You need to save I1 and points1:
I1 = rgb2gray(imread('/home/colin/downloads/matlabImages/template.jpg'));
points1 = detectHarrisFeatures(I1);
save('im1.mat', 'I1','points1');

Now you can use the info:
load('im1.mat');%This loads I1 and points1
I2 = rgb2gray(imread('/home/colin/downloads/matlabImages/small.jpg'));
points2 = detectHarrisFeatures(I2);
[features2, valid_points2] = extractFeatures(I2, points2);
[features1, valid_points1] = extractFeatures(I1, points1);
indexPairs = matchFeatures(features1, features2);

Optionally, you can compute the features1 variable in the first step and save it (instead of using I1 and points1):
I1 = rgb2gray(imread('/home/colin/downloads/matlabImages/template.jpg'));
points1 = detectHarrisFeatures(I1);
[features1, valid_points1] = extractFeatures(I1, points1);
save('im1.mat', 'features1');

load('im1.mat');%This loads features1
I2 = rgb2gray(imread('/home/colin/downloads/matlabImages/small.jpg'));
points2 = detectHarrisFeatures(I2);
[features2, valid_points2] = extractFeatures(I2, points2);
indexPairs = matchFeatures(features1, features2);


text:
Q: Liferay dxp 7.3: how to add third party jars for global sharing? how can add 3rd party jars for global sharing?
in 6.1, it just need to add those jar files into tomcat's lib/ext folder. but after upgrade to 7.3, those jars seems not loading and cannot reference in portlets.
please help!
thx.

A: Liferay 7 replaced its whole foundation and switched to OSGi -- you'll need to provide your third-party jars in an OSGi bundle.
(This basically was the answer. Any elaboration would be too much for this site or would need a more specific question. As Liferays documentation is always in flux, search for "liferay include third-party jars in module" for more info. At the time of writing, this link is a relevant search result.)


text:
Q: htaccess not working on WHM I'm trying to run an PHP application on such this type of link http://XXX.xxx.xxx.xxx/~sender0/
I'm using htaccess file
    <IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?action=$1 [NC,L]

</IfModule>

the system replying the htaccess error.
I think as the URL have a special character "~" this may the reason of not working my application.

A: Can you please try to add following code before RewriteCond lines and check it.
RewriteEngine on
RewriteBase /~sender0/


text:
Q: Laravel: How to populate existing data with a foreignkey? I build a two models which represent two tables in my mysql database.
In one table I got the zip codes of some car dealers and in the second one I got the coordinates
of zip codes.
Unfortunatly, I don't get
the related data.
I used the zip_code aus the foreign_key.
public function up()
{
    Schema::create('plzs', function (Blueprint $table) {
        $table->id();
        $table->text("Ort");
        $table->decimal('Latitude', 10, 8);
        $table->decimal('Longitude', 11, 8);
    });
}

and
public function up()
{
    Schema::create('autodealers', function (Blueprint $table) {
        $table->id();
        $table->bigInteger('plz_id')->unsigned();
        $table->text("Händler");

        $table->foreign('plz_id')->references('id')->on('plzs')->onDelete('cascade');
    });
}

then I migrate the table and the table is created in my db.
After that I import via csv files data to the tables in mySQL. Everything works fine.
Here I define the one-to-one relationship.
plz.php:
public function dealer()
{
    return $this->hasOne('App\Autodealer', 'plz_id');
}

Autodealer.php:
public function coor()
{
    return $this->belongsTo('App\plz');
}

Via web.php I'm defining the route:
Route::get('/auto', 'AutohaendlerController@index');

From this Route I'm calling the index method:
public function index()
{
    $dealer = \App\Autodealer::all();
    return view('plz', array('ausgabe'=>$dealer));
}

It works perfectly fine when my view looks like:

        @foreach ($ausgabe as $dealer)

{{$dealer}}

        @endforeach

But when I use
{{$dealer->coor}}
 instead, no data is displayed.
The coor() funktion should call the belongTo method.
In tinker my data seems to be also unrelated.
What I am missing?
When I use tinker and save a plz object and a Autodealer object with the same id and plz_id, it works.
It seems to be a problem, when I'm importing my data.

A: I think you're missing keys in the coor() relationship. You're not using id in the autodealers table as the foreign key, so you need to set that in the relationship.
public function coor()
{
    return $this->belongsTo('App\plz', 'id', 'plz_id');
}

A: When I used Tinker I noticed, that I could not save an object without updated_at, created_at.
Tinker throws this SQL-Error:
Illuminate/Database/QueryException with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list' (SQL: insert into plzs (id, updated_at, created_at) values (33611, 2020-07-02 11:18:12, 2020-07-02 11:18:12))'
So I added timestamps to my Tables:
public function up()
{
    Schema::create('plzs', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->text("Ort");
        $table->decimal('Latitude', 10, 8);
        $table->decimal('Longitude', 11, 8);
        $table->timestamps();
    });
}

and
public function up()
{
    Schema::create('autodealers', function (Blueprint $table) {
        $table->bigIncrements('id');
        //connect to the plzs table via reference to plz table
        $table->unsignedBigInteger('plz_id');
        $table->text("Händler");

        //index for any foreign key
        $table->index('plz_id');
        $table->timestamps();
    });
}

In mySQL the updated_at, created_at colums of each table must have set additionally CURRENT-TIME standard, in order fill the updated_at and created_at colums during the import of csv-data.
Best Regards


text:
Q: JQuery rotation forward and backward animation I am trying to make plus to cross toggle button. Ive already created a transforming forward animation with transition but i cant figure out how to make slight transition to backwards. Thanks in advance!

Here is my code snippets.

blabla

  .tog-holder{
    position:relative;
    width:32px;
    height:32px;
    padding:15px 0;
    cursor: pointer;
    border-radius: 50%;
    background: url(https://rscua.com/wp-content/uploads/2020/05/plus_icon-icons.com_69322.png);
    background-size: cover;
  }

.animaterotate {
  transform: rotate(45deg);
  transition:all .2s ease-in-out;
}

 jQuery(document).ready(function(){

            jQuery(".anim").hide();
            jQuery(".tog-holder").click(function(){
               jQuery(this).toggleClass('animaterotate');
                jQuery(this).next(".anim").slideToggle();
            });

        });

A snippit to work with:

jQuery(document).ready(function() {

  jQuery(".anim").hide();
  jQuery(".tog-holder").click(function() {
    jQuery(this).toggleClass('animaterotate');
    jQuery(this).next(".anim").slideToggle();
  });

});
.tog-holder {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 15px 0;
  cursor: pointer;
  border-radius: 50%;
  background: url(https://rscua.com/wp-content/uploads/2020/05/plus_icon-icons.com_69322.png);
  background-size: cover;
}

.animaterotate {
  transform: rotate(45deg);
  transition: all .2s ease-in-out;
}

blabla

A: I made a small change on your css and jquery code.
Therefore, I used "hasClass" to check the state of the rotation without really using the 'animaterotate' for css directly.
NEW VERSION:

jQuery(document).ready(function() {
  jQuery(".anim").hide();
  jQuery(".tog-holder").click(function() {
    if(!jQuery(this).hasClass('animaterotate'))
      jQuery(this).css("transform", "rotate(45deg)");
    else
      jQuery(this).css("transform", "rotate(0deg)");

    jQuery(this).toggleClass('animaterotate');
    jQuery(this).next(".anim").slideToggle();
  });
});
.tog-holder {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 15px 0;
  cursor: pointer;
  border-radius: 50%;
  background: url(https://rscua.com/wp-content/uploads/2020/05/plus_icon-icons.com_69322.png);
  background-size: cover;
  transition: all .2s ease-in-out;
}

blabla

OLD VERSION:

jQuery(document).ready(function() {

  jQuery(".anim").hide();
  jQuery(".tog-holder").click(function() {
    if(!jQuery(this).hasClass('animaterotate'))
    {
      jQuery(this).css("transform", "rotate(45deg)");
    }
    else
    {
      jQuery(this).css("transform", "rotate(0deg)");
    }
    jQuery(this).css("transition", "all .2s ease-in-out");
    jQuery(this).toggleClass('animaterotate');
    jQuery(this).next(".anim").slideToggle();
  });

});
.tog-holder {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 15px 0;
  cursor: pointer;
  border-radius: 50%;
  background: url(https://rscua.com/wp-content/uploads/2020/05/plus_icon-icons.com_69322.png);
  background-size: cover;
}

blabla

A: I added another class while going back.
        jQuery(".anim").hide();
        jQuery(".tog-holder").click(function(){
           jQuery(this).toggleClass('animaterotate');
           if(!jQuery(this).hasClass('animaterotate')) {
              jQuery(this).addClass('animaterotate2');
           }
           else {
               jQuery(this).removeClass('animaterotate2');
           }
           jQuery(this).next(".anim").slideToggle('2000');

        });

   .animaterotate2 {
     transform: rotate(0deg);
     transition:all .2s ease-in-out;
   }


text:
Q: Is it possible to cross-play Minecraft Pocket Edition with PC? Can you cross-play with people playing in Minecraft Pocket Edition, with Minecraft PC edition?
I don't have the digital money, or the permission to pay for Minecraft PE, and all of my friends are on the Pocket Edition, and I want to play with them.

A: No, it is currently not possible to play on the same server with Minecraft Java Edition and Minecraft Pocket/Windows 10 Edition and it is also not planned to add that ability.
But, if your PC has Windows 10, you can get the Windows 10 Edition for free if you go to this page: http://account.mojang.com/me


text:
Q: Most light weight conversion from hex to byte in c#?
Possible Duplicate:
How do you convert Byte Array to Hexadecimal String, and vice versa?

I need an efficient and fast way to do this conversion.  I have tried two different ways, but they are not efficient enough for me.  Is there any other quick method to accomplish this in a real-time fashion for an application with huge data?
  public byte[] StringToByteArray(string hex)
    {
        return Enumerable.Range(0, hex.Length / 2).Select(x => Byte.Parse(hex.Substring(2 * x, 2), NumberStyles.HexNumber)).ToArray();
    }

The above one felt more efficient to me.
 public static byte[] stringTobyte(string hexString)
    {
        try
        {
            int bytesCount = (hexString.Length) / 2;
            byte[] bytes = new byte[bytesCount];
            for (int x = 0; x < bytesCount; ++x)
            {
                bytes[x] = Convert.ToByte(hexString.Substring(x * 2, 2), 16);
            }
            return bytes;
        }
        catch
        {
            throw;
        }

A: As a variant of Jon's if based ParseNybble:
public static byte[] ParseHex(string hexString)
{
    if ((hexString.Length & 1) != 0)
    {
        throw new ArgumentException("Input must have even number of characters");
    }
    byte[] ret = new byte[hexString.Length / 2];
    for (int i = 0; i < ret.Length; i++)
    {
        int high = ParseNybble(hexString[i*2]);
        int low = ParseNybble(hexString[i*2+1]);
        ret[i] = (byte) ((high << 4) | low);
    }

    return ret;
}

private static int ParseNybble(char c)
{
    unchecked
    {
        uint i = (uint)(c - '0');
        if(i < 10)
            return (int)i;
        i = ((uint)c & ~0x20u) - 'A';
        if(i < 6)
            return (int)i+10;
        throw new ArgumentException("Invalid nybble: " + c);
    }
}

A: I took the benchmarking code from the other question, and reworked it to test the hex to bytes methods given here:
HexToBytesJon: 36979.7 average ticks (over 150 runs)
HexToBytesJon2: 35886.4 average ticks (over 150 runs)
HexToBytesJonCiC: 31230.2 average ticks (over 150 runs)
HexToBytesJase: 15359.1 average ticks (over 150 runs)

HexToBytesJon is Jon's first version, and HexToBytesJon2 is the second variant.
HexToBytesJonCiC is Jon's version with CodesInChaos's suggested code.
HexToBytesJase is my attempt, based on both the above but with alternative nybble conversion which eschews error checking, and branching:
    public static byte[] HexToBytesJase(string hexString)
    {
        if ((hexString.Length & 1) != 0)
        {
            throw new ArgumentException("Input must have even number of characters");
        }
        byte[] ret = new byte[hexString.Length/2];
        for (int i = 0; i < ret.Length; i++)
        {
            int high = hexString[i*2];
            int low = hexString[i*2+1];
            high = (high & 0xf) + ((high & 0x40) >> 6) * 9;
            low = (low & 0xf) + ((low & 0x40) >> 6) * 9;

            ret[i] = (byte)((high << 4) | low);
        }

        return ret;
    }

A: If you really need efficiency then:

*

*Don't create substrings

*Don't create an iterator

Or, and get rid of try blocks which only have a catch block which rethrows... for simplicity rather than efficiency though.
This would be a pretty efficient version:
public static byte[] ParseHex(string hexString)
{
    if ((hexString.Length & 1) != 0)
    {
        throw new ArgumentException("Input must have even number of characters");
    }
    int length = hexString.Length / 2;
    byte[] ret = new byte[length];
    for (int i = 0, j = 0; i < length; i++)
    {
        int high = ParseNybble(hexString[j++]);
        int low = ParseNybble(hexString[j++]);
        ret[i] = (byte) ((high << 4) | low);
    }

    return ret;
}

private static int ParseNybble(char c)
{
    // TODO: Benchmark using if statements instead
    switch (c)
    {
        case '0': case '1': case '2': case '3': case '4':
        case '5': case '6': case '7': case '8': case '9':
            return c - '0';
        case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
            return c - ('a' - 10);
        case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
            return c - ('A' - 10);
        default:
            throw new ArgumentException("Invalid nybble: " + c);
    }
    return c;
}

The TODO refers to an alternative like this. I haven't measured which is faster.
private static int ParseNybble(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    c = (char) (c & ~0x20);
    if (c >= 'A' && c <= 'F')
    {
        return c - ('A' - 10);
    }
    throw new ArgumentException("Invalid nybble: " + c);
}


text:
Q: After hitting "Power Cycle" on DigitalOcean, the app doesn't work I needed to create an image of the current droplet on DigitalOcean, so I powered off the droplet from dashboard, created the new image of the current droplet and then wanted to turn on the droplet again. So I hit "Power Cycle".
The problem is that after 10 minutes, the app is still not up. What happened and, how can I fix it?
Thanks

A: It sounds like the application may not be configured to start on boot. The power cycle feature at DO is basically just a gentle reboot (it tries to wait for things to shut down instead of deploying more harsh methods to stop the processes). Does the application start up if you SSH in and start it manually? If so, next check on what starts it automatically at boot. It might have encountered an error (environment errors are common) and should have reported somewhere (syslog, application log, etc.).
Just to help you out moving forward, DO supports live snapshots now, so you should be able to snapshot your droplet without powering it off. :)


text:
Q: MongoDB stops working but doesn't crash when ingesting large amounts of records I am currently trying to ingest very large amounts of very simple text data into a MongoDB collection with a full-text index and two regular indexes. I've noticed a pretty bizarre behavior where, sometimes after 4 million records, sometimes after 44 million records... MongoDB will just stop working.
By stop working I mean that Mongo will no longer accept connections or process any more data. It has not crashed, as the service is still "running". It's barely using any CPU and is not using any disk IO. There are no useful logs generated by Mongo or in dmesg. This state is usually unrecoverable, and requires me to forcefully kill and remove the docker container/volume and start over.
To ingest the records into Mongo, I am using a Node.JS script that is reading the source data line-by-line into a buffer of size 10,000 and using the Mongo bulkWrite function to pass the data.
I've tried looking for any type of logging that would be useful, but the only logs that exist are just thousands of "insert slow query" warnings that are to be expected.
It's safe to say that the hardware this is running on is more than adequate for this task.


text:
Q: Show that $\int_0^1 \frac{\ln^3(x)}{1+x} dx = \sum_{k=0}^{\infty}(-1)^{k+1} \frac6{(k+1)^4}$ Show that;

$$ \int_0^1 \frac{\ln^3(x)}{1+x} dx = \sum_{k=0}^{\infty}(-1)^{k+1} \frac6{(k+1)^4}$$

I arrived to the fact that
$$ \int_0^1 \frac{\ln^3(x)}{1+x} dx = \sum_{k=0}^{\infty}(-1)^k\int_0^1 x^k \ln^3(x)dx$$
But I am unable to continue further.

A: An alternative approach is to use differentiation under the integral sign. For any $\alpha > 0$ we have
$$ \int_{0}^{1}\frac{x^{\alpha}}{1+x}\,dx = \sum_{n\geq 0}(-1)^n\int_{0}^{1}x^{\alpha+n}\,dx = \sum_{n\geq 0}\frac{(-1)^n}{n+\alpha+1}\tag{1}$$
hence by differentiating three times wrt $\alpha$ both sides of $(1)$ we get:
$$ \int_{0}^{1}\frac{x^{\alpha}\log^3(x)}{1+x}\,dx = \sum_{n\geq 0}\frac{6(-1)^{n+1}}{(n+\alpha+1)^4}\tag{2}$$
and by considering the limit s $\alpha\to 0^+$:
$$ \int_{0}^{1}\frac{\log^3(x)}{1+x}\,dx = 6\sum_{n\geq 1}\frac{(-1)^n}{n^4} = -\frac{21}{4}\zeta(4)=\color{red}{-\frac{7\pi^4}{120}}\tag{3} $$
follows.

A: Just integrate by parts:
\begin{align*}
\int_0^1 x^k \ln^3(x) \, dx &= \frac{x^{k + 1}}{k + 1} \ln^3 x \big|_0^1 - \int_0^1 \frac{x^{k + 1}}{k + 1} 3 \ln^2(x) \frac 1 x \, dx \\
&= -\frac{3}{k + 1} \int_0^1 x^k \ln^2(x) \, dx
\end{align*}
The next application reverses the sign, picks up factor $2/(k + 1)$, and drops the power on the log by $1$. Continue until the log disappears.

A: The substitution $u=-\ln x$ rewrites the integral as $$-\int_0^\infty \frac{u^3e^{-u}du}{1+e^{-u}}=\sum_{k=0}^\infty\left(-1\right)^{k+1}\int_0^\infty u^3e^{-\left(k+1\right)u}du.$$ The substitution $v=\left(k+1\right)u$ in $\int_0^\infty v^3 e^{-v}dv=3!=6$ obtains $$\int_0^\infty u^3e^{-\left(k+1\right)u}du=\frac{6}{\left(k+1\right)^4},\,\int_0^1\frac{\ln^3x}{1+x}dx=6\sum_{k=0}^\infty\frac{\left(-1\right)^{k+1}}{\left(k+1\right)^4}.$$

A: We begin with the substitution $$x=\mathrm{e}^{-y}$$ so our integral becomes
\begin{equation}
-\int\limits_{0}^{\infty} \frac{y^{3}}{1+\mathrm{e}^{\,y}} \mathrm{d} y
\end{equation}
This integral is a Mellin transform of the function
\begin{equation}
f(y) = \frac{1}{1+\mathrm{e}^{\,y}}
\end{equation}
where the Mellin transform is defined as
\begin{equation}
\mathcal{M}[f(x](s) = \int\limits_{0}^{\infty} x^{s-1} f(x) \mathrm{d} x
\end{equation}
From Tables of Integral Transforms (Bateman Manuscript) Volume 1, we have
\begin{equation}
\mathcal{M}[(\mathrm{e}^{\alpha x} + 1)^{-1}](s) = \frac{1}{\alpha^{s}} \Gamma(s) (1-2^{1-s}) \zeta(s)
\label{eq:1}
\tag{1}
\end{equation}
With $$s = 4 \quad \mathrm{and} \quad \alpha = 1$$ we have
\begin{equation}
-\int\limits_{0}^{\infty} \frac{y^{3}}{1+\mathrm{e}^{y}} \mathrm{d} y = -\Gamma(4) (1-2^{1-4}) \zeta(4) = -\frac{7\pi^{4}}{120}
\end{equation}
Thus
\begin{equation}
\int\limits_{0}^{1} \frac{\mathrm{ln}^{3}(x)}{1+x} \mathrm{d} x = -\frac{7\pi^{4}}{120}
\end{equation}
Addendum
We can rewrite \eqref{eq:1} as
\begin{align}
\mathcal{M}[(\mathrm{e}^{\alpha x} + 1)^{-1}](s) & = \frac{1}{\alpha^{s}} \Gamma(s) (1-2^{1-s}) \zeta(s) \\
& = \frac{1}{\alpha^{s}} \Gamma(s) \eta(s)
\end{align}
where
\begin{equation}
\eta(s) = (1-2^{1-s}) \zeta(s) = \sum\limits_{n=1}^{\infty} \frac{(-1)^{n-1}}{n^{s}}
\end{equation}
is the Dirichlet eta function, also known as the alternating Riemann zeta function.
Note that for Wolfram Alpha, $\eta(s)$ defaults to the Dedekind eta function. To obtain the Dirichlet eta function type "dirichlet eta(s)".

A: Substitute $x=e^{-u}$:
$$
\begin{align}
\int_0^1\frac{\log^3(x)}{1+x}\,\mathrm{d}x
&=-\int_0^\infty\frac{u^3}{1+e^{-u}}e^{-u}\,\mathrm{d}u\\
&=\int_0^\infty\sum_{k=1}^\infty(-1)^ku^3e^{-ku}\,\mathrm{d}u\\
&=\int_0^\infty u^3e^{-u}\sum_{k=1}^\infty\frac{(-1)^k}{k^4}\,\mathrm{d}u\\
&=3!\sum_{k=1}^\infty\frac{(-1)^k}{k^4}\\
\end{align}
$$

A: $\newcommand{\angles}[1]{\left\langle\,{#1}\,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,\mathrm{Li}_{#1}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
\color{#f00}{\int_{0}^{1}{\ln^{3}\pars{x} \over 1 + x}\,\dd x} & =
\lim_{\mu \to 0}\,\partiald[3]{}{\mu}\int_{0}^{1}{x^{\mu} \over 1 + x}\,\dd x =
\lim_{\mu \to 0}\,\partiald[3]{}{\mu}
\int_{0}^{1}{x^{\mu} - x^{\mu + 1} \over 1 - x^{2}}\,\dd x
\\[5mm] & \stackrel{x^{2}\ \mapsto\ x}{=}\
\half\,\lim_{\mu \to 0}\,\partiald[3]{}{\mu}\bracks{%
\int_{0}^{1}{x^{\mu/2 - 1/2}\,\,\, -\,\,\, x^{\mu/2} \over 1 - x}\,\dd x}
\\[5mm] & =
\half\,\lim_{\mu \to 0}\,\partiald[3]{}{\mu}\bracks{%
\int_{0}^{1}{1 - x^{\mu/2} \over 1 - x}\,\dd x -
\int_{0}^{1}{1 - x^{\mu/2 - 1/2} \over 1 - x}\,\dd x}
\\[5mm] & =
\half\,\lim_{\mu \to 0}\,\partiald[3]{}{\mu}
\bracks{\Psi\pars{\mu + 2 \over 2} - \Psi\pars{\mu + 1 \over 2}}\tag{1}
\end{align}
where $\ds{\Psi}$ is the Digamma Function. In $\ds{\pars{1}}$ we used the
identity:
$\ds{\Psi\pars{\xi} = -\gamma + \int_{0}^{1}{1 - t^{\xi - 1} \over 1 - t}
\,\dd \xi}$ with $\ds{\Re\pars{\xi} > 0}$.

\begin{align}
\color{#f00}{\int_{0}^{1}{\ln^{3}\pars{x} \over 1 + x}\,\dd x} & =
{1 \over 16}\bracks{\Psi'''\pars{1} - \Psi'''\pars{\half}} =
\color{#f00}{-\,{7 \over 120}\,\pi^{4}} \approx -5.6822
\end{align}

Some values of $\ds{\Psi'''}$ are well known:
  $\ds{\Psi'''\pars{1} = 3! \times \zeta\pars{4} = {1 \over 15}\,\pi^{4}\,,\qquad
\Psi'''\pars{\half} = 3! \times 15 \times \zeta\pars{4} = \pi^{4}}$
  with
  $\ds{\zeta\pars{4} = {1 \over 90}\,\pi^{4}}$.


text:
Q: How to find out, is a logged in user having view all or modify all permission How can I get in my service class(Apex class) that a logged in user is having view all and modify all permissions on any particular object.

A: You can query the permissionsetassignment object to determine if a user has PermissionsViewAllData or PermissionsModifyAllData (I believe, check the documentation). See https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_permissionsetassignment.htm for more information.
Edit: You can also query for specific objects. The items mentioned above are the global permissions.


text:
Q: Countable dense subset of Baire (ω^ω)
Prove that
$$
D =
\{ f \in \mathbb{N}^\mathbb{N} \mid \exists i \forall j \geq i f(j) = 0 \}
$$
is a countable dense subset of $\mathbb{N}^\mathbb{N}$ (Baire).

Here is the theorem about the Seperability of Baire space. How can I start? Actually isn't it's clear that for all s finite sequence there at least one x eventually goes with 0? how can I show it more formally?

A: Every basic open set of Baire space is determined by an initial segment.
So every such sets contains (lots of) sequences that are eventually $0$: after the initial segment condition has been satisfied, we're free to choose coordinates..
So the set of eventually $0$ sequences (or eventually $1$ sequences etc) are dense in Baire space (i.e. $\omega^\omega$)


text:
Q: Mount server folder locally on windows 7 I generally use Linux systems for most of my work, and some work I need to do on specific machines as I can only run certain software on each machine. I have a Windows 7 machine on which I have Publisher 2013, and need to access and modify files on a Linux machine.
If it was a Linux machine, I could use the 'Connect to server' function integrated into the File Manager (Nautilus, Nemo, etc) to connect over FTP or SFTP (FTP over SSH, sort of):

This mounts the attached 'server' as a folder on the machine, meaning files can be modified remotely as though they were attached locally.

I am aware of FTP clients like Filezilla, but I think this would involve manually transferring files to update them in the local and remote directories. I also know about SMB/samba, I would prefer to use SFTP (please).
Is there a alternative I can use on Windows 7 64bit?

A: Yes, there are a number of 3rd-party tools that will enable something like this on Windows.

*

*Swish

*Netdrive

*win-sshfs
are three that I'm aware of.

A: A much easier option is to use sshfs-win.
and here is how to go about it based on the official docs:

Installation

*

*Install the latest version of WinFsp.

*Install the latest version of SSHFS-Win. Choose the x64 or x86 installer according to your computer's architecture.

Basic Usage

Once you have installed WinFsp and SSHFS-Win you can map a network
drive to a directory on an SSHFS host using Windows Explorer or the
net use command.
Windows Explorer
----    In Windows Explorer select This PC > Map Network Drive and enter the desired drive letter and SSHFS path using the following UNC
syntax: \\sshfs\REMUSER@HOST[\PATH]
The first time you map a particular SSHFS path you will be prompted
for the SSHFS username and password. You may choose to save these
credentials with the Windows Credential Manager in which case you will
not be prompted again.
In order to unmap the drive, right-click on the drive icon in Windows
Explorer and select Disconnect.

Side note:
In case you want to access a specifc directory and not home directory, when you are setting  the map network, you can do :
\\sshfs\username@address\your_relative_path

example :
\\sshfs\rika@192.168.254.29\..\mnt\something


text:
Q: How to clean projects with Premake5? I know how to generate solutions and projects with premake5 with an action like vs2013.
However, how can I remove all generated files without relying on git clean? Is this possible?

A: As this issue said, this action has still not been ported yet (Actually, if you run: premake5 clean, it will show the same description and won't do anything).
However I found that you can write your own ver. of action to clean the build by writing a newaction.
Suppose you build your solution at ./build, then you can write a newaction like:
-- Clean Function --
newaction {
   trigger     = "clean",
   description = "clean the software",
   execute     = function ()
      print("clean the build...")
      os.rmdir("./build")
      print("done.")
   end
}

Then run premake5 clean at the same folder of premake5.lua, and you will see  it will clean for you.

A: Po-Han's answer is a good way to do a centralized cleanup across all projects in the build. If you have some project-specific cleanup you would like to do as well, you can just wrap it in a conditional:
if _ACTION == "clean" then
   os.rmdir("./something")
end


text:
Q: input validation does not work - form gets submitted anyway? I'm creating a website with a form and I can't get the validation to work, and can't figure out what I'm doing wrong. I've tried everything I can think of. The PHP works and it will submit, but it will always submit, and won't stop itself from submitting.

<!DOCTYPE html>

  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="a website for carley Knight art">
  <meta name="keywords" content="art artist painter painting store fine-art">
  <link rel="favicon icon" href="Images/favicon.ico">
  <title>Carley Knight Art</title>
  <link rel="stylesheet" href="style.css">
  <link rel="stylesheet" href="slicknav.css">

Home

About

Gallery

Blog

Shop

FAQs

Homepage

Welcome to Carley Knight Art!

Hello My name is Carley Knight and I'm an artist living in Milwaukee, WI. I make abstract art in a variety of different mediums, including fibers, acrylics, and digital.

      <button id="readMore">Read More</button>

      <form action="sendmail.php" method="post" name="contact_form" id="contact_form">
        <fieldset>
          <legend>sign up now!</legend>

Sign up for my email list and get a free mini coloring book!

          First Name:
          <input type="text" name="first_name" id="first_name">*

          Last Name:
          <input type="text" name="last_name" id="last_name">*

          Email Address:
          <input type="email" name="email" id="email">*

          Verify Email:
          <input type="email" name="verify" id="verify"> *

            <input type="submit" id="submit" value="Sign Up">

        </fieldset>

      </form>

  ©copywrite 2021 Carley Knight Designs

A: In HTML all you have to do is give element input the attribute required.
If you wish for more advanced validation then you have to do it in javascript.

<form>
  <input type="text" required>
  <input value="GO" type="submit">
</form>


text:
Q: Change text view value for all layouts using the same resource file I'm trying to change the value of a text view defined in an XML file for all the layouts that use the above file. The XML file serves as the header for all the pages and I am trying to display the username in the header file without manually having to set that value in each activity file.
textView textElement = (TextView) findViewById(R.id.user_id);
    String user_id_string = Integer.toString(user_id);
    textElement.setText(user_id_string);

From my understanding, you cannot change the actual value of the resource file and the above only changes the value for the specific layout. How can I go about this? Thank you!

A: SharedPreferences can help you.
In the layout-activity where you get user ID, save the value to SharedPreference Variable.
In rest of the layout-activities, populate the value from SharedPreferences in onResume().

A: You are right - there are no specific options in Android SDK to achieve exactly what you want.
But still you can solve this issue with simple encapsulation - just create base ActivityWithHeader class and implement setting of header there. And use it as parent for your others Activities which needs this logic.
Also from the context of your question I think you may find these links helpful:
Re-using Layouts
Data Binding Library


text:
Q: Does Grub2 have a way of uniquely labelling the menu entries that can be used to set the default for booting? Does grub2 have a means of selecting a menu entry by a unique label instead of the current numbering system which results in commands like grub-reboot '1>3', GRUB_DEFAULT="1", GRUB_DEFAULT="1>3"?
What I have in mind are more line the UUIDs used for selecting partitions to boot from, rather than expressions like (hd0,1), (hd1,1) etc. I would prefer to enter random UUIDs in the menu entries and use GRUB_DEFAULT="MENUID=2XDR" rather than numbered entries which are hard to compute?

A: Set the exact name from the menuentry as GRUB_DEFAULT, for example Ubuntu, with Linux 4.4.0-62-generic (upstart), see:
perl -lne "print \$1 if /menuentry '(.*?)'/" /boot/grub/grub.cfg


text:
Q: 12 month rolling data from earliest invoice date - Hadoop Seeking help with the following problem statement.
I/P Data Set:
customer id invoice date    item id invoice amount      Comment
1           10-Jan-2014     1       10                  Start of 12 month window - 10th Jan 2014 to 10th Jan 2015
1           20-Jan-2014     2       20                  Falls within 12 month window
1           21-Aug-2014     1       10                  Falls within 12 month window
1           31-Dec-2014     1       10                  Falls within 12 month window
1           20-Feb-2015     1       10                  Start of new 12 month window as this is post 10th Jan 2015
1           30-Mar-2016     1       10                  Start of new 12 month window as this is post 20th Feb 2016

Desired o/p
customer id invoice date    item id invoice amount  window  sum(amount where item id = 1)
1           10-Jan-2014     1       10              1       10
1           20-Jan-2014     2       20              1       0
1           21-Aug-2014     1       10              1       20
1           31-Dec-2014     1       10              1       30
1           20-Feb-2015     1       10              2       10
1           30-Mar-2016     1       10              3       10

I tried using the following query in Hive to achieve the above output but the challenge is in resetting the next window once we have crossed the 12 month mark. (Please refer to rows 5 and 6 in the input data set). The need is for these records to be considered as start of a new window.
Following Query Used:
SELECT SUM(if(item_id = 1, invoice_amount, 0)) OVER (
    PARTITION BY customer_id
    ORDER BY invoice_date ASC
    RANGE BETWEEN 31556926 PRECEDING AND CURRENT ROW
) FROM INVOICE_DETAILS;`


text:
Q: how to run with --stacktrace flutter I'm trying to run my application -that is working fine with my team members-
but i keep getting this error
FAILURE: Build failed with an exception.

*

*What went wrong:
A problem occurred configuring project ':package_info_plus'.

Could not load compiled classes for build file 'C:\src\flutter\flutter.pub-cache\hosted\pub.dartlang.org\package_info_plus-1.4.3+1\android\build.gradle' from cache.
Failed to notify project evaluation listener.
Could not get unknown property 'android' for project ':package_info_plus' of type org.gradle.api.Project.
Could not get unknown property 'android' for project ':package_info_plus' of type org.gradle.api.Project.

*

*Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

*Get more help at https://help.gradle.org
BUILD FAILED in 16s
Does anyone know the solution or can tell me how to view the stacktrace, I tried going to android studio-> settings-> compiler-> command
and i added --stacktrace but there is no changes in the run

A: try flutter run -d deviceid -v , will give you an insight as to whats happening
You can also cd into the android folder and run ./gradlew build


text:
Q: Life after linear algebra and multivariate calculus I have been following Strang's Linear Algebra course, and found it quite challenging. My goal, however, is to learn application of linear algebra and calculus in applied statistics (regression, linear mixed models, structural equation modeling, et cetera). I want to understand the math behind these techniques. Some people suggest learning abstract algebra after linear algebra. However, after trying one to two lectures by Benedict Gross (on youtube), I find that it is totally not for me - I was lost very soon about what he talked about. In addition, I am unsure if abstract algebra is very useful to applied statistics. Therefore, I am unsure what I should learn after linear algebra and calculus, and I preferably want to learn something with online videos (as self-learning stats can be quite difficult).

A: One place in statistics where abstract algebra (specically finite fields)  is used is  in the construction of mutually orthogonal latin squares which are used in Design of (statistical) Experiments.  Knowing  linear algebra, matrix, eigenvalues, positive definiteness, generalized inverses is the most important thing. You can safely skip abstract algebra and focus on applications of matrices.  One small book that does this well  is  by Bapat (Linear Algebra and Linear Models?) published by Hindustan Book Agency, New Delhi.


text:
Q: CSS - Targetting top nav ul li a:hover only Ok, so I have a jsfiddle of my problem here:  http://jsfiddle.net/WF3QX/1/
Full Screen result is here:  http://jsfiddle.net/WF3QX/1/embedded/result/
I am trying to get rid of the box-shadow inset on a:hover of the submenu that pops up when hovering over the Menu 2 Item, but am not having any luck at all with this.  I'd rather just target the first

  elements and not the

  elements.  I have tried this everyway I can think of by using > symbols to just grab the immediate children, but this doesn't seem to help at all.
HTML is as follows (within the body tag):

Menu 1

            Menu 2

Sub 1

Sub 2

Sub 3

Menu 3

Menu 4

Menu 5

Menu 6

Menu 7

CSS is as follows:
nav#main_menu {
    height: 3em;
    width: 100%;
    background: #A92A23;
    font-size: .8em;
    font-family: "MissionGothic-Regular", "Mission Gothic Regular Regular", "mission_gothicregular";
    position: relative;
    margin-top: -.3em;
    border-bottom: .15em solid #7c211c;
    border-top: .15em solid #7c211c;
    z-index: 1001;
}
ul.menu {
    padding: 0;
    width: 100%;
    height: 3em;
    margin: 0px;
}
nav#main_menu li {
    display: inline;
    margin-left: -.2em;
}
nav#main_menu ul.menu li a {
    display: inline-block;
    width: 13.2%;
    text-align: center;
    text-decoration: none !important;
}
nav#main_menu ul.menu li > a {
    border-right: 1px solid #576979;
    color: #f2efe9;
    background: #A92A23;
    line-height: 3em;
    /* text-shadow: 1px 1px 0px #7c211c; */
    -o-transition: color .2s ease-out, background .5s ease-in;
    -ms-transition: color .2s ease-out, background .5s ease-in;
    -moz-transition: color .2s ease-out, background .5s ease-in;
    -webkit-transition: color .2s ease-out, background .5s ease-in;
    /* ...and now override with proper CSS property */
    transition:color .2s ease-out, background .5s ease-in;
}

nav#main_menu ul.menu li a {
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    text-transform: uppercase;
}
nav#main_menu:first-child li {
    margin-left: 0px !important;
}
nav#main_menu ul.menu li:last-child a {
    border-right: 0;
}
nav#main_menu ul.menu li > a:hover, nav#main_menu ul.menu li > a:active, nav#main_menu ul.menu li.current > a {
    background-color: #f2efe9;
    color: #A92A23;
    -webkit-box-shadow: -0.2em 0px 0.15em -0.2em rgba(0, 0, 0, 0.8), inset 0px 0.7em 0.7em -0.5em rgba(0, 0, 0, 0.5);
    -moz-box-shadow: -0.2em 0px 0.15em -0.2em rgba(0, 0, 0, 0.8), inset 0px 0.7em 0.7em -0.5em rgba(0, 0, 0, 0.5);
    box-shadow: -0.2em 0px 0.15em -0.2em rgba(0, 0, 0, 0.8), inset 0px 0.7em 0.7em -0.5em rgba(0, 0, 0, 0.5);
}
nav#main_menu ul.menu li.current > a {
    height: 3.15em;
    border-left: none;
    border-right: none;
    z-index: 2;
}
nav#main_menu a#pull {
    display: none;
}
.desc, .h4_desc, .desc_bold {
    line-height: 1.5em;
}
li ul.sub_menu {
    display: none;
    position: absolute;
    left: 0;
    top: 3.1em;
    width: 100%;
    height: 0;
    background-color: #f2efe9 !important;
    border-bottom: .15em solid #605953;
    -webkit-transition: height .25s ease .1s;
    -moz-transition: height .25s ease .1s;
    -o-transition: height .25s ease .1s;
    -ms-transition: height .25s ease .1s;
    transition: height .25s ease .1s;
}
li.current ul.sub_menu li {
    overflow: hidden;
    padding: 0;
    float: none;
}
li.current:hover ul.sub_menu {
    height: auto;
    display: block;
}
li.current:hover ul.sub_menu li {
    overflow: hidden;
}
nav#main_menu ul.menu ul.sub_menu a {
    padding: .5em .8em;
    border-left: none;
    border-right: none;
    width: auto !important;
    color: #A92A23 !important;
    background: none !important;
    border: none !important;
    height: 0;
}

I don't want these CSS Rules effecting any other ul elements on the page, so I was kinda strict in the declaration of them.
Basically, what I am really trying to do is to drop down the ul.sub_menu with the transition css code on the height, when the user mouses over Menu 2, which isn't working.  But the other problem I am having, is how to get the a:hover only on the nav#main_menu ul.menu li a:hover elements and not the children a:hover elements of  ul.sub_menu li?

A: get rid of nav#main_menu ul.menu li > a:hover, nav#main_menu ul.menu li > a:active so the box-shadow class only remains on nav#main_menu ul.menu li.current > a.
Working example here: http://jsfiddle.net/WF3QX/3/
Update:
Make the selectors more specific:
nav#main_menu ul.menu > li > a:hover, nav#main_menu ul.menu > li > a:active, nav#main_menu ul.menu > li.current > a
Example: http://jsfiddle.net/WF3QX/5/

A: I think you're just forgetting to use an additional child selector to target the correct links in the first place:
nav#main_menu ul.menu > li > a


text:
Q: Have the major bugs in Stronghold 3 been fixed yet? Stronghold 3 was released on the 25th of October 2011 and contained many bugs. I know the game has been patched through Steam multiple times, but I'm uncertain what those patches have done.
Have any of the major bugs been fixed in Stronghold 3 since its release? Is the current build Stable?

A: You can find the revision history for the Steam version here:
http://store.steampowered.com/news/?appids=47400
It is up to you to compare this list to the bugs the reviews are complaining about and/or you want to see fixed before plunging the money for it.


text:
Q: How to list subdirectories with white space in their names in bash I've found a few similar questions to this but surprisingly none of them work for me.
I have this written in a script:
for d in $(ls -d "$1"); do
echo $d
done
$1 is the parent directory for which I wish to print out the list of subdirectories for, however, running this prints out, for example, a directory named "dir with spaces" as 3 words on separate lines.

A: You can use shell globbing instead of process substitution, which doesn't suffer from word expansion problem:
# to include dotfiles and not iterate empty directory
shopt -s dotglob nullglob

for d in "$1"/*; do
    echo "$d"
done

Or you can resort to pretty common find ... -print0 | xargs -0 ... pattern.


text:
Q: GSAP animate elements in an array fetched from the server I would like to animate each element in an array with TweenMax.staggerFrom. At the moment I created this working sample
import React, { useRef, useEffect createRef } from 'react';
import { TweenMax } from 'gsap';

const AnimateView = () => {
  const data = [
    { title: 'Title 1', value: 1000 },
    { title: 'Title 2', value: 1100 },
    { title: 'Title 3', value: 1200 },
  ];

  const elementsRef = useRef(data.map(() => createRef()));

  useEffect(() => {
    const elements = elementsRef.current.map(el => el.current);

    TweenMax.staggerFrom(elements, 1, { scale: 0 }, 0.3);
  }, []);

  return (
    <>
      {data.map((item, index) => (

{item.title}

      ))}
    </>
  );
};

export default AnimateView;

The difference is that I want data array to be fetched from the server. I cannot figure out why in elementsRef I'm getting no attached refs. Below you can check what I wanted to achieve.
import React, { useRef, useEffect createRef } from 'react';
import { TweenMax } from 'gsap';
import { connect } from 'react-redux';
import { fetchData } from 'actions';

const AnimateView = ({ combineFetching, income }) => {

  const elementsRef = useRef(income.length && income.map(() => createRef()));

  useEffect(() => {
    const elements = elementsRef.current.map(el => el.current);

    TweenMax.staggerFrom(elements, 1, { scale: 0 }, 0.3);
  }, []);

  return (
    <>
      <button onClick={fetchData}>Click</button>
      {income.map((item, index) => (

{item.title}

      ))}
    </>
  );
};

const mapDispatchToProps = state => ({
  income: state.budget.income,
});

export default connect(
  mapDispatchToProps,
  { fetchData },
)(AnimateView);

On Click I want to fetch data from database and animate each element in the array.


text:
Q: New Android Studio project created without drawable-ldpi,drawable-mdpi etc When I create a new Android Studio project (version 2.2 - the latest) my project is created without the drawable-xxxx folders(xxxx refers to the various dpi).
Now I know I can add them myself but there is a way in the creation of a new project in Android Studio to check/uncheck a box that will build those folders for me?

A: In new Android Studio, Click on Project Files tab and you will see all the folders, just put items in them and they will be visible.
Here is sample

OPTION 2:
When you copy a image and then go to your drawable and try to paste it shows you a dialog like this


text:
Q: What's the proper way of using libcURL without the dlls? recently managed to use a libcurl in a test program for downloading a files.
The code is this:
  CURL * curl;
  FILE * fout;
  CURLcode result;
  char * url = "http://blablabla.com/blablabla.txt";
  char filename[FILENAME_MAX] = "blablabla.txt";
  curl = curl_easy_init();
  if (curl)
  {
    fout = fopen(filename,"wb");
    curl_easy_setopt(curl, CURLOPT_URL, url);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, fout);
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
    fclose(fout);
  }

and those things for directives:
#define CURL_STATICLIB
#include <curl/curl.h>

My question is how to make that I don't need to copy all of its dlls in the same dir with the exec to make it work:
libcurl.dll
libeay32.dll
libidn-11.dll
librtmp.dll
libssh2.dll
libssl32.dll
zlib1.dll

Cannot find info about that in the homesite (http://curl.haxx.se) of the library :|

A: You mean, "how do I statically link libcurl"?
5.7 in the FAQ says:

When building an application that uses the static libcurl library, you must add -DCURL_STATICLIB to your CFLAGS. Otherwise the linker will look for dynamic import symbols. If you're using Visual Studio, you need to instead add CURL_STATICLIB in the "Preprocessor Definitions" section.

A: CURL *curl;
CURLcode res;
CString strUser;
FILE *ftplister;
m_FTPUserName.GetWindowTextW (strUser);
CT2CA PUF_File_HostName(PUF_FIle_Host);
CT2CA FTP_UserName(FTP_USERNAME);
FTP_PASSWORD.Append(L":");
FTP_PASSWORD.Append(FTP_USERNAME);
CT2CA FTP_Password(FTP_PASSWORD);
CT2CA FTP_AddressName(FTP_Address);
CString strLocalFile;
CString strFileName;
m_FTPFileName.GetWindowTextW(strFileName);
strLocalFile.Append(FTP_FileName);
strLocalFile.Append(L"\\");
strLocalFile.Append(strFileName);
CT2CA PUF_LocalFile(strLocalFile);
//ofstream stream2(PUF_LocalFile);

curl = curl_easy_init();
if(curl)
{
    ftplister=fopen(PUF_LocalFile,"wb");
    curl_easy_setopt(curl,CURLOPT_URL,PUF_File_HostName);
    if(strUser!=_T(""))
    {
    curl_easy_setopt(curl,CURLOPT_USERPWD,FTP_Password);
    }
    curl_easy_setopt(curl, CURLOPT_FTP_SSL, TRUE);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &write_data);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, ftplister);
    res = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
    fclose(ftplister);
}


text:
Q: Unity - Interception for a WCF service class? i have a client & server application which communicate using WCF. To add some custom session information to each WCF message header i wrapped the client WCF channel into a "ClientChannelProxy" class and used the Unity Interception extension to add my custom header information using aspects.
IUnityContainer container = new UnityContainer();
container.AddNewExtension<Interception>();
container.RegisterType<IClientService, ClientServiceProxy>();
container.Configure<Interception>().SetInterceptorFor<IClientService>(new
TransparentProxyInterceptor());

This works fine for the client since i can easly configure the unity container and  interception using the code shown above.
But how to setup unity and interception on the server side? My WCF service is configured in a .SVC file, i don't have any possiblity to configure interception and getting my aspects executed.
<%@ ServiceHost Language="C#" Debug="true" Service="Test.ClientService" %>
<!-- How to configure Unity Interception for this WCF-Service ? -->

Would ne nice if anyone could help me getting it working.
Thanks!

A: You could enable your WCF service with DI on implementing your own InstanceProvider, ServiceHost, etc. with Unity. So you'll be able to plug your aspect.
Here's an exemple of how it could be achieved  : http://initializecomponent.blogspot.com/2008/06/integrating-unity-with-wcf.html

A: You need to create an inspector/interceptor on the server side. You may refer to this post: WCF Parameter Validation with Interceptor and http://msdn.microsoft.com/en-us/library/ms751495.aspx


text:
Q: Matlab change a single point in a plot without replotting So I have a plot of N points in the 2D plane (N can be very large). I am writing a script that is to show the workings of an algorithm. So I have for loops. At each step in the for loop I'd like to change the color of the current point (actually probably make a stem plot with just this point).
However, at the end of the step I'd like to remove the coloring of the current point so that I can color the next one. Currently I have to redraw the whole plot (incl. the 2D points). I'm not sure whether Matlab detects such things in the plotting commands but is there a way to do this without redrawing the whole plot?
For example:
plot(x,y, '*');

for j = 1:N-1
    for i = j:N
        hold on;
        %Do stuff

        plot(x,y, '*');
        hold on;
        stem(x(1), y(1), 'g*');
    end

end

A: A quick example:
%# plot some data
x = 1:100;
y = cumsum(rand(size(x))-0.5);
plot(x,y,'*-')

%# animate by going through each point
hold on
h = stem(x(1),y(1),'g');
hold off
for i=1:numel(x)
    %# update the stem x/y data
    set(h, 'XData',x(i), 'YData',y(i));

    %# slow down a bit, drawnow was too fast!
    pause(.1)
end

A: Take a look at the documentation of handle graphics objects.
I'd recommend plotting the whole set of points as one object.  Then, for each iteration, plot the point of interest.  Save a handle to it (as in, h = plot(...);).  When you're ready for the next iteration, delete the object using that handle (delete(h)), and create the next one in the same manner.
%# outside the for loop (do this once)
plot(x,y,'*');

for...
    h = stem(x(i),y(i),'g*');
    ...
    %# next iteration... i has been incremented
    delete(h);
    h = stem(x(i),y(i),'g*');
end


text:
Q: Ajax multiple ajax request from online file function addIDS() {
  const imdbIDs = [];
  imdbIDs.push("id1");
  imdbIDs.push("id2");
  ...
  return imdbIDs ;
}

function getThemoviedbIDs(IDs) {
  let arr = [];
  let urls = [];
  for(let i = 0; i < IDs.length; i++) {
    urls.push(`...${imdb_ids[i]}...`);
  }
  $.each(urls, (i, u) => {
    $(function() {
      $.ajax({
        url: u,
        dataType: 'json',
        success: function(data) {
          arr.push(data.tv_results[0].id);
        },
        statusCode: {
          404: function() {
            alert('Err');
          }
        }
      });
    });
  });
  return arr;
}

function getDetails(themoviedbID) {
  console.log(themoviedbID);
  console.log(`...${themoviedbID[0]}`);
}

const imdbIDs = addIDS();
console.log("IMDB IDs: ", imdbIDs);

const themoviedbIDs = getThemoviedbIDs(imdbIDs);
console.log("themoviedbIDs: ", themoviedbIDs);

const themoviedbIDs = getThemoviedbIDs(themoviedbIDs);
console.log("themoviedbIDs: ", themoviedbIDs);

I am using themoviedb database.
populate() I add imdb IDs to the imdbIDs array, then I get themoviedb IDs by getThemoviedbIDs() function.
In the getDetails() function I would like to make ajax request just like in the getThemoviedbIDs() function, but unfortunatelly there is a problem in there. console.log(themoviedbID) output the appropriate array, but console.log(...${themoviedbID[0]}) output .../undefined...
I can get enough information about the series if I am using themoviedb ID.


text:
Q: Why NFT marketplace such as OpenSea can get all nft contracts? I am currious of why Opensea can get all NFT contract information from blockchain? Not only does Opensea, but all the NFT marketplaces. I know that there are APIs from Etherscan or Polygonscan, but I don't find an API which returns all the contract addresses or token names. Or they just contact with Etherscan and get a private API for that fucntion? Are there any web3 experts can help with my question?
Thank you

A: As per the ERC-721 and ERC-1155 standards, when a contract is minting or transferring NFTs, it needs to emit an event.
Marketplaces listen to these events containing collection addresses and token IDs. Combined with another set of standardized functions implemented by the collection contracts, and standardized metadata file format, they are able to automatically retrieve information about:

*

*newly minted NFTs

*their metadata files

*their image files, name, description, and other attributes

and store this information in their own database.


text:
Q: How would I find the height of the task bar? In my windows application, I am trying to find the height of the task bar. While I can hard program this into my program, I would like to find it programmatically to support past, present (win7) and future windows versions.
So, how would I do this?

A: You get it from GetMonitorInfo(), MONITORINFOEX.rcWork member.
Get the HMONITOR that you need to call this function from, say, MonitorFromRect(), passing your window rectangle.  Or MonitorFromPoint() or EnumDisplayMonitors(), depends where you want to display your window.  (0,0) is always the upper left corner of the primary monitor.

A: By searching Google for "height of taskbar c++", I got the following result:

Here's how to get the height of the Windows task bar using the windows functions FindWindow and GetWindowRect.
int MyClass::getTaskBarHeight()
{
    RECT rect;
    HWND taskBar = FindWindow(L"Shell_traywnd", NULL);
    if(taskBar && GetWindowRect(taskBar, &rect)) {
        return rect.bottom - rect.top;
    }
}

Getting the width (should the task bar be on the left or right of the
  screen) can be done using:
rect-right - rect.left

You may want to check if the width is greater than the height. If the width is greater, this means the bar is at the top or bottom. Otherwise, it is on the left/right side of the screen.

A: Ask Windows about it using the ABM_GETTASKBAR message and specifying the hwnd for the taskbar.

A: Probably, you want not only Taksbar, but all other 'bars' on the screen?
All you actually need is SystemParametersInfo(SPI_GETWORKAREA)
SystemParametersInfo, passing SPI_GETWORKAREA as a parameter

Retrieves the size of the work area on the primary display monitor.
  The work area is the portion of the screen not obscured by the system
  taskbar or by application desktop toolbars. The pvParam parameter must
  point to a RECT structure that receives the coordinates of the work
  area, expressed in virtual screen coordinates.

A: There are numerous methods depending on your needs. I used EnumDisplayMonitors() as I needed to test every display to see if it had a taskbar. A method of doing this is:
Use EnumDisplayMonitors() to get a list of all the monitors.
MyInfoEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData)

Inside the callback will give you a handle to a display.
Warning this function will enumerate virtual displays as well: Using the handle to the display, use GetMonitorInfo() with the handle to the display.
This will return the name of the display along with two RECT structures one of the display position and resolution, the other RECT will be the work-area. You will need to do two checks (One for the X, one for the Y) to see if there is a taskbar on the monitor and the height or width of the taskbar.
For example first we check the Y axis:
if(monitor->rcMonitor.top == monitor->rcWork.top &&
monitor->rcMonitor.bottom == monitor->rcWork.bottom)
{
std::cout << "There is no taskbar on the Y axis" << std::endl;
}
else
{
std::cout << "There is a taskbar on the Y axis" << std::endl;
int height = monitor->rcMonitor.bottom - monitor->rcMonitor.top;
int hieghtOfTaskbar = height - (monitor.rcWork.bottom - monitor.rcWork.top);
std::cout << "The height of the taskbar is: " << heightOfTaskbar << std::endl;
}

Then we check the X axis:
if(monitor->rcMonitor.right == monitor->rcWork.right &&
monitor->rcMonitor.left == monitor->rcWork.left )
{
std::cout << "There is no taskbar on the X axis" << std::endl;
}
else
{
std::cout << "There is a taskbar on the X axis" << std::endl;
int width = monitor->rcMonitor.left  - monitor->rcMonitor.right;
int widthOfTaskbar = height - (monitor.rcWork.left - monitor.rcWork.right);
std::cout << "The width of the taskbar is: " << heightOfTaskbar << std::endl;
}

The height or width, depending on position, of the taskbar will usually be the height or the width of the monitor respectively, though this may not always be the case.


text:
Q: If the specific field is double, convert it to Int The number field in my collection can be either Double or Int, and for now it's always equals 1 or 1.0. So I could use this:
db.getCollection('my_collection').update(
   {number:{$type:"double"}},
   {$set: {number: new NumberInt(1)}},
   {multi:true}
)

But what if I have various values, not only 1.0? How do I update each field in collection if it's Double type?
Thank you in advance.


text:
Q: Sorting jsonb in postgresql I have a jsonb column in postgresql in which data are stored as
CREATE TABLE foo(response jsonb);
INSERT INTO foo VALUES
('[{"qs":"field1", "ans":"a"},{"qs":"field2", "ans":"1"}]' :: jsonb),
('[{"qs": "field1", "ans": "d"},{"qs": "field2", "ans": "4"}]' :: jsonb),
('[{"qs": "field1", "ans": "b"},{"qs": "field2", "ans": "3"}]' :: jsonb),
('[{"qs": "field1", "ans": "e"},{"qs": "field2", "ans": "2"}]' :: jsonb)

I need to sort key 'ans' value based on value 'field1' to generate result,
[{"qs": "field1", "ans": "a"}, {"qs": "field2", "ans": "1"}]
[{"qs": "field1", "ans": "b"}, {"qs": "field2", "ans": "3"}]
[{"qs": "field1", "ans": "d"}, {"qs": "field2", "ans": "4"}]
[{"qs": "field1", "ans": "e"}, {"qs": "field2", "ans": "2"}]

field1 | field2
  a    |    1
  b    |    3
  d    |    4
  e    |    2

also sorting based on 'field2',
[{"qs": "field1", "ans": "a"}, {"qs": "field2", "ans": "1"}]
[{"qs": "field1", "ans": "e"}, {"qs": "field2", "ans": "2"}]
[{"qs": "field1", "ans": "b"}, {"qs": "field2", "ans": "3"}]
[{"qs": "field1", "ans": "d"}, {"qs": "field2", "ans": "4"}]

field1 | field2
  a    |    1
  e    |    2
  b    |    3
  d    |    4

is there anyway to achieve this in postgresql???

A: demo:db<>fiddle

I am not sure if you want:

A) sort the JSON objects as they are:
| response                                                     |
| :----------------------------------------------------------- |
| [{"qs": "field1", "ans": "a"}, {"qs": "field2", "ans": "1"}] |
| [{"qs": "field1", "ans": "b"}, {"qs": "field2", "ans": "3"}] |
| [{"qs": "field1", "ans": "d"}, {"qs": "field2", "ans": "4"}] |
| [{"qs": "field1", "ans": "e"}, {"qs": "field2", "ans": "2"}] |

Query for sorting json output:
SELECT
    *
FROM foo
ORDER BY response -> 0 -> 'ans'

Simply query the ans value within ORDER BY clause. If your want to sort by field2, you need to change the 0 into 1 (and maybe cast it into type int: ORDER BY (response -> 1 ->> 'ans')::int)

or B) You want to sort simply the ans values:

field1 | field2
:----- | -----:
a      |      1
b      |      3
d      |      4
e      |      2

Query for sorting ans values:
SELECT
    response -> 0 ->> 'ans' AS field1,
    (response -> 1 ->> 'ans')::int AS field2
FROM
    foo
ORDER BY 1

Create the two columns from parsing the array. field1 is the first element of the JSON array, field2 the second one (indexes 0 and 1). After that you can order these columns ordinarily.


text:
Q: How to enable Seekbar on touch event if it is already disabled, through code in android? I'm making a code in which i set seekbar disabled when it attains some particular position and after disabled it should get enabled if user touched it again. for that i used onTouch Listener. But it didn't enabled once get disabled, here is the code
seek.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {

            seek.setEnabled(true);

            return false;
        }
    });

seek.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress,
                boolean fromUser) {

            if (progress > 23 ) {
                seek.setEnabled(false);
            }
        }
    });

Thanks in advance. Please Help

A: As of my knowledge it is not possible but you can set progress up to 23 only
how much user will scroll it will set at 23 only.
In OnSeekBarChangeListener
public void onProgressChanged(SeekBar seekBar, int progress,
            boolean fromUser) {

        if (progress > 23 ) {
            seek.setProgress(23);
        }
    }

Hope this will helps you.


text:
Q: reading from a text file into a jagged array I found this question in an old question in your website so i thought i can do it but I think I was mistaken :-)
the old post was here
I'm new at the jagged array thing so did the following code
StreamReader rows = new StreamReader("c:\\practice.txt");
            string line;
            int i;
            i=1;
            while ((line = rows.ReadLine()) != null)
            {
                String[][]rows = new String [i][]; ;
                rows = rows.ReadLine();
                String[][] rows = new string[S.Length][];
                i++;
            }
            for (int i; i < S.Length; i++)
            {

                row[i] = S[I].Split(',');

            }

            int totalCounter = 0, totalSum = 0;
            // etc
            foreach(string[] row in rows)
            {
                int m1 = int.Parse(row[3]);
                totalCounter++;
                totalSum += m1;
                switch(row[2])
                {
                    case "male":
                    maleCount++;
                    maleSum += m1;
                        break;
                    case "female":
                        femaleCount++;
                        femaleSum += m1;
                        break;
                }
            }

I know i did major mistakes but at east i tried can any one help me to make it a workin code

A: Firstly, make sure you wrap unmanaged resources such as streams in using statements.
Personally I like my LineReader class which makes it easy to read lines of text from a file (or anything else, actually).
Next, I'd avoid using arrays unless you really have to. List<T> is generally a lot more pleasant to work with. Now if string.Split does what you want, you can easily have a List<String[]>. Alternatively, you can probably do a lot of the work using LINQ:
var query = from line in new LineReader("c:\\practice.txt")
            let parts = line.Split(',')
            select new { Gender=parts[2], Amount=int.Parse(parts[3]) };

Taking multiple aggregates from a single data stream is tricky in "normal" LINQ (which is why Marc Gravell and I developed Push LINQ). However, you can use a normal foreach statement:
int totalCounter = 0, totalSum = 0;
int maleCount = 0, maleSum = 0, femaleCount = 0, femaleSum = 0;
foreach (var row in query)
{
    totalCounter++;
    totalSum += row.Amount;
    switch (row.Gender)
    {
        case "male":
            maleCount++;
            maleSum += Amount;
            break;
        case "female":
            femaleCount++;
            femaleSum += Amount;
            break;
    }
}

If you grouped the rows by gender you might be able to make this even simpler, particularly if you know that the gender is always "male" or "female".

A: You seem to be double-reading the lines, or maybe you've mixed up rows and cells - this bit in particular looks really odd:
        while ((line = rows.ReadLine()) != null)
        {
            String[][]rows = new String [i][]; ;
            rows = rows.ReadLine();
            String[][] rows = new string[S.Length][];
            i++;
        }

i.e. re-declaring rows, two calls to ReadLine per loop, etc. I suspect you mean string.Split? Either way, either use File.ReadAllLines, or look at some of the options presented yesterday. If you are desperate to use arrays, the core might look something like:
using System;
using System.IO;
static class Program
{
    static void Main()
    {
        string[] lines = File.ReadAllLines("foo.txt");
        string[][] grid = new string[lines.Length][];
        for (int i = 0; i < lines.Length; i++)
        {
            grid[i] = lines[i].Split(',');
        }

        int totalCount = 0, maleCount = 0, femaleCount = 0,
            m1Total = 0, m2Total = 0, m3Total = 0,
            m1MaleTotal = 0, m1FemaleTotal = 0;
        foreach (string[] line in grid)
        {
            totalCount++;
            int m1 = int.Parse(line[3]),
                m2 = int.Parse(line[4]),
                m3 = int.Parse(line[5]);
            m1Total += m1;
            m2Total += m2;
            m3Total += m3;
            switch (line[1].Trim())
            {
                case "male":
                    maleCount++;
                    m1MaleTotal += m1;
                    break;
                case "female":
                    femaleCount++;
                    m1FemaleTotal += m1;
                    break;
            }
        }
        Console.WriteLine("Rows: " + totalCount);
        Console.WriteLine("Total m1: " + m1Total);
        Console.WriteLine("Average m1: " + ((double)m1Total)/totalCount);
        Console.WriteLine("Male Average m1: " + ((double)m1MaleTotal) / maleCount);
        Console.WriteLine("Female Average m1: " + ((double)m1FemaleTotal) / femaleCount);
    }
}

Again - I cannot stress enough how much you should be doing this with LINQ instead of manual looping...


text:
Q: Router-links is broken in vue project while links work fine in reality I have my vue project with different router-links. When I build it for hosting and try to check my links using Link Checker it says all my internal links are broken while all internal links work well and bring the user to the proper page in reality.
When I try to check all my links locally on my computer using Link Checker all links are fine.
I would appreciate it if someone helps me figure out what kind of problem it is.
There is my code below:
import {createRouter, createWebHistory} from 'vue-router'
import Main from '../static/Main'

const routes = [
    {
        path: '/',
        name: 'Main',
        component: Main
    },
    {
        path: '/about-us/',
        name: 'about-us',
        component: () => import('../static/AboutUs')
    },
    {
        path: '/about/',
        redirect: '/about-us/'
   },
]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes,
    scrollBehavior: function(to, from, savedPosition) {
        window.scrollTo({ top: 0, behavior: 'smooth' });
    },

})

A: Change /about-us/ to /about-us and /about/ to /about.


text:
Q: dropping table using presto doesn't drop tables from warehouse I am trying to drop a table using presto, actually metadata gets dropped but table data in /user/hive/warehouse still exists.
Upon further digging I found that this behavior was possibly due to the sticky bit which was getting applied to the database and all the tables inside the database.
drwxrwxrwt   - hadoop hadoop          0 2017-11-29 13:40 /user/hive/warehouse/testmanishdb.db
now if I try to remove the sticky bit applied on the database using the below command
hadoop fs -chmod -t  /user/hive/warehouse/testmanishdb.db/

sticky bit gets removed as can be seen below
drwxrwxrwx   - hadoop hadoop          0 2017-11-29 13:44 /user/hive/warehouse/testmanishdb.db
Now going forward if I create a table in presto and drop the table its metadata and corresponding /user/hive/warehouse/ data on the HDFS also gets deleted.
Though this behavior is only observed in presto, even without removing sticky bit if I drop table using hive/spark both metadata and data gets deleted.
Thanks
Manish


text:
Q: Magento 2: Do I need to have separate swatches for every configurable product? TL;DR
Simply put: How to make a configurable product with different images and different prices for each?

To read more:
I was under the assumption that configurable products pull its configuration from other products. If I have 4 options, it will pull the data (price, quantity, image) of the products that are set during the making of the main configurable product.
Let's say I need to create a configurable product (flower bouquet). And this bouquet comes in different arrangements, good, better, best, and deluxe and each has its arrangement has its own price, image, and quantity.
My question is, where do I set the images for a configurable product?

The way I'm doing it now is by:

*

*Create a new configurable product --> Create configuration

*Select Attributes (I would create a new one for this example)

*I will choose 'visual swatch' for -> Catalog Input Type

*Then I will add options in the section: Manage Options (Values of Your Attribute)

Now here where I get confused. Do I add the 4 product photos here, in the attribute?
Because in the next screen, I will also add the details for 4 products. I will set the price, image, quantity, SKU etc.
But at the front end (customer view) the images are being pulled from the switch. (I found out because if I don't set images for the swatch, the little squares under the product title will come blank).
So as for the images I uploaded for each product, what are they for if they won't be shown?
If only the images that come from the switch, does that mean I have to set a different swatch attr for every configurable product?
So here, I don't upload an image for the swatch:

Here, it shows that I have 4 products being set with images:

Obviously, it shows blank squares:

Now I went back and added an image to the attribute (the visual swatch) and refreshed the page:

The front end now shows the swatches with images, but when I click on one, it doesn't update the main product image. Notice I'm selecting an image labeled 2 and hovering over an image labeled 3, and the product shows image labeled 1.