text:
Q: How can I make my pattern view extend without stretching? EDIT - I've worked out what I was originally doing wrong. I was changing the size of the UIScrollView, instead of the pattern subview. I have fixed that, but amended my question with the new problem this has thrown up.
I am making a notes section in my app with a lined-paper effect. The lines are on a separate UIScrollView which responds to scrollViewDidScroll: so the lines and text always move together. My lines are set up like this in viewWillAppear:
CGRect noteLinesRect = CGRectMake(self.view.bounds.origin.x,
                                  self.view.bounds.origin.y,
                                  self.view.bounds.size.width,
                                  noteTextView.contentSize.height+self.view.bounds.size.height);

UIScrollView *anoteXLinesView = [[UIScrollView alloc] initWithFrame:self.view.bounds];
self.noteXLinesView = anoteXLinesView;
[anoteXLinesView release];

LinePatternView *linesPattern = [[LinePatternView alloc] initWithFrame:noteLinesRect];
 self.linesPatternView = linesPattern; [linesPattern release];
[self.noteXLinesView addSubview:self.linesPatternView];
[linesPattern release];

CGPoint newOffset = CGPointMake(self.noteTextView.contentOffset.x, noteTextView.contentOffset.y - NOTE_LINES_OFFSET);
self.noteXLinesView.contentOffset = newOffset;

[self.view insertSubview:self.noteXLinesView atIndex:0];

This works fine when the user first looks at a stored note - all the text is nicely underlined. But when they write more text, eventually they get to the bottom of the lines I created in viewWillAppear and are writing on 'blank paper'. So I need my lined-paper pattern to dynamically get bigger and smaller so it is always a bit bigger than the contentSize of my textView. I am trying to do that like this:
-(void)textViewDidChange:(UITextView *)textView
{
    self.linesPatternView.frame = CGRectMake( self.linesPatternView.frame.origin.x, //-self.noteTextView.contentOffset.y+NOTE_LINES_OFFSET,
                                              self.linesPatternView.frame.origin.y,
                                              self.linesPatternView.frame.size.width,
                                              noteTextView.contentSize.height+self.view.bounds.size.height );
}

The problem is, although the lined-paper pattern does increase in size, it doesn't add new lines at the bottom. Instead, the pattern stretches out and gets bigger as the view gets bigger. What am I doing wrong?

A: One of the solutions is to make 3 views, each containing the lines of the size of your scrollview frame on screen. You position the three one underneath the other in the scrollview and monitor the scrollview through its delegate.
When scrolling down you check:
As soon as the topmost one goes offscreen for more than Y pixels you remove it from the scrollview and insert it underneath the bottom one.
When scrolling up you check:
As soon as the bottommost one goes offscreen for more than Y pixels you remove it from the scrollview and insert it above the top one.

A: Is there a reason you're not simply using a tiled pattern as your background view's backgroundColor? UIColor's +colorWithPatternImage: will let you set a background that'll tile indefinitely and won't stretch as your view resizes. If part of the background has to be different—like the top of your paper, for instance—you can just place an image view containing that at the top of your background view.

A: Fixed! In addition to the changes outlined in my edit to the question above, I just needed to call [self.linesPatternView setNeedsDisplay]; after the resize.


text:
Q: Big Query: How to extract each tables creation time for a data set? For one of my datasets, I am having a new table created at different a time every day.
Is there a way to extract / query these creation times for all tables?

A: This is available as the creationTime field in the tables.get API call.
Purely as an undocumented implementation detail of table wildcards, if you want to quickly fetch this via query you can query the __TABLES__ metatable that exists in a dataset:
SELECT table_id, creation_time FROM <dataset>.__TABLES__

redpajama_set_name: RedPajamaStackExchange


text:
Q: what's the best way to declare and get js object? (pattern) Javascript question.
About pattern or expression, could be duplicate question.
You can get a object using three of them below.
result object works same.
Which pattern is the best when you use heavy javascript web application?
in order,
1. object literal case
2. closure case
3. anonymouse function with new case

function car = {
  name: 'Q5',
  type:'SUV',
  wheels:4,
  door:2,
  score: 0,

  getWheel: function(){return this.wheels;},
  getDoor: function(){return this.door;},
  setScore: function(score){ this.score = score;}
}

var car = (function(){
  var name = 'Q5',
    type ='SUV',
    wheels = 4,
    door = 2,
    score = 0;

  return {
    getWheel: function(){return wheels},
    getDoor: function(){return door},
    setScore: function(_score){ score = _score;}
  }
})();

var car = new function(){
  var name = 'Q5',
    type ='SUV',
    wheels = 4,
    door = 2,
    score = 0;

  this.getWheel = function(){return wheels}
  this.getDoor = function(){return door}
  this.setScore = function(_score){ score = _score;}
}

A: There is no "best" way. There are a few OOP patterns in JavaScript, and the one you mentioned is one of them (and also a popular one). It is essentially a prototypical (or pseudo-classical) pattern with a closure to encapsulate private class-based static variables.
There are other patterns (e.g. the functional pattern recommended by Douglas Crockford).
I personally recommend the pseudo-classical pattern (although which pattern is best is a hot area of debate).
If you are doing OOP with JavaScript, I strongly recommend that you look into adopting a JavaScript library that has OOP built in, such as The Dojo Toolkit or the Closure Library. Other libraries (e.g. jQuery, MOOtools, Ext etc.) all have OOP modules and/or plugins.
Or
While there are no classes in JavaScript, there are constructors and prototypes. These concepts come in handy when you have several objects that are similar (eg users contained in a userlist). Your code sample uses both of these concepts. Using names like myclass, it is hard to tell what you are trying to model. Here's an example of a User constructor and an extention to it's prototype:
var User = function (name) {
    this.name = name;
};

User.prototype.sayHello = function () {
    return "Hello, my name is " + this.name;
};


text:
Q: django model instance in form without model i have a form say:
class ProfileEditForm(forms.Form):
    first_name = forms.CharField(max_length=20)
    last_name = forms.CharField(max_length=20)
    email = forms.EmailField(max_length=50)
    address = forms.CharField(max_length=100)

I want to pass model instance on it so that when user tries to edit their profile they get their existing data on the form.
For some reasons I am not using ModelForm
lets say I have instance user = User.objects.get(pk=pk)
and I want to pass instance like form = ProfileEditForm(instance=user)
I googled and found I can only use instance with model form but can I use it in form too that not from model ?
Thank you

A: Try this:
user = User.objects.filter(pk=pk).values('first_name','last_name','email','address')
form = ProfileEditForm(user[0])


text:
Q: javac error "error: warnings found and -Werror specified" disable "-Werror" in ant this is an android project and my ant build script sometimes fails when it decides to treat warnings as errors when running the javac program. Seriously, it only does this sometimes, which is a different question I may ask.
It will print errors and abruptly cancel the build
[javac] 1 error

[javac] 9 warnings

as I did deeper I see the "error" is
error: warnings found and -Werror specified

which is not anything I explicitly set. Now this may be an argument buried deep in the build.xml file, or maybe in this particular sub library's build.xml file in one particular condition I don't currently know about
It is the android facebook sdk that causes this, sometimes. But there is no Werror argument within the ant build.xml files but I want to disable it or work around it
This is for a build server, where I have other conditions to stop a build. Inconsistent ant and javac issues don't really have a place.
but any insight about it is appreciated.

A: The file "tools/ant/build.xml" under my Android SDK directory contains the following:
<property name="java.compilerargs" value="" />

Perhaps the Android SDK used by the build that fails due to warnings being treated like errors includes "-Werror" in the compiler args?  (If not, a recursive grep for "compilerargs" in the directory of the offending Android SDK instance could find the culprit.)
UPDATE:
On the other hand, that's in my Android SDK, the property is not in itself mandatory -- it just happens to be used here:
<!-- Compiles this project's .java files into .class files. -->
<target name="-compile" depends="-pre-build, -build-setup, -code-gen, -pre-compile">
    <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping...">
        <!-- merge the project's own classpath and the tested project's classpath -->
        <path id="project.javac.classpath">
            <path refid="project.all.jars.path" />
            <path refid="tested.project.classpath" />
            <path path="${java.compiler.classpath}" />
        </path>
        <javac encoding="${java.encoding}"
                source="${java.source}" target="${java.target}"
                debug="true" extdirs="" includeantruntime="false"
                destdir="${out.classes.absolute.dir}"
                bootclasspathref="project.target.class.path"
                verbose="${verbose}"
                classpathref="project.javac.classpath"
                fork="${need.javac.fork}">
            <src path="${source.absolute.dir}" />
            <src path="${gen.absolute.dir}" />
            <compilerarg line="${java.compilerargs}" />
        </javac>

The element that has to be there is the "compilerarg" one on the next-to-last line, so a grep for "compilerarg" instead of "compilerargs" would be the better choice.


text:
Q: How to obfuscate swift code for cocoa pods I have created a pod library. But my code in the library is completely visible when imported. How can I hide the content of code and just show signatures?
It should be something like this.
import Foundation
import WebKit
import UIKit
import SafariServices

internal enum SdkErrorCode : String {

    case INITIALIZATION_PENDING

    case OPERATION_IN_PROGRESS
}

public class XYZ : NSObject, SFSafariViewControllerDelegate {

    public func safariViewControllerDidFinish(_ controller: SFSafariViewController)

    public func setUserCloseCallback(cb: (() -> ())?)

    public func setResponse(url: URL)

    public func activateUser(data: [String : Any], cb: @escaping (([String : Any]) -> Void?)) -> [String : Any]?

    public func loginUser(cb: @escaping (([String : Any]) -> Void?)) -> [String : Any]?

}

A: As others have said, CocoaPods are intended for open source projects, and include all your source code. You want to build a framework or static library.
Do a Google search on "Xcode Create Framework". The top hit I found was this Ray Wenderlich article. Those are generally very good, although I don't know how current that one is. There are quite a few hits in the Google search results however.


text:
Q: How can I set a custom attribute on completeNewPassword? I have the following code
Auth.completeNewPassword(
        user,
        this.profileForm.get('newPassword')?.value,
        {
          "phone_number": String(this.profileForm.get('phone')?.value),
          "given_name": this.profileForm.get('fName')?.value,
          "family_name": this.profileForm.get('lName')?.value,
          "locale": this.profileForm.get('language')?.value,
          "custom:role": "user" // Error when this line is added
        }
      )
      .then(data => console.log("Changed Password! -->", data))
      .catch(err => console.log("Password change failed: ", err));

It fails at the custom:role line and I get the following error:
`Input attributes include non-writable attributes for the client XXXX`

Also, in Cognito, the role attribute doesn't show as a required attribute. How can I set that?

