text:
Q: How to enforce a specific Spring Security version dependency in Spring Boot How do you ensure Spring Security >3.2.1 is used in accordance with this documented, bug?:
class path resource [org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.class]
cannot be opened because it does not exist

I've tried upgrading it in my POM.xml with no luck (Intellij complains the version doesn't exist):

My local repository path in Intellij Maven Settings is correct. I hover over its complaint and select "Update Maven Indices". It tries to update my local repository, returning only that the dependencies do not exist.
So, how else can I ensure GlobalAuthenticationConfigurerAdapter.class is found?

A: I think the current answer to this question can be found here:
Gradle
https://docs.spring.io/spring-security/reference/getting-spring-security.html#getting-gradle-boot
e.g. for Spring Security version 5.7.0-SNAPSHOT specify property
ext['spring-security.version']='5.7.0-SNAPSHOT'

in your Gradle file
Maven
https://docs.spring.io/spring-security/reference/getting-spring-security.html#getting-maven-boot
e.g. for Spring Security version 5.7.0-SNAPSHOT specify property
<properties>
    <!-- ... -->
    <spring-security.version>5.7.0-SNAPSHOT</spring-security.version>
</properties>

Also remember that if you're going to try out new builds that might not exist in public Maven repositories, you might have to add Spring's own repositories, for example https://repo.spring.io/snapshot.

A: if you are using older spring boot starter but you want latest security you could do something like this
 <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.3.2.RELEASE</version>
</parent>
<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-core</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>4.1.3.RELEASE</version>
    </dependency>

A: When using Spring Boot use the different Spring Boot Starter projects to get the appropriate dependencies. For Spring Security that implies to adding the spring-boot-starter-security dependency to get all necessary Spring Security dependencies.
Using the starters will save you from hunting down the correct dependencies and dependency versions, you will get a working set of dependencies this way.


text:
Q: highcharts jquery dynamic change chart type column to bar I'm trying to switch of graph type using jquery.
I found the way to change dinamically the chart type (without recreating a new chart) by using the function :
series[i].update({ type: chartType});
My first question will be : There is a way to change the all chart and not just the series ? If not keep reading :)
But with this function i'm not able to make the 'bar' chart working. It's acting like a column chart. As you can see the pie example is working as excepted.
bar : http://www.highcharts.com/demo/bar-basic
How it works(sample example) :

    <button id="set_column">column</button>
    <button id="set_bar">bar</button>
    <button id="set_pie">pie</button>

$('#set_column').click(function () {
    var chart = $(this).parent('div').attr('id');
    chart = chart.replace('_', '');
    $('#' + chart).highcharts().series[0].update({
        type: "column"
    });
});
$('#set_bar').click(function () {
    var chart = $(this).parent('div').attr('id');
    chart = chart.replace('_', '');
    $('#' + chart).highcharts().series[0].update({
        type: "bar"
    });
});
$('#set_pie').click(function () {
    var chart = $(this).parent('div').attr('id');
    chart = chart.replace('_', '');
    $('#' + chart).highcharts().series[0].update({
        type: "pie"
    });
});

Highcharts creation :
$('#top10').highcharts({
    chart: {
        type: 'column',
        margin: [50, 50, 100, 80]
    },
    title: {
        text: 'TOP10'
    },
    subtitle: {
        text: ' '
    },
    credits: {
        enabled: false
    },
    xAxis: {
        categories: ['1', '2', '3', '4'],
        labels: {
            rotation: -45,
            align: 'right',
            style: {
                fontSize: '13px',
                fontFamily: 'Verdana, sans-serif'
            }
        }
    },
    yAxis: {
        min: 0,
        title: {
            text: 'Ilość'
        }
    },
    legend: {
        enabled: false
    },
    tooltip: {
        formatter: function () {
            return '' + this.x + '
' + 'Ilość: ' + this.y;
        }
    },
    series: [{
        name: 'Ilość zgłoszeń, TOP10',
        data: [1, 2, 3, 43],
        dataLabels: {
            enabled: true,
            rotation: -90,
            color: '#FFFFFF',
            align: 'right',
            x: 4,
            y: 10,
            style: {
                fontSize: '13px',
                fontFamily: 'Verdana, sans-serif'
            }
        }
    }]
});

Here is a fiddle example : http://jsfiddle.net/supergg/zqvNq/4/
Thanks,

A: This works for me:
$.each(chart.series, function (key, series) {
    series.update(
        {type: 'bar'},
        false
    );
}

A: You can use inverted parameter in chart and update yAxis. http://jsfiddle.net/n9xkR/8/
$('#bar').click(function () {

    chart.inverted = true;
    chart.xAxis[0].update({}, false);
    chart.yAxis[0].update({}, false);
    chart.series[0].update({
        type: 'column'
    });

});

A: Here what works for me:
function changeType() {
  var series  = chart.series[0];
  var newType = your_condition_here ? 'column' : 'bar';
  var dataArray = [],
      points = series.data;

  series.chart.addSeries({
      type: newType,
      name: series.name,
      color: series.color,
      data: series.options.data
  }, false);
  series.remove();
}

It creates new series using the new type and removes the old one.
Free to add more options as you need.
Hope it helps someone :)

A: You are able to update the chart type at the level of the chart. Since you have set the type inside the chart attribute, you need to update the same attribute.
// Initializing Chart
let probChart = new Highcharts.Chart('container', {
  chart: {
    type: "line"
  },
});

// Updating Chart Type
probChart.update({
  chart: { type: "column" }
});

A: Not sure you find an answer yet or not but I found one link which is 101% useful to you even for future reference. So can you have a look please. I was searching for something else and I found this link and also got your question.
   [http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/members/series-update/][1]

Let me know or accept my answer if this will help to you in any manner. Cheers:)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is there any way to synchronize a acf field with custom post type( media attachment ) tag I have added attachment_tag taxonomy to WordPress attachments.
Now, I want it to be synchronized an acf field.
I tried using edit_attachment hook to update both fields, but the problem is how to know if one tag is added to the tag or removed from acf field and vice versa, in this situation edit_attachment is not helping me.
Besides this, if the acf field is somewhere else(a post using it as featured image and I would like to add/update attachment_tag in edit post page), it will never trigger edit_attachment hook, so I am unable to synchronize these two.
If anyone knows any better hook or another way, I can use to make it work, please let me know.
If anything else, I need to add to describe my situation, please let me know.

A: Part of answer:-
Using acf/update_value like
add_filter('acf/update_value', 'my_acf_update_value', 10, 3);

