text:
Q: switch legend text and symbol in barchart (R lattice) I'd like to switch the legend text and the symbols in that way, that first the symbols appear and then the text right to it. At the moment you see first the describing text and then the symbol. But my text is so long that it would be better to have it the other way around. Do you have any suggestion? Here is my code. Unfortunately, I can't show a picture of the plot according to the constraints of this page.
MyText<-c("Subbasin 1")

barchart(Sub1_AbflussMittel_cms ~ Aufforstungsart, data = Abfluss_Means_Sub1, groups = Waldanteil,
     scales=list(x=list(rot=90,cex=0.6,alternating=1)),  #alternating bestimmt wo die x-Achse Beschriftet wird (2 wäre oberhalb)
     origin=0,
     ylab="Mittlerer Abfluss über die Simulationsdauer [m³/s]", xlab="Szenarien - Waldzusammensetzung",
     main="Abflussveränderung",
     auto.key=list(space="top",
                   #columns=1,
                   title="Szenarien - Waldanteil im Einzugsgebiet [%]",
                   points=FALSE, rectangles=TRUE,
                   size=4,#Breite der Rechtecke
                   height=0.5, #Höhe der Rechtecke
                   background = "gray97",
                   cex=0.8, cex.title=0.9),
     par.settings = my.settings,
     panel=function(x,y,...){
            panel.grid(h=-1, v=0)     # macht die horizontalen Linien
            panel.barchart(x,y,...)
            panel.text(4.5,-1.5,labels=MyText[panel.number()],font=2)}
              )


text:
Q: Is is ok to run multiple PHP Websockets using 1 machine? I am using Debian LAMP Server and I need to run PHP Websockets with very simple coding.
Will need at least five different WebSockets running with same IP different ports but as you know this things use a 1s looping.
I ran one using Alt+F1, another at Alt+F2 and another one at Alt+F3; and they all seem to work ok.
Is it Ok to use one machine to do this, or is that not recommendable at all?
I am expecting around 100 connections on each one.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I hide rulers on startup for Pages? I can press Command-R to easily hide the ruler, but is there a way to make this behavior consistent every time I start up Pages?

A: Get a document set up exactly the way you like it, with whatever showing or not-showing that you want. Save it as a template (File: Save as Template).
If you have the template picker load on startup, then just pick that template.
If you don't, then go into Preferences, and choose that template as the template to load by default (For new documents: Use template…).
These templates can also include custom styles, canned text, etc.


text: Q: How to display one item in LazyRow in JetPack Compose? Like Viewpager or in RecyclerView we can achive this behavior of swiping only one item per swipe. In RecyclerView we achiveve this behavior by using SnapHelper. Any idea how to achieve this behavior in Compose?


text:
Q: Generate File & Send Mail using nodemailer - GCP+NodeJS I'm stuck with the below scenarios. This is working fine on the local computer, however with GCP+NodeJs is not working.
Problem - I have an API that generates QR-Images using https://www.npmjs.com/package/qr-image, then it creates a zip using https://www.npmjs.com/package/archiver. Once the archive is done, it uses the nodemailer(https://www.npmjs.com/package/nodemailer) to send the mail.
Now, to store the generated image & archieve processing I'm using the fs library of NPM.
GCP Configuration - It's dynamic/Flexi app engine where the node app is deployed.
The mkdir function is giving the problem. I don't want to use bucket for simple stuff. Is there any other way, I can use the existing code without a tweak to send mail using nodemail (after archiving files(qr codes))?
Tried the API on the local computer working. For the mail test using mailtrap.io which seems to be working well. But not with GCP.
It is clear some GCP tweak is needed or some node/express JS magic.
Code part which is triggering the error -
const codesFolder = 'codes';
if (!fs.existsSync(codesFolder)) {
    fs.mkdirSync(codesFolder);
}

Error from the GCP Log -
2022-11-13 18:48:58 default[20221113t223118]  Processing email
2022-11-13 18:48:58 default[20221113t223118]  /workspace/node_modules/mysql/lib/protocol/Parser.js:437
2022-11-13 18:48:58 default[20221113t223118]        throw err; // Rethrow non-MySQL errors
2022-11-13 18:48:58 default[20221113t223118]        ^
2022-11-13 18:48:58 default[20221113t223118]  Error: EROFS: read-only file system, mkdir 'codes'      at Object.mkdirSync (node:fs:1382:3)      at Query.<anonymous> (/workspace/index.js:243:16)      at Query.<anonymous> (/workspace/node_modules/mysql/lib/Connection.js:526:10)      at Query._callback (/workspace/node_modules/mysql/lib/Connection.js:488:16)      at Query.Sequence.end (/workspace/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)      at Query._handleFinalResultPacket (/workspace/node_modules/mysql/lib/protocol/sequences/Query.js:149:8)      at Query.EofPacket (/workspace/node_modules/mysql/lib/protocol/sequences/Query.js:133:8)      at Protocol._parsePacket (/workspace/node_modules/mysql/lib/protocol/Protocol.js:291:23)      at Parser._parsePacket (/workspace/node_modules/mysql/lib/protocol/Parser.js:433:10)      at Parser.write (/workspace/node_modules/mysql/lib/protocol/Parser.js:43:10) {
2022-11-13 18:48:58 default[20221113t223118]    errno: -30,
2022-11-13 18:48:58 default[20221113t223118]    syscall: 'mkdir',
2022-11-13 18:48:58 default[20221113t223118]    code: 'EROFS',
2022-11-13 18:48:58 default[20221113t223118]    path: 'codes'
2022-11-13 18:48:58 default[20221113t223118]  }

App.YAML file
runtime: nodejs16

env_variables:
  # The following environment variables are set for all instances
  # of the app.
  NODE_ENV : "production"

A: There is some confusion. Your post says you're using flex env but your comment says standard env.
If you're using Standard, then your code won't work because Standard doesn't allow you write to the local disk (see Google documentation)

A: As @NoCommandLine was correct, earlier my app.YAML file was not containing the env attribute.
I have used flex with a little bit of tweak in YAML. The updated YAML will look like below -
runtime: nodejs
env: flex

env_variables:
  # The following environment variables are set for all instances
  # of the app.
  NODE_ENV : "production"

beta_settings:
  # The connection name of your instance, available by using
  # 'gcloud beta sql instances describe [INSTANCE_NAME]' or from
  # the Instance details page in the Google Cloud Platform Console.
  cloud_sql_instances: <<<connection_name>>>


text:
Q: jq to change one thing and filter another Following on How to make jq to pick name value pairs, which will change/transform the name value pairs. Would it be possible to filter on another field in the same go, or I have to pipe the result to another jq to do the extra filtering?
Here is the test data:
https://jqplay.org/s/_HqPFze-PhZ
The change/transform of the name value pairs under .QueryString, .Params has already been done.
Now I want to further filter the result on the Headers record, and would only need the fields of Accept, User-Agent, and Referer, and discard any other fields that might exist. I.e.,
The final result would be the same as
https://jqplay.org/s/_HqPFze-PhZ
except that the the Headers record now only has the Accept, User-Agent, and Referer remains:
. . .
    "Headers": [
      {
        "Name": "Accept",
        "Value": "text/html, application/xhtml+xml"
      },
      {
        "Name": "User-Agent",
        "Value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36"
      },
      {
        "Name": "Referer",
        "Value": "http://mytest.com/sign_in"
      }
    ]
. . .

Everything else should remain the same as the sample output.

A: You can chain as many assignments as necessary :
jq '( .. | objects | ( .QueryString, .Params ) | select(.) )
         |= ( map( @uri "\( .Name )=\( .Value )" ) | join("&") )
    |
    ( .. | objects | .Headers | select(.) )
         |= map(select(.Name|IN("Accept", "Referer", "User-Agent")))
   '

Using walk is more performant :
jq 'walk(
      ( objects | ( .QueryString, .Params ) | select(.) )
         |= ( map( @uri "\( .Name )=\( .Value )" ) | join("&") )
      |
      ( objects | .Headers | select(.) )
         |= map(select(.Name|IN("Accept", "Referer", "User-Agent")))
   )'


text:
Q: How do you do conditional hovering in styled components? I have a component that based on certain props I want the ability to change the background on hover. but based on other props, hover should do nothing. is this possible?
export const Container = styled.div`

    &:hover {
        background: ${({ shouldHover }) => shouldHover ? 'red' : '' };
    }
`

however this does not work. any suggestions how this can be done?

A: This will work:
export const Container = styled.div`
    ${ props => props.shouldHover
        ? '&:hover { background: red }'
        : ''
    }
`;

A: You can try something like the following, that may help:
import styled, { css } from 'styled-components'

styled.div`
   ${props => props.shouldHover && css`
      &:hover {
        background: 'red';
      }
   `}
`

A: This works for me
import React from "react";
import ReactDOM from "react-dom";
import styled from "styled-components";
const Container = styled.div`
  & > h2 {
    &:hover {
      background: ${props => (props.shouldHover ? "red" : "none")};
    }
  }
`;
function App({ shouldHover }) {
  return (
    <Container shouldHover>

Hello CodeSandbox

Start editing to see some magic shappen!

    </Container>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App shouldHover />, rootElement);

Codesandbox

A: You can make the background conditional based on what props you pass down. Below is an example where the div changes based on multiple different conditions.
const Container = styled.div`
  background: blue;

  &:hover {
    background: ${props => props.shouldHoverRed
      ? 'red'
      : props.shouldHoverGreen
      ? 'green'
      : props.shouldHoverOrange
      ? 'orange'
      : 'blue'
    };
  }
`

default is blue and depending on the prop passed it will render different colors for the background on hover.


text:
Q: Outer Joinning two table in codeigniter I have this two arrays:
  Array ( [291] => 3 [292] => 1 [293] => 3 )

  Array ( [291] => 3 [292] => 1 )

I need a php function to join out the two and have a result look like:
Array ( [293] => 3 )

How could I do this?

A: It seems you want to compute the array_difference, you should use array_diff
<?php
$a1=array ( "291" => 3, "292" => 1, "293" => 3 );
$a2=array ( "291" => 3, "292" => 1 ) ;

$result=array_diff_assoc($a1,$a2);
print_r($result);
?>


text:
Q: Inequality involving binomial coefficients I recently stumbled upon an inequality involving binomial coefficients. There is reason to suspect that it holds for all $l\in\mathbb{N}$. It states that
$$ (2l+1)^{2l+1} < \sum_{m = 0}^{l} \binom{2l+1}{2m} 2^{2(m-l)}(2l+1)^{2m} $$
I am not sure how to approach this problem (i.e. to prove the inequality) and I am not even sure if the inequality holds for large $l$. Any help on the way to prove this is appreciated. Thanks in advance.

A: We have:
$$\sum_{m=0}^{l}\binom{2l+1}{2m}(2l+1)^{2m}\left(\frac{1}{2}\right)^{2l-2m}=2\sum_{h\equiv 0\pmod{2}}\binom{2l+1}{h}(2l+1)^h\left(\frac{1}{2}\right)^{2l+1-h}$$
so the RHS equals:
$$ \left(\frac{1}{2}+(2l+1)\right)^{2l+1} + \left(\frac{1}{2}-(2l+1)\right)^{2l+1} $$
or:
$$\left(2l+\frac{3}{2}\right)^{2l+1}-\left(2l+\frac{1}{2}\right)^{2l+1} $$
and now it is not difficult to show that such a term is greater than $(2l+1)^{2l+1}$.


text:
Q: How to view values set to a superclass's members through the subclass's method? I'm studying Java programming, and trying to understand Inheritance right now. Please take a look at my code here-
package chapter8.programs;

class A
{
    int i,j;

    void showIJ()
    {
        System.out.println("i and j: "+ i +" "+ j );

    }
}

//create a subclass by extending A
class B extends A
{
    int k;
    void showK()
    {
        System.out.println("k : "+ k);
    }

    void sum()
    {
        System.out.println("i + j + k: "+ (i+j+k));
    }
}

public class SimpleInheritance {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

        A superob=new A();
        B subob=new B();

        //superclass can be used by itself-
        superob.i=10;
        superob.j=20;
        System.out.println("Contents of superOb");
        superob.showIJ();
        System.out.println();

        //subclass has access to all public members of the superclass
        subob.k=9;
        System.out.println("Contents of subOb");
        subob.showIJ();
        subob.showK();
        //subob.sum();
        System.out.println();

        System.out.println("Sum of i, j and k: ");
        subob.sum();

    }

}

