text:
Q: c# clase para gestionar distintos proveedores de BD Tengo el siguiente código , esta clase donde defino la interface
namespace classBD.clases.connexiones
{

    public interface IConexion
    {
        void OpenConection();
        void CloseConnection();
        void ExecuteQueries(string Query);
        object ShowDataInGridView(string Query);
        DbDataReader DataReader(string Query);
        Boolean Ejecutar(string query, Dictionary<string,string> parametros);

    }

    public class ConnectionFactory
    {
       public static IConexion GetConnection()
       {
           string valconfig = "sqlite";
           if(valconfig == "sqlite")
               return new conexionSQlite();
           else
               return new conexionSQLServer();
       }
    }

}

Luego tengo una implementación para sqlServer y otra para Sqllite (pongo solo un trozo de código)
namespace classBD.clases.connexiones
{

    public class conexionSQlite : IConexion
    {
        SQLiteConnection conexionSQLite;

        public void OpenConection()
        {
            conexionSQLite = new SQLiteConnection(ConnectionString);
            try
            {
                conexionSQLite.Open();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
        }

        public void CloseConnection()
        {
            conexionSQLite.Close();
        }

    ...
    ...

        public Boolean Ejecutar(string query, Dictionary<string, string> parametros)
        {
            Boolean retorno = true;
            this.OpenConection();
            SQLiteCommand Comando = new SQLiteCommand(query, conexionSQLite);
            foreach (var p in parametros)
            {
                Comando.Parameters.Add(p);
            }

            try
            {
                Comando.ExecuteNonQuery();
            }
            catch
            {
                retorno = false;
            }

            return retorno;
        }

    }
}

Luego tengo algo parecido para sql server.
Al ejecutar este código el error que recibo es este
Gracias

A: Falta algo de información en tu pregunta, pero imagino que lo que quieres es tener un diccionario con el nombre del parámetro y su valor, y añadirles a la coleccion de parámetros. Para eso, lo primero deberías usar el método AddWithValue en lugar de Add de la colección Parameters. Tu código deberia quedar asi:
foreach (var p in parametros)
{
     Comando.Parameters.AddWithValue(p.Key, p.Value);
}

Para completar, el error que te da es porque no puedes añadir un KeyValuePair a la colección de parametros. Si quieres añadir solo el nombre del parametro para poner su valor a posteriori, tu código debería ser:
Comando.Parameters.Add(p.key,SqlDbType.VarChar); //Aqui debe ir el tipo que corresponda

Como entiendo que no quieres preocuparte de los tipos de los parámetros, la mejor solución en tu caso sea probablemente la primera usando AddWithValue

A: Cuando estás haciendo esta parte del código:
SQLiteCommand Comando = new SQLiteCommand(query, conexionSQLite);
foreach (var p in parametros)
{
    Comando.Parameters.Add(p);
}

En concreto en el .Add deberás usar alguna de las sobrecargas que tenga, si mal no recuerdo una de las que te puede servir es la de pasarle un new SQLiteParameter() por lo que te quedaría el código así:
SQLiteCommand Comando = new SQLiteCommand(query, conexionSQLite);
foreach (var p in parametros)
{
    Comando.Parameters.Add(new SQLiteParameter(p.Key,p.Value));
}

Finalmente como consejo he visto que usas var para la definición temporal del foreach, te recomiendo que si sabes que tipo es uses el correcto ya que con esto prevendrás futuros errores.


text:
Q: Array of PHP Objects So I have been searching for a while and cannot find the answer to a simple question. Is it possible to have an array of objects in PHP? Such as:
$ar=array();
$ar[]=$Obj1
$ar[]=$obj2

For some reason I have not been able to find the answer anywhere. I assume it is possible but I just need to make sure.

A: Arrays can hold pointers so when I want an array of objects I do that.
$a = array();
$o = new Whatever_Class();
$a[] = &$o;
print_r($a);

This will show that the object is referenced and accessible through the array.

A: Another intuitive solution could be:
class Post
{
    public $title;
    public $date;
}

$posts = array();

$posts[0] = new Post();
$posts[0]->title = 'post sample 1';
$posts[0]->date = '1/1/2021';

$posts[1] = new Post();
$posts[1]->title = 'post sample 2';
$posts[1]->date = '2/2/2021';

foreach ($posts as $post) {
  echo 'Post Title:' . $post->title . ' Post Date:' . $post->date . "\n";
}

A: Yes.
$array[] = new stdClass;
$array[] = new stdClass;

print_r($array);

Results in:
Array
(
    [0] => stdClass Object
        (
        )

    [1] => stdClass Object
        (
        )

)

A: The best place to find answers to general (and somewhat easy questions) such as this is to read up on PHP docs. Specifically in your case you can read more on objects. You can store stdObject and instantiated objects within an array. In fact, there is a process known as 'hydration' which populates the member variables of an object with values from a database row, then the object is stored in an array (possibly with other objects) and returned to the calling code for access.
-- Edit --
class Car
{
    public $color;
    public $type;
}

$myCar = new Car();
$myCar->color = 'red';
$myCar->type = 'sedan';

$yourCar = new Car();
$yourCar->color = 'blue';
$yourCar->type = 'suv';

$cars = array($myCar, $yourCar);

foreach ($cars as $car) {
    echo 'This car is a ' . $car->color . ' ' . $car->type . "\n";
}

A: Yes, its possible to have array of objects in PHP.
class MyObject {
  private $property;

  public function  __construct($property) {
    $this->Property = $property;
  }
}
$ListOfObjects[] = new myObject(1);
$ListOfObjects[] = new myObject(2);
$ListOfObjects[] = new myObject(3);
$ListOfObjects[] = new myObject(4);

print "<pre>";
print_r($ListOfObjects);
print "</pre>";

A: You can do something like this:
$posts = array(
  (object) [
    'title' => 'title 1',
    'color' => 'green'
  ],
  (object) [
    'title' => 'title 2',
    'color' => 'yellow'
   ],
   (object) [
     'title' => 'title 3',
     'color' => 'red'
   ]
);

Result:
var_dump($posts);

array(3) {
  [0]=>
  object(stdClass)#1 (2) {
    ["title"]=>
    string(7) "title 1"
    ["color"]=>
    string(5) "green"
  }
  [1]=>
  object(stdClass)#2 (2) {
    ["title"]=>
    string(7) "title 2"
    ["color"]=>
    string(6) "yellow"
  }
  [2]=>
  object(stdClass)#3 (2) {
    ["title"]=>
    string(7) "title 3"
    ["color"]=>
    string(3) "red"
  }
}

A: Although all the answers given are correct, in fact they do not completely answer the question which was about using the [] construct and more generally filling the array with objects.
A more relevant answer can be found in
how to build arrays of objects in PHP without specifying an index number?
which clearly shows how to solve the problem.

redpajama_set_name: RedPajamaStackExchange


text:
Q: What is the best data structure to implement a queue? I only need the operations enque and dequeue.