function my_acf_update_value( $value, $post_id, $field  ) {
    // only do it to certain custom fields
    if( $field['name'] == 'custom_field' ) {

        // get the old (saved) value
        $old_value = get_field('custom_fields', $post_id);

        // get the new (posted) value
        $new_value = $_POST['acf']['custom_field'];
        if( $old_value != $new_value ) {
            //update here
        }
}

This is how it can be done out side attachment edit page.
Now only problem is with attachment edit page.


text:
Q: Unable to route to controller within subfolder - CodeIgniter I am new to CodeIgniter.
I am creating an application where I have created controllers within sub folders.
Demo
 -Application
    -Controllers
      - Home
        -Left
        -Right
        -Main

In routes.php, I have added below line.
$route['Left/(:any)'] = 'Home/Left/$1';

This is the URL I am trying to access.
http://localhost/Voyager/left/main
I am getting "404 Page Not Found error".
Is there something else I need to add or change?
Thanks for help.

A: I found the answer myself.
Issue was that I had another controller in controller folder with name Home, which was causing issue. Renaming that solved the issue.


text:
Q: How can I return to the original image after change the color pixels on my image in processing? In the program below, I try to change the pixel colors form a image with the click of the mouse, however, I'm trying to return to the original image with the second click but I haven't been able to find the rigth argument to do it...
PImage pic;

void setup(){
  pic=loadImage("road.jpg"); // Loading the image from a folder "date" attached to the sketch
  size (pic.width,pic.height);
image(pic,0,0);
}
void draw(){
}
void mousePressed(){

  loadPixels();
  pic.loadPixels();
        for (int y = 0; y < height; y++ ) {
          for (int x = 0; x < width; x++ ) {
            int loc = x + y*width;
             if(red(pixels[loc]) >170 && red(pixels[loc])<215){
               pixels[loc]=color(187,0,0);    //changing the pixels color from red to green
               }

             }
    }
    for (int y = 0; y < height; y++ ) {
          for (int x = 0; x < width; x++ ) {
            int loc = x + y*width;
             if(green(pixels[loc]) >120 && green(pixels[loc])<160){
               pixels[loc]=color(0,192,0);    //changing the pixels color form green to red
             }
          }
    }
       // I belive that here I have to add an argument that returns to the original image
  updatePixels();
}

I will appreciate any help.
Thanks.

A: What I typically do for this sort of thing is to create /two/ images, one being the file (target) and the other being a blank Image.
PImage target;
PImage destination;
target = loadImage("file.jpg");
destination = createImage(target.width, target.height, RGB);

And then I copy the target's information into the destination's pixels.  If I want to switch back, I can just call target; I'm able to freely swap back and forth by saving them as two separate images.
For an example, check out a sketch of mine on openprocesing: http://openprocessing.org/visuals/?visualID=49301


text:
Q: Chrome hangs for 15s+, no clues in DevTools — how can I debug this? One page on a client's site causes Chrome to hang unresponsively for 15 seconds or so. On macOS, the browser locks up completely and the spinning wheel appears.
There are no issues whatsoever in Safari or Firefox. I have no idea why this is happening, and DevTools doesn't seem to give any clues as to what's causing it.
Here's a screenshot of the timeline — note the flurry of activity in the final second, when the browser becomes responsive after seemingly doing "nothing" in the latter half:

Some comments on the timeline above:

*

*At ~12,500ms the page looks ready. In any other browser, it is ready for interaction at this point. You can see the final green chunk in the timeline finishes around here.

*Chrome completely locks up between 12,500ms and 28,500ms.

*I initially assumed the problem was with one of the 3rd-party/analytics scripts, as you can see the timeline shows activity from these right in the final second (> 28,000ms). I tried switching every one of these off, but exactly the same thing happens.

*This is a particularly large page, as it lists several thousand records in a JS datatable. I appreciate performance can be improved, but I don't believe that's the root cause. The page/plugin has been working absolutely fine for several years.

What can I try next? Thanks!

A: This turned out to be a bug in Google Chrome v107. Updating to v108 fixed the issue immediately.


text:
Q: Javascript / jQuery not executing in IE until the body of the page is moused over I'm working on a new portfolio site at http://www.nitrohandsome.com, and am using the experience to cut my teeth on jQuery. I'm using the latest build and jcarouselite along with the easing extension on my main page for a nifty carousel effect. It works fine in most browsers, but when I started testing in IE (7 and 8, haven't started optimizing for 6.5) I find that jQuery does not execute code as soon as the document is loaded. Rather, it seems to wait until one moves the mouse on to the body of html itself. This causes my carousel to display like a list and my main menu buttons to not render properly until the user moves the mouse. I used browsershots.org to check if it was only happening on my machine, but sadly not. Can anyone shed some light on this for me? I'm a novice with jQuery, and have only a bit more experience with javascript in general, although I am quite familiar with other ECMA languages such as Actionscript.
I would post the source, but the live preview of the post shows that it would try to render the HTML.
Thanks in advance.

A: You have an extra comma somewhere in your code. Check it for something like this:
{
 param: "whatever",
 param2: "whatever", // <- extra comma!
}

IE dies on these while Firefox does not.
EDIT: Here is the extra comma:
$("#carousel").jCarouselLite({
    btnNext: "#next",
    btnPrev: "#prev",
    visible: 3,
    easing: "easeout",
    speed: 150, // <- REMOVE THIS COMMA
});

SECOND EDIT:
For the sake of anyone that finds this page later on, the reason his page was not showing correctly was because of jQuery's 1.3.1 documented problems with document.ready firing after images or not at all. A fix to the latest jQuery version did the trick.


text:
Q: Config file of FOSRestBundle 2.3? I'm looking for configuration's path of FOSRestBundle 2.3.
I have Symfony 2.8.
I have checked app/config/config.yml but nothing about fos_rest :/
When I type PHP app/console config:debug fos_rest I got the configuration of this bundle.
Please help !

A: I have current configuration for my bundle.
# FOSRest Configuration
fos_rest:
    body_listener: true
    format_listener:
        rules:
            - { path: '^/filemanager', priorities: ['html'], fallback_format: html, prefer_extension: false }
            - { path: '^/html', priorities: ['html'], fallback_format: html, prefer_extension: false }
            - { path: '^/', priorities: ['json'], fallback_format: json, prefer_extension: false }

param_fetcher_listener: true
view:
    view_response_listener: 'force'
    formats:
        json: true
exception:
    enabled: true


text:
Q: Custom Toolbar placed in the NavigationBar Shifting I'm having a strange problem with my custom toolbar that is sometimes shifting slightly right:
I created a UIView subclass that contains 4 UIButtons and a UIImageView.
I insert this component (custom toolbar) into the navigation bar of the view controller using the following line:
self.navigationItem.titleView = toolbar;

This works fine: The buttons are actionable etc.
However, depending on the view controller that I am pushing (using the navigation controller) the custom toolbar shifts slight to right, just enough to crop a tiny part of the image view.
When I compare the view controller that has a stable toolbar with another one that's toolbar is shifting, I cannot see any different. And they are pushed at the same level in the navigation history. So I am really confused. I thought it was because of the presence of the Back Button but it is present in both views. I think the most confusing thing is to have a controller view that behaves correctly and another one that behaves consistently differently.
Any ideas, pointers, links will be greatly appreciated.
Thanks in advance,
Happy holiday season.


text:
Q: Falla en la importación de 200,000 registros de Excel con PHP hacia SQL Server error 500 necesito de su ayuda. Requiero de importar 200,000 registros con 33 columnas de excel con php y ajax hacia la base de datos SQL Server, sin embargo; al realizar la importación y revisar la consola y el network me envía error 500, ya amplié el memory_limit = 1024M, max_execution_time = 30000, max_input_time = -1, post_max_size = 800M, upload_max_filesize = 3000M. Al llegar a 17,000 registros simplemente se truncan y me envía el error 500. He revisado en diferentes preguntas del foro y he hecho varias de las sugerencias que postearon, pero aún así no logro solucionar la importación.
A continuación mi código:

function uploadingAm4(){
    let inputAm4CoCo = document.getElementById('dataListAM4co').value;
    let listAm4Period = document.getElementById('dataListAM4period').value;
    let inputAm4Year = document.getElementById('am4Year').value;
    var excelAM4 = $("#importAM4id").val();

    if((inputAm4CoCo == "") || (listAm4Period == "") || (inputAm4Year == "")){
        inputAm4CoCo = "";
        listAm4Period = "";
        inputAm4Year = "";
        return swalfire();
    }
    if (excelAM4 === "") {
        return Swal.fire("Warning","The file is not .xlsx extension","warning");
    }
    var formDataAM4 = new FormData();
    var files =  $("#importAM4id")[0].files[0];
    formDataAM4.append('archivoexcelAM4', files);
    $.ajax({
        url: 'model/importAm4.php',
        type: 'post',
        data: formDataAM4,
        contentType: false,
        processData: false,
        cache: false,
        /* beforeSend: function(){
            $('#uploadAm4').attr('disabled', 'disabled');
            $('#uploadAm4').val('Importing');
            $('#importAM4id').attr('disabled', 'disabled');

        }, */
        success: function(res){
            $('#mostrarTablaAm4').html(res);
            console.log(res);
        }
    });
}
<form action="" method="post" enctype="multipart/form-data" id="filesAM4">

              Select your Actuals M4 Excel file
              <input class="form-control form-control-lg" id="importAM4id" name="importAM4" type="file" accept=".xls,.xlsx">

            <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
            <button type="button" id="uploadAm4" name="uploadAm4" class="btn btn-primary" onclick="return uploadingAm4()">Upload</button>

</form>

     session_start();
     /* variables*/
    $user = $_SESSION['signin'];
    require_once 'PHPExcel/Classes/PHPExcel.php';
    require 'PHPExcel/Classes/PHPExcel/IOFactory.php';
    require_once 'conexion.php';
    $conn = Conexion::conectardb();

try {
if(is_array($_FILES['archivoexcelAM4']) && count($_FILES['archivoexcelAM4'])>0){

    $max_filesize = 41943040;
    $fileName = $_FILES['archivoexcelAM4']['tmp_name'];
    $readExcel = PHPExcel_IOFactory::createReaderForFile($fileName);
    $excelObj = $readExcel->load($fileName);
    $sheet = $excelObj->getSheet(0);
    $row = $sheet->getHighestRow();

    /* echo '

'; */
    $laTablaAm4 ="EXEC Get_Temporary_Importing_Actuals_AM4";
    $byTablaAm4 = $conn->query($laTablaAm4);
        for ($fila=2; $fila <= $row; $fila++) {

            $IdEmpleado = $sheet->getCell('A'.$fila)->getValue();
            $Nombre = $sheet->getCell('B'.$fila)->getValue();
            $RegistroPatronal = $sheet->getCell('C'.$fila)->getValue();
            $CentrodeTrabajo = $sheet->getCell('D'.$fila)->getValue();
            $Concepto = $sheet->getCell('E'.$fila)->getValue();
            $Descripción = $sheet->getCell('F'.$fila)->getValue();
            $Importe = $sheet->getCell('G'.$fila)->getValue();
            $FechadePago = $sheet->getCell('H'.$fila)->getValue();
            $Anio = $sheet->getCell('I'.$fila)->getValue();
            $Mes = $sheet->getCell('J'.$fila)->getValue();
            $Agrupador_Totalizador  = $sheet->getCell('K'.$fila)->getValue();
            $Convenio = $sheet->getCell('L'.$fila)->getValue();
            $TipoSalario = $sheet->getCell('M'.$fila)->getValue();

            $elQueryAm4 = ("INSERT INTO ty_temporary_importing_actuals_am4([Id Empleado],[Nombre],[Registro Patronal],[Centro de Trabajo],[Concepto],[Descripción],[Importe],[Fecha de_ Pago] ,[Año],[Mes],[Agrupador/_Totalizador],[Convenio],[Tipo Salario]) VALUES ('".$IdEmpleado."','".$Nombre."','".$RegistroPatronal."','".$CentrodeTrabajo."','".$Concepto."','".$Descripción."', '".$Importe."','".$FechadePago."','".$Anio."','".$Mes."','".$Agrupador_Totalizador."','".$Convenio."','".$TipoSalario."')");

                $byQueryAm4 = $conn->query($elQueryAm4);
        }

}
} catch (\Throwable $th) {
//throw $th;
}


text:
Q: How to make Zebra Xing (Zxing) customs overlay as subview in Xamarin iOS I want to scan a barcode and return the result. I'm using ZXing for that. For Zxing when its default overlay, it would navigate to a new page and scan works perfectly. I want to stay on the same page and want a subview to enable camera and start scanning. Can anyone advise how to do that?
MyCode:
    MobileBarcodeScanner scanner;
    CustomOverlayView customOverlay;
    ZXingScannerView scannerView;
    UIActivityIndicatorView loadingView;
    UIView loadingBg;
    public event Action<ZXing.Result> OnScannedResult;
    public MobileBarcodeScanningOptions ScanningOptions { get; set; }

    public override void ViewDidLoad()
    {
        camView = new UIView(new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height / 4)) { BackgroundColor = UIColor.Clear };
        scanner = new MobileBarcodeScanner();

        Root = new RootElement("ZXingDwatNet.Mobile") {
            new Section {

                camView
            }
        };

        scannerView = new ZXingScannerView();

        camView = scannerView;
        loadingBg = camView;// new UIView(this.View.Frame) { BackgroundColor = UIColor.Purple, AutoresizingMask = UIViewAutoresizing.FlexibleDimensions };
        loadingView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray)
        {
            AutoresizingMask = UIViewAutoresizing.FlexibleMargins
        };
        loadingView.Frame = new CGRect((this.View.Frame.Width - loadingView.Frame.Width) / 4,
            (this.View.Frame.Height - loadingView.Frame.Height) / 4,
            loadingView.Frame.Width / 4,
            loadingView.Frame.Height / 4);

        loadingBg.AddSubview(loadingView);
        View.AddSubview(loadingBg);
        loadingView.StartAnimating();

        this.View.InsertSubviewBelow(scannerView, loadingView);

        this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

        scanner.UseCustomOverlay = true;
        scanner.CustomOverlay = camView;
        var options = new MobileBarcodeScanningOptions
        {
            AutoRotate = false,
            TryHarder = true
        };
        Task.Run( async () =>
        {
            var result = await scanner.Scan(options, false);
            HandleScanResult(result);
        } );

    }

    void HandleScanResult(ZXing.Result result)
    {
        string msg = "";

        if (result != null && !string.IsNullOrEmpty(result.Text))
            msg = "Found Barcode: " + result.Text;
        else
            msg = "Scanning Canceled!";

        this.InvokeOnMainThread(() =>
        {
            var av = new UIAlertView("Barcode Result", msg, null, "OK", null);
            av.Show();
        });
    }

    public override void ViewDidAppear(bool animated)
    {
        scannerView.OnScannerSetupComplete += HandleOnScannerSetupComplete;
        camView = scannerView;
        //originalStatusBarStyle = UIApplication.SharedApplication.StatusBarStyle;
        var opt = new MobileBarcodeScanningOptions();
        opt.DelayBetweenContinuousScans = 3000;
        ScanningOptions = opt;

        if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
        {
            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.Default;
            SetNeedsStatusBarAppearanceUpdate();
        }
        else
            UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.BlackTranslucent, false);

        Console.WriteLine("Starting to scan...");

        Task.Factory.StartNew(() =>
       {
           BeginInvokeOnMainThread(() => scannerView.StartScanning(result =>
           {

               //if (!ContinuousScanning)
               //{
                  // Console.WriteLine("Stopping scan...");
                  // scannerView.StopScanning();
               //}

               var evt = this.OnScannedResult;
               if (evt != null)
                   evt(result);

           }, this.ScanningOptions));
       });
    }

    void HandleOnScannerSetupComplete()
    {
        BeginInvokeOnMainThread(() =>
       {
           if (loadingView != null && loadingBg != null && loadingView.IsAnimating)
           {
               loadingView.StopAnimating();

               UIView.BeginAnimations("zoomout");

               UIView.SetAnimationDuration(2.0f);
               UIView.SetAnimationCurve(UIViewAnimationCurve.EaseOut);

               loadingBg.Transform = CGAffineTransform.MakeScale(2.0f, 2.0f);
               loadingBg.Alpha = 0.0f;

               UIView.CommitAnimations();

               loadingBg.RemoveFromSuperview();
           }
       });
    }