A: OK my previous answer was incorrect, so I deleted it for posterity.
Apparently we have to set the Read and Write permissions of the custom attribute before we can set it using Amplify.
Cool - where do we have this setting? NOT in the Attributes tab of the Cognito Console. It is tucked away in APP CLIENTS tab all the way at the bottom under a toggle called Set attribute read and write permissions. Check the boxes of your custom attribute and you have it.
Terrible UX but at least I have the answer now.
Source: https://forums.aws.amazon.com/message.jspa?messageID=882666


text:
Q: Using Ajax to bring data from database What I'm looking for basically,is a way to bring data from the db, using ajax.
Each time person put the mouseover the category name, I would like the data of this category to pop inside a div.
For some reason the while loop is doing nothing.
It's the first time I'm using ajax, and also I'm not that pro at php.
function showCat(str) {
    if (str == "") {
        document.getElementById("txtHint").innerHTML = "";
        return;
    } else {
        if (window.XMLHttpRequest) {
            // code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        } else {
            // code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
            }
        };
        xmlhttp.open("GET","getcat.php?q="+str,true);
        xmlhttp.send();
    }
}

<?php
$q = intval($_GET['q']);

$con = mysqli_connect('localhost','ipattcoi','6#uP!AR3G_','patt_db');
if (!$con) {
    die('Could not connect: ' . mysqli_error($con));
}

mysqli_select_db($con,"patt_db");
$sql="SELECT * FROM products WHERE category = '".$q."'";
$result = mysqli_query($con,$sql);

echo "

Firstname
Lastname
Age
Hometown
Job

";

while($row = mysqli_fetch_array($result))
{
    echo "
";
    echo "" . $row['product_id'] . "	";
    echo "" . $row['product_name'] . "	";
    echo "" . $row['product_pic'] . "	";
    echo "" . $row['category'] . "	";
    echo "
";
}
echo "
";
mysqli_close($con);
?>

A: Your code works, I was able to copy and run it with minimal modifications (just to re-use my existing table), so check the following:
1) Check you have data in your table, use any mysql client (command line tool, phpmyamdin, etc)
2) Call your getcat.php script directly and see if it actually returns the table (like http://my.server.name/getcat.php?q=something'), just open URL like this in the browser
3) If the above works - open your HTML page which does the ajax request, open developer tools (F12 in chrome and firefox), find the "console" where you can see the js errors. Trigger the request and check for errors.
Besides that, I hope that your code is just for some learning purpose and not for the live application / web-site. Because the way you compose the $sql string is really dangerous, see for example this.
There are also other things I would do differently in the real application:

*

*on the client side - use jquery or other library to do ajax requests, while XMLHttpRequest is a vaild way to do requests, you may find that in real application you'll have to write more code to handle different browsers and different use cases.

*on the server - read and convert data to json, send json to the client and format / insert it there. Again there are libraries to help you with that. What is not good at the moment is that you have part of your html in the php code

*also for a real app I would use some framework (Yii, Laravel, etc) on the php side

A: I assume "txtHint" is the div under which you want to have the category details displayed via AJAX request.
Make sure your select statement retrieves values for the category.     If no records exist for it, while loop does nothing.
a.  Queries are case-sensitive.   It might that $q supplies the category as 'Samsung' but in your database it is stored as 'samsung' and vice versa.  Fix the problem by converting the comparison in sql into uppercase or lowercase.
b.  Check whether $q value is already present in the database.  Fix the  problem by adding or removing the items in category list in your webpage or database.
This has nothing to do with the problem - the table headers are not matching the columns from the database.


text:
Q: Whatever she said, I will/would insist on doing that tomorrow In this following sentence,
which one is better:
whatever she said, I will/would insist on doing that tomorrow.(now I'm speaking)
Because we can just use "would" in the following sentence right?
After he finished this, he would clean the floor.
Thanks in advance

A:
Whatever she said, I will/would insist on doing that tomorrow.

What the sentence means is ambiguous; there is no way of determining which modal is "better" without more context.
I can think of at least seven different things your sentence might mean, depending on whether would has a past-tense or an irrealis sense, on whether it is the "doing" or the "insisting" which is occur tomorrow, and on whether that refers to whatever she said or to something outside the sentence:

*

*I intend to insist on doing whatever she wants, once I find out what she said that is ... This calls for will.

*She said many things on many different occasions last week; my response on each occasion was to insist on doing X tomorrow ... This calls for would.

*I recommend that you insist on doing tomorrow whatever it is she told you to do ... This calls for would.

*I made up my mind beforehand that regardless of what she might say at the scheduled meeting, I was going to insist on doing X tomorrow ... This calls for would.

*I am wholly indifferent to what she said yesterday; I am determined to insist on doing X tomorrow ... This calls for will.

*The strategy I recommend when you meet with her, the strategy I would adopt, is that of insisting on doing X tomorrow regardless of what she says ... This calls for would.
There are more possibilities than these; for instance, there are probably versions in which will/would has a volitive sense rather than the futurive and habitual senses illustrated here.


text:
Q: How to fade in a ListItem if ListItem is of a certain type I have a ListBox, with some ListItems inside. All of the ListItems inherit from my BaseViewModel (using MVVM)
What I'd like to do is if the ListItem is is of type DogViewModel (which inherits BaseViewModel), then for the ListItem to fade in. If the LIstItem is of type CatViewModel, then it will have no 'special' effects.
Initially, all values are of type cat, but the user change the type to a dog, at which point I'd like to see the original fade out and the new fade in. For the moment, I'm only focusing on the fade in.
The code below does not compile, but I'm hoping it will show what I'm trying to achieve (and what I've tried)
<ListBox.ItemTemplate>
    <DataTemplate>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding Group}" Value="{x:Type vm:DogVm}">
                <DataTrigger.EnterActions>
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0.0" To="1.0" Duration="0:0:0.2" />
                        </Storyboard>
                    </BeginStoryboard>
                </DataTrigger.EnterActions>
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>
</ListBox.ItemTemplate>

The problem with the above is it removes my ListItem totally (or makes it invisible, not sure which)
How can I specify in that, in XAML only, that if the item which has just been added to the ObseravableCollection is of N, then fade in?

A: I think DataTrigger instead of EventTrigger is more suitable and you need to use x:Type to specify the bound data to the Item.
Edit:
I answered your question based on your original post. Now, given your current code, I suggest to use a converter.
Here, I have chosen my ItemTemplate to be a Button.
<Window.Resources>
     <d:ObjectToTypeConverter x:Key="convertToType" />
</Window.Resources>

<ListBox.ItemTemplate>
   <DataTemplate>
        <Button x:Name="btn" Content="{Binding Name}"></Button>
        <DataTemplate.Triggers>
             <DataTrigger
                 Binding="{Binding Converter={StaticResource convertToType}}" Value="{x:Type d:DogVm}">
                    <Setter TargetName="btn" Property="Background" Value="Red"/>
            </DataTrigger>
            <DataTrigger Binding="{Binding Converter={StaticResource convertToType}}" Value="{x:Type d:CatVm}">
                 <Setter TargetName="btn" Property="Background" Value="Yellow"/>
            </DataTrigger>
        </DataTemplate.Triggers>
  </DataTemplate>
</ListBox.ItemTemplate>

and here is the converter ...
public class ObjectToTypeConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return value.GetType();
    }
      .....
}

A: You should use DataTemplateSelector. Here is an implementation:
<Window.Resources>
   <DataTemplate x:Key="FirstTemplate">
      <TextBlock Text="{Binding Path=YourProperty}"/>
   </DataTemplate>
   <DataTemplate x:Key="SecondTemplate">
      <TextBlock Text="{Binding Path=YourProperty}" Background="Red"/>
    </DataTemplate>
</Window.Resources>

and DataTemplateSelector:
public class ViewModelDataTemplateSelector : DataTemplateSelector
{
    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    {
        FrameworkElement element;
        //System.Data.DataRowView viewModelItem;
        element = container as FrameworkElement;
        // Tests to ensure that both the item and the container are not null, and that the
        // item is of the expected data type.
        if (element != null && item != null && item is System.Data.DataRowView)
        {
            // Returns the FirstTemplate in the case of a match
            if (item is PersonViewModel)
                return element.FindResource("FirstTemplate") as DataTemplate;
            else
                // Returns the SecondTemplate for other cases
                return element.FindResource("SecondTemplate") as DataTemplate;
        }
        return null;
    }
}

<Window x:Class="MainWindow"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:my="clr-namespace:WpfApplication1"
  Title="MainWindow" Height="350" Width="525" >
<Window.Resources>
   <my:ViewModelDataTemplateSelector x:Key="myTemplateSelector" />
</Window.Resources>
<!-- The code omitted for brevity -->
</Window>

and to select DataTemplateSelector you should use it at ListBox:
<ListBox ItemTemplateSelector="{StaticResource myTemplateSelector}" />


text:
Q: Are there 3D effects on Xubuntu? (hardware-accelerated graphics) Does the default XFCE's window manager offer any 3D eye candy? If it does, how do I enable it after installing the relevant drivers?
I want to install Nouveau's experimental 3D driver (which worked great for me under Ubuntu), libgl1-mesa-dri-experimental, in Xubuntu. But I don't know if just installing it will enable any 3D effects.

A: Xubuntu doesn't come with Compiz so no 3D effects out of the box, but turning on the Composite feature gives you many effects like transparency and shadows plus it allows you to use 3D programs like Docky...
To enable go to:  Applications -> Settings -> XFCE Settings Manager
Then run:  Window Manager Tweaks - Compositor (tab) and Enable
...and from there play with the settings and fancify your desktop :)

A: Xfce by design leaves out much of the eye candy of other systems. There aren't even fancy animations. The most you can get is 2D accelerated compositing if your driver supports it (most do), unless you are willing to install other software.
You have to enable the compositing feature in XFCE's settings manager, and to my memory it will use hardware acceleration automatically. (You may need to do this manually but I am on unity so I cannot test it).

A: In xubuntu 12.10 go to:
Settings Manager -> Window Manager Tweaks and navigate to the last pane "Compositor".
Check the "Enable display compositing"
I know, its not of direct use for a one year old question - but I got stuck in 12.10 and landed on this site. Consider this an update of TenPlus1's answer.

A: AFAIK only KWin and compiz offer opengl/3d based compositing. xfwm4 (i.e. the default window manager of xfce) offers fancy stuffs such as transparency/shadows only. And as far as your drivers question goes installing necessary drivers makes your hardware ready, you still need to enable what is in offer i.e. What @TenPlus suggests in context with xfwm4 to enjoy. You can look into cairo-compmgr for some additional compositing as well which can easily run in top of xfwm4.

A: It's four years old, but there was "Xubuntu + Compiz = Pretty pretty Xubuntu" at http://xubuntublog.wordpress.com/2007/12/09/xubuntu-compiz-pretty-pretty-xubuntu/


