text:
Q: change the formatting of the chapter I am trying to change the formatting of my chapter. The class i am using is report. I want it to be bold centered. I used the following but no effect. .
\renewcommand{\@makechapterhead}[1]{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\hrule
\vspace{5pt}%
\ifnum \c@secnumdepth >\m@ne
\huge\scshape \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge \scshape #1\par
\vspace{5pt}%
\hrule
\nobreak
\vskip 40\p@
}}
\renewcommand{\@makeschapterhead}[1]{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright
\normalfont
\hrule
\vspace{5pt}%
\interlinepenalty\@M
\Huge \scshape #1\par
\vspace{5pt}%
\hrule
\nobreak
\vskip 40\p@
}}

A: As suggested in a comment, you can use the sectsty package:
\documentclass{report}
\usepackage{sectsty}
\usepackage{lipsum}% just to generate some text

\chapterfont{\centering}

\begin{document}

\chapter{Test Chapter}
\lipsum[4]

\end{document}

A: The following MWE takes your code as the starting basis. I've provided examples of both numbered and unnumbered chapter headings. The main changes, relative to the code you provided, are: (i) the two \raggedright directives have been replaced with \centering directives, (ii) the three \scshape instructions have been replaced with \bfseries instructions, and (iii) there's a little bit more vertical whitespace below the first \hrule and above the second \hrule statements. (Your code provides only 5pt of vertical separation, but I think that 12pt and 10pt, respectively, may be easier on the reader's eye. This is obviously a subjective decision and you should feel free to tweak the code further.) Hope this is what you're looking for.
\documentclass{report}
\usepackage{lipsum} % for filler text
\makeatletter
\renewcommand{\@makechapterhead}[1]{%
    \vspace*{50\p@}%
    {\parindent \z@ \centering \normalfont
    \hrule
    \vspace{12pt}%
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par
    \vspace{10pt}%
    \hrule
    \vskip 40\p@
}}
\renewcommand{\@makeschapterhead}[1]{%
    \vspace*{50\p@}%
    {\parindent \z@ \centering
    \normalfont
    \hrule
    \vspace{12pt}%
    \interlinepenalty\@M
    \Huge \bfseries #1\par
    \vspace{10pt}%
    \hrule
    \vskip 40\p@
}}
\makeatother
\begin{document}
\chapter{Hello There!}
\lipsum[1]
\chapter*{Good Bye}
\lipsum[2]
\end{document}

First the numbered chapter style:

Second, the unnumbered chapter style:


text:
Q: Use an Image or using the graphic function for 2D game dev? I'm trying to write a simple game that has some dogs and cats move around. Now my dogs, cats is the read and blue rectangle, I need to make them more pretty and now is 2 options for me:

*

*Using an Image.

*Draw them by some graphic class.

But I not sure what should I choose!

*

*If use Image, I must draw some (the object can animate). But it make thing simple.

*Use graphic function give me more power (like in case there more than just dog and cat, OO will help me alot). But I will make my barin hurt.

And the the most important is which is faster?
BTW I'm using Qt.

A: I'd most definitely use a bitmap.
Rendering a bitmap image is usually faster because it can be fully cached in memory unless it's large (which it shouldn't be, in your case). The underlying mechanics would simply involve a blazingly-fast memcpy (or the like) once it's been read from the disk.
Drawing a dog using vector graphics would incur a large overhead in terms of performance due to function calls, math/transformations, and would end up effectively needing more memory than a bitmap.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Wordpress: Make Text max-width:660px an images max-width:1000px I would like to have in Wordpress the normal text width 660px and the images between text wider than the text (max-width:1000px).
How can i handle that?

A: You could give images negative left and right margins. In order to work, though, they shouldn't be max-width, but just width:
 .container {
    width: 660px;
}

img {
    width: 1000px;
    margin-left: -170px;
    margin-right: -170px;
}

Another alternative, use a grid system and great a new .row or whatever your grid system calls it for each image, with columns that are wider than the one used for the text.


text:
Q: Check out page takes so much of time in Magento 2.2.4?
Check out page takes so much of time in Magento 2.2.4. I tried to checkout the product in Magento 2 it takes so much of time

A: I checked your site, it is throwing Javascript error. So the page is not loading at all.
There is no issue with the loading time but the issue is with the javascript error. This error is blocking to load the contents in the page and you see the loader which is never-ending.
Please check this screenshot.

Looks like there is issue with jQuery.Stellar.min.js.
Try to add this piece of code to the file in the beginning.
    require([
    'jquery'
], function ($) {

and at the end of the code close the "require" method with
});

It is because stellar js is using jquery object which has to be loaded through require js.

A: Make sure cache is enabled and that you are in production mode. Check the following 4 files and increase the memory limit from 756M to 2048M.

*

*.htaccess

*pub/.htaccess

*.user.ini

*pub/.user.ini

Temporarily add phpinfo(); to your index.php file and check the memory_limit setting.
You can also enable Magento's profiler and find the bottleneck.

A: If it is default Magento2 checkout, it'll not take much time.

*

*Check any extensions are enabled in the checkout page.

*Please disable and then check.


text:
Q: Value of variable not getting passed into the echo statement I m passing the value in the href attribute by using a variable, but the value of variable is not getting passed, either it passes nothing or the variable name itself.
How do I use quotes and variables in order to pass the value of variable successfully?
Below is the code:
<?php
for ($x = 0; $x < $count; $x++)
  {

    $html= ''.$out[$x][0].': added on-'.date('M j Y g:i A', strtotime($out[$x][1]));
    //Products
    echo $html;

    echo "

";

  }
  ?>

A: This should work:
<?php
for ($x = 0; $x < $count; $x++)
  {

    $html= ''.$out[$x][0].': added on-'.date('M j Y g:i A', strtotime($out[$x][1]));
    //Products
    echo $html;

    echo "

";

  }
  ?>

I replaced '".$out[$x][2]."' with '.$out[$x][2].'


text:
Q: How do we know the optimal solution path of A* search to be used for pruning before finishing the search? How do we know the optimal solution cost before finishing the search?
The textbook says
A* expands all nodes with f(n) less than C *
but how do we know C* before actually finishing the search?
Maybe I'm not understanding the concept of the optimal solution path
I get the concept in
Does A* need to know the optimal solution cost while utilizing an admissible heuristic?
but then how do we do the concept of pruning? I feel like we should be able to write off some nodes so we don't have to keep track of them in case they become the lowest cost.

A: First of all you should stop reading a book which says A* expands all nodes because this is not the case.
Suppose you get a cost of 4 from source to goal and you have a extra node in queue with cost > 4 then A* will not evalute that node because it has a goal node with less cost and hence that node will not be evaluated.
If heuristic is admissible then the first path you find from source to goal is always the best path also every node is reached through the best path. Heuristic is estimated cost not exact cost. You have to compute it in some way.
If heuristic is not admissible then it is possible that there is some path with cost less then current cost , in that case A* will later update the current path with new path.
No idea what you mean by pruning.


text:
Q: Trying to implement multiple conditional loop and changing image and content randomly I'm Trying to implement a condition such that Tapping on image should change image content and text in different image container and  text block respectively and randomly such that one of the content of Headername should always matches with one of the image in image container and text in text block .
Refer imageenter image description here
Xamlcode
<Grid.Background>
            <ImageBrush  ImageSource="Assets/Quiz/bg.png"/>
        </Grid.Background>
        <StackPanel>
            <MediaElement x:Name="mediaElement1" />
        </StackPanel>
        <Popup x:Name ="ppup" IsOpen = "False" IsLightDismissEnabled = "True" Width = "30" HorizontalAlignment = "Left" >
            <Image Source = "Assets/good_job.png" />
        </Popup >
        <Popup x:Name ="ppup1" IsOpen = "False" IsLightDismissEnabled = "True" Width = "30" HorizontalAlignment = "Left" >
            <Image Source = "Assets/wrong_ans.png" />
        </Popup >
        <Grid>
            <Image x:Name="homeBtn"
            Source="Assets/LearnColor/Button/btn_home.png"
               Height="90" Width="80"
               VerticalAlignment="Top"
               HorizontalAlignment="Right"
               Margin="0,-10,-10,0"/>
        </Grid>
        <Grid>
            <Image x:Name="Header"
            Source="Assets/Quiz/header_quiz.png"
               Height="140" Width="350"
               VerticalAlignment="Top"
               Margin="0,-7,0,0"
               />
            <TextBlock x:Name="HeaderName"
                Text="Yellow"
               VerticalAlignment="Top"
               Margin="290,53,0,0" FontSize="30" FontStyle="Normal" FontWeight="ExtraBold" />
        </Grid>
        <Grid>
        <Image x:Name="imgContainer1"
            Source="Assets/Quiz/object_bg.png"
               Height="190" Width="200"
               HorizontalAlignment="Left"
               VerticalAlignment="Center"
               Margin="10,60,0,0"/>
            <Image x:Name="image1"
            Source="Assets/LearnColor/Object/ob_0_0.png"
            Height="150" Width="160"
            HorizontalAlignment="Left"
            VerticalAlignment="Center"
            Margin="30,60,0,0"
            Tapped="image1Tap"
               />
            <Image x:Name="imgContainer2"
            Source="Assets/Quiz/object_bg.png"
               Height="190" Width="200"
               HorizontalAlignment="Center"
               VerticalAlignment="Center"
               Margin="20,60,0,0"/>
            <Image x:Name="image2"
            Source="Assets/LearnColor/Object/ob_1_0.png"
               Height="150" Width="160"
                   HorizontalAlignment="Center"
               VerticalAlignment="Center"
                   Margin="20,60,0,0"
                   Tapped="image2Tap"
               />
            <Image x:Name="imgContainer3"
            Source="Assets/Quiz/object_bg.png"
               Height="190" Width="200"
               HorizontalAlignment="Right"
               VerticalAlignment="Center"
               Margin="0,60,0,0"/>
            <Image x:Name="image3"
            Source="Assets/LearnColor/Object/ob_2_0.png"
               Height="150" Width="160"
               HorizontalAlignment="Right"
               VerticalAlignment="Center"
                   Margin="0,60,20,0"
                   Tapped="image3Tap"
               />
        </Grid>
        <Grid>
            <Image x:Name="objName1"
            Source="Assets/Quiz/object_bg_name.png"
            Height="200" Width="200"
            VerticalAlignment="Bottom"
            HorizontalAlignment="Left"
            Margin="10,0,0,0"/>
            <TextBlock x:Name="objNameWritten1"
               Text="Banana"
               VerticalAlignment="Bottom"
               HorizontalAlignment="Left"
               Margin="30,0,0,20" FontSize="25" FontStyle="Normal" FontWeight="ExtraBold"
               Tapped="objNameWritten1Tapped"/>
            <Image x:Name="objName2"
            Source="Assets/Quiz/object_bg_name.png"
            Height="200" Width="200"
            VerticalAlignment="Bottom"
            HorizontalAlignment="Center"
            Margin="10,0,0,0"/>
            <TextBlock x:Name="objNameWritten2"
               Text="Sheep"
               VerticalAlignment="Bottom"
               HorizontalAlignment="Center"
               Margin="0,0,0,20" FontSize="25" FontStyle="Normal" FontWeight="ExtraBold"
              Tapped="objNameWritten2Tapped"/>
            <Image x:Name="objName3"
            Source="Assets/Quiz/object_bg_name.png"
            Height="200" Width="200"
            VerticalAlignment="Bottom"
            HorizontalAlignment="Right"
            Margin="10,0,0,0"/>
            <TextBlock x:Name="objNameWritten3"
               Text="Berry"
               VerticalAlignment="Bottom"
               HorizontalAlignment="Right"
               Margin="0,0,50,20" FontSize="25" FontStyle="Normal" FontWeight="ExtraBold"
               Tapped="objNameWritten3Tapped"/>
        </Grid>