A: You could use an array (continuous spaces in memory)
You could also use a linked list (not necessarily continous)
Array and its fancier derivatives (ArrayList, vector, etc) may be more complicated. They aren't as efficient because if you start adding too many elements, you may run out of continous memory space and you will have to copy everything in your queue over to a new block of memory.
A linked list to me seems pretty efficient as long as you keep track of the front and back (head and tail, whatever you want to call it).
This may help: https://www.cs.bu.edu/teaching/c/queue/linked-list/types.html

A: From a theoretical standpoint, a singly-linked list with both a head and a tail. Remove from the front, append to the tail. There you have the theoretical O(1) constant-time complexity (even for worst-case) with less storage than a doubly-linked list.
From a practical standpoint, a growable array-based contiguous structure can perform better using circular indexing. The hardware excels at dealing with contiguous memory due to the spatial locality (cache lines that fit multiple adjacent elements, e.g.). Those have a worse algorithmic complexity with only amortized constant time and a worst-case linear-time complexity (though it's so infrequent that it generally doesn't matter very much).
Also from a practical standpoint, an unrolled list could work well (basically arrays of multiple elements stored in nodes that are linked together, giving you the locality of reference + guaranteed constant-time enqueues and dequeues).
"Best" is really hard to say here since it depends on your needs.
For example, the singly-linked list with a tail has the weakness of allocation/deallocation overhead per node and the lost locality of reference, unless you back that with an efficient, contiguous allocator that helps mitigate these weaknesses. It also pays a memory overhead of a list pointer/ref per element (plus potentially some more due to the separate allocations per node). As pointed out in the comments, linked lists are generally nowhere near as good as they sound because they don't line up quite as well (at least without a lot of help from an allocator) with the actual nature of the hardware.
The circular array has a weakness where it needs excess capacity to reduce the number of reallocations (or else that worst-case linear time complexity is going to kick in more frequently) and copies (though they could be shallow in some cases). Also since it's just one big contiguous memory block, if you're working with enormous data sets, you could get out of memory errors even on a machine with virtual addressing (out of memory doesn't necessarily mean all memory has been used up in such cases, it means that a contiguous set of unused pages matching the requested size wasn't found).
The unrolled list mitigates the list pointer and node allocation overhead but stores some excess capacity in nodes which could be quite wasteful if you're, say, using an unrolled list with the capacity to store 64 elements per node and you're just storing 3 elements in your queue.

A: I do not recommend array (OR any data structure which is implemented on top of array) because dequeue operation will lead to shifting of all the elements.In this case i would go for single ended linkedList where you insert at the end and remove from the begining but if you want to remove from the last then you need doubly linkedlist because you will need a handle on penultimate node to remove the last node (dequeue) which would lead to scanning the complete list in case of single pointer linkedlist.


text:
Q: Bootstrap navbar button toggler suddenly stopped working (hamburger menu) when I clicked on the hamburger menu it used to work then suddenly stopped

    Tindog
     <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

  </button>

            Contact

            Pricing

            Download

I've included bootstrap and jquery .


text:
Q: Can't import a module from another crate - unresolved import I am trying to write a crate called bar, the structure looks like this
src/
├── bar.rs
└── lib.rs

My src/lib.rs looks like this
#![crate_type = "lib"]
#![crate_name = "bar"]
#![feature(ip_addr)]
#[allow(dead_code)]
pub mod bar;

My bar.rs has
pub struct baz {
  // stuff
}

impl baz {
  // stuff
}

Now when I try to use this crate in another crate like:
extern crate bar;

use bar::baz;

fn main() {
    let cidr = baz::new("Hi");
    println!("{}", cidr.say());
}

This fails with
error: unresolved import `bar::baz`. There is no `baz` in `bar`

Do I need to declare the module somewhere else?

A: The important part you are missing is that crates define their own module. That is, your crate bar implicitly defines a module called bar, but you also have created a module called bar inside that. Your struct resides within this nested module.
If you change your main to use bar::bar::baz; you can progress past this. You will have to decide if that's the structure you want though. Most idiomatic Rust projects would not have the extra mod and would flatten it out:
src/lib.rs
pub struct Baz {
    // stuff
}

impl Baz {
    // stuff
}

Unfortunately, your example code cannot compile, as you have invalid struct definitions, and you call methods that don't exist (new), so I can't tell you what else it will take to compile.
Also, structs should be PascalCase.


text:
Q: Layout not scrolling up? I tried everything but my layout is not scrolling. I wanted to scroll whole page not just the GridView. Please if anyone can help me to resolve this. I tried to make ScrollView as parent as well as child of relative layout but it won't work for me. I don't want to change my layout but I just want to scroll the layout so that I can add more CardViews.
Here is my code of layout.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@mipmap/bg">

    <ScrollView
        android:fillViewport="true"
        android:scrollbars="none"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:isScrollContainer="true">

        <LinearLayout
            android:orientation="vertical"
            android:weightSum="7"
            android:scrollbars="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <RelativeLayout
                android:layout_weight="1.4"
                android:layout_width="match_parent"
                android:layout_height="0dp">

                <TextView
                    android:id="@+id/textGrid"
                    android:text="SCHOOL NAME"
                    android:textSize="34sp"
                    android:textColor="@android:color/white"
                    android:layout_alignParentBottom="true"
                    android:layout_marginBottom="10dp"
                    android:layout_centerInParent="true"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

            </RelativeLayout>

            <GridLayout
                android:id="@+id/mainGrid"
                android:columnCount="2"
                android:rowCount="3"
                android:alignmentMode="alignMargins"
                android:columnOrderPreserved="false"
                android:layout_weight="8"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:padding="14dp">

                <!-- Row 1 -->
                <!-- Column 1 -->
                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_rowWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    app:cardElevation="8dp"
                    app:cardCornerRadius="8dp">

                    <LinearLayout
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:src="@mipmap/me_time"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                        <TextView
                            android:text="Me"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <!-- Column 2 -->
                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_rowWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    app:cardElevation="8dp"
                    app:cardCornerRadius="8dp"
                    >

                    <LinearLayout
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:src="@mipmap/family_time"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                        <TextView
                            android:text="Family"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <!-- Row 2 -->

                <!-- Column 1 -->
                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_rowWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    app:cardElevation="8dp"
                    app:cardCornerRadius="8dp"
                    >

                    <LinearLayout
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:src="@mipmap/lovely_time"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                        <TextView
                            android:text="Lovely"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <!-- Column 2 -->
                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_rowWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    app:cardElevation="8dp"
                    app:cardCornerRadius="8dp"
                    >

                    <LinearLayout
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:src="@mipmap/team_time"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                        <TextView
                            android:text="Team"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <!-- Row 2 -->

                <!-- Column 1 -->
                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_rowWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    app:cardElevation="8dp"
                    app:cardCornerRadius="8dp"
                    >

                    <LinearLayout
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:src="@mipmap/friends"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                        <TextView
                            android:text="Friends"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <!-- Column 2 -->
                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_rowWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    app:cardElevation="8dp"
                    app:cardCornerRadius="8dp"
                    >

                    <LinearLayout
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:src="@mipmap/calendar"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                        <TextView
                            android:text="Calendars"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_rowWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    app:cardElevation="8dp"
                    app:cardCornerRadius="8dp"
                    >

                    <LinearLayout
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:src="@mipmap/calendar"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                        <TextView
                            android:text="Calendars"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_rowWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    app:cardElevation="8dp"
                    app:cardCornerRadius="8dp"
                    >

                    <LinearLayout
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:src="@mipmap/calendar"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                        <TextView
                            android:text="Calendars"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_rowWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    app:cardElevation="8dp"
                    app:cardCornerRadius="8dp"
                    >

                    <LinearLayout
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:src="@mipmap/calendar"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                        <TextView
                            android:text="Calendars"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_rowWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    app:cardElevation="8dp"
                    app:cardCornerRadius="8dp"
                    >

                    <LinearLayout
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:src="@mipmap/calendar"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                        <TextView
                            android:text="Calendars"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_rowWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    app:cardElevation="8dp"
                    app:cardCornerRadius="8dp"
                    >

                    <LinearLayout
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:src="@mipmap/calendar"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                        <TextView
                            android:text="Calendars"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="0dp"
                    android:layout_height="0dp"
                    android:layout_columnWeight="1"
                    android:layout_rowWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    app:cardElevation="8dp"
                    app:cardCornerRadius="8dp"
                    >

                    <LinearLayout
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content">

                        <ImageView
                            android:src="@mipmap/calendar"
                            android:layout_gravity="center_horizontal"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />

                        <TextView
                            android:text="Calendars"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content" />
                    </LinearLayout>
                </android.support.v7.widget.CardView>
            </GridLayout>
        </LinearLayout>
    </ScrollView>
