text:
Q: WPF - DatePicker Selected Date Validation Rule I have been working on this problem for a while now, I would like to add a validation rule to my DatePicker that will make sure the SelectedDate is between two dates (Upper and Lower limits).
I would also like these two limits to be data bound to other elements, the example I am working with an employee cannot have a birth date before they joined a company for eg.
Here are my classes:
LimitDates:
Public Class LimitDates
    Inherits DependencyObject

    Public Shared ReadOnly UpperLimitDateProperty As DependencyProperty
    Public Shared ReadOnly LowerLimitDateProperty As DependencyProperty

    Shared Sub New()
        Dim metadata As New FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.None)
        UpperLimitDateProperty = DependencyProperty.Register("UpperLimitDate", GetType(Date), GetType(LimitDates))
        LowerLimitDateProperty = DependencyProperty.Register("LowerLimitDate", GetType(Date), GetType(LimitDates))
    End Sub

    Public Property UpperLimitDate As Nullable(Of DateTime)
        Get
            Return CType(GetValue(UpperLimitDateProperty), Nullable(Of DateTime))
        End Get
        Set(value As Nullable(Of DateTime))
            SetValue(UpperLimitDateProperty, value)
        End Set
    End Property

    Public Property LowerLimitDate As Nullable(Of DateTime)
        Get
            Return CType(GetValue(LowerLimitDateProperty), Nullable(Of DateTime))
        End Get
        Set(value As Nullable(Of DateTime))
            SetValue(LowerLimitDateProperty, value)
        End Set
    End Property

End Class

DateValidationRule:
Public Class DateValidationRule
    Inherits ValidationRule

    Public Property FutureDateAllowed As Boolean = True
    Public Property LimitDates As LimitDates

    Public Overloads Overrides Function Validate(value As Object, cultureInfo As CultureInfo) As Windows.Controls.ValidationResult
        Try
            Dim d As Date = CDate(value)
            If Not FutureDateAllowed And d > Now Then
                Return New System.Windows.Controls.ValidationResult(False, "Future dates not allowed")
            End If
            If Not LimitDates Is Nothing Then
                If Not LimitDates.LowerLimitDate Is Nothing Then
                    If d < LimitDates.LowerLimitDate Then
                        Return New System.Windows.Controls.ValidationResult(False, "Date must less then " & LimitDates.LowerLimitDate)
                    End If
                End If
                If Not LimitDates.UpperLimitDate Is Nothing Then
                    If d > LimitDates.UpperLimitDate Then
                        Return New System.Windows.Controls.ValidationResult(False, "Date must not be behond " & LimitDates.UpperLimitDate)
                    End If
                End If
            End If
        Catch ex As Exception
            Return New System.Windows.Controls.ValidationResult(False, "Not in correct format, please input a correct date. Eg. 23-04-2012")
        End Try

        ' If hasn't returned an error already, must be okay
        Return New System.Windows.Controls.ValidationResult(True, Nothing)
    End Function

End Class

And XAML markup for EmployeeView:
<Label Style="{StaticResource EditViewLabel}" Grid.Row="0">Birth Date</Label>
<DatePicker Grid.Row="0" Grid.Column="1" x:Name="dtPkBirthDate" DisplayDateEnd="{Binding ElementName=dtPkStartDate, Path=SelectedDate}">
<DatePicker.SelectedDate>
<Binding Path="Employee.DateOfBirth">
<Binding.ValidationRules>
<local:DateValidationRule FutureDateAllowed="True">
<local:DateValidationRule.LimitDates>
<local:LimitDates UpperLimitDate="4/5/2010" />
      </local:DateValidationRule.LimitDates>
</local:DateValidationRule>
</Binding.ValidationRules>
</Binding>
</DatePicker.SelectedDate>
</DatePicker>

It all looks fine to me, and it does work if the date is hard coded, but when I try binding to another control or to a property of the DataContext, the Limit date value is never set, only the default value of 12:00AM appears in the debugger.
Also how can I set and check if dates are null (VB.net not C# with I am used to)?
Thanks.
Luke
Edit:
Okay so I think I might have worked out a little bit of why, after reading Binding ElementName. Does it use Visual Tree or Logical Tree and http://social.msdn.microsoft.com/Forums/vstudio/en-US/e359b99f-e864-4e9e-b81e-2692f240598f/binding-to-object-in-template-in-another-visual-tree?forum=wpf I think that the binding on DateValidationRule might not be finding the ElementName as both element's are siblings and so in a different visual tree..?
I will keep researching

A: Yup, I'm going with my answer I found... it's impossible!
"ValidationRule is not a dependency object (nor is it in the element tree), so you cannot set bindings on dependency properties on it (nor would they be resolved if you could)." MSDN
I've moved on to using the Infragistics XamDateTimeInput (Which says it's for Silverlight but is also here for WPF). Still doesn't have the validation I want, but I am happy using Value Converters and Business Logic validation.
Thanks


text:
Q: Add new table to EF I have a project in MVC4 (VS 2012) with Entity Framework. I have created a model by connecting to SQL Server 2008. Works great.
Now I want to add one or more tables to the model.
Here's what I did:

*

*opened the .edmx file.

*Right clicked and selected Update model from the database.

*Under the Add tab, it shows Tables, Views and Stored Procedure.

But none of them is selectable. Am I missing something here?

A: Murali, if I understood well, the problem is that you didn't make changes to the database since you've created the model. If this statement is correct, take a look at this:
Add tables starting from the model is a Model-first approach. Starting from code is a Code-first approach. However, you are trying to update the model from a existing database. That is a Database-first approach. For a database-first approach, the steps you mentioned are right.
However, in this approach you shouldn't be trying to develop new tabes starting from the model. Instead, you should open your sql server management studio (or database project) and code the new schema there. Then, after coding the updates in the schema, you go back to your model and follow the steps that you described.
Hope it helps.

A: make sure that your table have at least one primary key in order to get added to the entity model.
It works accurately when your table (which is to be added) have one primary key.

redpajama_set_name: RedPajamaStackExchange


text:
Q: User's input inside an if statement Hello i am begginer with java here's my code:
import java.util.Scanner;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.List;
import java.util.*;

public class Main extends MyZoo {

    public static void main(String[] args) {

        MyZoo a1 = new MyZoo();

        a1.SetAnimal_Name("Tiger");
        a1.SetCohabitation("Mammal");
        a1.SetGender("Female");
        a1.SetWeight(170);
        a1.SetMaximum_Age(15);
        a1.SetAnimal_Code("A01");

        MyZoo a2 = new MyZoo();

        a2.SetAnimal_Name("Taurus");
        a2.SetCohabitation("Mammal");
        a2.SetGender("Male");
        a2.SetWeight(1100);
        a2.SetMaximum_Age(22);
        a2.SetAnimal_Code("A02");

        MyZoo a3 = new MyZoo();

        a3.SetAnimal_Name("Red Deer");
        a3.SetCohabitation("Mammal");
        a3.SetGender("Male");
        a3.SetWeight(200);
        a3.SetMaximum_Age(27);
        a3.SetAnimal_Code("A03");

        MyZoo a4 = new MyZoo();

        a4.SetAnimal_Name("Giraffe");
        a4.SetCohabitation("Mammal");
        a4.SetGender("Female");
        a4.SetWeight(800);
        a4.SetMaximum_Age(30);
        a4.SetAnimal_Code("A04");

        List<MyZoo> List = new ArrayList<>();
        List.add(a1);
        List.add(a2);
        List.add(a3);
        List.add(a4);

        for (MyZoo s: List) { }

        System.out.println("Welcome to MyZoo application.\nPlease select a number from the menu\n" +
                "-------------------------------------\n " +
                "1.View all available zoo animals\n" +
                " 2.Add a new animal\n " +
                "3.Search for an animal by name\n " +
                "4.Search for an animal by code\n " +
                "5.Animal processing based on code\n " +
                "6.Delete animal based on code\n" +
                " 7.Exit from the application" +
                "\n-------------------------------------\n");

        Scanner input = new Scanner(System.in);

        int UserInput;

        while (true) {

            try {
                System.out.print("\nWrite Here: ");
                UserInput = input.nextInt();

            } catch (InputMismatchException e) {
                input.next();
                System.out.print("That's not an integer!Please Try again!");
                continue;

            }

            if (UserInput < 1 || UserInput > 7) {

                System.out.println("The number doesn't exist in the menu!Please try again!");
                continue;
            }
            break;
        }

        if (UserInput == 1) {
            System.out.println("You choose " + UserInput);

            for (int i=0;i<List.size();i++){

                System.out.print("\n\nAnimal name:"+List.get(i).GetAnimal_Name());
                System.out.print("\nCohibiatation:"+List.get(i).GetCohabitation());
                System.out.print("\nGender:"+List.get(i).GetGender());
                System.out.print("\nWeight:"+List.get(i).GetWeight());
                System.out.print("\nMaximum Age:"+List.get(i).GetMaximum_Age());
                System.out.print("\nAnimal Code:"+List.get(i).GetAnimal_Code());

                UserInput = input.nextInt();
                }
        } else if (UserInput == 2) {
            System.out.println("You choose " + UserInput);
        } else if (UserInput == 3) {
            System.out.println("You choose " + UserInput);
        } else if (UserInput == 4) {
            System.out.println("You choose " + UserInput);
        } else if (UserInput == 5) {
            System.out.println("You choose " + UserInput);
        } else if (UserInput == 6) {
            System.out.println("You choose " + UserInput);
        } else if (UserInput == 7) {
            System.out.println("You choose " + UserInput + "\n\nThank you for running the programm!" +
                    "\nI hope you enjoyed!\nTime to exit, bye!");
            System.exit(0);
        }

    }

}

When the User writes 1 , it shows my list but not all the objects and the result is :
Welcome to MyZoo application.
Please select a number from the menu
-------------------------------------
 1.View all available zoo animals
 2.Add a new animal
 3.Search for an animal by name
 4.Search for an animal by code
 5.Animal processing based on code
 6.Delete animal based on code
 7.Exit from the application
-------------------------------------

Write Here: 1
You choose 1

Animal name:Tiger
Cohibiatation:Mammal
Gender:Female
Weight:170
Maximum Age:15
Animal Code:A01

