text:
Q: how to get geolocation data(latitude, longitude) correctly from firebase (flutter/dart)?
this is my firebase
on this request I get this kind of data
final firestoreInstance = Firestore.instance;
firestoreInstance.collection("locations").getDocuments().then((querySnapshot) {
      querySnapshot.documents.forEach((result) {
        print(result.data);
      });
    });

Here comes a response from the server
{12/5/2020: {geohash: u8vybwryv, geopoint: Instance of 'GeoPoint'}} .... and all list of documents

after i use this
 firestoreInstance.collection("test").getDocuments().then((querySnapshot) {
      querySnapshot.documents.forEach((result) {
        print(result.data['geopoint'].latitude.toString());
      });
   });

and receive in debug null.
how to get latitude and longitude and not null?

A: maybe helpful for someone
List<LatLng> polyLinesLatLongs = List<LatLng>(); // our list of geopoints

_someFunction() {
    firestoreInstance
        .collection("userId") // your collection
        .document('history') //your document
        .collection("locations") //your collection
        .getDocuments()
        .then((querySnapshot) {
      var fireBase = querySnapshot.documents;
      for (var i = 1; i < fireBase.length; i++) {

        GeoPoint point = fireBase[i].data['position']['geopoint']; //that way to take instance of geopoint

        polyLinesLatLongs.add(LatLng(double.parse('${point.latitude}'),
              double.parse('${point.longitude}'))); // now we can add our point to list
    });
  }


text:
Q: google custom search api complex search terms The program I am writing needs to execute complex search queries.
An example would be
(blue AND jeans AND NOT (cheap || expensive)) .
How can I do this. I know there are parameters
such as hq and exclude and orTerms (or just the boolean operator),
but I don't know how to combine them, or if they can be combined for that matter.
Thanks a bunch

A: The parameters are described here.

q (string)
  The search expression.
exactTerms (string)
  Identifies a phrase that all documents in the search results must contain.
excludeTerms (string)
  Identifies a word or phrase that should not appear in any documents in the search results.
orTerms (string)
  Provides additional search terms to check for in a document, where each document in the search results must contain at
  least one of the additional search terms.

And the different Boolean Operators are described here.

AND includeTerms=(phrase%20one).(phrase%20two)
NOT q=key1%20(-key2)
OR excludeTerms=key1|key2 orTerms=key1|key2
() lr=-(lang_fr|lang_it)

By that you could call q=john%20doe&orTerms=wikipedia|imdb and this will result documents containing john AND doe AND ( wikipedia OR imbd ).
Something what I did not expect was q=&exactTerms=(john).(doe).(wikipedia) (46 results) returns the same as q="john%20doe%20wikipedia" (46 results). I thought it would result the same as q="john"%20"doe"%20"wikipedia" (153000 results). So it is sometimes more a CONCAT than an AND operator or exactTerms is simply not able to support multiple keywords.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Main method error can't figure out how to fix Getting a main method error which is only affecting my retrieve salary method I'm not sure what to do to fix the issue I have added particular items but I can't get the error to go away. Is the only thing on my program that brings up an error and I am unable to continue. Image included of the only issues I'm encountering now
"Error: Main method not found in class, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application"
Image included
public class finalproject {

public static class employeeCase {
       EMPLOYEE[] employees;
       int AMOUNT;

       employeeCase(){
           employees = new EMPLOYEE[100];
           AMOUNT = 0;

       }

private void loadEmployee() {

    String ID = null;

    int SALARY = 0;

    Scanner sc = new Scanner(System.in);

    System.out.println(" ");
    System.out.println("How many employees do you want to load?: ");
    int num = sc.nextInt();

    for(int i = 0; i < num; i++){

        // Display parallel arrays
        System.out.println(" ");
        System.out.println("Name: " + employees[i] + " " + "ID: " + ID + " " + "Salary: " + SALARY);

        sc.close();
    }

}
private int addEmployee() {

    Scanner sc = new Scanner(System.in);

    System.out.println(" ");
    System.out.println("How many employees do you want to enter?: ");
    AMOUNT = 0;
    AMOUNT = sc.nextInt();

    String Again1 = "no";

    String Fname;

    String ID;

    int SALARY = 0;

    do {

        for(int i = 0; i < AMOUNT; i++) {

    System.out.printf("Enter employee's first name: ");
    Fname = sc.nextLine();
    System.out.printf("Enter employee ID (5 digits): ");
    ID = sc.next();
    System.out.printf("Enter employee salary: ");
    SALARY = sc.nextInt();

    System.out.println(" ");

    this.employees[this.AMOUNT] = new EMPLOYEE(Fname, ID, SALARY);
    this.AMOUNT++;

    sc.close();

        }   } while (Again1.equalsIgnoreCase("yes"));
    return SALARY;

}

private void displayEmployee() {

    for(int i = 0; i < AMOUNT; i++){

        // Display parallel arrays
        System.out.println(" ");
        System.out.println(this.employees[i]);

    }

}

private void retrieveSpecific() {

    Scanner sc = new Scanner(System.in);

    System.out.println(" ");
    System.out.println("Enter employee ID: ");
    String id = sc.next();

    //Search for ID in all the stored employees
       for(int i=0; i<this.AMOUNT; i++) {

           if(id.contentEquals(this.employees[i].ID)) {
               System.out.println(this.employees[i]);

               sc.close();
    }}}

private void retrieveSalary() {

        Scanner scan = new Scanner(System.in);
        System.out.println(" ");
        System.out.println("Enter lowest employee salary: ");
        int LSALARY = scan.nextInt();

        System.out.println(" ");
        System.out.println("Enter highest employee salary: ");
        int HSALARY = scan.nextInt();

        for(int i = 0; i < AMOUNT; i++) {

            if(employees[i].SALARY >= LSALARY & employees[i].SALARY <= HSALARY) {
                   System.out.println(employees[i]);

                   scan.close();}}

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

    employeeCase EmployeeData = new employeeCase();

    Scanner sc = new Scanner(System.in);

    int Select = 0;

    do {

        displayMenu();

        System.out.print("Input your selection from the menu: ");
        Select = sc.nextInt();

    switch (Select) {

    case 1 :    EmployeeData.loadEmployee();
                break;

    case 2 :    EmployeeData.addEmployee();
                break;

    case 3 :    EmployeeData.displayEmployee();
                break;

    case 4 :    EmployeeData.retrieveSpecific();
                break;

    case 5 :    EmployeeData.retrieveSalary();
                break;

    case 6 :    System.out.println("Thank you, goodbye!");
                break;

    default :   System.err.println("Invalid Input");
                break;
    }

    } while (Select != 6);

    sc.close();
}

        public static void displayMenu() {

            System.out.println("                    MENU");
            System.out.println("============================================");
            System.out.println("1: Load employees' data");
            System.out.println("2: Add new employee");
            System.out.println("3: Display all employees");
            System.out.println("4: Retrieve specfic employee data");
            System.out.println("5: Retrieve employee based on salary range");
            System.out.println("6: Exit program");
        }
}}

A: Your main method needs to be static. Change public void main to public static void main.

A: Access modifier for main method should be static here you define a non static main method
Replace your main method with
public static void main(String[] args){}


text:
Q: Defining a variable - MainActivity I have this code
public class MainActivity extends AppCompatActivity {
    private ListView contactNames;
        ....

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        contactNames = findViewById(R.id.contact_names);
                ...
        }
}

The following is not clear to me:

*

*Why do I get an error when i try to assign contactNames under MainActivity?

*Why is it so important to find views after setContentView because if I find views before (under onCreate) I also get an error?

A: To define a variable under MainActivity, you need the following format:
contactNames = (ListView) findViewById(R.id.contact_names);

This will cast it to the ListView type.  Also, verify that contact_names is in the mainactivity layout.

A: The findViewById() is what links the widgets or controls in the xml to a Java-based object.  Therefore setContentView() has to be executed BEFORE because that is what inflates the view in order to find the resources in the xml.

A: Hello there when you call findViewById it get view from from current context and after when you call set setContentView it set your XML layout as activity content, so then you can call findViewById to get view it is the simple definition of your question's second part.


text:
Q: Optimization of C++ code - std::vector operations
I have this funcition (RotateSlownessTop) and it's called about 800 times computing the corresponding values. But the calculation is slow and is there a way I can make the computations faster.
The number of element in X/Y is 7202. (Fairly large set)
I did the performance analysis and the screenshot has been attached.
void RotateSlownessTop(vector <double> &XR1, vector <double> &YR1, float theta = 0.0)
{
Matrix2d a;

a(0,0) = cos(theta);
a(0,1) = -sin(theta);
a(1, 0) = sin(theta);
a(1, 1) = cos(theta);

vector <double> XR2(7202), YR2(7202);

for (size_t i = 0; i < X.size(); ++i)
{
    XR2[i] = (a(0, 0)*X[i] + a(0, 1)*Y[i]);
    YR2[i] = (a(1, 0)*X[i] + a(1, 1)*Y[i]);
}
size_t i = 0;
size_t j = 0;

while (i < YR2.size())
{
    if (i > 0)
        if ((XR2[i]>0) && (XR2[i-1]<0))
            j = i;

    if (YR2[i] > (-1e-10) && YR2[i]<0.0)
        YR2[i] = 0.0;

    if (YR2[i] < (1e-10) && YR2[i]>0.0)
        YR2[i] = -YR2[i];

    if ( YR2[i]<0.0)
    {
        YR2.erase(YR2.begin() + i);
        XR2.erase(XR2.begin() + i);
        --i;
    }
    ++i;
}
size_t k = 0;
while (j < YR2.size())
{
    YR1[k] = (YR2[j]);
    XR1[k] = (XR2[j]);
    YR2.erase(YR2.begin() + j);
    XR2.erase(XR2.begin() + j);
    ++k;
}
size_t l = 0;
for (; k < XR1.size(); ++k)
{
    XR1[k] = XR2[l];
    YR1[k] = YR2[l];
    l++;
}
}

Edit1: I have updated the code by replacing all push_back() with operator[], since I read somewhere that this is much faster.
However the whole program is still slow. Any suggestions are appreciated.

A: If the size is large, you can improve the push_back by pre-allocating the space needed. Add this before the loop:
XR2.reserve(X.size());
YR2.reserve(X.size());


text:
Q: Magento 2: convert curl response into array I am not able to convert magento 2 JSON response into array. Can you please help in short out this problem?
Here is my code:
$url = 'http://example.com/api/coop';
$post = [
        'firstname' => $userDetail->firstname,
        'lastname'  => $userDetail->lastname,
        'email'     => $userDetail->email,
        'password'  => $userDetail->password
    ];
$this->curlClient->post($url, $post);
$responseCurl = $this->curlClient->getBody();
print_r($responseCurl);
die();

Output:
{"coop_id":"COOP33"}

I have to use coop_id value somewhere in my logic. Thanks in advance.