cs code
public sealed partial class Quiz : Page
    {
        public class MyImage
        {
            public string Header { get; set; }
            public string image { get; set; }
            public string prevObjBtn { get; set; }
            public string fwdObjBtn { get; set; }
            public string HeaderName { get; set; }
            public string objNameWritten1 { get; set; }
            public string objNameWritten2 { get; set; }
            public string objNameWritten3 { get; set; }
        }
        string[] Headername = new string[] { "Yellow", "white", "red", "purple", "pink", "orange", "green", "grey", "brown", "blue", "black" };
        string[] objnamewritten = new string[] { "Banana", "Sheep", "Berry", "Grapes", "Icecream", "Girrafe", "Tree", "Elephant", "Log", "Sky", "Crow" };
        int CI = 0;
        public Quiz()
        {
            this.InitializeComponent();
        }

        private void image1Tap(object sender, TappedRoutedEventArgs e)
        {
            common();
        }

        private void image2Tap(object sender, TappedRoutedEventArgs e)
        {
            common();
        }

        private void image3Tap(object sender, TappedRoutedEventArgs e)
        {
            common();
        }

        private void objNameWritten1Tapped(object sender, TappedRoutedEventArgs e)
        {
            common();
        }

        private void objNameWritten2Tapped(object sender, TappedRoutedEventArgs e)
        {
            common();
        }

        private void objNameWritten3Tapped(object sender, TappedRoutedEventArgs e)
        {
            common();
        }

        private void common()
        {
            if (Headername[CI] == "Yellow")
            {
                if (objNameWritten1.Text=="Banana" || objNameWritten1.Text=="lemomn" || objNameWritten1.Text=="Sun")
                {
                    ppup.Height = Window.Current.Bounds.Height;
                    ppup.IsOpen = true;
                }
                else if (objNameWritten2.Text == "Banana" || objNameWritten2.Text == "lemomn" || objNameWritten2.Text == "Sun")
                {
                    ppup.Height = Window.Current.Bounds.Height;
                    ppup.IsOpen = true;
                }
                else if (objNameWritten3.Text == "Banana" || objNameWritten3.Text == "lemomn" || objNameWritten3.Text == "Sun")
                {
                    ppup.Height = Window.Current.Bounds.Height;
                    ppup.IsOpen = true;
                }
                else
                {
                    ppup1.Height = Window.Current.Bounds.Height;
                    ppup1.IsOpen = true;
                }
            }
            else
            {
                ppup1.Height = Window.Current.Bounds.Height;
                ppup1.IsOpen = true;
            }

        }
    }

Updated Logic
Below Logic I'm trying issue is image is not comparing
if ((image1.Source==new BitmapImage(new Uri("ms-appx:///Assets/LearnColor/Object/ob_" + CI + "_" + LI + ".png"))) &&(objNameWritten1.Text==objnamewritten[LI]))

private void common()
        {

            if (CI > 10)
            {
                CI = 0;
                return;
            }
            if (HeaderName.Text== Headername[CI])
            {
                int LI = 0;
                for (int i = 3*CI+LI; i < 3*(CI+1); LI++)
                {
                    if ((image1.Source==new BitmapImage(new Uri("ms-appx:///Assets/LearnColor/Object/ob_" + CI + "_" + LI + ".png"))) &&(objNameWritten1.Text==objnamewritten[LI]))
                    {
                        ppup.Height = Window.Current.Bounds.Height;
                        ppup.IsOpen = true;
                        CI++;
                        HeaderName.Text = Headername[CI];
                        common();
                    }
                    else if ((image2.Source == new BitmapImage(new Uri("ms-appx:///Assets/LearnColor/Object/ob_" + CI + "_" + LI + ".png"))) && (objNameWritten2.Text == objnamewritten[LI]))
                    {
                        ppup.Height = Window.Current.Bounds.Height;
                        ppup.IsOpen = true;
                        CI++;
                        HeaderName.Text = Headername[CI];
                        common();
                    }
                    else if ((image3.Source == new BitmapImage(new Uri("ms-appx:///Assets/LearnColor/Object/ob_" + CI + "_" + LI + ".png"))) && (objNameWritten3.Text == objnamewritten[LI]))
                    {
                        ppup.Height = Window.Current.Bounds.Height;
                        ppup.IsOpen = true;
                        CI++;
                        HeaderName.Text = Headername[CI];
                        common();
                    }

                }

            }
            else
            {
                ppup1.Height = Window.Current.Bounds.Height;
                ppup1.IsOpen = true;
            }


text:
Q: How do I access Ubuntu after dual booting it alongside windows? I installed Ubuntu through a flash drive on my laptop with Windows 10.
I partitioned ubuntu on an external hard drive.
I am not given an option to boot with Ubuntu when I start my computer, it just boots straight into Windows 10.
I found a similar question telling me to do the following:
change advanced startup options> restart now.>
Then after restarting, go to troubleshoot> advanced options> UEFI Firmware settings>
My problem so far is that I don't get the option UEFI Firmware settings after going to advanced options.
I apologize if this is a dumb question I don't have a lot of knowledge in this area.


text:
Q: Validate a form field only if populated I have a field in a form which is optional but if it is completed I want to validate that it is an integer value. In my model I have:
validates :number_of_employees, numericality: { only_integer: true }

This works but when I submit the form with the value not completed it raises an error because it is not numeric. I gather you can put and if condition in the validates statement but not sure if this is the correct way to handle this or what the syntax is to check for existance.
Any help appreciated.

A: Rather than using an :if option, the idiomatic way to allow empt fields to pass validation is to use the :allow_blank option. It's common to all the validators except the presence validator.
validates :number_of_employees, numericality: { only_integer: true, allow_blank: true }


text:
Q: Draggable images on 3D surface I'm creating 3D program in WPF in C#. I'd like to move images which are place on  3D surface.
In my case they're situated on square. The problem is when I  try to move the image, other
 images change their sizes.
I tried setting contstraints but it seems that the problem is that images and canvas are placed in 3D.
Does anybod have an idea how to get rid of this problem ?
Part of wpf code:
    <Viewport2DVisual3D
  Material="{StaticResource visualHostMaterial}"
  Geometry="{StaticResource squareMeshFrontRight}">
        <Canvas Grid.Row="1" HorizontalAlignment="Center"
        VerticalAlignment="Center" x:Name="ImageHolder"  >
            <Image Canvas.Left="36" MouseWheel="Img_MouseWheel" MouseMove="Img_MouseMove"
           MouseDown="Img_MouseDown" MouseUp="Img_MouseUp" Panel.ZIndex="0"
           Cursor="Hand" Canvas.Top="33" Height="150" Width="150" Source="sketch.jpg"
           x:Name="Img" HorizontalAlignment="Center" VerticalAlignment="Center" MinWidth="60" MinHeight="60" MaxWidth="60" MaxHeight="60">
            </Image>
            <Image Canvas.Left="341" MouseWheel="Img_MouseWheel" MouseMove="Img_MouseMove"
           MouseDown="Img_MouseDown" MouseUp="Img_MouseUp" Panel.ZIndex="0"
           Cursor="Hand" Canvas.Top="22" Height="72" Width="77" Source="GreenSquare.jpg"
           x:Name="Img2">
            </Image>
        </Canvas>
    </Viewport2DVisual3D>

Methods used for moving imgaes:
    Point p;
    Image tmpImg;

    private void Img_MouseMove(object sender, MouseEventArgs e)
    {
        tmpImg = sender as Image;
        Point x = e.GetPosition(ImageHolder);

        if (e.LeftButton == MouseButtonState.Pressed)
        {
            Canvas.SetLeft(tmpImg, Canvas.GetLeft(tmpImg) + (x.X - p.X));

            Canvas.SetTop(tmpImg, Canvas.GetTop(tmpImg) + (x.Y - p.Y));
        }
        p = x;
    }

    private void Img_MouseDown(object sender, MouseButtonEventArgs e)
    {
        tmpImg = sender as Image;
        tmpImg.CaptureMouse();
        p = e.GetPosition(ImageHolder);
    }

    private void Img_MouseUp(object sender, MouseButtonEventArgs e)
    {
        tmpImg = sender as Image;
        tmpImg.ReleaseMouseCapture();
    }

A: I move images around in 3d, under animated control rather than user dragging, but i am pretty sure that the mechanism for moving them would be the same.
first, make just to make sure that the outer canvas isnt getting autosized or something weird like that set it to a fixed width/height.
and with the setting of the position of the images within the Viewport2DVisual3D, I used RenderTransform on the image to set it to its new position.
cheers
Anton


text:
Q: Angular Dependencies Between Modules I'm facing a problem using Dependency Injection between modules.
I have a module that implements a directive I need to use in other applications.
I added the dependency from this module in another app declaration like this:
angular.module('mainApp', ['ngRoute', 'directiveApp']);

However, the methods implemented into directiveApp.controller, doesn't seem to be visible from a page of MainApp, since the directive can't run a method it needs from their controller.
I know it's a little confusing, so I put an example in this plunker, that shows the problem I'm facing.

A: When you inject another module into your own, the controllers and directives it implements become available, but you need to use them properly.
The way you are trying to do is not possible, you can do something like this:
http://plnkr.co/edit/peHH226vxtkI48RFZ3Eq?p=preview

Value: {{name}}!

    <button ng-click="mainModule()">Call a function in the main module!</button>

      {{name}}
      <button ng-click="dependentModule()">Call a function in the dependent module!</button>

But notice that you have two different $scopes and consequently two different name variables.
That means your dependentModule() function belongs to your SubCtrl and you can only use it inside its own $scope

That's not recommended, but if you really need to, you can use the other controllers on your own methods and then copy the results:
http://plnkr.co/edit/ranK9n08NNVuSKIGX15G?p=preview
main.controller("MainCtrl", function($scope, $controller) {

  $scope.name = "Initial value";
  $scope.mainModule = function() {
    $scope.name = "a function in the same module";
  };

  $scope.bridgeFunction = function(){
    // Create a new scope
    var injectedScope = $scope.$new();

    // Use it on the other controller
    $controller('SubCtrl',{$scope : injectedScope });

    // Call the methdo on the controller
    testCtrl1ViewModel.dependentModule(); //And call the method on the newScope.

    // Copy the result from that scope into your own
    $scope.name = testCtrl1ViewModel.name;
  }

});

A third option is to merge the two scopes, although this can get very messy, it is possible:
http://plnkr.co/edit/1NKStMuYy0e00dhuWKUD?p=preview
main.controller("MainCtrl", function($scope, $controller) {

  $scope.name = "Initial value";

  //This can get very messy, but it is possible to merge the two scopes:
  $controller('SubCtrl',{$scope : $scope });

  $scope.mainModule = function() {
    $scope.name = "a function in the same module";
  };

});

Hope that helps


text:
Q: Issue understanding weka apriori algorithm output I'm using the following code in order to find out interesting association rules
on file data.arff.
My problem is that I don't know how to interpret the output.
what is the output telling me ?
I would expect rules like [a=1,b=1] -> [c=1]
for example, wich I'm not getting.
        //Define ArrayList to Add Clustered Information
        Apriori apriori = new Apriori();
        apriori.setNumRules(10);
        BufferedReader datafile = readDataFile("C:\\data.arff");
        Instances data = new Instances(datafile);
        apriori.buildAssociations(data);
        System.out.println("-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-");
        System.out.println("Number of Associations : " + apriori.getNumRules());
        System.out.println("Adding Association Information to ArrayList ..");
        AssociationRules arules = apriori.getAssociationRules();
        int num = apriori.getAllTheRules().length;
        System.out.println("Num :" + num);

        for(AssociationRule ar : arules.getRules())
        {
            System.out.println("premise: " + ar.getPremise());
            System.out.println("consequence: "+ar.getConsequence());

            System.out.println("---");
        }

data.arff
@relation Presence-Absence-Representation

@attribute a    {0,1}
@attribute b    {0,1}
@attribute c    {0,1}
@attribute d    {0,1}
@attribute e    {0,1}
@attribute f    {0,1}
@attribute g    {0,1}
@attribute h    {0,1}

@data
1,0,1,0,0,1,0,0
0,1,1,0,1,0,0,1
1,1,1,1,0,0,0,1
1,1,0,0,0,1,1,1
1,0,1,0,0,1,0,0
1,0,1,0,0,1,0,0
1,0,0,0,0,0,0,1
0,0,0,0,1,1,0,0
0,0,0,0,0,1,1,1

and I'm getting the following output:
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
Number of Associations : 10
Adding Association Information to ArrayList ..
Num :6
premise: [a=1]
consequence: [e=0]
---
premise: [b=0]
consequence: [d=0]
---
premise: [f=1]
consequence: [d=0]
---
premise: [c=1]
consequence: [g=0]
---
premise: [a=1, d=0]
consequence: [e=0]
---
premise: [e=0, g=0]
consequence: [a=1]
---
premise: [a=1, g=0]
consequence: [e=0]
---
premise: [b=0, e=0]
consequence: [d=0]
---
premise: [b=0, f=1]
consequence: [d=0]
---
premise: [b=0, g=0]
consequence: [d=0]
---

A: You may want to use a dictionary, and look up the terms

*

*premise

*consequence

to understand how to write them using the => symbol.


text:
Q: Meaning of too in the following sentence In the sentence given below

Your watch is five minutes too fast.

What is the meaning of too?
I think five minutes fast in itself is sufficient and too does not make any sense.

A: Idiomatically, you hear both; however I would say that you only really need "too" in there if you include a measurement such as "five minutes" in your example.
A watch may be unique in that we want it to be precise - neither fast nor slow. Saying "my watch is fast" suggests that it possesses the quality of being fast (ie that it gains over time), which for a watch is no use.
In any other context though, "fast" or "slow" could be exactly what we want. For example, you might say "my new computer is fast!" I can't imagine anyone saying their computer was too fast.
However, if you include a measurement, such as seconds or minutes in the case of a watch or clock, you need the word "too" in there to show that the speed or slowness is excessive by that amount. For example, if you were trying to get on a fairground ride with a height restriction of 5ft and you were 6ft tall, you wouldn't say "I am 1ft tall", because that is a declaration of your total height! You would say "1ft too tall".

A: I would say that both

*

*Your watch is five minutes too fast.

*Your watch is five minutes fast.

are acceptable and have the exact same meaning. In the second case the "too" is elided and implied. "Too" is correct because the speaker is saying that the watch is ahead of where is should be. The word "too" is used in this sort of construction to mean excess:

*

*You have gone too far.

*I ate too much.

*The window is five inches too wide.

*The meeting is half-an-hour too short.


text:
Q: VBA connect using named connection points I have a few shapes with named connection points. Is there any way to connect them using their name?
I don't want to connect them using x,y co-ordinates.
Example:
Say I have two shapes S1, S2.
Connection points on S1: C11, C12
Connection points on S2: C21, C22
Now can I specify Connect S1(C11) -> S2(C21)

A: Yes.  Say you have two shapes on a Visio page object (vzpVisioPage), the starting shape and the ending shape:
Set vsoStartShape = vzpVisioPage.Shapes.Item(varSomeIndex)
Set vsoEndShape = vzpVisioPage.Shapes.Item(varSomeOtherIndex)

The custom connection points will be in the Connections section of the shapesheet.
Create a connector shape and glue it as follows:
Set vsoConnectorShape = vzpVisioPage.Drop(vzpVisioPage.Application.ConnectorToolDataObject, 0, 0)
vsoConnectorShape.CellsU("BeginX").GlueTo vsoStartShape.Cells("Connections.C11")
vsoConnectorShape.CellsU("EndX").GlueTo vsoEndShape.Cells("Connections.C21")


text:
Q: python error when initializing a class derived from and abstract one I have this simple code and I get a strange error:
from abc import ABCMeta, abstractmethod

class CVIterator(ABCMeta):

    def __init__(self):

        self.n = None # the value of n is obtained in the fit method
        return

class KFold_new_version(CVIterator): # new version of KFold

    def __init__(self, k):
        assert k > 0, ValueError('cannot have k below 1')
        self.k = k
        return

cv = KFold_new_version(10)

In [4]: ---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-ec56652b1fdc> in <module>()
----> 1 __pyfile = open('''/tmp/py13196IBS''');exec(compile(__pyfile.read(), '''/home/donbeo/Desktop/prova.py''', 'exec'));__pyfile.close()

/home/donbeo/Desktop/prova.py in <module>()
     19
     20
---> 21 cv = KFold_new_version(10)

TypeError: __new__() missing 2 required positional arguments: 'bases' and 'namespace'

What am I doing wrong?  A theoretical explanation would be appreciated.

A: You used the ABCMeta meta class incorrectly. It is a meta class, not a base class. Use it as such.
For Python 2, that means assigning it to the __metaclass__ attribute on the class:
class CVIterator(object):
    __metaclass__ = ABCMeta

    def __init__(self):
        self.n = None # the value of n is obtained in the fit method

In Python 3, you'd use the metaclass=... syntax when defining the class:
class CVIterator(metaclass=ABCMeta):
    def __init__(self):
        self.n = None # the value of n is obtained in the fit method

As of Python 3.4, you can use the abc.ABC helper class as a base class:
from abc import ABC

class CVIterator(ABC):
    def __init__(self):
        self.n = None # the value of n is obtained in the fit method


text:
Q: Angular jasmine test not able to trigger Observable created with fromEvent rxjs operator I have a simple case. The standard AppComponent of an Angular app contains a ChildComponent which is defined in its own module ChildModule.
The template of ChildComponent is very simple

ChildComponent has an even simpler testClick(event) method that just logs a message on the console.
testClick(event) {
    console.log(event);
}

Now I want to build a test on AppComponent simulating a click on ChildComponent.
This is the code of the test
describe('AppComponent', () => {
  let fixture: ComponentFixture<AppComponent>;
  let app: AppComponent;
  let child: DebugElement;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [ ChildModule ],
      declarations: [
        AppComponent
      ],
    }).compileComponents();
  }));
  beforeEach(() => {
    fixture = TestBed.createComponent(AppComponent);
    app = fixture.debugElement.componentInstance;
    child = fixture.debugElement.query(By.css('.child'));
    fixture.detectChanges();
  });

  it(`should create the child'`, async(() => {
    expect(child).toBeTruthy();
  }));

  it(`clicks on the child and the relative Observable emits`, async(() => {
    setTimeout(() => {
      child.triggerEventHandler('click', 'clicked');
    }, 100);

  }));

});