But i want the result to be like this:
Welcome to MyZoo application.
Please select a number from the menu
-------------------------------------
 1.View all available zoo animals
 2.Add a new animal
 3.Search for an animal by name
 4.Search for an animal by code
 5.Animal processing based on code
 6.Delete animal based on code
 7.Exit from the application
-------------------------------------

Write Here: 1
You choose 1

Animal name:Tiger
Cohibiatation:Mammal
Gender:Female
Weight:170
Maximum Age:15
Animal Code:A01

Animal name:Taurus
Cohibiatation:Mammal
Gender:Male
Weight:1100
Maximum Age:22
Animal Code:A02

Animal name:Red Deer
Cohibiatation:Mammal
Gender:Male
Weight:200
Maximum Age:27
Animal Code:A03

Animal name:Giraffe
Cohibiatation:Mammal
Gender:Female
Weight:800
Maximum Age:30
Animal Code:A04

Write here:

with the input here i want to jump off from the if , how can i make that?

A: Why you are having this UserInput = input.nextInt() inside this for loop. This causing you the incorrect behavior.Remove that and try .It will work
       for (int i=0;i<List.size();i++){

            System.out.print("\n\nAnimal name:"+List.get(i).GetAnimal_Name());
            System.out.print("\nCohibiatation:"+List.get(i).GetCohabitation());
            System.out.print("\nGender:"+List.get(i).GetGender());
            System.out.print("\nWeight:"+List.get(i).GetWeight());
            System.out.print("\nMaximum Age:"+List.get(i).GetMaximum_Age());
            System.out.print("\nAnimal Code:"+List.get(i).GetAnimal_Code());

            UserInput = input.nextInt();
      }

A: Here is the refacotored code for your program. Try this, this should work.
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Scanner;

public class Main extends MyZoo {

    public static void main(String[] args) {
 MyZoo a1 = new MyZoo();

        a1.SetAnimal_Name("Tiger");
        a1.SetCohabitation("Mammal");
        a1.SetGender("Female");
        a1.SetWeight(170);
        a1.SetMaximum_Age(15);
        a1.SetAnimal_Code("A01");

        MyZoo a2 = new MyZoo();

        a2.SetAnimal_Name("Taurus");
        a2.SetCohabitation("Mammal");
        a2.SetGender("Male");
        a2.SetWeight(1100);
        a2.SetMaximum_Age(22);
        a2.SetAnimal_Code("A02");

        MyZoo a3 = new MyZoo();

        a3.SetAnimal_Name("Red Deer");
        a3.SetCohabitation("Mammal");
        a3.SetGender("Male");
        a3.SetWeight(200);
        a3.SetMaximum_Age(27);
        a3.SetAnimal_Code("A03");

        MyZoo a4 = new MyZoo();

        a4.SetAnimal_Name("Giraffe");
        a4.SetCohabitation("Mammal");
        a4.SetGender("Female");
        a4.SetWeight(800);
        a4.SetMaximum_Age(30);
        a4.SetAnimal_Code("A04");

        List<MyZoo> List = new ArrayList<>();
        List.add(a1);
        List.add(a2);
        List.add(a3);
        List.add(a4);

        for (MyZoo s: List) {

        System.out.println("Welcome to MyZoo application.\nPlease select a number from the menu\n" +
                "-------------------------------------\n " +
                "1.View all available zoo animals\n" +
                " 2.Add a new animal\n " +
                "3.Search for an animal by name\n " +
                "4.Search for an animal by code\n " +
                "5.Animal processing based on code\n " +
                "6.Delete animal based on code\n" +
                " 7.Exit from the application" +
                "\n-------------------------------------\n");

        Scanner input = new Scanner(System.in);

        int UserInput;

        for (int i=0;i<List.size();i++){

                System.out.print("\nWrite Here: ");
                UserInput = input.nextInt();

            if (UserInput < 1 || UserInput > 7) {

                System.out.println("The number doesn't exist in the menu!Please try again!");
                continue;
            }

        if (UserInput == 1) {
            System.out.println("You choose " + UserInput);

            for (int j=0;j<List.size();j++){

                System.out.print("\n\nAnimal name:"+List.get(j).GetAnimal_Name());
                System.out.print("\nCohibiatation:"+List.get(j).GetCohabitation());
           .................... other print
                System.out.println("");
                System.out.println();
                }

        }
        else if (UserInput == 2) {
            System.out.println("You choose " + UserInput);
        } else if (UserInput == 3) {
            System.out.println("You choose " + UserInput);
        } else if (UserInput == 4) {
            System.out.println("You choose " + UserInput);
        } else if (UserInput == 5) {
            System.out.println("You choose " + UserInput);
        } else if (UserInput == 6) {
            System.out.println("You choose " + UserInput);
        } else if (UserInput == 7) {
            System.out.println("You choose " + UserInput + "\n\nThank you for running the programm!" +
                    "\nI hope you enjoyed!\nTime to exit, bye!");
            System.exit(0);
        }
        }
        }

    }
   }


text:
Q: Can I reference another property in messages.properties? if yes, How? I trying to using referencing a property to another property in messages.properties.
when searching for answers in the internet mostly answered like this:
referenced.text.property=Some text
new.text.property=${referenced.text.property}

but it outputs only "${referenced.text.property}" without quotes in thymeleaf.
this code only works on application.properties

A: Order is important!
You need have referenced.text.property before new.text.property
Sample: https://github.com/NoraUi/NoraUi/blob/master/src/test/resources/UnitTest4CLI.properties
in java you can code this order:
protected static Properties initPropertiesFile(ClassLoader loader, String propertiesFileName) {
    if (loader != null) {
        final InputStream in = loader.getResourceAsStream(propertiesFileName);
        final Properties props = new Properties();
        try {
            if (in == null) {
                log.error(Messages.getMessage(CONTEXT_PROPERTIES_FILE_NOT_FOUND), propertiesFileName);
            } else {
                log.info("Reading properties file ({}).", propertiesFileName);
                props.load(in);
            }
        } catch (final IOException e) {
            log.error("error Context.initPropertiesFile()", e);
        }
        log.info("Loaded properties from {} = {}.", propertiesFileName, props);
        return props;
    }
    return null;
}

Springboot:
--spring.config.location=your/path/application.yml

Maven:
<filters>
    <filter>src/main/resources/messages.properties</filter>
</filters>


text:
Q: addEventListener doesn't work properly First let me explain you briefly what I'm trying to do, I have an unordered list with like 10 elements when the page first loads, then whenever the user scroll the list and reach the bottom it loads 10 more elements. I've done this with ajax and it works fine, the problem is that I want that the element clicked by the user has to appear in an input field and I don't know why this doesn't work:
function loadCod(){
$.ajax({
    url: '<%= request.getContextPath() %>/GetMoreCod',
    error: function(){
        var s = "CONNECTION'S ERROR";
        alert(s);
    },
    success: function(data){
        if(data == null) return null;
        if(data.indexOf('|') == -1) return new Array(buffer);
        var arrayCod = data.split('|');

        for(var i = 0; i< arrayCod.length; i++)
        {
            var ul = document.getElementById("menu");
            var li = document.createElement("li");
            $("li").each(function()
                {
                var $li = $(this);
                $li.css("cursor","pointer");
            });
            var a = document.createElement("a");
            a.textContent = arrayCod[i];
            a.addEventListener("click",function(){  //HERE IS THE PROBLEM
            $("#codField").val(arrayCod[i]);},false);
            li.appendChild(a);
            ul.appendChild(li);
        }

    },
    type: "GET"
});

}
Which is strange for me is if here $("#codField").val(arrayCod[i]) instead of arrayCod[i] I put something like "Hello" it does work and it appears in the input.
Another example is that if I write alert(arrayCod[i]) before the addEventListener it shows me the correct value but if I do this inside the addEventListener it shows me nothing.
[EDIT] I checked this but it still doesn't work


text:
Q: Extension mysqli is missing, phpmyadmin doesn't work I have a problem with phpmyadmin on ubuntu 12.04.
I have already installed apache2, php5, mysql and phpmyadmin.
The phpinfo(); script, don't show nothing about mysqli or mysql extension.
When I try start phpmyadmin this error appear:

----
**phpMyAdmin - Error**
-------
**The mysqli extension is missing. Please check your PHP configuration.**
----

In the php.ini file, I uncommented extension=mysql.so line, but doesn't work...
Anyone have another posible solution?

A: Just restart the apache2 and mysql:

*

*apache2: sudo /etc/init.d/apache2 restart

*mysql: sudo /etc/init.d/mysql restart
then refresh your browser, enjoy phpmyadmin :)

A: I tried a lot of the answers and none of them seemed to work because php7.0 is not the default.
sudo apt-get upgrade

seemed to do the job for me but I had to reinstall php7.0 and phpmyadmin after that:
sudo apt-get install php7.0 php7.0-mysql
sudo apt-get install apache2 apache2-mod-php7.0
sudo apt-get install phpmyadmin

Hope it helps!

A: I faced same issue and resolved it by doing following steps:

*

*First check PHP versions. If you have multiple PHP Versions. Suppose you have PHP versions like php7.0, php7.1 and php 7.2 then

*run these commands
For PHP7.0
sudo apt-get install php7.0-mysql
sudo apt-get install php7.0-mysqlnd

For PHP7.1
sudo apt-get install php7.1-mysql
sudo apt-get install php7.1-mysqlnd

For PHP7.2
sudo apt-get install php7.2-mysql
sudo apt-get install php7.2-mysqlnd

For PHP7.3
sudo apt-get install php7.3-mysql
sudo apt-get install php7.3-mysqlnd

*Edit the ini file and look for mysqli. Uncomment the line by removing ;
for all php versions
extension=mysqli.so

/etc/php/<php.version>/apache2/php.ini

For PHP7.0
sudo nano /etc/php/7.0/apache2/php.ini

For PHP7.1
sudo nano /etc/php/7.1/apache2/php.ini

For PHP7.2
sudo nano /etc/php/7.2/apache2/php.ini

For PHP7.3
sudo nano /etc/php/7.3/apache2/php.ini

and last restart apache server
sudo /etc/init.d/apache2 restart

A: sudo apt-get install php5-mysql
sudo apt-get install php5-mysqlnd

try both of alternatively it works for me