A: You have to use ZXingScannerView and add it to your view. You can see how to use ZXingScannerView in ZXingScannerViewController

A: For those who are interested in code;
// Variable declaration
private ZXingScannerView m_scannerView;

   // Below code snippet goes inside a method body
    var mobileBarcodeScanner = new MobileBarcodeScanner(this);
    m_scannerView =
        new ZXingScannerView(
            new CGRect(
                0,
                0,
                m_findPatientsView.CustomScannerView.ScannerView.Frame.Width,
                m_findPatientsView.CustomScannerView.ScannerView.Frame.Height))
        {
            AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
            UseCustomOverlayView = mobileBarcodeScanner.UseCustomOverlay,
            CustomOverlayView = mobileBarcodeScanner.CustomOverlay
        };

    // Adding scanner view as a subview
    m_findPatientsView.CustomScannerView.ScannerView.Add(m_scannerView);

    m_scannerView.StartScanning(
        async result =>
        {
            if (result != null)
            {
                // Handle scaneed result
            }
        });


text:
Q: Max value 2d array using pointer arithmetic I'm trying to write a programm to find a maximum value in column in a initialized 5x5 matrix, and change it to -1. I found out the way to do it, but i want to find a better solution.
Input:
    double array2d[5][5];
        double *ptr;
        ptr = array2d[0];
//        initializing matrix
        for (int i = 0; i < 5; ++i) {
            for (int j = 0; j < 5; ++j) {
                if (j % 2 != 0) {
                    array2d[i][j] = (i + 1) - 2.5;
                } else {
                    array2d[i][j] = 2 * (i + 1) + 0.5;
                }
            }
        }

This is my solution for the first column :
//        Changing the matrix using pointer arithmetic

        for (int i = 0; i < (sizeof(array2d) / sizeof(array2d[0][0])); ++i) {
            if (i % 5 == 0) {
                if (maxTemp <= *(ptr + i)) {
                    maxTemp = *(ptr + i);
                }
            }
        }
        for (int i = 0; i < (sizeof(array2d) / sizeof(array2d[0][0])); ++i) {
            if (i % 5 == 0) {
                if (*(ptr + i) == maxTemp) {
                    *(ptr + i) = -1;
                }
            }
        }

I can repeat this code 5 times, and get the result, but i want a better solution. THX.

A: I have written it in java but I think u can understand. This one is for all 5 columns at the same time. You can try this:
int count = 0;
double max = 0;
for (int i = 0; i < 5; ++i) {
   for (int j = 0; j < 5; ++j) {
       if (j == 0) {
            max = array2d[j][I];
            count = 0;
       }
       if (array2d[j][i] > max) {
           count = j;
       }
   }
   array2d[count][i] = -1;
}

A: Below is the complete program that uses pointer arithmetic. This program replaces all the maximum values in each column of the 2D array -1 as you desire.
#include <iostream>

int main()
{
    double array2d[5][5];
    double *ptr;
    ptr = array2d[0];
    //        initializing matrix
    for (int i = 0; i < 5; ++i) {
        for (int j = 0; j < 5; ++j) {
            if (j % 2 != 0) {
                array2d[i][j] = (i + 1) - 2.5;
            } else {
                array2d[i][j] = 2 * (i + 1) + 0.5;
            }
        }
    }

    //these(from this point on) are the things that i have added.
    //Everything above this comment is the same as your code.

    double (*rowBegin)[5]  = std::begin(array2d);
    double (*rowEnd)[5] = std::end(array2d);

    while(rowBegin != rowEnd)
    {
        double *colBegin = std::begin(rowBegin[0]);
        double *colEnd = std::end(rowBegin[0]);

        double lowestvalue = *colBegin;//for comparing elements
        //double *pointerToMaxValue = colBegin;

        while(colBegin!= colEnd)
        {
            if(*colBegin > lowestvalue)
            {
                lowestvalue = *colBegin;
                //pointerToMaxValue = colBegin ;
            }
            colBegin = colBegin + 1;
        }
        double *newcolBegin = std::begin(rowBegin[0]);
        double *newcolEnd = std::end(rowBegin[0]);

        while(newcolBegin!=newcolEnd)
        {
            if(*newcolBegin == lowestvalue)
            {
                *newcolBegin = -1;
            }
            ++newcolBegin;
        }
        ++rowBegin;
    }
    return 0;
}

The program can be checked here.
You can add print out all the element of the array to check whether the above program replaced all the maximum value in each column with -1.


text:
Q: How to do action in Visual Studio when a file type is saved Each time a JavaScript file is saved in Visual Studio, I want to be able to run a code that gets the file path as the input parameter, analyzes the file, and does some operations on it based on the content of that JavaScript file and its location.
I thought of creating an extension, and automating this process. But that's too much work. And its deployment to team members is also a pain.
Is there an easier way to hook into OS operations through Visual Studio?


text:
Q: Error occured during changing for loop to .apply() I am currently working on finding position(row index, column index) of maximum cell in each column of a dataframe.
There are a lot of similar dataframe like this, so I made a function like below.
def FindPosition_max(series_max, txt_name):
# series_max : only needed to get the number of columns in time_history(Index starts from 1).

    time_history = pd.read_csv(txt_name, skiprows=len(series_max)+7, header=None, usecols=[i for i in range(1,len(series_max)+1)])[:-2]

    col_index = series_max.index
    row_index = []
    for current_col_index in series_max.index:
        row_index.append(time_history.loc[:, current_col_index].idxmax())

    return row_index, col_index.tolist()

This works well, but takes too much time to run with a lot of dataframes. I found on the internet that .apply() is much more faster than for loop and I tried like this.
def FindPosition_max(series_max, txt_name):
    time_history = pd.read_csv(txt_name, skiprows=len(series_max)+7, header=None, usecols=[i for i in range(1,len(series_max)+1)])[:-2]

    col_index = series_max.index
    row_index = pd.Series(series_max.index).apply(lambda x: time_history.loc[:, x].idxmax())

    return row_index, series_max.index.tolist()

And the error comes like this,
  File "C:\Users\hwlee\anaconda3\lib\site-packages\pandas\core\internals\construction.py", line 844, in _list_of_series_to_arrays
    indexer = indexer_cache[id(index)] = index.get_indexer(columns)

AttributeError: 'builtin_function_or_method' object has no attribute 'get_indexer'

I tried to find what causes this error, but this error never goes away. Also when I tested the codes inside the function separately, it works well.
Could anyone help me to solve this problem? Thank u!


text:
Q: How to determine that a selection has been cleared I'm trying to find a way to determine that some selected text has been unselected.
I've tried using the isCollapsed property of window.getSelection(), however if you click inside the text range to clear the text selection it still reports as false. If you click outside the text range to clear the selection it reports as true.
This fiddle demonstrates what I'm talking about.
What else can I use to determine some selected text has been unselected?
I only need this to work in Chrome.
Thanks

A: How about using a timeout of 10ms
$(function() {
    $("#select").on('mouseup keyup', function() {
        setTimeout(function(){
        var sel = window.getSelection();
        console.log(sel.isCollapsed);
        },10);
    });
});

FIDDLE LINK


text:
Q: Next-auth CredentialProvider config and redirect I'm a bit confused on the implementation of the credentials provider and the redirects. The documentation says that the credentials provider doesn't support a callback and its for the OAuth providers. This is fine. However, instead of staying on the page and flashing an error message or even logging in like in this video it redirects to https://localhost/api/auth/callback/[credentials-provider-name]. Which doesn't even include the port I'm working with. If I explicitly set an id it uses that at the end of the url in instead.
This is what I have for the provider
import NextAuth from "next-auth"
import CredentialsProvider from "next-auth/providers/credentials"

export default NextAuth({
  // Configure one or more authentication providers
  providers: [
    CredentialsProvider({
      credentials: {
        username: { label: "Username", type: "text", placeholder: "someuser69" },
        password: { label: "Password", type: "password" },
      },
      name: "User Pass",
      type: "credentials",
      async authorize(credentials, req) {
        // Add logic here to look up the user from the credentials supplied
        return {
          id: 2,
          name: "user",
          email: "user@gmail.com",
        }
        return null;
      }
    })
    // ...add more providers here
  ],
  callbacks: {
    async jwt({ token, account }) {
      // Persist the OAuth access_token to the token right after signin
      if (account) {
        token.accessToken = account.access_token
      }
      return token
    },
    async session({ session, token, user }) {
      // Send properties to the client, like an access_token from a provider.
      session.accessToken = token.accessToken
      return session
    },
    async redirect({ url, baseUrl, }) {
      console.log("");
      return baseUrl;
    },
    async signIn({ user, account, profile, email, credentials }) {
      return '/home';
    }
  },
  session: {
    jwt: true,
    maxAge: 30 * 24 * 60 * 60,

  },
  secret: "CHANGE!!!",
  jwt: {
    maxAge: 60 * 60 * 24 * 30,
    secret: "afdsfi",

  },

})

I've looked through the docs and I'm not sure if I'm making some massive oversight, here. But some of my major confusions are:

*

*Where is this callback set and how do I turn in off in the default provider (if possible).

*I don't think the authorize function works. If I put a console log in it. It doesn't print to the terminal. So I don't even know if it's being called.

A: The issue is that I hadn't set the NEXTAUTH_URL variable correctly. The module apparently appends https if the protocol isn't set in the provided address. This is the case whether you are using 127.0.0.1 or localhost. The solution to fixing the callback issues is to pass in the unsecured http protocol if you're using a local address for testing or development purposes like so:
NEXTAUTH_URL='http://127.0.0.1:3001'


text:
Q: jQuery conflict on wordpress page I'm fairly new to jQuery and I'm encountering a problem.
On my page, I'd like to add a new piece of jQuery code which makes use of:
Somehow, when I add this script, my piece of code works, but the rest of the website code is broken.
I've tried to add the $.noConflict(true); script to my jquery. But it doesn't work somehow..
Can anybody help me out?
Thanks in advance.
Hank

A: You can set another variable to use instead of $ like var $j = jQuery.noConflict();

A: You need to create a new variable instead of the $ and use that.
For example for wordpress u will use $
then for the other jquery you could create a new one like this
var jquery = $.noConflict();