The output I got is-
Contents of superOb
i and j: 10 20

Contents of subOb
i and j: 0 0
k : 9

Sum of i, j and k:
i + j + k: 9

From what I read about inheritance, I was under the impression that:

A subclass, and all it's members and methods do have access to all
  public members of the superclass.

Accordingly, when I use the object of the sub-class to check the values that have been set by members of the super-class, why is it that the subclass isn't able to view the values(I'm assuming 0 means that).
I think if I use the sub-class object to set values to the members of super-class, using code like:
subob.i=100 and subob.j=200

that would work, but then the values set to i and j by super-class object superobwould be lost.
Can someone please clarify what's the problem here?

A: superob and subob are distinct instances. Setting i and j members of superob doesn't change the values of i and j of subob (which remain 0, the default value of int).

why is it that the subclass isn't able to view the values(I'm assuming 0 means that).

The sub-class is able to view these values (since you didn't define i and j to be private). Otherwise, the code wouldn't compile.

A: superob and subob are completely different instances. If you want to see the behavior you're describing, you need to set those values on a single instance of B.

A: You have two different instances here. The first is an instance of superob, and the second is an instance of subob. As a result, the values they hold are in different memory.
When you set the values of superob, they are stored in the superob instance. When you create a new instance of subob, it has new copies of the fields in superob, but it doesn't share the same data. It just has those fields.
So:
superob.i != subob.i
superob.j != subob.j

Here's a list of all variables:
superob.i
superob.j
subob.i
subob.j
subob.k

There are five total, which hold five different values.

A: Well, in order for the subclass to inherit these values.. They would need to be defined statically before compilation. When a class inherits a superclass, it does not actually keep any dynamic values stored in that superclass. Only static values that are defined in the superclass from the beginning. When I say static that does not mean they are literally Static but that they are defined before runtime and not changed.

A: subob will contain everything that has been defined in it's super-class, so if you assign some values to subob.i and subob.j, those values will be sitting in that class and you'll be able to print them from subob.
superob contains only members defined in the super-class. subob and superob are different instances though, so assigning values to member's of superob and trying to print them from subob is not going to work.
Just to make it even more explicit, take a look at the diagram below. subob and superob are pointing to the different memory blobs, so whatever you do in superob is not going to affect subob and vise versa:
subob points to memory block B:
--------
int i   |
int j   |
int k   |
--------

superob points to memory block A:
--------
int i  |
int j  |
--------


text:
Q: Spring boot + Jackson. How to serialize collections which have null value as empty lists? In my entity I have:
private Set<Account> accounts;

Now it is being serialized like this:
"accounts": null

I need to change it to
"accounts": []

I have many (150+) entities which have this problem - how can configure jackson mapper to achieve this?

A: You could remove the "accounts" completely from the json annotating your pojo with:
@JsonInclude(JsonInclude.Include.NON_NULL)

maybe this helps

A: I think declaring your set like this will work...
private Set<Account> accounts = new HashSet<>();

It's then an empty set when marshalling and not null.


text:
Q: "My orders" showing everyones orders in my page suppose when I logged in using google sign in my app then I order the food and if anyone orders food from other app with other account if user orders then my orders can show me his orders and his orders are getting loaded into my including my orders . so, every user can see everyones order. help me to solve this problem.
    package com.food.sheenishere.stark;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.food.sheenishere.stark.Common.Common;
import com.food.sheenishere.stark.Model.Request;
import com.food.sheenishere.stark.ViewHolder.OrderViewHolder;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;

public class OrderStatus extends AppCompatActivity {

    public RecyclerView recyclerView;
    public RecyclerView.LayoutManager layoutManager;

    FirebaseRecyclerAdapter<Request,OrderViewHolder> adapter;
    FirebaseDatabase database;
    DatabaseReference requests;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_order_status);
        //firebase
        database=FirebaseDatabase.getInstance();
        requests=database.getReference("Requests");

        recyclerView= (RecyclerView)findViewById(R.id.listOrders);
        recyclerView.setHasFixedSize(true);
        layoutManager= new LinearLayoutManager(this);
        recyclerView.setLayoutManager(layoutManager);

        loadOrders();

    }

    private void loadOrders() {

        adapter = new FirebaseRecyclerAdapter<Request, OrderViewHolder>(
                Request.class,
                R.layout.order_layout,
                OrderViewHolder.class,
                requests.orderByChild("name")

        ) {

            @Override
            protected void populateViewHolder(OrderViewHolder viewHolder, Request model, int position) {
                viewHolder.txtOrderId.setText(adapter.getRef(position).getKey());
                viewHolder.txtOrderStatus.setText(convertCodeToStatus(model.getStatus()));
                viewHolder.txtOrderAddress.setText(model.getAddress());
                viewHolder.txtOrderPhone.setText(model.getPhone());
                viewHolder.txtOrderName.setText(model.getName());
            }
        };
        recyclerView.setAdapter(adapter);
    }

    private String convertCodeToStatus(String status) {
        if (status.equals("0"))
            return "placed  ";
        else if (status.equals("1"))
            return "On my way";
        else
            return "Shipped   ";
    }
}

com.food.sheenishere.stark.Model.Request
 package com.food.sheenishere.stark.Model;

import java.util.List;

/**
 * Created by WAHDAT KASHMIRI on 12-09-2017.
 */

public class Request {
    private String phone;
    private String name;
    private String address;
    private String total;
    private String status;
    private List<Order> foods; //list of food order

    public Request() {
    }

    public Request(String phone, String name, String address, String total, List<Order> foods) {
        this.phone = phone;
        this.name = name;
        this.address = address;
        this.total = total;
        this.status = "0"; //default is 0, 0:placed, 1 : shipping ,2:shipped
        this.foods = foods;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getTotal() {
        return total;
    }

    public void setTotal(String total) {
        this.total = total;
    }

    public List<Order> getFoods() {
        return foods;
    }

    public void setFoods(List<Order> foods) {
        this.foods = foods;
    }
}

A: I would suggest adding a userId to your Request model.
private String userId;

Populate that with the user who created the request.  Then later, when you are retrieving records to display, only retrieve records for the current logged-in user by userId.
If you're using Android Google Sign On, see this section of documentation for a source of unique identifier for the user:
https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInAccount#getId()


text:
Q: trying to convert web.xml file into servlet 3.0 format with annotation Currently, I am learning how to connect my spring project with DB from a book I have. But, in this book, project is written with WEB.xml which is I dont want to use.
Can you help me to convert this xml file with proper servlet 3.0 format?
<listener>
    <listener-class>jdbc.DBCPInitListener</listener-class>
</listener>

<context-param>
    <param-name>poolConfig</param-name>
    <param-value>
        jdbcdriver=com.mysql.jdbc.Driver
        jdbcUrl=jdbc:mysql://localhost:3306/board?characterEncoding=utf8
        dbUser=jspexam
        dbPass=jsppw
        validationQuery=select 1
        minIdle=3
        maxTotal=30
        poolName=board
    </param-value>
</context-param>


text:
Q: Laravel class not being compiled on first run I used the tutorial posted on Net Tuts+ (http://hub.tutsplus.com/tutorials/combining-laravel-4-and-backbone--net-31745) and implemented the Error handling as instructed.
In the composer autoload section, I have the error.php file being loaded.  It contains a class called NotFoundException which is used to create exceptions for REST requests.
When I dump the autoload using artisan, it builds fine, and on the first run, I get the error "ReflectionException: Class NotFoundException does not exist".  This ONLY happens on the first run after the dump.  Subsequent runs are fine and when I run into an instance that triggers the exception, the exception class works. This error does appear each time I run my unit testing though, causing my tests to fail, but it only appears in the first file which calls the exception.  I have 2 tests in 2 separate files which run and both use the exception as an assertion, and the first one gets and error, while the second one passes.
I am still very new to Laravel, so it might be a simple fix, but am I missing something?  Is there supposed to be another reference that I'm overlooking?
The output from the steps below:
root@ubuntu:/var/www/api# composer dump-autoload
Generating autoload files
root@ubuntu:/var/www/api# php artisan clear-compiled
root@ubuntu:/var/www/api# php artisan optimize
Generating optimized class loader
Compiling common classes
root@ubuntu:/var/www/api# phpunit
PHPUnit 3.7.22 by Sebastian Bergmann.

Configuration read from /var/www/api/phpunit.xml

E........................................

Time: 2 seconds, Memory: 46.00Mb

There was 1 error:

1) AuthControllerTest::testProcess
ReflectionException: Class NotFoundException does not exist

/var/www/api/bootstrap/compiled.php:7539
/var/www/api/bootstrap/compiled.php:7533
/var/www/api/bootstrap/compiled.php:7508
/var/www/api/bootstrap/compiled.php:7477
/var/www/api/bootstrap/compiled.php:7472
/var/www/api/vendor/composer/ClassLoader.php:185
/var/www/api/vendor/composer/ClassLoader.php:185
/var/www/api/bootstrap/compiled.php:165
/var/www/api/bootstrap/compiled.php:142
/var/www/api/bootstrap/compiled.php:444
/var/www/api/bootstrap/compiled.php:83
/var/www/api/bootstrap/compiled.php:163
/var/www/api/bootstrap/compiled.php:142
/var/www/api/bootstrap/compiled.php:444
/var/www/api/bootstrap/compiled.php:186
/var/www/api/bootstrap/compiled.php:175
/var/www/api/bootstrap/compiled.php:142
/var/www/api/bootstrap/compiled.php:444
/var/www/api/bootstrap/compiled.php:4763
/var/www/api/bootstrap/compiled.php:7834
/var/www/api/bootstrap/compiled.php:7821
/var/www/api/bootstrap/compiled.php:4775
/var/www/api/bootstrap/compiled.php:483
/var/www/api/bootstrap/compiled.php:490
/var/www/api/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Client.php:82
/var/www/api/vendor/symfony/browser-kit/Symfony/Component/BrowserKit/Client.php:324
/var/www/api/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php:58
/var/www/api/app/tests/controllers/AuthControllerTest.php:22
/usr/share/php/PHPUnit/TextUI/Command.php:192
/usr/share/php/PHPUnit/TextUI/Command.php:130

FAILURES!
Tests: 41, Assertions: 38, Errors: 1.

Here is the errors.php file:
<?php

class PermissionException extends Exception {