A: You can check in PHP sandbox, example below.
Show example
<?php

$jsonString = '{"coop_id":"COOP33"}';

$stdClass = json_decode($jsonString);
echo $stdClass->coop_id; //COOP33

$array = json_decode($jsonString, true);
echo $array['coop_id']; //COOP33

A: You can use json_decode as follows.
<?php
    $json = $responseCurl;
    $array = json_decode($json, true);
    $coop_id = $array['coop_id'];
?>

A:  $json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';

var_dump(json_decode($json));           // Object
var_dump(json_decode($json, true));     // Associative array


text:
Q: How can I split strings in a column only when a certain word occurs? I would like to only retain the part after the word 'in' if it occurs in a row of a column. The problem is that if this word does not occur in the row, its original value is replaced by NaN. I would like to keep the original values if the word 'in' does not appear.
I have tried splitting the string using str.split on the column 'city':
    Rotterdam
    Den Haag
    Postcode 2288 in Rijswijk
    Postcode 2511 in Den Haag Centrum
    Delft

df.city.astype(str).str.split('in').str[1]

Actual results:
    NaN
    NaN
    Rijswijk
    Den Haag Centrum
    NaN

Expected results:
    Rotterdam
    Den Haag
    Rijswijk
    Den Haag Centrum
    Delft

A: One possible solution is replace missing values by original column:
df['new'] = df.city.astype(str).str.split(' in ').str[1].fillna(df.city)
print (df)
                                city                new
0                          Rotterdam          Rotterdam
1                           Den Haag           Den Haag
2          Postcode 2288 in Rijswijk           Rijswijk
3  Postcode 2511 in Den Haag Centrum   Den Haag Centrum
4                              Delft              Delft

Or select last values in lists by -1 - solutions working same if only one in in data:
df.city.astype(str).str.split(' in ').str[-1]

Another solution by @Jon Clements is use Series.str.rpartition:
df.city.str.rpartition(' in ')[2]


text:
Q: Typescript - substitute type property names from mapping I have a function that takes an object as a model and an object that represents a mapping. It returns an object with two properties: one representing the base model and one that represents the model with every property wrapped in another type. The mapping determines the keys of the returned object, and the mapping will always be
type Mapping<Model> = {
    foo: string,
    bar: string
}

function fooBar<M extends object, B extends Mapping>(model: M, mapping: B) {
    return {
        [mapping.foo]: model,
        [mapping.bar]: recursiveWrap(model) //this function would go through the model and wrap each property
    }
}

so calling this function like so:
fooBar({ message: 'hello' }, { foo: 'thing', bar: 'thing$' })

should return a type something like this:
type MyType = {
    thing: { message: string },
    thing$: WrappedType<{ message: string  }>
}

But I cannot figure out how to substitute property names from an object and still be type checked correctly.
I followed along with this question but then the type of the returned properties were { message: string } | WrappedType<{ message: string }>. Is there a way to pull this off without the result being a union type?

A: This seems unlikely now (April 2020), but may be possible in the future.
See:

*

*Typescript issue #12754: Augment Key during Type Mapping - open issue, lots of use cases

I would like to open discussion to the prospect of augmenting property keys during mapping.
For example: via arthimetic:
type Changed<T> =
{
  [ P in keyof T ] + "Changed" ?: Function;
}

*Typescript issue #36623: Design Meeting Notes, 1/31/2020 - "Augmenting Keys" discusses #12754

Can't necessarily say "yes", but probably not near-term. We should be focusing on speed.


text:
Q: NoSQL - Migrating from a NoSQL DB to another This is a general question : Do you know if there exists application(s) for moving from a NoSQL DB to another? There are a lot of methods for migrating from SQL to NoSQL but I did not found for NoSQL to another.
Thanks a lot,

A: There are 150 NoSQL tools coming in different flavors (document, key/value, graph, column-store) and the leading vendors constantly add/change features.
A general tool that assists you to migrate from A to B wouldn't make sense. It would never be up-to-date and couldn't support you in data modeling for the target system.
But you will find assistance from NoSQL vendors. They will guide you how to extract data from lets say a MongoDB and get it into Couchbase. In reality you will not migrate 1:1 from a NoSQL solution to another as you perhaps switch for a particular reason - and that might need changes in the data modeling / indexing as well.


text:
Q: Making a file from a form cannot post error I am currently coding a node js with AWS code thank takes a string from a HTML textbox and transfers it to another python file and return the compilation of it.
The node.js file is as follows
const app = express();
var path = require('path');
var fs = require('fs');

app.get('/', (req, res) => {
    res.sendFile(path.join(__dirname + '/index.html'));
});

app.get('/myform', function(req, res) {
    var myText = req.query.mytext;
    res.send('Your Text:' +myText);

    fs.writeFile('app.py',myText,function(err) {
       if(err) throw err;
    });
});

 app.listen(3000, () => console.log('listening on port 3000!'));

And index.html is
<!DOCTYPE html>

Docker

        <form action="/myform" method="post">
            <input type="text" name="mytext" required />
            <input type ="submit" value="Submit">
        </form>

Upon submitting my for I get the error "Cannot POST /myform" and I cannot figure out why.

A: The solution is to simply use app.post instead of app.get


text:
Q: I need List Plot points to have different color based on amount of neighbours? So i have a list of points, and i need them to be colored differently based on how many neighbours they have.
I tried:
ListPlot[Nearest[list, list, {Infinity, 2}],
ImageSize -> Large, AspectRatio -> 1]

but this doesnt work.
 Anyone have any ideas how to do this?
Thanks in Advance
Update: The List im using is About 6000 numbers long.
Here is a part of it:
{{14.24, 12.5}, {14.15, 12.67}, {14.22, 12.36}, {14.17, 12.71},
{13.61, 12.42}, {14.35, 12.49}, {14.12, 12.68}, {14.26, 12.59},
{14.07, 12.56}, {14.19, 12.57}, {14.06, 12.9}, {14.17, 12.59},
{14.19, 12.67}, {14.23, 12.5}, {14.07, 12.49}, {14.45, 12.45}, {13.7,
12.8}, {14.12, 12.59}, {14.07, 12.7}, {14.23, 13.07}, {13.83, 12.13},
{14.35, 12.79}, {13.92, 12.41}, {14.08, 12.65}, {13.68, 12.16},
{13.84, 13.18}, {13.58, 11.61}, {12.58, 12.3}, {12.84, 13.25},
{13.57, 12.66}, {13.74, 12.18}, {13.24, 12.33}, {13.05, 12.47},
{13.26, 12.67}, {13.7, 12.35}, {13.68, 10.79}, {13.35, 12.19},
{13.77, 12.46}, {13.67, 12.15}, {12.75, 12.21}, {13.06, 12.81}}

A: Something like this will work - choose your own styling function...
nearCount[pt_, list_, dist_] := Length[Nearest[list, pt, {Infinity, dist}]];
styleByCount[pt_] := Style[pt, GrayLevel[nearCount[pt, list, 0.2]/15]];
ListPlot[styleByCount /@ list]

A: nc = Length /@ Nearest[list, list, {Infinity, 2}];
minmax = MinMax[nc];
legend = SwatchLegend[ColorData[{"Rainbow", minmax}] /@ Union[nc],
   Union@nc, LegendLabel -> "Neighbor Counts",
   LegendLayout -> {"Row", 1}, LegendMarkers -> "Bubble"];