</RelativeLayout>

A: Try below code.Scroll working fine now.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@mipmap/bg">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:scrollbars="none">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:scrollbars="vertical">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <TextView
                    android:id="@+id/textGrid"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:layout_centerInParent="true"
                    android:layout_marginBottom="10dp"
                    android:text="SCHOOL NAME"
                    android:textColor="@android:color/white"
                    android:textSize="34sp" />

            </RelativeLayout>

            <GridLayout
                android:id="@+id/mainGrid"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:alignmentMode="alignMargins"
                android:columnCount="2"
                android:columnOrderPreserved="false"
                android:padding="14dp"
                android:rowCount="3">

                <!-- Row 1 -->
                <!-- Column 1 -->
                <android.support.v7.widget.CardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@mipmap/me_time" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Me"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <!-- Column 2 -->
                <android.support.v7.widget.CardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@mipmap/family_time" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Family"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <!-- Row 2 -->

                <!-- Column 1 -->
                <android.support.v7.widget.CardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@mipmap/lovely_time" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Lovely"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <!-- Column 2 -->
                <android.support.v7.widget.CardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@mipmap/team_time" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Team"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <!-- Row 2 -->

                <!-- Column 1 -->
                <android.support.v7.widget.CardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@mipmap/friends" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Friends"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <!-- Column 2 -->
                <android.support.v7.widget.CardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@mipmap/calendar" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Calendars"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@mipmap/calendar" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Calendars"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@mipmap/calendar" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Calendars"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@mipmap/calendar" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Calendars"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@mipmap/calendar" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Calendars"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@mipmap/calendar" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Calendars"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold" />

                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_columnWeight="1"
                    android:layout_marginBottom="16dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_rowWeight="1"
                    app:cardCornerRadius="8dp"
                    app:cardElevation="8dp">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal|center_vertical"
                        android:layout_margin="16dp"
                        android:orientation="vertical">

                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:src="@mipmap/calendar" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Calendars"
                            android:textAlignment="center"
                            android:textColor="@android:color/black"
                            android:textSize="18sp"
                            android:textStyle="bold" />
                    </LinearLayout>
                </android.support.v7.widget.CardView>

            </GridLayout>
        </LinearLayout>
    </ScrollView>
</RelativeLayout>


text:
Q: How to position topLevel() widget relative to root window? I have created a topLevel widget and was wondering if there was a way to position the new window relative to the root window.

A: You can skip getting/setting the dialog width/height and set only its X, Y position:
x = root.winfo_x()
y = root.winfo_y()
toplevel.geometry("+%d+%d" % (x + 100, y + 200)))

Replace 100 and 200 with relative X, Y to your root window.

A: Get root window position:
x = root.winfo_x()
y = root.winfo_y()

Use geometry to set the position:
w = toplevel.winfo_width()
h = toplevel.winfo_height()
toplevel.geometry("%dx%d+%d+%d" % (w, h, x + dx, y + dy))

where dx and dy are the offsets from the current position.


text:
Q: Prove that $f \left(\lambda x + (1- \lambda )x' , \lambda y +(1- \lambda )y' \right) > \min \{f(x,y), f(x',y')\}$
Let $f(x,y)=xy$ where $x,y\geq 0$. Prove that the function $f$ satisfies the following property: $$f \left(\lambda x + (1- \lambda )x' , \lambda y +(1- \lambda )y' \right) \geq \min \{f(x,y), f(x',y')\}$$
   for all $(x,y) \neq (x',y')$ and $ \forall\; \lambda \in (0,1)$