    public function __construct($message = null, $code = 403)
    {
        parent::__construct($message ? : 'Action not allowed', $code);
    }

}

class ValidationException extends Exception {

    protected $messages;

    public function __construct($validator)
    {
        $this->messages = $validator->messages();
        parent::__construct($this->messages, 400);
    }

    public function getMessages()
    {
        return $this->messages;
    }

}

class NotFoundException extends Exception {

    public function __construct($message = null, $code = 404)
    {
        parent::__construct($message ? : 'Resource Not Found', $code);
    }

}

And finally, my composer.json file:
{
        "name": "laravel/laravel",
        "description": "The Laravel Framework.",
        "keywords": ["framework", "laravel"],
        "require": {
            "laravel/framework": "4.0.*",
            "way/generators": "dev-master",
            "twitter/bootstrap": "dev-master",
            "conarwelsh/mustache-l4": "dev-master",
            "hybridauth/hybridauth": "*"
        },
        "require-dev": {
            "phpunit/phpunit": "3.7.*",
            "mockery/mockery": "0.7.*"
        },
        "autoload": {
                "classmap": [
                        "app/commands",
                        "app/controllers",
                        "app/models",
                        "app/database/migrations",
                        "app/database/seeds",
                        "app/tests/TestCase.php",
                        "app/ifr/interfaces",
                        "app/ifr/repositories",
                        "app/errors.php"
                ]
        },
        "scripts": {
            "post-install-cmd": [
                "php artisan optimize"
            ],
            "pre-update-cmd": [
                "php artisan clear-compiled"
            ],
            "post-update-cmd": [
                "php artisan optimize"
            ],
            "post-create-project-cmd": [
                "php artisan key:generate"
            ]
        },
        "config": {
                "preferred-install": "dist"
        },
        "minimum-stability": "dev"
}

A: Try the following:

*

*Create the errors.php file and code your exceptions

*Put your file to the autload section of your root composer.json

*Run in your laravel root:
php composer.phar dump-autoload

php artisan clear-compiled

php artisan optimize

Please report :)

A: it is old but somebody may need the solution of the problem. Please   remove compiled.php then run composer update. It should be OK.


text:
Q: What is a "map" in the four color theorem? The four color theorem declares that any map in the plane (and, more generally, spheres and so on) can be colored with four colors so that no two adjacent regions have the same colors.
However, it's not clear what constitutes a map, or a region in a map. Is this actually a theorem in graph theory, something about every planar graph with some properties admitting a certain coloring?
Or does one really prove it using regions in the plane (which I guess we take to have non-fractal boundaries, or something). What is the precise definition?

A: The theorem is a statement about planar graphs.  In the application to geography, you have a finite collection of "countries" (disjoint connected open subsets of the plane with, let's say, piecewise-smooth boundaries).  Two countries are considered to be adjacent if the intersection of their boundaries has nonzero length.  You then consider the graph with vertices corresponding to countries and edges between adjacent countries.

A: Here is a formal statement. Let $G=(V,E)$ be a finite planar graph with vertices $V$ and edges $E$. It is possible to find a collection $P=\{S_1,S_2,S_3,S_4\}$ of dijoint subsets of $V$ such that $V=S_1\cup S_2\cup S_3\cup S_4$ and for every $a,b\in S_i$, there is no edge in $E$ joining $a$ and $b$.
The map is the graph, and regions are the vertices.


text:
Q: Is there any tool for displaying ActionScript class hierarchy? Is there any tool to generate a class hierarchy graph (like UML) for ActionScript3 projects?

A: I have no experience with this application, but a little google-fu found UML4AS which claims that it generates class diagrams like you're looking for.

A: I like Crocus Modeler ( http://crocusmodeller.com/ ).  It is still not free ($49), but does support round trip coding.  I use it to generate documentation from existing code, or generates stubs from a diagram.  It is specific to MXML/AS3, so all of the features are directed to coding in flex.


text:
Q: How to connect web3 contract with flutter I want to create a web d-App with flutter. I use flutter_web3 to connect to a metamask wallet on the browser with this code:
  final access = await ethereum!.requestAccount();
  if (access.isNotEmpty) currentAddress = access.first;

It connects successfully and I can get the address of the account. also I have these functions in solidity:
pragma solidity ^0.8.0;
contract Money {
uint public money = 0;

function getMoney() public view returns(uint256) {
    return money;
}

function updateMoney() external {
    money += 1;
}
}

Also, I have the contract address, RPC URL, and an abi.json file. So, How can I call getMoney function and updateMoney function with the contract?


text:
Q: How to get the order of execution of different functions in multiple python modules? I have 3 modules in a python package arranged in the following order:
└── mypackage
       ├── __init__.py
       ├── module1.py
       ├── module2.py
       ├── main.py

main.py looks like this:
from mypackage.module1 import func1
from mypackage.module2 import func2

if __name__=="__main__":
   func1()
   func2()

If we run the main.py module, it's evident that

*

*At first, func1 from module1 gets executed

*Secondly, func2 from module2 gets executed

I'd like to know in what order each of the functions in different modules got executed. How can I get something like this? (The output format does not need to be exactly like this)
└── main.py
       ├── module1.py
           ├── func1
       ├── module2.py
           ├── func2

FAQs
1. Is your input a python script?
Yes.
2. Can it (your modules) have any valid structure and any valid code?
Yes. It has valid functions
3. Do you want to determine this without executing the code?
No. Codes can be executed. I just need the name of the modules and functions in their correct execution order
4. Do you want to know if code from the standard library is executed or just your own code?
Just my own code


text:
Q: Failure/Error: get :show, :id => @user I'm going through a Rails tutorial. In the chapter 11th when I add this code
<% if @user.microposts.any? %>
        <table class="microposts" summary= "User microposts">
        <%= render @microposts %>
        </table>
        <%= will_paginate @microposts %>
        <% end %>

I get two errors as followed
1) UsersController GET 'show' should show the user's microposts
   Failure/Error: get :show, :id => @user
   ActionView::Template::Error:
     Missing partial microposts/micropost with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/home/ruby/new_rails/rail_new_app/app/views"
   # ./app/views/users/show.html.erb:10:in `_app_views_users_show_html_erb___4312949856623214655_35714500__2182421899600364460'
   # ./spec/controllers/users_controller_spec.rb:100:in `block (3 levels) in <top (required)>'

 2) UsersController GET 'show' should paginate microposts
   Failure/Error: get :show, :id => @user
   ActionView::Template::Error:
     Missing partial microposts/micropost with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:html], :locale=>[:en, :en]} in view paths "/home/ruby/new_rails/rail_new_app/app/views"

Please let me know where I'm wrong.

A: Error: Missing partial microposts/micropost
Which is because of <%= render @microposts %> needing a partial to render the collection of microposts, like the error says.
Caveat: If you just provide an object and let rails determine the partial by itself, it will default to :pluralized_model_name/_:singular_model_name, which is microposts/_micropost in your case. If you want rails to render another partial for your collection, you need to explicitly specify it; render partial: 'user/microposts', collection: @microposts.
You just need to create the partial. And read the error messages, they're helpful.

A: Sounds like you solved this but just in case others are going through the Hartl tutorial and get this error see:
Listing 11.21: A partial for showing a single micro post.
This is where the file is created in the tutorial.
Make sure the file you created has this name:
app/views/microposts/_micropost.html.erb

Also make sure the file has the appropriate content.


text:
Q: sum up each individual values from 2 arrays I'm trying to understand this conditional loop to sum up each elements from 2 arrays, but I stumble upon the latter part, I don't understand what is to be achieved there.
Can you please explain to me?
function Arrays_sum(array1, array2) {
    var result = [];
    var ctr = 0;
    var x = 0;

    if (array1.length === 0)
        return "array1 is empty";
    if (array2.length === 0)
        return "array2 is empty";

    while (ctr < array1.length && ctr < array2.length) {
        result.push(array1[ctr] + array2[ctr]);
        ctr++;
    }

    if (ctr === array1.length) //I don't understand from here onwards
    {
        for (x = ctr; x < array2.length; x++) {
            result.push(array2[x]);
        }
    } else {
        for (x = ctr; x < array1.length; i++) {
            result.push(array1[x]);
        }
    }

    return result;
}

A: Let's suppose the following two arrays and their "sum":
Array 1: 1  2  3  4   5  6   7   8  9 [length = 9]
Array 2: 2  4  6  8   2  4   6        [length = 7]

Sum    : 3  6  9  12  7  10  13  8  9 [length = 9]

Pay attention to the last two items. The sum is equal to the value of the first array because the second array doesn't contain such number of values.
Array 1: 1  2  3  4   5  6   7   8  9
Array 2: 2  4  6  8   2  4   6   ?  ?

That's exactly what algorithm does:
1) While both arrays have numbers at i index - sum up.
ctr    : !  !  !  !   !  !   !  \|/   [ ctr   = 7 (remember: 0-based indexes)]
Array 1: 1  2  3  4   5  6   7   8  9 [length = 9]
Array 2: 2  4  6  8   2  4   6        [length = 7]

Sum    : 3  6  9  12  7  10  13

Here while (ctr < array1.length && ctr < array2.length) conditions breaks at ctr < array2.length.
Further, the check ctr == array2.length returns true meaning that the Array 2 is over and we need to continue iterating through the array1.
for (x = ctr; x < array1.length; i++) {
    result.push(array1[x]);
}

2) While the remaining array is not over - add values from it.
x    :                           !  !  \|/ [  x    = 10]
Array 1: 1  2  3  4   5  6   7   8  9      [length = 9 ]
Array 2: 2  4  6  8   2  4   6             [length = 7 ]

Sum    : 3  6  9  12  7  10  13  8  9

A: At the end of the first loop, the following assertion holds:
ctr === array1.length || ctr === array2.length

Observe the following scenario illustration:
array1: xxxxxxx    (length = 7)
array2: xxxxxxxxxx (length = 10)
               ^
               7 (ctr)

If the end of one array has been reached, it will continue to append each element of the other array from that point onwards. Of course, this assumes that elements outside of each array's bounds are considered to be 0.
Technically, the function could have less edge cases by considering:
array2 is empty => yield array1
array1 is empty => yield array2

That said, because we're dealing with JavaScript we can bend the CS rules a little bit:
function array_sum(a, b)
{
  // iterate over the biggest array and map each value
  return (a.length > b.length ? a : b).map(function(value, index) {
    // to the sum of both, whereby 0 is assumed for non-existent elements
    return value + (b[index] || 0);
  });
}

A: As You can see hear you are using if because in while loop you are checking two array using && condition.
so if suppose array1.length = 1 and  array2.length = 2 and your ctr = 1 then your while loop will be stop , but array2 has one more value remaining so for remaining Value they use IF Condition