For example
Now you will use jquery instead of $
jquery(document).ready(function (){
  var form = jquery('#formcomments');
  var submit = jquery('#comments');

A: Wordpress is in noConflict mode by default, you don't have to add anything, you just have to use jQuery, and not $.
This is usually handled with jQuery wrappers
jQuery(function($) {
    // code here
});

It also means
$.noConflict(true);

won't work, as $ is not defined in Wordpress, it's all explained in the Codex

A: Try to convert all $ to jQuery in your code or use:
jQuery(function($) {
   // Your code here
});

or put your code inside a closure:
(function($){
    // Your code here
})(jQuery);

A: $.noConflict();
add this function where your scripts is conflict


text:
Q: KonvaJS connect squares and correct line placement? So I am building a UML drawing tool with KonvaJS and KonvaReact, for that I need to connect shapes with lines. I saw the tutorial on the website on connected objects https://konvajs.org/docs/sandbox/Connected_Objects.html.
They use a function get_connecter_points that calculates the possition from the line based on the radians on the circle.
function getConnectorPoints(from, to) {
        const dx = to.x - from.x;
        const dy = to.y - from.y;
        let angle = Math.atan2(-dy, dx);

        const radius = 50;

        return [
          from.x + -radius * Math.cos(angle + Math.PI),
          from.y + radius * Math.sin(angle + Math.PI),
          to.x + -radius * Math.cos(angle),
          to.y + radius * Math.sin(angle)
        ];
      }

I am trying to comeup with a simular function, but can't comeup with a good solution or find a good example. As you can see in the immage I just returned the from x and y and to x and y in the function and so the lines will be placed in the left top corner of every square.

The goal of the function should be to place the lines halfway to the side of the square and on the correct side of the square. So when the to square is placed below it should appear on the bottom side.
So if someone has a solution, any help is appreciated.

A: For the rectangles, the math is a bit more complex than for circles.
First, you need to calculate the angle for connection line, between two objects:
function getCenter(node) {
  return {
    x: node.x() + node.width() / 2,
    y: node.y() + node.height() / 2
  }
}
const c1 = getCenter(object1);
const c2 = getCenter(object2;

const dx = c1.x - c2.x;
const dy = c1.y - c2.y;
const angle = Math.atan2(-dy, dx);

Second, when you know the angle, you need a function, that finds a point of the rectangle border that you can use to connect with another object.
function getRectangleBorderPoint(radians, size, sideOffset = 0) {
  const width = size.width + sideOffset * 2;

  const height = size.height + sideOffset * 2;

  radians %= 2 * Math.PI;
  if (radians < 0) {
    radians += Math.PI * 2;
  }

  const phi = Math.atan(height / width);

  let x, y;
  if (
    (radians >= 2 * Math.PI - phi && radians <= 2 * Math.PI) ||
    (radians >= 0 && radians <= phi)
  ) {
    x = width / 2;
    y = Math.tan(radians) * x;
  } else if (radians >= phi && radians <= Math.PI - phi) {
    y = height / 2;
    x = y / Math.tan(radians);
  } else if (radians >= Math.PI - phi && radians <= Math.PI + phi) {
    x = -width / 2;
    y = Math.tan(radians) * x;
  } else if (radians >= Math.PI + phi && radians <= 2 * Math.PI - phi) {
    y = -height / 2;
    x = y / Math.tan(radians);
  }

  return {
    x: -Math.round(x),
    y: Math.round(y)
  };
}

Now, you just need to generate points for line shape:
function getPoints(r1, r2) {
  const c1 = getCenter(r1);
  const c2 = getCenter(r2);

  const dx = c1.x - c2.x;
  const dy = c1.y - c2.y;
  const angle = Math.atan2(-dy, dx);

  const startOffset = getRectangleBorderPoint(angle + Math.PI, r1.size());
  const endOffset = getRectangleBorderPoint(angle, r2.size());

  const start = {
    x: c1.x - startOffset.x,
    y: c1.y - startOffset.y
  };

  const end = {
    x: c2.x - endOffset.x,
    y: c2.y - endOffset.y
  };

  return [start.x, start.y, end.x, end.y]
}

function updateLine() {
  const points = getPoints(rect1, rect2);
  line.points(points);
}

All of this as a demo:

function getRectangleBorderPoint(radians, size, sideOffset = 0) {
  const width = size.width + sideOffset * 2;

  const height = size.height + sideOffset * 2;

  radians %= 2 * Math.PI;
  if (radians < 0) {
    radians += Math.PI * 2;
  }

  const phi = Math.atan(height / width);

  let x, y;
  if (
    (radians >= 2 * Math.PI - phi && radians <= 2 * Math.PI) ||
    (radians >= 0 && radians <= phi)
  ) {
    x = width / 2;
    y = Math.tan(radians) * x;
  } else if (radians >= phi && radians <= Math.PI - phi) {
    y = height / 2;
    x = y / Math.tan(radians);
  } else if (radians >= Math.PI - phi && radians <= Math.PI + phi) {
    x = -width / 2;
    y = Math.tan(radians) * x;
  } else if (radians >= Math.PI + phi && radians <= 2 * Math.PI - phi) {
    y = -height / 2;
    x = y / Math.tan(radians);
  }

  return {
    x: -Math.round(x),
    y: Math.round(y)
  };
}

const stage = new Konva.Stage({
  container: 'container',
  width: window.innerWidth,
  height: window.innerHeight
});

const layer = new Konva.Layer();
stage.add(layer);

const rect1 = new Konva.Rect({
  x: 20,
  y: 20,
  width: 50,
  height: 50,
  fill: 'green',
  draggable: true
});
layer.add(rect1);

const rect2 = new Konva.Rect({
  x: 220,
  y: 220,
  width: 50,
  height: 50,
  fill: 'red',
  draggable: true
});
layer.add(rect2);

const line = new Konva.Line({
  stroke: 'black'
});
layer.add(line);

function getCenter(node) {
  return {
    x: node.x() + node.width() / 2,
    y: node.y() + node.height() / 2
  }
}

function getPoints(r1, r2) {
  const c1 = getCenter(r1);
  const c2 = getCenter(r2);

  const dx = c1.x - c2.x;
  const dy = c1.y - c2.y;
  const angle = Math.atan2(-dy, dx);

  const startOffset = getRectangleBorderPoint(angle + Math.PI, rect1.size());
  const endOffset = getRectangleBorderPoint(angle, rect2.size());

  const start = {
    x: c1.x - startOffset.x,
    y: c1.y - startOffset.y
  };

  const end = {
    x: c2.x - endOffset.x,
    y: c2.y - endOffset.y
  };

  return [start.x, start.y, end.x, end.y]
}

function updateLine() {
  const points = getPoints(rect1, rect2);
  line.points(points);
}

updateLine();
layer.on('dragmove', updateLine);

layer.draw();

A: The easiest way to do this would probably just be to have two layers, one for lines that connect the centers of the rectangles, and a layer that draws the rectangles on top of the lines.
Other than that though, I thought of another way to solve the "point on a rectangle problem" that works out a bit nicely in my opinion.
Starting from this implicit formula for a rectangle (I got it from here, but I think you can also derive it by rotating the coordinate system of  and stretching the vertical and horizontal axes):

We can convert to polar coordinates by substituting  and . Rewriting as a function of the radius to get:

We can then convert that back into rectangular coordinates with the same substitution and get a parametric function of θ:

So why is this useful? Besides the fact that we don't have to worry about what range the angle falls in, working in polar coordinates makes rotation trivial - it's just a domain shift.
Using that polar function of r (for ease of notation) we can express that as (letting α be the angle we are rotating counterclockwise by):

Which you can play around with in this desmos visualization: https://www.desmos.com/calculator/zgi3jzb2eg
Putting that into practice (assuming rotation about the center), we get:
function degreesToRadians(degrees) {
    return Math.PI * degrees / 180;
}

function getPointOnRectangle(width, height, angle, rotation) {
    const rot_angle = angle - rotation;

    const radius = 1 / (
        Math.abs(Math.cos(rot_angle) / width + Math.sin(rot_angle) / height) + Math.abs(Math.cos(rot_angle) / width - Math.sin(rot_angle) / height)
    );

    return {x: radius * Math.cos(angle), y: radius * Math.sin(angle)};
}

function connectRects(rectA, rectB, line, margin=0) {
    const deltaX = rectB.x() - rectA.x();
    const deltaY = rectB.y() - rectA.y();

    const angleA = Math.atan2(deltaY, deltaX);
    const angleB = Math.PI + angleA;

    const rotA = Konva.angleDeg? degreesToRadians(rectA.rotation()) : rectA.rotation();
    const rotB = Konva.angleDeg? degreesToRadians(rectB.rotation()) : rectB.rotation();

    const relA = getPointOnRectangle(rectA.width() + margin, rectA.height() + margin, angleA, rotA);
    const relB = getPointOnRectangle(rectB.width() + margin, rectB.height() + margin, angleB, rotB);

    line.points([
        rectA.x() + relA.x,
        rectA.y() + relA.y,
        rectB.x() + relB.x,
        rectB.y() + relB.y,
    ]);
}

Codepen Demo (adapted from lavrton's demo) here: https://codepen.io/creallfluharty/pen/WNEVjgW


text:
Q: Cannot invoke 'performOperation' with an argument list of type '(NSAttributedString)' @IBAction func operate(sender: UIButton) {
    if userIsInTheMiddleTypeANumber {
        enter()
    }

    if let  operation = sender.currentAttributedTitle {
        if let result = brain.performOperation(operation){
            displayValue = result
        } else {
            displayValue = 0
        }
    }

}

brain.performOperation error is

Cannot invoke 'performOperation' with an argument list of type
  '(NSAttributedString)'

 func evaluate() -> Double? {
    let (result, _) = evaluate(opStack)
    return result
}

 func performOperation(symbol: String) -> Double? {
    if let operation = knownOps[symbol] {
        opStack.append(operation)
    }
    return evaluate()
}

This is the content of Stanford 's white-bearded teacher Lesson,Why Stackoverflow To force the user to enter more text , it is very unreasonable

A: You need to convert NSAttributedString to String because your function accept only String argument.
This way you can convert NSAttributedString to String :
if let result = brain.performOperation(operation.string)

And it will work fine.


text: Q: QT и UML диаграммы У меня есть проект написанный в QT и мне нужно построить по нему UML диаграмму классов. Подскажите, есть ли в qt встроенный инструмент для построение uml диаграмм по текущему проекту или без помощи сторонних программ типо doxygen не обойти?


text:
Q: Why checkcast-instruction is absent for (int)MethodHandle.invokeExact? I have created 2 simple classes for try Java MethodHandle-API:
public class Foo {
    private static int staticField;

    public static Object getStaticField() {
        return staticField;
    }
}

another class for invoke method Foo.getStaticField() in two ways - direct and using MethodHandle-API:
....
public static void methodHandleGetStaticField() throws Throwable {
    MethodHandle methodHandle = lookup.findStatic(Foo.class, "getStaticField", MethodType.methodType(int.class));
    int i = (int)methodHandle.invokeExact();
}

public static void directGetStaticField() {
    int i = (int)Foo.getStaticField();
}
....

I have decompiled class and saw that directGetStaticField method contains cast instructiona, but method methodHandleGetStaticField doesn't, though java.lang.invoke.MethodHandle.invokeExact() returns java.lang.Object.
public static void directGetStaticField();
descriptor: ()V
Code:
   0: invokestatic  #70    // Method ru/fj/methodhandle/Foo.getStaticField:()Ljava/lang/Object;
   3: checkcast     #33    // class java/lang/Integer
   6: invokevirtual #74    // Method java/lang/Integer.intValue:()I
   9: istore_0
  10: return

public static void methodHandleGetStaticField() throws java.lang.Throwable;
descriptor: ()V
Code:
   0: getstatic     #15    // Field lookup:Ljava/lang/invoke/MethodHandles$Lookup;
   3: ldc           #29    // class ru/fj/methodhandle/Foo
   5: ldc           #90    // String getStaticField
   7: getstatic     #32    // Field java/lang/Integer.TYPE:Ljava/lang/Class;
  10: invokestatic  #38    // Method java/lang/invoke/MethodType.methodType:(Ljava/lang/Class;)Ljava/lang/invoke/MethodType;
  13: invokevirtual #46    // Method java/lang/invoke/MethodHandles$Lookup.findStatic:(Ljava/lang/Class;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/MethodHandle;
  16: astore_0
  17: aload_0
  18: invokevirtual #52    // Method java/lang/invoke/MethodHandle.invokeExact:()I
  21: istore_1
  22: return

Could anyone explain it for me?

A: You can notice that invokeExact indeed returns an int from its descriptor ()I:
  18: invokevirtual #52    // Method java/lang/invoke/MethodHandle.invokeExact:()I

As a result, no casting is required.
The reason why it returns an int, not an Object, is that method invokeExact (as well as invoke) in MethodHandle are treated specially, see the invokeExact API

Returns:
the signature-polymorphic result, statically represented using Object

and from the signature polymorphism:

... The unusual part is that the symbolic type descriptor is derived from the actual argument and return types, not from the method declaration.


text:
Q: How to create IFC Files from JavaScript I want to export my 3D-Modell(simple vectors and points) to a IFC-File using JavaScript.
Does anybody know libraries I can use for it?

A: You can use ifc.js to create IFC files, its a new library and has a lot of capabilities.
It has 3 parts in total - web-ifc, web-ifc-three & web-ifc-viewer. You need to use web-ifc to create IFC files.
Below is a quote from their website:

 It can edit data and write entire IFCs from scratch. Create apps that communicate with the large software vendors.


text:
Q: DOMPDF page break I'm trying to generate reports with header, footer and content. The header and the footer works fine, however the text of the content div breaks higher than I want. See the image. I really don't understand why the page is breaking so high.
This is the CSS code:

@page {
  margin: 180px 50px;
}

#header {
  position: fixed;
  left: 0px;
  top: -150px;
  right: 0px;
  height: 150px;
  text-align: left;
}

#footer {
  position: fixed;
  left: 0px;
  bottom: -180px;
  right: 0px;
  height: 80px;
  text-align: right;
  background-color: lightblue
}

#footer .page:after {
  content: counter(page, upper-roman);
}

#content {
  padding-left: 10mm;
  padding-right: 5mm;
  line-height: 6mm;
  background-color: lightgreen;
  height: 850px;
}
#logo {
  height: 4cm;
}
#head_text {
  display: inline-block;
  line-height: 6mm;
  padding-top: 15px;
}