The tests work and in particular the second test prints the clicked message on the console, as expected.
Now I complicate a bit ChildComponent. I want to create an Observable on the click event using the fromEvent operator and ViewChild.
So the code becomes
export class ChildComponent implements AfterViewInit {
  @ViewChild('child') private childElement: ElementRef;

  ngAfterViewInit() {
    const testClick$ = fromEvent(this.childElement.nativeElement, 'click');
    testClick$.subscribe(d => console.log('test click in child', d));
  }
}

I launch the development server with ng serve and I see 2 messages printed on the console, one by the testClick method and one by the subscription of the testClick$ Observable.
If I run now the same tests as before, I expect to see also the same two messages printed on the console. On the contrary I see only the message printed by the testClick method. The message of the subscription, i.e. 'test click in child', does not appear, which means that the Observable testClick$ does not emit when child.triggerEventHandler('click', 'clicked'); is executed.
How can I make Observables created with fromEvent work in jasmine tests? What am I doing wrong?

A: Eventually I found a way to fire events that can be used within the fromEvent function of RxJs.
The solution has been inspired by this post.
The idea is that in order to be able to create an event stream from a DOM event you have to use the method dispatchEvent on the native element wrapped by the DebugElement.
So, rather than doing
child.triggerEventHandler('click', 'clicked');

you have to use something like
child.nativeElement.dispatchEvent(new MouseEvent('click', {...});


text:
Q: Finite Element model of Fourth order PDE in FreeFEM++ I am attempting to finite element model the/a solution to the Kuramoto-Sivashinsky equation
$$u_{t}+\nu u_{xxxx}+u_{xx}+uu_{x}=0 $$
with 1-periodic boundary condition
$$u(\cdot,0)=u_{0} $$
using the software FreeFem++.
Using this paper, I derived the following weak form of the equation:
$$ (u_t,\phi)+\nu(u_{xx},\phi_{xx})-(u_x,\phi_x)+(uu_x,\phi) = 0 $$
with $\phi \in H_{0}^2(I)$ as defined in the paper linked above.
I am having trouble translating this weak form into  FreeFEM++ code.  I am unsure how to handle the higher order term $\nu(u_{xx},\phi_{xx})$ and the nonlinear term $(uu_x,\phi)$.  Does anyone know how to represent this in FreeFEM? Will I need to discretize the weak form or is this good enough?  Can the command int2d be used to solve this problem?


text:
Q: Android JavaScriptInterface not calling method in Android GINGERBREAD I am injecting some JavaScript inside a WebView in order to detect a button click. It's working correctly in all devices where I tested it except in GINGERBREAD devices. In that device I am getting this error:
Uncaught TypeError: Object com.zonaapp.flamencomovil.PromotionActivity$1@407c3088 has no method 'share' at :1

This is my relevant code:
private void startWebview(){

    wvPromo.getSettings().setJavaScriptEnabled(true);
    wvPromo.addJavascriptInterface(this, "JSInterface");
    wvPromo.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageFinished(WebView view, String url) {
            if(mDialog!=null && mDialog.isShowing()) mDialog.dismiss();
            view.loadUrl("javascript:(function() { "
                    + "var myEl = document.getElementById('boton_regalar');   "
                    + "myEl.addEventListener('click', function(){window.JSInterface.share();}, false);"
                    + "})();");
            view.addJavascriptInterface(this, "JSInterface");
        }
    });

    wvPromo.setWebChromeClient(new WebChromeClient() {
        public void onConsoleMessage(String message, int lineNumber,
                String sourceID) {
            Log.d("MyApplication", message + " -- From line " + lineNumber
                    + " of " + sourceID);
        }
    });
    wvPromo.loadUrl(promo.getWebViewURl());
    wvPromo.setBackgroundColor(0x00000000);
}

And here is my share method:
@JavascriptInterface
public void share() {
    Log.i(getClass().getSimpleName(), "Share button");
    String textShare = promo.getShareTitle() + " " + promo.getShareUrl();
    Intent i = Utils.shareContentIntent(this,textShare, promo.getShareTitle());
    startActivity(i);
}

Method is correctly called in all others OS versions!

A: You should define your share() method inside JSInterface class
Here's the solution:
    //1) init your webView and set interface