A: If you run PHPMyAdmin on localhost uncomment in file /etc/php5/apache2/php.ini this line:
mysqli.allow_local_infile = On

Restart Apache:
sudo /etc/init.d/apache2 restart

A: I solved this problem by editing /usr/local/zend/etc/php.ini.
(found it by doing netstat -nlp ¦ grep apache, then strace -p somepid ¦ grep php.ini).
At the end of the file, I added:
extension=/usr/lib/php5/20090626+lfs/mysql.so
extension=/usr/lib/php5/20090626+lfs/mysqli.so
extension=/usr/lib/php5/20090626+lfs/mcrypt.so

Adding it without the path did not work.
Then after a restart it worked.

A: For ubuntu user open your terminal and type following command
sudo apt-get install mysql

After that just restart apache2 by typing this
sudo service apache2 restart

refresh you browser and enjoy phhmyadmin

A: For Ubuntu 20.04 users with php-fpm
I fixed the issue by adding the full path in the php conf:

edit /etc/php/7.4/fpm/conf.d/20-mysqli.ini

and replace
extension=mysqli.so

with:
extension=/usr/lib/php/20190902/mysqli.so

A: Latest phpMyAdmin versions require mysqli extension and will no longer work with mysql one (note the extra "i" at the end of its name).
For PHP 7.3
sudo apt-get install php7.3-mysqli

For PHP 8
sudo apt-get install php8.0-mysqli

Will install package containing both old one and the new one, so afterwards all you need to do is to add
extension=mysqli.so

in your php.ini, under the subject Dynamic Extensions.
Restart apache:
sudo systemctl restart apache2

Authenticate if needed and press enter.
Should be done! If problem still occurs remove the browser cache.

A: Checking the extension_dir is one of the thing you like to check from phpinfo().In my case it was extension_dir = "./" by default which was wrong. Change it to extension_dir = './ext/' or where all your extension dlls are currently residing.

A: Just add this line to your php.ini if you are using XAMPP etc. also check if it is already there just remove ; from front of it
extension= php_mysqli.dll

and stop and start apache and MySQL it will work.

A: You need the MySQLi module. This error usually occurs when manually installing phpMyAdmin.
sudo apt-get install php7.3-mysql

It will return you with.
[Creating config file /etc/php/7.3/mods-available/mysqlnd.ini with new version]

[Creating config file /etc/php/7.3/mods-available/mysqli.ini with new version]

Then.
sudo service apache2 restart.

Then.
Press F5 on your browser.

A: This worked for me , make a database with a php and mysql script and open up the mysql console and type in create user 'yourName'@'127.0.0.1' and then type in grant all privileges on . to 'yourName'@'127.0.0.1' then open up a browser go to localhost and a database should been made and then go to your phpmyadmin page and you will see it pop up there.

A: at ubuntu 12.04 i had to change mssql.compatability_mode = On.
put On and works

A: Since I had this problem following an upgrade, I just disable Apache2-php5
a2dismod php5

and activated php7
a2enmod php7

Hope it may help anybody!

A: I have encountered the same error on ubuntu and what worked for me was editing 2 lines in /etc/php/7.3/apache2/php.ini
  ;extension=mysqli to   extension=mysqli

and gave the extension variable location to mysqli.so after uncommenting it
   extension=/usr/lib/php/20170718/mysqli.so

then restart the service just to make sure
systemctl start mysql