And this is the HTML:

      '.$header.'

Página

      '.$content.'

Could anyone help to solve this problem? Tanks!

A: If your DOMPDF_DPI is set to 72 then a 180px margin is pretty expansive. A DPI of 72 gives a one-to-one translation from PX to PT (the native unit in a PDF). PDF documents produced by dompdf are always 72 PPI. That translates into 2.5 inches of margin around the content. I don't think you meant to pad your margins quite that much.
Another problem I see is that you've set a height condition on your content element. You don't really need this and I see it causing some problems as I run some test renders. If you want your content background to have a specific color then I'd recommend setting it on the body element, which is the true bounds of your document content.
Try the following:

@page {
  margin: 180px 50px;
}
#header {
  position: fixed;
  left: 0px;
  top: -150px;
  right: 0px;
  height: 150px;
  text-align: left;
}

#footer {
  position: fixed;
  left: 0px;
  bottom: -180px;
  right: 0px;
  height: 80px;
  text-align: right;
  background-color: lightblue
}

#footer .page:after {
  content: counter(page, upper-roman);
}

body {
  background-color: lightgreen;
  height: 850px;
}
#content {
  padding-left: 10mm;
  padding-right: 5mm;
  line-height: 6mm;
}
#logo {
  height: 4cm;
}
#head_text {
  display: inline-block;
  line-height: 6mm;
  padding-top: 15px;
}
<!DOCTYPE html>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    HEADER

Página

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id erat blandit, auctor massa eu, aliquam lacus. Suspendisse justo ante, gravida vel diam quis, porta luctus nisi. Donec id enim sem. Sed et lobortis magna. Ut et dignissim augue. Cras quam libero, feugiat ac auctor eget, semper a augue. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse quis hendrerit ex. Phasellus auctor dolor sit amet nibh rhoncus sagittis. Sed quis odio sit amet purus feugiat malesuada.


text:
Q: Comparing absolute value of variables We have
$$0 < |x-a| < \delta $$
How do we get
$$a - \delta < x < a + \delta $$
?
When I add $a$ to both sides I get:
$$a<|x|<a+\delta$$

A: $|y| < \delta$ iff $-\delta < y < \delta$.
Then you have $-\delta < x-a < \delta$.
Add $a$ throughout to get $a-\delta < x < a+\delta$.
Note that the last equation is not equivalent to the first condition given, for equivalence
you need to add the condition $x \neq a$.
Elaboration of first line:
Suppose $|y| < \delta$. Then either $y \ge 0$, in which case $0 \le y < \delta$ (and so $-\delta < y < \delta$) or
$y < 0$ in which case $|y| = -y $ and we have $0 \le -y < \delta$. Multiplying
the latter by $-1$ (and reversing the inequalities) gives
$-\delta < y \le 0$ (and so $-\delta < y < \delta$).
Now suppose $-\delta < y < \delta$. If $y \ge 0$, we have $|y|=y < \delta$.
If $y < 0$ we have $|y|=-y$ and since $y > -\delta$ we have (multiplying across by $-1$) $-y < -\delta$ and so $|y|=-y < \delta$.

A: By definition,
$|x|=x$ if $x\ge0$ and $|x|=-x$ if $x<0$. Thus, $|x|\ge0$ for all $x$.
Here,
$$|x-a|<\delta$$

Case 1: $x-a>0$
$$|x-a|=x-a<\delta$$
$$x<a+\delta$$
As $\delta>0$, we have $-\delta<0$, i.e., $x-a>-\delta$ which gives $x>a-\delta$.

Case 2: $x-a<0$
$$|x-a|=-(x-a)<\delta$$
$$x-a>-\delta$$
$$x>a-\delta$$
As $\delta>0$, we have $x-a<\delta$ which gives $x<a+\delta$.
Thus,
$$a-\delta<x<a+\delta$$

A: It doesn't actually give that result. For instance, $x = a$ satisfies the second conclusion, but not the first.

A: One has $0\lt |b|\lt c\iff -c\lt b\lt c$. We apply that to $|x-a|\lt\delta$ to get
$$-\delta\lt x-a\lt \delta$$
And this implies
$$a-\delta\lt x\lt a+\delta$$

A: The other answers are correct, but may not help you in the future.
I think you should begin with an example and some words, rather than trying to "add $a$ to both sides".
Think about the situation when (for example) $a = 3$ and $\delta = 1$. Then the condition says you care about the values of $x$ for which the distance from $3$ is less than $1$ but bigger than $0$. You should draw the picture that shows why  $x$ is between $3-1=2$ and $3+1=4$ (values $1$ away from $3$), but not $3$ itself.


text:
Q: Issues in executing gradle task through terminal in Android studio I am writing a simple gradle task in my project level build.gradle. The code is pretty simple.
task compile {
    doLast {
        println 'compiling source'
    }
}

When I try to execute the task from Gradle-> Gradle projects in the right hand panel, it compiles and prints the result.
But, when I go to the Terminal in Android studio and type
./gradlew -q compile

it shows error message
A problem occurred configuring root project 'xx'
Could not resolve all dependencies for configuration ':classpath'.

When in the Terminal I write other gradle commands, it displays perfect, like
./gradlew -h
./gradlew -v
Somehow, it does not execute the gradle task.
* EDIT *
My project level build.gradle uses
dependencies {
        classpath 'com.android.tools.build:gradle:1.3.1'
    }

What is that I am doing wrong? Any suggestion will b very helpful.

A: Seems like you would want to make a task then let that task finalize the compileJava task.
task myTask {
    println "doing stuff"
}
project.tasks.findByName('compileJava').finalizedBy myTask

We can now see the task executing in the build
$ gradle -q clean build
doing stuff


text:
Q: How to implement a modal pop-up window on an app (mlapp)? I want to create a modal popup window, containing a number of uiedit, uimenu and uipushbutton controls. This modal popup window should appear on top of a MATLAB app (built with the app designer; not with GUIDE). The parent app UIFigure should be grayed out while the modal popup is active, similar to what happens when a uiconfirm dialog box is opened. Is there an undocumented way or some other workaround to implement this type of UI element?
The idea is that the user clicks on a "settings" button on the main app and the modal dialog pops up, while deactivating the main app controls, to allow adjustment of settings.

A: Have a look at the documentation for uiwait which explains exactly how to achieve your desired effect.
In the interest of adhering to best practices for providing meaningful answers, I might approach this problem as follows.
Create a callback for the "settings" button which:

*

*"grays out" desired main app's UI elements by setting their Enable property to 'off'

*instantiates the *.mlapp you've created for the settings UI

From here, there are a number of possibilities. One approach would be to uiwait on the settings mlapp's UIFigure since, by default, it is contained in a public property of the mlapp definition. If you want to wait until the settings UI is closed, you can get away with, simply, uiwait(settingsApp.UIFigure);. Once the settings UI is closed, you can re-enable all your main app components to un-"gray" them.
For example, your "Settings button" callback could look like:
function onRequestSettings(app, event)
  % set main figure's UI elements gray
  % Assuming you want all elements gray
  set(app.UIFigure.Children, 'Enable', 'off');

  % create the settings UI by instantiating it here
  settingsApp = settingsUI();

  % wait until the figure closes
  uiwait(settingsApp.UIFigure);

  % ... SEE NOTE BELOW CODE BLOCK! ... %

  % Now that the settings UI is closed,
  % set main figure's UI elements back to normal.
  % Again, assuming all elements here
  set(app.UIFigure.Children, 'Enable', 'on');
end