void initWebView(){
    webView.getSettings().setJavaScriptEnabled(true);
    webView.addJavascriptInterface(this, "JSInterface");
}

//2) Wrap js function call into interface like so
void callJsFunction(){
    webView.loadUrl("javascript:JSInterface.onShare( shareFunction(){} );");
}

//3) Define your interface class and catch the callback
class JSInterface{
    @JavascriptInterface
    public void onShare() {
        //catch the callback
        Log.i(getClass().getSimpleName(), "Share button");
        String textShare = promo.getShareTitle() + " " + promo.getShareUrl();
        Intent i = Utils.shareContentIntent(this,textShare, promo.getShareTitle());
        startActivity(i);
    }
}


text:
Q: How to get object from Request POST object with Angular Ajax call in NODEJS?
*

*After click the button will call a method .. The code is,
    .controller('templeDetailsList', function ($scope, $http, $ionicModal) {

     $scope.starclick = function(){

     var newFav = [{
            "favid":"4654646",
            "favname":"sometext"
        }];

     var favurl = "http://localhost:1337/users/adduser";

     $.post(favurl, newFav, function () {
            alert("Successfully posted data");
        });
    }

    });

*Node service with mongodb code is,
    var express = require('express');

    var router = express();

    router.post('/adduser', function (req, res) {

    var db = req.db;

    var d1 = req.body;

    var collection = db.get('userlist');
    collection.insert(req.body, function (err, result) {
        res.send(
            (err === null) ? { msg: '' } : { msg: err }
        );
    });
    });

Http request succesfully worked for to calling service method. But i can't get request object in service method. What can i do for this?. I want get requesting object data in service method. please anyone help to me.

A: Add body parser to your express app.
var router = express();
bodyParser = require('body-parser');
router.use(bodyParser.json());


text:
Q: Product route undefined and not showing on frontend ReactJS part, mongoDB I'm getting troubles about showing product, when I try to GET api/products/:id, my browser return localhost:3000/produit/undefined, and Request failed with status code 500
link repo : https://github.com/Kwonsongji/mern-stack-calone-shop
Here is my part Back :
Model : Product.js
const mongoose = require('mongoose');

const productSchema = new mongoose.Schema({
  name: {
    type: String,
    required: true
  },
  image: {
    type: String,
    required: true
  },
  price: {
    type: Number,
    required: true
  },
  material: {
    type: String,
    required: true
  },

  countInStock: {
    type: Number,
    required: true
  },
}, {
  timestamps: true
})
const Product = mongoose.model('Product', productSchema);

module.exports = Product;

Controller : productCtrl.js
const db = require('../config/db');
const Product = require('../models/Product');
const datas = require('../data/datas');

const productCtrl = {
  sendDatasProductToMoongoose: async (req, res) => {
    try {
      //await db.products.dropIndexes({})
      await Product.deleteMany({})
                    //.remove({});
      const createdProducts = await Product.insertMany(datas.products);
      console.log('Data Import Sucess createdProducts',createdProducts);
      res.send({ createdProducts});
    } catch (error) {
      res.status(500).send(error.message)
    }
  },

  getAllProducts: async (req, res) => {
    try {
      console.log("req :", req.body);
      // Product.find({})
      const products = await Product.find()
        .then((Document) => {
          console.log("Document: ", Document);
           console.log("Req.params: ", req.params);
           if (!Document) {
            return res
                    .status(404)
                    .json({ message: "This ressource doesn't exist " });
          }
          res.status(200).json(datas.products);
         })
        .catch((error) => {
          console.log(error);
          res.status(500).json(error)
        });
  } catch (error) {
    console.error(error);
    res.status(500).json({ message: "Server Error" });
    }
  },
    getProductById: async (req, res) => {
      try {
 /*        const product = await Product.findOne(_id)  */
        const product = await Product.findById(req.params.id)
        /*  .then((Document) => {
          if (!Document) {
            return res
              .status(404)
              .json({ message: "This document doesn't exist" });
          }
          res.status(200).json(Document);
        })
        .catch((error) => {
          res.status(500).json(error);
        });  */
       res.send(product); // returne moi les données en json
    } catch (error) {
      console.error(error);
      res.status(500).json({ message: "Server Error" });
    }
  },

};

module.exports = productCtrl;

Router : product.js
const productCtrl = require('../controllers/productCtrl');
const router = express.Router();

router.get('/seed', productCtrl.sendDatasProductToMoongoose )
router.get('/', productCtrl.getAllProducts);
router.get('/:id', productCtrl.getProductById);

module.exports = router;

Server : server.js
const express = require("express");
const cors = require("cors");
// require connexion db and run it
const connectDB = require("./config/db");
const app = express();

connectDB();

app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(cors());

app.use("/api/products",require("./routes/product.js"));
app.use("/api/users",require("./routes/user.js"))

const PORT = process.env.PORT || 5000;
app.listen(PORT, () => console.log(`Server running on ${PORT}`));

Frontend :
productActions :
import * as actionTypes from '../constants/productConstants';
import axios from 'axios';

export const getProducts = () => async (dispatch) => {
  try {
    dispatch({ type: actionTypes.GET_PRODUCTS_REQUEST });

    const { data } = await axios.get(`/api/products`);

    dispatch({
      type: actionTypes.GET_PRODUCTS_SUCESS,
      payload: data
    })
  } catch (error) {
    dispatch({
      type: actionTypes.GET_PRODUCTS_FAIL,
      payload: error.response && error.response.message
        ? error.response.data.message
        : error.message
    });

  }
};

export const getProductDetails = (id) => async (dispatch) => {
  try {
    dispatch({ type: actionTypes.GET_PRODUCT_DETAILS_REQUEST });

    const { data } = await axios.get(`/api/products/${id}`);

    dispatch({
      type: actionTypes.GET_PRODUCT_DETAILS_SUCESS,
      payload: data
    })
  } catch (error) {
    dispatch({
      type: actionTypes.GET_PRODUCT_DETAILS_FAIL,
      payload: error.response && error.response.message
        ? error.response.data.message
        : error.message
    });

  }
};
export const removeProductDetails = () => (dispatch) => {
  dispatch({ type: actionTypes.GET_PRODUCT_DETAILS_RESET });
};

productReducer.js:
import * as actionTypes from '../constants/productConstants';

const initialStateForGetProducts = {
  products: []
};
export const getProductsReducer = (state = initialStateForGetProducts, action) => {
  switch (action.type) {
    case actionTypes.GET_PRODUCTS_REQUEST:
      return {
        loading: true,
        products:[]
      }
    case actionTypes.GET_PRODUCTS_SUCESS:
      return {
        loading: false,
        products: action.payload
      }
    case actionTypes.GET_PRODUCTS_FAIL:
      return {
        loading: false,
        error: action.payload //on veut afficher l'erreur
      }
    default:
      return state;
  }
}

const initialStateForGetOneProduct = {
  product: {}
}
export const getProductDetailsReducer = (state = initialStateForGetOneProduct, action) => {
  switch (action.type) {
    case actionTypes.GET_PRODUCT_DETAILS_REQUEST:
      return {
        loading: true,
      }
    case actionTypes.GET_PRODUCT_DETAILS_SUCESS:
      return {
        loading: false,
        product: action.payload
      }
      case actionTypes.GET_PRODUCT_DETAILS_FAIL:
      return {
        loading: false,
        error: action.payload
      }
    case actionTypes.GET_PRODUCT_DETAILS_RESET:
      return {
      product: {}
      }
    default:
      return state;
  }
}

ProductScreen.js
/* eslint-disable react/prop-types */
import React from 'react';
import './style.scss';
//import moonPendant from '../../assets/fonts/moon-pendant.png';
import { useState, useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';

// Actions
import { getProductDetails } from '../../../redux/actions/productActions';
import { addToCart } from '../../../redux/actions/cartActions';

const ProductScreen = ( {match, history}) => {
   const [qty, setQty] = useState(1);
  const dispatch = useDispatch();

   const productDetails = useSelector(state => state.getProductDetails);
   const { loading, error, product } = productDetails;

   useEffect(() => {
     if (product && match.params.id !== product._id) {
       dispatch(getProductDetails(match.params.id));
     }
   }, [dispatch, product, match]);

  const addToCartHandler = () => {
    dispatch(addToCart(product._id, qty));
    history.push("/panier");
  }
  return (

      { loading ?
Loading...

        : error ?
{error}

          : (
            <>

 {/*                     */}

 {product.name}

 {product.price}

 {product.material}

            Prix:  {product.price} euros

                    Statut:

                      {product.countInStock > 0 ? "En Stock" : "En Rupture de Stock"}

            Quantité:
                    <select value={qty} /* lorsqu'on slct le nbre voulu */
                      onChange={(e) => setQty(e.target.value)}>
                {[...Array(product.countInStock).keys()].map((x) => (
                  <option
                    key={x+1}
                    value={x+1}
                  >
                    {x+1}
                  </option> //on utilise l'instance array pour créer un tableau de liste
                ))}
            </select>

            <button
              type="button"
              onClick={ addToCartHandler}
              className="productScreen__right__add"
              > Ajouter
            </button>

            </>
      )}

  )
}

export default ProductScreen;

link repo : https://github.com/Kwonsongji/mern-stack-calone-shop


text:
Q: How to generate an animated scrolling image effect I am using The following snippet in order to create a scrolling textbox:

This is the scrolling text

however, I am looking to create a 'scrolling' image, and whenever I try to create an  tag within the 'This is the scrolling text' div, it doesn't show up on the page (at all).
I'm pretty new to javascript (ok, a complete novice) and would appreciate if anyone could inform me of a way of adding this image to this effect:

I have been unable to find a way of creating something like this, other than creating my own gif image in photoshop/etc.
EDIT
I tried using a marqee, however:

A: If you want to add an image that is 128px high into your div, you also need to change the height of the containing element from 20px to 128px.
Here's your code working:

A: If you want to use your existing code just alter the height of #oScroll in the CSS


text:
Q: How to set agentlib property for mvn tomcat plugin (jpda) Related to
eclipse debug remote web application => How do I debug a remote application in my eclipse
How can I set / archive this in the mvn tomcat plugin?
http://tomcat.apache.org/maven-plugin-2.0-SNAPSHOT/tomcat7-maven-plugin/
The only thing that might help is setting systemProperty but that doesn't work for me ;/
Goal: let tomcat run on console via maven but enable remote debugging for different IDEs
(YES guys, we can run tomcat in Eclipse WTP! That's not the question ;)

A: It's a bit old thread but for the sake of completeness I though i might add a little here.
The plugin does not provide debug options configuration for whatever strange reason.
Thus your only option is to manually specify debug configuration to the JVM that runs the process.
In your environment, there are three ways achieve this:

*

*Using a well known-maven environment variable (as described by childno.de)

*Directly specifying the options to maven (no env. variable needed):

mvn -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y tomcat7:run-war

*With an eclipse Run configuration That's basically the same like 2) but you define this in eclipse (that would be good if you didn't want to leave  the IDE at all).
  To achieve that you need to specify a Maven Build Run configuration.
  Set the goal to tomcat7:run (or similar) and then navigate to the JRE tab. The VM arguments area is where you specify the debug configuration: -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y

  If you opt for 3), the precise run goal for tomcat7 is irrelevant to the debug enabling. Choose according to you use case (dynamic web project, war, etc.). Same goes for the plugin configuration. However, make sure to specify that you are using the tomcat maven plugin in the pluginManagement section of your project pom:

<pluginManagement>
   <plugins>
        <plugin>
        <groupId>org.apache.tomcat.maven</groupId>
        <artifactId>tomcat7-maven-plugin</artifactId>
        <version>2.1</version>
    </plugin>
    </plugins>
</pluginManagement>

A: $ export MAVEN_OPTS=-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n
$ mvn tomcat7:run-war

^^ that's it, not cool (as it is not in POM) but it works
Source: http://aaronz-sakai.blogspot.de/2009/02/debugging-jetty-when-running-mvn.html

A: OR... you could simply add the following tag to your plugin configuration
 <jpda>true</jpda>

Then when you execute: mvn tomcat7:run, it will start jpda on port 8000.
Funny thing is even though I have tested this and it works, I can't find any code in the opensource code base to explain why it works, nor have I found any way to change from the default port 8000.
Apache seems to have dropped the ball when it comes to documentation of this plugin.


text:
Q: Can't install less-loader in VueCLI3 project Some pages of my project use less to render,so I run the npm command to install less and less-loader but find just less can successfully installed,for unknown reason, the less-loader keep falied to install and throw error like this:
PS E:\myprogramming\tutorial\frontEND\eduResourceCode\Vue教程\复习\Vue脚手架CLI3\vuexdemo_> npm i less-loader
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: webpack@4.46.0
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^4.0.0" from @intervolga/optimize-cssnano-plugin@1.0.6
npm ERR!   node_modules/@intervolga/optimize-cssnano-plugin
npm ERR!     @intervolga/optimize-cssnano-plugin@"^1.0.5" from @vue/cli-service@4.5.13
npm ERR!     node_modules/@vue/cli-service
npm ERR!       peer @vue/cli-service@"^3.0.0 || ^4.0.0-0" from @vue/cli-plugin-babel@4.5.13
npm ERR!       node_modules/@vue/cli-plugin-babel
npm ERR!         dev @vue/cli-plugin-babel@"~4.5.0" from the root project
npm ERR!       4 more (@vue/cli-plugin-eslint, @vue/cli-plugin-router, ...)
npm ERR!   peer webpack@"^4.0.0 || ^5.0.0" from @soda/friendly-errors-webpack-plugin@1.8.0
npm ERR!   node_modules/@soda/friendly-errors-webpack-plugin
npm ERR!     @soda/friendly-errors-webpack-plugin@"^1.7.1" from @vue/cli-service@4.5.13
npm ERR!     node_modules/@vue/cli-service
npm ERR!       peer @vue/cli-service@"^3.0.0 || ^4.0.0-0" from @vue/cli-plugin-babel@4.5.13
npm ERR!       node_modules/@vue/cli-plugin-babel
npm ERR!         dev @vue/cli-plugin-babel@"~4.5.0" from the root project
npm ERR!       4 more (@vue/cli-plugin-eslint, @vue/cli-plugin-router, ...)
npm ERR!   18 more (@vue/cli-plugin-babel, @vue/cli-plugin-eslint, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! less-loader@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: webpack@5.38.1
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^5.0.0" from less-loader@9.1.0
npm ERR!   node_modules/less-loader
npm ERR!     less-loader@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\hw\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\hw\AppData\Local\npm-cache\_logs\2021-06-13T12_28_33_753Z-debug.log

But my dev server can't run without less-loader, I try many methods, like reinstalling two dependencies,use vue-cil to download the plugin with same name, or stick other less-loader tag to my package.json but all don't work.
I find a possible,but weird reason is my node_modules don't have a less-loader folder! Now how I can fix it?

A: I merge my project by take the css-prodecessor,and it solve my problem.but I still confuse.
I don't like solve problem by merge because it will break some files what I already finished.
If I can have less-loader after my project built that will be better.


text:
Q: Minecraft High CPU (125%~) using openJava 6/7 if I run Minecraft with OpenJDK 6 or 7 on my Ubuntu 12.04 machine, it eats nearly of the CPU and I have lags during minecraft gameplay.
What I have tried so far:

*

*start minecraft with something like java -Xmx2044M -Xms1024M  -jar minecraft.jar

*Using recommended Nvdia drivers

*Using latest beta nvidia drivers

*Tested minecraft with both openJava Versions (6/7)

*Switched between Unity 2D and Unity 3D

*Verified that I am using the latest graphic engine that is used by Minecraft (LWJGL)

My machine is an AMD Phenom 955x using Ubuntu 12.04 with a Nvidia GTX 275
Until now nothing changed the bad performance of minecraft. Suggestions are much appreciated, thank you in advance for any help!

A: You could try using OptiFine - it's worked well for me in the past.
The SSP mod also works very well; Minecraft singleplayer now runs as a shell of SMP (thus enabling LAN connection), and this mod allows Minecraft to run like it used to, just as pure SSP.


text:
Q: NullPointerException in WindowManagerImpl on Android OS 3.2 I got an null pointer exception on Android 3.2 emulator  on a simple Android project created by Wizerd with a service in separated process, when I switch between "Stretch to fill screen" to "Zoom to fill screen". This crash will not happen if the service is put into the same process with main activity, namely "android:process" attribute not specified. While it only happens when I add "android:process" to manifest file for my test service.
The exception is:
FATAL EXCEPTION: main

    java.lang.NullPointerException
      at android.view.WindowManagerImpl.reportNewConfiguration(WindowManagerImpl.java:427)
      at android.app.ActivityThread.handleUpdatePackageCompatibilityInfo(ActivityThread.java:2801)
      at android.app.ActivityThread.access$2700(ActivityThread.java:122)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1151)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:132)
      at android.app.ActivityThread.main(ActivityThread.java:4123)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:491)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
      at dalvik.system.NativeStart.main(Native Method)

My test code:
TestActivity.java (Generated by Wizerd)
package com.test;

import android.app.Activity;

public class TestActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Intent intent = new Intent(this, TestService.class);
        startService(intent);
    }
}

TestService.java (Most of the functions are empty)
Package com.test;

import android.content.ComponentName;

public class TestService extends Service {
    private boolean m_connected = false;

    private ServiceConnection m_connInitService = new ServiceConnection() {
        public void onServiceConnection(ComponentName className, IBinder service) {
            m_connected = true;
        }

        public void onServiceDisconnected(ComponentName className) {
        }
    };

    public static class TestServiceBinder extends Binder {
    }

    public IBinder onBind(Intent intent) {
        return new TestServiceBinder();
    }

    public void onDestroy() {
        super.onDestroy();
    }

    public int onStartCommand(Intent intent, int flags, int startId) {
        return 1;
    }
}

If I run the test app without service or with service in the same process the screen compatibility switch will not cause any problem. However, I do not understand why service can cause system exception during screen compatibility switch. Is this because service process is a non-UI process? Which could potentially triggers a bug inside the Android core code?

A: I've found in the documentation the following thing:

android:process
If the name assigned to this attribute begins with a colon (':'), a
new process, private to the application, is created when it's needed
and the service runs in that process. If the process name begins with
a lowercase character, the service will run in a global process of
that name, provided that it has permission to do so. This allows
components in different applications to share a process, reducing
resource usage.

Thus, if you assign process name that starts with lowercase you should have permissions to do this. But I do not know where these permissions are checked. Maybe they are checked in the WindowManagerImpl and it cannot find this global process and thus returns null. This is just an assumption.

A: The reason causing this issue is Screen Compatibility Mode, see how to disable it for your app:
http://developer.android.com/guide/practices/screen-compat-mode.html#Disable


text:
Q: Node.js running a shell command from the same process I'm trying to make a way to boot up a Minecraft server from nodejs, but I'm having trouble making a way to run commands from nodejs.
const { spawn } = require('node:child_process')
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const fs = require('fs');

app.get('/start', (req, res) => {
  fs.writeFile('minecraftstatus.txt', 'on', (err) => {
    if (err) throw err;
  });
  const command = spawn('java',  ['-jar', '-Xms2048M','-Xmx2048M', '-Dfile.encoding=utf8', 'server.jar', 'nogui'])

  // the `data` event is fired every time data is
  // output from the command
  command.stdout.on('data', output => {
      // the output data is captured and printed in the callback
      fs.appendFile('console.txt', ("\n" + output.toString()), 'utf-8', err => {
        console.log(err)
      })
      console.log("Output: ", output.toString())
  })

  res.status(200).send("OK")
});

app.listen(80, () => {
  console.log('Server started on port 80');
});

From what you see above, whenever a user sends a GET request, it sends a command and appends any output to a text file. I need to make a way in order to send commands to Minecraft. I need to send commands to the same shell that nodejs ran the command.
I've tried this:
app.get('/mcstop', (req, res) => {
    try {
      const command2 = spawn('/stop')

      // the `data` event is fired every time data is
      // output from the command
      command2.stdout.on('data', output => {
          // the output data is captured and printed in the callback
          console.log("Output: ", output.toString())
      })

      res.status(200).send("OK")
    }
    catch {
      console.log("Oh no...")
    }
});

Where it sends /stop to the shell, but it seems like it isn't being ran on the same shell as where the Minecraft server was created from.
How could I achieve this?


text:
Q: R&W with AXI4 slave I'm a begginer in VHDL and Vivado and I need to establish communication between slave and master; exactly I need to read and write. I mean, my slave is a memory and my master is a DDR controller.
I used the wizard to create an IP but I am pretty lost... This is what the wizard returns:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity axitest_v1_0 is
    generic (
        -- Users to add parameters here

        -- User parameters ends
        -- Do not modify the parameters beyond this line

        -- Parameters of Axi Slave Bus Interface S00_AXI
        C_S00_AXI_ID_WIDTH  : integer   := 1;
        C_S00_AXI_DATA_WIDTH    : integer   := 32;
        C_S00_AXI_ADDR_WIDTH    : integer   := 7;
        C_S00_AXI_AWUSER_WIDTH  : integer   := 0;
        C_S00_AXI_ARUSER_WIDTH  : integer   := 0;
        C_S00_AXI_WUSER_WIDTH   : integer   := 0;
        C_S00_AXI_RUSER_WIDTH   : integer   := 0;
        C_S00_AXI_BUSER_WIDTH   : integer   := 0
    );
    port (
        -- Users to add ports here

        -- User ports ends
        -- Do not modify the ports beyond this line

        -- Ports of Axi Slave Bus Interface S00_AXI
        s00_axi_aclk    : in std_logic;
        s00_axi_aresetn : in std_logic;
        s00_axi_awid    : in std_logic_vector(C_S00_AXI_ID_WIDTH-1 downto 0);
        s00_axi_awaddr  : in std_logic_vector(C_S00_AXI_ADDR_WIDTH-1 downto 0);
        s00_axi_awlen   : in std_logic_vector(7 downto 0);
        s00_axi_awsize  : in std_logic_vector(2 downto 0);
        s00_axi_awburst : in std_logic_vector(1 downto 0);
        s00_axi_awlock  : in std_logic;
        s00_axi_awcache : in std_logic_vector(3 downto 0);
        s00_axi_awprot  : in std_logic_vector(2 downto 0);
        s00_axi_awqos   : in std_logic_vector(3 downto 0);
        s00_axi_awregion    : in std_logic_vector(3 downto 0);
        s00_axi_awuser  : in std_logic_vector(C_S00_AXI_AWUSER_WIDTH-1 downto 0);
        s00_axi_awvalid : in std_logic;
        s00_axi_awready : out std_logic;
        s00_axi_wdata   : in std_logic_vector(C_S00_AXI_DATA_WIDTH-1 downto 0);
        s00_axi_wstrb   : in std_logic_vector((C_S00_AXI_DATA_WIDTH/8)-1 downto 0);
        s00_axi_wlast   : in std_logic;
        s00_axi_wuser   : in std_logic_vector(C_S00_AXI_WUSER_WIDTH-1 downto 0);
        s00_axi_wvalid  : in std_logic;
        s00_axi_wready  : out std_logic;
        s00_axi_bid : out std_logic_vector(C_S00_AXI_ID_WIDTH-1 downto 0);
        s00_axi_bresp   : out std_logic_vector(1 downto 0);
        s00_axi_buser   : out std_logic_vector(C_S00_AXI_BUSER_WIDTH-1 downto 0);
        s00_axi_bvalid  : out std_logic;
        s00_axi_bready  : in std_logic;
        s00_axi_arid    : in std_logic_vector(C_S00_AXI_ID_WIDTH-1 downto 0);
        s00_axi_araddr  : in std_logic_vector(C_S00_AXI_ADDR_WIDTH-1 downto 0);
        s00_axi_arlen   : in std_logic_vector(7 downto 0);
        s00_axi_arsize  : in std_logic_vector(2 downto 0);
        s00_axi_arburst : in std_logic_vector(1 downto 0);
        s00_axi_arlock  : in std_logic;
        s00_axi_arcache : in std_logic_vector(3 downto 0);
        s00_axi_arprot  : in std_logic_vector(2 downto 0);
        s00_axi_arqos   : in std_logic_vector(3 downto 0);
        s00_axi_arregion    : in std_logic_vector(3 downto 0);
        s00_axi_aruser  : in std_logic_vector(C_S00_AXI_ARUSER_WIDTH-1 downto 0);
        s00_axi_arvalid : in std_logic;
        s00_axi_arready : out std_logic;
        s00_axi_rid : out std_logic_vector(C_S00_AXI_ID_WIDTH-1 downto 0);
        s00_axi_rdata   : out std_logic_vector(C_S00_AXI_DATA_WIDTH-1 downto 0);
        s00_axi_rresp   : out std_logic_vector(1 downto 0);
        s00_axi_rlast   : out std_logic;
        s00_axi_ruser   : out std_logic_vector(C_S00_AXI_RUSER_WIDTH-1 downto 0);
        s00_axi_rvalid  : out std_logic;
        s00_axi_rready  : in std_logic
    );
