text:
Q: Command Line failing to print some print statements So I have a program and in one line it is printing out a variable stored in an object. It works perfectly fine in any IDE I've tried (blue-J and Eclipse) but when I run it in cmd it just gives blank, any ideas what is wrong?
Image of code and how it runs on IDE vs. CMD

A: ohh i think command line has small limits on words to display the and i think the first print was covered by the second print you should use println or do something like this :
System.out.println(ans + " with score " + smallestAccept[i].getScore());

A: Try this:
System.out.print(ans);
System.out.print(" with score: " + smallestAccept[i].getScore() + "\n");

or this :
System.out.println(ans);
System.out.print(" with score: " + smallestAccept[i].getScore() + "\n");


text:
Q: Material Angular md-autocomplete clear and blur after selection (multi select) I am trying to use md-autocomplete in Angular Material as a multi selector. The idea is, that the selected element from the autocomplete will be added to an object array after selection and then the selection will be removed from the md-autocomplete. I was able to clear the md-autocomplete, but the focus stays on the md-autocomplete input and so the autocomplete suggestions are still visible.
Example:
http://cdpn.io/QjQGVQ
Code:
function selectedItemChange(item) {
  $log.info('Item changed to ' + JSON.stringify(item));
  if(item)
  {
    //check if item is already selected
    if($filter('filter')(vm.contactsSelected, function (d) {return d.id === item.id;})[0])
      {
        $log.info('Item already selected. Will not add it again.');
      }
    else
      {
        //add id to object
        vm.contactsSelected.push(item);
      }
    // clear search field
    vm.searchText = '';
    vm.selectedItem = undefined;

    //somehow blur the autocomplete focus
    //$mdAutocompleteCtrl.blur();
  }
}

PS: I am aware I could use the contact chips of Angular Material instead, but I was still wondering how the blur could be achieved.

A: If you set md-no-cache="true" property inside your  the list will dissapear, but input field will not be cleared. I think is better solution than clearing input field but leaving the list visible, but is up to you.

redpajama_set_name: RedPajamaStackExchange


text:
Q: LAN Port as controller i need only to get any voltage out from my laptop to control a relay
how to get a signal from a LAN port from any pin ?
in my laptop there is no com Port or lpt Port
also the usb port needs interfacing circuits which is not nessesary
in my simple project
thats why i choosed the LAN Port
i use (visual basic 6)
any help would much appriciated .

A: While such things as PoE exist, normal ports do not provide any power to external devices.  The USB ports are far more likely candidates since they are designed to support powering external devices, though the amount of current supported varies by adapter/hub (most "ports" are actually internal hub ports).


text:
Q: Cannot upload file using Angular and Spring Boot I'm trying to upload a file with AngularJS and Spring Boot controller. I have 2 problems:
1) When I use an HTML form 'submit' I get exceeded size even though I have set the max size of file to 128M. The code looks like this:
public class AppConfig {
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        factory.setMaxFileSize("128MB");
        factory.setMaxRequestSize("128MB");
        return factory.createMultipartConfig();
    }
}

It seems that Spring ignores these settings.
2) When I'm trying to upload a file, I get the error:
org.springframework.web.multipart.MultipartException: The current request is not a multipart request

The Angular controller looks like this:
 $scope.uploadFile=function(){
     var formData=new FormData();
     formData.append("file",file.files[0]);

     $http.post('/content-files/upload /',  file.files[0], {

         transformRequest: function(data, headersGetterFunction) {
                return data; // do nothing! FormData is very good!
            },
         headers: {'Content-Type': undefined }

     })
     .success(function(){
         console.log('Post Succeded !');
     })
     .error(function(){
         console.log('Post Failed .');
     });
}

and the Spring controller looks like this:
@RequestMapping(value = "/content-files/upload/", method = RequestMethod.POST  )
public @ResponseBody String handleFileUpload(  @RequestParam("file") MultipartFile file) {
    System.out.println("BrandController.uploadMultipart()");

    String name=file.getName();
    if (!file.isEmpty()) {
        try {
            byte[] bytes = file.getBytes();
            BufferedOutputStream stream =
                          new BufferedOutputStream(new FileOutputStream(new File(name)));
            stream.write(bytes);
            stream.close();
            return "You successfully uploaded " + name + "!";
        } catch (Exception e) {
            return "You failed to upload " + name + " => " + e.getMessage();
        }
    } else {
        return "You failed to upload " + name + " because the file was empty.";
    }
}

I tried changing the JS controller to:
$http.post('/content-files/upload /',  file.files[0], {
    headers: { 'Content-Type': undefined },
    transformRequest: angular.identity
})

but I get the same error as above. When I try changing the JS controller to:
headers: { 'Content-Type': 'multipart/form-data' },
          transformRequest: angular.identity

I get the error the request was rejected because no multipart boundary was found.
It seems that I have tried all combinations with the parameters, and still nothing worked. What do I need to do to get this file upload to work?

A: Try with this:
var formData = new FormData();
formData.append('file',file.files[0]);

$http.post('/content-files/upload /',  formData, {
    headers: { 'Content-Type': undefined },
    transformRequest: angular.identity
})

A: Based on the MultipartAutoConfiguration code, the way to increase the size limit on uploads (by default max is 1 MB) with Spring Boot is the following properties:
multipart.maxFileSize=129Mb
multipart.maxRequestSize=129Mb

Regarding jquery multipart uploads, the way you are doing it does not appear correct, there are other good references that you can check for, I have seen plenty within Stackoverflow itself.


text:
Q: SQl performance b/w like and trim Which would be better to perform search on a column in SQL table :-
like or trim.
As this column has the spaces either on the starting or at the end so both serves the purpose but which one would be faster.
Thanks

A: You should set up a test and see how they are performing. In example below I've used dbms_utility.get_time. I tested the same input for both functions and repeated the test alternatively to exclude any exterior influence.
It is a "plsql environment", if I can call it this way, you should replace the query with actual table and actual tests and do a more "sql" test.
declare
v_start number;
v_end number;
time_trim number:=0;
time_like number:=0;
cnt_trim number:=0;
cnt_like number:=0;
begin
for N in 1..10 --repeat test
loop
    for type_oper in 1..2
    loop
        v_start := dbms_utility.get_time;
        for k in (
            select 'abc   ' as col from dual connect by level <= 100000
            union all
            select 'ccc   ' as col from dual connect by level <= 100000
            union all
            select 'acbc   ' as col from dual connect by level <= 100000
            union all
            select '   acbc   ' as col from dual connect by level <= 100000
        )
        loop
        if type_oper = 1 then
            if trim(k.col) = 'abc' then cnt_trim := cnt_trim + 1; end if;
        else
            if k.col like '%abc%' then cnt_like := cnt_like + 1; end if;
        end if;
        end loop; --end loop table
        v_end := dbms_utility.get_time;
        if type_oper = 1 then
            time_trim := time_trim + v_end-v_start;
        else
            time_like := time_like + v_end-v_start;
        end if;

    end loop; --end loop type
end loop; --end loop repeat test
dbms_output.put_line('time trim:'||time_trim/100);
dbms_output.put_line('time like:'||time_like/100);
end;
/

Result:

cnt trim:1000000 time trim:6.33
  cnt like:1000000 time like:5.83


text:
Q: Google API How to identify primary Calendar In my application, I need to export to primary Google calendar. In my testing the calendar query seems to always return the default/primary calendar as the first entry in the array, but this is never mentioned in the documentation so likely not guaranteed.
I also notice that the calendar title is sometimes user@domain.com even though the primary calendar title in UI is often in the "First Last" format. I believe this only happens if the user does not override the name. Is this a bug?
In other instances the calendar title is "First Last" and not the email or some other custom name. Is there a reliable way to identify a primary calendar, or should I take the first item in array and hope that it never changes?
Thanks,

A: You can directly use 'primary' to identify the primary calendar.
It works fine for me in php and JAVA. Or identify with the calendar id, that should be the owner's email.

A: My own answer seems to be that a primary Calendar can always be identified by the feed:
http://www.google.com/calendar/feeds/default/owncalendars/full/username%40domain.com, so the lookup is not necessary. There's lack of documentation in this area and some inconsistency in the way the title is populated for primary calendars that had not been re-named by the users.


text:
Q: A divisibility rule for 7 in primoradic with an historical example. I'm looking for other examples of the same type. I have given as much information as I could about primoradic here.
In primoradic , multiples of 7 which are not multiples of 2, 3 or 5 end
by (...:0:1:0:1), (...:1:3:0:1), (...:2:2:2:1), (...:3:0:0:1), (...:3:4:2:1), (...:4:2:0:1), (...:5:1:2:1) or (...:6:3:2:1).
Let us apply that to an historical example. Consider a number studied by Blaise Pascal, N=287.542.178. Let $N1=N/2=143.771.089$. In primoradic, $$N1=(14:15:10:7:6:1:3:0:1)\equiv49 \pmod {210}$$ It was sufficient to have $(...:1:3:0:1)$ to know that Pascal's number is divisible by 7. By generalization, you have a divisibility rule for any prime number. For $p_{n+1}$, you have $Card((Z/p_n\#)^\times)$ endings. For example, for $11$, $(...:7:3:2:0:1)$ is one of the $48$ endings.
Notice : $$N1=(14:15:10:7:6:1:3:0:1)=1+3 \times6+1\times{30}+6\times{210}+7\times{2310}+10\times30030+15\times510510+14\times9699690$$
To ask a precise question : you could find a number like Blaise Pascal's one, which is a multiple of $7$ and write it in primoradic. Or a multiple of any prime number as 107 (see here)