text:
Q: How to aggregate across multiple columns in R using dplyr I have the following data frame:
data = data.frame(store=c('A','A','A','A','A','A','A','A','A','A','B','B','B','B','B','B','B','B','B','B'),
prod_id=c('p1','p1','p2','p2','p2','p1','p1','p1','p2','p2','p1','p1','p1','p2','p2','p2','p1','p1','p2','p2'),
Date=c('2017-01-01','2017-01-01','2017-01-01','2017-01-01','2017-01-01','2017-01-02','2017-01-02','2017-01-02','2017-01-02','2017-01-02','2017-01-01','2017-01-01','2017-01-01','2017-01-01','2017-01-01','2017-01-01','2017-01-02','2017-01-02','2017-01-02','2017-01-02'),
sales=c('12','13','15','10','12','9','12','8','7','11','10','1','5','9','6','7','1','4','1','5'))

data

     store prod_id  Date    sales
1      A      p1 2017-01-01    12
2      A      p1 2017-01-01    13
3      A      p2 2017-01-01    15
4      A      p2 2017-01-01    10
5      A      p2 2017-01-01    12
6      A      p1 2017-01-02     9
7      A      p1 2017-01-02    12
8      A      p1 2017-01-02     8
9      A      p2 2017-01-02     7
10     A      p2 2017-01-02    11
11     B      p1 2017-01-01    10
12     B      p1 2017-01-01     1
13     B      p1 2017-01-01     5
14     B      p2 2017-01-01     9
15     B      p2 2017-01-01     6
16     B      p2 2017-01-01     7
17     B      p1 2017-01-02     1
18     B      p1 2017-01-02     4
19     B      p2 2017-01-02     1
20     B      p2 2017-01-02     5

I want to aggregate sales across store-prod_id-Date to get the aggregated data as below:
>data_aggregate

   store prod_id   Date     sales
1     A      p1 2017-01-01    15
2     A      p2 2017-01-01    37
3     A      p1 2017-01-02    29
4     A      p2 2017-01-02    18
5     B      p1 2017-01-01    16
6     B      p2 2017-01-01    22
7     B      p1 2017-01-02     5
8     B      p2 2017-01-02     6

How can the above aggregation be achieved using dplyr or any other aggregate method in R?

A: Something like below using aggregate?
> aggregate(cbind(sales = as.numeric(sales))~.,data,sum)
  store prod_id       Date             sales
1     A      p1 2017-01-01                25
2     B      p1 2017-01-01                16
3     A      p2 2017-01-01                37
4     B      p2 2017-01-01                22
5     A      p1 2017-01-02                29
6     B      p1 2017-01-02                 5
7     A      p2 2017-01-02                18
8     B      p2 2017-01-02                 6


text:
Q: PyQt5 - How to make a push button always has true value when click down and false value when it has up Im just try to use PyQt5 for my robot GUI. im little bit confuse how to use momentary push button which should giving true value when it pressed down and false value when it unpressed. fyi im using python for this.
im already try to use "setCheckable" to detecting its state, but it make the button toggled (not momentary). is there any other methode that i can implement?

A: The clicked signal is always emitted after the mouse button is released in the button rectangle. That's the common convention for a "click event" of buttons in almost any reasonable UI toolkit.
If you want to know when the button is pressed or released, then you can connect to the pressed and released signals.
Be aware, though, that the common convention above also considers that if the user leaves the button while the mouse button is still pressed, the button becomes "unpressed" as well, and becomes pressed again if the mouse goes back inside its geometry while the same mouse button is still pressed. This means that if you connect to those signals and the user "leaves" the button with the mouse button still pressed and gets back to it, you might get inconsistent results depending on your needs.
If you are interested in the basic "just when mouse button was pressed" and "mouse button released at last" state, no matter if the user released the mouse button outside of the widget, then the only option is to override the mouse button handlers and use a custom signal:
from PyQt5 import QtCore, QtWidgets

class IgnoreClickPosButton(QtWidgets.QPushButton):
    pressedState = QtCore.pyqtSignal(bool)
    def mousePressEvent(self, event):
        super().mousePressEvent(event)
        if event.button() == QtCore.Qt.LeftButton:
            self.pressedState.emit(True)

    def mouseReleaseEvent(self, event):
        super().mouseReleaseEvent(event)
        if event.button() == QtCore.Qt.LeftButton:
            self.pressedState.emit(False)

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    btn = IgnoreClickPosButton()
    btn.pressedState.connect(lambda p: print('pressed', p))
    btn.show()
    sys.exit(app.exec_())


text:
Q: Create JSON from path using java I need to create a JSON from path. for e.g my paths and its values looks like below
root/departments[name=dept1]/employees[id=emp1]/firstName = firstName
root/departments[name=dept1]/employees[id=emp1]/lastName = lastName
root/departments[name=dept1]/employees[id=emp2]/firstName = firstName
root/departments[name=dept2]/employees[id=emp1]/firstName = firstName

from this i need to generate json which looks like this.
{
"root": {
    "departments": [
        {
            "name": "dept1",
            "employees": [
                {
                    "id": "emp1",
                    "firstName": "firstName",
                    "lastName": "lastName"
                },
                {
                    "id": "emp2",
                    "firstName": "firstName"
                }
            ]
        },
        {
            "name": "dept2",
            "employees": [
                {
                    "id": "emp1",
                    "firstName": "firstName"
                }
            ]
        }
    ]
}

}
When i checked into JsonPath and JsonPointers this kind of structure is not supported.


text:
Q: API For Google PageSpeed Insight I just setup Google PageSpeed Insight into my Google Webmaster but whenever I am trying to do PageSpeed Test this error occurs "The referrer https://www.googleapis.com/ does not match the referrer restrictions configured on your API key. Please use the API Console to update your key restrictions."
I already created API for my URL and Created Restriction of HTTPS Referrers and submitted my Website in it but still not working.
Any solution for it?

A: You have set your restrictions incorrectly, the error message points you directly to the problem.
Remove all restrictions and try again, then slowly add restrictions until you reach the problem.
If you have restricted Accept requests from these HTTP referrers (web sites) (Optional) then bear in mind you have to verify your site first for some APIs to function correctly.


text:
Q: Relacionamento many-to-many Laravel 5 Boa tarde.
Estou desenvolvendo um sistema em Laravel 5.3 com as seguintes tabelas:

A partir do id de comissão, preciso trazer todos os dados relacionados em uma view onde listará numa tabela quais os parlamentares que fazem parte (um por linha), qual seu cargo na comissão, qual o período de atuação etc.

A: No model Comissao.php deves fazer a tua relação :
...
public function parlamentares() {
    return $this->belongsToMany('App\Parlamentar', 'composicao_comissao', 'cod_comissao', 'cod_parlamentar')->withPivot('dat_designacao', 'cod_periodo_comp', 'ind_titular', 'outras colunas da tabela pivot que queiras aceder via esta relacao');
}
...

Model Parlamentar.php (opcional, visto que não mencionas precisar desta relação na pergunta):
...
public function comissoes() {
    return $this->belongsToMany('App\Comissao', 'composicao_comissao',  'cod_parlamentar', 'cod_comissao')->withPivot('dat_designacao', 'cod_periodo_comp', 'ind_titular', 'outras colunas da tabela pivot que queiras aceder via esta relacao');
}
...

EX:
$comissao_1 = App\Comissao::find(1);

Envias os dados $comissao_1 para a view, e lá podes fazer, ex (parto do princípio que estás a usar template blade):
@foreach($comissao_1->parlamentares as $par)
    {{$par->nome_completo}} -> {{$par->pivot->cod_periodo_comp}}<br>
@endforeach

Nota pivot, são as informações (colunas) a que queres aceder na tabela pivot (composicao_comissao), cod_periodo_comp neste caso. É preciso declara-las na relação dentro dos models, tal como o exemplo acima.
DOCS


text:
Q: Use enum in angular to select drop menu item I want to implement select menu which uses enum data to display data and saved number based on the selected String:
HTML code:

    State
    <select class="custom-select" name="state_raw" [(ngModel)]="merchant.state_raw" id="state_raw" required>
      <option selected></option>
      <option [value]="type" *ngFor="let type of types">{{type | formatType}}</option>
    </select>

Enum which displaying data and translated number value:
export enum MerchantStatusType {
  'Being set up' = 1,
  'Live for processing' = 2,
  'Trading suspended' = 3,
  'Account suspended' = 4
}

Object for the elect menu:
export class MerchantNew {
  constructor(
    public name: string,
    public address_state: string,
  ) {}
}

How can this be implemented? I want to display String but save number into database?
EDIT: I tried this:
ENUM:
export enum MerchantStateType {
  being_set_up = 1,
  live_for_processing = 2,
  trading_suspended = 3,
  account_suspended = 4,
}

export const MerchantStateType2LabelMapping = {
  [MerchantStateType.being_set_up]: "Being set up",
  [MerchantStateType.live_for_processing]: "Live for processing",
  [MerchantStateType.trading_suspended]: "Trading suspended",
  [MerchantStateType.account_suspended]: "Account suspended",
}

Component:
public MerchantStateType2LabelMapping = MerchantStateType2LabelMapping;

public stateTypes = Object.values(MerchantStateType);

HTML code:
<select class="custom-select" name="state_raw" [(ngModel)]="merchant.state_raw" id="state_raw" required>

      <option [value]="stateType" *ngFor="let stateType of stateTypes">{{ MerchantStateType2LabelMapping[stateType] }}</option>

But I get 4 empty rows and 4 lines of the states.

A: I usually do it in 3 steps.
First, declare separate enum and a mapping from enum value to label. This way both enum values and labels can be later changed just in one place without changing any other code.
// FileTypes.enum.ts

export enum FileTypesEnum {
    CSV = "CSV",
    JSON = "JSON",
    XML = "XML",
}

// optional: Record type annotation guaranties that
// all the values from the enum are presented in the mapping
export const FileType2LabelMapping: Record<FileTypesEnum, string> = {
    [FileTypesEnum.CSV]: "Here's Csv",
    [FileTypesEnum.JSON]: "Here's Json",
    [FileTypesEnum.XML]: "Here's Xml",
};

Then import them into a component and stick them in a public property, so they will be available in the view:
// my.component.ts

import {FileTypesEnum, FileType2LabelMapping} from "../FileTypes.enum";

@Component({ ... })
export class MyComponent implements OnInit {
    public FileType2LabelMapping = FileType2LabelMapping;

    public fileTypes = Object.values(FileTypesEnum);

    constructor(){}
}

And then in the view i'm doing ngFor over enum's values and map them to labels:

 <select ...>
  <option *ngFor="let fileType of fileTypes"
          [value]="fileType">
    {{FileType2LabelMapping[fileType]}}
  </option>
</select>