if (ctr === array1.length) //I don't understand from here onwards
    {
        for (x = ctr; x < array2.length; x++) {
            result.push(array2[x]);
        }
    } else {
        for (x = ctr; x < array1.length; i++) {
            result.push(array1[x]);
        }
    }


text:
Q: Validate date strings in Ruby with multiple accepted formats? I have some strings that might or might not be dates like:
"Hello World", "Sept 12, 2013", "Hello World Sept 12"

In this case, I'd like only the second one to be considered a proper date.
So far, I have been using Date.parse and the Chronic gem but they very lenient and convert strings like "a a" or "12-UNKN/34/OWN1" into acceptable dates.
For example:
Date.parse '12-UNKN/34/OWN1'

would return:
 Tue, 12 Nov 2013

So, I am trying to restrict the accepted formats to a set of formats I can control:
09/12/2013
9/12/2013
9/12/13
09-12-2013
9-12-2013
9-12-13

and some formats with text inside like:
Sept 9, 2013 - with or without the coma, accepting Sep, Sept or September and with or without a dot after the month name, covering things like:
Sept. 9, 2013
Sept 09, 2013
Sept. 09, 2013
September 9, 2013
September 09, 2013

Any suggestion on a good way to do this in Ruby, either pure Ruby or with Rails?

A: I'll take a stab at this and elaborate on my comment. Separating the date from the other string allows you to validate the date in multiple formats before handing it off to Chronic:
validates_format_of :date, with: /\d{2,4}[-/]\d{1,2}[-/]\d{1,4}/, on: :create
That should handle most of the date formats you described.
However, a big issue is you won't know if someone is submitting a date in the US format or non-US format.
The bigger issue is know what part of the title string is in fact a date, and that would either be a more complicated regular expression, or make it easy on yourself and make it a separate field. You're getting somewhat close to trying to parse natural language which isn't cut and dry by any means.

A: Try something like this
validate :validate_some_date

private

def validate_some_date
  errors.add("Created at date", "is invalid.") unless [
      date_case_one,
      date_case_two,
      date_case_three
    ].all?
end

def date_case_one
  # some regex
end

def date_case_two
  # some regex
end

def date_case_three
  # some regex
end


text:
Q: tail -f | awk and end tail once data is found I am trying to build a script which tail -f | awk the log file which is getting updated every second. awk part will fetch me only the required part of the log file based on my search parameter. Output XML is also captured in an output file. Script is working fine - as expected.
Issue - However ever after the search is performed it stays hung due to tail -f. Any idea how to update below script - so that once the output XML is captured, it should break the tail part??
XMLF=/appl/logs/abc.log

aa_pam=${1-xml}
[[ ${2-xml} = "xml" ]] && tof=xml_$(date +%Y%m%d%H%M%S).xml || tof=$2
tail -f $XMLF | \
awk  ' BEGIN { Print_SW=0; Cnt_line=1; i=0}
       /\<\?xml version\=/ { if (Print_SW==1) p_out(Cnt_Line,i)
                             Print_SW=0; Cnt_line=1;
       }
       { Trap_arry[Cnt_line++]=$0;
       }
       /'${1-xml}'/ { Print_SW=1;
       }
       /\<\/XYZ_999/    { if (Print_SW==1) p_out(Cnt_Line, i);
                             Print_SW=0; Cnt_line=1; }
       END { if (Print_SW==1) p_out(Cnt_Line, i); }
function p_out(Cnt_Line, i) {
       for (i=1;i<Cnt_line;i++) {print Trap_arry[i] | "tee '$tof'" }
}
' | tee $tof

Update Tried as per below suggestion of using exit - it is existing the script successfully - however the xml that is getting captured at output is getting duplicated. So in the output file - same XML appears twice..!!
XMLF=/appl/logs/abc.log

aa_pam=${1-xml}
[[ ${2-xml} = "xml" ]] && tof=xml_$(date +%Y%m%d%H%M%S).xml || tof=$2
tail -f $XMLF | \
awk  ' BEGIN { Print_SW=0; Cnt_line=1; i=0}
       /\<\?xml version\=/ { if (Print_SW==1) p_out(Cnt_Line,i)
                             Print_SW=0; Cnt_line=1;
       }
       { Trap_arry[Cnt_line++]=$0;
       }
       /'${1-xml}'/ { Print_SW=1;
       }
       /\<\/XYZ_999/    { if (Print_SW==1) p_out(Cnt_Line, i);
                             Print_SW=0; Cnt_line=1; }
       END { if (Print_SW==1) p_out(Cnt_Line, i); }
function p_out(Cnt_Line, i) {
       for (i=1;i<Cnt_line;i++) {print Trap_arry[i] | "tee '$tof'" } { exit }
}
' | tee $tof

A: Call exit (which will jump to your END block prior to termination) after you are finished capturing your output.
When awk terminates, the next write() to stdout by tail -f will result in an EPIPE error. tail knows to terminate when that happens.
UPDATE: You seem to be having some problem trying to decide where to put the exit. It should not be in p_out because you call p_out from both the closing XML tag match expression and from the END block. Try this instead:
XMLF=/appl/logs/abc.log

aa_pam=${1-xml}
[[ ${2-xml} = "xml" ]] && tof=xml_$(date +%Y%m%d%H%M%S).xml || tof=$2
tail -f $XMLF | \
awk  '
  BEGIN {
    Print_SW=0
    Cnt_line=1
    i=0
  }

  /\<\?xml version\=/ {
     if (Print_SW==1)
        p_out(Cnt_Line,i)
     Print_SW=0
     Cnt_line=1
  }

  {
    Trap_arry[Cnt_line++]=$0
  }

  /'${1-xml}'/ {
    Print_SW=1;
  }

  /\<\/XYZ_999/ {
    if (Print_SW==1)
      p_out(Cnt_Line, i)
    Print_SW=0
    Cnt_line=1
    exit
  }

  END {
    if (Print_SW==1)
      p_out(Cnt_Line, i);
  }

  function p_out(Cnt_Line, i) {
    for (i=1;i<Cnt_line;i++) {
      print Trap_arry[i] | "tee '$tof'"
    }
  }
' | tee $tof

A: You could, in the awk script, add a line such as:
/some-end-of-xml-marker/  {  close(/dev/stdin) ; }

I didn't try it, but you get the idea: close STDIN when you reached the end of the file, so that the loop in awk stops and you get to the END part (not tested, I hope this proves to be correct...)

A: Based on this question How to break a tail -f command in bash you could try
#! /bin/bash

XMLF=/appl/logs/abc.log

aa_pam=${1-xml}
[[ ${2-xml} = "xml" ]] && tof=xml_$(date +%Y%m%d%H%M%S).xml || tof=$2

mkfifo log.pipe
tail -f "$XMLF" > log.pipe & tail_pid=$!

awk  -vpar1="$aa_pam" -vtof="$tof" -f t.awk  < log.pipe
kill $tail_pid
rm log.pipe

where t.awk is:
/<\?xml version\=/ {
    if (Print_SW==1) {
        p_out(Cnt_Line)
    }
    Print_SW=0
    Cnt_line=0
}

{
    Trap_arry[++Cnt_line]=$0
}

$0 ~ par1 {
    Print_SW=1;
}

/<\/XYZ_999/    {
    if (Print_SW==1)
        p_out(Cnt_Line)
    Print_SW=0
    Cnt_line=0
}

function p_out(Cnt_Line, i) {
    for (i=1; i<Cnt_line; i++) {
        print Trap_arry[i] | ("tee " tof)
    }
    exit 1
}


text:
Q: Recuperating Data From a WebService Using Alamofire Swift 3 How to recuperate data from the web service using the POST method with in swift 3 using Alamofire API , my xcode target version is ios 10.3.
This is an example of my web service data recuperation.
https://imgur.com/9uWXCrB


text:
Q: Is mysql update on join table consistent? I have two tables t1 and t2 with primary key id and integer amount each.
I need to "move" amounts from t2 to t1, but not lost any amounts and not get extra. Is it possible by single update with autocommit and without transaction isolations?
I mean something like this:
update t1 join t2 using (id)
    set t1.amount = t1.amount + t2.amount, t2.amount = 0;

Is it guaranteed that total amount will not be changed by this statement? Or it's possible (if change t2.amount during this execution or interrupt it) that t1.amount increase by not the same value that t2.amount decrease?

A: Though it seems to work as expected, it's documented as "unreliable":

Single-table UPDATE assignments are generally evaluated from left to
  right. For multiple-table updates, there is no guarantee that
  assignments are carried out in any particular order.

(MySQL 8.0 Reference Manual  /  ...  /  UPDATE Syntax )
But you can calculate the sum in a derived table:
update t1
join t2 using (id)
join (
  select id, t1.amount + t2.amount as amount
  from t1 join t2 using(id)
) x using (id)
set t1.amount = x.amount,
    t2.amount = 0

In this case the order in the SET clause doesn't matter since the assignments don't interfere.
For InnoDB a single UPDATE statement is atomic. It's either executed completly or not at all. If something goes wrong during the execution (eg. server crash or data type overflow) all changes will be rolled back or just not commited.


text:
Q: Lay out two triggers in different tables So I have two BEFORE INSERT triggers. One is:
DELIMITER //

CREATE TRIGGER Carperperson  /* This Trigger Blocks a customer from renting two cars on the same name twice on one day. */
BEFORE INSERT ON bookings   /*E.g. Mr.ABC cannot rent a Ford and a Nissan on the same day. Has to return first car first.[WORKING]*/
FOR EACH ROW
BEGIN
IF EXISTS (
    SELECT 1
    FROM bookings
    WHERE NEW.customer_id = bookings.customer_id
      AND ((new.start_date >= bookings.start_date
            and new.start_date < bookings.end_date)
        or (new.end_date > bookings.start_date
            and new.end_date < bookings.end_date))
) THEN
    SIGNAL SQLSTATE '45000'
        set message_text='You can only book one car per single customer a day!' ; /* This triggers only allows to rent a car for 7 days, not more, not less[WORKING]*/
END IF;
IF ( NEW.end_date > NEW.start_date + INTERVAL 7 DAY ) THEN
      SIGNAL SQLSTATE '45000'
         SET MESSAGE_TEXT = 'error end_date more than seven days after start_date';
   END IF;
END //

DELIMITER ;

The other one is:
DELIMITER $$
CREATE TRIGGER `check_repair` BEFORE INSERT ON `bookings` FOR EACH ROW BEGIN
    # We need to save the "count"
    DECLARE inspections_count INT DEFAULT 0;

    # Check if where is a repair going which matches the vehicle_id
    SELECT
      1 INTO inspections_count # store the "count" into the variable.
    FROM inspections
    WHERE
        inspections.vehicle_id = NEW.vehicle_id
      AND
        repair_complete = 'No'
    ORDER BY
     inspections.start_date DESC
   LIMIT 1

    # if there is a "count" stop the insert.
    IF inspections_count = 0 THEN
      SIGNAL SQLSTATE '45000'
      SET MESSAGE_TEXT = 'vehicle is in repair';
    END IF;
END
$$
DELIMITER ;