text:
Q: Emoji Keyboard - How to add emoji keyboard like whatsapp in ReactNative? I want to add an emoji keyboard like WhatsApp for my chat application, I tried react-native-emoji-board and some more are just pickers they really don't act like a keyboard with TextInput.
Somebody, please suggest to me if there is a library that works with TextInput or even there is any way to open the system emoji keyboard on a button click.
Thanks

A: Their is a package o npmjs.org called React Native Emoticons
you can find it on https://www.npmjs.com/package/react-native-emoticons
this should help you typing some emojis


text:
Q: Simplifying a Boolean Expression with two additional conditions Problem:
Given that $$ A \cdot B = 0$$ and $$A + B = 1$$ use algebraic manipulation to prove that:
$$ (A + C) \cdot( \overline A + B ) \cdot (B + C) = B \cdot C$$
Answer:
First, I will rewrite the left hand side without the operator $$ \cdot $$. That is, I will write $$ AB $$ to mean $$A \cdot B$$.
\begin{align*}
(A + C)( \overline A + B ) (B + C) &= ( 0 + \overline A C + AB + BC ) (B + C) \\
(A + C)( \overline A + B ) (B + C) &= ( 0 + \overline A C + 0 + BC ) (B + C) = ( \overline A C + BC )( B + C) \\
(A + C)( \overline A + B ) (B + C) &= B( \overline A C + BC ) + C( \overline A C + BC ) \\
(A + C)( \overline A + B ) (B + C) &=  \overline A BC + BC + C( \overline A C + BC ) \\
(A + C)( \overline A + B ) (B + C) &= \overline A BC + BC + \overline A C + BC \\
(A + C)( \overline A + B ) (B + C) &= \overline A BC + BC + \overline A C \\
(A + C)( \overline A + B ) (B + C) &= \overline A BC + \overline A C + BC \\
(A + C)( \overline A + B ) (B + C) &= \overline A C + BC \\
\end{align*}
I think I am on the right track, but I do not know how to finish solving the problem.
Thanks,
Bob

A: This is a super long detour for a simple result:

*

*A·B = 0 implies that at most one of A, B is true

*A+B = 1 implies that at least one of A, B is true

*This implies that exactly one of A, B is true.

*This implies that \$\overline A = B\$.

Then
\begin{align}
(A + C) \cdot( \overline A + B ) \cdot (B + C)
&=(\overline B +C)\cdot(B+B)\cdot (B+C)\\
&=B(\overline B +C)(B+C)\\
&=(B\overline B + BC)(B+C)\\
&=(0+BC)(B+C)\\
&= BCB + BCC\\
&=BC\\
&\overset!=BC
\end{align}


text:
Q: React: Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of  So I have this error popping up about the spaces left in . I am trying to find an answer in stack but I don't actually have a  or any table element in my project because I am using React and Material-UI.
I also get another similar error like this:
Warning: validateDOMNesting(...): <td> cannot appear as a child of <tfoot>.

which again I cannot find any  or  in my project. My error tab is filled and every error has one same dependency which is:

js/0.chunk.js:227830:31

A: Seems that React is complaining about whitespace around curly brackets in JSX tags. Somewhere, one of those JSX tags is actually a <td> tag, but because it's a third-party element you can't easily see what tag it is behind the scenes.
So you will have to change all following code:
<tag> {code} </tag>

to
<tag>{code}</tag>

The easiest way to fix this would be to do a global replace in all files with a JSX file extension:

*

*> { to >{

*} </ to }</
But that's quite prone to breaking because it could be valid code in some places.
I'm not sure whether there is an ESlint rule for catching these issues during development.


text:
Q: PHP compile time vs run time. Understanding the difference I hear those two terms often and keep thinking

What is the difference between compile time vs run time in PHP?

I have tried reading some articles, but it didn't help.
Does anyone know of a simple explanation? How are they different from each other?

A: PHP makes two passes (by default) anytime it runs a file.
Pass #1 parses the file and builds what is called operational(or machine) code. This is the raw binary format your computer will actually run and it is not human readable. In other languages (like C++, etc) this is called compiling. You can cache this step using various systems like Opcache, which saves you the overhead of compiling this every time.
Syntax errors come from this portion of the execution.
Pass #2 executes the operational code from Pass #1. This is what is commonly called "run time", because your computer is actually executing the instructions.
Run-time errors (like exhausting memory, abnormal termination, etc) come from this level. These are considerably less common than syntax errors, however.

A: PHP files are run in two stages.
First, the PHP files are parsed. At this point, the data coming from the web browser (or from any other source) is utterly irrelevant. All this does is break the PHP file down into its constituent parts and building the structure of the code.
Then the code is executed with the data you supply.
This separation makes the code a very great deal faster. This is especially true when you have opcode caches like APC or OPcache, because the first step can be skipped on subsequent occasions because the structure of the code is exactly the same.
The time when you will encounter the difference is principally with errors. For instance, this code will cause an error at the compiling stage:
function class() {
    // some code
}

This is not possible because class is a reserved word. PHP can pick this up at the time the code is compiled: it will always fail. It can never work.
This code, however, could cause an error at runtime:
echo $_GET['nonExistingKey'];

Since the key nonExistingKey doesn't exist, it can't be retrieved, so it causes an error. However, PHP can't decide this when the code is originally compiled, only when it is run with the data you supply.


text:
Q: Trouble with Queries and JOINS The main page I am using is called the Project Details Page which when you select a project number on the form will query the subform for any records pertaining to that project number and display them in this page named the (TasksSubform).
This page called (TasksSubform) uses a php file called mysqli_connect.php to obtain a database connection and assigns that connection to $dbc in the mysqli_connect.php file.
This page then query's table 1 named 'CommonTasks', and starts displaying the data row by row in a table on the page using
while($row = $result->fetch_assoc())

Currently one of the columns in the record being displayed is named "AssignedTo" which produces the unique ID number in the Employees table instead of the text value of the employees name associated with the ID number. So, I need to be able to list the records in the CommonTasks Table using Fetch then, when it tries to display the value in the "AssignedTo" column within the Common Tasks Table, it must lookup the ID in the Employees table which equals the same value in the Common Tasks Table, and replace the number value of the Assigned To Field with the text value in the Employees table.
COMMONTASKS
    EMPLOYEES
    * Add
    * AssignedTo
    * Attachments
    * Cost
    * CostInDays
    * Description
    * DueDate
    * EmployeeID
    * ID
    * PercentComplete
    * Priority
    * StartDate
    * SubmissionDate
    * Title * ID
* Address
* BusinessPhone
* City
* Company
* CountryRegion
* EmailAddress
* FaxNumber
* FirstName
* HomePhone
* JobTitle
* LastName
* MobilePhone
* Notes
* StateProvince
* WebPage
* ZIPPostal Code

This is what I have. Yet, all it is producing is a blank in the Assigned To field on the php page.
enter image description here
I am a novice to php and mysql.
This is probably something simple which I am overlooking.
Yet, I have been troubleshooting various methods for the past few days, and just cant seem to figure out what I am doing wrong.
    <?php
// Get a connection for the database
require_once('../mysqli_connect.php');

// Create a query for the database

$sql = "SELECT * FROM `CommonTasks`";
$employee = "SELECT ID, LastName, LastName FROM Employees JOIN CommonTasks ON Employees.ID=CommonTasks.AssignedTo";
$emp = "SELECT LastName, FirstName FROM Employees JOIN CommonTasks WHERE Employees.ID = CommonTasks.AssignedTo LIMIT 1";
$emp1 = "SELECT id as LastName, FirstName FROM Employees WHERE ID = CommonTasks.AssignedTo LIMIT 1";
// Get a response from the database by sending the connection
// and the query
$result1 = @mysqli_query($dbc, $sql);
$result2 = @mysqli_query($dbc, $emp);
 $result = $dbc->query($sql);
$link = "commntasks-insertdata.php"
?>
<!DOCTYPE html>

<title>Common Tasks-subform</title>
<meta name="viewport"charset="utf-8" content="width=device-width, initial-scale=1.0">

<?php

echo "

SUBFORM - Common Tasks

    Job Title
    Due Date
    Start Date
    Cost
    Priority
    Percent Complete
    Assigned To
    Description

";

       if ($result->num_rows > 0) {
     // output data of each row

     while($row = $result->fetch_assoc()) {

       echo "
";
       echo " $row[Title]  	";
       echo "". $row['DueDate'] . "	";
       echo "". $row['StartDate'] . "	 " ;
       echo "". $row['Cost'] . "	";
       echo "". $row['Priority'] . "	";
       echo "". $row['PercentComplete'] . "	 " ;
       echo "". $row ['SELECT LastName, FirstName FROM Employees JOIN CommonTasks WHERE Employees.ID = $_GET[AssignedTo] LIMIT 1'] . "	";
       echo "". $row['Description'] . "	 " ;
       echo "
";
    }
}
echo "
";
?>

A: Currently, the results are being produced by this line
$result = $dbc->query($sql);

The following line will not execute a mysql query.
echo "". $row ['SELECT LastName, FirstName FROM Employees JOIN CommonTasks WHERE Employees.ID = $_GET[AssignedTo] LIMIT 1'] . "	";