end axitest_v1_0;

architecture arch_imp of axitest_v1_0 is

    -- component declaration
    component axitest_v1_0_S00_AXI is
        generic (
        C_S_AXI_ID_WIDTH    : integer   := 1;
        C_S_AXI_DATA_WIDTH  : integer   := 32;
        C_S_AXI_ADDR_WIDTH  : integer   := 7;
        C_S_AXI_AWUSER_WIDTH    : integer   := 0;
        C_S_AXI_ARUSER_WIDTH    : integer   := 0;
        C_S_AXI_WUSER_WIDTH : integer   := 0;
        C_S_AXI_RUSER_WIDTH : integer   := 0;
        C_S_AXI_BUSER_WIDTH : integer   := 0
        );
        port (
        S_AXI_ACLK  : in std_logic;
        S_AXI_ARESETN   : in std_logic;
        S_AXI_AWID  : in std_logic_vector(C_S_AXI_ID_WIDTH-1 downto 0);
        S_AXI_AWADDR    : in std_logic_vector(C_S_AXI_ADDR_WIDTH-1 downto 0);
        S_AXI_AWLEN : in std_logic_vector(7 downto 0);
        S_AXI_AWSIZE    : in std_logic_vector(2 downto 0);
        S_AXI_AWBURST   : in std_logic_vector(1 downto 0);
        S_AXI_AWLOCK    : in std_logic;
        S_AXI_AWCACHE   : in std_logic_vector(3 downto 0);
        S_AXI_AWPROT    : in std_logic_vector(2 downto 0);
        S_AXI_AWQOS : in std_logic_vector(3 downto 0);
        S_AXI_AWREGION  : in std_logic_vector(3 downto 0);
        S_AXI_AWUSER    : in std_logic_vector(C_S_AXI_AWUSER_WIDTH-1 downto 0);
        S_AXI_AWVALID   : in std_logic;
        S_AXI_AWREADY   : out std_logic;
        S_AXI_WDATA : in std_logic_vector(C_S_AXI_DATA_WIDTH-1 downto 0);
        S_AXI_WSTRB : in std_logic_vector((C_S_AXI_DATA_WIDTH/8)-1 downto 0);
        S_AXI_WLAST : in std_logic;
        S_AXI_WUSER : in std_logic_vector(C_S_AXI_WUSER_WIDTH-1 downto 0);
        S_AXI_WVALID    : in std_logic;
        S_AXI_WREADY    : out std_logic;
        S_AXI_BID   : out std_logic_vector(C_S_AXI_ID_WIDTH-1 downto 0);
        S_AXI_BRESP : out std_logic_vector(1 downto 0);
        S_AXI_BUSER : out std_logic_vector(C_S_AXI_BUSER_WIDTH-1 downto 0);
        S_AXI_BVALID    : out std_logic;
        S_AXI_BREADY    : in std_logic;
        S_AXI_ARID  : in std_logic_vector(C_S_AXI_ID_WIDTH-1 downto 0);
        S_AXI_ARADDR    : in std_logic_vector(C_S_AXI_ADDR_WIDTH-1 downto 0);
        S_AXI_ARLEN : in std_logic_vector(7 downto 0);
        S_AXI_ARSIZE    : in std_logic_vector(2 downto 0);
        S_AXI_ARBURST   : in std_logic_vector(1 downto 0);
        S_AXI_ARLOCK    : in std_logic;
        S_AXI_ARCACHE   : in std_logic_vector(3 downto 0);
        S_AXI_ARPROT    : in std_logic_vector(2 downto 0);
        S_AXI_ARQOS : in std_logic_vector(3 downto 0);
        S_AXI_ARREGION  : in std_logic_vector(3 downto 0);
        S_AXI_ARUSER    : in std_logic_vector(C_S_AXI_ARUSER_WIDTH-1 downto 0);
        S_AXI_ARVALID   : in std_logic;
        S_AXI_ARREADY   : out std_logic;
        S_AXI_RID   : out std_logic_vector(C_S_AXI_ID_WIDTH-1 downto 0);
        S_AXI_RDATA : out std_logic_vector(C_S_AXI_DATA_WIDTH-1 downto 0);
        S_AXI_RRESP : out std_logic_vector(1 downto 0);
        S_AXI_RLAST : out std_logic;
        S_AXI_RUSER : out std_logic_vector(C_S_AXI_RUSER_WIDTH-1 downto 0);
        S_AXI_RVALID    : out std_logic;
        S_AXI_RREADY    : in std_logic
        );
    end component axitest_v1_0_S00_AXI;

begin

-- Instantiation of Axi Bus Interface S00_AXI
axitest_v1_0_S00_AXI_inst : axitest_v1_0_S00_AXI
    generic map (
        C_S_AXI_ID_WIDTH    => C_S00_AXI_ID_WIDTH,
        C_S_AXI_DATA_WIDTH  => C_S00_AXI_DATA_WIDTH,
        C_S_AXI_ADDR_WIDTH  => C_S00_AXI_ADDR_WIDTH,
        C_S_AXI_AWUSER_WIDTH    => C_S00_AXI_AWUSER_WIDTH,
        C_S_AXI_ARUSER_WIDTH    => C_S00_AXI_ARUSER_WIDTH,
        C_S_AXI_WUSER_WIDTH => C_S00_AXI_WUSER_WIDTH,
        C_S_AXI_RUSER_WIDTH => C_S00_AXI_RUSER_WIDTH,
        C_S_AXI_BUSER_WIDTH => C_S00_AXI_BUSER_WIDTH
    )
    port map (
        S_AXI_ACLK  => s00_axi_aclk,
        S_AXI_ARESETN   => s00_axi_aresetn,
        S_AXI_AWID  => s00_axi_awid,
        S_AXI_AWADDR    => s00_axi_awaddr,
        S_AXI_AWLEN => s00_axi_awlen,
        S_AXI_AWSIZE    => s00_axi_awsize,
        S_AXI_AWBURST   => s00_axi_awburst,
        S_AXI_AWLOCK    => s00_axi_awlock,
        S_AXI_AWCACHE   => s00_axi_awcache,
        S_AXI_AWPROT    => s00_axi_awprot,
        S_AXI_AWQOS => s00_axi_awqos,
        S_AXI_AWREGION  => s00_axi_awregion,
        S_AXI_AWUSER    => s00_axi_awuser,
        S_AXI_AWVALID   => s00_axi_awvalid,
        S_AXI_AWREADY   => s00_axi_awready,
        S_AXI_WDATA => s00_axi_wdata,
        S_AXI_WSTRB => s00_axi_wstrb,
        S_AXI_WLAST => s00_axi_wlast,
        S_AXI_WUSER => s00_axi_wuser,
        S_AXI_WVALID    => s00_axi_wvalid,
        S_AXI_WREADY    => s00_axi_wready,
        S_AXI_BID   => s00_axi_bid,
        S_AXI_BRESP => s00_axi_bresp,
        S_AXI_BUSER => s00_axi_buser,
        S_AXI_BVALID    => s00_axi_bvalid,
        S_AXI_BREADY    => s00_axi_bready,
        S_AXI_ARID  => s00_axi_arid,
        S_AXI_ARADDR    => s00_axi_araddr,
        S_AXI_ARLEN => s00_axi_arlen,
        S_AXI_ARSIZE    => s00_axi_arsize,
        S_AXI_ARBURST   => s00_axi_arburst,
        S_AXI_ARLOCK    => s00_axi_arlock,
        S_AXI_ARCACHE   => s00_axi_arcache,
        S_AXI_ARPROT    => s00_axi_arprot,
        S_AXI_ARQOS => s00_axi_arqos,
        S_AXI_ARREGION  => s00_axi_arregion,
        S_AXI_ARUSER    => s00_axi_aruser,
        S_AXI_ARVALID   => s00_axi_arvalid,
        S_AXI_ARREADY   => s00_axi_arready,
        S_AXI_RID   => s00_axi_rid,
        S_AXI_RDATA => s00_axi_rdata,
        S_AXI_RRESP => s00_axi_rresp,
        S_AXI_RLAST => s00_axi_rlast,
        S_AXI_RUSER => s00_axi_ruser,
        S_AXI_RVALID    => s00_axi_rvalid,
        S_AXI_RREADY    => s00_axi_rready
    );

    -- Add user logic here

    -- User logic ends

end arch_imp;

I thinkt that, it is here, in the end where I have to type my code related to the communication.

A: The wizard returns some template with the complete logic for an AXI4 device (same for AXI4Lite and Stream). All you have to is to place the logic, the parameter and the connections in the marked area.
So if you create a new IP, the wizard generates two files

*

*myip_v1_0

*myip_v1_0_S00_AXI