Note:
While the above code block will produce your desired behavior, I have not shown how to share the data between the settings app and the main app.
I assume, since you do not explicitly ask for this, that you have some way in mind. If not, I will point you to the documentation for creating multi-window apps and sharing data within app designer and also to this answer. Alternatively, you can leverage the fact that mlapps are members of the handle super-class and thus have a builtin event, ObjectBeingDestroyed. You can construct a listener (see addlistener and this) for this event and bind it to a method in your main app which then updates the main app according to changes made on the settings app.
Alternatively:
If the settingsUI is stored in a property of the main app, say app.settingsUI, and is instantiated, but perhaps hidden, by the main app's startupFcn, then instead of re-instantiating every time the "Settings button" is pressed you could simply bring it forward with figure(app.settingsUI.UIFigure);. Then make it "modal" with uiwait(app.settingsUI.UIFigure); and override the settingsUI closeRequestFcn to release the code execution halt with uiresume. The close callback could look like:
classdef settingsUI < matlab.apps.AppBase

...

  function UIFigureCloseRequest(app,event)
    % override close request to prevent deleting the app
    % hide the settings window to appear as though it was closed
    app.UIFigure.Visible = 'off';

    % resume code execution so that main app can continue to run.
    uiresume(app.UIFigure);
  end

...

end

-Cheers


text:
Q: Android app error: net.wimpi.modbus.ModbusSlaveException: Error Code = 2 i'm using the JAMOD with android to read data from modbus.
i have a slave and a master class.(slave is running in netbeans)
triing to connect with the android apk and got the error message which is in the title.
Can you help me why or how to correct my app?
import net.wimpi.modbus.Modbus;
    import net.wimpi.modbus.ModbusCoupler;
    import net.wimpi.modbus.net.ModbusTCPListener;
    import net.wimpi.modbus.procimg.*;

public class Modbus_slave_server {

    public static void main(String[] args) {

        ModbusTCPListener listener = null;
        SimpleProcessImage spi = new SimpleProcessImage();
        int port = Modbus.DEFAULT_PORT;

        if (Modbus.debug) {
            System.out.println("jModbus Modbus TCP Slave");
        }
        if (args != null && args.length >= 1) {
            port = Integer.parseInt(args[0]);
        }

        try {

            //2. Prepare a process image
            spi = new SimpleProcessImage();
            spi.addInputRegister(new SimpleInputRegister(635)); //érték beállítás

            //3. Set the image on the coupler
            ModbusCoupler.getReference().setProcessImage(spi);
            ModbusCoupler.getReference().setMaster(false);
            ModbusCoupler.getReference().setUnitID(1);

            //3. create a listener with 3 threads in pool
            if (Modbus.debug) {
                System.out.println("Listening...");
            }

            listener = new ModbusTCPListener(1);
            listener.setPort(port);
            listener.start();

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//main
}

A: I'm using liblary for modbus in C#(NModbus) and SlaveException means thean your slave device return error: http://www.simplymodbus.ca/exceptions.htm
Error code number 2 means that:

The data address received in the query is not an allowable address for
  the slave. More specifically, the combination of reference number and
  transfer length is invalid. For a controller with 100 registers, a
  request with offset 96 and length 4 would succeed, a request with
  offset 96 and length 5 will generate exception 02.

http://www.kepware.com/Support_Center/SupportDocuments/KTAN90006_Modbus_Exception_Codes.pdf


text:
Q: Different layout based on post amount? Is it possible to change the layout of the query posts depending on how many there are?
So simple query page listing posts...
Up to 4 posts show them in a list.
If there are 4 posts and over show them as float blocks for example.

A: for a standard query, you can check the amount of posts with:
all posts for the query:
$wp_query->found_posts
and the posts on the page:
$wp_query->post_count
use that with a conditional statement to switch to the different layouts.
example:
<?php if ( have_posts() ) : //start of the loop//
  if ( $wp_query->found_posts <= 4 ) { ?>
     list output of posts
      //this will need to include the 'while(have_posts())' including the 'endwhile' of the loop
  <?php } else { ?>
     float block output
     //this will need to include the 'while(have_posts())' including the 'endwhile' of the loop
     <?php }
endif; ?>


text:
Q: Return an mvc action with a viewmodel type different to the passed one I have an ItemsController with an Index action returning and rendering items on the client like
return View(itemViewModels);

Each itemViewModel has some bootstrap tabs. In each tab a partialView is rendered.
When the user edits a partialView and send the data to the Tab1Controller how can I return the View for the whole itemViewModel showing validation errors for the one partial view inside that tab1?
I have made the View work requesting/responsing with the sent itemViewModel but then Only the single item`s html is returned not the full items html.
AND when I return the Index View to the ItemsViewModels then I can NOT return my passed itemViewModels to show the validation errors.
    [HttpGet]
    public ActionResult Index(ItemViewModel viewModel)
    {

        return View("ItemsViewModels", viewModel);
    }

This code does not work because the View does not match to the viewmodel type.
But I need to show the Html of the ItemsViewModels with the invalid (data-val attributes) html of the single edited itemViewModel.
I can NOT post and return the ItemsViewModels  because it has many other properties which would make the modelstate invalid...
Do you have any idea?
UPDATE
I am NOT allowed to use ajax else the problem would be done quickly... this is for a common website and the customer wants a postback no ajax/SPA behavior.
At the moment I get the whole items from the service again and render it but then every ItemViewModel`s html has an invalid e.g. textbox. But I want that only a certain ItemViewModel is invalid.
[HttpPost]
public virtual async Task<ActionResult> SaveLanguage(ItemViewModel itemViewModel)
{

     var viewModels = GetItemsViewModelsFromSErvice();

     viewModels.Items.ElementAt(0).Settings = itemViewModel;

    return View(MVC.Test.Items.Views.Index,viewModels );
}

A: If you are forced to do a full postback, but each partial view contains just a form with the elements for that 1 item then you'll have to reconstruct the other items in your controller before returning.
Your controller method would be something like
public ActionResult Index()
{
     var vm = GetAllItems(); //method to get all your items for first load
     return View(vm);
}

[HttpPost]
public ActionResult Index(ItemViewModel viewModel)
{
    //get the full list of items, and then replace just the altered one
    var vm = GetAllItems(); // assume returns a list
    var index = vm.FindIndex(x => x.ID == viewModel.ID);
    vm[index] = viewModel;

    //might have to rename items in the ModelState.Errors dictionary
    //so they are associated with the correct item index.
    //first get the list of errors. As viewModel is not a list for this method
    //they will have keys like "PropertyName".
    //For a listItem need renaming to something like "[#].PropertyName" (# = index)
    var errs = from ms in ModelState
             where ms.Value.Errors.Any()
             let fieldKey = ms.Key
             let errors = ms.Value.Errors
             from error in errors
             select new {fieldKey, error.ErrorMessage};

    //clear the ModelState, and then re-add any model-errors with the renamed key
    ModelState.Clear();
    foreach(var item in errs)
    {
        ModelState.AddModelError(
             String.Format("[{0}].{1}", index, item.fieldKey), item.ErrorMessage);
    }

    return View("ItemsViewModels", vm);
}

In addition you might need to rename your form elements so that the model binder treats them as list items after postback. I'm not 100% sure this is necessary though.
If you can use ajax this becomes neater...
It looks like your index Model is a List<ItemViewModel>
Then your Main view (Index.cshtml) would be something like..
@model List<ItemViewModel>
...
@for(int i = 0; i < Model.Count; i++)
{
    <div id="@String.Format("partialContainer{0}", Model[i].ID)">
    @Html.Partial("Partial1", Model[i])
    </div>
}

(notice that the ID of the container div is something that we can reference as the ajax update target)
And then have your partial Views use the relevant partial Models
Eg Partial1.cshtml:
@model ItemViewModel
... etc
@using (Ajax.BeginForm("RefreshPartial", "Home", null, new AjaxOptions() {
UpdateTargetId = String.Format("partialContainer{0}", Model.ID), HttpMethod = "Post" }, null))
{
    @Html.TextBoxFor(m => m.Property1);
    @* form controls... *@
    <input type="submit" value="Submit" />
}


text:
Q: npm dependencies pull in different versions of the same package Wondering if someone can help me understand why this is happening. I have two npm packages that use tar-fs@2.1.0 but that package pulls in different versions of tar-stream. It is defined in the package.json as "tar-stream": "^2.0.0" but they resolve to different patch versions when running npm install. Reading about caret-ranges I'm not seeing anything to explain this.
I tried deleting the node_modules and lock file, running npm update tar-stream, and running npm install --package-lock-only to update the lock file based on 'package.json'. Any help is appreciated.
$ npm ls tar-stream
project@1.2.0 /Users/akerr/Documents/GitHub/project
├─┬ chrome-aws-lambda@5.3.0
│ └─┬ lambdafs@2.0.0
│   └─┬ tar-fs@2.1.0
│     └── tar-stream@2.1.3
└─┬ puppeteer-core@5.3.0
  └─┬ tar-fs@2.1.0
    └── tar-stream@2.1.4


text:
Q: Creating multiple folders using Powershell I need to create 3 folders named AAA,BBB,CCC at location :c\temp\test
I tried the below codes:
$local = "C:\Temp\Test"
$Users = $local+"\AAA\",$local+"\BBB\",$local+"\CCC\"
New-Item -Item Type directory $Users

It is giving me error
New-Item : A positional parameter cannot be found that accepts argument
I also tried
$local = "C:\Temp\Test"
$Users = $local+"\AAA\",$local+"\BBB\",$local+"\CCC\"
md $Users

what am I missing here??

A: BenH's helpful answer offers an effective solution.
Why your command didn't work:
Your problem was one of operator precedence:
$local+"\AAA\",$local+"\BBB\",$local+ "\CCC\"

was interpreted as:
$local + ("\AAA\",$local) + ("\BBB\",$local) +"\CCC\"

resulting in a single string rather than the desired array, because the LHS - $local is a string.
Perhaps surprisingly, ,, the array-construction operator, has higher precedence than + - see Get-Help about_Operator_Precedence.

Therefore, using (...) for precedence would have made your command work:
$Users = ($local+"\AAA\"), ($local+"\BBB\"), ($local+"\CCC\")

Using expandable (interpolating) strings (inside "..."), as in BenH's answer, is more concise, but still:

*

*requires defining auxiliary variable $local first

*requires referencing $local in each expandable (interpolating) string ("...")

A DRY alternative is (% is an alias for ForEach-Object):
$Users = 'AAA', 'BBB', 'CCC' | % { "C:\Temp\$_\" }

Note that using a pipeline to achieve this is somewhat slow, but that won't matter in most cases.

Using the foreach statement is a little more verbose, but performs better:
$Users = foreach($name in 'AAA', 'BBB', 'CCC') { "C:\Temp\$name\" }

A: For you definition of $users either put the variable inside the quotes or do the string concatenation in a subexpression e.g. $(). Also you had an extra space in the ItemType Parameter:
$local = "C:\Temp\Test"
$Users = "$local\AAA\","$local\BBB\","$local\CCC\"
New-Item -ItemType directory $Users

A: You can put all the directory path values in an array and create new directories at a single run.
@('D:/NewFolder','D:/NewFolder1/NewFolder_app','D:/NewFolder1/NewFolder_app_pool','C:/NewTestFolder101') | foreach {New-Item -Path $_ -ItemType Directory -Force}
It will create all the directories at once.
For getting some directories as well as some files, declare two different arrays. The first one is for directories and the second one for the files. Rest of the script will be same except: Item-Type will be file instead of directory

A: why not just use Mkdir $(001..10 | %{"testfolders-$_"})


text:
Q: linear transformations Finding $T(v_1) - T(v_3)$ Question:

Solution:

I get 3) a
but I don't get 3 b,
how are they getting these numbers? im stumped

A: $$\begin{aligned}
T(v_1)&=1\cdot v_1 + 2\cdot v_2 + 6\cdot v_3\\
&=3x+3x^2+2(-1+3x+2x^2)+6(3+7x+2x^2)\\
&=16+51x+19x^2
\end{aligned}$$
The other two are similar.


text:
Q: JS object property undefined when called within object the first time Consider the following JS object, it has:

*

*x: a variable given value 100

*p: prints value of x, called immediately after creation

*y: prints value of x, called after object creation

When the value of Pipe.x is printed immediately during Object creation, for some reason Pipe.x is undefined but when P.y() is called, after an object, the Object has been created, the Value of Pipe.x is 100, as it should have been in the first place.
var Pipe = {
    x: 100,

    p: function(){
        console.log('p says x is ' + this.x); // prints y says x is undefined
    }(),    // call immediately

    y: function(){
        console.log('y says x is ' + this.x);
    }
}

Pipe.y();    // prints y says x is 100

Is there any JS object property I'm missing which makes Pipe.p() print undefined and P.y() print 100?

A: The this Context depends on how it is being called.
When you call Pipe.y(), it is equivalent to obj.method() and this will be pointed to obj, in this case Pipe.
When p is being executed as IIFE, this is set to window and there is no x on window


text:
Q: Pimcore pixlr api integration Right now i am testing features of pimcore.
Really it has nice integration with pixlr but it is showing some problem on local machine.
Actually i have built a virtual host pmc.com with port 81.
What happens when i click on edit image to edit an image pimcore generates url like
http://pmc.com/admin/assests/...
Its does not add the port 81 so i am unable to save & edit images on localhost.
Can any one help me to solve this problem.
Thanks

A: From a member of Pimcore's team:

if you have a closed System Pixlr cannot load your image by the local url. (Example http://localhost/admin/asset/get-image-thumbnail)
  a possibility could be realized by using dyndns.org so Pixlr can handle your picture

Pixlr cannot load a local image
In other words, you must have an accessible host in order to Pixlr can load your picture (pcm.com is a virtual host for your machine and is not visible from internet).
Hope this help.


text:
Q: Python Repl in Python Am I right in assuming that the Python shell is coded in Python?  If so, where, might one find the source code?  If I wanted to write a shell program that did things differently, could I just copy the code to new_shell.py, make a few changes, and then set up a bash alias 'python'='python3 new_shell'?

A: There are various versions of Python. The most popular one is cpython, and the source code for that can be found here: cpython. If you want Python written in Python, check out PyPy.


text:
Q: JSF with facelets in Tomcat7 I am trying to deploy a  JSF 2.0 application with Facelets 1.1.14 to Tomcat7. I am getting the following exceptions:
INFO: Initializing Mojarra 2.0.0 (FCS b23) for context '/AdminUI'

3 Aug, 2011 7:44:32 PM com.sun.faces.spi.InjectionProviderFactory createInstance

INFO: JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
3 Aug, 2011 7:44:33 PM com.sun.faces.config.ConfigManager initialized
INFO: Unsanitized stacktrace from failed start...
java.lang.NullPointerException
        at com.sun.faces.util.Util.loadClass(Util.java:200)
        at com.sun.faces.config.processor.AbstractConfigProcessor.loadClass(AbstractConfigProcessor.java:312)
        at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processHandlerClass(FaceletTaglibConfigProcessor.java:416)
        at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTags(FaceletTaglibConfigProcessor.java:370)
        at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.processTagLibrary(FaceletTaglibConfigProcessor.java:313)
        at com.sun.faces.config.processor.FaceletTaglibConfigProcessor.process(FaceletTaglibConfigProcessor.java:262)
        at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:337)
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:219)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
        at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
        at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
3 Aug, 2011 7:44:33 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
3 Aug, 2011 7:44:33 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/AdminUI] startup failed due to previous errors
3 Aug, 2011 7:44:33 PM com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
        at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:804)
        at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:306)
        at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:104)
        at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:305)
        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4763)
        at org.apache.catalina.core.StandardContext$4.run(StandardContext.java:5472)
        at java.lang.Thread.run(Thread.java:662)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5481)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:225)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:153)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:932)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:723)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1363)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:294)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1233)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1391)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1401)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1380)
        at java.lang.Thread.run(Thread.java:662)