As written, you are trying to find a row value in $result that does not exist. You need to call the second query within the first while loop and pass the value of $_GET[AssignedTo] which is probably $row[AssignedTo]
Something like this
while($row = $result->fetch_assoc()) {

   echo "
";
   echo " $row[Title]  	";
   echo "". $row['DueDate'] . "	";
   echo "". $row['StartDate'] . "	 " ;
   echo "". $row['Cost'] . "	";
   echo "". $row['Priority'] . "	";
   echo "". $row['PercentComplete'] . "	 " ;

   $emp = "SELECT LastName, FirstName FROM Employees JOIN CommonTasks WHERE Employees.ID = '$row[AssignedTo]' LIMIT 1";
   $result2 = @mysqli_query($dbc, $emp);
   $row2 = $result2->fetch_assoc();

   echo "". $row2 ['Firstname'] . " ". $row2 ['Lastname'] . "	";
   echo "". $row['Description'] . "	 " ;
   echo "
";
}

A: So, Here are my revisions to your example:

while($row = $result->fetch_assoc()) {

   echo "
";
   echo " $row[Title]  	";
   echo "". $row['DueDate'] . "	";
   echo "". $row['StartDate'] . "	 " ;
   echo "". $row['Cost'] . "	";
   echo "". $row['Priority'] . "	";
   echo "". $row['PercentComplete'] . "	 " ;

   $emp = "SELECT LastName, FirstName FROM Employees JOIN CommonTasks WHERE Employees.ID = '$row[AssignedTo]'";
   $result2 = @mysqli_query($dbc, $emp);
   $row2 = $result2->fetch_assoc();

   echo "". $row2['LastName']," , ",$row2[FirstName] . "	";
   echo "". $row['Description'] . "	 " ;
   echo "
";
}
}
echo "
";
?>

Which produces this: Results of modified code
Thank you so much for your Help!
Since I am converting an Access Database to mySQL and recreating all of the queries, forms, and reports.... I am sure I will have an overwhelming amount of questions in the near future.
Eric


text:
Q: Generating primes from other primes For a natural number $n$ let $M$ be an $n$ by $n$ matrix w/$0$'s on diagonal and natural numbers off diagonal and let $p_1, p_2, \dots, p_n$ be a set of prime numbers.
Note then, that
$$p=\sum_{i=1}^n (\pm) \prod_{j=1}^n p_i^{m_{ij}}$$
is not divisible by any of the primes $p_1, p_2, \dots, p_n$.
Questions: Is there a finite set of primes that would generate
 (a)   all co-primes to the set,
 (b)   all other primes
in this fashion (varying $M$ and signs).
Example: $p_1 = 2$, $p_2=3$,
$$ 2+3 = -2^2 + 3^2 =5, $$
$$ 2^2+3 = 2^4 - 3^2 = 7, $$
$$ 2^3+3 = -2^4+ 3^3 = 11, $$
$$ 2^2+ 3^2 = 13,$$
$$\dots,$$
$$ ? =37. $$
What restriction on $M$ and signs would produce only primes for a set $p_1, p_2, \dots, p_n$?

A: Intuitively, the answer to the first two questions is no and the last is that there is no restriction on $M$ and signs that will produce only primes.  The fundamental reason is that powers get very far apart when the exponent is large.
Pick your set $\{p_1,p_2,p_3,\ldots p_n\}$.  It is finite and has a maximum.  Now pick a prime and a composite that are about $10^{100^n}$ times the largest one.  It is quite unlikely that you can express them this way.  We could calculate how many powers of the primes are less that this and find it is small compared to the number of numbers to express.  This will not be rigorous-there could be some cancellation between larger powers of the primes that brings it back into range.
For the last, note that $2^5+3=35$.  You just need to find one prime that $2$ is a primitive root of and you will be able to find a multiple of that prime.


text:
Q: Go Web Service - Undefined type has no field or method I am trying to consolidate routing functionality within a web service. The package main has two files of concern, route.go and main.go.
Within route.go I am defining routing as follows:
package main

import (
    "github.com/justinas/alice"
    "net/http"
)

func (app *Application) Routes() http.Handler {
    standardMiddleware := alice.New(app.logRequest)

    mux := http.NewServeMux()
    mux.HandleFunc("/ping", helpers.Ping)

    return standardMiddleware.Then(mux)
}

Within main.go I am trying to execute the application as follows:
package main

import (
    "flag"
    "log"
    "net/http"
    "os"
)

type Application struct {
    errorLog *log.Logger
}

func main() {
    addr := flag.String("addr", ":8080", "HTTP Network Address")
    flag.Parse()

    errorLog := log.New(os.Stderr, "ERROR\t", log.Ldate|log.Ltime|log.Lshortfile)

    app := &Application{
        errorLog: errorLog,
    }

    srv := &http.Server{
        Addr:     *addr,
        ErrorLog: errorLog,
        Handler:  app.Routes(),
    }

    err := srv.ListenAndServe()
    errorLog.Fatal(err)
}

When I execute the program I get the following error: app.Routes undefined (type *Application has no field or method Routes)
I'm not sure why the method isn't registering correctly?

A: Try using:
go run cmd/web/main.go cmd/web/route.go

go run takes file or files as input. It compiles only those file or files before running. So you need to add route.go file as input otherwise the method you declared in it, will be undefined.
go run ./cmd/web also works.
Update:
If you're in the same directory of main.go, just use:
go run .


text:
Q: Single Transaction in multiple java jvms One spring service is implemented in one java deployment unit(JVM). Another spring service is implemented in another JVM. Making service call from 1st jvm to 2nd jvm. Service interface could be either rest or soap over http. Need to keep single transaction over multiple jvms, meaning if any service fails every thing must be rolled back. How to do this. Any code examples.

A: *

*Use global transactions (i.e., JTA),

*Use XA resources (RDBMS and JMS connections), do "Full XA with 2PC".
For further reference on the Spring transaction management, including the JTA/XA scenario, read: http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#transaction

A: REST faces the exact same problem as SOAP-based web services with regards to atomic transactions. There is no stateful connection, and every operation is immediately committed; performing a series of operations means other clients can see interim states.
Unless, of course, you take care of this by design. First, ask yourself: do I have a standard set of atomic operations? This is commonly the case. For example, for a banking operation, removing a sum from one account and adding the same sum to a different account is often a required atomic operation. But rather than exporting just the primitive building blocks, the REST API should provide a single "transfer" operation, which encapsulates the entire process. This provides the desired atomicity, while also making client code much simpler. This appracoh is known as low granularity services, or high-level batch operations.
If there is no simple, pre-defined set of desired atomic operation sequences, the problem is more severe. A common solution is the batch command pattern. Define one REST method to demarcate the beginning of a transaction, and another to demarcate its end (a 'commit' request). Anything sent between these sets of operations is queued by the server but not committed, until the commit request is sent.
This pattern complicates the server significantly -- it must maintain a state per client. Normally, the first operation ('begin transaction') returns a transaction ID (TID), and all subsequent operations, up to and including the commit, must include this TID as a parameter.
It is a good idea to enforce a timeout on transactions: if too much time has passed since the initial 'begin transaction' request, or since the last step, the server has the right to abort the transaction. This prevents a potential DoS attack that causes the server to waste resources by keeping too many transactions open. The client design must keep in mind that each operation must be checked for a timeout response.
It is also a good idea to allow the client to abort a transaction, by providing a 'rollback' API.
The usual care required in designing code that uses multiple concurrent transactions applies as usual in this complex design scenario. If at all possible, try to limit the use of transactions, and support high-level batch operations instead.
I take no credit of this information, i'm just a director, credit goes to This article
Also please read Transactions in REST?
You can get some handy code samples here http://www.it-soa.eu/en/resp/atomicrest/userguide/index.html


text:
Q: The Erdős-Turán conjecture or the Erdős' conjecture? This has been bothering me for a while, and I can't seem to find any definitive answer.  The following conjecture is well known in additive combinatorics:

Conjecture: If $A\subset \mathbb{N}$ and $$\sum_{a\in A} \frac{1}{a}$$ diverges, then $A$ contains arbitrarily long arithmetic progressions.

This is often called either "The Erdős-Turán conjecture" or "Erdős's conjecture on arithmetic progressions."

I want to make sure I quote things correctly in my writing, and my main question is, who should this conjecture be attributed to?

I am asking because I find a lot of conflicting pieces of information regarding how it should be referred to.  For example, the Wikipedia page and the two Wolfram pages, page A and page B, are in disagreement.  Wikipedia seems to be adamant that calling it the Erdős-Turán conjecture is incorrect, however I am skeptical, as it does not seem to be so clear.  Also, both of the choices are used in many papers in the literature.
I went back and read the original 1936 paper of Erdős and Turán, "On some sequences of integers."  (Math Sci Net MR1574918).  In that paper, they conjecture that $r(N)=o(N)$, where $r(N)$ is a maximal subset of $\{1,\dots,N\}$ without 3 term arithmetic progressions.  They also mention the (incorrect) conjectures of Szekeres on $k$ term progressions, but other than that, they don't seem to mention any conjectures regarding longer progressions at all.
As far as I can tell, the above conjecture first appears in the 1972 paper of Erdős, "Résultats et problèmes en théorie des nombres."  (Math Sci Net MR0396376)  This suggests that the conjecture should be named after Erdős, however, I believe that there must some reason why this conjecture has often been attributed to Turán as well.  I can't imagine that it would be done for no reason, and it is entirely possible that the reason why credit is given to both Erdős and Turán was not written down, or at least, is not easy to find.
I am hoping someone can shed some light on this, and provide a clearer answer for what to call the above conjecture.
Thanks for your help,