The first one is the top design, which you will see in the Customization GUI tab of the Package IP tab. You can add customization parameters like the bus width there. All you have to is to create a new generic in the entity. Your logic is placed in myip_v1_0_S00_AXI:
    -- Add user logic here
    << Logic here >>
    -- User logic ends

    port (
        -- Users to add ports here
        << Additional connections here >>
        -- User ports ends
        -- Do not modify the ports beyond this line

    generic (
        -- Users to add parameters here
        << Customization parameters here >>
        -- User parameters ends
        -- Do not modify the parameters beyond this line


text:
Q: I want to run .exe or bat file in C# asp.net (mvc) Below are different code I have used but I need to execute ETL or batch file gave link to button dashbord via view page but I couldn't execute or run file
please suggest me on same
public ActionResult RunETL(){
    try
    {
        System.Diagnostics.Process p = new System.Diagnostics.Process();
        p.StartInfo = new System.Diagnostics.ProcessStartInfo(@"D:\Jobs\Execute");
        p.Start();

        //Process p = new Process();
        //// Redirect the output stream of the child process.
        //p.StartInfo.UseShellExecute = false;
        //p.StartInfo.RedirectStandardOutput = true;
        ////p.StartInfo.FileName = @"D:\Jobs\Execute";

        //p.Start();
        //// Do not wait for the child process to exit before
        //// reading to the end of its redirected stream.
        //p.WaitForExit();
        //// Read the output stream first and then wait.
        //string output = p.StandardOutput.ReadToEnd();
        //p.WaitForExit();
        //Response.Write("Done");
        ////ViewBag.Result = "ETL Running";
    }
    catch (Exception ex)
    {

        //ViewBag.Result = ex.Message;

    }

    return RedirectToAction("Home");
}

A: have a Look at the Application Pool Identity that's used to run your web app.
it should have a Execute Right on the location of the batch file.


text:
Q: Simple problems in tessellation shader implementation I tried to render a triangle with a tessellation shader. Now, without the tessellation shaders, the triangle renders fine. As soon as I add the tessellation shaders, I get a blank screen. I have also written glPatchParameteri(GL_PATCH_VERTICES,3) before glDrawArrays(GL_PATCHES,0,3).
Here are the shaders:
VERTEX SHADER:
#version 440 core

layout (location = 0) in  vec2 apos;
out vec2 pos;

void main()
{
    //gl_Position = vec4(apos,1.0f,1.0f);  without tessellation shaders
    pos = apos;
}

TESSELLATION CONTROL SHADER
#version 440 core

layout (vertices = 3) out;
in vec2 pos[];
out vec2 EsPos[];
void main()
{
    EsPos[gl_InvocationID] = pos[gl_InvocationID];
    gl_TessLevelOuter[0] = 3.0f;
    gl_TessLevelOuter[1] = 3.0f;
    gl_TessLevelOuter[2] = 3.0f;
    gl_TessLevelInner[0] = 3.0f;
}

TESSELLATION EVALUATE SHADER
#version 440 core

layout (triangles, equal_spacing, ccw) in;
in vec2 EsPos[];
vec2 finalpos;

vec2 interpolate2D(vec2 v0, vec2 v1);

void main()
{
    finalpos = interpolate2D(EsPos[0],EsPos[1]);
    gl_Position = vec4(finalpos,0.0f,1.0f);
}
vec2 interpolate2D(vec2 v0, vec2 v1)
{
    return (vec2(gl_TessCoord.x)*v0 + vec2(gl_TessCoord.y)*v1);
}

FRAGMENT SHADER
#version 440 core

out vec4 Fragment;

void main()
{
    Fragment = vec4(0.0f,1.0f,1.0f,1.0f);
}

EDIT:
I made changes in the interpolate2D function, but still I am getting a blank screen.

A: The output patch size of the Tessellation Evaluation shader is 3:

layout (vertices = 3) out;

Thus the length of the input array to the Tessellation Control Shader is 3, too. Furthermore, the abstract patch type is triangles,

layout (triangles, equal_spacing, ccw) in;

thus the tessellation coordinate (gl_TessCoord) is a Barycentric coordinate. Change the interpolation:
vec2 interpolate2D(vec2 v0, vec2 v1, vec2 v2)
{
    return v0*gl_TessCoord.x + v1*gl_TessCoord.y + v2*gl_TessCoord.z;
}

void main()
{
    finalpos = interpolate2D(EsPos[0], EsPos[1], EsPos[2]);

    // [...]
}


text:
Q: How to get the selected value of select option using java code I'm studying Java Web. And now, I have a question like that. This is my code in JSP file:
<select id="ddlFruits" name="ddlFruits" onchange="GetSelectedTextValue()">
   <option value="0">Banana</option>
   <option value="1">Apple</option>
   <option value="2">Mango</option>
   <option value="3">Orange</option>
</select>

<script type="text/javascript">
    function GetSelectedTextValue() {
        var t = document.getElementById("ddlFruits");
                var fruitsID = t.options[t.selectedIndex].value;
        <%
             // How to get Value of fruitsID in here???

             // do something with fruitsID.
         %>
}
</script>

How to get the selected value of select option (variable : fruitsID ) in <%  // Java Code %>.
I used this code: request.getParameter("fruitsID ").
But it returned null.
Thanks for advance!


text:
Q: How to solve $4\sin x\cos x+2\sqrt3\sin x-2\cos x-\sqrt3=0$? How can I solve the trigonometric equation $$4\sin x\cos x+2\sqrt3\sin x-2\cos x-\sqrt3=0$$
I used to replace $\sin x$ by $\sqrt{1-\cos^2 x}$ but doesn't work very well ;°
I just want a hint kiss:°

A: Hint: Note that $$4\sin x\cos x+2\sqrt3\sin x-2\cos x-\sqrt3=0$$ is equivalent to $$\left(2\sin x-1\right)\left(2\cos x+\sqrt3\right)=0.$$ Can you take it from here?
I hope this helps.
Best wishes, $\mathcal H$akim.


text:
Q: HTAccess: Redirect a subdomain to a another protocoll I would like to make a rule for a subdomain, so my teamspeak subdomain will directly be redirected to the ts3 protocol.
So, let me show you an example:
RewriteCond %{HTTP_HOST} ^(ts\.)?example\.com$ [NC]
RewriteRule ^(.*)$ ts3://example.com/$1 [R=301,L]

Unfortunately, this isnt working (resulting an endless loop).
To be honest, I've no experience with .htaccess. What should it look like? Tried some other examples, but most of them just rewrite into a directory or redirect to another domain, so I am lacking of examples...
Is it even possible to do what I'm trying?

A: TL;DR .htaccess aren't made for that, and TS3 wouldn't understand Apache's HTTP traffic (for many protocol-related reasons). The best solution is probably to make ts.example.com an alias to example.com (in your domain's DNS configuration), and to ask your clients to connect to ts.example.com:x where x is your Teamspeak connection port.
.htaccess files are used by the Apache web server. It is part of a system which handles HTTP traffic. Teamspeak 3 does not understand HTTP traffic... because it's not an HTTP server. Therefore, redirecting HTTP traffic to TS3 with an .htaccess file (assuming it was the right way to do so) would not make much sense: TS3 would just discard the requests, since it can't understand HTTP requests.
The Teamspeak service is associated to a port, not an address. If you use netstat, you'll actually be able to find that port. I'm not very familiar with Teamspeak, but I heard of ports 9987 and 10011... You'd have to check your TS3 configuration for that :)
If you want to redirect everything coming in from ts.example.com to example.com, I'd simply recommend that you configure your domain name to work that way. Make ts.example.com an alias to example.com, and all requests sent to ts.example.com:9987 will arrive at example.com:9987. This kind of configuration is usually handled by your authoritative name server, and you should have access to DNS zones management in order to apply your changes.
Now, redirecting all traffic coming from the ts.example.com to port 9987 specifically is more complicated, and it is also very counterproductive. Teamspeak uses several ports (queries, voice data, file transfers...) : if you send everything to 9987, then it might not receive queries and file transfers, possibly making the initial connection impossible. Besides, your machine will not be able to distinguish traffic coming from ts.example.com of that coming from example.com, since the client reached it by IP after resolving the name.
An HTTP server (or maybe, proxy) could indeed make that distinction using the HTTP Host header, but there are so many protocol-related issues to deal with here:

*

*HTTP is connection-based, the traffic would have to be transported from TCP to UDP (hello overhead!).

*The Host:  header would have to be remove so that only the TS3 binary data remains. Mixing text and binary data is, of course, a terrible idea.

*The proxy would also have to be able to distinguish voice data from file transfers and TS3 queries... and I'm pretty sure such a proxy does not exist.

*...


text:
Q: Model-View-Presenter. Model is a list - Is it right architectural decision? Let me show you an abstract example:
I have a weather machine which can produce different type of weathers: snow (falling snowflakes), rain, etc...
Every snowflake or raindrop is a view: so i have many views.
Because I want unique algorithm of falling, every snowflake or raindrop has its own instance of class. That's why in my opinion model must be a list of snowflakes/raindrops.
Presenter receive events of wind changing, falling speed changing and change model properties.
Is it right architectural decision?

A: I am no expert on animation and graphics, but using instances of classes for every rain drop is going to eat up a lot of memory and possibly not be very fast. MVP doesn't sound like the right fit for graphics programming. Have you considering using something like XNA?


text:
Q: exporting data in json format I am trying to export data from PhpMyAdmin to JSON format
This code works for select lat,lng from googlemaps, but does not for the address column
My code is:
<?php
$con=mysqli_connect("localhost","root","","googlemaps");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql = "SELECT lat,lng,`addr` FROM infos";
if ($result = mysqli_query($con, $sql))
{

$resultArray = array();
$tempArray = array();

// Loop through each row in the result set
while($row =mysqli_fetch_array($result))
{
    // Add each row into our results array
    $tempArray = $row;
    array_push($resultArray, $tempArray);
}

$fp = fopen('results01.json', 'w');
fwrite($fp, "{ \"tab\":  ");
fwrite($fp, json_encode($resultArray));
fwrite($fp, " }");
fclose($fp);
echo json_encode($resultArray);
//var_dump($resultArray);
?>

Screenshot of infos table:

A: Just found the solution it s actually adding this before the select query :
mysqli_set_charset($con, "utf8");
$sql = "SELECT lat,lng,`addr` FROM infos";
if ($result = mysqli_query($con, $sql))
{......}


text:
Q: Visual studio will not undo my git changes For some reason, my VS will not remove the files from changes view after "undo changes" :

The actual changes are gone when I view a diff, but I want the files not to show. I would like to know a permanent solution to this. I already know I can do a stash or similar outside of VS to hide the files from showing.
EDIT:
I have found a work-around. When I undo, then with the remaining files select stage, they disappear!

A: Based on your description (undo does not change file list, staging forces an update), this sounds like the following issue related to Visual Studio 2015 and 2017:
https://developercommunity2.visualstudio.com/t/shGitsh---shUndosh-changes-doe/681074?space=8&q=git+undo+2015
According to Microsoft, Visual Studio 2019 is also affected. The problem is now being tracked in this issue:
https://developercommunity2.visualstudio.com/t/Undo-changes-with-new-git-experience-pre/1170228
The root cause seems to be related to line endings:
Microsoft:

So our suspicion is that maybe dotnet format rewrote the line endings (and only the line-endings), so now git status reports that there are changed files. However, if you try to actually checkout-index, git will not actually mutate anything. However, git status believes there are changes, because the stat-block is leading it to believe there has been a change (since there has been a change).
One way to verify this is to, from the command line, or visual studio.
Stage everything (git add *) (you can do this from visual studio by right click > stage)
git status (or, if in Visual Studio, it will refresh status automatically)
If the files disappear from view, then there's a line-ending issue, and git has suddenly realized that they're actually the same file.

Reporter:

Yes! Staging everything made all of the files disappear :-)

Microsoft:

Cool! So here's what we know!
For EOL-only changes, SHA changes don't change. Git apparently stores these internally as LF-only
Neither checkout nor checkout-index will overwrite the file on disk
Basically, since git is our source of truth here, we get misleading information. However, I think git maybe made the right decision here in regards to performance. That being said, this is super confusing from a UX perspective, so we'll be evaluating this.
We're evaluating how to improve this UX.

The issue is still open but it seems that the root caused was identified. For now, there's only the workaround.


text:
Q: A question about the distance from the center to the foci of a hyperbola. When it comes to an ellipse, I know that an ellipse with major axis $2a$ and minor axis $2b$ and a distance from the center to the foci $c$ has a relationship $b^2+c^2=a^2$.
This can be shown by using the definition of the focal radii and just pick the covertex to come up with this equality.
A similar situation with a hyperbola gives us $a^2+b^2=c^2$, but I don't know why this is true.
I am trying to convince my students with basic precalc material, can someone help me out ?


text:
Q: How to Detect a specific sound in android app? I am beginner in Android Programmming. Developing a sound detection app in Android studio. Can somebody help me to detect a specific sound ?

A: Try using musicg
musicg is a lightweight audio analysis library, written in Java, with the purpose of extracting both high level and low level audio features. This API allows developers to extract audio features and operate audio data like reading, cutting and trimming easily from an inputstream. It also provides tools for digital signal processing, renders the wavform or spectrogram for research and development purpose.
Add musicg library to your project and try this code :-
Wave w1= new Wave("first_wav"); // Base Audio file
Wave w2= new Wave("second_wav"); // Audio file to compare
// Finding Audio Fingerprint Similarity
FingerprintSimilarity fps = w1.getFingerprintSimilarity(w2);
float score = fps.getScore();
float sim = fps.getSimilarity();

sim contains the similarity between to audio files (value rages from 0 to 1.0). value greater that 0.3 can be considered as similar sound.musicg uses 16 bit PCM audio files.
but getFingerprintSimilarity() accept only wave format files.
This app uses musicg for sound detection.


text:
Q: Best alternative to http_referer for internal redirect? after discovering the unreliability of HTTP_REFERER, I was wondering what was the best alternative to indicate an operation the correct url of origin which then perform an internal redirect.
After reading various topics I seemed to understand that only possible solutions are:

1) specify the referer url directly as a parameter of the operation.
2) create a custom referer storage system using session.