This is a problem from an olympiad book. My try:
The left side of the inequality is a quadratic in $\lambda$ i.e. $$ (x-x')(y-y')\lambda^2 + \left\{(x-x')y' + (y-y')x'\right\}\lambda + x'y'$$ I'm unable to find the minimum value of above quadratic in $(0,1)$. Also, how to deal with $\min{\{xy,x'y'\}}$.
Thank you.

A: To simplify, let $m:=\min\{xy,x'y'\}$.
We can write $f \left(\lambda x + (1- \lambda )x' , \lambda y +(1- \lambda )y' \right)$ as:
\begin{eqnarray}
f \left(\lambda x + (1- \lambda )x' , \lambda y +(1- \lambda )y' \right) & = &
(\lambda x + (1- \lambda )x')(\lambda y +(1- \lambda )y')\\
& = & \lambda^2xy+\lambda(1-\lambda)(xy'+x'y)+(1-\lambda)^2x'y'
\end{eqnarray}
Now we prove $xy'+x'y\geq 2m$, looking at all possible cases:

*

*$x\geq x',y\geq y'\Rightarrow xy'\geq x'y', x'y\geq x'y'\Rightarrow xy'+x'y\geq 2x'y'=2m$

*$x\leq x',y\leq y'$. Very similar to case 1.

*$x\geq x',y\leq y'$. Note $$
0\geq (x-x')(y-y')=xy-(x'y+xy')+x'y'\\
\Rightarrow x'y+xy'\geq xy+x'y'\geq 2m
$$

*$x\leq x',y\geq y'$. Same as case 3.

We have $xy'+x'y\geq 2m$ and $xy\geq m, x'y'\geq m$, and since $(x,y)\neq (x',y')$, some of the inequalities will be strict. Hence
\begin{eqnarray}
f \left(\lambda x + (1- \lambda )x' , \lambda y +(1- \lambda )y' \right) & = &
\lambda^2xy+\lambda(1-\lambda)(xy'+x'y)+(1-\lambda)^2x'y'\\
& > & m\lambda^2+2m\lambda(1-\lambda)+m(1-\lambda)^2\\
& = & m(\lambda+(1-\lambda))^2\\
& = & m
\end{eqnarray}


text:
Q: My js script is to toggle "active" class between selections on a sidebar menu but only allows toggling for the first selection My issue is I am only able to toggle "active" class on my first "side-menu" div and not the others. Please take a look at my codes and let me know what is wrong.
When active, there will be a span on the left showing that it is the current selection, refer to the attached image.
HTML SCRIPT

Beverages

Burger

Pizza

Pasta

Sides

Desserts

CSS SCRIPT
.side-menu.active p::after{
content: '';
background-color: var(--clr-primary);
width: 10px;
height: 100px;
position: absolute;
left: 0px;
top: 5px;

JS SCRIPT
let sidemenu = document.querySelector('.side-menu')
let fbg = document.querySelector('.food-box-grid')
sidemenu.onclick=function(){
  sidemenu.classList.toggle('active')
  fbg.classList.toggle('active')
}

I can toggle active class on the "beverages" but not on the other options such as burger, pizza...

A: According to MDN

querySelector() returns the first Element within the document that matches the specified selector

You want to use querySelectorAll(), then iterate through the output and toggle the class for each element.
Something like this
let sidemenu = document.querySelectorAll('.side-menu')
let fbg = document.querySelectorAll('.food-box-grid')
sidemenu.onclick=function(){
  sidemenu.forEach((i) => {
    i.classList.toggle("active")
  })
  fbg.forEach((i) => {
    i.classList.toggle("active")
  })
}


text:
Q: EasyMock capture: use getValue() outside of an IAnswer Suppose I want to test a method Foo.doSomething(String arg):String using EasyMock. I know that I can use EasyMock Capture in order to capture the value set inside of the parameter and then get it at a later time. When writing my test, my goal is to capture the value when I mock out Foo's method and then get the value of the capture outside of my mocked method. I am trying something like this:
Capture<String> stringCapture = new Capture<String>();
EasyMock.expect(foo.doSomething(EasyMock.capture(stringCapture)).andAnswer(new IAnswer<String> {
    @Override
    public String answer() throws Throwable {
        ...
});
String retrievedValue = stringCapture.getValue();

However, I get a runtime error when I try to use getValue():
java.lang.AssertionError: Nothing captured yet
    at org.easymock.Capture.getValue(Capture.java:80)
    at com.example.Test.myTest(...)
    ....

I wish I could have a String variable within my test method but outside of the IAsnwer closure and set that variable's value inside of my IAnswer.answer() method. The problem is that the String variable must be marked as final in order to be accessible to the closure, which makes it unmodifiable and hence useless. Also, I do not wish to use a global just to solve this.
The only workaround I've thought of it to use my own class that has a String field, declare it as a final variable outside of IAnswer, set the captured value during answer() and finally set this value into a field within my test method. Perhaps there's a better way to do this because using another class to extract a captured value, or even a global variable, seems ugly to me.

A: The getValue will only work after the actual (replayed) call to foo. Before that, nothing is capture.
To set a variable inside answer(), because of Java requesting variables used in an inner class to be final, I normally use an AtomicReference. It's a nice placeholder for such things. The AtomicReference is then final but its content isn't.


text:
Q: Updating Ubuntu installed on a USB drive I have installed Ubuntu 16.04 on my 16 GB pen drive using Startup Disk Creator, now my pen drive doesn't have write permission, so I cannot format it. But I want to update it to Ubuntu 18.04 or 18.10. Can anyone help?

A: New version of a live Ubuntu system
If you want to update the USB pendrive with a new version of Ubuntu, simply download the iso file and use the Startup Disk Creator to install it. The old version will be overwritten and the new version will be there.
There will be a live (live-only) system, which can be modified temporarily (in RAM), but the modifications will not persist after shutdown or reboot.

Most likely, the USB pendrive is writable, but the file system is not. The Startup Disk Creator in Ubuntu 16.04 LTS and newer versions is a cloning tool, and it clones the ISO9660 file system from the iso file. This file system is read-only by design.
Persistent live Ubuntu system
If you want to add some program package or save some files, you can create a persistent live system with mkusb. It can save the modifications in a casper-rw partition, so that they persist after shutdown or reboot.
See the following links,
mkusb
mkusb/persistent

A: This isn't really a good idea to install an OS on a flash stick. Boot your pc from pendrive, download rufus (you use win as your main system, yes? because it's a windows app) and copy it onto hard drive then install. This app should do with formatting "non-writable" disc.
Or you can try making it accessible for anyone when on linux. Just try sudo chmod 777 /dev/sdx(x is your disc label you can check it with lsblk)


text:
Q: What is a cairngorm "Comparator" Can anyone explain this in easy to understand terms?

A: Here is Adobe's 5 part series - whether it is easy to understand depends on the individual users perspective!
Also this post describes the "comparator" much like a filter.


text:
Q: How to display Unicode character names and their hexadecimal codes with PowerShell? Since the default Windows PowerShell console fonts don't support Emojis, I'd like to display their surrogate pair hexadecimal codes and ideally also their Unicode character names for debugging purposes.
I know how to convert Emojis to a byte arrays, but I haven't figured out how to convert them to surrogate pair hexadecimal codes and Unicode character names.
$ThumbsUp = ""
$Bytes = [system.Text.Encoding]::UTF8.GetBytes($ThumbsUp)
# output
#240
#159
#145
#141

What I need is the following output:
$Hex = 0x1F44D
$CharName = "Thumbs Up Sign"

I.e., the following command should convert the hexadecimal value back to an Emoj:
[char]::ConvertFromUtf32($Hex)
# output
#

A: Maybe the following script (a part of my broader project) could help. The script defines fairly sophisticated Get-CharInfo function.
Example: 'r Ř',0x1F44D|chr -OutUni -OutHex -OutStr  -IgnoreWhiteSpace
r Ř
0x0072,0x002C,0x0158,0x0001F44D
\u0072\u002C\u0158\U0001F44D
Char CodePoint                              Category Description
---- ---------                              -------- -----------
   r {U+0072, 0x72}                  LowercaseLetter Latin Small Letter R
   Ř {U+0158, 0xC5,0x98}             UppercaseLetter Latin Capital Letter R With Caron
   {U+1F44D, 0xF0,0x9F,0x91,0x8D}               So THUMBS UP SIGN (0xd83d,0xdc4d)
 #             ↑ UFF-8                               ↑ name          ↑ surrogates

The code (comment-based help at the end of the function body):
# Get-CharInfo function. Activate dot-sourced
# . .\_get-CharInfo_2.1.ps1
# Comment-based help at the end of the function body
# History notes at the very end of the script

if ( -not ('Microsofts.CharMap.UName' -as [type]) ) {
  Add-Type -Name UName -Namespace Microsofts.CharMap -MemberDefinition $(
    switch ("$([System.Environment]::SystemDirectory -replace
                '\\', '\\')\\getuname.dll") {
    {Test-Path -LiteralPath $_ -PathType Leaf} {@"
[DllImport("${_}", ExactSpelling=true, SetLastError=true)]
private static extern int GetUName(ushort wCharCode,
    [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder buf);

public static string Get(char ch) {
    var sb = new System.Text.StringBuilder(300);
    UName.GetUName(ch, sb);
    return sb.ToString();
}
"@
    }
    default {'public static string Get(char ch) { return "???"; }'}
    })
}
function Get-CharInfo {
    [CmdletBinding()]
    [OutputType([System.Management.Automation.PSCustomObject],
                [System.Array])]
    param(
        # named or positional: a string or a number e.g. 'r Ř'
        # pipeline: an array of strings and numbers, e.g 'r Ř',0x1f44d
        [Parameter(Position=0, Mandatory, ValueFromPipeline)]
        $InputObject,
        # + Write-Host Python-like Unicode literal e.g. \u0072\u0020\u0158\U0001F44D
        [Parameter()]
        [switch]$OutUni,
        # + Write-Host array of hexadecimals e.g. 0x0072,0x0020,0x0158,0x0001F44D
        [Parameter()]
        [switch]$OutHex,
        # + Write-Host concatenated string e.g. r Ř
        [Parameter()]
        [switch]$OutStr,
        # choke down whitespaces ( $s -match '\s' ) from output
        [Parameter()]
        [switch]$IgnoreWhiteSpace,
        # from https://www.unicode.org/Public/UNIDATA/UnicodeData.txt
        [Parameter()]
        [string]$UnicodeData = 'D:\Utils\CodePages\UnicodeData.txt'
    )
    begin {
        Set-StrictMode -Version latest
        if ( [string]::IsNullOrEmpty( $UnicodeData) ) { $UnicodeData = '::' }
        Function ReadUnicodeRanges {
            if ($Script:UnicodeFirstLast.Count -eq 0) {
                $Script:UnicodeFirstLast = @'
                    First,Last,Category,Description
                    128,128,Cc-Control,Padding Character
                    129,129,Cc-Control,High Octet Preset
                    132,132,Cc-Control,Index
                    153,153,Cc-Control,Single Graphic Character Introducer
                    13312,19903,Lo-Other_Letter,CJK Ideograph Extension A
                    19968,40956,Lo-Other_Letter,CJK Ideograph
                    44032,55203,Lo-Other_Letter,Hangul Syllable
                    94208,100343,Lo-Other_Letter,Tangut Ideograph
                    101632,101640,Lo-Other_Letter,Tangut Ideograph Supplement
                    131072,173789,Lo-Other_Letter,CJK Ideograph Extension B
                    173824,177972,Lo-Other_Letter,CJK Ideograph Extension C
                    177984,178205,Lo-Other_Letter,CJK Ideograph Extension D
                    178208,183969,Lo-Other_Letter,CJK Ideograph Extension E
                    183984,191456,Lo-Other_Letter,CJK Ideograph Extension F
                    196608,201546,Lo-Other_Letter,CJK Ideograph Extension G
                    983040,1048573,Co-Private_Use,Plane 15 Private Use
                    1048576,1114109,Co-Private_Use,Plane 16 Private Use
'@ | ConvertFrom-Csv -Delimiter ',' |
                ForEach-Object {
                    [PSCustomObject]@{
                        First      = [int]$_.First
                        Last       = [int]$_.Last
                        Category   = $_.Category
                        Description= $_.Description
                    }
                }
            }
            foreach ( $FirstLast in $Script:UnicodeFirstLast) {
                if ( $FirstLast.First -le $ch -and $ch -le $FirstLast.Last ) {
                    $out.Category = $FirstLast.Category
                    $out.Description = $FirstLast.Description + $nil
                    break
                }
            }
        }
        $AuxHex = [System.Collections.ArrayList]::new()
        $AuxStr = [System.Collections.ArrayList]::new()
        $AuxUni = [System.Collections.ArrayList]::new()
        $Script:UnicodeFirstLast = @()
        $Script:UnicodeDataLines = @()
        function ReadUnicodeData {
            if ( $Script:UnicodeDataLines.Count -eq 0 -and (Test-Path $UnicodeData) ) {
                 $Script:UnicodeDataLines = @([System.IO.File]::ReadAllLines(
                        $UnicodeData, [System.Text.Encoding]::UTF8))
            }
            $DescrLine = $Script:UnicodeDataLines -match ('^{0:X4}\;' -f $ch)
            if ( $DescrLine.Count -gt 0) {
                $u0, $Descr, $Categ, $u3 = $DescrLine[0] -split ';'
                $out.Category = $Categ
                $out.Description = $Descr + $nil
            }
        }
        function out {
            param(
                [Parameter(Position=0, Mandatory=$true )] $ch,
                [Parameter(Position=1, Mandatory=$false)]$nil=''
                 )
            if (0 -le $ch -and 0xFFFF -ge $ch) {
                [void]$AuxHex.Add('0x{0:X4}' -f $ch)
                $s = [char]$ch
                [void]$AuxStr.Add($s)
                [void]$AuxUni.Add('\u{0:X4}' -f $ch)
                $out = [pscustomobject]@{
                    Char      = $s
                    CodePoint = ('U+{0:X4}' -f $ch),
                        (([System.Text.UTF32Encoding]::UTF8.GetBytes($s) |
                            ForEach-Object { '0x{0:X2}' -f $_ }) -join ',')
                    Category  = [System.Globalization.CharUnicodeInfo]::GetUnicodeCategory($ch)
                    Description = [Microsofts.CharMap.UName]::Get($ch)
                }
                if ( $out.Description -eq 'Undefined' ) { ReadUnicodeRanges }
                if ( $out.Description -eq 'Undefined' ) { ReadUnicodeData }
            } elseif (0x10000 -le $ch -and 0x10FFFF -ge $ch) {
                [void]$AuxHex.Add('0x{0:X8}' -f $ch)
                $s = [char]::ConvertFromUtf32($ch)
                [void]$AuxStr.Add($s)
                [void]$AuxUni.Add('\U{0:X8}' -f $ch)
                $out = [pscustomobject]@{
                    Char        = $s
                    CodePoint   = ('U+{0:X}' -f $ch),
                        (([System.Text.UTF32Encoding]::UTF8.GetBytes($s) |
                            ForEach-Object { '0x{0:X2}' -f $_ }) -join ',')
                    Category    = [System.Globalization.CharUnicodeInfo]::GetUnicodeCategory($s, 0)
                    Description = '???' + $nil
                }
                ReadUnicodeRanges
                if ( $out.Description -eq ('???' + $nil) ) { ReadUnicodeData }
            } else {
                Write-Warning ('Character U+{0:X4} is out of range' -f $ch)
                $s = $null
            }
            if (( $null -eq $s ) -or
                ( $IgnoreWhiteSpace.IsPresent -and ( $s -match '\s' ))
               ) {
            } else {
                $out
            }
        }
    }
    process {
        #if ($PSBoundParameters['Verbose']) {
        #    Write-Warning "InputObject $InputObject, type = $($InputObject.GetType().Name)"
        #}
        if ( ($InputObject -as [int]) -gt 0xFFFF -and
             ($InputObject -as [int]) -le 0x10ffff ) {
            $InputObject = [string][char]::ConvertFromUtf32($InputObject)
        }
        if ($null -cne ($InputObject -as [char])) {
            #Write-Verbose "A $([char]$InputObject) InputObject character"
            out $([int][char]$InputObject) ''
        } elseif (  $InputObject -isnot [string] -and
                    $null -cne ($InputObject -as [int])) {
            #Write-Verbose "B $InputObject InputObject"
            out $([int]$InputObject) ''
        } else {
            $InputObject = [string]$InputObject
            #Write-Verbose "C $InputObject InputObject.Length $($InputObject.Length)"
            for ($i = 0; $i -lt $InputObject.Length; ++$i) {
                if (  [char]::IsHighSurrogate($InputObject[$i]) -and
                      (1+$i) -lt $InputObject.Length -and
                      [char]::IsLowSurrogate($InputObject[$i+1])) {
                    $aux = ' (0x{0:x4},0x{1:x4})' -f [int]$InputObject[$i],
                                                   [int]$InputObject[$i+1]
                    # Write-Verbose "surrogate pair $aux at position $i"
                    out $([char]::ConvertToUtf32($InputObject[$i], $InputObject[1+$i])) $aux
                    $i++
                } else {
                    out $([int][char]$InputObject[$i]) ''
                }
            }
        }
    }
    end {
        if ( $OutStr.IsPresent -or $PSBoundParameters['Verbose']) {
            Write-Host -ForegroundColor Magenta -Object $($AuxStr -join '')
        }
        if ( $OutHex.IsPresent -or $PSBoundParameters['Verbose']) {
            Write-Host -ForegroundColor Cyan -Object $($AuxHex -join ',')
        }
        if ( $OutUni.IsPresent -or $PSBoundParameters['Verbose']) {
            Write-Host -ForegroundColor Yellow -Object $($AuxUni -join '')
        }
    }
<#
.SYNOPSIS
Return basic information about supplied Unicode characters.

.DESCRIPTION
Return information about supplied Unicode characters:
    - as a PSCustomObject for programming purposes,
    - in a human-readable form, and
    - with optional additional output to the Information Stream.

Properties of the output PSCustomObject are as follows:

Char        The character itself (if renderable)
CodePoint   [string[]]Unicode CodePoint, its UTF-8 byte sequence
Category    General Category (long name or abbreviation)
Description Name (and surrogate pair in parentheses if apply).

.INPUTS
    An array of characters, strings and numbers (in any combination)
    can be piped to the function as parameter $InputObject, e.g as
    "ΧАB",[char]4301,191,0x1F3DE | Get-CharInfo
    or (the same in terms of decimal numbers) as
    935,1040,66,4301,191,127966 | Get-CharInfo

    On the other side, the $InputObject parameter supplied named
    or positionally must be of the only base type: either a number
    or a character or a string.
    The same input as a string:
    Get-CharInfo -InputObject 'ΧАBჍ¿'

    -Verbose implies all -OutUni, -OutHex and -OutStr

.OUTPUTS
    [System.Management.Automation.PSCustomObject]
    [Object[]]    (an array like [PSCustomObject[]])

.NOTES
    The UnicodeData.txt file (if used) must be saved locally
    from https://www.unicode.org/Public/UNIDATA/UnicodeData.txt
    (currently Unicode 13.0.0)

    The UnicodeData.txt file is not required however, in such case,
    Get-CharInfo function could be return inaccurate properties
    Category and Description for characters above BMP, see Example-3.

.LINK
    Unicode® Standard Annex #44: Unicode Character Database (UCD)
.LINK
    https://www.unicode.org/reports/tr44/
.LINK
    https://www.unicode.org/reports/tr44/#General_Category_Values

.EXAMPLE
# full (first three lines are in the Information Stream)
'r Ř'|Get-CharInfo -OutUni -OutHex -OutStr -IgnoreWhiteSpace

r Ř
0x0072,0x0020,0x0158,0x0001F44D
\u0072\u0020\u0158\U0001F44D
Char CodePoint                             Category Description
---- ---------                             -------- -----------
   r {U+0072, 0x72}                 LowercaseLetter Latin Small Letter R
   Ř {U+0158, 0xC5,0x98}            UppercaseLetter Latin Capital Letter R W...
   {U+1F44D, 0xF0,0x9F,0x91,0x8D}              So THUMBS UP SIGN (0xd83d,0...

.EXAMPLE
# shortened version of above (output is the same)
'r Ř'|chr -Verbose -IgnoreWhiteSpace

.EXAMPLE
# inaccurate (inexact) output above BMP if missing UnicodeData.txt
'r Ř'|chr -Verbose -IgnoreWhiteSpace -UnicodeData .\foo.bar

r Ř
0x0072,0x0020,0x0158,0x0001F44D
\u0072\u0020\u0158\U0001F44D
Char CodePoint                             Category Description
---- ---------                             -------- -----------
   r {U+0072, 0x72}                 LowercaseLetter Latin Small Letter R
   Ř {U+0158, 0xC5,0x98}            UppercaseLetter Latin Capital Letter R W...
   {U+1F44D, 0xF0,0x9F,0x91,0x8D}     OtherSymbol ??? (0xd83d,0xdc4d)

.FUNCTIONALITY
Tested: Windows 8.1/64bit, Powershell 4
        Windows 10 /64bit, Powershell 5
        Windows 10 /64bit, Powershell Core 6.2.0
        Windows 10 /64bit, Powershell Core 7.1.0
#>
}
Set-Alias -Name chr -Value Get-CharInfo

<#
HISTORY NOTES

Origin by: http://poshcode.org/5234
           http://fossil.include-once.org/poshcode/artifact/5757dbbd0bc26c84333e7cf4ccc330ab89447bf679e86ddd6fbd3589ca24027e

License: CC0
  https://creativecommons.org/publicdomain/zero/1.0/legalcode

Activate dot-sourced like this (apply a real path instead of .\):
. .\Get-CharInfo.ps1

Improved by: https://stackoverflow.com/users/3439404/josefz
             (to version 2)
#>

A: Partial answer - I only know how to get the UTF-32 code point:
$ThumbsUp = ""
$utf32bytes = [System.Text.Encoding]::UTF32.GetBytes( $ThumbsUp )
$codePoint = [System.BitConverter]::ToUint32( $utf32bytes )
"0x{0:X}" -f $codePoint

Output:
0x1F44D

For the character names, you could possibly find an answer here:
Finding out Unicode character name in .Net

A: Here's a simple script to get the name.  Note emojis are two surrogate chars.  Making a hash is faster than using where-object, even for one search of a 34,626 line file.
# idChar.ps1

param($inputChar)

if (! (test-path $psscriptroot\UnicodeData.txt)) {
  wget http://www.unicode.org/Public/UNIDATA/UnicodeData.txt -outfile UnicodeData.txt
}
$unicode = import-csv $psscriptroot\UnicodeData.txt -Delimiter ';' -Header hexcode,
  name
$unicode | % { $hash = @{} } { $hash[[int]('0x' + $_.hexcode)] = $_ }
$hash[[char]::ConvertToUtf32($inputChar,($index=0))]

Examples (control v to paste in console, not right click, to use psreadline's paste function):
.\idChar

hexcode name
------- ----
1F44D   THUMBS UP SIGN

.\idChar —

hexcode name
------- ----
2014    EM DASH


text:
Q: Calculation of Work Typically I see problems laid out along these lines. If you are lifting a 100 kg weight 1 meter how much work do you do?
Work = Force * Distance
Work = (100 kg) (9.8 m/s^2) * 1 m = 980 J
But it seems to me that if I'm moving it I'm not just overcoming the downward acceleration of gravity. That would just hold it in place. I'm making headway (eventually it gets to 1 m of displacement). I could be accelerating it very quickly against gravity. I know that would be taken into account in Power, but it seems like it should apply to Work as well.
Can someone explain how I should be thinking about this?
Edit I'm guessing this is all about looking at potiential change of the box, but I'm not sure that really accounts for my total work, given the various accelerations I could have exerted.

A: The idea of net work encompasses the fact that while you may have to accelerate the mass initially to get it to move, it will also decelerate later (in other words, you can stop applying force a little bit before you reach the end, and let its momentum carry it the rest of the way).
Let's show this with a simple example. Assume I am trying to lift a mass M over a distance of h.  Now we take into account that I am initially accelerating the mass. Let's say I accelerate it over a distance d to get enough velocity that it can "coast" to the top. This means that the extra work I have to do over the first $d$ meters is just the work done to get the object to a total height $h$ - the velocity it needs to reach is such that $\frac12 m v^2 = mg(h-d)$. I will leave it up to you to prove that the extra force needed over the distance $d$ is indeed such that while I do more work in the first part of the lift, the total work done is still the same - it is exactly the work needed to overcome the potential energy
All this ignores certain physiological factors - like the fact that "perceived work" on your body is not linear, and that even holding a weight still appears to take work (in the physiological sense that is true - but not in the physics sense).

A: You can consider resolving the work needed to lift mass m as just throwing it up by initial speed
$V _ 0 =$ and the we know the height to which the mass is reached is .$  \  \ H=V_0^2/2g$
And $V_0^2=2gH$ and enrgy you gave to it is $E =1/2 mV^2=mgh$
which is the work needed to lift mass M to height H!

A: Although Floris and kamran have answered your question, I want to add something pertaining to your edit. Even if you exerted different accelerations, going along different paths, as far as you moved the object from a lower point A to a higher point B in a gravitational field, the work done by you would always be calculated as Force$\times$displacement.
This path independence is a special property of fields where there are no losses, and such fields are called conservative fields. If the gravitation field were not conservative, or lets say you were working against a non-conservative field (e.g. some frictional force), all the different routes you took would give you different amounts of work done.
The key really is whether there are losses (dissipation) or not. In fact, the absence of dissipation in a gravitational field is what allows us to write it purely in terms of a potential. You can't define such potentials in the presence of dissipation, or for non-conservative fields.
To imagine your situation, first remove the human and consider a machine doing the lifting. If the machine is holding the weight in place at a certain height, well lubricated wheels (negligible friction) will allow you to move the machine along with the lifted weight by just pushing it once -- your applied force is converted to kinetic energy without losses and you don't have to do further work to maintain the speed. Now imagine doing this in a flowing stream; you will have to continuously push and do work against the dissipative force of the stream even for horizontal movement, i.e. even if you are not doing work against gravity.


text:
Q: Changing single route part of URL I have the following route:
routes.MapRoute(
    "Default", // Route name
    "{language}/{controller}/{action}/{id}",
    new { language = "en", controller = "XY", id = UrlParameter.Optional }
);

For changing the language of the site, I would like to create links, which correspond exactly to the url of the current page, but have another language part.
What would be the best way, to generate such a link?

A: Most likely, you'll want to insert the {language} value as part of each link-rendering View's ViewModel or ViewData. There's a few different way you could achieve this; such as overloading your controller's OnActionExecuted() method. If you take this approach, I suggest making all of your controllers inherit from a single base controller.
protected override void OnActionExecuted(ActionExecutedContext filterContext)
{
    filterContext.Controller.ViewData["Language"] = GetUserLanguage();
    base.OnActionExecuted(filterContext);
}

And then in your View:
@Url.Action("Index", "Home", new { language = ViewData["Language"] })

Alternatively, you might consider overloading the Url.Action() and Html.ActionLink() methods with logic which appends this value automatically.

A: You could do something like this:
@Html.RouteLink("Switch Language", "Default", new {
    controller = ViewContext.RouteData.Values["controller"],
    action = ViewContext.RouteData.Values["action"],
    id = ViewContext.RouteData.Values["id"],
    language = "fr"
})

It would probably make sense to make an extension method to handle this though.


text:
Q: Does mapping a new drive influence the execution of the other batches in the master batch? So I have a master batch file in what I call 2 batches. The first one is mapping a new drive, and the other one is using an batch from that mapped drive.
As far as I know the batches should the batches should execute one after another (after the batch one is executed, the batch 2 is executing). But my problem is after the batch 1 is executed all other commands that I had written after it are not executed.
call mapping
set root = F:\a\b
pushd root
echo The current directory is %CD%
call batch2
pause

Do you know if the mapping can influence the order of execution of the batches ? Thanks a lot :)


text:
Q: side content bar material ui I'm interested in creating a content nav bar, similar to this one

This screenshot is taken from Material UI's site, but I haven't been able to find a component inside the library that resembles it. Is there one? Is there a way repurpose either a Drawer of an App Bar to replicate it?
Thanks

A: If it's always visible on the page that is just a normal div really.
Set it up in your  component (or wherever your routes are defined) so it is on every page


text:
Q: different Computer, different CultureInfo - Problems with datetime format "latvian"
*

*it is a web page (Asp.Net MVC), multi-language including english, latvian, lithuvian, russian, polonia.

*For selecting a date  we choose the jQuery-Ui-datepicker including extra localization files for each language. (Date is given as string:   "DateTime".ToString("d", new CultureInfo("lv")) )

All runs fine with all languages at my development computer (Win10, DotNet 4.5, Visual Studio 2012).
Running the web application at the server (Windows Server 2012 R2) other languages without problems. But the latvian language leads to problems.
I added trace code around the CultureInfo for Latvian 'lv'.
There is an difference between the CultureInfo.DateTimeFormat.ShortDatePattern between development notebook and web Server.
CultureInfo.DateTimeFormat.ShortDatePattern
- my computer: 'dd.MM.yyyy'
- web server : 'dd.MM.yyyy.'
the fastest solution would be: trim final point at datetime format.
(the javascript seems to work without the 'final point')

*

*Is it a Framework Bug ?

*

*which system needs a fix ? the server or my computer (inclusing javascript datepicker localization source)

*How to solve it in a nice way (so it doesnt seems hacky)

thanks,
Mathias


text:
Q: Statistics Hypothesis Testing + binomial table problem There is a problem in my statistics textbook (Wackerly 7th) I cannot seem to solve. The question is:
10.8 A two-stage clinical trial is planned for testing $H_0 : p = .10$ versus $H_a : p > .10$, where $p$ is the proportion of responders among patients who were treated by the protocol treatment. At the first stage, 15 patients are accrued and treated. If 4 or more responders are observed among the (first) 15 patients, $H_0$ is rejected, the study is terminated, and no more patients are accrued.
Otherwise, another 15 patients will be accrued and treated in the second stage. If a total of 6 or more responders are observed among the 30 patients accrued in the two stages (15 in the first stage and 15 more in the second stage), then H0 is rejected. For example, if 5 responders
are found among the first-stage patients, $H_0$ is rejected and the study is over. However, if 2 responders are found among the first-stage patients, 15 second-stage patients are accrued, and an additional 4 or more responders (for a total of 6 or more among the 30) are identified, $H_0$ is rejected and the study is over.
a) Use the binomial table to find the numerical value of $α$ for this testing procedure.
b) Use the binomial table to find the probability of rejecting the null hypothesis when usingvthis rejection region if $p = .30$.
c) For the rejection region defined above, find $β$ if $p = .30$.
My attempt to solve part a is as follows:
Let $X$ be the number of responders from the 1st stage, and $Y$ be the number of responders in the 2nd stage. Then,
$n = 15, p=0.10$
$α = P(X \geq 4) + \sum_{i=0}^3P(Y\geq6-i)P(X\leq i)$
$α = 0.056+(0.002)(0.206)+(0.013)(0.549)+(0.056)(0.816)+(0.184)(0.944)$
$α = 0.283$
The answer in the back of the book says $α=0.0989$, so either I'm reading the table wrong or the book is wrong. I would appreciate any input.
Thanks.

A: Your calculation for part (a) is not correct because the formula should read $$\alpha = \Pr[X \ge 4] + \sum_{i=0}^3 \Pr[Y \ge 6-i]\Pr[X = i],$$ not $\Pr[X \le i]$.  Therefore, the table of probabilities will be
$$\begin{array}{ll} \Pr[X = 0] \approx 0.205891 & \Pr[Y \ge 6] \approx 0.00224967 \\
\Pr[X = 1] \approx 0.343152 & \Pr[Y \ge 5] \approx 0.0127205 \\
\Pr[X = 2] \approx 0.266896 & \Pr[Y \ge 4] \approx 0.0555556 \\
\Pr[X = 3] \approx 0.128505 & \Pr[Y \ge 3] \approx 0.184061 \\
\Pr[X \ge 4] \approx 0.0555556. & \end{array}$$


text:
Q: Get credentials of public FTP server I use FTPClient to automatically downloads files from FTP servers. I tested it with a mock FTP server, and everything works fine.
Now, my problem is that when I use the address of the servers from where I want to get the files, I get the following error:
java.io.IOException: Unable to determine system type - response: 530 Please login with USER and PASS.
    at org.apache.commons.net.ftp.FTPClient.getSystemType(FTPClient.java:2835)
    at org.apache.commons.net.ftp.FTPClient.createParser(FTPClient.java:3401)
    at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3370)
    at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:3048)