A: In the first paragraph of page 233 of [1], we read the following:

Erdős conjectured that the sequence of primes contains arbitrarily long arithmetic progressions and, even more, that every sequence $1\leq a_{1} < a_{2} <... $ with $\sum_{n=1}^{\infty}\frac{1}{a_{n}} = \infty$ contains arbitrarily long arithmetic progressions. He offered $\\\$3000$ for this conjecture.

Besides, I believe that we can find a possible explanation of how the surname Turán got added in the last paragraph of page 232...
References
[1] B. Bollobás, To prove and conjecture: Paul Erdős and his mathematics. Amer. Math. Monthly, 105 (Mar., 1998), no. 3.
[2] Alex R. Erdős conjecture on arithmetic progressions, math-overflow.

A: One of the best places to track these things down is The mathematical coloring book, by Alexander Soifer, Springer 2009. Chapter 35 is on "Monochromatic arithmetic progressions", and section 35.4, "Paul Erdős's Favorite Conjecture", is on the problem you ask about.
As far as I can tell, the question is sometimes called the Erdős-Turán conjecture for two reasons: First, it extends their older conjecture (now Szemerédi's theorem). Second, it was first popularized in connection to Turán, see below.
Soifer identifies a problem paper in the premier issue of Combinatorica as the first place in print were the conjecture appears with the attached value of $\\\$3000$:  On the combinatorial problems which I would most like to see solved, Combinatorica, 1 (1981), 25–42, submitted Sep. 15, 1979.
Soifer adds that apparently Erdős first offered this amount in a 1976 talk, "To the memory of my lifelong friend and collaborator Paul Turán", in a conference the University of Manitoba, see
Problems in number theory and Combinatorics, in Proceedings of the Sixth Manitoba Conference on Numerical Mathematics (Univ. Manitoba, Winnipeg, Man., 1976), Congress. Numer. XVIII, 35–58, Utilitas Math., Winnipeg, Man., 1977. (Erdős calls it "A very attractive conjecture of mine.")
In Problems and results on combinatorial number theory, II, J. Indian Math. Soc. (N.S.), 40(1–4) (1976), 285–298, he stated the conjecture with an attached prize of $\\\$2500$. In page 288 of this paper, we read (mildly edited for typos):

$2.$ An old conjecture in number theory states that for every $k$ there are $k$ primes in arithmetic progression. This conjecture would immediately follow if we could prove that for every $k$ and $n\gt n_1(k)$, $r_k (n) \lt \pi (n)$.

Here, as usual, $r_k(n)$ is the size of the largest subset of $\{1,2,\dots,n\}$ without $k$-term progressions.

This method of proof seems very attractive, it tries to prove a difficult property of the primes by just using the facts that the primes are numerous. In some cases I have been successful with this simple minded approach. In this connection I recently formulated the following conjecture for the proof or disproof of which I offer $2500$ dollars:

Let $a_l \lt a_2 \lt\dots$ be an infinite sequence of integers satisfying $\sum\frac1{a_i}=\infty$.
Then for every $k$ there are $k$ $a$'s in an arithmetic progression.

(The truth of this conjecture would imply that for every $k$ there are $k$ primes in arithmetic progression). One can put this problem in a finite form as follows: Put $$g_k (n) = \max\sum_{a_i>n}\frac1{a_i},\quad G (k) = \lim_{n=\infty} g_k (n),$$ where the maximum is extended over all sequences $\{a_i\}$ not exceeding $n$ which do not contain an arithmetic progression of $k$ terms. The $2500$ dollar conjecture is equivalent to $G(k) \lt\infty$ for every $k$ (it is not quite trivial to show that $G (k) = \infty$ implies the falseness of the conjecture).

By the way, the prize currently attached to the conjecture is actually $\\\$5000$. Soifer indicates that the update occurred in the paper Some of my favorite problems and results, in The Mathematics of Paul Erdős, vol. I, Graham, R. L., and Nesetril, J., (eds), 47–67, Springer, Berlin, 1997. (The paper appeared posthumously, and was written in 1996.)

I offer $5000 for a proof (or disproof) of this [problem]. Neither Szemerédi nor Furstenberg's methods are able to settle this but perhaps the next century will see its resolution.

Soifer then tries to identify when the conjecture was first stated.

I searched for evidence in the ocean of his writings, and found three indicators. First, in a paper submitted on September 7, 1982 to Mathematical Chronicle (now called New Zealand
Journal of Mathematics) that appeared the following year [E83.03], Paul writes: "This I conjectured more than forty years ago."

In the same year, 1982, Paul spoke at the Conference on Topics in Analytic Number Theory in Austin, Texas. I read in the proceedings (published in 1985 [E85.34],
p. 60): "I conjectured more than 40 years ago that if $a_1 \lt a_2\lt \dots$ is a sequence of integers for which $\sum_{i=1}^\infty \frac1{a_i}=\infty$ then the $a$'s contain arbitrarily long arithmetic progressions."

Thus, both of these publications indicate that the conjecture was posed before 1942. On the other hand, in the 1986 Jinan, China, Conference proceedings (published in 1989 [E89.35]), Paul writes (p. 142): "About 30 years ago I conjectured that if $\sum_{n=1}^\infty 1/{a_n}=\infty$, then the $a$'s contain arbitrarily long arithmetic progressions." This would date the birth of the conjecture to about 1956.

The cited papers are:

*

*[E83.03]: Combinatorial problems in geometry, Math. Chronicle 12 (1983), 35–54.

*[E85.34]: Some solved and unsolved problems of mine in number theory, in Topics in
Analytic Number Theory (Austin, Tex., 1982), Univ. Texas Press, Austin, TX, 1985, 59–75.

*[E89.35]: Some problems and results on combinatorial number theory, in Graph theory
and its applications: East and West (Jinan, 1986), Ann. New York Acad. Sci. 576, 132–145, New York Acad. Sci., New York, 1989.

For the finitude of $G_k$, see for example ArxiV:math/0703467.
By the way, the conjecture in the 1972 paper you identify seems to be restricted to $3$-term progressions. Even this version remains open (and carries an attached prize of $\\\$250$.)


text:
Q: Is it possible to find the closest point that is on Google Street View I have a program that outputs a coordinate (42.12576, 13.12356 for example), is it possible to find the closest point to that that is on Google Street View using the API, or something like that. I'm using Python for my program.

A: Yes, when using the Street View Static API you can specify both a location and a maximum radius in which the API should search for an image.

location can be either a text string (such as Chagrin Falls, OH) or a
lat/lng value (40.457375,-80.009353) [...]
[...]
radius (default is 50) sets a radius, specified in meters, in which to
search for a panorama, centered on the given latitude and longitude. [...]

An example request would be https://maps.googleapis.com/maps/api/streetview?size=600x300&location=23,42&radius=1234&key=YOUR_API_KEY&signature=YOUR_SIGNATURE
See https://developers.google.com/maps/documentation/streetview/request-streetview for more information.
To get not the image but metadata including its location you can use the metadata endpoint which returns JSON. An example request would be  https://maps.googleapis.com/maps/api/streetview/metadata?size=600x300&location=23,42&radius=1234&key=YOUR_API_KEY&signature=YOUR_SIGNATURE
See https://developers.google.com/maps/documentation/streetview/metadata for more information.


text:
Q: dijit/form/Select onSelect event Are there other events that can be registered with dojo/form/Select, except onChange?
I'd need to execute a callback function every time user selects an option, even though he selects the same option as it was selected last time. The options I have tried: onSelect, onClick did not work.
        var spatialSelectionStore = new Memory({
        data: [
            { label: "Rectangle", id: "RECT" },
            { label: "Polygon", id: "POLY" },
            { label: "Circle", id: "CIRC" },
            { label: "Freehand", id: "FREE" }
        ]
    });

    var os = new ObjectStore({ objectStore: spatialSelectionStore });

    spatialQuerySelect = new Select({
        id: "selectionType",
        style: { width: "100px" },
        store: os,
        onChange: activateDrawTool
    }, "cp_selectByShapeId");
    spatialQuerySelect.startup();

A: I found a way to do this, and while it may not be the best way to do it, it seems to work.
I set up an aspect to fire a function after the Select._setValueAttr function executes, which is fired by the widget every time you click on either the menu drop-down or a drop-down item. Because of this, I added a check to make sure the function callback only fires when you click on a menu item (i.e. after the menu has closed). I also had to delete the onChange callback you added to Select manually, as this interfered with the aspect.
HTML

JavaScript
require(["dojo/aspect", "dojo/store/Memory", "dijit/form/Select", "dojo/data/ObjectStore", "dojo/dom-construct", "dojo/dom", "dojo/aspect"], function(aspect, Memory, Select, ObjectStore, domConstruct, dom, aspect) {

    var spatialSelectionStore = new Memory({
        data: [
            { label: "Rectangle", id: "RECT" },
            { label: "Polygon", id: "POLY" },
            { label: "Circle", id: "CIRC" },
            { label: "Freehand", id: "FREE" }
        ]
    });

    var os = new ObjectStore({ objectStore: spatialSelectionStore });

    spatialQuerySelect = new Select({
        id: "selectionType",
        style: { width: "100px" },
        store: os
    }, "cp_selectByShapeId");
    spatialQuerySelect.startup();

    aspect.after(spatialQuerySelect, "_setValueAttr", function() {
        if(spatialQuerySelect.dropDown.isShowingNow === false) {
            alert(spatialQuerySelect.get('value'));
        }
    });

    domConstruct.place(spatialQuerySelect.domNode, dom.byId("foo"), "first");
});

Fiddle
Aspects can be very powerful, but if you use too many and rely on them too heavily, you can end up with a horrible mess of spaghetti code, so I recommend you use them sparingly, and only when necessary.
In case you're not familiar with what they do, you can tell an aspect to fire before, after, or around another method, and the aspect will "listen" to that method being fired and behave appropriately with your function callback. Further documentation.

A: spatialQuerySelect.dropDown.on("execute",function() {
alert(spatialQuerySelect.get('value'));
});

this would also work for all option.
onExecute: function(){
            // summary:
            //      Attach point for notification about when a menu item has been executed.
            //      This is an internal mechanism used for Menus to signal to their parent to
            //      close them, because they are about to execute the onClick handler.  In
            //      general developers should not attach to or override this method.
            // tags:
            //      protected
        },


text:
Q: Menu Views and Permissions I am building an app, in my app i am want to have a page for an admin to manage user menu permissions.  What this means is that supposing i have the following menus:
Products
-Add
-Edit
-View
-Delete

And
 Users
    -Add
    -Edit
    -View
    -Delete

Now i want User A to be only able to see and go to:
Products:
-View

And
Users:
-View

The rest of the menu items will be invisible and inaccessible to User A.
What i have set out to do is to create tables for this in my database:
menu_groups
-id
-name
-description

menu_items
-id
-menu_group_id
-name
-state
-description

Menu groups table will hold all top-level menu items, in this case: products and users.
Menu items table will hold sub menu items: eg. Add, Edit, View, Delete
Now when the app loads i plan on checking user permissions then loading these menu items from the database, displaying and then caching them.  Obviously i will put a filter/middleware or whatever it's called on those routes on the server so no one can bypass it.
My question now is, is this the right way of doing it? In terms of security, efficiency etc.  Or is there another simple way of achieving this?
I use mysql for my database, laravel-5 on my server and angularjs for client side.

A: I did something similar with my application, it's a good solution. When a user tries to access a forbidden section on my website, laravel returns a 401 error which I catch automatically in my angular application by an interceptor.
$httpProvider.interceptors.push(function() {
    return {
        'responseError': function(rejection) {
            if(rejection.status === 401) {
                //Redirect to login, show error etc.
            }
        };
    });


text:
Q: How do I avoid the SSL error using hipchat-api on Ruby 1.9.3? I am getting the below error when I am trying to send a message or perform any action.

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate
  B: certificate verify failed

This error occurs only on ruby 1.9.3 p484. Works fine on 1.8.7.
I came across other similar issues(not specific to hipchat-api gem) and one of the solutions provided was to set the verify_mode to OpenSSL::SSL::VERIFY_NONE. I tried it but isn't working for me or I am not sure if I am doing it right. Can anyone let me know what needs to be done..
Thanks in advance.

A: Looks like your SSL certificates need to be updated.  If you're using RVM, you can use their tool to update.  Try
 rvm osx-ssl-certs update all

See http://rvm.io/support/fixing-broken-ssl-certificates for more details on updating using RVM.

A: I Just downgraded the httparty gem to a older version(0.11.0) and that worked for me.


text:
Q: Redirect for HTTP POST does not work in SvelteKit In SvelteKit I want to handle a post request and redirect to a route on success. This should be possible by sending a status code of 303 and the location header - as in the SvelteKit docs. Unfortunately, it does not work. In the Dev tools you see the 303 response, but the redirect is not handled. Of course, there are workarounds (for example, a redirect on the client, or directly post to the desired page), but I would like to know why this error happens.
Stackblitz: https://stackblitz.com/edit/sveltejs-kit-template-default-z9rs2c
index.svelte

 <button on:click={submit}>Click me</button>

endpoint.js
export function post() {
    console.log('got post request at endpoint');
    return {
        status: 303,
        headers: {
            location: '/success'
        }
    };
 }

success.svelte

Success

A: HTTP POST redirect is handled by web browsers only if you are using native <form method=POST> HTML construct.
You are using fetch() API, which is very different. Thus you need to handle the redirect yourself.
You can do this by extracting location from the fetch() response headers and then calling manually goto() from $app/navigation.


text:
Q: How to get the average score of a department using sql I want to get the average score of all department in my database, I have a query that get the average score of just one department, is there a way I can get the name of the department and their average score.
Lets assume I have 2 departments(Server and IT), The average of the server is the sum of all score of the people in that department divided by the total number of the department.
Here is a query I Have, but it's just the average of one department
SELECT SUM(RatingId)/(select COUNT(Id) from Employee where DepartmentId = 5) as Sums
FROM PerformanceReviewRatings pfr join
     Employee e
     on pfr.EmployeeId = e.Id join
     Department d
     on d.Id = e.DepartmentId
WHERE pfr.AppraisalId = 1009;

A: Use group by
SELECT e.DepartmentId, d.name,
       SUM(RatingId)/COUNT(1) as Sums
  FROM PerformanceReviewRatings pfr
  JOIN Employee e
    ON pfr.EmployeeId = e.Id
  JOIN Department d
    ON d.Id = e.DepartmentId
 WHERE pfr.AppraisalId = 1009
 GROUP BY e.DepartmentId, d.name

A: Assuming an employee gets only one rating, you don't need a subquery or a reference to the Department table:
SELECT e.DepartmentId,
       SUM(RatingId)/COUNT(*) as average_rating
FROM Employee e LEFT JOIN
     PerformanceReviewRatings pfr
     ON pfr.EmployeeId = e.Id AND
        pfr.AppraisalId = 1009
GROUP BY e.DepartmentId;

If you only want the average of employees with ratings -- rather than one your question asks (which is to treat unrated employees as 0s -- then:
SELECT e.DepartmentId, AVG(RatingId) as average_rating
FROM Employee e JOIN
     PerformanceReviewRatings pfr
     ON pfr.EmployeeId = e.Id
WHERE pfr.AppraisalId = 1009
GROUP BY e.DepartmentId

A: Using the AVG() function.
SELECT e.DepartmentId,
       AVG(RatingId) as average_rating
FROM Employee e LEFT JOIN
     PerformanceReviewRatings pfr
     ON pfr.EmployeeId = e.Id AND
        pfr.AppraisalId = 1009
GROUP BY e.DepartmentId


text:
Q: How to collect images and text from pdf catalogue in javascript/AngularJS sample picssample image
In this catalog there are 4 images and 5 description and a title and price. I need to collect all these things from the image by using JavaScript. Help in this regard will be appreciated
// script
var input = document.getElementById("input");
var processor = document.getElementById("processor");
var output = document.getElementById("output");

window.addEventListener("message", function(event){
    if (event.source != processor.contentWindow) return;

    switch (event.data){
        case "ready":
            var xhr = new XMLHttpRequest;
            xhr.open('GET', input.getAttribute("src"), true);
            xhr.responseType = "arraybuffer";
            xhr.onload = function(event) {
                processor.contentWindow.postMessage(this.response, "*");
            };
            xhr.send();
            break;

        default:
            output.textContent = event.data.replace(/\s+/g, "");
            break;
    }
}, true);

// these code got from net- to collect text from pdf , i need to collect images also.
// embed the pdftotext web app as an iframe

// a container for the output -->

Extracting text from a PDF file using only Javascript.
Tested in Chrome 16 and Firefox 9.

   //  the PDF file must be on the same domain as this page -->


text:
Q: Creating new records with comma delimited values I have a table in worksheet1 where one column "G" allows multiple values that are separated by comma, e.g. 12,24,72. In worksheet2, I want to read the table or worksheet1 and write new records (rows) with select columns C & G. If a comma is identified in G, worksheet1 I would like to have it create a new row for each instance in worksheet2.
Worksheet1
ID(A) | Name(C) | Period(G)
1     | Paul    | 12
2     | Sam     | 12,14,72
3     | Karen   | 36

Worksheet2
Paul  | 12
Sam   | 12
Sam   | 14
Sam   | 72
Karen | 36

A: Try following code (comments are in code):
Option Explicit
Sub FillWS()
    Dim ws1 As Worksheet, ws2 As Worksheet
    ' Set references to worksheets
    Set ws1 = Worksheets("Worksheet1")
    Set ws2 = Worksheets("Worksheet2")
    ' Determine last row in column C in worksheet1
    Dim lastRow As Long
    lastRow = ws1.Cells(ws1.Rows.Count, 3).End(xlUp).Row

    Dim i As Long, j As Long, currentRow As Long, name As String, period() As String
    currentRow = 1
    ' Loop through first worksheet
    For i = 1 To lastRow
        name = ws1.Cells(i, 3).Value
        period = Split(ws1.Cells(i, 7).Value, ",")
        For j = LBound(period) To UBound(period)
            ws2.Cells(currentRow, 1) = name
            ws2.Cells(currentRow, 2) = period(j)
            currentRow = currentRow + 1
        Next
    Next
End Sub


text:
Q: target location after pressing enter This is probably a very simple thing, but I'm very new to Javascript and HTML5 and can't seem to find an answer to my question.
I'm currently developing an app for Samsung Smart TV.
I currently have 2 major files: Main.js and index.html, in which most of my code is written. Also, I have a style sheet called Main.css.
My problem: I have a button the screen, that when pressing it (that is, when pushing enter on the remote), I want the screen to change in to a completely different one (from welcome screen to admin settings). How do I do that??
Hope my question is not too general. Any help would be appreciated.

A: You should divide your index.html with divs that represent a scene. To make it easy please use Basic Project it will generate a pattern to split the html/css/js like different pages and you only need to call sf.scene.show("SettingsScene")
If you're using javascript project, then the answer from user3384518 is the only way. Like i mentioned above, split your body to several divs and do hide/show the div

A: Your question is clear, but you don't say if you use a library (or not).
So, if you use jQuery :
$('.myButtonName').click(function () {
    $('#myWelcomScreenDiv').hide(200, function () {
        $('#myAdminSettingsDiv').show(200);
    });
});

But, if you would like to do something better, I recommend you to use a framework like Backbone.js or Angular.js.


text:
Q: Adding TypeScript to exsisting React Project (Not create-react-app) I have been looking everywhere for a place to tell me how to add tsx compilers to an existing react project.  This was not a create-react-app.  Is it possible to use both TSX and JSX files in the same project?  I don't want to do everything in TSX, but I definitely want to get some practice in and don't want to convert the whole thing.  Do you guys have any places I can go look for this?  Here is my webpack.config for reference (if you know a way I can add lmk)
Version:  "react": "^16.8.1",
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {

    devtool: 'inline-source-map',

    plugins: [
        new HtmlWebpackPlugin({
            template: './src/index.html',
            filename: "./index.html"
        }),
        new MiniCssExtractPlugin({
            // Options similar to the same options in webpackOptions.output
            // both options are optional
            filename: "/static/cs/styles.css",
            chunkFilename: "styles.css"
        })

    ],

    entry: './src/index.js',
    output: {
        path: path.join(__dirname, 'build'),
        filename: 'static/js/bundle.js'
    },
    module: {

        rules: [

            {
                test: /\.s?css$/,
                use: [
                    "style-loader",
                    MiniCssExtractPlugin.loader,
                    "css-loader",
                    "sass-loader"
                ]
            },

            {
                use: { loader: 'babel-loader' },
                test: /\.js$/,
                exclude: /node_modules/
            },
            {
                test: /\.(png|svg|jpg|gif)$/,
                use: [
                    {
                        loader: 'file-loader',
                        options: {
                            outputPath: '',
                        },
                    }

                ]
            },

        ]
    },

    devServer: {

        contentBase: path.join(__dirname, 'build'),

    },

}


text:
Q: Error in pushing Discord bot to Heroku: Push rejected, failed to compile Node.js app I am having trouble pushing changes that I have made to my Discord bot to heroku.
I have updated my node to version 12.18.2 and my Discord.js to version 12 after I have done this I tried to push the changes to Heroku but Heroku keeps on rejecting my push. I am not sure what the problem exactly is.
My Heroku log:
-----> Node.js app detected

-----> Creating runtime environment

       NPM_CONFIG_LOGLEVEL=error
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       NODE_VERBOSE=false

-----> Installing binaries
       engines.node (package.json):  unspecified
       engines.npm (package.json):   unspecified (use default)

       Resolving node version 12.x...
       Downloading and installing node 12.18.2...
       Using default npm version: 6.14.5

-----> Restoring cache
       - node_modules is checked into source control and cannot be cached

-----> Installing dependencies
       Prebuild detected (node_modules already exists)
       Rebuilding any native modules

       > ffmpeg-binaries@4.0.0 install /tmp/build_71e019d8/node_modules/ffmpeg-binaries
       > node install

       internal/modules/cjs/loader.js:969
         throw err;
         ^

       Error: Cannot find module '/tmp/build_71e019d8/node_modules/decompress-tarxz/node_modules/lzma-native/binding-v3.0.8-node-v72-linux-x64/lzma_native.node'
       Require stack:
       - /tmp/build_71e019d8/node_modules/decompress-tarxz/node_modules/lzma-native/index.js
       - /tmp/build_71e019d8/node_modules/decompress-tarxz/index.js
       - /tmp/build_71e019d8/node_modules/ffmpeg-binaries/install.js
           at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
           at Function.Module._load (internal/modules/cjs/loader.js:842:27)
           at Module.require (internal/modules/cjs/loader.js:1026:19)
           at require (internal/modules/cjs/helpers.js:72:18)
           at /tmp/build_71e019d8/node_modules/decompress-tarxz/node_modules/lzma-native/index.js:13:14
           at Object.<anonymous> (/tmp/build_71e019d8/node_modules/decompress-tarxz/node_modules/lzma-native/index.js:597:3)
           at Module._compile (internal/modules/cjs/loader.js:1138:30)
           at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
           at Module.load (internal/modules/cjs/loader.js:986:32)
           at Function.Module._load (internal/modules/cjs/loader.js:879:14) {
         code: 'MODULE_NOT_FOUND',
         requireStack: [
           '/tmp/build_71e019d8/node_modules/decompress-tarxz/node_modules/lzma-native/index.js',
           '/tmp/build_71e019d8/node_modules/decompress-tarxz/index.js',
           '/tmp/build_71e019d8/node_modules/ffmpeg-binaries/install.js'
         ]
       }
       npm ERR! code ELIFECYCLE
       npm ERR! errno 1
       npm ERR! ffmpeg-binaries@4.0.0 install: `node install`
       npm ERR! Exit status 1
       npm ERR!
       npm ERR! Failed at the ffmpeg-binaries@4.0.0 install script.
       npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

       npm ERR! A complete log of this run can be found in:
       npm ERR!     /tmp/npmcache.7XYhs/_logs/2020-07-16T19_21_22_644Z-debug.log
-----> Build failed

       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys

       Some possible problems:

       - node_modules checked into source control
         https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits

       - Node version not specified in package.json
         https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

       - A module may be missing from 'dependencies' in package.json
         https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies

       Love,
       Heroku

 !     Push rejected, failed to compile Node.js app.
 !     Push failed```


text:
Q: How do I disable the warning "The backup of this post in your browser is different from the version below"? I have a small filter below. It does a regular expression replace of a particular string when the user saves the draft.
However, using this filter causes the warning "The backup of this post in your browser is different from the version below."
Is there a way to 'tell' Wordpress not to display the warning when that filter runs?
To re-create:

*

*Create a draft post.

*In the body, enter a line of text:
rcq[whatever]
eg.
rcqTestMsg

*Save the draft.
Here is the code.
UPDATE: WHAT I THINK IS GOING ON: I think that somehow this is triggering the autosave.js CheckPost() function which (apparently) compares the text on screen with the current saved version. Is there a way to disable the autosave or revision just when this filter is triggered? Or is there something in my code that is confusing the revision system?

 function jchwebdev_rant_quote_question( $content ) {
    global $post;
    $pattern = '/rcq/';
    $replacement = 'RC$1';
    if ($post->post_status == 'draft') {
      return preg_replace($pattern, $replacement, $content);
    }
    else
      return $content;
  }
  add_filter( 'content_save_pre' , 'jchwebdev_rant_quote_question' , 10, 1);

A: The way to avoid this error is to make sure the wp-saving-post cookie is being set to a value of [post id]-saved, as seen here. As you can see, if that occurs, then WordPress won't complain about the difference, because it then knows that the post was saved properly.
Also take a look at this line and note that WordPress handles this for you already. So the error you're seeing, it likely has to do with some mild cookie corruption in your browser.
I ran several tests with your plugin and I was unable to reproduce the issue that you reported. So my feeling is that you should clear all browser cookies for your domain and eliminate the possibility of corruption causing the problem. Also be sure to do a review of WordPress config settings related to cookie storage. If there's something wrong with cookie settings on your site, it may have an impact on the behavior that you're seeing when running tests against this.
Finally, check to be sure you're not filtering the content, and then immediately redirecting, or exiting the script, or doing something else that would prevent this line from running once your filter is applied. That too, may lead to the problem that you're seeing.

A: i think javascript will help you. Use this code, and see if it helps:
add_action( 'add_meta_boxes', function () { add_meta_box('myhtml_ID_123',  'smth', 'draft_title_remover');} );
function draft_title_remover( $post ) { ?>
    <script>
    nIntervId = setInterval(RemoveMyDiv, 1000);
    function RemoveMyDiv() {
      if(document.getElementById("message")){
          var x = document.getElementById("message");
          if( x.innerHTML.indexOf("The backup of this post in your browser") > -1){
            x.style.display="none";
          }
      }
    }
    </script>
    <?php
}

A: If you want to forcefully turn off the notification, you can use this snippet:
add_action('in_admin_footer', function(){
  remove_action('admin_footer', '_local_storage_notice');
});

in_admin_footer is the nearest action before admin_footer in wordpress/wp-admin/admin-footer.php, and it always runs, so it's a nice place to prevent running _local_storage_notice() which emits the dialog's content.

A: The possible reason of getting warning can be solved from your wp-config.php file. Check if in this file WP_DEBUG is true or false. If you don't want to see warnings then it must be set to false like this
define('WP_DEBUG', false);

If your WP_DEBUG is true (define('WP_DEBUG', true);) then simply make it false(define('WP_DEBUG', false);).
However if this don't work for your then try to replace your WP_DEBUG
Change your following line of code
define('WP_DEBUG', false);

Into this
ini_set('log_errors','On');
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

Note: Before trying any change in this file, first take backup of it Because if you mistakenly did any mistake while changing code then it may cause some unwanted problems.


text:
Q: How do I use material ui date clicker on a regular css element? https://codesandbox.io/s/busy-glitter-butkvc?file=/src/App.js:0-977
Basically, I have this table

        column 1
        column 2
        end date
        column 4
        column 5
        column 6

      row 1
      row 1
      3/18/2022
      row 1
      row 1
      row 1

      row 1
      row 1
      3/25/2022
      row 1
      row 1
      row 1

I want to click on the date cell and have the date picker box open and let me choose a date. I looked through material ui and found date picker but it seems to only be used on textfield. Any way to achieve the on click if i were to click on the span element ?
Something like this but start time not needed just the date

A: Managed to figure it out by trying out props from the doc and some css
  const [date, setDate] = React.useState(new Date());
  const [open, setOpen] = React.useState(false);

  React.useEffect(() => {
    console.log(date);
    setOpen(false);
  }, [date]);

  const openDatePicker = () => {
    setOpen(true);
  };

using the props open and display: none on the textfield
<LocalizationProvider dateAdapter={AdapterDateFns}>
    <DatePicker
      open={open}
      value={date}
      onChange={(newValue) => setDate(newValue)}
      renderInput={(params) => (
        <TextField {...params} style={{ display: "none" }} />
      )}
    />
</LocalizationProvider>

https://codesandbox.io/s/busy-glitter-butkvc?file=/src/App.js:270-514
However, preferably I wanted it like a drop down, not to side. Not sure if MUI can do that though.


text:
Q: Как составить запрос, чтобы из одного SELECT взять массив с переменными и уже в другом SELECT использовать этот массив для другого массива? Есть функция, по которой надо вывести пользователей определенного саппорта.
Есть 2 таблицы.
supports_user:
id | support_id | client_id
1  |     2      |    10
2  |     2      |     9
3  |     2      |     8

users :
id | status |
8  |    3   |
9  |    3   |
10 |    3   |

Нужно из таблицы "supports_user" найти все "client_id" одного саппорта,
и положить все значения в массив $client_id.
Далее с помощью значений из этого массива найти всех пользователей из второй выборки и поместить данные уже в другой массив, который я и буду выводить.
Вот то что получилось, но не работает.
Вызываю функцию users в controller.
$users=users($id);

Сама функция в model.
function users($id){
global $connection;
$query = "SELECT * FROM supports_user WHERE support_id = '$id' ORDER BY id DESC ";
$res = mysqli_query($connection, $query);
$client_id = array();
while($row = mysqli_fetch_assoc($res)){
    $client_id[$row['client_id']] = $row;
}

foreach($client_id as $val) {
    $query = "SELECT * FROM users WHERE status='3' AND id = '$val' ORDER BY id DESC ";
    $res = mysqli_query($connection, $query);
}
    $users = array();
    while ($row = mysqli_fetch_assoc($res)) {
        $users[$row['id']] = $row;
    }
    return $users;}

А выводить это всё в шаблоне
<?php foreach($users as $use): ?>

и т.д.
Подскажите, что не так или как это сделать по другому, заранее спасибо.

A: Делайте одним запросом
SELECT u.* FROM users u
JOIN supports_user s ON s.client_id = u.id
WHERE u.status='3' AND s.support_id = '$id'

$id - переменная которую передаете в функцию users($id)
Результатом запроса будет выборка из таблицы пользователей (users)


text:
Q: Calendário em PHP Alguém sabe como eu coloco um loop nesse calendário, só preciso que ele imprima as datas cadastradas no meu banco.
Da um erro na query:

Warning:  mysql_fetch_array() expects parameter 1 to be
  resource, boolean given in
  C:\xampp\htdocs\Shamcey\functions.php on line 198

function MostreSemanas() {
    $semanas = "DSTQQSS";

    for( $i = 0; $i < 7; $i++ )
        echo "".$semanas{$i}."	";

}

function GetNumeroDias( $mes ) {
    $numero_dias = array(
        '01' => 31, '02' => 28, '03' => 31, '04' =>30, '05' => 31, '06' => 30,
        '07' => 31, '08' =>31, '09' => 30, '10' => 31, '11' => 30, '12' => 31
    );

    if (((date('Y') % 4) == 0 and (date('Y') % 100)!=0) or (date('Y') % 400)==0) {
        $numero_dias['02'] = 29;    // altera o numero de dias de fevereiro se o ano for bissexto
    }

    return $numero_dias[$mes];
}

function GetNomeMes( $mes ) {
    $meses = array(
        '01' => "Janeiro", '02' => "Fevereiro", '03' => "Março",
        '04' => "Abril",   '05' => "Maio",      '06' => "Junho",
        '07' => "Julho",   '08' => "Agosto",    '09' => "Setembro",
        '10' => "Outubro", '11' => "Novembro",  '12' => "Dezembro"
    );

    if( $mes >= 01 && $mes <= 12)
        return $meses[$mes];

        return "Mês deconhecido";
}

function MostreCalendario( $mes  ) {

    $numero_dias = GetNumeroDias( $mes );   // retorna o número de dias que tem o mês desejado
    $nome_mes = GetNomeMes( $mes );
    $diacorrente = 0;

    $diasemana = jddayofweek( cal_to_jd(CAL_GREGORIAN, $mes,"01",date('Y')) , 0 );  // função que descobre o dia da semana

    echo "\n
".$nome_mes."
";
    echo "\n
";
        echo "
";
        MostreSemanas();
        echo "
";

    for( $linha = 0; $linha < 6; $linha++ ) {
        echo "
";

        for( $coluna = 0; $coluna < 7; $coluna++ ) {
            echo "<td";

            if( ($diacorrente == ( date('d') - 1) && date('m') == $mes) ) {
                echo " id='dia_atual' ";
            }

            else {
                if(($diacorrente + 1) <= $numero_dias ) {

                    if( $coluna < $diasemana && $linha == 0) {
                        echo " id='dia_branco' ";
                    }
                    else {
                        echo " id='dia_comum'";
                    }
                }
                else {
                    echo " ";
                }
            }

            echo ">";

            /* TRECHO IMPORTANTE: A PARTIR DESTE TRECHO É MOSTRADO UM DIA DO CALENDÁRIO (MUITA ATENÇÃO NA HORA DA MANUTENÇÃO) */
            if( $diacorrente + 1 <= $numero_dias ) {

                if( $coluna < $diasemana && $linha == 0) {
                    echo " ";
                }
                else {
                    //echo "<input type = 'button' id = 'dia_comum' name = 'dia".($diacorrente+1)."'  value = '".++$diacorrente."' onclick = \"acao(this.value)\">";
                    $query = mysql_query("SELECT data FROM _atendimento_medico WHERE date_format(data, '%m') = '$mes'");
                    while($resposta = mysql_fetch_array($query)) {

                    if($diacorrente == ( date( 'd', strtotime( $resposta['data']) && date( 'm', strtotime( $resposta['data'] == $mes) ) ) )) {
                        echo "".++$diacorrente . "";
                    }
                    else {
                        echo "".++$diacorrente . "";}
                }

                }
            }
            else {
                break;
            }
            /* FIM DO TRECHO MUITO IMPORTANTE */

            echo "	";
        }
        echo "
";
    }
    echo "
";
}

function MostreCalendarioCompleto() {
    echo "
";
        echo "
";
        echo "
";
        echo "
";
            MostreCalendario(date('m'));
        echo "
";
        echo "
";
        echo "
";

    $cont = 1;
    for( $j = 0; $j < 4; $j++ ) {
        for( $i = 0; $i < 3; $i++ ) {

            echo "
";
            echo "
";
            echo "
";
                MostreCalendario( ($cont < 10 ) ? "0".$cont : $cont );

            $cont++;
            echo "
";
            echo "
";
            echo "
";

        }
    }
    echo "
";
}

A: O erro obtido está a dar conta que a função mysql_fetch_array() espera um recurso mas recebeu um boleano:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\Shamcey\functions.php on line 198

Em suma, isto verifica-se quando a função mysql_query() não foi bem sucedida, tendo devolvido FALSE, como podemos ler na documentação:

Para comandos SELECT, SHOW, DESCRIBE ou EXPLAIN, mysql_query() retorna um resource em caso de sucesso, ou FALSE em caso de falha.
Para outros tipos de consultas SQL, UPDATE, DELETE, DROP, etc, mysql_query() retorna TRUE em caso de sucesso ou FALSE em caso de erro.

Solução
O que deverias fazer é verificar o sucesso da consulta antes de tentares utilizar dados provenientes da mesma. Desta forma tens acesso ao erro e podes agir em conformidade para o resolver:
// Ligação
$dbConn = mysql_connect("localhost", "mysql_user", "mysql_password");

// Selecionar Base de dados
mysql_select_db("minhaBaseDados", $dbConn);

// Consulta
$query = "
SELECT data
FROM _atendimento_medico
WHERE date_format(data, '%m') = '$mes'";

// Consultar a base de dados
$result = mysql_query($query);

// Verificar se obtivemos um erro
if ($result === false) {
    die(mysql_errno($dbConn) . ": " . mysql_error($dbConn) . "\n");
}

// Continuar com o trabalho
while($resposta = mysql_fetch_array($result)) {
    // ...
}

A: Penso que o teu erro está na consulta:
$query = mysql_query("SELECT data FROM _atendimento_medico
                      WHERE date_format(data, '%m') = '$mes'");

Estás a utilizar uma função a seguir a where date_format(data, '%m') no lugar do nome do campo/coluna onde pretendes fazer a consulta.

A: Estou usando este mesmo algoritmo de calendário com pequenas adaptações, segue o trecho onde listo os Eventos (registros no banco) no calendário, lembrando que este trecho está dentro do loop de geração das colunas:
$dataCalendario = formataDia($diacorrente+1)."/".$mes."/".$ano;

                    # PESQUISANDO SE O USUÁRIO TEM ALGUM EVENTO CADASTRADO EM DETERMINADA DATA
                    $pdo2 = Connection::Conexao();
                    $sql2 = "SELECT * FROM EVENTOS as evt WHERE evt.USUARIOS_idUSUARIO=".$id." AND evt.DATA='".$dataCalendario."'";
                    $query2 = $pdo2->prepare($sql2);
                    $query2->execute();

                    # SE HOUVER EVENTO NO BANCO NA DATA, MOSTRA DESCRIÇÃO DO EVENTO NA RESPSCTIVA DATA
                    if( $query2->rowCount() > 0) {

                        echo "".++$diacorrente.'';

                        # PEGANDO TODOS OS EVENTOS ENCONTRADOS PARA A DATA E LISTA NO CALENDÁRIO
                        while($reg = $query2->fetch(PDO::FETCH_ASSOC)) {

                            $descArray = array($reg["idEVENTO"] => $reg["TITULO"]);

                            foreach ($descArray as $value) {
                                echo "
 ".$value."";
                            }
                        }

                    } else {

                        echo "".++$diacorrente.'';
                    }

unset($descArray);
unset($pdo2);
unset($query2);
$sql2="";


text:
Q: Query that finds connection (friend, friend of friend) too slow If two users are friends, I have one entry in the "friends" table for them like this:
   table: friends
   ------------------------
   uid1           uid2
   332            333

Now let's say a new user (with uid=100) joins. My app finds the users near her, and then tries to show their connection (fb friends, friends of friends, etc.) to her. I use this query for this purpose:
           SELECT (fr.id IS NOT NULL)+(f2.id IS NOT NULL)*2+(fr.id IS NULL AND f2.id IS NULL)*3 AS connection
           FROM users u
           LEFT JOIN friends AS fr ON ((fr.uid1='100' AND fr.uid2=u.uid) OR (fr.uid1=u.uid AND fr.uid2='100'))
           LEFT JOIN (friends AS f1, friends AS f2) ON fr.id IS NULL AND
           (
            (f1.uid1='100' AND f1.uid2=f2.uid1 AND f2.uid2=u.uid) OR
            (f1.uid2='100' AND f1.uid1=f2.uid1 AND f2.uid2=u.uid) OR
            (f1.uid2='100' AND f1.uid1=f2.uid2 AND f2.uid1=u.uid) OR
            (f1.uid1='100' AND f1.uid2=f2.uid2 AND f2.uid1=u.uid)
           )
           WHERE [location near her]

This query will find people near the new user, and for each one the value of "connection" will be 1 if friends with the new user, 2 if they have a common friend, and 3 otherwise.
The query used to work okay but now that I have just a little more users (10,000) it has become very slow (takes 10 seconds to find the type of connection for just 10 people near the new user).
Is there something I'm doing completely wrong in my query or database scheme? I know that defining indices will make things faster but still I think taking 10 seconds for such simple query is very long. I'd appreciate any suggestions.

A: I worked on sqlfiddle to stick with your question.
This is what I suggest :

*

*Do not use OR condition in left join, it's a performance killer, better to do 2 joins or more than using OR

*Do not use fr.id IS NULL in 2nd left join (Performance killer), instead use it in select part : (fr.id IS NOT NULL)+(fr.id IS NULL AND f2.id IS NOT NULL)*2

*Use CASE WHEN [cond] THEN [type_connection] ELSE 3 END to show 1/2/3 type of connection (More readable)

Here is my suggested code (exemple : new user with uid=1) :
SELECT
    u.uid
    ,CASE
        WHEN directFriend.frUid IS NOT NULL THEN 1
        WHEN commonFriend.frUid IS NOT NULL THEN 2
        ELSE 3
    END as connection
FROM
    users u
    LEFT JOIN(
            SELECT
                u.uid as frUid
            FROM
                users u
                LEFT JOIN friends as fr1
                    ON fr1.uid1='1'
                    AND fr1.uid2=u.uid
                LEFT JOIN friends as fr2
                    ON fr2.uid1=u.uid
                    AND fr2.uid2='1'
            WHERE
                fr1.uid2 IS NOT NULL
                OR fr2.uid1 IS NOT NULL) as directFriend
        ON directFriend.frUid = u.uid
    LEFT JOIN(
            SELECT
                CASE
                    WHEN common1.uid2 IS NOT NULL THEN common1.uid2
                    WHEN common2.uid1 IS NOT NULL THEN common2.uid1
                END as frUid
            FROM
                users u
                LEFT JOIN friends as fr1
                    ON fr1.uid1='1'
                    and fr1.uid2=u.uid
                LEFT JOIN friends as fr2
                    ON fr2.uid2='1'
                    and fr2.uid1=u.uid
                LEFT JOIN friends as common1
                    ON common1.uid1 = fr1.uid2
                    AND common1.uid1 = u.uid
                LEFT JOIN friends as common2
                    ON common2.uid2 = fr2.uid1
                    AND common2.uid2 = u.uid
            WHERE
                common1.uid2 IS NOT NULL
                OR common2.uid1 IS NOT NULL) as commonFriend
    ON commonFriend.frUid = u.uid

Here is the sqlfiddle demo used
Hope it helps :)


text:
Q: Issue with Formula for complicated text not working So the issue i have is on the sheet below Column G formula is the same as Column H, but it is not working, i believe it is because of the complicated text it is looking for, any help is appreciated
https://docs.google.com/spreadsheets/d/1nEeulAtoiHS810VyafJCu07EyvN6xIHjdaQo46Wb5ys/edit#gid=0

A: Most likely this is due to the fact that square brackets are used in your data. Those represent a character class in regex. I changed the formula you had so that it now replaces those brackets. Result can be seen in the duplicated sheet, starting in G2. The formula I used is
=INDEX(QUERY({regexreplace('All Report'!$B$1:$B, "\[|\]",),'All Report'!$C$1:$C},"select count(Col1) where (Col1 matches '"&JOIN("|",REGEXREPLACE($M$2:$M$4, "\[|\]",))&"') and Col2='"&$A2&"' label count(Col1) ''"))

An alternative formula could be
=COUNTA(FILTER('All Report'!$B:$B, match('All Report'!$B:$B, $M$2:$M$4, 0), 'All Report'!$C:$C = $A2 ))

or even
=SUMPRODUCT(FILTER('All Report'!$C:$C, match('All Report'!$B:$B, $M$2:$M$4, 0))=$A2 )

See if that helps?


text:
Q: heap corruption detected after free Why am I getting an error Heap Corruption Detected after normal block when I trying to free the string?
I read a name from a text file into a string (nameS), and after I used this string I try to "free" the memory
    char c;
    int phy = 0;
    int log = 1;
    char *nameS = (char *)malloc(log * sizeof(char));
    int id;

    checkallo(nameS);
    c = fgetc(f);

    while (c != ' ') {
        if (log == phy) {
            log = log * 2;
            nameS = (char *)realloc(nameS, log * sizeof(char));
            checkallo(nameS);
        }
        nameS[phy] = c;
        phy++;
        c = fgetc(f);
    }
    nameS[phy] = '\0';
    phy++;

    if (log > phy) {
        nameS = (char *)realloc(nameS, phy * sizeof(char));
        checkallo(nameS);
    }

    id = findInsId(InstTree, nameS);

    free(nameS); // <--- the problem

    return (id);

A: You must ensure there is enough space for the null terminator. For example if the user enters an one character word, phy and log will be 1 at the beginning of the second iteration, when the test while (c != ' ') stops the loop and nameS[phy] = '\0'; writes beyond the end of the allocated array, causing undefined behavior (corrupting the heap as you observe).
Also note that c should have type int and you should handle EOF.
Note also that stopping on ' ' only is probably incorrect as words might be separated by other white space characters such as TAB or newline.
Here is a modified version:
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>

#define checkallo(p)  do { if (!(p)) perror("allocation error"); } while (0)

int getInsId(FILE *f) {
    int c;
    int phy = 0;
    int log = 0;
    int id;
    char *nameS = malloc(log + 1);
    checkallo(nameS);

    while ((c = fgetc(f)) != EOF && !isspace(c)) {
        if (log == phy) {
            log = log * 2;
            nameS = realloc(nameS, log + 1);
            checkallo(nameS);
        }
        nameS[phy++] = c;
    }
    nameS[phy] = '\0';

    if (log > phy) {
        nameS = realloc(nameS, phy + 1);
        checkallo(nameS);
    }

    id = findInsId(InstTree, nameS);

    free(nameS);

    return id;
}