In my opinion, the first solution is logically more correct and free of contraindications.
Using the second solution and storing the referrer in session on every page request is possible that using the site in the various tabs referrer stored does not correspond to the page where we're actually sending the operation; Despite this bug (in my opinion quite ugly) this second solution seemed the most recommended by experts. Why? Did I miss something?
Thank you all for your attention and sorry for my low level of English.

A:
storing the referrer in session on every page request is possible that using the site in the various tabs referrer stored does not correspond to the page where we're actually sending the operation;  Despite this bug (in my opinion quite ugly) this second solution seemed the most recommended by experts

You could notify server to update session with current page before leaving - this way next loaded page will know what was the previous one without passing anything in URL.
That said though this solution still have some faults - it will break on any connection failure or if someone loads multiple pages in multiple tabs and requests go out of synch (it's relying on an assumption that between javascript sending request on leaving the page and server receiving request to load a next page nothing else occurs).
Best way would be to use both - this and HTTP_REFERER as a fall-back option.
Other than that mentioned passing of current pages in URL will do, but it's understandable why you try to avoid it.


text:
Q: Automatic Macro in Access to check today date minus date on table Is there a an automatic way to do this scenrio in access?
I have a table which have StartDate, EndDate and checkerBox
what my goal is like today is January 31, I want a VBA or Macro something in access to check if the EndDate=Today it should Check the CheckBox if not leave it like that...
I'm looking a good way to do this... any suggestion is welcome
thanks

A: Try this in vba :
Private Sub Form_Current()

  If DateDiff("d", inputEndDate, Date) = 0 Then
   chkDate = 1  ' Check the checkbox chkDate
  End If

End Sub

A: If the "checkerBox" in your table is a Yes/No field and you want to update the value of that field then this might be what you're after:

UPDATE [TableName] SET [checkerBox]=True WHERE [EndDate]=Date()


text:
Q: Converting non digit text to double and then back to string I have a unique situation where I have to write code on top of an already establish platform so I am trying to figure out a hack to make something work.
The problem I have is I have a user defined string.  Basically naming a signal.  I need to get this into another program but the only method available is within a double value.  Below is what I have tried but not been able to get it to work.  I tried converting the string to byte array and then creating a new string by looping the bytes.  Then I convert this string to a Double.  Then use BitCoverter to get it back to byte array and then try to get the string.
Not sure if this can even be achieve.  Any ideas?
string signal = "R3MEXA";
string newId = "1";

byte[] asciiBytes = System.Text.Encoding.ASCII.GetBytes(signal);

foreach (byte b in asciiBytes)
    newId += b.ToString();

double signalInt = Double.Parse(newId);

byte[] bytes = BitConverter.GetBytes(signalInt);

string result = System.Text.Encoding.ASCII.GetString(bytes);

A: Asuming your string consists of ASCII characters (7Bit):
Convert your string into a bit-Array, seven bits per character.
Convert this bit-array into a string of digits, using 3 bits for each digit. (there are digits 0..7)
Convert this string of digits to a double number.

A: You initially set newId to "1", which means when you're doing later conversion, you're not going to get the right output unless to account for the "1" again.

A: It doesn't work, because if you convert it back you don't know the length of a byte.
So I made every byte to a length of 3.
        string signal = "R3MEXA";
        string newId = "1";

        byte[] asciiBytes = System.Text.Encoding.ASCII.GetBytes(signal);

        foreach (byte b in asciiBytes)
            newId += b.ToString().PadLeft(3,'0'); //Add Zero, if the byte has less than 3 digits

        double signalInt = Double.Parse(newId);

        //Convert it back
        List<byte> bytes = new List<byte>(); //Create a list, we don't know how many bytes will come (Or you calc it: maximum is _signal / 3)
        //string _signal = signalInt.ToString("F0"); //Maybe you know a better way to get the double to string without scientific
        //This is my workaround to get the integer part from the double:
        //It's not perfect, but  I don't know another way at the moment without losing information
        string _signal = "";
        while (signalInt > 1)
        {
            int _int = (int)(signalInt % 10);
            _signal += (_int).ToString();
            signalInt /= 10;
        }
        _signal = String.Join("",_signal.Reverse());
        for (int i = 1; i < _signal.Length; i+=3)
        {
            byte b = Convert.ToByte(_signal.Substring(i, 3)); //Make 3 digits to one byte
            if(b!=0) //With the ToString("F0") it is possible that empty bytes are at the end
            bytes.Add(b);
        }
        string result = System.Text.Encoding.ASCII.GetString(bytes.ToArray()); //Yeah "R3MEX" The "A" is lost, because double can't hold that much.

What can improved?

*

*Not every PadLeft is necessary. Work from back to front and if the third digit of a byte is greater than 2, you know, that the byte has only two digits. (Sorry for my english, I write an example).

Example
194 | 68 | 75 | 13
194687513
Reverse:
315786491
31  //5 is too big    13
57  //8 is too big    75
86  //4 is too big    68
491 //1 is ok        194


text:
Q: Discord BOT, guildMemberSpeaking event is not working I want to make the bot detect when a user is talking. in the discord documentation I saw i needed to use the event guildMemberSpeaking. This is the code:
const Discord = require('discord.js');
const client = new Discord.Client();

client.once('ready', () => {
    console.log('Talkover is online!');
})

// Joins the voice channel with every tekst
client.on('message', async message => {
    // Join the same voice channel of the author of the message
    if (message.member.voice.channel) {
        const connection = await message.member.voice.channel.join();

    }
});

client.on('guildMemberSpeaking', (member, speaking) => {

    if (speaking) {
        console.log('speaking');
    } else {
        console.log('notspeaking');
    }

});

for some reason message works but guildmemberspeaking not. I don't know what I'm doing wrong.

A: You have to use an async listener my friend
client.on('guildMemberSpeaking', async (member, speaking) => {
    if (speaking) {
        console.log('speaking');
    } else {
        console.log('notspeaking');
    }
});

Just add async before your parameters and you're done.


text:
Q: Kotlin ListView IndexOutOfBoundsException (new to kotlin) I'm making my own music app but i'm having an error that i don't understand :

*

*in the bit of code where i try to access a random view (shuffle), i get the java.lang.IndexOutOfBoundsException: Index:96 Size:11.

*96 in this example is the view in the listview that i'm trying to access.

*It happens in this line : var iView = listViewMusic.get(idShuffle)

*Same if i use listViewMusic[idShuffle]
EDIT : Turns out that 11 is only the 11 visible items on screen at any given moment, even if the list contains hundreds of items. When i use listViewMusic.smoothscrolltoposition(idShuffle) it works, but the size of 11 now relates to the 11 on screen after the scrolling
The function playNext() inside the activity, called when clicking on the shuffle button:
fun playNext(){

        try {
            // Find the order of the next song to play
            var idShuffle = musicAdapter!!.getIdofItem(listMusicShuffled.get(musicNextToPlay).title)

            // Find the right record in the list
            //var iView = listViewMusic[idShuffle]
            //toastIt(applicationContext, "adapter count ${listViewMusic.adapter.count}")
            //toastIt(applicationContext, "listview count ${listViewMusic.count}")
            var iView = listViewMusic.get(idShuffle) //throws the error

            // Play it
            playOrPause(iView)

            // Prepare the next track
            musicNextToPlay += 1
            if (musicNextToPlay >= listMusicShuffled.size) {
                musicNextToPlay = -1
            }
        } catch (e:Exception) {toastException(applicationContext, "playnext", e) }

    }

The part of the function onCreate that fills in the listViewMusic:
// Retrieve the data
val mediaStoreUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
val cursor = contentResolver.query(mediaStoreUri, null, "", null, null)

//Browse the data
listMusic = mutableListOf()
val listMusicJson = getMusicFromJson()
while (cursor!!.moveToNext()) {
      val musicName = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME))
      val musicArtist = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST))
      val musicUrl = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.DATA))
      val musicType:String =
                if (musicArtist.contains("lmdmf", true)) { "LMDMF" }
                else if (musicName.contains("slack", true)) { "SLACK" }
                else { "MUSIC" }

      listMusic.add(
               MusicTrack(
                         musicName,
                         musicPlayCount,
                         musicUrl,
                         musicType
                )
       )
}
cursor.close()

musicAdapter = MusicAdapter(listMusic.sortedWith(compareBy<MusicTrack>{ it.title }).filter { it.type == "MUSIC"}.toMutableList())
listViewMusic.adapter = musicAdapter


text:
Q: Question of Jordan Decomposition Proof in Artin's Algebra Book
Can someone tell me why we can assume that the chains of subspaces become constant for large $r$ ?
It is page 122 of the 2nd edition of the book
Here is also a pdf file:
http://home.ustc.edu.cn/~liweiyu/documents/Algebra,%20Second%20Edition,%20Michael%20Artin.pdf

A: Because $V$ is finite dimensional, $K_i$ and $U_i$ must also be finite dimensional. If, for instance, the sequence of $K_i$ did not become eventually constant, then there is some sub-sequence $K_{i'}$ that is strictly increasing. This means that the dimensions of $K_{i'}$ are also strictly increasing. However, each of these must also be bounded above by the dimension of $V$. So, we have a strictly increasing set of integers that has an upper bound, a contradiction.
The proof for the $U_i$ is similar, replacing "increasing", "upper", and "above" with their antonyms as appropriate.