A: For the record, my system is Ubuntu Server 20.04 and none of the solutions here worked. For me, I installed PHP 7.4 and I had to edit enter code here/etc/php/7.4/apache2/php.ini`.
Within this, search for ;extension=mysqli, uncomment and change mysqli to mysqlnd so it should look like this extension=mysqlnd. I tried using mysqli but I faced the same error as if I didn't enable it but mysqlnd worked for me.

A: Had the very same problem, but in my case the reason was update of Ubuntu and php version - from 18.04 and php-7.2 up to 20.04 and php-7.4.
The Nginx server was the same, so in my /etc/nginx/sites-available/default was old data:
server {
  location /pma {
    location ~ ^/pma/(.+\.php)$ {
      fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    }
  }
}

I could not get phpmyadmin to work with any of php.ini changes and all answers from this thread, but at some moment I had opened the /etc/nginx/sites-available/default and realised, that I still had old version of php. So I just changed it to
fastcgi_pass unix:/run/php/php7.4-fpm.sock;

and the issue was gone, phpmyadmin magically started to work without any mysqli-file complaint. I even double checked it, but yeap, that's how it works - if you have wrong version for php-fpm.sock in your nginx config file, your phpmyadmin will not work, but the shown reason will be 'The mysqli extension is missing'

A: I hope my successful answer helps someone in recent times as I had to try many mix-and-matches and then found it:
This solution worked for me on Ubuntu 20.04 Desktop with PHP v7.4, PHP v8.0.7 and MySQL v8.0.25 setup.
What I did was edited /etc/php/7.4/apache2/php.ini and /etc/php/8.0/apache2/php.ini files and replaced
extension=mysqli.so
with
extension=/usr/lib/php/20190902/mysqli.so
in both the files.
Later, restarted both of these (PHP and MySQL) by sudo systemctl restart apache2 and sudo systemctl restart mysql. Refreshed Chrome, and phpMyAdmin responded with the login screen.
(UPDATE: Please check if you have /usr/lib/php/20200930/mysqli.so file as well. I tested this as it looked newer by directory date, and this too worked in both the PHP files as extension=/usr/lib/php/20200930/mysqli.so)


text:
Q: Using functions and arrays My little program below shall take 5 numbers from the user, store them into
an array of integers and use a function to print them out. Sincerly it doesn't work and
my output is always "00000". I can't find a mistake, so i would be glad about any advice. Thanks.
#include <stdio.h>

void printarray(int intarray[], int n)
{
    int i;
    for(i = 0; i < n; i ++)
    {
        printf("%d", intarray[i]);
    }
}

int main ()
{
    const int n = 5;
    int temp = 0;
    int i;
    int intarray [n];
    char check;

    printf("Please type in your numbers!\n");

    for(i = 0; i < n; i ++)
    {
        printf("");
            scanf("&d", &temp);
        intarray[i] = temp;

        getchar();
        getchar();

    }

    printf("Do you want to print them out? (yes/no): ");
        scanf("%c", &check);

        if (check == 'y')
            printarray(intarray, n);

    getchar();
    getchar();

    return 0;
}

A: You want %d, not &d, in your scanf() format string.  This bug is the kind that is very easy to identify by using a debugger - I recommend learning how to use whichever one works best with the rest of your development system.
Compiling with more warnings turned on would probably have detected this one, too.  Something like "too many arguments for format".


text:
Q: Shopify API POST for Private App to Create Fulfillment Below is what I am passing to Shopify:
curl -v -i -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Shopify-Access-Token: 1fadecf1b0eee641ce0248e3b5f053XX" -X POST "https://[key]:[pass]@[store].myshopify.com/admin/orders/361911625/fulfillments.json" -d '{"fulfillment":{"tracking_numbers":["1Z89E5W203624344XX"],"line_items":[{"id":640901329}],"notify_customer":"true"}}'

The response is:
HTTP/1.1 404 Not Found Server: nginx Date: Fri, 12 Dec 2014 15:59:22 GMT Content-Type: application/json; charset=utf-8 Transfer-Encoding: chunked Connection: close Vary: Accept-Encoding Vary: Accept-Encoding Status: 404 Not Found X-XSS-Protection: 1; mode=block; report=/xss-report/ec54beef-a112-4fb7-a19a-b76a6960616a?source%5Baction%5D=create&source%5Bcontroller%5D=admin%2Ffulfillments&source%5Bsection%5D=admin X-Content-Type-Options: nosniff X-UA-Compatible: chrome=1 X-ShopId: 4XXX5XX X-ShardId: 2 X-Shopify-Shop-Api-Call-Limit: 1/40 HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 1/40 X-Stats-UserId: 0 X-Stats-ApiClientId: 513097 X-Stats-ApiPermissionId: 9286803 X-Request-Id: ec54beef-a112-4fb7-a19a-b76a696061XX

{"errors":"Not Found"}

I am working in PHP, have tried using PHP based curl functions, curl_init, setopt, curl_exec... but was getting the same results so tried switch to command line.  When searching around online I tried every "fix" I could locate, but none seemed to be my cause.

A: This is working for me:
curl -v -i -H "Content-Type: application/json" -H "Accept: application/json" -X POST "https://KEY:PASSWORD@YOURSHOP.myshopify.com/admin/orders/381824040/fulfillments.json" -d '{"fulfillment":{"notify_customer":true,"tracking_numbers":["ce09af9e9cc42f4b6306d7de4b6ad655"],"line_items":[{"id":682326640}]}}'

If you're still having trouble, double check the order ID and the line item ID.
Note that with private apps, you don't need the X-Shopify-Access-Token and there shouldn't be quotes around the true value on notify_customer. Hope this helps!

A: In my case the issue was that I confused the line_items id with variant id.
I understood that when I got 404 error for /admin/orders/381824040/fulfillments.json with line_items
And then got success for /admin/orders/381824040/fulfillments.json without line_items.


text:
Q: T-SQL Order By on key-value table I have two tables like :
Docs {#DocId, SomeData}
KeyValues {#RowId, DocId,  Name,  Value}
and it have values like :
Docs
D1 | This is content of doc 1

D2 | This is content of doc 2

Key-values
1 | D1 | Firstname | David

2 | D1 | Lastname  | Andersson

3 | D2 | Firstname | Anders

4 | D2 | Lastname  | Andersson

I would like to get Doc.SomeData and order by the value of Firstname
How-would you do it? Pivot? Joins?
EDITED
I might have simplified to much. The KeyValue table has the value divided into several columns, but the actual column to get the value is defined in C# code where the SQL is generated on the fly:
KeyValues {#RowId, DocId,  Name,  StringValue, IntegerNumericValue, FractalNumericValue, BoolValue, GuidValue, DateTimeValue}
Using Left Joins would need me to issue one left join for each sorting expression otherwise the set might get duplication of docs in the result.

A: Try this :
SELECT SomeData
FROM Doc d
INNER JOIN KeyValues k ON d.DocId = k.DocId AND k.Name = 'FirstName'
ORDER BY k.Value

UPDATE :
If your sorting needs dynamically based on values passed from c# code then you can use case in order by clause like :
SELECT SomeData
FROM Doc d
INNER JOIN KeyValues k ON d.DocId = k.DocId AND k.Name = @PassedValue
ORDER BY CASE WHEN @PassedValue = 'FirstName' THEN k.StringValue
              WHEN @PassedValue = 'LastName' THEN k.StringValue
              WHEN @PassedValue = 'Date' THEN k.DateTimeValue
              ELSE k.StringValue
              END

A: SELECT Doc.SomeData, KV.Value
FROM Doc JOIN KeyValues KV ON Doc.DocId = KV.DocId
WHERE KV.Name = 'Firstname'
ORDER BY KV.Value

A: Look in the comments to the Gist for the solution. Any tweaks are highly appreciated.
https://gist.github.com/1343449#comments


text:
Q: How to get closest integer values in embedded c? I am working in embedded c, variable x is a sensor data which is an integer (lies between 1 and 100) and i need to output a variable y on lcd as a linear relation of x but after rounding it to closest integer, will this code work? If not then what are other ways of doing the same.
int x
float y
int z
x=4 /*say its 4*/
y=((x*3.45)+3.5) /*which is a decimal*/
z=(unsigned int)(y)

A: int z = ((x * 3.45) + 3.5) + 0.5;  /* assuming x is non-negative */

Floating-point to integer is covered by implicit conversion, so you don't need to do it explicitly.  But the conversion is a truncate so the extra +0.5 gets you to the actual closest integer.

A: An alternative suggestion:
If your code is running on a fixed-point processor, then any floating-point operation is replaced by the compiler with a call to a library function (typically provided by the manufacturer, as part of the BSP).
In such case, you might want to avoid invoking floating-point operations within your code.
Create a hash table for all the values in the specified range (0-100):
int hash[101] =
{
      4,  7, 10, 14, 17, 21, 24, 28, 31, 35, 38, 41, 45, 48, 52, 55, 59, 62, 66, 69,
     73, 76, 79, 83, 86, 90, 93, 97,100,104,107,110,114,117,121,124,128,131,135,138,
    142,145,148,152,155,159,162,166,169,173,176,179,183,186,190,193,197,200,204,207,
    211,214,217,221,224,228,231,235,238,242,245,248,252,255,259,262,266,269,273,276,
    280,283,286,290,293,297,300,304,307,311,314,317,321,324,328,331,335,338,342,345,
    349
};

Then, simple use y = hash[x] for every given value of x.

A: Following up from @Joe Hass comment with an "after accepted" answer.
Skip all floating point math.
Scale the operation and round by adding 0.5 via 50u/100u.
int x;       // (lies between 1 and 100)
unsigned z;
#define A 345u /* 3.45 * 100 */
#define B 350u /* 3.5  * 100 */
// Do everything unsigned
z = ((unsigned) x * A + B + 50u)/100u

This does a  "rounding to nearest, half away from 0" (@mb84)
Note: A smaller scale of 20 could have been use, but 100 is clearer.


text:
Q: React setState immutably in es6: cannot convert undefined or null to object I'm trying to setState using the rule that state should not be mutated but I keep getting an error.  Can't figure this out.
Here is my state:
this.state = {
      jsonReturnedValue: null,
      fruit: [
        {
          id: 1,
          title: 'Orange',
          selected: false,
          key: 'fruit'
        },
        {
          id: 2,
          title: 'Grape',
          selected: false,
          key: 'fruit'
        },
        {
          id: 3,
          title: 'Pomegranate',
          selected: false,
          key: 'fruit'
        },
        {
          id: 4,
          title: 'Strawberry',
          selected: false,
          key: 'fruit'
        }
      ]
    }

I do a fetch when component mounts with:
  componentDidMount() {
    fetch('http://127.0.0.1:8000/api/printing/postcards-printing')
      .then(response => response.json())
      .then(json => {
        this.setState({ jsonReturnedValue: [...this.state.jsonReturnedValue, json.printCategory.products] }, () => console.log(this.state));
      });
  }

This returns the error:
Uncaught (in promise) TypeError: Cannot convert undefined or null to object
The following works
  .then(json => {
    this.setState({ jsonReturnedValue: json.printCategory.products }, () => console.log(this.state));
  });

However the working one would mutate the state which according to what I've read is a bad practice.  Any help would be greatly appreciated!

A: You are trying to spread a null primitive, which is not possible. So instead do this with your initial state:
this.state = {
  jsonReturnedValue: [],
  fruit: [
    {
      id: 1,
      title: 'Orange',
      selected: false,
      key: 'fruit'
    },
    {
      id: 2,
      title: 'Grape',
      selected: false,
      key: 'fruit'
    },
    {
      id: 3,
      title: 'Pomegranate',
      selected: false,
      key: 'fruit'
    },
    {
      id: 4,
      title: 'Strawberry',
      selected: false,
      key: 'fruit'
    }
  ]
};

Also note that you're going to want to do this { jsonReturnedValue: [...this.state.jsonReturnedValue, ...json.printCategory.products] }. Note the spread in the second index of the array.


text:
Q: Vertical scroll bars no longer appear when overflow is set to auto I am working on a JSP site.
I have 3 main concentric divs:

*

*"container" ( contains the entire site )

*"content"  ( contains the content )

*"results" ( inside of "content", contains a large amount of server generated data )

I set up the CSS so that when a large amount of data is deposited in the div "results" horizontal and vertical scroll bars would appear automagically.
It worked.
Until I added these tags to the top of the page to fix some other unrelated problems:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

I tried the suggestion in the second answer below, to set a height in the divs.  No joy, even when I set the height with px.  I need to set the height with %s, if possible.
I took a screen save of the troublesome JSP, took out all of the junk not related to the problem and put the CSS intp the head to simplify debugging the problem.  In the quote below is a single HTML file you can drop into a browser and a text editor to see the issue for yourself.  The pink div "results" is only supposed to be about as high as the stackoverflow edit box, with horizontal and vertical scroll bars appearing as needed.
results.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
    <title>Staff Directory</title>

Div "Content"

        <form id="command" name="f" action="employee" method="post">

Div "Results"

               Start:  A very wide string. A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.  A very wide string.   The End.

            Lorem ipsum dolor sit amet consect etuer adipi scing elit sed diam nonummy nibh
            euismod tinunt ut laoreet dolore magna aliquam erat volut. Ut wisi enim ad minim
            veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip
            ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in
            vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla
            facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent
            luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

            Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit
            lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure
            dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore
            eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui
            blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla
            facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
            nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

            Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie
            consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan
            et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis
            dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer
            adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna
            aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation
            ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

            Lorem ipsum dolor sit amet consect etuer adipi scing elit sed diam nonummy nibh
            euismod tinunt ut laoreet dolore magna aliquam erat volut. Ut wisi enim ad minim
            veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip
            ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in
            vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla
            facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent
            luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

            Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit
            lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure
            dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore
            eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui
            blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla
            facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
            nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

            Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie
            consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan
            et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis
            dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer
            adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna
            aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation
            ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

            Lorem ipsum dolor sit amet consect etuer adipi scing elit sed diam nonummy nibh
            euismod tinunt ut laoreet dolore magna aliquam erat volut. Ut wisi enim ad minim
            veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip
            ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in
            vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla
            facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent
            luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

            Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit
            lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure
            dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore
            eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui
            blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla
            facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
            nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

            Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie
            consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan
            et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis
            dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer
            adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna
            aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation
            ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

            Lorem ipsum dolor sit amet consect etuer adipi scing elit sed diam nonummy nibh
            euismod tinunt ut laoreet dolore magna aliquam erat volut. Ut wisi enim ad minim
            veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip
            ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in
            vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla
            facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent
            luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

            Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit
            lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure
            dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore
            eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui
            blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla
            facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
            nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

            Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie
            consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan
            et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis
            dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer
            adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna
            aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation
            ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

                <input value="Request More Information" name="buttonRequestMoreInformation" type="submit">

                <input value="Start New Search" onclick="location.href='search'" name="buttonSearch" type="button">

                    <input value="Add Member" onclick="document.formAddButton.submit();" name="buttonAddMember" type="button">

        </form>

        <form name="formAddButton" action="initialRequest" method="post">
            <input name="NextRequest" value="Add Member" type="hidden">
        </form>

A: div {overflow-x:hidden; }
div {overflow-x:scroll; }
div {overflow-x:visible;}
div {overflow-x:auto;}
div {overflow-y:hidden; }
div {overflow-y:scroll; }
div {overflow-y:visible;}
div {overflow-y:auto;}

A: Are you sure you didn't try to do as I said? I've just dumped your code in my browser, and changed
#results
{
    height: 40%;
}

to
#results
{
    height: 200px;
}

and the pink box behaved as I expected and you wanted.
About using % instead of px: you can't unless you set a fixed height to the container.

A: Well, since none of your element is attributed an HEIGHT, then, 40% of 'something' will never be applyed.
So, to solve your situation, you have to fix some height somewhere on a parent divider.
Carry on


text:
Q: TB data write to parquet we have 2.5TB data in hbase, and the region size is 5g or 10g, and the hbase table have 450 reigons. and we need transform to spark-sql. and the method used below:
1.snapshot hbase table.
2.read hfile by newHadoopAPIRDD
3.write to parquet.
val hconf = HBaseConfiguration.create()
hconf.set("hbase.rootdir", "/hbase")
hconf.set("hbase.zookeeper.quorum", HbaseToSparksqlBySnapshotParam.zookeeperQurum)
hconf.set(TableInputFormat.SCAN, convertScanToString(scan))

val job = Job.getInstance(hconf)
val path = new Path("/snapshot")
val snapshotName = HbaseToSparksqlBySnapshotParam.snapshotName

TableSnapshotInputFormat.setInput(job, snapshotName, path)
val hbaseRDD = spark.sparkContext.newAPIHadoopRDD(job.getConfiguration, classOf[TableSnapshotInputFormat],classOf[ImmutableBytesWritable], classOf[Result])
val rdd = hbaseRDD.map{
    case(_,result) =>
    ...
    Row
 }
val df = spark.createDataFrame(rdd, schema)
df.write.parquet("/test")

num-executors executor-memory executor-cores   run_time
16              6               2                  error following
5               15              8                  6hours

i don't know how to set the params(num-executors,executor-memory,executor-cores), and can run faster. when i just get one region(10g), i use the param as num-executors 1,executor-memory 3g,executor-cores 1, it run 14min.
i use spark2.1.0
error:
19/01/18 00:55:26 INFO TaskSetManager: Finished task 386.0 in stage 0.0 (TID 331) in 1187343 ms on hdh68 (executor 5) (331/470)
19/01/18 00:55:31 INFO TaskSetManager: Starting task 423.0 in stage 0.0 (TID 363, hdh68, executor 1, partition 423, NODE_LOCAL, 6905 bytes)
19/01/18 00:55:31 INFO TaskSetManager: Finished task 383.0 in stage 0.0 (TID 328) in 1427677 ms on hdh68 (executor 1) (332/470)
19/01/18 00:57:36 INFO YarnSchedulerBackend$YarnDriverEndpoint: Disabling executor 10.
19/01/18 00:57:36 INFO DAGScheduler: Executor lost: 10 (epoch 0)
19/01/18 00:57:36 INFO BlockManagerMasterEndpoint: Trying to remove executor 10 from BlockManagerMaster.
19/01/18 00:57:36 INFO BlockManagerMasterEndpoint: Removing block manager BlockManagerId(10, hdh68, 40679, None)
19/01/18 00:57:36 INFO BlockManagerMaster: Removed 10 successfully in removeExecutor
19/01/18 00:57:36 INFO DAGScheduler: Shuffle files lost for executor: 10 (epoch 0)
19/01/18 00:57:36 WARN DFSClient: Slow ReadProcessor read fields took 114044ms (threshold=30000ms); ack: seqno: 49 reply: 0 downstreamAckTimeNanos: 0, targets: [DatanodeInfoWithStorage[10.41.2.68:50010,DS-26a72d43-2e16-41a9-9a71-99593f14ab6f,DISK]]
19/01/18 00:57:39 WARN YarnSchedulerBackend$YarnSchedulerEndpoint: Container killed by YARN for exceeding memory limits. 6.6 GB of 6.6 GB physical memory used. Consider boosting spark.yarn.executor.memoryOverhead.
19/01/18 00:57:39 ERROR YarnScheduler: Lost executor 10 on hdh68: Container killed by YARN for exceeding memory limits. 6.6 GB of 6.6 GB physical memory used. Consider boosting spark.yarn.executor.memoryOverhead.
19/01/18 00:57:39 INFO BlockManagerMasterEndpoint: Trying to remove executor 10 from BlockManagerMaster.
19/01/18 00:57:39 INFO BlockManagerMaster: Removal of executor 10 requested
19/01/18 00:57:39 INFO YarnSchedulerBackend$YarnDriverEndpoint: Asked to remove non-existent executor 10
19/01/18 00:57:52 INFO YarnSchedulerBackend$YarnDriverEndpoint: Registered executor NettyRpcEndpointRef(null) (10.41.2.68:49771) with ID 17
19/01/18 00:57:52 INFO TaskSetManager: Starting task 387.1 in stage 0.0 (TID 364, hdh68, executor 17, partition 387, NODE_LOCAL, 6906 bytes)
19/01/18 00:57:52 INFO TaskSetManager: Starting task 417.1 in stage 0.0 (TID 365, hdh68, executor 17, partition 417, NODE_LOCAL, 6906 bytes)
19/01/18 00:57:53 INFO BlockManagerMasterEndpoint: Registering block manager hdh68:38247 with 3.0 GB RAM, BlockManagerId(17, hdh68, 38247, None)
19/01/18 00:58:42 INFO TaskSetManager: Starting task 426.0 in stage 0.0 (TID 366, hdh68, executor 13, partition 426, NODE_LOCAL, 6905 bytes)
19/01/18 00:58:42 INFO TaskSetManager: Finished task 396.0 in stage 0.0 (TID 341) in 1014645 ms on hdh68 (executor 13) (333/470)
java.io.IOException: Broken pipe
        at sun.nio.ch.FileChannelImpl.transferTo0(Native Method)
        at sun.nio.ch.FileChannelImpl.transferToDirectlyInternal(FileChannelImpl.java:428)
        at sun.nio.ch.FileChannelImpl.transferToDirectly(FileChannelImpl.java:493)
        at sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:608)
        at io.netty.channel.DefaultFileRegion.transferTo(DefaultFileRegion.java:139)
        at org.apache.spark.network.protocol.MessageWithHeader.transferTo(MessageWithHeader.java:121)
        at io.netty.channel.socket.nio.NioSocketChannel.doWriteFileRegion(NioSocketChannel.java:287)
        at io.netty.channel.nio.AbstractNioByteChannel.doWrite(AbstractNioByteChannel.java:237)
        at io.netty.channel.socket.nio.NioSocketChannel.doWrite(NioSocketChannel.java:314)
        at io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:802)
        at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.java:313)
        at io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.java:770)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.flush(DefaultChannelPipeline.java:1256)
        at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:781)
        at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:773)
        at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:754)
        at io.netty.channel.ChannelOutboundHandlerAdapter.flush(ChannelOutboundHandlerAdapter.java:115)
        at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:781)
        at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:773)
        at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:754)
        at io.netty.channel.ChannelDuplexHandler.flush(ChannelDuplexHandler.java:117)
        at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:781)
        at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:807)
        at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:818)
        at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:799)
        at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:835)
        at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1017)
        at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:256)
        at org.apache.spark.network.server.TransportRequestHandler.respond(TransportRequestHandler.java:194)
        at org.apache.spark.network.server.TransportRequestHandler.processStreamRequest(TransportRequestHandler.java:150)
        at org.apache.spark.network.server.TransportRequestHandler.handle(TransportRequestHandler.java:111)
        at org.apache.spark.network.server.TransportChannelHandler.channelRead0(TransportChannelHandler.java:119)
        at org.apache.spark.network.server.TransportChannelHandler.channelRead0(TransportChannelHandler.java:51)
        at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:367)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:353)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:346)
        at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:367)
        at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:367)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:353)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:367)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:353)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:346)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:367)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:353)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:652)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:575)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:489)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:451)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
        at java.lang.Thread.run(Thread.java:748)
19/01/18 00:59:58 INFO TaskSetManager: Starting task 428.0 in stage 0.0 (TID 367, hdh68, executor 17, partition 428, NODE_LOCAL, 6906 bytes)
19/01/18 00:59:58 WARN TaskSetManager: Lost task 387.1 in stage 0.0 (TID 364, hdh68, executor 17): java.nio.channels.ClosedChannelException
        at org.apache.spark.network.client.StreamInterceptor.channelInactive(StreamInterceptor.java:60)
        at org.apache.spark.network.util.TransportFrameDecoder.channelInactive(TransportFrameDecoder.java:179)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:251)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:237)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:230)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1289)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:251)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:237)
        at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:893)
        at io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:691)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:408)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:455)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
        at java.lang.Thread.run(Thread.java:748)

19/01/18 01:00:04 INFO TaskSetManager: Starting task 387.2 in stage 0.0 (TID 368, hdh68, executor 14, partition 387, NODE_LOCAL, 6906 bytes)
19/01/18 01:00:04 INFO TaskSetManager: Finished task 385.0 in stage 0.0 (TID 330) in 1471628 ms on hdh68 (executor 14) (334/470)
19/01/18 01:00:12 INFO TaskSetManager: Starting task 429.0 in stage 0.0 (TID 369, hdh68, executor 8, partition 429, NODE_LOCAL, 6905 bytes)
19/01/18 01:00:12 INFO TaskSetManager: Finished task 392.0 in stage 0.0 (TID 337) in 1220925 ms on hdh68 (executor 8) (335/470)
19/01/18 01:00:27 INFO TaskSetManager: Starting task 430.0 in stage 0.0 (TID 370, hdh68, executor 11, partition 430, NODE_LOCAL, 6906 bytes)
19/01/18 01:01:16 INFO TaskSetManager: Finished task 390.0 in stage 0.0 (TID 335) in 1353136 ms on hdh68 (executor 14) (337/470)
19/01/18 01:01:30 INFO TaskSetManager: Starting task 432.0 in stage 0.0 (TID 372, hdh68, executor 5, partition 432, NODE_LOCAL, 6906 bytes)
19/01/18 01:01:30 INFO TaskSetManager: Finished task 393.0 in stage 0.0 (TID 338) in 1244707 ms on hdh68 (executor 5) (338/470)
java.io.IOException: Broken pipe
        at sun.nio.ch.FileChannelImpl.transferTo0(Native Method)
        at sun.nio.ch.FileChannelImpl.transferToDirectlyInternal(FileChannelImpl.java:428)
        at sun.nio.ch.FileChannelImpl.transferToDirectly(FileChannelImpl.java:493)
        at sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:608)
        at io.netty.channel.DefaultFileRegion.transferTo(DefaultFileRegion.java:139)
        at org.apache.spark.network.protocol.MessageWithHeader.transferTo(MessageWithHeader.java:121)
        at io.netty.channel.socket.nio.NioSocketChannel.doWriteFileRegion(NioSocketChannel.java:287)
        at io.netty.channel.nio.AbstractNioByteChannel.doWrite(AbstractNioByteChannel.java:237)
        at io.netty.channel.socket.nio.NioSocketChannel.doWrite(NioSocketChannel.java:314)
        at io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:802)
        at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.forceFlush(AbstractNioChannel.java:319)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:646)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:575)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:489)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:451)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
        at java.lang.Thread.run(Thread.java:748)
19/01/18 01:01:59 INFO TaskSetManager: Starting task 434.0 in stage 0.0 (TID 374, hdh68, executor 17, partition 434, NODE_LOCAL, 6905 bytes)
19/01/18 01:01:59 WARN TaskSetManager: Lost task 417.1 in stage 0.0 (TID 365, hdh68, executor 17): java.nio.channels.ClosedChannelException
        at org.apache.spark.network.client.StreamInterceptor.channelInactive(StreamInterceptor.java:60)
        at org.apache.spark.network.util.TransportFrameDecoder.channelInactive(TransportFrameDecoder.java:179)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:251)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:237)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:230)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1289)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:251)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:237)
        at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:893)
        at io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:691)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:408)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:455)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:140)
        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
        at java.lang.Thread.run(Thread.java:748)

update:
the cluser is a pseudo-distributed. Memory Tota 200g, VCores Total 64. and the root.root queue resource, the queue has not other application:
Used Resources: <memory:171776, vCores:44>
Num Active Applications:    7
Num Pending Applications:   0
Min Resources:  <memory:0, vCores:0>
Max Resources:  <memory:204800, vCores:64>
Steady Fair Share:  <memory:54614, vCores:0>
Instantaneous Fair Share:   <memory:102400, vCores:0>
Preemptable:    true


text:
Q: What project files does Visual Studio Code create via its Java extensions? I give a computer programming course I have written, and I recently switched to recommending Visual Studio Code in the course. We are starting out with the basics, so I just wanted a simple editor. We started learning Git, and one student's repository suddenly had all sorts of cruft in it, including:

*

*.settings/

*.vscode/

*.classpath

*.project
In particular the .settings directory had all sorts of Eclipse settings, such as I would expect to see in an Eclipse project.
The student explained to me that these came from VS Code after installing its Java extensions. But why are the VS Code Java extensions creating Eclipse files? And where is all this documented, so that I can update my lessons with the exact details and avoid this problem in the future?
Thanks in advance.

A: Simplified the Language Support for Java™ by Red Hat is the headless Eclipse Java IDE integrated into Visual Studio Code via the Language Server Protocol (LSP). See the self-description of the extension:

Provides Java™ language support via Eclipse JDT Language Server, which
  utilizes Eclipse JDT, M2Eclipse and Buildship.

Except for .vscode/, the mentioned files are Eclipse Java IDE files.
Because in Eclipse these files are not intended to be edited manually, there is little or no documentation about them (the Java compiler settings in .settings/org.eclipse.jdt.core.prefs are similar to the command line arguments of the Eclipse batch compiler).
For example, the documentation of the Java extension recommends using the Eclipse Java IDE to edit the formatter settings (which are also stored in .settings/org.eclipse.jdt.core.prefs) and concludes:

No it's not an ideal solution, but it should be done only once, unless
  you regularly change your formatter settings.


text:
Q: Custom Google Map with user location marked in React I need to make have a custom google map embedded inside a React app. I also need to be able to track location of the user and mark the location on the embedded map in React app. As I understand it, I will have to use google-map-react library and I understand how to have a map going with longitude and latitude data, but I am not sure how to have a "custom" map in place of the normal map? I guess I can have mark a position like so:
<Wrapper apiKey={"API_KEY"}>
  <Map center={center} zoom={zoom}>
    <Marker position={position} />
  </Map>
</Wrapper>

and I am guessing I can get the longitude and latitude like so:
const getLocation = () => {
  if (!navigator.geolocation) {
    setStatus('Geolocation is not supported by your browser');
  } else {
    setStatus('Locating...');
    navigator.geolocation.getCurrentPosition((position) => {
      setStatus(null);
      setLat(position.coords.latitude);
      setLng(position.coords.longitude);
    }, () => {
      setStatus('Unable to retrieve your location');
    });
  }
}

Please give your opinions on if I do this any smarter than this and how to get a custom map instead of a standard Google Map.


text:
Q: Deserialize JSON with C# (Multiple Objects) I'm trying to deserialize a School to then insert into a Bar Chart Later. The JSON object looks like:
[{"Subject": "TEST APP","AppScores": [{"Season": "AAAAAAAAAAAAAAAAAAAA","year": "1"}, {"Season": "BBBBBBBBBBBBBBBBBBBBB","year": "2"}]}, {"Subject": "TEST APP2","AppScores": [{"Season": "CCCCCCCCCCC","year": "3"}, {"Season": "DDDDDDDDDDDDDDDDD","year": "4"}]}]

The output I am hoping to see in the Console.WriteLine();
Subject: TEST APP
AppScores
Season: AAAAAAAAAAAAAAAAAAAA
Year: 1
Season: BBBBBBBBBBBBBBBBBBBBB
Year: 2
Subject: TESTAPP2
AppScores
Season: CCCCCCCCCCC
Year: 3
Season: DDDDDDDDDDDDDDDDD
Year: 4

I have seen this been done in multiple of ways using similar code below.
School subject = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<School>(json);
foreach (var item in subject.data)
{Console.WriteLine("season: {0}, year: {1}", item.season, item.year); Console.ReadLine();}

Calling from a Class:
public class School
{
public List<SchoolSubjects> data { get; set; }
}
public class SchoolSubjects
{
public string year { get; set; }
public string season { get; set; }
}

Can anyone help to amend this code as I cant find any examples that would do this? Thanks in advance.

A: Your problem is that your root JSON container is an array, not an object:

*

*An array is an ordered collection of values. An array begins with [ (left bracket) and ends with ] (right bracket). Values are separated by , (comma).

*An object is an unordered set of name/value pairs. An object begins with { (left brace) and ends with } (right brace).
A JSON array needs to be deserialized into a collection, such as a List<T>.
If I upload your JSON to http://json2csharp.com/, I get the following classes, renamed more appropriately:
public class SchoolSubjectAppScore
{
    public string Season { get; set; }
    public string year { get; set; }
}

public class SchoolSubject
{
    public SchoolSubject() { this.AppScores = new List<SchoolSubjectAppScore>(); }
    public string Subject { get; set; }
    public List<SchoolSubjectAppScore> AppScores { get; set; }
}

Then your JSON can be deserialized and printed as follows:
        var root = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<List<SchoolSubject>>(json);
        foreach (var subject in root)
        {
            Console.WriteLine(subject.Subject);

            foreach (var item in subject.AppScores)
            {
                Console.WriteLine("season: {0}, year: {1}", item.Season, item.year);
            }
        }


text:
Q: While Integrating Apple iAd Framework getting Error this error? I am integrated Apple iAd framework and I am getting this Error.Please Help me on this.
Error Domain=ADErrorDomain Code=2 "The operation couldn\u2019t be completed. Loading throttled" UserInfo=0x6b57cf0 {ADInternalErrorCode=2, NSLocalizedFailureReason=Loading throttled}

A: You've created too many banner ads simultaneously or have asked for a lot of ads in rapid succession. Reduce the number of ads you're trying to display and/or slow down your requests for new ones.

A: Is this the only error you get, or do you get other ones?  Does it work sometime and not others?
The iAd test server tends to return a lot of errors, so that you can test your code for hiding and unhiding the banners and so on.  If it works sometime and not others, then it should be fine - but like @myztikjenz says, you should check the rate/number that you are issuing requests and re-read the documentation to make sure you are issuing your requests correctly.


text:
Q: EF: How to group by multiple columns and include children of Key Entity In EF query i want to group entity by 2 columns. and then  include the entity instance of grouped column
Below is generic repository. i have removed some code for brevity
  public class MyGenericRepository
  {
        public IQueryable<TEntity> GetQuery<TEntity>() where TEntity : class
        {
            return _dbContext.Set<TEntity>();
        }
  }

Below i am grouping PackageDetail entity by TemplateID and DocumentID column. After grouping i am only interested in first ( Group Key) entity. I also want to include Key Entity's Template and Document child entity
IEnumerable<int> ids= GetIDs();

  var result = await _repository.GetQuery<PackageDetail>()
                .Include(x => x.Template)
                .Include(x => x.Document)
                .Where(x => ids.Contains(x.ID))
                .GroupBy(x => new { x.TemplateID, x.DocumentID })
                .Select(x => x.FirstOrDefault())
                .ToListAsync();

The code above correctly doing grouping and producing correct result. However resultant PackageDetails does not include Template or Document children.


text:
Q: issue importing module in python jupyter hi so I'm trying to import geopandas into my script
import pandas as pd
import geopandas as gpd
from shapely.geometry import Point

#handling txt
#remove 'lat=' and 'long=' then type change from object to float to make point.
df = pd.read_csv('latlong.txt', header=None, names = ['lat','long', 'name','description'])

df['lat'] = df['lat'].str.replace('lat=', '')
df['long'] = df['long'].str.replace('long=', '')

df['lat'] = df['lat'].astype(float)
df['long'] = df['long'].astype(float)

#make point geometry
df['geometry'] = df.apply(lambda row: Point(low['long'], low['lat']), axis=1) #long is X, lat is Y

#change df to gdf
gdf = gpd.GeoDataFrame(df, geometry = 'geometry', crs='EPSG:4326')  #epsg4326 is WGS84

But when I try to run this in the jupyter notebook, using a conda environment from these steps: https://medium.com/@nrk25693/how-to-add-your-conda-environment-to-your-jupyter-notebook-in-just-4-steps-abeab8b8d084
I get the following error :
ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_2312/3230284861.py in <module>
----> 1 import pandas as pd
      2 import geopandas as gpd
      3 from shapely.geometry import Point
      4
      5 #handling txt

~\.conda\envs\geojsongen\lib\site-packages\pandas\__init__.py in <module>
     14
     15 if missing_dependencies:
---> 16     raise ImportError(
     17         "Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
     18     )

ImportError: Unable to import required dependencies:
numpy:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.9 from "C:\Users\User\.conda\envs\geojsongen\python.exe"
  * The NumPy version is: "1.21.2"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.

I installed the geopandas in this environment using the following command:
conda install -c conda-forge geopandas
Could someone advise me on how I can fix these errors? Any help is appreciated, thank you!!
edit:
I tried this pip install --upgrade --force-reinstall numpy, thanks @krmogi for this, but now I get this error, it looks like an issue with my geopandas installation? :
ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_13932/3230284861.py in <module>
      1 import pandas as pd
----> 2 import geopandas as gpd
      3 from shapely.geometry import Point
      4
      5 #handling txt

~\.conda\envs\geojsongen\lib\site-packages\geopandas\__init__.py in <module>
----> 1 from geopandas._config import options  # noqa
      2
      3 from geopandas.geoseries import GeoSeries  # noqa
      4 from geopandas.geodataframe import GeoDataFrame  # noqa
      5 from geopandas.array import points_from_xy  # noqa

~\.conda\envs\geojsongen\lib\site-packages\geopandas\_config.py in <module>
    107 use_pygeos = Option(
    108     key="use_pygeos",
--> 109     default_value=_default_use_pygeos(),
    110     doc=(
    111         "Whether to use PyGEOS to speed up spatial operations. The default is True "

~\.conda\envs\geojsongen\lib\site-packages\geopandas\_config.py in _default_use_pygeos()
     93
     94 def _default_use_pygeos():
---> 95     import geopandas._compat as compat
     96
     97     return compat.USE_PYGEOS

~\.conda\envs\geojsongen\lib\site-packages\geopandas\_compat.py in <module>
      7 import numpy as np
      8 import pandas as pd
----> 9 import pyproj
     10 import shapely
     11 import shapely.geos

~\.conda\envs\geojsongen\lib\site-packages\pyproj\__init__.py in <module>
     47 import warnings
     48
---> 49 import pyproj.network
     50 from pyproj._datadir import (  # noqa: F401 pylint: disable=unused-import
     51     _pyproj_global_context_initialize,

~\.conda\envs\geojsongen\lib\site-packages\pyproj\network.py in <module>
      8 import certifi
      9
---> 10 from pyproj._network import (  # noqa: F401 pylint: disable=unused-import
     11     _set_ca_bundle_path,
     12     is_network_enabled,

ImportError: DLL load failed while importing _network: The specified module could not be found.

A: Your issue is happening here as shown in your traceback
----> 1 import pandas as pd

Make sure you have pandas installed.
pip install pandas

It also says that numpy C-extentions failed. Install numpy as well:
pip install numpy

While you're at it, make sure you have the other modules installed as well.
If you're still getting the same error, it's possible that setuptools is not properly installed. Do this:

*

*pip uninstall -y numpy

*pip uninstall -y setuptools

*pip install setuptools

*pip install numpy
If you still don't have any luck, try this:
pip install --upgrade --force-reinstall numpy


text:
Q: Find initial value and growth in exponential growth model I was given two models each with specific time($t$) and end amount($P$). $100$ after $3$ hours and $400$ after $5$ hours. Using the exponential growth model I get these $100=Pe^{3r}$ and $400=Pe^{5r}$. I heard you are suppose to divide these two so after that I got this: 4$=Pe^{5/3}$. Then I did the natural log of both and got this $r=0.831774$. After words I have to find the the end amount but I have no Initial Amount($P$). Only the rate and time. Advice?

A: $$100=Pe^{3r} \\400=Pe^{5r} \\ \implies 4 = e^{5r-3r}=e^{2r} \\ \implies r=\ln2\approx0.693$$
Substitute $r$ in any equation to get the $P$.


text:
Q: Probability of selecting a type of chocolate The probability of selecting a white chocolate from a box is
1/5 and the probability of selecting a dark chocolate from the same box is
1/3. The other chocolates are milk chocolates.
a) Find the probability of selecting a milk chocolate.
b) How many chocolates in total could be in the box? Give reasons. Is there more than one answer?

A: Hint -
(1) Probabilities of all event equal to 1. So you can probability of milk chocolates by subtracting the sum of other two probabilities from 1.
(2) Total chocolates are in multiples. So we can't find exact value.


text:
Q: How do I call mpmovieplayer from applicationwillresignactive in ppdelegate? I'm using mpmovieplayer to play an audio stream. I'm having trouble with handling intruptions e.g when a call is received. My player is declared in viewcontroller and I beleive I need to do something in applicationdidresignactive in my appdelegate right? How do I do that if my appdelegate isn't aware of my moviePlayer? I'm new to iPhone development so I'm learning as I go and enjoying it :)
Here is what I'm doing in viewcontroller
-(IBAction)play1MButton:(id)sender{

    [[NSNotificationCenter defaultCenter] addObserver:self
        selector:@selector(moviePlayerStatus:)
        name:MPMoviePlayerPlaybackStateDidChangeNotification
        object:nil];

    NSString *url = @"http://22.22.22.22:8000/listen.pls";

    [self.activityIndicator startAnimating];

    moviePlayer = [[MPMoviePlayerController alloc]
        initWithContentURL:[NSURL URLWithString:url]];

    [moviePlayer prepareToPlay];

    [[NSNotificationCenter defaultCenter] addObserver:self
        selector:@selector(moviePlayerLoadStateChanged:)
        name:MPMoviePlayerLoadStateDidChangeNotification
        object:nil];
}

-(void) moviePlayerStatus:(NSNotification*)notification {

    //MPMoviePlayerController *moviePlayer = notification.object;
    MPMoviePlaybackState playbackState = moviePlayer.playbackState;

    if(playbackState == MPMoviePlaybackStateStopped) {
        NSLog(@"MPMoviePlaybackStateStopped");
    } else if(playbackState == MPMoviePlaybackStatePlaying) {
        NSLog(@"MPMoviePlaybackStatePlaying");
    } else if(playbackState == MPMoviePlaybackStatePaused) {
        NSLog(@"MPMoviePlaybackStatePaused");
    } else if(playbackState == MPMoviePlaybackStateInterrupted) {
        NSLog(@"MPMoviePlaybackStateInterrupted");
    } else if(playbackState == MPMoviePlaybackStateSeekingForward) {
        NSLog(@"MPMoviePlaybackStateSeekingForward");
    } else if(playbackState == MPMoviePlaybackStateSeekingBackward) {
        NSLog(@"MPMoviePlaybackStateSeekingBackward");
    }
}

- (void) moviePlayerLoadStateChanged:(NSNotification*)notification {
    if ([moviePlayer loadState] != MPMovieLoadStateUnknown)
    {
        [[NSNotificationCenter  defaultCenter] removeObserver:self
                        name:MPMoviePlayerLoadStateDidChangeNotification
                           object:moviePlayer];

        [moviePlayer play];

        [self.activityIndicator stopAnimating];
        [moviePlayer setFullscreen:NO animated:NO];
    }

}

and in appdelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];

    AVAudioSession *audioSession = [AVAudioSession sharedInstance];

    NSError *setCategoryError = nil;
    [audioSession setCategory:AVAudioSessionCategoryPlayback error:&setCategoryError];
    if (setCategoryError) {

    }

    NSError *activationError = nil;
    [audioSession setActive:YES error:&activationError];
    if (activationError) {
    }

I can catch the errors, but how do I use the player from appdelegate?

A: Try importing the class where your MPMoviePlayerController is. Use this code in the AppDelegate.h "import "YourClassNameWithThePlayer.h"".
Maybe that can help. I am also new at this, and I hope you consider it.


text:
Q: Convert FALSE rows into TRUE depending on length of consecutive FALSE values in R I used the following code to detect events based on a criteria, but I would like to change FALSE events to TRUE if there are less than 10 consecutive "Falses", as well as the id counter to keep the last value.
df %>%
  mutate(Event = V1 > 20, id = rleid(Event))

Time        V1      Event   id
20:15:57    26.41   TRUE    6
20:15:57    25.10   TRUE    6
20:15:57    23.74   TRUE    6
20:15:57    22.45   TRUE    6
20:15:57    21.33   TRUE    6
20:15:57    20.45   TRUE    6
20:15:58    19.88   FALSE   7
20:15:58    19.66   FALSE   7
20:15:58    19.83   FALSE   7
20:15:58    20.39   TRUE    8

I would like to obtain this:
Time        V1      Event   id
20:15:57    26.41   TRUE    6
20:15:57    25.10   TRUE    6
20:15:57    23.74   TRUE    6
20:15:57    22.45   TRUE    6
20:15:57    21.33   TRUE    6
20:15:57    20.45   TRUE    6
20:15:58    19.88   TRUE    6
20:15:58    19.66   TRUE    6
20:15:58    19.83   TRUE    6
20:15:58    20.39   TRUE    6

Note the last id value, that was 8, is now 6, because it is part of the previous event.
For example, if there is a "group" of 12 consecutive FALSEs, all of them should remain FALSE, but if there is a "group" of only 3 FALSEs, all of them should be turned into TRUE.
I hope I made myself clear, and maybe the problem is in the code I am using at the beginning.
Thanks so much!

A: Generate group_id and use n() to get the size of each group.
library(tidyverse)

df <- tibble(
  x = c(T, T, T, F, F, F, T, F, F, F, F, F, F, F, F, F, F, F, T)
)

df %>%
  mutate(
    group_id = cumsum(x != lag(x, default = 0))
  ) %>%
  group_by(group_id) %>%
  mutate(x = x | n() < 10)
#> # A tibble: 19 x 2
#> # Groups:   group_id [5]
#>    x     group_id
#>    <lgl>    <int>
#>  1 TRUE         1
#>  2 TRUE         1
#>  3 TRUE         1
#>  4 TRUE         2
#>  5 TRUE         2
#>  6 TRUE         2
#>  7 TRUE         3
#>  8 FALSE        4
#>  9 FALSE        4
#> 10 FALSE        4
#> 11 FALSE        4
#> 12 FALSE        4
#> 13 FALSE        4
#> 14 FALSE        4
#> 15 FALSE        4
#> 16 FALSE        4
#> 17 FALSE        4
#> 18 FALSE        4
#> 19 TRUE         5

A: Does this work with your data:
> library(dplyr)
> df %>% mutate(Event = V1 > 20) %>% mutate(id = rep(rle(Event)$lengths, rle(Event)$lengths)) %>% group_by(Event) %>%
+   mutate(Event = case_when(Event == FALSE & n() <= 10 ~ TRUE, TRUE ~ TRUE)) %>% mutate(id = max(id))
# A tibble: 10 x 4
# Groups:   Event [1]
   Time        V1 Event    id
   <time>   <dbl> <lgl> <int>
 1 20:15:57  26.4 TRUE      6
 2 20:15:57  25.1 TRUE      6
 3 20:15:57  23.7 TRUE      6
 4 20:15:57  22.4 TRUE      6
 5 20:15:57  21.3 TRUE      6
 6 20:15:57  20.4 TRUE      6
 7 20:15:58  19.9 TRUE      6
 8 20:15:58  19.7 TRUE      6
 9 20:15:58  19.8 TRUE      6
10 20:15:58  20.4 TRUE      6
>


text:
Q: String operations not working with special characters I opened a text file using utf-8 encoding. I am trying to do operations on the strings like line[0], but it is not working correctly because of special characters in the text file. Most of the time, it does not return anything.
import codecs
with codecs.open('test_2014.txt', mode='r', encoding='utf-8') as document:
    OnCode = False
    for line in document:
        conv = line.encode('utf-8')
        print conv[0]

If I try this with a text file that says:
Hello
!

it will return H and !.
If I try this with a text file that says:
Hello
!
§

it only prints H.

A: Your code reads a full string into the variable line which is encoded into conv Since that is a string, conv[i] gives you one of the characters in the string. If you have more than one word in the line, then use `split()1
for line in document:
    conv = line.encode('utf-8')
    print conv[0]