The servers are available without a password through a web browser. Why do I need one here? How do I get one?

A: You almost always need username/password, when logging into FTP server. Some public FTP servers are happy with any username/password or something like anonymous for the username and anything for the password. Web browsers do that automatically, so seemingly they do not use any credentials. With your code, you need to specify such credentials explicitly.


text:
Q: Factor Significance for Factor Model I am working with a given factor model of the form
$$y=B x +\epsilon$$
where $x$ is a random vector in $R^M$, $B$ is an $N\times M$ matrix of factor loadings, $y$ is a random vector in $R^N$ (with $N \gg M$) and $\epsilon$ is a vector of mean-zero innovations, independent of $x$. For simplicity, the innovations are normally distributed and pairwise independent. My question is relatively simple to state: How can I test whether a factor is significant, in the same sense in which a predictor is significant in linear regression?
Clarification: I should perhaps have emphasized that I am working with a given model, and I have to assess the predictive value of each factor of the model. In other terms, is there a simple way to assess whether dropping a factor from a model would result in a loss of predictive power, without comparing two different models with and without the factor? In the latter case, there is a great deal of literature on model selection, based on ML, GMM etc. (The rotational invariance of factor models doesn't play an essential role, btw).

A: The short answer is: There is something you can do but I am not sure how meaningful it will be.
The Long answer: I will give the long answer for a simple model where we have only one unknown latent factor. The idea carries over to the more general case albeit with more complications. It follows from your factor model that:
$E(y) = B E(x)$ and
$Var(y) = B^T  B Var(x) + \sigma^2$
(Note: Keep in mind that in this simplified model: $x$ is a scalar we are dealing with only one factor).
Since the data is normally distributed the above two equations determine your likelihood function.
However, do note that you have identification issues here as you have to estimate $B$ and $x$ simultaneously. The traditional way to solve the identification issue is to assume that:
$B(1) = 1$
(i.e., set the factor loading of the first element to 1. Otherwise we can scale $B$ by $\alpha$ and scale $E(x)$ by $\frac{1}{\alpha}$ and obtain an identical E(y)).
It follows that:
E(x) = E(y(1))
In other words, the above identification constraint on B has effectively constrained the mean of our factor to be the sample mean of our first dependent variable (i.e., y(1)).
For similar reasons, we assume that:
$Var(x) = 1$
(Otherwise you could just scale $B$ by $\sqrt{\alpha}$ and scale $Var(x)$ by $\frac{1}{\alpha}$ and your likelihood function will not change).
Since we impose an identification constraint on the distribution of x (which is in some sense arbitrary) I am not sure how meaningful it is to perform statistical testing for a factor.
You could compute factor scores and perform standard statistical testing using the mean of $E(x) = E(y(1))$ and $Var(x) = 1$.
So, the answer to your question depends on:

Is the conclusion from the above statistical test invariant to your choice of identification constraints?

I do not know the answer to the above question.

A: Just speaking on a practical level, in my discipline (psychology) I have never seen this done for pure factor analysis.
That being said, the significance (fit really) of a statistical model is normally tested by the use of Structural Equation Modelling, where you attempt to reproduce the observed matrix of data from the structure you have proposed through the use of factor analysis.
The SEM, lavaan or OpenMx Packages for R will all do this.
Technically, the Chi square test will tell you if a factor model fits perfectly, but this statistic is almost always significant with any appreciable (200+) sample size.
The psych package for R also gives you the Bayesian Information Criterion as a measure of fit after you specify a factor model, but I am unsure as to how useful this is.

A: If the problem at issue consists of testing for the optimal number of factors, Jushan Bai and Serena Ng in several articles provide a test based on AIC/BIC that minimizes, for different options, the variance of the error. They supply to my knowledge the most updated approach to resolve this issue. See also Alexei Onatski who uses a different method based on eigenvalues of the factor covariance matrix.

A: I am not sure if I got your question right,
but if you already have a number of exact factors,
I guess you can use chi-squared test
to see if the factor loading of your concern is significant
as we do in Multiple Regression.
So here I assume you know in advance the exact value of factors
and the criterion variable, it's much like multiple regression.
If you have multiple criterion variables, then you might want to test
if the factor loadings for a specific factor is significantly different for
(0,0,0, ...,0). We can approach this problem with Multiple Comparison or multivariate viewpoint.