Update:
String-valued and numeric enums compile to different objects
Typescript Playground
So it looks like you have to additionally filter your array
public stateTypes = Object.values(MerchantStateType).filter(value => typeof value === 'number');

A: Another simple way for Making Enum into dropdown or selecct List,

*

*Define Enum

export enum ConditionalOperator {
    Equals="Equals",
    NEquals="NEquals",
    GT="GT",
    GTE="GTE",
    LT="LT",
    }

*In component assign enum to a variable and in the constructor take all enum keys to another defined array

    conditionalOperator = ConditionalOperator;
    enumKeys=[];

    constructor(private fb: FormBuilder) {
      this.enumKeys=Object.keys(this.conditionalOperator);
    }

*And in the HTML file simply iterate through enum keys is an assign value as following,

    <select>
    <option value='' disabled selected>Operator</option>
    <option *ngFor="let name of enumKeys" [value]="name"> {{conditionalOperator[name]}} </option>
    </select>

A: if anyone using NG-ZORRO template.
Follow the above solution[Click], written by @mramsath
Then try this:
Update constructor or leave as it is. i updated for fetching values.
constructor(private fb: FormBuilder) {
      this.enumKeys=Object.values(this.conditionalOperator);
    }

Here is the main part:
<nz-select name="yourFormPostName" #yourFormPostName="ngModel" [(ngModel)]="data.yourFormPostName" nzPlaceHolder="Select Type" nzAllowClear style="width: 95%;">
<nz-option nzDisabled nzLabel="Select" nzValue="disabled"></nz-option>
<nz-option *ngFor="let name of enumKeys" [nzValue]="name" [nzLabel]="name"> </nz-option>
</nz-select>


text:
Q: How to keep footers at the bottom of the page? This is my CSS code
footer {
    position: relative;
    height: 50px;
    width: 100%;
    background-color: white;
}
p.copyright {
    position:absolute;
    width:100%;
    line-height:40px;
    color:red;
    vertical-align:bottom;
    text-align:center;
    bottom:0;
}

This is my aspx HTML code

  Copyright 2017 Anime Toys

I'm trying to keep footers at the bottom of all web pages.
The problem that I'm facing is that some web pages contains small amount of content, the footer can sometimes sit halfway up the page leaving a blank space underneath.
How do I solve this issue?
Can someone fix my code?

A: You can do it with a container element with position: relative; and a footer with position: absolute; and bottom: 0;. The trick is to give the container a min-height: 100vh; to make sure, the footer is at least at the bottom of the page, even if the content before is less then the viewport height.

body {
  margin: 0;
}

.container {
  position: relative;
  min-height: 100vh;
}

footer {
  position: absolute;
  bottom: 0;
  height: 60px;
  width: 100%;
}

p.copyright {
  line-height: 40px;
  color: red;
  text-align: center;
}

  some text

Copyright 2017 Anime Toys

A: Put your content into html5 sections and an outer container with a logical class like "wrapper" and set the following CSS.
Please view full page from snipit to see it in action!
Cheers

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

    .wrapper {
        min-height: 100%;
        position: relative;
    }
    header{
        background-color: #dcdcdc;
        height: 100px;
        width: 100%;
    }
    footer {
        position: absolute;
        bottom: 0;
        left: 0;
        height: 50px;
        width: 100%;
        background-color: white;
    }

    p.copyright {
        width: 100%;
        padding: 10px 0px;
        color: red;
        text-align: center;
        background-color: #f1f1f1;
    }
<!doctype html>

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's
                standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it
                to make a type specimen book. It has survived not only five centuries, but also the leap into electronic
                typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset
                sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker
                including versions of Lorem Ipsum.

                Copyright 2017 Anime Toys

A: NB: Make sure the value for 'padding-bottom' on #content is equal to or greater than the height of #footer.
html,
body {
    margin:0;
    padding:0;
    height:100%;
}
wrapper {
    min-height:100%;
    position:relative;
}
header {
    background:#ededed;
    padding:10px;
}
content {
    padding-bottom:100px; /* Height of the footer element */
}
footer {
    background:#ffab62;
    width:100%;
    height:100px;
    position:absolute;
    bottom:0;
    left:0;
}


text:
Q: word wrap in select option menu How could I wrap the text inside option menu? I want the option value following the width of the select picker. short text works well, but not with long text.
I have tried many things inside this forum but nothing work. I'm using bootstrap classes and no additional css yet.
select option menu with short text

select option menu with long text

                        Program Strategis
                        <select id="programstrategis_id"
                            class="selectpicker data-content form-control @error ('programstrategis_id') is-invalid @enderror"
                            name="programstrategis_id">
                            <option selected disabled>--silahkan pilih program strategis berikut--</option>
                            @foreach ($programstrategis_id as $dataprogramstrategis)
                            <option value="{{ $dataprogramstrategis->id }}">{{$dataprogramstrategis->program_strategis}}
                            </option>

                            @endforeach
                        </select>
                        @error('programstrategis_id')

                            {{ $message }}

                        @enderror

                        Sasaran
                        <select id="sasaran_id"
                            class="selectpicker form-control @error ('sasaran_id') is-invalid @enderror"
                            name="sasaran_id">
                            <option selected disabled>--silahkan pilih sasaran berikut--</option>
                            @foreach ($sasaran_id as $datasasaran)
                            <option value="{{ $datasasaran->id }}">{{$datasasaran->sasaran}}</option>
                            @endforeach
                        </select>
                        @error('sasaran_id')

                            {{ $message }}

                        @enderror

A:
I'm using bootstrap classes and no additional css yet.

Since you're using bootstrap, you can create dropdown using
 or  tag instead of <select>. It's easier to wrap the text inside.
You can set the default width for dropdown-menu class and update white-space property for all of the child items .dropdown-item.

.dropdown-menu {
  width: 170px;
}