When you enter Hello as the first line
>>>print conv
Hello
>>>print conv[0]
H
>>> print conv[1]
e

For more than one word in line
for line in document:
    conv = line.encode('utf-8').split(' ')
    print conv[0]

When you enter Hello World you get
>>>print conv
Hello World
>>>print conv[0]
Hello
>>> print conv[1]
World


text:
Q: Migrating legacy code with Log4j to Slf4J. What about 3rd party dependencies using Log4J? So I have read the migration document on how you port code from Log4J to SLF4J Api, but I am still unclear what you do when your legacy code 3rd party dependencies have a dependency on Log4J.  I obviously, don't want my final executable jar file to contain the Log4J jar, so I can of course add an exclusion in my project pom file, but isn't that a big risk, as the 3rd party code could in theory be using aspects of Log4J that are not covered via the Log4J-over-slf4j implementation and you then run the risk of a runtime exception as the required binaries are not present on the classpath?
Or maybe I am wrong and instead of excluding the Log4J jar file, you just make sure that your classpath definition has log4j-over-slf4j before that of Log4j.

A:
Obviously, don't want my final executable jar file to contain the Log4J jar.

Not necessarily so.  There is another way.  You could use a hybrid of slf4j + whatever logging backend for your code, and continue to use log4j for the problematic dependencies.  You will then end up with two sets of log files.  But that is not the end of the world ...
If you are doing this to deal with log4j vulnerabilities, they can be fixed or mitigated in other ways, depending on whether you are talking about log4j 1.2.x or log4j 2.x.  The details are in https://logging.apache.org/log4j/2.x/security.html