ListPlot
You can wrap each data point with List and use the option PlotStyle to style each point differently:
ListPlot[List /@ list,
 PlotStyle -> (Directive[PointSize[Large], ColorData[{"Rainbow", minmax}]@#] & /@ nc),
 PlotLegends -> Placed[legend, Top],
 ImageSize -> Medium, AspectRatio -> 1, PlotRange -> All]

Alternatively, you can style each data point differently by wrapping it with Style as in Jon's answer:
ListPlot[Style[#, ColorData[{"Rainbow", minmax}][#2]] & @@@ Transpose[{list, nc}],
 PlotLegends -> Placed[legend, Top], BaseStyle -> PointSize[Large],
 ImageSize -> Medium, AspectRatio -> 1, PlotRange -> All]

same picture

BubbleChart
You can also use BubbleChart by appending to each data point its neighbor count:
BubbleChart[Join[list, List /@ nc,  2], ColorFunction -> "Rainbow",
 BubbleSizes -> {.02, .02}, ChartLegends -> Placed[legend, Top]]

RelationGraph
rg = RelationGraph[EuclideanDistance[##] <= 2 &, list];
cols = ColorData[{"Rainbow", MinMax@#}] /@ # &[1 + DegreeCentrality[rg]];
Legended[Graph[rg,
  VertexSize -> {Divide @@ (Subtract @@@ CoordinateBounds[list]), 1}/30,
  VertexCoordinates -> list,
  EdgeStyle -> Opacity[0],
  VertexStyle -> Thread[VertexList[rg] -> cols], Frame -> True,
  FrameTicks -> All, AspectRatio -> 1], Placed[legend, Top]]

A: With your data = dat define a measure function between points. This is arbitrary.
measure[p1_, p2_] := 1/(.1 + Norm[p1 - p2]);

Assume a point's total measure is the sum of the measures between points. Get the total measures of points.
outerRes = Total@Outer[measure[#1, #2] &, dat, dat, 1]

Extend our data to 3D
augdat = Transpose@Join[Transpose[dat], {outerRes}];

Look at 3D plot (fun)...
ListPointPlot3D[augdat,
          ColorFunction -> Function[{x, y, z}, Hue[z]]
          ]

Looking down from directly overhead by setting Viewpoint to get 2D view.
ListPointPlot3D[augdat,
  ColorFunction -> Function[{x, y, z}, Hue[z]],
  ViewPoint -> {0, 0, Infinity}]


text:
Q: "The panda is an endangered species" "Pandas are an endangered species"... Which would be acceptable? "A panda is an endangered species".
"Pandas are an endangered species".
"The panda is an endangered species"
"The pandas are an endangered species".
If you want to mention pandas in general, which one is acceptable and natural?

A: "A panda is an endangered species" - This is completely wrong, how can one panda be an entire species?
"Pandas are an endangered species" - This is best recommended as "pandas" are plural to represent the entire species
"The panda is an endangered species" - This is also possible, as "panda" is singular but is generic when using "the".
"The pandas are an endangered species" - This is the same meaning as the 2nd sentence.

A: I would do whatever you can to make the left-side panda line up most with the idea of species on the right. "The panda" is closest in this regard, but "the giant panda" is even better. Biologically, you could say "Ailuropoda melanoleuca is an endangered species," but this would only be meaningful to a very informed audience.
I would recommend "The giant panda is an endangered species."
but I think "The panda is an endangered species." is good too.
I would also double-check the validity of this statement, as I think they may just be vulnerable and not technically endangered.


text:
Q: Is the Gummel-Poon model useful for explaining AC transistor amplification? Let me be clear: By amplification I am talking about the process of boosting the strength of an AC signal. Thus, where the output power to input power ratio is greater than 1.

Now suppose we have a simple Common Emitter amplifier with a voltage divider base(and a positive collector supply voltage).A capacitor is an AC short and a DC open. Now when we add an AC signal to the base, the capacitors experience a change in voltage and began to conduct, causing a surge of current to flow from points E' to C' on the circuit diagram. There is also current flowing through C(BC'). Thus small changes on the base voltage(due to input) control larger changes in the emitter-collector current. And that's how transistors can be used to boost AC signal power.

A: You say AC and then immediately involve the capacitors and that's not strictly correct and not also needed.
Power amplification in a transistor means that a change at the input can result in a change at the output and the changes are such that the change (which is a signal) has greater power at the output than at the input. These changes are modeled in the GP model and "work" even when all the capacitors have a value of 0 (zero).
What I describe above is small signal behavior and that has by itself nothing to do with the capacitors. The capacitors are present in the model to model the capacitors that are actually present in the transistor and their effect is that they limit the bandwidth of the transistor circuit.
At high frequencies the power gain will be smaller or even non-existent (power loss) due to these capacitors.
If what you say is true and the capacitors are involved in power amplification then gain at DC would be impossible. A non-AC coupled common emitter circuit has a DC gain of about gm*Rc.
But back to your question, can the model be used?
Yes of course it can, as long as it models the change in Ic due to a change in Vbe (or Ib) it can. And that behavior is included in the model. If is was not included then the Gummel-Poon model would be "silly" as it would not model the main function of a BJT: power gain.


text:
Q: Cygwin's pdflatex several times slower starting some time between 2015 and summer 2019 I've used Cygwin's pdflatex for the better part of a decade now.
Being a non-administrator, I was locked down to a 2015 installation
for several years.  At around 2019, I was given the opportunity to
update Cygwin, and I think it was around that time that I saw a marked
slow down in pdflatex's processing of LaTeX documents, even small
ones (my document sizes haven't changed much through the years).
Since I work with multiple laptops, I estimate that this started
occuring for me circa summer 2019, plus/minus perhaps 4 months.  It is
possible that the actual slowdown in Cygwin's pdflatex started well
before then, with me being stuck in an 2015 installation and
blissfully unaware.
I've done the online web search.  I see complaints dating well before
2019 of Cygwin and various LaTeX processing software being slow, but
no mention of a marked slowdown occuring between 2015 and 2019.
Since I am very much at the user level rather than admin level, I rely
alot on the configuration of Cygwin apps as-installed.  But I
sometimes poke deeper, especially when repeatedly experiencing the
agonizing slowness of compilation.  What might cause this slowdown,
and what measures can I take to mitigate this?
I'm seriously considering switching to MiKTeX, even though I would
very much dislike leaving the non-GUI environment of Bash and Vim.
TROUBLESHOOTING

*

*A minimal example file accompanied by the organizational texmf
subtree compiled slowly too, i.e, with no references or acronyms.
The console output scrolled very slowly compared to the 2015
installation.

*In the console output, I sometimes see a single line of what seems
like page numbers adorned with square brackets print out slowly. My
naive impression from this is that this slowness is due to
processing other than file searching.

*I compared timed execution with MiKTeX and found it even slower
than Cygwin's pdflatex (as predicted by Steven B. Segletes & Ulrike Fischer).

*

*Erased auxiliary files and ran Bash script mkpdf.bash
containing the usual pdflatex, bibtex, pdflatex x2

*Timed the execution from Cygwin's Bash with time ./mkpdf.bash:
1m56s

*Two tries of incremental runs of pdflatex using Cygwin's
Bash: 38s, 37s
export TEXMFHOME=texmf
time pdflatex MainDocument.tex

*MiKTeX with no "aux" files (pdfLaTeX+MakeIndex+BibTex):
2m18s

*Choose incremental pdfLaTeX beside MiKTeX "play" button:
43s

A: Someone in my organization reported a slowdown of the acro package at around the time I first saw it.  I couldn't use the suggested [version=2] option because it causes both exclude and exclude-class options to go unrecognized.  My solution was to disable acro package except for document finalization.
Here is the code to conditionally enable/disable the acro package.  A single run of pdflatex now takes 13.5 seconds, which is a 3x speedup.  Thanks for everyone's help.
% Acronyms
\newif\ifacro
\acrofalse % Replace with \acrotrue to enable acro package
\ifacro
   \usepackage[display-foreign=false]{acro}
      % https://tex.stackexchange.com/questions/499134/calling-acro-first-use-when-plural-is-producing-an-s-in-the-short-definition-t
   \input{acronyms}
\else
   \usepackage{suffix}
   \newcommand{\ac}[1]{\uppercase{#1}}
   \newcommand{\Ac}[1]{\uppercase{#1}}
   \newcommand{\acf}[1]{\uppercase{#1}}
   \newcommand{\Acf}[1]{\uppercase{#1}}
   \newcommand{\acs}[1]{\uppercase{#1}}
   \newcommand{\Acs}[1]{\uppercase{#1}}
   \newcommand{\acl}[1]{\uppercase{#1}}
   \newcommand{\Acl}[1]{\uppercase{#1}}
   \newcommand{\acp}[1]{\uppercase{#1}s}
   \newcommand{\Acp}[1]{\uppercase{#1}s}
   \newcommand{\acsp}[1]{\uppercase{#1}s}
   \newcommand{\Acsp}[1]{\uppercase{#1}s}
   \newcommand{\acfp}[1]{\uppercase{#1}s}
   \newcommand{\Acfp}[1]{\uppercase{#1}s}
   \newcommand{\aclp}[1]{\uppercase{#1}s}
   \newcommand{\Aclp}[1]{\uppercase{#1}s}
   \newcommand{\acresetall}{}
   \newcommand{\acuse}{}
   \WithSuffix\newcommand\ac*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\Ac*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\acf*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\Acf*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\acs*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\Acs*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\acl*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\Acl*[1]{\uppercase{#1}}
   \WithSuffix\newcommand\acp*[1]{\uppercase{#1}s}
   \WithSuffix\newcommand\Acp*[1]{\uppercase{#1}s}
   \WithSuffix\newcommand\acsp*[1]{\uppercase{#1}s}
   \WithSuffix\newcommand\Acsp*[1]{\uppercase{#1}s}
   \WithSuffix\newcommand\acfp*[1]{\uppercase{#1}s}
   \WithSuffix\newcommand\Acfp*[1]{\uppercase{#1}s}
   \WithSuffix\newcommand\aclp*[1]{\uppercase{#1}s}
   \WithSuffix\newcommand\Aclp*[1]{\uppercase{#1}s}
\fi

<...snip...>

\ifacro
   \cleardoublepage
   \printacronyms[%
      name = {List of abbreviations/acronyms/initialisms/symbols},
      sort = false
   ]
\fi


text:
Q: How to remove set of special characters (see attachment) This characters is special I can not put in code because the forum not support it. Here is how it looks in code format: [32;1m
The cube (first character) is arrow to left in file (see links above).
Here is the picture of character how it look.See the file: http://www.dodaj.rs/f/2u/ar/3B1Q7J4Q/sample.jpg
And here is attachement of file it consist what I want to remove: http://hotfile.com/dl/124448134/58e08a0/File.log.html
Here is the complete file:
[32;1m/var/log/daemon.log file is rotated1...[0m
[32;1m/var/log/daemon.log file is rotated2...[0m
[37;1m/var/log/daemon.log file is rotated3...[0m
[35;1m/var/log/daemon.log file is rotated3...[0m
[33;1mhello[0m
[33;1mthis is sample[0m
[33;1mwhats up?[0m

What I want is to delete everything of unnecessary characters and output to be:
/var/log/daemon.log file is rotated1...
/var/log/daemon.log file is rotated2...
/var/log/daemon.log file is rotated3...
/var/log/daemon.log file is rotated3...
hello
this is sample
whats up?

I tried to delete special characters with sed like:
cat File.log | sed 's/[!@#\$%^&*()]//g' | sed -e 's/37;1m//g' > output.log

but it do nothing.
Can someone please write me that code that make what I need?
Thx.
EDIT: After posting the post arrow can not see on forum...

A: sed -e 's/[[:cntrl:]]//g' -e 's/\[32;1m//g' -e 's/\[33;1m//g' -e 's/\[35;1m//g' -e 's/\[37;1m//g' -e 's/\[0m//g'

A: echo '[32;1m/var/log/daemon.log file is rotated1...[0m' | awk -F'1m' '{sub("\[0m","",$2);print $2}'

/var/log/daemon.log file is rotated1...


text:
Q: Date-time conversion in R I have created a file something like this:
> filesInside
         Date         Time
1  01:09:2013 10:35:49.997
2  01:09:2013 10:35:50.197

How could I possibly make a function using
as.POSIXct()

and I should be get something like this:
> as.POSIXct("2013-09-01 10:35:50")
[1] "2013-09-01 10:35:50 NZST"

How can I make it as a function?
My code so far:
DateTime <- as.POSIXct(paste(filesInside$Date, filesInside$Time), format="%Y%m%d %H%M%S")

Appreciate a bit of help please. Cheers

A: You may try this. The order of date-time components and separators in format should reflect those in the object to be converted. See also ?strptime.
with(filesInside,
     as.POSIXct(paste(Date, Time),
                format = "%d:%m:%Y %H:%M:%S",
                tz = "NZ"))
# [1] "2013-09-01 10:35:49 NZST" "2013-09-01 10:35:50 NZST"

A: library(lubridate)
dmy_hms(apply(filesInside, 1, paste, collapse=" "), tz="NZ")
# [1] "2013-09-01 10:35:49 NZST" "2013-09-01 10:35:50 NZST"

lubridate here is a cinch, especially with its collection of dmy_hms, ymd etc functions.
To properly paste across rows, simply use apply(<data.frame>, 1, paste, collapse=" ")


text:
Q: Why is $c((n+1)H_n^\ast) = c(H_n^\ast)^{n+1}$ for the total Chern class c. I'm currently studying with the Book "From Calculus to Cohomology" by Madsen & Tornehave(free PDF here).
In the Example 18.13 there is a claim(within a calculation), that
 $$c((n+1)H_n^\ast) = c(H_n^\ast)^{n+1},$$ where $c$ denotes the total Chern class, $H_n$ denotes the canonical line Bundle of $\mathbb{CP}^n$ and $n\in \mathbb{N}$.
I have already understood the rest of the calculations, but somehow, I can't feel sure about this one.. maybe I just need sleep, but I need to know for certain why this is, before tomorrow morning.
My guess was, that it has something to do with the fact, that we have(18.9(ii) in the book)
$$ f^\ast c_k(\xi) = c_k(f^\ast(\xi)) $$
for a complex vector bundle $\xi$.
Please punch me if I am totally wrong..
What calculation rule is causing the property above?...
I know it might be totally trivial, but please don't hesitate to state the fact, even if it's trivial af..


text:
Q: How to use CDI and JSF on Tomcat 8.5 I thought that it would be easy to replace JSF bean by CDI bean.  But it's being a slow start.  Very slow.
I'm using Tomcat 8.5 and JSF 2.2, and I'm trying to use CDI.  I tried different configurations, with different results but nothing works, so, I follow the orientation in http://balusc.omnifaces.org/2013/10/how-to-install-cdi-in-tomcat.html and that's what I got.
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Workflow]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:911)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:890)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1403)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1393)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

My configurations are:
\META-INF\Context.xml
<!-- language: lang-html -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<Context reloadable="true">
<Resources            cachingAllowed="true" cacheMaxSize="20000"        />

<Resource
name="jdbc/FlowDB"
auth="Container"
type="javax.sql.DataSource"
maxActive="100"
maxIdle="30"
maxWait="10000"
username="xxxx"
password="xxxxxxxxxxx"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/flow?autoReconnect=true" />

<Resource
name="mail/Session"
auth="Container"
type="javax.mail.Session"
mail.smtp.host="localhost"
mail.smtp.port="25"
mail.smtp.auth="true"
mail.smtp.user="xxxxx@localhost"
mail.smtp.password="123456" />

<!-- Binding BeanManager to JNDI -->
<Resource
name="BeanManager"
auth="Container"
type="javax.enterprise.inject.spi.BeanManager"
factory="org.jboss.weld.resources.ManagerObjectFactory"/>

<!--                             -->

</Context>

\WEB-INF\beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="annotated"
>
</beans>

Pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.2.10</version>
</dependency>

<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.4.Final</version>
</dependency>

<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>3.3.0.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-validator -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<!--            <version>4.3.2.Final</version> -->
<version>5.2.4.Final</version>
</dependency>
<!-- MySQL -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.30</version>
<scope>provided</scope>
</dependency>

<!-- Spring -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>

<!-- SPRING DATA JPA - https://mvnrepository.com/artifact/org.springframework.data/spring-data-jpa -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.10.2.RELEASE</version>
</dependency>

<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>

<!-- https://mvnrepository.com/artifact/javax.enterprise/cdi-api 'INFO: CDI @ViewScoped bean functionality unavailable' http://weld.cdi-spec.org/
-->

<dependency>
<groupId>org.jboss.weld.servlet</groupId>
<artifactId>weld-servlet</artifactId>
<version>2.3.5.Final</version>
</dependency>

<!-- Primefaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.3</version>
</dependency>

<!-- Primefaces Theme -->
<!-- https://mvnrepository.com/artifact/org.primefaces.extensions/all-themes -->
<dependency>
<groupId>org.primefaces.themes</groupId>
<!-- <artifactId>all-themes</artifactId> -->
<artifactId>bootstrap</artifactId>
<version>1.0.8</version>
</dependency>

<!-- Email -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.3.3</version>
</dependency>

<!-- JUnit » 4.12 -->
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>

<!-- slf4j-log4j -->

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.6.2</version>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.6.2</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.webjars/font-awesome -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>font-awesome</artifactId>
<version>4.6.3</version>
</dependency>

</dependencies>

I suspect that something may be wrong in my pom.xml, or with Tomcat 8.5, or with something else.  But there is not much left...
Thank in advance.

A: SOLUTION
Seems that a library was missing, Java Annotation Indexer or Jandex, which I already tried before, but not at the right way obviously. Not the right set of libraries and/or not the right scope.
after apply this configurations
plus the dependency below
<dependency>
    <groupId>org.jboss</groupId>
    <artifactId>jandex</artifactId>
    <version>1.2.4.Final</version>
</dependency>

Seems to start working fine.
So, the relevant section of my POM.XML was:
<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-web-api</artifactId>
    <version>7.0</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>javax.enterprise</groupId>
    <artifactId>cdi-api</artifactId>
    <version>1.2</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.jboss.weld.servlet</groupId>
    <artifactId>weld-servlet</artifactId>
    <version>2.3.5.Final</version>
    <scope>runtime</scope>
</dependency>

<dependency>
    <groupId>org.jboss</groupId>
    <artifactId>jandex</artifactId>
    <version>1.2.4.Final</version>
</dependency>


text:
Q: Error in the following Function? I want the following JS to hide the modal when POST is successful. Why does it not work? I am new to JS. Thanks a lot.
dpd.posts.post({
    name: name,
}, function(posts, error) {
    if (error) {
        return showError(error)
    } else {
        $('#modal').modal('hide');
    }
    addYourposts(yourposts);
    $('#name').val('');
});

return false;

});

A: You can use $(element).hide()
$('#modal').hide()

If you are using a jQuery extension for displaying the modal. The modal may have its own API/syntax for closing the modal correctly. e.g 1 $('#modal').modal('hide')
If your getting a error then provide it please


text:
Q: How do I make my webpage adjust its according to the screensize? On my Desktop monitor, the website is perfect, however, when I view it on my laptop, the content is out of place
 <meta name="viewport" content="width=device-width,initial-scale=1.0" charset="utf-8">

Have tried this.
width="100vw" height="100vh"

Have tried this too.
Have tried to set container's min and max-width/height.
None of it worked. Does anyone have a solution to this?

A: Use Media querys or incase of framework use the relevent class
standard Media Query Sizes
320px — 480px: Mobile devices.
481px — 768px: iPads, Tablets.
769px — 1024px: Small screens, laptops.
1025px — 1200px: Desktops, large screens.
1201px and more — Extra large screens, TV.

Example of bootstrap framework
col-xs for smaller Mobile phone (devices with resolutions < 576px);
col-sm for larger mobile phones (devices with resolutions ≥ 576px);
col-md for tablets (≥768px);
col-lg for laptops (≥992px);
col-xl for desktops (≥1200px)

A: Problem
You are declaring meta tag incorrectly

*

*charset declares the document's character encoding

*name and content can be used together to provide document metadata

NOTE: character encoding must be located entirely within the first
1024 bytes of the document.

Solution
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

MDN


text:
Q: STM32f GPIO's on 1.8V So I'm trying to figure out what GPIO voltage levels on an STM32F4 would if I have my VDD at 1.8V. I'm assuming you just use the minimum values, however the conditions state 2.7V < Vdd < 3.6V, that means either the conditions were only tested for that voltage range OR they only hold for that range. There isn't any other info in the datasheet on Voh and 1.8V
In previous digital devices, I've seen differences between the different voltages (like 2.4v and 3.6V). So for 2.4V it would be Vdd-0.2 and for 3.3V it would be Vdd-0.4.
You can run this chip at 1.8V, that's stated elsewhere in the datasheet. Under table 6.3.1

VDD: Standard operating voltage 1.7V - 3.6V

What is my minimum Voh and max Vol range for CMOS on an I/O Pin if my Vdd is 1.8?

A:
I'm trying to figure out what GPIO voltage levels on an STM32F4 would if I have my VDD at 1.8V.
What is my minimum Voh and max Vol range for CMOS on an I/O Pin if my Vdd is 1.8?

The table which you kindly included, might suggest that it was for a device which was only supported down to VDD = 2 V (i.e. the lowest voltage mentioned in that table).
However the datasheet for the STM32F437 gives these VOL and VOH figures below, which specifically include VDD = 1.8 V as you asked:


text:
Q: Slicing array based on date condition I have an array of objects with a Date property. The array is sorted in descending Date order, i.e element at index 0 is the newest and the last element is the oldest. For example: Array[0] = 2017-11-05, Array[1] = 2017-11-04
From this array, I want to create an Array that contains Arrays with objects based on what day of the month is the closing date. For example if the closing date is the 6th day of each month:
Array = [2017-11-07,
         2017-11-06,
         2017-11-05,
         2017-11-04]

should produce
NewArray = [[2017-11-07,
             2017-11-06],
            [2017-11-05,
             2017-11-04]]

I have written my algorithm(I wont post it here because its long and full of if and else statements) based on all the different scenarios I could think of. For example, if two adjacent elements in the list are in the same month, I check if the first elements day is >= closing day and the second elements day is < closing date. Then there are cases where one of the elements are one month ahead, or several months ahead. Oh and there is also the cases where there is a year difference between the two, and that screws up the other conditions.
I am completely stuck as I'm testing my algorithm with edge cases. As I keep on going, I come up with more and more edge cases and the amount of if and else statements seems to go towards infinity. Is there a different approach to this, because I can't figure out how to write the algorithm without a ton of if and else conditions.
EDIT:
More problematic case.
Array = [2018-01-06,
         2017-12-07,
         2017-12-05,
         2017-12-04,
         2017-11-16,
         2017-11-05,
         2017-09-27,
         2017-02-08,
         2016-12-07]

Desired output if the closing date is the 6th:
NewArray = [[2018-01-06],
            [2017-12-07],
            [2017-12-05,
             2017-12-04,
             2017-11-16],
            [2017-11-05],
            [2017-09-27],
            [2017-02-08],
            [2016-12-07]]

This case for example, requires the algorithm to begin a new list where the month differnce is >= 2. In the cases where the month difference is 1, i.e one month apart, it has to check if one of the elements day is >= closing date (and) the other elements day is < closing date. In the cases where the elements are in the same month, it needs to check if one of the elements day is >= closing date and the other elements day < closing date. Just those conditions alone will not work well when there are elements in the list with different year.

A: If I understand your problem correctly, the Calendar method

*

*nextDate(after:matching:matchingPolicy:repeatedTimePolicy:direction:)
is what you are looking for. It allows you to compute the 6th day
of a month which occurs before a given date. Then compare each
date against the next current closing date, and either append
it to the current slice, or start a new slice and compute the next
(i.e. previous in time) closing date:
let yourDates: [Date] = ... // Your array of dates (in descending order)

let matchComponents = DateComponents(day: 6)
let cal = Calendar.current

var nextClosingDate = Date.distantFuture // So that the first date will start a new slice
var slicedDates: [[Date]] = []

for date in yourDates {
    if date >= nextClosingDate {
        // Append to current slice:
        slicedDates[slicedDates.count - 1].append(date)
    } else {
        // Start new slice and compute next closing date:
        slicedDates.append([date])
        nextClosingDate = cal.nextDate(after: date,
                                       matching: matchComponents,
                                       matchingPolicy: .nextTime,
                                       direction: .backward)!
    }
}


text:
Q: longitude lattitude performance I have to store frequently (at least every min) the position (longitude, latitude) of animals in a DB, and perform for each update a search in order to determinate if ananother animal is near to it.
My question is about performance. I plan to use MySQL and FLOAT (10,6) for these variables.

*

*Does a better SQL type exist for this kind of problem in MySQL?  It seems Microsoft released their GEOGRAPHY TYPE, maybe something exists in other DB manager?

*Is it a good idea to create an index on these values (because I update them a lot but also search on them a lot)? If yes, what kind of index is the best (CLUSTERED)?

*Do you have any advice for querying the DB?

Thanks.


text:
Q: JavaFX 2 - Can´t import .css File I´m currentl trying to get into JavaFX 2.0 but I can´t get .css Stylesheets to work within my application. I´ve followed the guide at http://docs.oracle.com/javafx/2/get_started/css.htm#BABBGJBI but whenever I try to import a .css file via
        scene.getStylesheets().add(Login.class.getResource("loginform.css").toExternalForm());

I get the following Error:
    Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:399)
    at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
    at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
    at Login.start(Login.java:68)
    at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:315)
    at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:174)
    at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:141)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
    at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:62)
    ... 1 more

The css path is located in my eclipse project path:
C:\Users\UserName\Dropbox\Documents\Eclipse\FirstExamples\loginform.css
I´d appreciate any help, I can´t get it working, not with absolute paths nor with relative ones like shown in the example.

A: Check the compiled output path of your eclipse project and ensure that loginform.css is in the same directory as Login.class

I´ve solved the problem by putting stylesheets into my src folder not
  a very nice solution but going up by ../formm.css doesn´t seem to work
  dunno why

You are requesting the css file via the class.getResource method, which will look for the resource in the same location the class is located.  When you put the stylesheet in your src folder, then whatever build system you are using is copying the stylesheet to the same directory as Login.class during the build.  When you don't place it in that src folder, then the copy is not occuring.
If you don't want to place the css file in the same directory as your Java source, then either set your build system up to copy it across from another directory OR don't use the classloader mechanism when you add a stylesheet, e.g. use an absolute file or http url or a file url based on the user.dir system property (current working directory) instead.
Really though, just placing leaving the stylesheet in the src folder and accessing it in the manner you are doing is fine and it also makes resource location easy when you deploy the app to different environments.

A: If you use anything as a resource, you have to prefix the name of it with "/" and that resource has to be on the classpath.
I have the setup with a directory e.g. resources, which contains the .css. Then I use this:
scene.getStylesheets().add(Login.class.getResource("/loginform.css").toExternalForm());

The directory 'resources' which contains the .css file is added to the classpath (in Eclipse, for example, just make it be a source folder).
It is however pity that the exception is totally useless; I've noticed that the .css was the problem when I added it for the first time.


text:
Q: Show this identity for the surface measure on the boundary of a submanifold Let $M$ be a $k$-dimensional embedded $C^1$-submanifold of $\mathbb R^d$ with boundary$^1$ and $(\Omega,\phi)$ be a $k$-dimensional boundary $C^1$-chart$^2$ of $M$. We know that$^3$ $(\tilde\Omega,\tilde\phi):=(\Omega\cap\partial M,\pi\circ\left.\phi\right|_{\tilde\Omega})$ is a $(k-1)$-dimensional $C^1$-chart of $\partial M$. Let $(U,\psi):=(\phi(\Omega),\phi^{-1})$ and $(\tilde U,\tilde\psi):=(\tilde\phi(\tilde\Omega),\tilde\phi^{-1})$. Then $${\rm D}\tilde\psi(u)={\rm D}\psi(\iota u)\circ\iota\;\;\;\text{for all }u\in\tilde U=\{u\in\mathbb R^{k-1}:(u,0)\in U\}\tag1.$$ By definition, the surface measure on $\mathcal B(\tilde\Omega)$ is given by $$\sigma_{\tilde\Omega}:=\sqrt{g_{\tilde\psi}}\left.\lambda^{\otimes(k-1)}\right|_{\tilde U}\circ\tilde\psi^{-1},$$ where $g_{\tilde\psi}:=\det G_{\tilde\psi}$, $G_{\tilde\psi}(u):={\rm D}\tilde\psi(u)^\ast{\rm D}\tilde\psi(u)$ for $u\in\tilde U$ and $\lambda$ denotes the Lebesgue measure on $\mathcal B(\mathbb R)$.

If $k=d$, I would like to show that $$\int f\:{\rm d}\sigma_{\tilde\Omega}=\int_{B_0}f(\psi(u))|\det{\rm D}\phi(u)|\left\|{\rm D}\phi(u)^\ast e_k\right\|\:\lambda^{\otimes k}({\rm d}u)\tag2$$ for all $\sigma_{\tilde\Omega}$-integrable $f:\tilde\Omega\to\mathbb R$, where $B_0:=\{u\in\mathbb R^k:\left\|u\right\|\le1\text{ and }u_k=0\}$ and $(e_1,\ldots,e_k)$ denotes the standard basis of $\mathbb R^k$. How can we do that?

It's easy to see that $\pi$ is the adjoint $\iota^\ast$ of $\iota$, i.e. $\iota^\ast=\pi$. So, if $A\in\mathbb R^{d\times k}$ and $\tilde A:=A\circ\iota$, then $$(\tilde A^\ast\tilde A)_{ij}=\langle Ae_i,Ae_j\rangle=B_{ij}\;\;\;\text{for all }i,j\in\{1,\ldots,k-1\},\tag3$$ where $B:=A^\ast A$. If we denote by $B^{kk}$ the submatrix of $B$ formed by deleting the $k$th row and $k$th column, we have shown that $\tilde A^\ast\tilde A=B^{kk}$. If $\operatorname{cof}(M)$ denotes the cofactor matrix of a square-matrix $M$ and $k=d$, then $$\operatorname{cof}(B)=\operatorname{cof}(A)^\ast\operatorname{cof}(A)\tag4$$ and hence $$\det\tilde A^\ast\tilde A=\operatorname{cof}(B)_{kk}=\left\|\operatorname{cof}(A)e_k\right\|^2\tag5.$$ If $A$ is regular, then $$\operatorname{cof}(A)=\det A(A^{-1})^\ast\tag6$$ and hence $$\sqrt{\det\tilde A^\ast\tilde A}=|\det A|\left\|(A^{-1})^\ast e_k\right\|\tag7.$$ If we apply this to $A={\rm D}\psi(u)$, $u\in\phi(\Omega)$, we obtain $$\sqrt{g_{\tilde\psi}(u)}=|\det{\rm D}\psi(\iota u)|\left\|({\rm D}\psi(\iota u)^{-1})^\ast e_k\right\|\;\;\;\text{for all }u\in\tilde U\tag8.$$ Now, by definition, $$\int f\:{\rm d}\sigma_{\tilde\Omega}=\int\sqrt{g_{\tilde\psi}}(f\circ\tilde\psi)\:{\rm d}\left.\lambda^{\otimes(k-1)}\right|_{\tilde U}.\tag9$$

How do we need to proceed? If $B$ denotes the closed unit ball in $\mathbb R^k$, $B_+:=B\cap(\mathbb H^k)^\circ$ and $B_0=B\cap\partial\mathbb H^k$, I've read that we can assume without loss of generality that $\Omega^\circ=\phi^{-1}(B_+)$ and $\partial\Omega=\phi^{-1}(B_0)$, but I don't get why this is possible.

EDIT: What I could imagine is that we can replace $\phi$ by $$x\mapsto\begin{cases}\frac{\phi(x)}{\max(1,\left\|\phi(x)\right\|)}&\text{, if }\phi(x)\ne0\\0&\text{, otherwise}\end{cases}\tag{10}.$$ This should (am I missing something?) still be a $C^1$-diffeomorphism and it clearly takes values in $B$. Is this the right approach?

$^1$ i.e. each point of $M$ is locally $C^1$-diffeomorphic to $\mathbb H^k$.
If $E_i$ is a $\mathbb R$-Banach space and $B_i\subseteq E_i$, then $f:B_1\to E_2$ is called $C^1$-differentiable if $f=\left.\tilde f\right|_{B_1}$ for some $E_1$-open neighborhood $\Omega_1$ of $B_1$ and some $\tilde f\in C^1(\Omega_1,E_2)$ and $g:B_1\to B_2$ is called $C^1$-diffeomorphism if $g$ is a homeomorphism from $B_1$ onto $B_2$ and $g$ and $g^{-1}$ are $C^1$-differentiable.
$^2$ A $k$-dimensional $C^1$-chart of $M$ is a $C^1$-diffeomorphism from an open subset of $M$ onto an open subset of $\mathbb H^k$.
$^3$ Let $\iota$ denote the canonical embedding of $\mathbb R^{k-1}$ into $\mathbb R^k$ with $\iota\mathbb R^{k-1}=\mathbb R^{k-1}\times\{0\}$ and $\pi$ denote the canonical projection of $\mathbb R^k$ onto $\mathbb R^{k-1}$ with $\pi(\mathbb R^{k-1}\times\{0\})=\mathbb R^{k-1}$.


text:
Q: Cant see example apps? So I wanted to look at the example applications "tabs" and "api".
But all I see is "Sorry, I could not find this app"
and then two sections with the text:
metadataStarted
URI: spotify:app:tabs
metadataFailed
URI: spotify:app:tabs
Error: appNotFound
So, how could those apps not be found? As I understand they should be there from thestart?

A: They seem to be unavailable at the moment. Take a look at this question and answer where you can get some useful resources.


text:
Q: Append id from button clicked to an existing JQuery Function that Toggles a Form I have a table, each row is ended with a dynamically generated button. That button has an id matching the id of the user from the DB. I want to be able to press any of the buttons and pass that id to a script that toggles a form. I just cannot work out how to append the id to an existing script to toggle the form.
So far the code I have is
<button type='submit' class='btn btn-success' id='formButton$uid' onclick='myFunction()'>Edit User #$uid</button>

&
$(document).ready(function() {
        $("#3").click(function() {
    $("#form1").toggle();
  });
});

As you see in the code above I have hard coded the id of 3 in but as I say I am looking for that id to take the value, the id, from any of the buttons clicked so if there are 50 buttons they can all toggle the form as the button clicked id will have be appended into the JQuery toggle function.

A: After a few hours I have managed to add the id to the JQuery.
     <form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="POST">
        <input type="submit" name="mybutton" id="1" value="1">
        <input type="submit" name="mybutton" id="2" value="2">
        <input type="submit" name="mybutton" id="3" value="3">
        <input type="submit" name="mybutton" id="4" value="4">
    </form>

Then the JQuery
$(document).ready(function() {
  $("#<?php echo $_POST['mybutton'] ?>").click(function() {
   $("#form1").toggle();
 });
});

I don't know if this is the best way of doing the job?

A: you could hook the on click event on the element name like so
<button type='submit' name="mybutton" Id="#$uid" onclick='myFunction()'>Edit User #$uid</button>
<button type='submit' name="mybutton" Id="#$uid" onclick='myFunction()'>Edit User #$uid</button>
<button type='submit' name="mybutton" Id="#$uid" onclick='myFunction()'>Edit User #$uid</button>

$('button[name="mybutton"]').each(function() {
  $(this).click(function() {
    console.log($(this).attr("Id"));
    $("#form1").toggle();
  });
});

[https://jsfiddle.net/bjq5drwh/2/]
I hope this helps


text:
Q: Unity C# Load textrue with www I am making a game that load a level by reading XML. That part works fine but I can't load Textrues. He doesnt give a error or something like that. There is just no textrue, it's a null object.
this is the code that read the xml:
void ReadXML(){

    XmlDocument doc = new XmlDocument();
    doc.Load("world/world.xml");

    //load all textrues
    XmlNodeList elemList = doc.GetElementsByTagName("textrue");
    _matrial = new Texture[elemList.Count];
    for (int i=0; i < elemList.Count; i++){
        LoadTexture(elemList[i].InnerXml);
        _matrial[i] = loaded;
        //_matrial[i] = Resources.Load(elemList[i].InnerXml) as Texture;
        Debug.Log(_matrial[i] + " <> " + elemList[i].InnerXml);
    }

    ///.... here he loads al object, that works fine

}

This is the LoadTexture methode:
IEnumerator LoadTexture(string url) {
    WWW www = new WWW(url);
    yield return www;
    loaded = www.texture;
}

Thank you!

A: It has to wait until the textare is loaded before I could use it. So the function should looks like this:
IEnumerator LoadTexture(string url) {
    WWW www = new WWW(url);
    while (!www.isDone){
        yield return null;
    }
    loaded = www.texture;
}


text:
Q: How can I get image from local folder through XML file I am new to iPhone. What I need is I have to get image through XML parsing and that image is from local folder. What I am doing is store the name of the images in the XML and fetch the name accordingly... it gets name but image is not displayed is there any necessity of converting image string name to bitmap code or anything. My code is as fallows.
    <?xml version="1.0" encoding="UTF-8"?>
    <kids>
    <image>apple.png</image>
    </kids>

Kids*obj = [appdelegate.kids objectAtindex:0];
NSLog("image %@",obj.image);

NSString *strring = obj.image;
imageview = [[UIImageView alloc]initWithImage:[UIImage imageNamed:string]];

Here I am getting image string name in console as Apple.png but it did n't display image in imageview is there anything wrong. If any thing wrong please post any link related to how to get image from local folder through XML file.

A: Here is some tips and check:
1/ Separate this line out :
imageview = [[UIImageView alloc]initWithImage:[UIImage imageNamed:string]];
to 2 lines:
UIImage *image = [UIImage imageNamed:string];
NSLog (@"%@", image);
imageView = [[UIImageView alloc] initWithImage:image];

then see what the log tells you
2/ What do you mean by local folder. This can be understood in 2 ways:

*

*The image is in your project target by you add it in using XCode. If it is this case, manually call UIImage *image = [UIImage imageNamed:@"apple.png"]; to see what returns

*The image is in your Tmp or /Library folder and you return the file path. Then you cannot use [UIImage imageNamed:FILE_PATH] anymore. You have to call using [UIImage imageWithContentsOfFile:FILE_PATH]


text:
Q: changed attributes not waving with Wordpress block I have a fairly simple block in a plugin, built using npx @wordpress/create-block pn-DisplayBlocks. Attributes, in block.json, are:
(code changed as per fixes below)
    "attributes": {
        "pid": {
            "type": "text",
            "default": "444"
        }
    }

save.js is:
import { __ } from '@wordpress/i18n';
import { useBlockProps } from '@wordpress/block-editor';

export default function Save( {attributes} ) {

    console.log( "SAVING", attributes )
    return (
        <p { ...useBlockProps.save() }>
            { __( 'Pn Image – hello from the saved content! ' + attributes.pid, 'pn-image' ) }
        </p>
    );
}

and edit.js is:

import { __ } from '@wordpress/i18n';
import { useBlockProps } from '@wordpress/block-editor';
import './editor.scss';
import { __experimentalNumberControl as NumberControl } from '@wordpress/components';

export default function Edit( {attributes, setAttributes} ) {

    console.log( "pid", attributes.pid )
    return (
        <p { ...useBlockProps() }>
            {
                __( 'Pn Image – hello from the editor! ' + attributes.pid, 'pn-image' )
            }
            <NumberControl
                label="PID"
                isShiftStepEnabled={ true }
                onChange={ value => { setAttributes( {pid: value})} }
                shiftStep={ 10 }
                value={ attributes.pid }
            />
        </p>

    );
}

NumberControl value updates pid and the block with the correct number value when changed, that all works fine, but if I preview the page I see the default value of pid showing, not the one I've just change it to. Same if I update the page to save it; console.log shows the new pid value but when reloaded into the edit page, pid reverts to the default value. Maybe I'm staring too hard but for the life of me I can't see what's wrong. Also, I'm fairly new to this so I may be doing something idiotic.
save & edit called from registerBlockType in index.js:
import { registerBlockType } from '@wordpress/blocks';

import './style.scss';

import Edit from './edit';
import Save from './save';

registerBlockType( 'pn-displayblocks/pn-image', {
    edit: Edit,
    save: Save,
} );

Attributes in block.json:
{
    "apiVersion": 2,
    "name": "pn-displayblocks/pn-image",
    "version": "0.1.0",
    "title": "Pn Image",
    "category": "widgets",
    "icon": "smiley",
    "description": "Example block written with ESNext standard and JSX support – build step required.",
    "supports": {
        "html": false
    },
    "textdomain": "pn-displayblocks",
    "editorScript": "file:./build/index.js",
    "editorStyle": "file:./build/index.css",
    "style": "file:./build/style-index.css",

    "attributes": {
        "pid": {
            "type": "text",
            "default": "444"
        }
    }
}

A: Did you try to store your attributes in comments of block ?
In according with documentation gutenberg :
The available source values are:
– (no value) – when no source is specified then data is stored in the block's comment delimiter.
– attribute – data is stored in an HTML element attribute.
– text – data is stored in HTML text.
– html – data is stored in HTML. This is typically used by RichText.
– query – data is stored as an array of objects.
– meta – data is stored in post meta (deprecated)

Can you try with ?
 "pid": {
    "type": "text",
    "default": "444"
  }


text:
Q: Bootstrap button styles margin-left:-1px when click outside that area I've use bootstrap in my project, like this below

  <input type="text" class="form-control input-lg" autofocus>

    <button class="btn btn-primary btn-lg" type="button">search</button>

and in Bootstrap, I saw :
.input-group-btn:last-child > .btn {
    margin-left: -1px;
}

So I write some CSS to avoid the useless margin-left:-1px; but I still have a problem:
When I click the area outside the
, the button still have a effort like margin-left:-1px;
I'm confused, should I write some JavaScript to avoid this?

A: From the bootstrap source code on Github, these -1px styles are used when having button groups where the buttons align next to each other from doubling the border. If you place 2 buttons with a 1px border next to each other, you create visually a 2px border. The -1px shifts the button over so that the border is not doubled.
Comment from actual github source:
// Prevent double borders when buttons are next to each other

A: The -1px margin is there to prevent double borders when buttons are next to each other. It's meant to be this way.
If you really need to get rid of this, you may also have to adjust some of the negative margins and/or z-index for .input-group-btn > .btn:hover, :focus, :active, :first-child, and :last-child.


text:
Q: Order-embedding, but no lattice embedding between distributive lattices Let $L$ be the power set lattice ${\cal P}(\{0,1,2\})$. It is clear that there is an order-preserving injective map from $M_3$ into $L$, but no injective lattice homomorphism (because $L$ is distributive, and $M_3$ is not).
What is an example of distributive lattices $K, L$ such that there is an order-preserving injective map from $K$ into $L$, but no injective lattice homomorphism from $K$ into $L$?

A: Let $K=\{1,2,3,6,12,18,36\}$ ordered by divisibility.
Let $L=\{1,2,3,6,12,24,36,72\}$ ordered by divisibility.
Then $6=2\vee 3=12\wedge 18$ would have to be sent to both $6$ and $12$, but it can only be sent one place.

A: The example in the following picture is from "Burris and Sankappanavar, A Course in Universal Algebra".

It is actually one with a bijective map.
Clearly, the map is not an isomorphism.
Since the lattices are finite, any injective homomorphism would be an isomorphism, and so we can conclude there is none.
Note:
This actually doesn't answer the title question, but rather the one in the body of the question. The difference is that in the title the OP asks for an order-embedding; in the text, for an order-preserving injective map, which is weaker.


text:
Q: Creating a ProgressDialog for loading I have this snippet from this site.
final ProgressDialog dialog = ProgressDialog.show(this, "Title",
"Message", true);
final Handler handler = new Handler() {
   public void handleMessage(Message msg) {
      dialog.dismiss();
      }
   };
Thread checkUpdate = new Thread() {
   public void run() {
//
// YOUR LONG CALCULATION (OR OTHER) GOES HERE
//
      handler.sendEmptyMessage(0);
      }
   };
checkUpdate.start();

I don't fully understand how it fully works other than the fact it creates a new thread for the ProcessDialog to run until process is complete.
I am assuming which of course correct me if I am wrong that this creates a new thread making the existing thread still running which would cause a null value on the .xml items.
My question are

How would it be possible to run this code without going into a null
  pointer exception?
Is there another alternate solution to doing something similar to
  this?

A: More elegant and preferred way of doing this is to use AsyncTask:
private class DownloadTask extends AsyncTask<Object, Object, Object>
    {
        @Override
        protected Object doInBackground(final Object... urls)
        {
           // long calculation

            return null;
        }

        @Override
        protected void onPostExecute(final Object result)
        {
            closeDialog();
        }

        @Override
        protected void onPreExecute()
        {
            showDialog();
        }
    }

private void closeDialog()
    {
        if (dialog != null)
        {
            dialog.dismiss();
        }
    }

    private void showDialog()
    {
        if (dialog !=null && !dialog.isShowing())
        {
            dialog = new ProgressDialog(this);
            dialog.setMessage("Loading. Please wait...");
            dialog.show();

        }

    }

Call it with this line:
new DownloadTask().execute();


text:
Q: Can't remove CallbackListener from Twilio channel I've trying all day to figure out a way to remove a Twilio CallbackListener from a Twilio channel when requesting unconsumed message count to avoid leaking memory when my activity is destroyed. Calling channel.removeAllListeners seems to only remove ChannelListener from the channel. I've posted some code below of what I'm attempting to do and here is a link to the Twilio chat docs. Any ideas?
CallbackListener<Long> callbackListener = new CallbackListener<Long>() {
        @Override
        public void onSuccess(Long unconsumedCount) {

        }

        @Override
        public void onError(ErrorInfo errorInfo) {
            super.onError(errorInfo);
        }
    };

channel.getUnconsumedMessagesCount(callbackListener);

A: Twilio developer evangelist here.
channel.getUnconsumedMessagesCount only sets up the callbackListener to be called once when the result is returned. It doesn't permanently set it up as a listener, so you are not leaking memory, and if you need to get the unconsumed message count again you need to call it again. Note that the value is cached for 5 seconds, so there is no need to call it any more often than that.
Let me know if that helps at all.


text:
Q: Rails 7 Unpermitted parameters: am gonna add the error and also my controller where i think its the source of the error
I have tried different solutions, but none of them worked, the weird thing, my code was working this morning, and this error only occurs after I added new tables to the database
this is my controller
class UsersController < ApplicationController
  before_action :configure_permitted_parameters, if: :devise_controller?

def create
  @user = User.new(user_params)
  if @user.save
    redirect_to root_path, notice: 'Sign up successful.'
  else
    render :new
  end
end

def index
  @users = User.all
end

protected

def configure_permitted_parameters
  devise_parameter_sanitizer.permit(:sign_up, keys: [:full_name, :password,
  :password_confirmation])
end

end
and this is the error

Unpermitted parameters: :full_name, :password_confirmation. Context: { controller: Devise::SessionsController, action: new, request: #ActionDispatch::Request:0x00007fc5b5ca5a58, params: {"authenticity_token"=>"[FILTERED]", "user"=>{"full_name"=>"shaker abu drais", "email"=>"shaker_abady@yahoo.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up", "controller"=>"devise/sessions", "action"=>"create"} }

I have tried different solutions, but none of them worked, the weird thing, my code was working this morning, and this error only occurs after I added new tables to the database

A: What is it that you're actually trying to acheive here? If you're trying to just add additional attributes to the user registration then this code is just completely misguided.
You can whitelist additional attributes either through your ApplicationController which is the superclass for Devise's controllers:
class ApplicationController < ActionController::Base
  before_action :configure_permitted_parameters, if: :devise_controller?

  private

  def configure_permitted_parameters
    devise_parameter_sanitizer.permit(:sign_up, keys: [:full_name, :password,
    :password_confirmation])
  end
end

Or by creating a subclass of Devise::RegistrationsController and configuring the routes if you need to customize the workflow further:
devise_for :user, controllers: { registrations: 'my_registrations' }

class MyRegistrationsController < ::Devise::RegistrationsController
  before_action :configure_permitted_parameters, if: :devise_controller?

  # Don't clobber the entire `#create` method. Especially not without actually
  # replicating its functionality
  def create
    super do |user|
      # do something with the newly registered user
    end
  end

  private

  def configure_permitted_parameters
    devise_parameter_sanitizer.permit(:sign_up, keys: [:full_name, :password,
    :password_confirmation])
  end
end

Note that I wouldn't call this controller UsersController. There is a reason why Devise choose the name Registrations - its because it differentiates between signing up and for example if users are created by an admin.


text:
Q: Proof that $M$ and $M^{T}$ are similar
Triangular matrix $M \in \mathbb R^{n,n}$ and all elements on the diagonal are different. Proof that $M$ and $M^{T}$ are similar.

I know that the matrices are similar when the matrix similarity relation is the relation of equivalence so it is reflexive, symmetric  and transitive relation.Unfortunately I don't know what to use this information in my task.
 Can you get some tips?

A: Presume that they are similar, and in particular $M = P^{-1}M^{T}P$. What can you say about $P$?
Then write the equation as $PM = M^{T}P$. Given what we know about $P$, this should suggest what we need for $M$ and $M^{T}$ to be similar (i.e. it should tell us what type of matrix $P$ is sufficient to make the equation true).

A: It turns out that any square matrix over any field is similar to its transpose. Here's why: First assume the field is algebraically closed. Write $M = AJA^{-1}$ where $J$ is the Jordan canonical form of $M$. Then $M^T = (A^T)^{-1} J^T A^T$. But it's not hard to show that $J$ and $J^T$ are similar (via permuting rows and columns within each Jordan block), so $M$ is similar to $M^T$.
If the field is not algebraically closed, apply the following theorem: If the field $F$ is the algebraic closure of the field $\Gamma$, and $M, N$ are square matrices over $\Gamma$ which are "similar over $F$" in the sense that there exists an invertible matrix $A$ over $F$ with $M = A N A^{-1}$, then $M$ and $N$ must also be "similar over $\Gamma$", i.e., there exists an invertible matrix $B$ over $\Gamma$ such that $M = B N B^{-1}$. For a proof via the rational canonical form, see Steven Roman's Advanced Linear Algebra, Third Edition, p. 182. For the special case $F = \mathbb C$ and $\Gamma = \mathbb R$, there's a nice alternate proof that avoids the rational canonical form: see Victor Prasolov's Problems and Theorems in Linear Algebra, first theorem in the section on the Jordan normal form.
By the way, the similarity $M \approx M^T$ has a nice interpretation in the more abstract framework of vector spaces and linear maps: For a finite-dimensional vector space $V$ with a fixed ordered basis, and its dual space $V^*$ with the dual basis, the matrices of a linear operator $\tau : V \to V$ and its operator adjoint $\tau^\times : V^* \to V^*$ are transposes of one another. So the theorem tells us that any linear operator looks just like its adjoint, up to a change of basis.


text:
Q: Install torrent tracker on Ubuntu Help me, please.
How can I configure and start a Torrent tracker on ubuntu? I have tried the Xbt tracker but it's not working. I have to make a torrent file and also manage seeders and leeches etc.


text:
Q: improper use of a GetX has been detected Flutter the improper use of a GetX has been detected. This error is causing me not to load the widget at that point of time. Tried to figure out but still the problem remain. You should only use GetX or Obx for the specific widget. Unable to figure out get x issue that is causing the problem or OBX where to enclose it with. Please help with this scenario.
Thank you.
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'specified_books.dart';
import '../pages/styles.dart';

class BookMagazineTapbar extends StatelessWidget {
  final String titleText;

  const BookMagazineTapbar({Key? key, required this.titleText})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 0,
        backgroundColor: whiteColor,
        title: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            Text(titleText.tr),
          ],
        ),
      ),
      body: SpecifiedBooks(
        titleText: titleText,
      ),
    );

/*TODO: Below is code for magzines and books, comment scafold from above and uncomment below code to use both if need to use magzines  */
    //   DefaultTabController(
    //     length: 2,
    //     child: Scaffold(
    //       appBar: AppBar(
    //         elevation: 0,
    //         backgroundColor: whiteColor,
    //         title: Row(
    //           mainAxisAlignment: MainAxisAlignment.center,
    //           mainAxisSize: MainAxisSize.min,
    //           children: <Widget>[
    //             Text(titleText.tr),
    //           ],
    //         ),
    //         bottom: TabBar(
    //           labelColor: mainColor,
    //           unselectedLabelColor: greyColor,
    //           tabs: [
    //             Tab(
    //               child: Row(
    //                 mainAxisSize: MainAxisSize.min,
    //                 children: [
    //                   const ImageIcon(AssetImage('assets/book.png')),
    //                   const SizedBox(width: 8),
    //                   Text('books'.tr),
    //                 ],
    //               ),
    //             ),
    //             Tab(
    //               child: Row(
    //                 mainAxisSize: MainAxisSize.min,
    //                 children: [
    //                   const ImageIcon(AssetImage('assets/magazine.png')),
    //                   const SizedBox(width: 8),
    //                   Text('magazines'.tr),
    //                 ],
    //               ),
    //             ),
    //           ],
    //         ),
    //       ),
    //       body: TabBarView(
    //         children: [
    //           SpecifiedBooks(
    //             titleText: titleText,
    //           ),
    //           SpecifiedMagazines(
    //             titleText: titleText,
    //           ),
    //         ],
    //       ),
    //     ),
    //   );
    // }
  }
}

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:matab/controllers/book_controller.dart';
import 'package:matab/ui/pages/search/search_books.dart';
import 'package:matab/ui/pages/styles.dart';

class SpecifiedBooks extends StatefulWidget {
  final String titleText;
  const SpecifiedBooks({Key? key, required this.titleText}) : super(key: key);

  @override
  State<SpecifiedBooks> createState() => _SpecifiedBooksState();
}

class _SpecifiedBooksState extends State<SpecifiedBooks> {
  @override
  Widget build(BuildContext context) {
    final BookController bookController = Get.find(tag: 'bookController');
    return SingleChildScrollView(
      child: RefreshIndicator(
          onRefresh: bookController.refreshList,
          backgroundColor: mainColor,
          color: Colors.white,
          child: Obx(
            (() {
              if (bookController.isLoading.value) {
                return const Center(
                  child: CircularProgressIndicator(),
                );
              } else {
                return Column(
                  children: [
                    SizedBox(
                        height: MediaQuery.of(context).size.height - 100,
                        child: SearchBooks(
                          titleText: widget.titleText,
                        )),
                  ],
                );
              }
            }),
          )),
    );
  }
}

A: instead of Get.find use Get.put bcz sometimes context not available
//final BookController bookController = Get.find(tag: 'bookController');
final BookController bookController = Get.put(BookController());

A: GetX's solution for this is to provide initialBinding in GetMaterialApp.
You may not be able to view the code sample below.
Future<void> main() async {
  runApp(
    GetMaterialApp(
      title: "test App",
      initialRoute: '/',
      initialBinding: HomeBinding(),
      getPages: AppPages.pages,
    ),
  );
}

We create HomeBinding in a separate file as follows.
class HomeBinding implements Bindings {
  @override
  void dependencies() {
    Get.lazyPut<MyController>(() => MyController());
    Get.put<MyOtherController>(MyOtherController());
  }
}

If you implement the above code correctly, when the application starts it will first see what controllers you need and initialize them.


text:
Q: Declaring Global Array in PHP I'm trying to declare a global array and put data in it with a function.
It works only if the global variable is a string but not if it's an array:
$data = iterate("USER361");
print_r($data);

function iterate($username)
{
    global $gv_array;

    $sql = "select * from account where sponsor = '$username'";
    $result = mysql_query($sql);
        while($row = mysql_fetch_array($result))
        {
            $this_user = $row['username'];
            $this_name = $row['full_name'];
            $this_tier = $row['tier'];

            $my_array = array("username"=>$this_user,"name"=>$this_name,"tier"=>$this_tier);
            array_push($gv_array[],$my_array);

            iterate($row['username']);
        }

}//end of iterate

The error I get is:

PHP Warning:  array_push() expects parameter 1 to be array, null given in /var/www/html/inc/code.php on line 29

A: if $gv_array it's an array then the problem is here array_push($gv_array[],$my_array); remove the square brackets.
array_push($gv_array,$my_array);


text:
Q: Including subitems in query using LINQ? Using mvc3 and entity framework 4.
In sql server, the "Steps" table has foreign key constraint to "Question" via stepID.
The query (below) steps includes any associated questions.
var steps = from b in db.Steps.Include(s => s.Questions)
            orderby b.StepOrder
            select b;

return View(steps.ToList());

I want to also pull "answers" associated to questions.
In sql server, the "Questions" table has foreign key contraint to "Answers" via questionID.
How do I change the query to include answers associate to questions which are associated to steps?

A: You need to Select the grandchildren inside the Include
var steps = from b in db.Steps.Include(s => s.Questions.Select(q => q.Answers))
            orderby b.StepOrder
            select b;

return View(steps.ToList());

See Eagerly loading multiple levels section in the Loading Related Entities EF tutorial.


text:
Q: Numbering of paragraphs only if there is more than one I use XSLT 1.0 to transform a simple XML to HTML. I use a template to number the paragraphs under a heading. I'm struggling with a condition that deactivates numbering if there is only one paragraph under a heading.
My XML:
<document title="Lorem Ipsum">
<heading title="Heading 1" id="HEADING-1">

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

</heading>
<heading title="Heading 2" id="HEADING-2">

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

</heading>

My XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

        <xsl:apply-templates/>

</xsl:template>

<xsl:template match="heading">

    <xsl:number format="1. " level="multiple" count="heading"/>
    <xsl:value-of select="@title"/>

<xsl:apply-templates />
</xsl:template>

<xsl:template match="p">

    <xsl:number format="(1) " level="single" count="p"/>
    <xsl:apply-templates />

</xsl:template>

</xsl:stylesheet>

With this setup, not only the two paragraphs under Heading 1 are numbered, but also the single paragraph under Heading 2. I'd like to deactivate numbering if there is only one paragraph under a heading. I tried many conditions like <xsl:if test="number(node()) > 1"> and <xsl:if test="count(*) > 1"> but cannot find the solution.

A: Or shortly:
<xsl:if test="count(../p) > 1">
    <xsl:number format="(1) "/>
</xsl:if>

A: One solution may be this one: checking if a p is found before (with the preceding-sibling axis) or after (with the following-sibling axis) the
 currently being processed.
You can implement it by modifying your stylesheet and adding a condition like below:
<xsl:if test="preceding-sibling::p or following-sibling::p">
  <xsl:number format="(1) " level="single" count="p"/>
</xsl:if>


text:
Q: How can I get row of ListView with CursorAdapter highlighted when touch on it? Normally when I create a ListView in simple ArrayAdapter. It got this highlight feature automatically without additional setup. However, when I create this ListView with my custom CursorAdapter this feature seem to be missing and I cannot find a way to solve it.
Here is my custom CursorAdapter
    public class RecentCallAdapter extends CursorAdapter {
    private final String tag = this.getClass().getSimpleName();

    public RecentCallAdapter(Context context, Cursor c, int flags) {
        super(context, c, flags);
        // TODO Auto-generated constructor stub
    }

    private static class ViewHolder {
        TextView name;
        TextView date;
        int nameCol;
        int dateCol;
        int numberCol;
        Calendar cal;
    }

    @Override
    public void bindView(View v, Context context, Cursor cursor) {
        // TODO Auto-generated method stub

        ViewHolder holder = (ViewHolder) v.getTag();
        if (holder == null) {
            holder = new ViewHolder();
            holder.name = (TextView) v.findViewById(R.id.recentcall_item_name);
            holder.date = (TextView) v.findViewById(R.id.recentcall_item_date);
            holder.nameCol = cursor.getColumnIndex(Calls.CACHED_NAME);
            holder.dateCol = cursor.getColumnIndex(Calls.DATE);
            holder.numberCol = cursor.getColumnIndex(Calls.NUMBER);
            holder.cal = Calendar.getInstance();
            v.setTag(holder);
        }

        String name = cursor.getString(holder.nameCol);
        if(name == null){
            name = cursor.getString(holder.numberCol);
        }
        holder.name.setText(name);

        holder.cal.setTimeInMillis(Long.valueOf(cursor.getString(holder.dateCol)));
        holder.date.setText(Utility.calculateTimePass(holder.cal.getTime()));
    }

    @Override
    public View newView(Context context, Cursor cursor, ViewGroup parent) {
        // TODO Auto-generated method stub
        LayoutInflater inflater = LayoutInflater.from(context);
        View v = inflater.inflate(R.layout.recentcall_item, parent, false);
        bindView(v, context, cursor);
        return v;
    }

Any way to solve this?
Thank.

A: use selector same following
    <selector xmlns:android="http://schemas.android.com/apk/res/android" >
     <item android:state_focused="true" android:drawable="@android:drawable/list_selector_background">

     </item>
<item android:state_focused="true" android:state_selected="true" android:drawable="@android:drawable/list_selector_background">

     </item>
    </selector>

and use this code in listview tag for set selector
android:drawSelectorOnTop="true"
android:listSelector="@drawable/selector"

A: I will give you an example which is working for me.
To hold the color of listview item when you press it, include the following line in your
listview layout:
android:background="@drawable/bg_key"

Then define bg_key.xml in drawable folder like this:
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
       android:state_selected="true"
       android:drawable="@color/pressed_color"/>
    <item
     android:drawable="@color/default_color" />
</selector>

Finally, include this in your listview onClickListener:
listView.setOnItemClickListener(new OnItemClickListener() {

 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position,long arg3) {
    view.setSelected(true);
    ...
}
}

This way, only one item will be color-selected at any time. You can define your color values in res/values/colors.xml with something like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="pressed_color">#4d90fe</color>
    <color name="default_color">#ffffff</color>
</resources>

A: In your custom layout set the background as android:background="@drawable/bkg"
bkg.xml
   <?xml version="1.0" encoding="utf-8"?>
  <selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:state_pressed="true"
    android:drawable="@drawable/pressed" />
  <item  android:state_focused="false"
    android:drawable="@drawable/normal" />
  </selector>

normal.xml
  <?xml version="1.0" encoding="UTF-8"?>
  <shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
  <solid android:color="#10EB0A"/>
  <stroke android:width="3dp"
        android:color="#0FECFF" />
  </shape>

pressed.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
   android:shape="rectangle">
<solid android:color="#FF1A47"/>
<stroke android:width="3dp"
        android:color="#0FECFF"/>
</shape>


text:
Q: No overload matches this call error: React Native Navigation I'm pretty new to React Native and React Native Navigation. I'm getting an error stating:
    "message": "No overload matches this call.\n  Overload 1 of 2, '(...args: never): void', gave the following error.\n    Argument of type 'string' is not assignable to parameter of type 'never'.\n  Overload 2 of 2, '(options: never): void', gave the following error.\n    Argument of type 'string' is not assignable to parameter of type 'never'.",

in regards to 'Signup'. Previously, I wasn't getting this issue, and I can't seem to figure out why this is occurring. All of the examples that I've found don't pertain to problems with navigation. I tried adding <RootStackParamList> to navigation.navigate<RootStackParamList>('Conversation'), but that just caused another error, and adding it to useNavigation did nothing. I would really appreciate any help or advice on why I might be getting this issue. Thank you!
HomeScreen.tsx
import React, { useState, useEffect } from 'react';
import { View, StyleSheet, FlatList, Alert } from 'react-native';
import {
  Text,
  TextInput,
  Pressable,
  ActivityIndicator,
} from 'react-native';
import { useNavigation } from '@react-navigation/native';
import { Text, View } from '../components/Themed';*/
import { useQuery, gql } from '@apollo/client';
import { RootStackParamList} from '../navigation/types';

export default function HomeScreen() {

  const navigation = useNavigation();

  return (
    <View style={styles.container}>
      <Pressable
        onPress={() => {console.warn('navigate'); navigation.navigate('Signup')}}
      >
        <Text
            New here? Sign up
        </Text>
      </Pressable>
    </View>
  );
}
);

types.tsx
import { StackNavigationProp } from '@react-navigation/stack';
import { RouteProp } from '@react-navigation/native';

export type RootStackParamList = {
  Home: undefined;
  Conversation: undefined;
  Login: undefined;
  Signup: undefined;
  NotFound: undefined;
  Splash: undefined;
};

export type MessageNavProps<T extends keyof RootStackParamList> = {
  navigation: StackNavigationProp<RootStackParamList, T>;
  route: RouteProp<RootStackParamList, T>;
};

A: The error you're seeing is at the Typescript level, so it won't prevent you from using the navigator. It tells you that the navigator isn't typed, so it's not expecting to navigate anywhere.
You can change the useNavigation call to look like this:
const { navigate } = useNavigation<StackNavigationProp<RootStackParamList>>();
and react-navigation will get the route names from your param list.

A: When using native-stack, usage will look like this:
import {ParamListBase, useNavigation} from '@react-navigation/native';
import {NativeStackNavigationProp} from '@react-navigation/native-stack';

const Component = () => {
  const navigation = useNavigation<NativeStackNavigationProp<ParamListBase>>();
  //...
}

A: If you want to go with the simpler and a bit hacker way.. just do this:
navigation.navigate("YourRouteName" as never);


text:
Q: Jgoodies binding not firing firePropertyChange I'm modifying an original JGoodies binding example found on JGoodies Binding: Presentation Model Property Change Example
I'm wondering however why I need to manually fire firePropertyChange(FIRST_NAME_PROPERTY, oldValue, this.firstName); to make the GUI update with the model when instead this should be automatically dealt by JGoodies.
The example below should update the JTextField by changing the model without me manually firing the fireUpdateChange from each setter!
How can I accomplish this?
import java.awt.event.ActionEvent;
import javax.swing.*;
import com.jgoodies.binding.*;
import com.jgoodies.binding.adapter.Bindings;
import com.jgoodies.binding.beans.BeanAdapter;
import java.util.Random;

public class PresentationModelPropertyChangeExample extends JPanel
{

    private PersonModel personModel;
    BeanAdapter beanAdapter;

    public PresentationModelPropertyChangeExample()
    {
        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

        this.personModel = new PersonModel();
        beanAdapter = new BeanAdapter(personModel, true);
        JTextField firstNameTextField = new JTextField();

        Bindings.bind(firstNameTextField, beanAdapter.getValueModel(personModel.FIRST_NAME_PROPERTY));

        add(firstNameTextField);
        add(new JButton(new ChangeBeanAction()));
    }

    private class ChangeBeanAction extends AbstractAction
    {

        public ChangeBeanAction()
        {
            super("Change PersonBean");
        }

        @Override
        public void actionPerformed(ActionEvent event)
        {
            Random rand = new Random(1000);
            personModel.setFirstName("" + rand.nextInt());
        }
    }

    public class PersonModel extends PresentationModel
    {

        private String firstName;
        public static final String FIRST_NAME_PROPERTY = "firstName";

        public String getFirstName()
        {
            return firstName;
        }

        public void setFirstName(String firstName)
        {
            String oldValue = this.firstName;
            this.firstName = firstName;
            //firePropertyChange(FIRST_NAME_PROPERTY, oldValue, this.firstName);
        }
    }

    public static void main(String[] a)
    {
        JFrame f = new JFrame("Presentation PropertyChange Example");
        f.setDefaultCloseOperation(2);
        f.add(new PresentationModelPropertyChangeExample());
        f.pack();
        f.setVisible(true);
    }
}