.dropdown-menu .dropdown-item {
  white-space: normal;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">

  <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Dropdown button
  </button>

    Action
    Another action
    Something else here Something else here Something else here Something else here Something else here Something else here Something else here

A: Using only CSS, manually wrap the text, as required. Note the options used for the wrapped text are 'disabled' so only the 'titles' can be selected, but this can be undone if required.
    <select style="width: 150px;">
    <option selected="selected" disabled>Wrap Demo</option>
    <option>-- All --</option>
    <option>Title A</option>
    <option disabled>  Lorem ipsum dolor sit amet, consectetur adipiscing elit, </option>
    <option disabled>  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </option>
    <option>Title B</option>
    <option disabled>  Lorem ipsum dolor sit amet, consectetur adipiscing elit, </option>
    <option disabled>  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </option>
    <option>Title C</option>
    <option disabled>  Lorem ipsum dolor sit amet, consectetur adipiscing elit, </option>
    <option disabled>  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. </option>
    </select>


text:
Q: eval() not working with ggplot, returns "non-numeric argument to binary operator" I have the following ggplot element stored as text:
eval(parse(text = " annotate('text', as.Date('2013-12-31'), 30.31049879  * 1.02,
       label = paste0( 19.48 , percent( 0.055 )), color = 'Blue') +
       annotate('text', as.Date('2013-12-31'), 33.341548669  * 1.02,
       label = paste0( 21.43 , percent( 0.048 )), color = 'Blue') "))

eval() returns error "non-numeric argument to binary operator" since it's trying to add the two parts together, but the plus sign is used differently with ggplot. Is there any way to dodge this problem?

A: This was solved by putting ggplot() + at the start of the code, i.e.
eval(parse(text = "ggplot() +
annotate('text', as.Date('2013-12-31'), 30.31049879  * 1.02,
           label = paste0( 19.48 , percent( 0.055 )), color = 'Blue') +
               annotate('text', as.Date('2013-12-31'), 33.341548669  * 1.02,
               label = paste0( 21.43 , percent( 0.048 )), color = 'Blue') "))


text:
Q: Reverse number with while loop I have been studying programmin for 3 months and I don't have a lot of experience so my question maybe silly for someone. This code I wrote in order to read the number in reverse won't run and there is no syntac errors.
public class fdujfdryujhftyh {

    public static void main(String[] args) {
        int a=8023;
        int rev=a%10;
        a=a/10;
        while(a!=0); {
            rev=rev*10+a%10;
            a=a/10;
        }
        System.out.println("Reverse number is"+rev);
        // TODO Auto-generated method stub

    }

}

A: remove the ";" in  "while(a!=0); {"
i think you have made a endless loop so no system.out is shown
You wrote something that is equivalent to
while(a!=0){
  //Do Nothing endless
}

{
     rev=rev*10+a%10;
     a=a/10;
}

A: This works too
int a=8023;

System.out.println("Reverse: " + new StringBuilder(a + "").reverse().toString());

I think you want to make it using math operations, but this way is valid for me. Regards!


text:
Q: Type 'string' has no properties in common with type 'FindOneOptions' I am trying to build a backend with express.js. I now have the following problem:
import { Request, Response } from "express";
import { getManager } from "typeorm";
import { User } from "../entity/user.entity";

export const GetUser = async (req: Request, res: Response) => {
  const repository = getManager().getRepository(User);

  const { password, ...user } = await repository.findOne(req.params.id);

  res.send(user);
};

The following error always occurs:
(parameter) req: Request<ParamsDictionary, any, any, QueryString.ParsedQs, Record<string, any>>
Type 'string' has no properties in common with type 'FindOneOptions'.ts(2559)

router.ts
router.get("/api/users/:id", AuthMiddleware, GetUser);

user.entity.ts
import {
  Column,
  Entity,
  JoinColumn,
  ManyToOne,
  PrimaryGeneratedColumn,
} from "typeorm";
import { Role } from "./role.entity";

@Entity()
export class User {
  @PrimaryGeneratedColumn()
  id: number;
  @Column()
  first_name: string;
  @Column()
  last_name: string;
  @Column({
    unique: true,
  })
  email: string;
  @Column()
  password: string;

  @ManyToOne(() => Role)
  @JoinColumn({ name: "role_id" })
  role: Role;
}

Can anyone help me with my problem?

A: The typeorm's findOne function is equivalent to Select * ... limit 1. This means that the findOne actually expects an object containing conditions to match and return the first element for which the condition is satisfied.
In your case, the code should be:
repository.findOne({where: {id: parseInt(req.params.id, 10)}})

or
repository.findOneBy({id: parseInt(req.params.id, 10)})

This will find the user whose id field will match match the req.params.id.

A: according to manual, use the { criteria: search }
so
findOneBy({id: req.params.id});

A: Anyone migrating from NestJs v7 to v9 will run into this issue because they use different TypeORM versions.
Turns out this was a breaking change on TypeORM side.

Going from v0.2.x to v0.3.x has this breaking change they dropped the findOne(id) method in favor of findOneBy({where : {id: id}})
Check Here: https://typeorm.io/changelog#breaking-changes-1

I have TypeORM v0.3.12:

Here I get the same error

Now the error is resolved:

This video rang the bell for me:  https://www.youtube.com/watch?v=UEFEze_SQKU


text:
Q: cant retrieve relation from belongsToMany with different tablename I got the following tables:
| messages |   | likes      |
| id       |   | id         |
| content  |   | message_id |
               | user_id    |

I want to retrieve all the likes from a message.
Currently I've this relation on the Message model:
public function likes()
{
    return $this->belongsToMany('App\Entities\Like', 'likes', 'message_id', 'id');
}

But when I dd(Message::find($id)->likes()->get()->toArray()); I get a exception:
Syntax error or access violation: 1066 Not unique table/alias: 'likes'

A: You need to define a has many relationship between Message model and Like model.
message.php
public function likes()
{
   return this->hasMany('App\Entities\Like');
}


text:
Q: Directory named "linux-4.13.10" containing content of 13 GB in Downloads? Recently, was trying to free up some space, and I found a directory named "linux-4.13.10" having Size of 13 GB, present in my Downloads.
I couldn't understand why it was there. I updated Ubuntu sometimes ago, and also updated the kernel recently.
Can I delete it, and free up some space or it could mess up the OS.

uname -a

Linux ...... 4.15.0-128-generic #131-Ubuntu SMP Wed Dec 9 06:57:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

(base) imran@imran:~/Downloads/linux-4.13.10$ ls -lah
total 1.1G
drwxrwxr-x  25 imran imran 4.0K Nov  6  2017 .
drwxr-xr-x  21 imran imran  16K Dec 24 23:19 ..
-rw-rw-r--   1 imran imran   22 Nov  5  2017 .10137.d
-rw-rw-r--   1 imran imran   22 Nov  4  2017 .10362.d
-rw-rw-r--   1 imran imran   22 Nov  5  2017 .11603.d
-rw-rw-r--   1 imran imran   22 Nov  5  2017 .14317.d
-rw-rw-r--   1 imran imran   22 Nov  5  2017 .14395.d
-rw-rw-r--   1 imran imran   22 Oct 28  2017 .15038.d
-rw-rw-r--   1 imran imran   22 Nov  5  2017 .15402.d
-rw-rw-r--   1 imran imran   22 Oct 28  2017 .15916.d
-rw-rw-r--   1 imran imran   22 Nov  5  2017 .18544.d
-rw-rw-r--   1 imran imran   22 Oct 28  2017 .24605.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3105.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3331.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3435.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3462.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3541.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3571.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3599.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3636.d
-rw-rw-r--   1 imran imran   21 Nov  6  2017 .3645.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3657.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3674.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3676.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3689.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3715.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3719.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3735.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3799.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3803.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3984.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .3989.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4027.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4059.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4080.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4098.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4122.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4131.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4145.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4160.d
-rw-rw-r--   1 imran imran   21 Nov  6  2017 .4174.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4202.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4203.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4216.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4235.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4237.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4247.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4252.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4266.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4276.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4292.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4403.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4436.d
-rw-rw-r--   1 imran imran   21 Nov  4  2017 .4496.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4541.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4562.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4564.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4685.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .4710.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .5042.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .5161.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .5173.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .5210.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .5217.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .5222.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .5274.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .5323.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .5411.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .5477.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .5706.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .5763.d
-rw-rw-r--   1 imran imran   21 Nov  4  2017 .5850.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .5982.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .6041.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .6381.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .6428.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .6703.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .7436.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .7901.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .7975.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .8164.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .8375.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .8557.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .9125.d
-rw-rw-r--   1 imran imran   21 Nov  6  2017 .9366.d
-rw-rw-r--   1 imran imran   21 Nov  5  2017 .9868.d
drwxrwxr-x  33 imran imran 4.0K Oct 28  2017 arch
drwxrwxr-x   3 imran imran 4.0K Nov  6  2017 block
-rw-rw-r--   1 imran imran 524K Nov  6  2017 built-in.o
drwxrwxr-x   2 imran imran 4.0K Nov  6  2017 certs
-rw-rw-r--   1 imran imran   59 Oct 27  2017 .cocciconfig
-rw-r--r--   1 imran imran 201K Nov  4  2017 config
-rw-rw-r--   1 imran imran  88K Nov  6  2017 .config
-rw-rw-r--   1 imran imran  88K Nov  6  2017 .config.old
-rw-rw-r--   1 imran imran  19K Oct 27  2017 COPYING
-rw-rw-r--   1 imran imran  97K Oct 27  2017 CREDITS
drwxrwxr-x   4 imran imran  28K Nov  6  2017 crypto
drwxrwxr-x 121 imran imran  12K Oct 27  2017 Documentation
drwxrwxr-x 132 imran imran 4.0K Nov  6  2017 drivers
drwxrwxr-x  36 imran imran 4.0K Nov  4  2017 firmware
drwxrwxr-x  74 imran imran  12K Nov  6  2017 fs
-rw-rw-r--   1 imran imran   31 Oct 27  2017 .get_maintainer.ignore
-rw-rw-r--   1 imran imran   30 Oct 27  2017 .gitattributes
-rw-rw-r--   1 imran imran 1.3K Oct 27  2017 .gitignore
drwxrwxr-x  30 imran imran 4.0K Oct 28  2017 include
drwxrwxr-x   2 imran imran 4.0K Nov  6  2017 init
drwxrwxr-x   2 imran imran 4.0K Nov  6  2017 ipc
-rw-rw-r--   1 imran imran 2.3K Oct 27  2017 Kbuild
-rw-rw-r--   1 imran imran  252 Oct 27  2017 Kconfig
drwxrwxr-x  17 imran imran  12K Nov  6  2017 kernel
drwxrwxr-x  12 imran imran  28K Nov  6  2017 lib
-rw-rw-r--   1 imran imran 8.2K Oct 27  2017 .mailmap
-rw-rw-r--   1 imran imran 411K Oct 27  2017 MAINTAINERS
-rw-rw-r--   1 imran imran  59K Oct 27  2017 Makefile
-rw-rw-r--   1 imran imran  485 Nov  6  2017 .missing-syscalls.d
drwxrwxr-x   3 imran imran  12K Nov  6  2017 mm
-rw-rw-r--   1 imran imran 4.8K Nov  6  2017 modules.builtin
-rw-rw-r--   1 imran imran 2.1K Nov  6  2017 modules.order
-rw-rw-r--   1 imran imran 466K Nov  6  2017 Module.symvers
drwxrwxr-x  69 imran imran 4.0K Nov  6  2017 net
-rw-rw-r--   1 imran imran  722 Oct 27  2017 README
drwxrwxr-x  27 imran imran 4.0K Oct 27  2017 samples
drwxrwxr-x  14 imran imran 4.0K Oct 28  2017 scripts
drwxrwxr-x  10 imran imran 4.0K Nov  6  2017 security
drwxrwxr-x  24 imran imran 4.0K Nov  5  2017 sound
-rw-rw-r--   1 imran imran 2.7M Nov  6  2017 System.map
-rw-rw-r--   1 imran imran 1.1M Nov  6  2017 .tmp_kallsyms1.o
-rw-rw-r--   1 imran imran 6.2M Nov  6  2017 .tmp_kallsyms1.S
-rw-rw-r--   1 imran imran 1.1M Nov  6  2017 .tmp_kallsyms2.o
-rw-rw-r--   1 imran imran 6.2M Nov  6  2017 .tmp_kallsyms2.S
-rw-rw-r--   1 imran imran 2.7M Nov  6  2017 .tmp_System.map
drwxrwxr-x   2 imran imran 140K Nov  6  2017 .tmp_versions
-rwxrwxr-x   1 imran imran 258M Nov  6  2017 .tmp_vmlinux1
-rwxrwxr-x   1 imran imran 260M Nov  6  2017 .tmp_vmlinux2
drwxrwxr-x  31 imran imran 4.0K Oct 27  2017 tools
drwxrwxr-x   2 imran imran 4.0K Nov  6  2017 usr
-rw-rw-r--   1 imran imran    3 Nov  6  2017 .version
drwxrwxr-x   4 imran imran 4.0K Oct 28  2017 virt
-rwxrwxr-x   1 imran imran 260M Nov  6  2017 vmlinux
-rw-rw-r--   1 imran imran   99 Nov  6  2017 .vmlinux.cmd
lrwxrwxrwx   1 imran imran   62 Nov  6  2017 vmlinux-gdb.py -> /home/imran/Downloads/linux-4.13.10/scripts/gdb/vmlinux-gdb.py
-rw-rw-r--   1 imran imran 302M Nov  6  2017 vmlinux.o

A: Since it is in your downloads folder I would say it is safe to delete it.

A: That looks like a perfectly ordinary kernel source tree although given the total size I think it's possible you used git to pull in a great deal more than you actually needed.
It should be safe to remove, regardless.
... Also, the current (as of December 2020) 4.x kernel is 4.19, and 5.10 came out not too long ago; if you're still on 4.15 another update may be in order.


text:
Q: The text isn't displaying on expo app. I think the prop is not being passed properly. How should I correct that? The component file:
{  return (
    <TouchableOpacity /* onLongPress={onLongPress} style={[styles.card, backgroundColor]} */>
      <View style={styles.fixToText}>
        <Text style={styles.title}>{item.post_title}</Text>
        <MaterialCommunityIcons
          name="star-outline"
          size={24}
          color="black"/>
        </View>
        <Text style={styles.tasks}>{item.post_info}</Text>
        <View style={styles.fixToText}>
          <Text style={styles.time}>{item.time}</Text>
        </View>
  </TouchableOpacity>
  );
}

App.js file
const App = () => {

  const [tasks,setTasks]= useState([
    {
      id: 1,
      post_title: "NEW Task",
      post_info: "Assigned with the ID",
      time: "1 min ago",
    },
   {
      id: 2,
      post_title: "NEW Task",
      post_info: "Assigned with the ID",
      time: "1 min ago",
    },
  ]);

  return (
    <>
     <Notification task={tasks}/>
    </>
  );
}

I am sure that the props are not being properly passed. Where exactly is it wrong ? I have passed it from App to Component file using {task} . I can only see the star icon though displayed at the side.

A: Are you able to attach the whole component?
it seems like the name should be either props.task[i].post_title
or in case you destruct the props using const {task}=props it should be task[i].post_title


text:
Q: Wave theory limit of geometric optics? Why is geometric optics the low wavelength limit of the wave theory of light? I can't seem to grasp why either a low or high wavelength limit would be necessary.

A: Actually I would answer this almost exactly as @EmilioPisanty answered the a very like question -
https://physics.stackexchange.com/a/65241/26076
this is the way that Born and Wolf "Principles of Optics" do it.
However, I would add as a footnote the following intuitive points:
There is one, unique class of Maxwell Equation solution that fulfills the Eikonal equation exactly and these are the plane waves: their wavevectors are the "rays" in ray optics. These are exactly light travelling in straight lines. However, they are also altogether "delocalized" - spread out evenly over all space, so strictly you can't talk about a ray at a particular place. What one finds in practice though is that if waves are approximately plane so that their phase fronts are flat over several wavelengths or more, they do not tend to spread out much as they propagate. Lasers are the same: the wider your beam, the less it diverges, indeed the divergence angle $\times$ beamwidth product is constant. So you can represent the field coming from a region wherein the phase fronts are flat as a plane wave along the ray with it tail in that region. Another good example is the phased array and dish antennas. They set up a field that is locally plane over many wavelengths, thus achieving a very tight beam. The ray is the spatial analogy of the ideal bandlimited AND time-limited signal often talked about in systems analysis. Theoretically, if something is time-limited, it has infinite bandwidth, but one can do practical analysis by assuming the "ideal" (strictly impossible) case. This is what we do when we draw rays.
Indeed intuitive comments like this lead to the "Ansatz" that Emilio talks of in his other answer: you assume the field is a plane wave multiplied by an "envelope" function that varies slowly in space. The Eikonal equation then results from putting the assumed solution into MAxwell's equations and making approximations.
Does all this sound familiar - it should do: it's exactly how the Heisenberg uncertainty principle works: the momentum operator is just a scalar multiplication in a space that is the Fourier transformed space wherein the position operator amounts to a scalar multiplication. So, the momentum corresponds to wavevectors (the directions of rays) and positions to a place where we can nail the rays' tails down. As long as we don't demand too much precision in either direction or position, rays are a useful model of all waves in this way.
Footnote: I should also say thank you to Emilio Pisanty for bringing to my attention the analogy between the Hamilton Jacobi and Eikonal equation in the answer cited above. I have never really appreciated that until today. Now the standard quantisation procedure Poisson bracket $\mapsto$ Lie bracket suddenly really makes sense to me.
Edit: The following is a code that you can import into Wolfram Mathematica  to do diffraction calculations. You can play with the beam width and so forth and simulate how well the beam will propagate without spreading for different beamwidths and wavelengths. Lines beginning in "#" are comments: Mathematica will read the following if you ask it to open a "text file".
#Index Rotation for Rotated Fourier Transform
[Kappa][k_,n_]:=If[k >= n/2,k-n,k]
#Whether the phase of the diffraction operator is imaginary (i.e. whether wave is evanescent) when the domain width is n samples and the wavelength is Lambda (in samples)
PhaseImaginary[k_,n_,[Lambda]_]:=1-([Kappa][k,n]/n [Lambda])^2<0
#Diffraction Phase Calculation: assume wavelength Lambda (in samples) and propagate through axial distance z
DiffractionPhase[k_,n_,[Lambda],z]:=If[z>= 0,2 [Pi]  z/[Lambda] (-1+Sqrt[1-([Kappa][k,n]/n [Lambda])^2]),If[PhaseImaginary[k,n,[Lambda]], -2 [Pi]  z/[Lambda],2 [Pi]  z/[Lambda] (-1+Sqrt[1-([Kappa][k,n]/n [Lambda])^2])]]
#Diffraction Calculation: Take List x (assumed field samples), assume wavelength Lambda (in samples) and propagate through axial distance z (also in samples)
Diffract[x_,[Lambda],z]:= InverseFourier[Table[Exp[I DiffractionPhase[k,n,[Lambda],z]],{k,0,n-1}] Fourier[x]]
#Domain Width in samples
n:=2048;
#Beam Width in samples
w:= 200;
#Beam Offset in samples
[Delta]:=n/4;
#Beam Tilt Relative z axis (Radians)
[Alpha]:=0.7;
#Beam Wavelength (in samples)
[Lambda]:=20;
#Gaussian Beam
x:= Table[Exp[-((2 (k - [Delta])^2)/w^2)] Exp[2 [Pi]  I/[Lambda] (k-[Delta]) Sin[[Alpha]]],{k,0,n-1}]
#Square Input Beam
x:= Table[If[Abs[k-[Delta]]

ListPlot[Abs[Diffract[x,[Lambda],1000]]^2,PlotRange->All]
ListPlot3D[Table[Abs[Diffract[x,[Lambda],10z]]^2,{z,0,100}],PlotRange->All]


text:
Q: JavaFX: Layout problem with BorderPane - bug or user error? I am experiencing a strange behaviour with a FlowPane within (the center of) a BorderPane.
If I enlarge the width of the window or reduce it, everything is fine. It is just a narrow width +- 5 pixels that causes this effect. Code to reproduce:
public class LayoutBugTest extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    public void start(Stage stage) {
        TextField tf1 = new TextField("");
        TextField tf2 = new TextField("");
        TextField tf3 = new TextField("");
        tf1.setPrefColumnCount(20);
        tf2.setPrefColumnCount(10);
        tf3.setPrefColumnCount(10);
        FlowPane flow = new FlowPane(10,10, tf1,tf2,tf3);

        BorderPane box = new BorderPane();
        box.setTop(new Label("Heading"));
        box.setCenter(flow);
        box.setStyle("-fx-border-width: 2px; -fx-border-color: black; -fx-border-radius: 1em; -fx-padding: 5px;");

        VBox anyLayout = new VBox(5, new Label("Before"), box, new Label("After"));

        Scene scene = new Scene(anyLayout);
        stage.setScene(scene);
        stage.show();
    }

}

Did I miss something or is this a layout bug?

A: This appears to be an odd bug. I added some debugging information.
scene.widthProperty().addListener(evt ->{
        System.out.println( "box: " + box.prefHeight(anyLayout.getWidth()) + ", " + box.minHeight(anyLayout.getWidth()) + ", " + box.getHeight() );
        System.out.println( "flow: " + flow.prefHeight(box.getWidth()) + ", " + flow.minHeight(box.getWidth()) + ", " + flow.getHeight());

    });

When the program is started. The two fields narrow fields are side by side, and the preferred sizes are:

box: 95.0, 95.0, 95.0
flow: 64.0, 64.0, 64.0

As we decrease the width of the window the FlowPane switches orientation, but it's minimum and preferred sizes don't change.

box: 95.0, 95.0, 95.0
flow: 64.0, 64.0, 101.0

When we decrease further and the layout looks good again.

box: 132.0, 132.0, 132.0
flow: 101.0, 101.0, 101.0

So it appears BorderPane is using the correct width for the FlowPane to "layout" but it is using the incorrect width when requesting the preferred height. eg
flow.prefHeight(box.getWidth() - 14);

That pref. height follows the actual height of the FlowLayout. 14 from the padding and the border.


text:
Q: Try/Catch not working with exception name I'm unable to catch what appears to be a ConnectionError. This does not work:
except ConnectionError:
            return {
                'error_status_code': 500,
                'error_message': "Activity Stream connection failed",
            }

But this does work:
except Exception as e:
        if(e.__class__.__name__ == 'ConnectionError'):
            return {
                'error_status_code': 500,
                'error_message': "Activity Stream connection failed",
            }
        else:
            raise e

When printing e using pdb.set_trace(), I get:
ConnectionError(MaxRetryError("HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /v1/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10f00e278>: Failed to establish a new connection: [Errno 61] Connection refused',))",),)
Suggesting that it is a ConnectionError. I've also tried to catch MaxRetryError and NewConnectionError with no effect.
Thanks


text:
Q: How to implement a SwapChainPanel with C++/WinRT and WinUI 3 I'm trying to implement a SwapChainPanel using C++/WinRT and WinUI 3.  I've found answers for C# and WinUI 3 and C++/CX and WinUI, but not my particular combination.
As a start, I create a C++/WinRT app using the "Blank App, Packaged (WinUI 3 in Desktop" template.  I then add the code from the SwapChainPanel section of the "DirectX and XAML interop" page 1 in learn.microsoft.com.
The code compiles and runs, but when I click the button, I get an error in this code:
App::App()
{
    InitializeComponent();

#if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
    UnhandledException([this](IInspectable const&, UnhandledExceptionEventArgs const& e)
    {
        if (IsDebuggerPresent())
        {
            auto errorMessage = e.Message();
            __debugbreak();  <--- Error on this line
        }
    });
#endif
}

The error is:
"A breakpoint instruction (__debugbreak() statement or a similar call) was executed in SCPDemo.exe."
The stack is:
SCPDemo.exe!winrt::SCPDemo::implementation::App::{ctor}::__l2::<lambda>(const winrt::Windows::Foundation::IInspectable & __formal, const winrt::Microsoft::UI::Xaml::UnhandledExceptionEventArgs & e) Line 31   C++
    SCPDemo.exe!winrt::impl::delegate<winrt::Microsoft::UI::Xaml::UnhandledExceptionEventHandler,void <lambda>(const winrt::Windows::Foundation::IInspectable &, const winrt::Microsoft::UI::Xaml::UnhandledExceptionEventArgs &)>::Invoke(void * sender, void * e) Line 4824   C++
    Microsoft.ui.xaml.dll!DirectUI::CFTMEventSource<struct ABI::Microsoft::UI::Xaml::IUnhandledExceptionEventHandler,struct ABI::Microsoft::UI::Xaml::IApplication,struct ABI::Microsoft::UI::Xaml::IUnhandledExceptionEventArgs>::Raise(struct ABI::Microsoft::UI::Xaml::IApplication *,struct ABI::Microsoft::UI::Xaml::IUnhandledExceptionEventArgs *)   Unknown
    Microsoft.ui.xaml.dll!DirectUI::FrameworkApplication::RaiseUnhandledExceptionEvent(long,struct HSTRING__ *,unsigned int *)  Unknown
    Microsoft.ui.xaml.dll!DirectUI::ErrorHelper::RaiseUnhandledExceptionEvent(long,class xstring_ptr const &,unsigned int *)    Unknown
    Microsoft.ui.xaml.dll!DirectUI::ErrorHelper::ProcessUnhandledError(class DirectUI::ErrorInfo &,unsigned int,unsigned int *) Unknown
    Microsoft.ui.xaml.dll!DirectUI::ErrorHelper::ReportUnhandledError(long) Unknown
    Microsoft.ui.xaml.dll!DirectUI::DXamlCore::FireEvent()  Unknown
    Microsoft.ui.xaml.dll!CCoreServices::CLR_FireEvent()    Unknown
    Microsoft.ui.xaml.dll!CommonBrowserHost::CLR_FireEvent()    Unknown
    Microsoft.ui.xaml.dll!CControlBase::ScriptCallback()    Unknown
    Microsoft.ui.xaml.dll!CXcpDispatcher::OnScriptCallback()    Unknown
    Microsoft.ui.xaml.dll!CXcpDispatcher::OnWindowMessage() Unknown
    Microsoft.ui.xaml.dll!CXcpDispatcher::WindowProc()  Unknown
    user32.dll!00007ff819afe858()   Unknown
    user32.dll!00007ff819afde1b()   Unknown
    user32.dll!00007ff819afd68a()   Unknown
    Microsoft.ui.xaml.dll!CXcpBrowserHost::SyncScriptCallbackRequest()  Unknown
    Microsoft.ui.xaml.dll!CEventManager::Raise()    Unknown
    Microsoft.ui.xaml.dll!CEventManager::RaiseRoutedEventBubbling() Unknown
    Microsoft.ui.xaml.dll!CInputServices::RaiseDelayedPointerUpEvent()  Unknown
    Microsoft.ui.xaml.dll!CInputServices::ProcessGestureInput() Unknown
    Microsoft.ui.xaml.dll!CInputServices::ProcessTouchInteractionCallback() Unknown
    Microsoft.ui.xaml.dll!CCoreServices::ProcessTouchInteractionCallback()  Unknown
    Microsoft.ui.xaml.dll!GestureRecognizerAdapter::OnTapped()  Unknown
    Microsoft.ui.xaml.dll!Microsoft::WRL::Details::DelegateArgTraits<long (__cdecl ABI::Windows::Foundation::ITypedEventHandler_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Microsoft::UI::Input::GestureRecognizer *,ABI::Microsoft::UI::Input::IGestureRecognizer *>,ABI::Windows::Foundation::Internal::AggregateType<ABI::Microsoft::UI::Input::TappedEventArgs *,ABI::Microsoft::UI::Input::ITappedEventArgs *>>::*)(ABI::Microsoft::UI::Input::IGestureRecognizer *,ABI::Microsoft::UI::Input::ITappedEventArgs *)>::DelegateInvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,ABI::Windows::Foundation::ITypedEventHandler<ABI::Microsoft::UI::Input::GestureRecognizer *,ABI::Microsoft::UI::Input::TappedEventArgs *>,Microsoft::WRL::FtmBase>,<lambda_45f026d2817627401d33114d1063e5ff> &,1,ABI::Microsoft::UI::Input::IGestureRecognizer *,ABI::Microsoft::UI::Input::ITappedEventArgs *>::Invoke()   Unknown
    Microsoft.UI.Input.dll!00007fff2e91cc7a()   Unknown
    Microsoft.UI.Input.dll!00007fff2e918276()   Unknown
    Microsoft.UI.Input.dll!00007fff2e915f32()   Unknown
    Microsoft.UI.Input.dll!00007fff2e915c3e()   Unknown
    ninput.dll!00007ff81236b0a8()   Unknown
    ninput.dll!00007ff812370798()   Unknown
    ninput.dll!00007ff81238f27f()   Unknown
    ninput.dll!00007ff81238f246()   Unknown
    ninput.dll!00007ff81238e9fa()   Unknown
    ninput.dll!00007ff81238eacf()   Unknown
    ninput.dll!00007ff81238d3ea()   Unknown
    ninput.dll!00007ff8123711b0()   Unknown
    ninput.dll!00007ff812370ac7()   Unknown
    ninput.dll!00007ff81236eff4()   Unknown
    Microsoft.UI.Input.dll!00007fff2e91a18b()   Unknown
    Microsoft.ui.xaml.dll!ElementGestureTracker::ProcessPointerInformation()    Unknown
    Microsoft.ui.xaml.dll!CInputServices::ProcessPointerMessagesWithInteractionEngine() Unknown
    Microsoft.ui.xaml.dll!CInputServices::ProcessInteractionPointerMessages()   Unknown
    Microsoft.ui.xaml.dll!ContentRootInput::PointerInputProcessor::ProcessPointerInput()    Unknown
    Microsoft.ui.xaml.dll!CInputServices::ProcessInput()    Unknown
    Microsoft.ui.xaml.dll!CXcpBrowserHost::HandleInputMessage() Unknown
    Microsoft.ui.xaml.dll!CJupiterControl::HandlePointerMessage()   Unknown
    Microsoft.ui.xaml.dll!CJupiterWindow::OnIslandPointerMessage(unsigned int,class CContentRoot *,struct ABI::Microsoft::UI::Input::IPointerPoint *,struct ABI::Microsoft::UI::Input::IPointerEventArgs *,bool,bool *) Unknown
    Microsoft.ui.xaml.dll!CXamlIslandRoot::InjectPointerMessage(unsigned int,struct ABI::Microsoft::UI::Input::IPointerEventArgs *) Unknown
    Microsoft.ui.xaml.dll!Microsoft::WRL::Details::DelegateArgTraits<long (__cdecl ABI::Windows::Foundation::ITypedEventHandler_impl<ABI::Windows::Foundation::Internal::AggregateType<ABI::Microsoft::UI::Input::InputPointerSource *,ABI::Microsoft::UI::Input::IInputPointerSource *>,ABI::Windows::Foundation::Internal::AggregateType<ABI::Microsoft::UI::Input::PointerEventArgs *,ABI::Microsoft::UI::Input::IPointerEventArgs *>>::*)(ABI::Microsoft::UI::Input::IInputPointerSource *,ABI::Microsoft::UI::Input::IPointerEventArgs *)>::DelegateInvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,ABI::Windows::Foundation::ITypedEventHandler<ABI::Microsoft::UI::Input::InputPointerSource *,ABI::Microsoft::UI::Input::PointerEventArgs *>,Microsoft::WRL::FtmBase>,<lambda_ce6152cb73defb12746a6f18006dfc8c> &,1,ABI::Microsoft::UI::Input::IInputPointerSource *,ABI::Microsoft::UI::Input::IPointerEventArgs *>::Invoke() Unknown
    Microsoft.UI.Input.dll!00007fff2e8ff3d8()   Unknown
    Microsoft.UI.Input.dll!00007fff2e900273()   Unknown
    Microsoft.UI.Input.dll!00007fff2e8fcfbf()   Unknown
    Microsoft.UI.Input.dll!00007fff2e8fa607()   Unknown
    Microsoft.UI.Input.dll!00007fff2e8feee1()   Unknown
    Microsoft.UI.Input.dll!00007fff2e8fa457()   Unknown
    Microsoft.UI.Input.dll!00007fff2e8fa173()   Unknown
    Microsoft.UI.Input.dll!00007fff2e8f985d()   Unknown
    Microsoft.UI.Input.dll!00007fff2e8f9693()   Unknown
    Microsoft.UI.Input.dll!00007fff2e90184c()   Unknown
    CoreMessagingXP.dll!00007fff2fe89007()  Unknown
    Microsoft.UI.Input.dll!00007fff2e8f6dbf()   Unknown
    Microsoft.UI.Input.dll!00007fff2e95daac()   Unknown
    CoreMessagingXP.dll!00007fff2fe3be28()  Unknown
    CoreMessagingXP.dll!00007fff2fe3b795()  Unknown
    CoreMessagingXP.dll!00007fff2fe3c002()  Unknown
    CoreMessagingXP.dll!00007fff2fe4edfe()  Unknown
    CoreMessagingXP.dll!00007fff2fe7fdd6()  Unknown
    CoreMessagingXP.dll!00007fff2fe2a434()  Unknown
    CoreMessagingXP.dll!00007fff2fe228d1()  Unknown
    CoreMessagingXP.dll!00007fff2fe2261b()  Unknown
    CoreMessagingXP.dll!00007fff2fe48376()  Unknown
    CoreMessagingXP.dll!00007fff2fe1221f()  Unknown
    CoreMessagingXP.dll!00007fff2fe47a44()  Unknown
    CoreMessagingXP.dll!00007fff2fe6222c()  Unknown
    CoreMessagingXP.dll!00007fff2fe19c5c()  Unknown
    CoreMessagingXP.dll!00007fff2fe1950e()  Unknown
    CoreMessagingXP.dll!00007fff2fe0ed7b()  Unknown
    CoreMessagingXP.dll!00007fff2fe11010()  Unknown
    CoreMessagingXP.dll!00007fff2fe114e6()  Unknown
    CoreMessagingXP.dll!00007fff2fe1140a()  Unknown
    CoreMessagingXP.dll!00007fff2fe6477f()  Unknown
    CoreMessagingXP.dll!00007fff2fe6471f()  Unknown
    user32.dll!00007ff819afe858()   Unknown
    user32.dll!00007ff819afe299()   Unknown
    Microsoft.ui.xaml.dll!DirectUI::FrameworkApplication::RunDesktopWindowMessageLoop() Unknown
    Microsoft.ui.xaml.dll!DirectUI::FrameworkApplication::StartDesktop()    Unknown
    Microsoft.ui.xaml.dll!DirectUI::FrameworkApplicationFactory::Start()    Unknown
    SCPDemo.exe!winrt::impl::consume_Microsoft_UI_Xaml_IApplicationStatics<winrt::Microsoft::UI::Xaml::IApplicationStatics>::Start(const winrt::Microsoft::UI::Xaml::ApplicationInitializationCallback & callback) Line 157 C++
    SCPDemo.exe!winrt::Microsoft::UI::Xaml::Application::Start::__l2::<lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics & f) Line 12146    C++
    SCPDemo.exe!winrt::impl::factory_cache_entry<winrt::Microsoft::UI::Xaml::Application,winrt::Microsoft::UI::Xaml::IApplicationStatics>::call<void <lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics &) &>(winrt::Microsoft::UI::Xaml::Application::Start::__l2::void <lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics &) & callback) Line 6286    C++
    SCPDemo.exe!winrt::impl::call_factory<winrt::Microsoft::UI::Xaml::Application,winrt::Microsoft::UI::Xaml::IApplicationStatics,void <lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics &)>(winrt::Microsoft::UI::Xaml::Application::Start::__l2::void <lambda>(const winrt::Microsoft::UI::Xaml::IApplicationStatics &) && callback) Line 6309   C++
    SCPDemo.exe!winrt::Microsoft::UI::Xaml::Application::Start(const winrt::Microsoft::UI::Xaml::ApplicationInitializationCallback & callback) Line 12147   C++
    SCPDemo.exe!wWinMain(HINSTANCE__ * __formal, HINSTANCE__ * __formal, wchar_t * __formal, int __formal) Line 69  C++
    SCPDemo.exe!invoke_main() Line 123  C++
    SCPDemo.exe!__scrt_common_main_seh() Line 288   C++
    SCPDemo.exe!__scrt_common_main() Line 331   C++
    SCPDemo.exe!wWinMainCRTStartup(void * __formal) Line 17 C++
    kernel32.dll!00007ff818917034() Unknown
    ntdll.dll!00007ff819d226a1()    Unknown

The one instruction I did not follow on the linked page was modify the IDL, so that seems like the next thing to try.  Here's the suggested IDL:
// MainPage.idl
namespace SCPDemo
{
    [default_interface]
    runtimeclass MainPage : Windows.UI.Xaml.Controls.Page
    {
        MainPage();
    }
}

and here's the original IDL
namespace SCPDemo
{
    [default_interface]
    runtimeclass MainWindow : Microsoft.UI.Xaml.Window
    {
        MainWindow();
        Int32 MyProperty;
    }
}

I tried changing MainWindow to inherit from Microsoft.UI.Xaml.Controls.Page, but that doesn't compile.  The error is in the App::OnLaunched() function in the line
window = make<MainWindow>();

It makes sense that you can't make a window from a class inheriting from Controls, but I don't have a clue as to what the correct IDL should be.  Suggestions?
Update: I stepped through the code and found the line where the error occurs.  Here's the function:
void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&)
{
    myButton().Content(box_value(L"Clicked"));

    // 3. In the MainPage class, we'll first create a Direct 3D device, a Direct 2D device, and a Direct 2D device context.
    //      To do that, we'll call D3D11CreateDevice, D2D1CreateDevice, and ID2D1Device::CreateDeviceContext.
    uint32_t creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;

    D3D_FEATURE_LEVEL featureLevels[] =
    {
        D3D_FEATURE_LEVEL_11_1,
        D3D_FEATURE_LEVEL_11_0,
        D3D_FEATURE_LEVEL_10_1,
        D3D_FEATURE_LEVEL_10_0,
        D3D_FEATURE_LEVEL_9_3,
        D3D_FEATURE_LEVEL_9_2,
        D3D_FEATURE_LEVEL_9_1
    };

    // Create the Direct3D device.
    winrt::com_ptr<::ID3D11Device> d3dDevice;
    D3D_FEATURE_LEVEL supportedFeatureLevel;
    winrt::check_hresult(::D3D11CreateDevice(
        nullptr,
        D3D_DRIVER_TYPE_HARDWARE,
        0,
        creationFlags,
        featureLevels,
        ARRAYSIZE(featureLevels),
        D3D11_SDK_VERSION,
        d3dDevice.put(),
        &supportedFeatureLevel,
        nullptr)
    );

    // Get the Direct3D device.
    winrt::com_ptr<::IDXGIDevice> dxgiDevice{d3dDevice.as<::IDXGIDevice>()};

    // Create the Direct2D device and a corresponding context.
    winrt::com_ptr<::ID2D1Device> d2dDevice;
    ::D2D1CreateDevice(dxgiDevice.get(), nullptr, d2dDevice.put());

    winrt::com_ptr<::ID2D1DeviceContext> d2dDeviceContext;
    winrt::check_hresult(d2dDevice->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_NONE, d2dDeviceContext.put()));

    // 5. Next, call call IDXGIFactory2::CreateSwapChainForComposition to create a swap chain.
    // MainPage.cpp | paste this at the end of MainPage::ClickHandler
    // Get the DXGI adapter.
    winrt::com_ptr< ::IDXGIAdapter > dxgiAdapter;
    dxgiDevice->GetAdapter(dxgiAdapter.put());

    // Get the DXGI factory.
    winrt::com_ptr< ::IDXGIFactory2 > dxgiFactory;
    dxgiFactory.capture(dxgiAdapter, &IDXGIAdapter::GetParent);

    DXGI_SWAP_CHAIN_DESC1 swapChainDesc{ 0 };
    swapChainDesc.Width = 500;
    swapChainDesc.Height = 500;
    swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // This is the most common swapchain format.
    swapChainDesc.Stereo = false;
    swapChainDesc.SampleDesc.Count = 1; // Don't use multi-sampling.
    swapChainDesc.SampleDesc.Quality = 0;
    swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
    swapChainDesc.BufferCount = 2;
    swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
    swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // We recommend using this swap effect for all applications.
    swapChainDesc.Flags = 0;

    // Create a swap chain by calling IDXGIFactory2::CreateSwapChainForComposition.
    winrt::com_ptr< ::IDXGISwapChain1 > swapChain;
    dxgiFactory->CreateSwapChainForComposition(d3dDevice.get(), &swapChainDesc, nullptr, swapChain.put());

    // 6. Get an ISwapChainPanelNative from the SwapChainPanel that you named swapChainPanel.
    //      Then call ISwapChainPanelNative::SetSwapChain to set the swap chain on the SwapChainPanel.
    // MainPage.cpp | paste this at the end of MainPage::ClickHandler
    // Get native interface for SwapChainPanel