... so I can of course add an exclusion in my project pom file, but isn't that a big risk, as the 3rd party code could in theory be using aspects of Log4J that are not covered via the Log4J-over-slf4j implementation and you then run the risk of a runtime exception as the required binaries are not present on the classpath?

Yes.  There is a risk.  But you should be able to address that by testing your code.   The risk only becomes a real problem if the 3rd-party library is actually using log4j API methods that the bridge code doesn't implement.  If it does, you should quickly see class loader errors when your code attempts to use the affected parts of the 3rd party library:

*

*The problem may not exist at all in the library codebase1.

*The problem may be isolated to parts of the library that your application doesn't use.

Either way ... if you test your application thoroughly you should be able to tell if this is a real issue ... or if you are just worrying about a hypothetical problem.

If it does turn out that the bridging approach doesn't work then you have a number of alternatives:

*

*Update the dependencies to a newer version of the library that uses slf4j, or log4j2, or something else that is acceptable.

*Incentivize the library supplier / vendor to fix their problem with legacy logging; e.g offer to pay them, or threaten to cancel your support contract, or ...

*See if it is feasible to fork the library and port it to use a more modern logging solution.

*See if it is feasible to fork the log4j-over-slf4j bridge library and add support for the missing log4j APIs.  (The feasibility will depend what is missing and what the 3rd-party library needs.)