3 Aug, 2011 7:44:33 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/AdminUI] appears to have started a thread named [Mojarra-ResourceCache-1-thread-1] but has failed to stop it. This is very likely to create a memory leak.

Iam having the following jars under/WEB-INF/lib/
activation-1.1.jar
antlr-2.7.6.jar
asm-3.1.jar
cglib-2.2.jar
commons-collections-3.1.jar
dom4j-1.6.1.jar
hibernate-commons-annotations-3.2.0.final.jar
hibernate-core-3.6.5.final.jar
hibernate-entitymanager-3.6.5.final.jar
hibernate-jpa-2.0-api-1.0.0.final.jar
hibernate-validator-4.0.2.GA.jar
javassist-3.12.0.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.3.jar
jsf-api-2.0.jar
jsf-impl-2.0.0.jar
jta-1.1.jar
slf4j-api-1.6.1.jar
stax-api-1.0-2.jar

How to resolve this?

A: JSF 2.0 ships with Facelets 2.0 bundled. The Facelets 1.x JAR file would only collide with this. You should remove the Facelets 1.x JAR file.
All JAR files you need for developing JSF 2.0 with Facelets on Tomcat are jsf-api.jar and jsf-impl.jar.


text:
Q: Why is normal ordering a valid operation? Why is normal ordering even a valid operation in the first place? I mean it can give us some nice results, but why can we do the ordering for the operators like that?
Is its definition motivated by the relation between the normal ordering and the time-ordered product, which is basically the content of Wick's theorem?

A: The choice of normal ordering prescription $:~:$ is usually adjusted to the choices of bra vacuum state $\langle \Omega|$ and ket vacuum state $|\Omega\rangle$, so that
$$\langle \Omega|:\hat{\cal O}_1\ldots \hat{\cal O}_{n>0} : |\Omega\rangle~~=~~0 , \qquad\qquad \langle \Omega|\Omega\rangle~~=~~1 .$$
The relation of normal ordering prescription to Wick theorem and other operator ordering prescriptions are typically only secondary. For motivation, see also e.g. this Phys.SE post.