//////////////////////////////////////////////////////////////////////
//     ERROR OCCURS ON NEXT LINE
//////////////////////////////////////////////////////////////////////
    auto panelNative{ swapChainPanel().as<ISwapChainPanelNative>() };

    winrt::check_hresult(panelNative->SetSwapChain(swapChain.get()));

    // 7. Lastly, draw to the DirectX swap chain, and then present it to display the contents.
    // Create a Direct2D target bitmap associated with the swap chain back buffer, and set it as the current target.
    D2D1_BITMAP_PROPERTIES1 bitmapProperties =
        D2D1::BitmapProperties1(
            D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW,
            D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED),
            96.f,
            96.f
        );

    winrt::com_ptr<::IDXGISurface> dxgiBackBuffer;
    swapChain->GetBuffer(0, __uuidof(dxgiBackBuffer), dxgiBackBuffer.put_void());

    winrt::com_ptr< ::ID2D1Bitmap1 > targetBitmap;
    winrt::check_hresult(
        d2dDeviceContext->CreateBitmapFromDxgiSurface(
            dxgiBackBuffer.get(),
            &bitmapProperties,
            targetBitmap.put()
        )
    );

    d2dDeviceContext->SetTarget(targetBitmap.get());

    // Draw using Direct2D context.
    d2dDeviceContext->BeginDraw();

    d2dDeviceContext->Clear(D2D1::ColorF(D2D1::ColorF::Orange));

    winrt::com_ptr<::ID2D1SolidColorBrush> brush;
    winrt::check_hresult(d2dDeviceContext->CreateSolidColorBrush(
        D2D1::ColorF(D2D1::ColorF::Chocolate),
        D2D1::BrushProperties(0.8f),
        brush.put()));

    D2D1_SIZE_F const size{ 500, 500 };
    D2D1_RECT_F const rect{ 100.0f, 100.0f, size.width - 100.0f, size.height - 100.0f };
    d2dDeviceContext->DrawRectangle(rect, brush.get(), 100.0f);

    d2dDeviceContext->EndDraw();

    swapChain->Present(1, 0);
}