*Ditch the dependency and look for something better.  There will often be other long-term benefits in doing that.

*Employ a contractor who has the skills and confidence to sort out the problem for you.

1 - It would be possible to determine this by forensically examining the 3rd-party library source code, or its .class files to see which logging classes and methods it references.


text:
Q: How to get Only the different columns from two tables I have two tables with the same columns. That I need to compare and get only the columns with modifications.
ID is the primary key and its what can be use to compare table A and Table B.
Table A the Original table and Table B is new table that will have the same modified data.
Table A
+----+------+---------+---------+-----------+
| ID | Name |  Color  | Country |   City    |
+----+------+---------+---------+-----------+
|  1 | Jim  | Red     | SP      | Barcelona |
|  2 | Hugh | Blue    | PT      | Lisbon    |
|  3 | Marc | Violtet | UK      | London    |
+----+------+---------+---------+-----------+

Table B
+----+--------+---------+---------+------------+
| ID |  Name  |  Color  | Country |    City    |
+----+--------+---------+---------+------------+
|  1 | Jim    | Blue    | SP      | Lisbon     |
|  2 | Roosie | Blue    | PT      | Lisbon     |
|  3 | Marc   | Violtet | UK      | Manchester |
+----+--------+---------+---------+------------+

How can i make a query that give me only the modified data
Example
ID 1  Old Color Red New color blue.
Id 1   Old City Barcelona New City Lisbon.
...