They are both BEFORE INSERT, however they are for different tables. Do I need to create a new statement? How do you put the triggers so they load in properly?  What is the proper syntax?

A: From "23.3.1 Trigger Syntax and Examples":

As of MySQL 5.7.2, it is possible to define multiple triggers for a given table that have the same trigger event and action time. For example, you can have two BEFORE UPDATE triggers for a table. By default, triggers that have the same trigger event and action time activate in the order they were created. To affect trigger order, specify a clause after FOR EACH ROW that indicates FOLLOWS or PRECEDES and the name of an existing trigger that also has the same trigger event and action time. With FOLLOWS, the new trigger activates after the existing trigger. With PRECEDES, the new trigger activates before the existing trigger.

So you can put more than one trigger for the same event for the same time on the same table without a problem, i.e., what you have should work (if you add a semicolon (;) after the LIMIT 1 in the check_repair trigger (and maybe other errors I didn't spot)).
If the order in which the triggers fire doesn't matter, you're good as they are.
If it does however I'd recommend to define it as documented with FOLLOWS or PRECEDES as the order in which the triggers are created is prone to changes for example if you want to changes something in the one created first by dropping and recreating it, it suddenly and unwillingly is the last one. You'd always have to make sure the order of creation is kept, which is easy to forget.
In your case you might also go with unifying both triggers into one and order the statements in the order you like them to execute.
BTW: In your second trigger you could also use IF EXISTS ... like in the first one instead of the detour with the variable. That's probably easier to understand on the first glance.


text:
Q: How to display location on custom map? I am using just image of map(custom map) not mkmapview control. So how can I display user's location on that image or my custom map ?
Thanks in advance.

A: Add an icon, representing your location on the top of your image.


text:
Q: How to add a magnet URL to bittorrent programmatically from vb.net? I have a database table where Magnet URLs are stored by another program, like magnet:?stuff.com%num. I would like to use a separate program to add these URLs to bittorrent.
Any help would be appreciated!

A: If magnet links are already associated with BitTorrent you can simply use Diagnostics.Process.Start
Diagnostics.Process.Start("magnet:?...")

if magnet links are not associated then you can just pass the magnet link as a argument like so:
Diagnostics.Process.Start("C:\...\BitTorrent.exe", "magnet:?...")


text:
Q: ionic 2 error:Unable to find "tslint" command: null i'm new in this website,i'm using ionic 2, when i create new project and run npm run build i get this error, i tried to delete all files and install again but without successful.
    npm run build

> ionic-hello-world@ build C:\Users\John\deve\myEventApp
> ionic-app-scripts build --rollup ./config/rollup.config.js

[20:39:57]  ionic-app-scripts 0.0.30
[20:39:57]  build prod started ...
[20:39:57]  clean started ...
[20:39:57]  clean finished in 6 ms
[20:39:57]  copy started ...
[20:39:57]  ngc started ...
[20:39:57]  lint started ...
[20:39:57]  lint failed:  Unable to find "tslint" command: null
[20:39:57]  Error: Unable to find "tslint" command: null
    at C:\Users\Adir\deve\myEventApp\node_modules\@ionic\app-scripts\dist\lint.js:38:20
    at runTsLint (C:\Users\Adir\deve\myEventApp\node_modules\@ionic\app-scripts\dist\lint.js:35:12)
    at C:\Users\Adir\deve\myEventApp\node_modules\@ionic\app-scripts\dist\lint.js:22:13
    at FSReqWrap.oncomplete (fs.js:123:15)
[20:39:58]  copy finished in 33 ms
[20:39:58]  ngc failed:  Unable to find Angular Compiler "ngc" command: null. Please ensure @angular/compiler-cli has been installed with NPM.
[20:39:58]  Error: Unable to find Angular Compiler "ngc" command: null. Please ensure @angular/compiler-cli has been installed with NPM.
    at C:\Users\Adir\deve\myEventApp\node_modules\@ionic\app-scripts\dist\ngc.js:40:20
    at runNgc (C:\Users\Adir\deve\myEventApp\node_modules\@ionic\app-scripts\dist\ngc.js:34:12)
    at C:\Users\Adir\deve\myEventApp\node_modules\@ionic\app-scripts\dist\ngc.js:18:16
Error running ionic app script "build": Error: Unable to find Angular Compiler "ngc" command: null. Please ensure @angular/compiler-cli has been installed with NPM.

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v6.8.0
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world@ build: `ionic-app-scripts build --rollup ./config/rollup.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-hello-world@ build script 'ionic-app-scripts build --rollup ./config/rollup.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ionic-app-scripts build --rollup ./config/rollup.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs ionic-hello-world
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Adir\deve\myEventApp\npm-debug.log

C:\Users\Adir\deve\myEventApp>

i just update my npm to 3.10.8 and my node.js to 6.8.0
i really don't know what the reason for it.


text:
Q: Mapping between the Poincare disk model and a negatively curved surface I am comfortable using the Poincare disk as a model of hyperbolic geometry, but it has left me with a question for which I don't have a good answer:
Is there a negatively curved surface that we could imagine the Poincare disk as representing?  Ideally there would be a reasonably nice way to transform this negatively curved surface into the Poincare disk (similar to how the hyperboloid model can be turned into the Poincare disk).
Note: When I say "negatively curved surface," I am looking for a surface embedded in $\mathbb{R}^3$ whose metric induced by the Euclidean metric causes it to exhibit hyperbolic geometry, just as the sphere embedded in $\mathbb{R}^3$ exhibits elliptic geometry.  (I'm under the impression that this will require the desired surface to have constant curvature, but I'm not sure about this.)


text: Q: How do I sync a file between OneDrive and local storage? Our school prescribed syllabus has only Turbo C++. I code on http://codeanywhere.com. It automatically saves my projects on OneDrive. Now, I want Turbo C++ to pick up files directly from OneDrive, instead of where it is mounted. Is it possible to do so? Please tell if you know?


text:
Q: Spring Boot Application getting warning , how to fix this and this warning will affect in production? WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/C:/Users/Lalith/.m2/repository/org/springframework/spring-core/5.2.8.RELEASE/spring-core-5.2.8.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
How can I fix this?
This warning will affect in production?

A: I see these WARNING on JAVA 9+ setup.
Looks like it was a known issue for some version of Spring.
Some suggest to remove org.springframework.boot:spring-boot-devtools dependency in pom.xml
It won't cause any issue in production. But yes in future if you upgrade version might affect as mentioned in WARNING.

WARNING: All illegal access operations will be denied in a future
release


text:
Q: combine blocks of code to one function How can I make one function to do something like this
$('#check_express').is(':checked') ? $('#form_express').show() : $('#form_express').hide();

$('#check_express').on('change', function(){
    $(this).is(':checked') ? $('#form_express').show() :
    $('#form_express').hide();
});

$('#check_standard').is(':checked') ? $('#form_standard').show() : $('#form_standard').hide();

$('#check_standard').on('change', function(){
    $(this).is(':checked') ? $('#form_standard').show() :
    $('#form_standard').hide();
});

A: You can probably merge them as:
$('#check_standard,#check_express').on('change', function() {
  var selectedId = this.id;
  var getName = selectedId.split('_');
  $(this).is(':checked') ? $('#form_' + getName[1]).show() :
    $('#form_' + getName[1]).hide();
});

A: First you can extract the code into a function
function bind_stuff(type) {
  $('#check_' + type).is(':checked') ? $('#form_' + type).show() : $('#form_' + type).hide();

  $('#check_' + type).on('change', function(){
      $(this).is(':checked') ? $('#form_' + type).show() :
      $('#form_' + type).hide();
  });
}

bind_stuff('express');
bind_stuff('standard');

You can then shorten the show/hide-Parts by using toggle, which takes an optional boolean parameter which indicates whether to show or hide:
function bind_stuff(type) {
  $('#form_' + type).toggle($('#check_' + type).is(':checked'));

  $('#check_' + type).on('change', function(){
      $('#form_' + type).toggle($(this).is(':checked'));
  });
}
bind_stuff('express');
bind_stuff('standard');

If you want to go further, you can reduce the initializing part by faking an change event:
function bind_stuff(type) {
  $('#check_' + type).on('change', function(){
      $('#form_' + type).toggle($(this).is(':checked'));
  });
  $('#check_' + type).trigger('change');
}

bind_stuff('express');
bind_stuff('standard');

A: You can use toggle like following :

$('#check_express').on('change', function() {
  $('#form_express').toggle();
});

<input type="checkbox" id="check_express" />

  Hello, world.

A: I would bind one function to both selectors.
In the function, check which id is triggered.
The toggle the visibility by using toggle( expression ). Where expression checks if the the checkbox is checked (=show) or not (=hide).

$('#check_express,#check_standard').on('change', function(){
    if( this.id == 'check_express' ) {
        $('#form_express').toggle( $(this).is(':checked') );
    }
    else {
        $('#form_standard').toggle( $(this).is(':checked') );
    }
});
form { display: none; }

Check express: <input type="checkbox" id="check_express" />

Check standard: <input type="checkbox" id="check_standard" />

<form id="form_express">
  Form express
</form>
<form id="form_standard">
  Form standard
</form>

A: I will recommend having a map of checkbox ID vs. form to do it at one shot:
var map = {
  check_express: $('#form_express'),
  check_standard: $('#form_standard')
};

$('#check_express, #check_standard').on('change', function() {
    map[this.id].toggle($(this).is(':checked'));
});

In case you have more such cases, simply add them to map.


text:
Q: How do you bake a deployment in a release pipeline stage? I want to ensure that my deployment has baked for X hours in the current stage before it is deployed to the next. I was reading about post-deployment gates here. I don't think these gates are the best way to ensure that the deployment has baked.

For post-deployment gates, the delay would be the maximum of the time taken for the deployed app to reach a steady operational state, the time taken for execution of all the required tests on the deployed stage, and the time it takes for incidents to be logged after the deployment.

If the deployed app reaches a healthy state, then would the gate be opened to move to the next?
Or if its always going to wait X hours, if I want my build to bake for 4 hours, but it took 1 hour to deploy it, then it wouldn't bake completely.

A: You can define a gate with delay

Asumming you have some healt check implemented in your app, it will make a request to a health check after 4 hours delay.


text:
Q: How to install Scriptcs to Sublime How can I install Scriptcs to Sublime ?
My aim is to use a Visual Studio alternative to run ASP.Net pages on Sublime.  To able to do this, I have to add Scriptcs to Sublime. But I couldn't add it.
What I have done so far :
Trying the steps on
https://www.c-sharpcorner.com/article/how-to-run-c-sharp-code-inside-sublime-text/
I have run this in cmd in administrator mode :
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object
System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
But couldn't understand this :
To install Sublime Text Package Manager, head over to packagecontrol.io and follow the installation procedure.

and couldn't run the package on
https://packagecontrol.io
How can I continue and add Scriptcs to Sublime?
Thanks.

A: In order to install packages, you need to install Package Control. As far as I know, there should be a menu entry if you're using Sublime Text 3. Otherwise, follow these instructions for manual installation. Once Package Control is installed, you can access install packages by running "Package Control: Install Package" from the command palette. This will open a search box that lets you search and install Scriptcs.


text:
Q: Entering scopes in template lib In a C++/Qt project, we are using .pro-files and qmake to build. Part of the project is a static lib. The .pro file goes like this:
TEMPLATE = lib
CONFIG = staticlib

#general build instructions

linux{
    #some os-specific build instructions
}
win32|win64{
    #some os-specific build instructions
}

However, these scopes are never entered, not on a linux system (when the first scope should execute), nor on a windows system (for the second scope).
This only appears to be a problem in the staticlib-configuration/lib-template.
The Qt-documentation mentions the different templates, but I do not see anything mentioned as to why scopes would not work or how to solve this.

A: Those conditions are true if they're set in the CONFIG variable. By overwriting CONFIG with staticlib, you reset all preset flags, including the ones specifying the platform.
It should work if you do CONFIG += staticlib


text:
Q: Save Images inline (Base64) for Markdown export in Jupyter notebook How can images from Matplotlib:
plt.tight_layout()
plt.savefig('Image.png', facecolor='w', edgecolor='w', transparent=False, bbox_inches='tight', pad_inches=0.1)
plt.show()

saved inline (embedded as base64?), so that there is no need for external files,
when the Notebook is downloaded as a Markdown file?

A: My workaround solution:
install this: https://github.com/freeman-lab/embed-images
and this: https://nbconvert.readthedocs.io/en/latest/install.html
add to the first cell:
%matplotlib inline
import os
import ipyparams

and to the last cell:
os.system('jupyter nbconvert --to markdown ' + ipyparams.notebook_name)
os.system('embed-images ' + ipyparams.notebook_name[:-6] + '.md > ' + ipyparams.notebook_name[:-6] + '_emb.md')

NBconvert convert the notebook.ipynb to notebook.md with all images in the folder notebook_files.
Embed-Images convert these images to base64, insert their code in the file and saves it as notebook_emb.md
Both lines outputs "0" for a successfully conversion.


text:
Q: Error Redirect for Ajax Froms in asp.net mvc2 I'm building an asp.net mvc2 website and using a lot of ajax form elementes (Ajax.BeginForm to be exact) to asynchronously populate data on the page. I would like to redirect the user to the sign in page after x amount of time of inactivity on the site. When I do this currently, either through ActionExecutingContext, or HttpContext, the sign in page is populated in the current div element for that ajax form, instead of the entire page. Any thoughts on how to get it to redirect the current page?

A: Solution:
override the OnActionExecuted event in your base controller, and create a RedirectResult to call into for wherever you want to redirect. Add the following code:
protected RedirectResult Redirect(string url, ActionExecutedContext filterContext)
{
    return new AjaxErrorRedirectResult(url, filterContext);
}

public class AjaxErrorRedirectResult : RedirectResult
    {
        public AjaxErrorRedirectResult(string url, ActionExecutedContext filterContext)
            : base(url)
        {
            ExecuteResult(filterContext.Controller.ControllerContext);
        }

        public override void ExecuteResult(ControllerContext context)
        {
            if (context.RequestContext.HttpContext.Request.IsAjaxRequest())
            {
                string redirectUrl = "www.google.com";

                JavaScriptResult result = new JavaScriptResult()
                {
                    Script = "self.parent.location='" + redirectUrl + "';"
                };
                result.ExecuteResult(context);
            }
            else
            {
                base.ExecuteResult(context);
            }
        }
    }

A: If you want to redirect the user to another page (login page) when the form is submitted then why use ajax ?
AJAX is best used for the manipulation of a part of the page not and the whole page.
The Ajax.BeginForm has an option object to specify the id of the HTML element to be updated and the type of the update
example
Ajax.BeginForm("Create", "Project",
                new AjaxOptions() {
                                   UpdateTargetId = "projectform",
                                   InsertionMode = InsertionMode.Replace,
                                   HttpMethod = "Post" })

The InsertionMode option has three values Replace, InsertAfter, InsertBefore
In your case i don't know if you can target the HTML tag in the UpdateTargetId. but as i said earlier it's better to use a normal request in this scenario and not to update the whole page using Ajax.
about redirecting the user to the sign in page after a time of inactivity. I believe Sessions is the right way to do that. I'm not sure though how it's done.
Update :
i hope this link will help :
http://blog.tallan.com/2010/06/25/handle-asp-net-mvc-session-expiration/


text:
Q: How and where to create Subversion repository in best practice by web development Could you teach me, how to create svn on the Redhat server, in which several sites, there is need to each of them:
/home/webmaster/www/kmp.ru/
/home/webmaster/www/yandexapi/
/home/webmaster/www/fms01.ru/
/home/webmaster/www/klubpodarkov.com/
There is could be only one svn or several? How to get svn connection via http:// or svn://. Where can I adjust this?
I have in this do not understand!
PS: Sorry for the possibly stupid question

A: There are many ways to do this, but here's a quick example. I'd suggest reading the SVN Book for more information here.

*

*Create repos for each site:

*

*svnadmin create /var/svn/site1

*svnadmin create /var/svn/site2

*configure apache2 to use webDAV and define SVN directory

*mount repos via webDAV

*

*mount -t dav2fs _http://localhost/svn/site1 /mnt/site1

*add mounted directory to apache2 aliases

This allows you to view the latest SVN version from the alias and to access the SVN with a URL like _http://server/svn/site1 .
Had to put unnecessary underlines due to automatic link generation.-

A: i make a svn directory for every user/client i have, then they can make sub folder with different projects

*

*/svn/clients/user1/

*

*/svn/clients/user1/project1

*/svn/clients/user1/project2

*/svn/clients/user1/project3

*/svn/clients/user2/

*

*/svn/clients/user2/project1

*/svn/clients/user2/project2

*/svn/clients/user2/project3

To mount the svn repos use apache mod_dav and mod_svn

A: You can have a single repository or multiple - it doesn't really matter from a technical point of view as you can check out part of the repository or all of it depending on your needs.
However, if you work with other people on different sites you probably want one repo per site.  One repo per site also works if you want to give each client a disk quota.  I create a user folder for each user, and store the repo, staging site, and live site files in the user folder like this:
/home/user
/home/user/svn_repo
/home/user/www/live-site
/home/user/www/staging-site

Check out from repo into local working folder and commit back to repo from there.
Check out/update from the repo into staging-site to show client the changes you have made and test.  Once it is all working and agreed, check out/update into live-site.  This gets a bit messy if multiple people try to do updates.  Best if one person takes this role.
Read Red-Bean book as cited by onik.  If you are doing any editing on Windows systems Tortoise-SVN will be invaluable.  With Tortoise-SVN you can also connect via ssh+svn: pseudo-protocol.  Works very well if you are using signature based ssh logins on your server.


text:
Q: Undefined symbols for architecture arm64: while using vs code to run c/c++
Undefined symbols for architecture arm64:
    "_main", referenced from:
         implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This is the error shown, I'm a beginner in C and C++ programming and I don't know what to do I have installed gcc successfully through homebrew and when I run this simple code for printing Hello world in VS code, it is showing this error. I don't know what I should do at this point.
#include <cstdio>

int main(){
    puts("Hello world\n");
return 0;
}

A: Perhaps the problem had been solved already. I just encountered this problem yet my homebrew is installed at the right place, and I solved it by typing g++ instead of gcc. Maybe you can give it a try.


text:
Q: Why does my command work in IRB but not from a Ruby script? The command below works in IRB but does not work from inside a Ruby program.
DISPLAY=:5 nohup firefox youtube.com &

In irb it successfully returns:
nohup: redirecting stderr to stdout

When called from a Ruby program within backticks ("`") it returns:
** (firefox:12402): WARNING **: Could not connect: Connection refused

** (firefox:12470): CRITICAL **: unable to create '/var/www/.cache/dconf'; dconf will not work properly.
Xlib:  extension "RANDR" missing on display ":5".
Failed to stat home directory /var/www: No such file or directory

(firefox:12470): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
Failed to connect to socket /tmp/dbus-989cWYOeP6: Connection refused

A: The problem appears to be that in order to connect to the X session, the user must have permission to do so (via Xauthority, likely).  The www-data user that the web server is running as does not have such permission.
If you are trying to do things with an X environment in the context of a web request (especially launching a web browser, as it appears you are doing), then you should probably re-think your approach, as this sounds like a bad idea.
We (at Flippa.com) have to open web pages for various reasons, due to the nature of what we do.  We use phantomjs, which also requires an X server, though we run a headless X server called Xvfb, via the Headless gem.  We don't do such things in the context of a web request, however, as that is typically an expensive process.  We run a bunch of Resque workers in the background and off-load that work to be executed asynchronously.  Perhaps you should consider an approach like that.
Also, if you're launching Firefox in order to scrape web content, take screenshots etc, you may want to look at phantomjs, which is intended to be used programatically, rather than on the desktop.
Here's an example of a current screenshot we took using phantomjs.
https://flippa.com/auctions/2703649/screenshots/30b037b026044f58764888995d41c020.png


text:
Q: Convert date string of 'yymmdd' format to 'MM-DD-YYYY' Hi I have strings representing dates in the format of 'yymmdd' i.e. '200421' represents 04-21-2020. How can I convert this to a format of 'MM-DD-YYYY' which is commonly used? I'm thinking this should be simple enough to use Date or momentjs, rather than getting creative and using substrings, etc..
I've been playing around with momentjs on http://jsfiddle.net/v9n4pL8s/1/
and have tried var now = moment('200421').format('MM-DD-YYYY');
alert(now);
but it seems to be all trial and error. Anybody have a simple way of doing this? Thanks!

A: var str = '200421';

function format(date) {
    return date.slice(2, 4) + '-' + date.slice(4) + '-20' + date.slice(0, 2);
}

format(str); // "04-21-2020"

A: you have to pass the date format as the second argument.

const date = moment('200421', 'YYMMDD').format('MM-DD-YYYY');
console.log(date);
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.2.1/moment.min.js"></script>

A: I know you don't want to use substring but, I think this can be useful.


text:
Q: when I use typescript compiler api, I found that interface ClassDeclaration contain optional property "name" when I use typescript compiler api, I found that interface ClassDeclaration contain optional property name.
How can i get a ClassDeclaration Node without name?
I also found that interface InterfaceDeclaration contain a required property name.
Why it is different?

A: A class declaration may not contain a name when exported as a default export.
export default class {
    method() {
    }
}

https://ts-ast-viewer.com/#code/KYDwDg9gTgLgBAE2AMwIYFcA28DGnUDOBcA3gFByVwC2wMAFhAgBQCUpFVAvmV0A
The same is not possible for an interface and it will raise a syntax error.
https://ts-ast-viewer.com/#code/KYDwDg9gTgLgBAE2AMwIYFcA28CWA7GYKNAY2DgG8AoAXyA
I'm not sure why they decided that, but not having to worry about the name not possibly being there does make things easier.


text:
Q: Recent flickr api problem I just recently had problem accessing the getSizes API. I tested it in flickr api site and it returns empty string.
My security setting is set to public. Are there any changes or should I do that I missed. This just happened recently.
Thanks in advance.

A: The site is not blank, I just had to right click on it and view source. :) sorry for such a NOOB.


text:
Q: Make react-native component blink at regular time interval I am trying to make a component "blink" on my page. I was thinking about setting a visible: true state in my componentWillMount method and then put a timeout of 1s in componentDidUpdate to set state to the "opposite" of the previous state. As I see it the component lifecycle looks like this :
sets state to visible to true (componentWillMount that runs only once and is not triggering a rerender)
  enters componentdidUpdate
  waits 1s
  hides component (setstate to visible false)
  enters componentDidUpdate
  waits 1s
  shows component (setstate to visible true)
However my component is blinking but the intervals of hide and show are not regular, they change and dont seem to follow the 1s logic
Here's my component code :
class ResumeChronoButton extends Component {
  componentWillMount(){

    console.log('in componentWillMount')
    this.setState({visible: true})
  }
  componentDidUpdate(){
    console.log('in componentDidUpdate')
    setTimeout(() =>this.setState({visible: !this.state.visible}), 1000)
  }

  // componentWillUnmount(){
  //   clearInterval(this.interval)
  // }
  render(){
    const { textStyle } = styles;
    if (this.state.visible){
      return (
              <TouchableOpacity onPress={this.props.onPress}>
                <Pause style={{height: 50, width: 50}}/>
              </TouchableOpacity>
      );
    }
    else {
      return (
        <View style={{height: 50, width: 50}}>
        </View>
      )
    }
  }
};

How can I make my component blink at regular time interval.

A: The following works for me
componentDidMount = () => {
  this.interval = setInterval(() => {
    this.setState((state, props) => {
      return {
        visible: !state.visible,
      };
    });
  }, 1000);
};

componentWillUnmount = () => {
  clearInterval(this.interval);
};

and then your render can just check this.state.visible to determine if it needs to show or not.
alternatively you could change the setState to
this.setState({visible: !this.state.visible})

A: Most likely because you are using the state and timeouts. State is set asynchronously and, for this reason, it may take different amounts of time to change the value depending on how many resources you are using.
To achieve the effect you want I would recommendo you to use the Animation framework from React Native. Check the docs.

A: just use
setInterval(()=>{//setstate here},time_in_ms)


text:
Q: Windows ComboBox Intercept WM_COMMAND Notifications Updated to reflect a more functional description of my request.
Functionally I need a read only ComboBox that does not directly inherit from the System.Windows.Forms.ComboBox class.  I need the text box portion to be read only, so the user can copy out text that was entered into the box but not change it.  And this is not a case of using DropDown vs DropDownList mode.
Using this article and some experimentation, I have the text box portion taken care of but still need to prevent changes from the drop down component due to technical reasons listed below.  I still need one of the following:

*

*Disable the drop down button on a ComboBox - to prevent it from opening

*Prevent the drop down from opening in a ComboBox when clicked

*Prevent the selection of an item from the drop down from changing the selection in the control (possibly by intercepting and ignoring the clicked item notification message)

I'm using the KryptonToolkit for visual prettiness in my application.  For the KryptonComboBox control, it has an internal, extended System.Windows.Forms.ComboBox class that intercepts the draw calls.  It exposes access to the ComboBox object, so I can get access to it's Handle.
I'm using the A Complete Read Only ComboBox code as a base to create a read only capable version of the KryptonComboBox.  Instead of using the KryptonComboBox.Handle in the SendMessage() calls, you have to use the KryptonComboBox.ComboBox.Handle to get the actual handle to the Windows control.  By doing that I'm able to set the read only mode on the text box part of the ComboBox correctly.
BUT!  Since the base class of the extended control is KryptonComboBox and not ComboBox, when the WndProc() is called it's for messages of the KryptonComboBox.  So I am unable to prevent the control from acting (changing the selection) on the clicked drop down item when it is in read only mode.
How do I intercept (and potentially ignore) WM_COMMAND messages from an existing ComboBox control.  Specifically I want to have a message 273 chain ignored under certain circumstances.  Is there a way to functionally do the same thing to an "external" ComboBox control that I could from an inherited control?  Since I have the Handle for the ComboBox, could I use something like SetWindowsHookEx() to intercept the messages?

A: So I found a solution that works for "plugging into" the command messages for the control and being able to interrupt them.  It involves using the System.Windows.Forms.NativeWindow class to create a listener to the ComboBox which is (from my understanding) called subclassing.
Listener Class:
private class ComboBoxListener : NativeWindow, IDisposable {
    private ComboBox m_oComboBox;

    private EventHandler m_oComboBox_HandleCreated;
    private EventHandler m_oComboBox_HandleDestroyed;

    public ComboBoxListener(ComboBox oComboBox) {
        // Save the combobox and assign the handle if it's already created
        m_oComboBox = oComboBox;
        if (m_oComboBox.IsHandleCreated) {
            AssignHandle(m_oComboBox.Handle);
        }

        // Subscribe to the handle events of the combobox
        m_oComboBox.HandleCreated += m_oComboBox_HandleCreated = new EventHandler(ComboBox_HandleCreated);
        m_oComboBox.HandleDestroyed += m_oComboBox_HandleDestroyed = new EventHandler(ComboBox_HandleDestroyed);
    }

    ~ComboBoxListener() {
        Dispose(false);
    }

    public void Dispose() {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    private void Dispose(bool bDisposing) {
        if (bDisposing && (m_oComboBox != null) && !m_oComboBox.IsDisposed) {
            // Unsubscribe from the combo box
            m_oComboBox.HandleCreated -= m_oComboBox_HandleCreated;
            m_oComboBox.HandleDestroyed -= m_oComboBox_HandleDestroyed;
        }
        m_oComboBox = null;

        // If a handle is currently assigned, release it
        if (this.Handle != IntPtr.Zero) {
            ReleaseHandle();
        }
    }

    private void ComboBox_HandleCreated(object sender, EventArgs e) {
        AssignHandle(m_oComboBox.Handle);
    }

    private void ComboBox_HandleDestroyed(object sender, EventArgs e) {
        ReleaseHandle();
    }

    protected override void WndProc(ref Message m) {
        // Do checks for whether to ignore the message
        // If ignoring, just call return and skip the base.WndProc(ref m) call
        base.WndProc(ref m);
    }
}

Then in the constructor for the deriving class from KryptonComboBox I added:
m_oComboBoxListener = new ComboBoxListener(this);

And added a cleanup in the overridden Dispose(bool disposing):
// Dispose the listener
if (disposing && (m_oComboBoxListener != null)) {
    m_oComboBoxListener.Dispose();
}
m_oComboBoxListener = null;


text:
Q: classification model with low inference time Could anyone suggest a classification model with inference time may be less than a second?
I have trained mobile net and squeeze net but both take around 2 secs for a single image inference.
Any suggestions would be really helpful.Thanks in advance.

A: The speed depends on the hardware specifications. To run this model even faster, you can try installing 'OpenVino' (works only for intel hardware), which helps to run the model 3x faster. Refer the below comparison from Intel.
Performance improvement using Openvino software
You have free version of 'Openvino' for CPU. This software works even for GPU inbuilt devices.
Check more details in the below link:
https://software.intel.com/en-us/openvino-toolkit


text:
Q: How can I get previous fragment index after swipe in android? I know that using ViewPager I can get current fragment index but how can I get previous fragment index?
Its not a problem when I go forward (i-1) but how about going backward? Maybe their is a way to detect which direction I swipe? or something else

A: I just answered a similar question --> Holding references to the fragments returned by PagerAdapter. In that question the user wants to connect the current fragment to a Server and disconnect the previous one, so only one connection is active at any given time.


text:
Q: Can ARKit tracking be as effective as Vuforia's Area targets? Area Targets in Vuforia do a great job of matching a LiDAR scan to the room it was scanned in.
Would I be able to use the point cloud scans from the iPad to do the same in RealityKit on a 1 to 1 scale as does Vuforia?
"Underscore 1 to 1".

A: Vuforia Area Target supports scans made with RealityKit-enabled devices with LiDAR Scanner.
So an answer is obvious: Yes, you can.


text:
Q: RAID 1 or (MSI P35 Neo3) mother board? What happened was that I have a mirror RAID (RAID-1) and one of the drives died.
As far as I know, one should always use identical drives for mirror RAID (don't mix iszes, don't mix manufacturers, right?), but I can't afford 2 right now, so I bought a new Hitachi 2tB to match my old Hitachi 2tB - the difference being that the old one is SATA 2 and the new one is SATA 3.
The J-micron RAID controller does not see the new drive ... can it be that the MSI P35 Neo3 motherboard does not support SATA 3?
Or is it something else?

A: Interface-wise, the SATA-3 should be backward compatible, but I suspect that maybe your RAID controller is being particular due to the firmware. Try taking out the SATA-2 drive and seeing if you can get the controller to recognize only the SATA-3 drive. If so, you know your answer. If not, try it in non-RAID mode, or if you have another system, try the SATA-3 drive there to make sure it was not just DOA.
This has all the docs for your drive, so you might want to keep this page: hitachigst.com/tech/techlib.nsf/products/Deskstar_7K3000 This is the Install guide, which I am looking at now: hitachigst.com/tech/techlib.nsf/techdocs/… I see nothing about a jumper as on some of these drives have for compatibility. At this point, I would call Hitachi and ask them, and also see if they have a firmware update for one, or both drives.


text:
Q: Aerospike: get upsert time without explicitly storing it for records with a TTL Aerospike is blazingly fast and reliable, but expensive. The cost, for us, is based on the amount of data stored.
We'd like the ability to query records based on their upsert time. Currently, when we add or update a record, we set a bin to the current epoch time and can run scan queries on this bin.
It just occurred to me that Aerospike knows when to expire a record based on when it was upserted, and since we can query the TTL value from the record metadata via a simple UDF, it might be possible to infer the upsert time for records with a TTL. We're effectively using space to store a value that's already known.
Is it possible to access record creation or expiry time, via UDF, without explicitly storing it?

A: At this point, Aerospike only stores the void time along with the record (the time when the record expires). So the upsert time is unfortunately not available. Stay tuned, though, as I heard there were some plans to have some new features that may help you. (I am part of Aerospike's OPS/Support team).

A: void time : This tracks the life of a key in system. This is the time at which key should expire and is used by eviction subsystem.
so ttl is derived from the void time.
As we get ttl from a record, we can only calculate the void time (now + ttl)
Based on what you have, I think you can evaluate the upsert time from ttl only if you add same amount of expiration to all your records, say CONSTANT_EXPIRATION_TIME.
in that case
upsert_time = now - (CONSTANT_EXPIRATION_TIME - ttl)

HTH


text:
Q: How to turn off or temporarily disable Visual Studio code hints when hover over code with cursor Started using Visual Studio for Flutter.  It always shows debug messages whenever cursor is hovering over code which I admit are useful, however, many times it's a struggle just to type a character of code in a line as the messages are preventing insertion of code for seconds at a time and it's becoming annoying.
Every message board I see says go to Visual Studio / tools / etc. to turn off such messages. But I see no such menu item, I see: File Selection View Terminal Run Go Help.
How to turn off these pesky messages so I can get back to typing code without having to coninuously fight Microsoft for control of my editor.


text:
Q: What is the iterator type returned by this Rust function?

So I have this example code here:
use std::iter::Filter;
use std::slice::Iter;

fn main() {
    let numbers = vec![12i32, 26, 31, 56, 33, 16, 81];

    for number in ends_in_six(numbers) {
        println!("{}", number);
    }
}

fn ends_in_six(numbers: Vec<i32>) /* -> ??? */ {
    numbers.iter().filter(|&n| *n % 10 == 6)
}

I'm trying to return an iterator, which has always been pretty hairy in Rust from what I've gathered. Running the code here gives me this error:
<anon>:13:5: 13:45 error: mismatched types:
 expected `()`,
    found `core::iter::Filter<core::slice::Iter<'_, i32>, [closure <anon>:13:27: 13:44]>`
(expected (),
    found struct `core::iter::Filter`) [E0308]
<anon>:13     numbers.iter().filter(|&n| *n % 10 == 6)
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Now, working off this (and based on my relatively limited knowledge of how this all works), it seems I should do something like:
fn ends_in_six<'a>(numbers: Vec<i32>) -> Filter<Iter<'a, i32>, /* ??? */> {

But now I'm stuck again, because I'm given [closure <anon>:13:27: 13:44] instead of an actual type. Even when I tried using the function here to try and find out the type, I was given:
core::iter::Filter<core::slice::Iter<i32>, [closure((&&i32,)) -> bool]>

So, trying to figure it out on my own, and basing it on the previous line, I attempted:
fn ends_in_six<'a>(numbers: Vec<i32>) -> Filter<Iter<'a, i32>, Fn(&&i32) -> bool> {

and got even more errors, because Fn is not constant at compile time (i.e. doesn't implement Sized). It makes sense, but I'm at a bit of a loss what else to try.
EDIT: I just tried:
fn ends_in_six<'a, F>(numbers: Vec<i32>) -> Filter<Iter<'a, i32>, F>
  where F: Fn(&&i32) -> bool {

and now I'm getting these errors:
<anon>:7:19: 7:30 error: unable to infer enough type information about `_`; type annotations required [E0282]
<anon>:7     for number in ends_in_six(numbers) {
                           ^~~~~~~~~~~
<anon>:14:32: 14:34 error: the type of this value must be known in this context
<anon>:14     numbers.iter().filter(|&n| *n % 10 == 6)
                                         ^~
<anon>:14:27: 14:44 error: mismatched types:
 expected `F`,
    found `[closure <anon>:14:27: 14:44]`
(expected type parameter,
    found closure) [E0308]
<anon>:14     numbers.iter().filter(|&n| *n % 10 == 6)
                                    ^~~~~~~~~~~~~~~~~

A: Each closure has its own unique type (closures are sugar for a struct and a Fn, FnMut or FnOnce implementation, as determined) and there is no way of writing out the type of a closure.
One thing you can do is write it as a function and then cast it to a function pointer, as shown below.
Another thing is using boxed functions (Box<Fn(&&i32) -> bool>), like Box::new(|&&n| n % 10 == 6). This involves a heap allocation and is in consequence not the most efficient, though in real life you don't need to worry about the performance differences.
The generic attempt you made doesn't work because generics are about allowing the caller to specify a type, any type, where in this case you want the callee to specify a single unique type.
use std::iter::Filter;
use std::slice::Iter;

fn main() {
    let numbers = vec![12i32, 26, 31, 56, 33, 16, 81];

    for number in ends_in_six(numbers) {
        println!("{}", number);
    }
}

fn ends_in_six(numbers: Vec<i32>) Filter<Iter<'a, i32>, fn(&&i32) -> bool> {
    fn filterer(&&n: &&i32) -> bool { n % 10 == 6 }
    numbers.iter().filter(filterer as fn(&&i32) -> bool)
}


text:
Q: Matching parts of strings in SQL Server 2008 and also grouping them? I have data for an ID and for an associated concatenated string. I want to find instances in which at least one of the portions of the concatenated string matches with another grouped on the ID. Please see examples below for clarification:
This is the raw data as I currently have it (note that the 'Row' column is only for explanatory reference):
Row | ID | Concatenated Key
============================
  1    1      AAA_BBB
  2    1      AAA_BBB_CCC
  3    1      BBB_GGG_III
  4    1      DDD_HHH
  5    1      HHH_MMM
  6    1      FFF_GGG_III
  7    2      NNN_OOO
  8    2      NNN_PPP_RRR
  9    2      QQQ_SSS
  10   2      TTT_UUU

Notice how for each Key = {1,2} there are associated concatenated strings. I want to create groups in which at least one of the strings matches with another (overlaps). Here is an example of how I want my resulting data to look like:
Row | ID | Concatenated Key | Group
===================================
  1    1      AAA_BBB          1A
  2    1      AAA_BBB_CCC      1A
  3    1      BBB_GGG_III      1A
  4    1      DDD_HHH          1B
  5    1      HHH_MMM          1B
  6    1      FFF_GGG_III      1A
  7    2      NNN_OOO          2A
  8    2      NNN_PPP_RRR      2A
  9    2      QQQ_SSS          2B
  10   2      TTT_UUU          2C

Here are how the groups are defined based on which keys they include:
  1A: AAA, BBB, CCC, FFF, GGG, III
  1B: DDD, HHH, MMM
  2A: NNN, OOO, RRR
  2B: QQQ, SSS
  2C: TTT, UUU

As an example, take ID 2: For Row 7 and Row 8, NNN is shared and so they are in the same bucket. For Rows 9 and 10, none of them are shared with any other rows so they are in their own buckets. If any single string is shared with any another row, then they are all bucketed together.
Hope that this is a clear explanation. Thank you!

A: Here is the old fashion way. Iterate through data.
It actually output your expected result sorted by group. So only the order is different.
It use '_' character to split the string and look for similar string.
Thus split function is required and included in the solution. Notice I added some logic into it for the operator "LIKE", so using a regular split function won't do unless you edit the codeé
IF object_id(N'SplitThatAddPercentCharacter', N'TF') IS NOT NULL
    DROP FUNCTION SplitThatAddPercentCharacter
GO
CREATE FUNCTION SplitThatAddPercentCharacter
(
    --Took from http://www.aspsnippets.com/Articles/Split-function-in-SQL-Server-Example-Function-to-Split-Comma-separated-Delimited-string-in-SQL-Server-2005-2008-and-2012.aspx
    --Added the adding of "%" character.
      @Input NVARCHAR(MAX),
      @Character CHAR(1)
)
RETURNS @Output TABLE
(
      Item NVARCHAR(MAX)
)
AS
BEGIN
      DECLARE @StartIndex INT, @EndIndex INT

      SET @StartIndex = 1
      IF SUBSTRING(@Input, LEN(@Input) - 1, LEN(@Input)) <> @Character
      BEGIN
            SET @Input = @Input + @Character
      END

      WHILE CHARINDEX(@Character, @Input) > 0
      BEGIN
            SET @EndIndex = CHARINDEX(@Character, @Input)

            INSERT INTO @Output(Item)
            SELECT '%' + SUBSTRING(@Input, @StartIndex, @EndIndex - 1) + '%'

            SET @Input = SUBSTRING(@Input, @EndIndex + 1, LEN(@Input))
      END

      RETURN
END

GO

DECLARE @YourTable TABLE(   ID              INT,
                            ConcatenatedKey NVARCHAR(MAX))

DECLARE @LoopingTable TABLE(    [Row]           INT,
                                ID              INT,
                                ConcatenatedKey NVARCHAR(MAX))

DECLARE @Result TABLE(  ID              INT,
                        ConcatenatedKey NVARCHAR(MAX),
                        [Group]         NVARCHAR(2))

INSERT INTO @YourTable
VALUES
(1,      'AAA_BBB'),
(1,      'AAA_BBB_CCC'),
(1,      'BBB_GGG_III'),
(1,      'DDD_HHH'),
(1,      'HHH_MMM'),
(1,      'FFF_GGG_III'),
(2,      'NNN_OOO'),
(2,      'NNN_PPP_RRR'),
(2,      'QQQ_SSS'),
(2,      'TTT_UUU')

INSERT INTO @LoopingTable
SELECT  ROW_NUMBER() OVER(ORDER BY ID, ConcatenatedKey),
        ID,
        ConcatenatedKey
FROM @YourTable
--ORDER BY ID, ConcatenatedKey

DECLARE @RowIterator                    INT,
        @idFromPreviousIteration        INT,
        @idIterator                     INT,
        @ConcatenatedKeyIterator        NVARCHAR(MAX),
        @GroupValueForCurrentIteration  NVARCHAR(2),
        @GroupIncrementASCIICode        INT

SELECT @idFromPreviousIteration  = -1

WHILE(EXISTS(SELECT TOP 1 1 FROM @LoopingTable))
BEGIN

    SELECT TOP 1    @RowIterator                    = [Row],
                    @idIterator                     = ID,
                    @ConcatenatedKeyIterator        = ConcatenatedKey,
                    @GroupValueForCurrentIteration  = NULL
    FROM @LoopingTable

    IF(@idIterator <> @idFromPreviousIteration)
    BEGIN
        SELECT  @GroupIncrementASCIICode        = 65,--A
                @GroupValueForCurrentIteration  = CONVERT(NVARCHAR, @idIterator) + CHAR(@GroupIncrementASCIICode)
    END
    ELSE
    BEGIN

        SELECT TOP 1 @GroupValueForCurrentIteration = [Group]
        FROM @Result
        INNER JOIN dbo.Split(@ConcatenatedKeyIterator, '_') AS KeySplitted ON ConcatenatedKey LIKE Item

        IF(@GroupValueForCurrentIteration IS NULL)
        BEGIN
            SELECT  @GroupIncrementASCIICode        = @GroupIncrementASCIICode + 1,--Increment letter
                    @GroupValueForCurrentIteration  = CONVERT(NVARCHAR, @idIterator) + CHAR(@GroupIncrementASCIICode)
        END
    END

    INSERT INTO @Result
    VALUES(@idIterator, @ConcatenatedKeyIterator, @GroupValueForCurrentIteration)

    SELECT @idFromPreviousIteration = @idIterator

    DELETE @LoopingTable
    WHERE [Row] = @RowIterator

END

SELECT  [Row] = ROW_NUMBER() OVER(ORDER BY [Group]),
        ID,
        ConcatenatedKey,
        [Group]
FROM @Result


text:
Q: Flutter range error not in inclusive range I have created a button, which is changing bool value, but when i click button so fast in row then it throw this error:
RangeError (index): Invalid value: Not in inclusive range 0..3: 4

Please help me

A: It sounds like you are chaning some list on that page. Maybe based on that bool value that is changed when you are pressing the button.
Obviously not possible to know since you haven't pasted any code.  Have a look at https://stackoverflow.com/help/how-to-ask and try to give more information with you question and maybe it is easier to help you.

A: Ok. I found solution. I had 2 list of texts and i wanted it to generate one of them when bool value was true or false. So i use this code
or ? truths[Random().nextInt(truths.length - 1)] : dares[Random().nextInt(truths.length - 1)]

insted of this code
or ? truths[Random().nextInt(truths.length)] : dares[Random().nextInt(truths.length)]

And now it works well :)