A: normal ordering is a valid operation provided one can undo it by an appropriate choice of counterterms (of existing couplings or field renormalisations). (How this is done in practice is explained here: http://arxiv.org/abs/1512.02604.)

A: In classical physics, quantities are ordinary, commuting $c$-numbers. The order in which we write terms in expressions is of no consequence. In quantum field theory (QFT), on the other hand, quantities are described by operators that, in general, don't commute.
Classical physics is a low-energy approximation of quantum physics - the road from quantum to classical physics ought to be unambiguous - and this is way the way nature goes, from high to low energies. The inverse - the road from classical to quantum, that we take to try and reconstruct the high-energy physics - however, is ambiguous, because of ordering ambiguities in non-commuting quantities.
When we normal order expressions after canonical quantization, we are correcting those ambiguities.
This occurs for the zero-point energy in the Hamiltonian
$$
H = \int \frac{d^3p}{(2\pi)^3} E_p \left(a_p^\dagger a_p + \frac12[a_p^\dagger,a_p]\right)
$$
You might hear it argued that the since the vacuum energy is unobservable, we are free to throw away the divergent piece (the commutator). Such an argument doesn't work for the charge operator,
$$
Q = \int \frac{d^3p}{(2\pi)^3} E_p \left(a_p^\dagger a_p - b_p b_p^\dagger\right)
$$
A charged vacuum would have observable effects. The best argument for normal ordering is that it is a rule for removing ordering ambiguities that results in e.g. a neutral vacuum.
Ordering ambiguties also occur in general relativity, when one promotes commuting ordinary derivatives $\partial_\mu$ to non-commuting covariant derivatives $\nabla_\mu$.

A: As other answers mention, it was originally (in QED) about getting a neutral vacuum. It is useful to go back to Schwinger's old version of QED, before Dyson's approach became accepted. See Pauli: Selected topics in field quantization.
Pauli presents both ways of looking at it: 1) define the electric current as sum of two terms (p.20 [6.4]), such that the vacuum expectation number operators give zero [6.7-6.9]; and later see that 2) normal ordering, i.e. dropping the infinite vacuum constant, has the same effect when taking the ordinary definition of the current, as far as the S-matrix is concerned (see p.141: "Not grouping together terms with the same argument is a substitute for the neglected subtraction of the vacuum current...").
This is how the 'negative energy sea' was eliminated. There is nothing incorrect about it, other than that the true content of QFT, i.e. renormalization, reaffirms the S-matrix point of view, 2).
The first approach tried to work with operators without reference to the S-matrix, as long as possible, whereas the second concedes from the start that only S-matrix results will be useful.
(Caution: Pauli's book is interesting but not easy to read.)


text:
Q: How to call a powershell script to another powershell script with arguments? I just need to call another script and pass the parameters to it.
I tried doing invoke-expression to access it, i tried using &, and nothing worked
I  tried doing the following:
 $hostfile = "C:\Users\username\Desktop\csvfile_test.csv"
 $outFile = ".\testerFile.xlsx"
 &  '.\organizer.ps1' "-csvFile $hostfile -outputPath $outFile "

Invoke-Expression 'C:\Users\username\Desktop\organizer.ps1' "$hostfile $outFile"

I receive the following errors:.
with ampersand (&):
PS C:\Users\username\Desktop> C:\Users\username\Desktop\scanner.ps1
Exception calling "ReadLines" with "1" argument(s): "The given path's format is not supported."
At C:\Users\username\Desktop\scanner.ps1:48 char:1
+ [System.IO.File]::ReadLines("$csvFile") | ForEach-Object {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NotSupportedException

with invoke-expression:
Exception calling "ReadLines" with "1" argument(s): "The given path's format is not supported."
At C:\Users\username\Desktop\scanner.ps1:48 char:1
+ [System.IO.File]::ReadLines("$csvFile") | ForEach-Object {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NotSupportedException

Invoke-Expression : A positional parameter cannot be found that accepts argument 'C:\Users\username\Desktop\csvfile_test.csv .\testerFile.xlsx'.
At C:\Users\username\Desktop\scanner.ps1:69 char:1
+ Invoke-Expression 'C:\Users\username\Desktop\organizer.ps1' "$host ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-Expression], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.InvokeExpressionCommand

A: When you write this:
& '.\organizer.ps1' "-csvFile $hostfile -outputPath $outFile "

you are passing a single parameter to the script (one quoted string). That's not what you want.
This is what you need:
$hostfile = "C:\Users\username\Desktop\csvfile_test.csv"
$outFile = ".\testerFile.xlsx"
.\organizer.ps1 -csvFile $hostfile -outputPath $outFile

First, you don't need the & (invocation) operator because your command name (the organizer.ps1 script in the current location, in this example) doesn't contain spaces. (You can add it if you want, but it's unnecessary in this scenario.)
Second, the -csvFile and -outputPath parameters each require a string.


text:
Q: Heading row doesn't appear in one line I create a popup via javascript, below is the rendered html. I would like to have a headingrow containing the heading("Preisrechner") and both of the icons you see below. I can't really adjust them so that they are in one row. What should I do to get one row with heading and icons?

FIDDLE

Preisrechner

EK - Preis:

<input class="buyIn" id="e" type="text">

EK - Preis:

<input class="buyIn" id="d" type="text">

.popup-wrapper{
    display:none;
    position:absolute;
    top:51px;
    background:#bdbdbd;
    z-index:10
}

.my-popup-box{
    display:table-cell;
    line-height:18px
}

.my-popup-heading{
    width:100%;
    padding-left:5px;
    float:left;

}

.my-popup-heading i{
    font-size:1.1em;
    font-weight:700;
    margin:0 8px;
    position: relative;
    float:right;

}

.my-popup-heading .heading-icons{
    position:absolute;
    right:10px
}

.my-popup-content{
    margin-left:auto;
    margin-right:auto;
    width:100%;
    padding:9px
}

DESIRED RESULT:

A: You seem to be using bootstrap, so one solution would be this:

Preisrechner

In basic you can give the icons and the heading different floats to achieve you desired outcome. .pull-right and .pull-left are the bootstrap classes to give floats.
Updated Fiddle

A: I created a JSfiddle with the simple changes you desired.
Here are the critical CSS changes:
.my-popup-heading h5{
    display: inline-block;
    width: 45%;
    float: left;
}

.headingIcons ul li{
  display: inline;
}

.my-popup-heading .heading-icons{
   display: inline-block;
   float:right;
   width:45%;
}

In order to have block level elements (
,
) on the same line, you have to use a display type such as inline or inline-block. And to have
 on the same line, you have to use display:inline.
If I misunderstood, comment below.

A: Try it with:

ul {
    float: right;
}
h5 {
    float: left;
}

You should wrap them of course. Otherwise they will apply to all h5 and ul tags...


text:
Q: How to send conditional props from Parent to Child. (send if only array is not empty) I want to show the JSON data I got from an API in Choices Component.
class ShowChoice extends React.Component{
    // var out=this.props.output Why is it not working here? Why is it showing error?
    render() {
        var out=this.props.output // Why is it not working above render????
        return(

Render out[0].id here

        )
    }
}

output is an array which has
output =[{'id':1}, {'choice_text':'some choice'}]

The problem is that whenever I start the app or the app re-renders itself, the output is undefined and it throws an error saying
TypeError: Cannot read property 'id' of undefined

for console.log(out[0].id)

*

*How can I solve this problem?

*I thought if I could somehow send the props if only the output has some length then I can solve the problem

*Why is the commented line  var out=this.props.output not working above render?

A: you have to check first if the output is defined before rendering anything.
Like
class ShowChoice extends React.Component{

    render() {
        const { output } = this.props
        if (!output) {
           return null;
        }
        return(

Render output[0].id here

        )
    }
}

A: The above var out=this.props.output; is not working put inside the constructor its working

constructor(props) {
   super(props);
   var out=this.props.output;
  }


text:
Q: Printing GetWindowTextA is wrong when printing outside function I'm quite new to C++, coming from C# background, so forgive me if this is a dumb question.
I have the following function for getting the title of a window by handle.
char* GetWindowTitle(HWND hwnd) {
    char winTitle[56];
    GetWindowTextA(hwnd, winTitle, sizeof(winTitle));
    printf("Title: %s\n", winTitle);

    return winTitle;
}

The printf in this function correctly outputs Title: a.txt - Notepad.
But if I do the same with the return from the function:
printf("Title: %s\n", GetWindowTitle(hwnd));

The output is now "Title: `÷S"
What's causing this different behaviour?

A: You are returning the address of something that is local to the function. It only exists for the duration of that function.
char* GetWindowTitle(HWND hwnd) {
    char winTitle[56];  <====== this is destroyed when the function ends
    GetWindowTextA(hwnd, winTitle, sizeof(winTitle));
    printf("Title: %s\n", winTitle);

    return winTitle;
}

Try this instead:
#include <string>

std::string GetWindowTitle(HWND hwnd) {
    char winTitle[56];
    GetWindowTextA(hwnd, winTitle, sizeof(winTitle));
    printf("Title: %s\n", winTitle);

    return std::string(winTitle);
}

This will allocate a std::string on the heap. Once you no longer reference it in the calling code, it will be deleted.
To display this string with printf(), do:
printf("Title: %s\n", GetWindowTitle(hwnd).c_str());

Though, you should get out of the habit of using C-style I/O (printf(), etc). To display this string with C++-style I/O, do:
#include <iostream>

std::cout << "Title: " << GetWindowTitle(hwnd) << std::endl;

If you intend to write a lot of C ++ code, learn to use:

*

*std::string (string in C#)

*std::shared_ptr and std::unique_ptr (class object reference in C#)

*std::vector (List in C#)

*std::map (Dictionary in C#)


text:
Q: Winter Is Coming? I just got awarded the "Winter Is Coming" hat - it's still the 19th? The hat is for the 20th!

What is going on?

A: Oh, it's already December 20th 02:27 AM in Kiritimati.

And as stated here:

we over-awarded the hat so that people in Auckland / Tokyo / Shanghai / Vanuatu wouldn't have to wait until their midday to receive it.

...and later on:

This behavior will also occur for the other hats that are date-sensitive

This was in Winter Bash 2012 but can't see any reason to change the behavior in 2013. :)


text:
Q: Checkbox returns "on", ActiveRecord needs "true" I have a form, where I defined a vanilla html checkbox
<%= form_tag charges_path, id: 'chargeForm' do %>
  (...)
  <input type="checkbox" id="agreed_to_terms" name="agreed_to_terms" /><label class="inputclass" for="agreed_to_terms">Agree to Terms</label>
<% end %>

model
class Product < ActiveRecord::Base
  (...)
  validates_acceptance_of :agreed_to_terms

When POST, the params:
"agreed_to_terms"=>"on"}

controller
  if charge["paid"]
    @product.update(status: "sold",
                    email:      params[:email],
                    first_name: params[:first_name],
                    last_name:  params[:last_name]
                    agreed_to_terms: params[:agreed_to_terms])

Transaction rollsback.
ActiveRecord says it needs to be true or false, not on or off.
How do I get this to work without doing this
  if charge["paid"]
    @product.update(status: "sold",
                    email:      params[:email],
                    first_name: params[:first_name],
                    last_name:  params[:last_name]
    @product.update_attribute(:agreed_to_terms, "true")

Which is wrong for so many reasons

A: To go in details I need your form code, but for a quick fix you can do this
agreed_to_terms: (params[:agreed_to_terms].eql?('on') ? true : false)

or
In your form add the following lines instead of <input type="checkbox" id="agreed_to_terms" name="agreed_to_terms" />
<%= hidden_field_tag "agreed_to_terms", false %>
<%= check_box_tag "agreed_to_terms", checked = true %>

When the checkbox is unchecked it will pass false, true otherwise

A: I tried to reproduce the problem in the rails console, setting agreed_to_terms to all of the following
t
"t"
true
"true"
1
"1"
accepted
"accepted"
to no avail.
Turns out, for some odd reason, I needed to specify in the validation what value the field should accept
class Product < ActiveRecord::Base
  (...)
  validates_acceptance_of :agreed_to_terms, accept: true


text:
Q: Moving image on scroll So, actually, I'm very bad at animations but I'm trying to be good at that. As I'm learning animations effect from various sources, I'm really proud that two of my animation sites are now being used in production. For 3.5 days I'm trying to implement the following animations
https://www.loom.com/share/6758e946dad7474db2bc5b99b4cd56f3
To move the image on scroll, but after spending a lot of time on it I'm still unable to get the desired output. I wrote my custom animation through css3 and js but was still unable to achieve the desired result. Please, help me and let me know how can I achieve a moving image on scroll.

A: I strongly recommend utilizing the Rellax JS library.
https://codepen.io/gcwebdev/pen/BaJjweE

var rellax = new Rellax('.rellax');
body {
  padding: 4rem;
  background-color: #282828;
  height: 500vh;
}

.parent {
  margin-top: 15em;
  color: white;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.parent>div {
  position: absolute;
  top: 0;
}

.child1 {
  width: 40vw;
  height: 80vh;
  background-color: white;
  border-radius: 3em;
}

.child2>div {
  background-color: #999;
  border-radius: 1em;
  position: absolute;
}

.child2-one {
  width: 200px;
  height: 100px;
  top: 70px;
  left: 100px;
}

.child2-two {
  width: 200px;
  height: 250px;
  top: 250px;
  left: 175px;
}

.child2-three {
  width: 100px;
  height: 75px;
  top: 500px;
  left: -250px;
}
<link href="https://cssanimation.rocks/levelup/public/03/04-end/stylesheets/main.css" rel="stylesheet" />

one

two

three

Child 3

Credits and Resources:

*

*(Dixon and Moe) https://dixonandmoe.com/rellax/

*(Donovan Hutchinson) https://cssanimation.rocks/parallax/

*(Donovan Hutchinson) https://codepen.io/donovanh/pen/zwdBzP


text:
Q: Googlebot index strings as URL in Javascript On my website I have Javascript code:
$(function() {
    $("#ratingComment").webwidget_rating_simple({
        rating_star_length: '5',
        rating_initial_value: '',
        rating_function_name: '',
        directory: '/images/raty'
    });
});

Googlebot index it & tries to go to URL '/images/raty'. But this URL don't exists, ofcourse.
Can I disable indexing of URLs like this? I get thousands of errors in Google Webmaster due to this problem.

A: If you want to prevent Googlebot or other search crawlers from accessing or making requests to a directory, you can always add an entry to your robots.txt file.
In this case, I might restrict all User Agents with:
User-Agent: *
Disallow: /images/raty

This will prevent any crawler that respects robots.txt from accessing anything that matches the path /images/raty. Note, it's not just that specific path, but it'll include all URLs that matches that string.
You might want to check out Google's Robots.txt Support Page for more info.


text:
Q: How to work around 'no LastInsertId available' using beego/orm I am trying to use https://github.com/astaxie/beego/tree/master/orm to insert a struct into a postgres database. The operation should be simple
import "github.com/astaxie/beego/orm"

type Product struct {
    ID string `orm:"pk"`
    ...
}

product := &Product{ID: productID}
_, err := orm.NewOrm().Insert(product)
if err != nil {
    log.Fatal(err)
}

I keep getting this; no LastInsertId available whenever the code runs (the insert is otherwise successful) but I get a crash.
I understand is it due to postgresql limitations because I use https://www.github.com/lib/pq driver.
Is there I way to work around this using beego/orm?

A: If the crash is being caused by your log.Fatal(err), you can avoid this by checking and avoiding it:
_, err := orm.NewOrm().Insert(product)

if err != nil {
    if err.Error() == "no LastInsertId available" {
        log.Println(err)
    } else {
        log.Fatal(err)
    }
}