can you help me?

A: You could use union all to unpivot each table, join the results and filter on changed values:
select
    a.id,
    a.col,
    a.val old_value,
    b.val new_value
from (
    select 'name' col, id, name val from table_a
    union all select 'color', id, color from table_a
    union all select 'country', id, country from table_a
    union all select 'city', id, city from table_a
) a
inner join (
    select 'name' col, id, name val from table_b
    union all select 'color', id, color from table_b
    union all select 'country', id, country from table_b
    union all select 'city', id, city from table_b
) b
    on a.id = b.id and a.col = b.col and a.val <> b.val
order by a.id, a.col

I am not generating the text that describes the differences because I find that it is most convenient to understand and manipulate columns, but you can easily do it with string concatenations.
Demo on DB Fiddle:

ID | COL   | OLD_VALUE | NEW_VALUE
-: | :---- | :-------- | :---------
 1 | city  | Barcelona | Lisbon
 1 | color | Red       | Blue
 2 | name  | Hugh      | Roosie
 3 | city  | London    | Manchester

A: You can do it like this:
select a.id, case when a.color!=b.color then 'old color '||a.color||' new color '||b.color end as color_change, .... same for all columns you want
from tablea a join tableb b on (a.id=b.id)
where a.color!=b.color or a.city!=b.city ...

This will give you one line per id. If you want a line per (id, attribute), the best performing SQL depends on the size of the tables, as well as the delta (i.e. how many rows are different). You can try this:
with delta as (select a.id, a.color, a.name, a.city, ..., b.name as bname, b.color as bcolor, ...
from tablea a join tableb b on (a.id=b.id)
where a.color!=b.color or a.city!=b.city ...)
select id, 'Old Color '||color||' new color '||bcolor
from delta where color!=bcolor
union all
select id, 'Old City '||city||' new city '||bcity
from delta where city!=bcity
union all
 .....


text:
Q: доступ к элементу object(stdClass) доброго времени суток.
есть такой вот объект:
$res = object(stdClass)#3 (3) {
["size"]=> "16",
["validator"]=> "",
["validator-error"]=> "не работает",
}

если я пишу $res->size , то получу 16 ,
но если пишу $res->validator-error , то получу только Notice: Use of undefined constant error - assumed 'error' in ...
как получить значение validator-error в этом объекте?

A: В php имеется в наличии сложный (фигурный) синтаксис, он позволяет использовать сложные выражения. Любая скалярная переменная, элемент массива или свойство объекта, может быть представлена в строке этим синтаксисом. Просто надо написать выражение, заключив его в { и } .
Чаще это используется в строках. Но можно и вне их также спокойно делать.
Как пример
class foo {
    var $bar = 'I am bar.';
}

$foo = new foo();
$bar = 'bar';
$baz = array('foo', 'bar', 'baz', 'quux');
echo "{$foo->$bar}\n";
echo "{$foo->{$baz[1]}}\n";

Соответственно, если вы не хотите конвертировать свой объект в массив (а это тоже можно и законом не запрещено), а хотите обращаться к полю объекта, то можно использовать этот самый фигурный синтаксис.
В вашем случае это будет так:
$res->{'validator-error'}

A: Можно так
((array)$res)['validator-error']

A:
Правильное имя переменной должно начинаться с буквы или символа
  подчеркивания и состоять из букв, цифр и символов подчеркивания в
  любом количестве.

Переменная в PHP не может содержать символ "-".


text:
Q: React showing two component at a single time I am having 2 routes and 2 component like
<Route path=`/admin/login/` exact  component={Login} />
<Route path="/admin/:file?/:id?"  component={Main} />

when i am having http://localhost:3000/admin/login i just want to show the Login component but it's showing both component

A: It shows the second route too because it thinks that parameter ':file?' is the '/login', for this thing Switch exist(just like switch statements, it chooses only one route):
import {BrowserRouter, Route, Switch } from "react-router-dom";
<BrowserRouter>
    <Switch>
        <Route path=/admin/login/exact  component={Login} />
        <Route path="/admin/:file?/:id?" exact component={Main} />
    </Switch>
</BrowserRouter>

A: If the exact doesn't work.
Maybe did try to send file and and id for props or save that in the async storage.
Another way you could change the route like
<Route path="/admin/main" exact component={Main} />


text:
Q: Ionic Inappbrowser to picking up exit event My app which is built on ionic has an inapp browser that opens a url. This works fine.
I need to identify when and if the user clicks the close/"X" button on it to run a function.
I have tried the exit eventlistener but it is not fired when the browser is closed.
I have tried the below.
var ref = window.open($scope.url, '_blank');

then
ref.addEventListener('exit', $scope.bclose());
    $scope.bclose = function(){
        alert('Close');
    }

also
ref.addEventListener('exit', function(event) {
   alert('Browser Closed');
});

I however have a loadstop listener which works fine.
Any help is greatly appreciated.

A: Try to use following way. It is working fine.
 $scope.openLink = function (url) {

        var ref = cordova.InAppBrowser.open(url, '_blank', 'location=yes');

        ref.addEventListener('exit', function(){
         alert('exit');
        });

    }

I am using following cordova inappbrowser version in my config.xml
<plugin name="cordova-plugin-inappbrowser" src="https://github.com/apache/cordova-plugin-inappbrowser.git" version="1.4.1-dev" />

A: try this:-
 when you open it in _self the state management of the app is handled.
$ scope.openLink = function (url) {
    var ref = cordova.InAppBrowser.open(url, '_self', 'location=yes');

    ref.addEventListener('exit', function(){
     alert('exit');
    });

}