Any ideas on why the line
auto panelNative{ swapChainPanel().as<ISwapChainPanelNative>() };

is failing?

A: I just got a pm from IInspectable.  He suggested I change a line in the pch.h file from
#include <windows.ui.xaml.media.dxinterop.h>

to
#include <microsoft.ui.xaml.media.dxinterop.h>

This solved the problem.  I can hardly wait until the Microsoft documentation catches up with their move to WinUI 3.


text:
Q: java.lang.ArrayStoreException while deploying a spring mvc webapp I am deploying a spring mvc web app using Maven with Tomcat container. And i get java.lang.ArrayStoreException while deploying. I have searched through similar posts on stackoverflow but no proper resolution. So asking again to understand the issue and fix.
Spring version : 4.2.6-RELEASE
Per stack trace i pasted below the issue seem exist with below line fo code:
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$1.doWith(AutowiredAnnotationBeanPostProcessor.java:244)

 Lookup lookup = (Lookup)method.getAnnotation(Lookup.class);

Complete Stack Trace
java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
        at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
        at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
        at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
        at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
        at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
        at java.lang.reflect.Executable.declaredAnnotations(Executable.java:602)
        at java.lang.reflect.Executable.declaredAnnotations(Executable.java:600)
        at java.lang.reflect.Executable.getAnnotation(Executable.java:572)
        at java.lang.reflect.Method.getAnnotation(Method.java:621)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$1.doWith(AutowiredAnnotationBeanPostProcessor.java:244)
        at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:530)
        at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:537)
        at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:241)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1069)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1042)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
        at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:666)
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:632)
        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:680)
        at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:551)
        at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:492)
        at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
        at javax.servlet.GenericServlet.init(GenericServlet.java:212)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4350)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4659)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
        at org.apache.catalina.startup.Embedded.start(Embedded.java:825)
        at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)
        at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

A: I am able to resolve by adding below to web.xml DispatcherServlet init param config after searching a bit on google. Keeping post open to understand how below fixed the issue.
<init-param> <param-name>contextClass</param-name> <param-value> org.springframework.web.context.support.AnnotationConfigWebApplicationContext </param-value> </init-param>


text:
Q: Will a function which wraps a query criteria be a bottleneck? I've been attempting to make the following query perform better lately :
SELECT
    BIN_TO_UUID(album_id) AS e,
    firstdateofinterval AS p,
    BIN_TO_UUID(territory_id) AS t,
    SUM(playbacks) AS c1,
    SUM(userplaybacks) AS c2,
    SUM(userdownloads) AS c3,
    SUM(usersingledownloads) AS c4
FROM
    entityusage_trackbyyear
WHERE
    firstdateofinterval >= '2018-01-01'
        AND firstdateofinterval <= '2018-09-30'
        AND library_id = UUID_TO_BIN('c72cbb1e-5848-39ee-a201-664f26ee9204')
GROUP BY p , e

I've added indexes, which helps, but I also at some point did the following to see if UUID_TO_BIN in the query criteria was a bottleneck :
I moved the UUID_TO_BIN([...]) into
a variable, and used that variable in the query. The query now completed in about 1 second, compared to about  4 - 5 seconds before.
SET @library_id = UUID_TO_BIN('c72cbb1e-5848-39ee-a201-664f26ee9204');
SELECT
    BIN_TO_UUID(album_id) AS e,
    firstdateofinterval AS p,
    BIN_TO_UUID(territory_id) AS t,
    SUM(playbacks) AS c1,
    SUM(userplaybacks) AS c2,
    SUM(userdownloads) AS c3,
    SUM(usersingledownloads) AS c4
FROM
    entityusage_trackbyyear
WHERE
    firstdateofinterval >= '2018-01-01'
        AND firstdateofinterval <= '2018-09-30'
        AND library_id = @library_id
GROUP BY p , e

My understanding was original that running criteria parameters through a function would only evaluate once, and that no noticeable performance impact would be seen unless I inversed this and ran the field through a function.
In other words, I thought this was fine :
[...] AND library_id = UUID_TO_BIN(?) [...]
...while this was bad :
[...] AND BIN_TO_UUID(library_id) = ? [...]
However, it seems that moving the criteria into a session variable performs much better.
Why do I see much better performance when I replace the function wrapped criteria with a variable?