text:
Q: Message: ini_set(): A session is active. You cannot change the session module's ini settings at this time I created a login page with codeigniter,but i get the php message.
Message: ini_set(): A session is active. You cannot change the session module's ini settings at this time
how to fix this?

view (login.php)
<!DOCTYPE html>

<meta charset="UTF-8">
<title>Admin Login</title>
<link rel="stylesheet" href="../css/normalize.css">
<link rel="stylesheet" href="../css/admin-style.css">

    <?php echo form_open('Verify_login', ['id'=>'loginForm', 'name'=>'loginForm', 'method'=>'post']) ?>

Login

                  <input id="username" name="username" placeholder="User Name" value="" type="text" >
                <?php echo form_error('username'); ?>
                <input id="Password" name="password" placeholder="Password" required type="password">
                <?php echo form_error('password'); ?>

                    <input id="checkBox" type="checkbox">
                    Remember Me

                <button class="login-button" name="loginButton">Login</button>

 </form>

controller (Verify_login.php)
<?php
defined('BASEPATH') OR exit('No direct script access aloowed');

class Verify_login extends CI_Controller
{

public function __construct()
{
    parent::__construct();
    $this->load->model('User');
    $this->load->helper('url');
    $this->load->helper('security');
    $this->load->library('form_validation');
    $this->load->library('session');
}

public function index()
{
    $this->form_validation->set_rules('username', 'Username', 'trim|required');
    $this->form_validation->set_rules('password', 'Password', 'trim|required|callback_check_database');
    if ($this->form_validation->run() == FALSE) {
        // if validation failed load the view
        $this->load->view('admin/login');
    }

    else{
        $this->check_database($username , $password);
        redirect('dashboard', 'refresh');
    }
}

public function check_database($password)
{
    $username = $this->input->post('username');

    //query tha database
    $result = $this->User->login($username, $password);

    if ($result) {
        $sess_array = [];
        foreach ($result as $row) {
            $sess_array =
                [
                    'id'=>$row->id,
                    'username'=>$row->name
                ];
            $this->session->set_userdata('logged_in', $sess_array);
        }
        return TRUE;
    }
    else{

        $this->form_validation->set_message('check_database','invalid username and password');
    }
  }
 }
?>

controller(Admin.php)
session_start(); //need to call PHP's session object to access it though it
class Admin extends CI_Controller
{

public $data;
public function __construct()
{
    parent::__construct();
    $this->load->helper('url');

    $this->load->helper('form');
    $this->load->helper('url');
    $this->load->library('form_validation');
    $this->load->helper('security');

    //load user model
    $this->load->model('User');

}
public function index()
{
    // $this->load->view('admin/index');
    if ($this->session->userdata('logged_in')) {

        $session_data = $this->session->userdata('logged_in');
        $data['username'] = $session_data['name'];
        $this->load->view('admin/dashboard', $data);
    }
    else{

        //if no session redirect to login page
        redirect('admin', 'refresh');
        // redirect('login');
    }
}

public function logout()
{
    $this->session->unset_userdata('logged_in');
    session_destroy();
    redirect('home', 'refresh');
}

model (User.php)
<?php

/**
    *user login claass which extends MY_Model
    *
    */
defined('BASEPATH') OR exit('no direct script allowed');

class User extends CI_Model
{
    protected $table = 'users';

    public function __construct()
    {
        $this->load->database();
    }

    public function login($username ,$password)
    {
        var_dump($username);
        var_dump($password);
        $this->db->select(['id', 'name', 'password']);
        $this->db->from($this->table);
        // $this->db->where('name', $username);
        // $this->db->where('password', $password);
        $this->db->limit(1);

        $query = $this->db->get();
        if ($query->num_rows() == 1) {
            return $query->result();
        }
        else{

            return false;
        }
    }
   }
   ?>

A: Message: ini_set(): A session is active. You cannot change the session module's ini settings at this time
I had same error message sometime ago , By default Code-igniter will write to file (C:\xampp\tmp) in my case. But I want it to write to database instead.
In your autoloader you might have had something like this:
//:::::$autoload['libraries'] = array();
//'session', this mean start session ini_set()
$autoload['libraries'] = array('session', 'database');

By default setting in the config/config.php  session configurartion look like this:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

The documentation stated that to use database instead of file you should first create a table in application database.
CREATE TABLE IF NOT EXISTS `ci_sessions` (
        `id` varchar(128) NOT NULL,
        `ip_address` varchar(45) NOT NULL,
        `timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
        `data` blob NOT NULL,
        KEY `ci_sessions_timestamp` (`timestamp`)
);

Go back to the config/config.php and change $config['sess_driver'] = 'files'; to $config['sess_driver'] = 'database';
Like so I thought everything should be fine but I got the error Message: ini_set(): A session is active. You cannot change the session module's ini settings at this time
My Solution was to first run the session_destroy();
Then change session name and table name
My config look like this :
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'newname_session';
$config['sess_expiration'] = 72000;
$config['sess_save_path'] ='newname_sessions';
$config['sess_match_ip'] = TRUE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;

Save everything and after refresh the page all cleared, no error message showing

A: This is really working for me
if (!isset($_SESSION)) {

// server should keep session data for AT LEAST 24 hour
ini_set('session.gc_maxlifetime', 60 * 60 * 24);

// each client should remember their session id for EXACTLY 24 hour
session_set_cookie_params(60 * 60 * 24);
session_start();
}

so you do start your session after calling ini_set and session_set_cookie_params etc

A: You don't need this line in admin.php
session_start(); //need to call PHP's session object to access it though it

When you load the session library, its constructor does this for you.

A: The message means that you have started a session with session_start() in which further down in the code you are using ini_set() to manipulate the session module. If you are manipulating the session module, it should be done before a session is started and active.

A: This works for me:
if (!isset($_SESSION)) {
   // server should keep session data for AT LEAST 24 hour
   ini_set('session.gc_maxlifetime', 60 * 60 * 24);

   session_start();

   // each client should remember their session id for EXACTLY 24 hour
   session_set_cookie_params(60 * 60 * 24);
}

A: *

*Go to file \system\libraries\Session\Session.

*Uncomment session_start() at line 143 and you are done.

A: You can handle this issue by only running the command when it's needed like this:
if (!isset($_SESSION)
    && !headers_sent()
) {
    session_start();
}


text:
Q: How many 4 digit numbers without $0$ between $1000$ and $9999$ are divisible by $3$?
Determine the number of numbers we can make between $1000$ and $9999$
  of $4$ different digits without $0$. How many of those numbers are
  divisible by $3$?

To calculate how many numbers there are between $1000$ and $9999$ of $4$ different digits without $0$
, we calculate $9*8*7*6=3024$.
To calculate how many of those numbers are divisible by $3$ , I tried to combine that the sum of the digits must be divisible by $3$ and the stars and bars theorem.
Since we have 4 different digits the maximum sum of the digits is $9+8+7+6=30$ and the minimum is $1+2+3+4=10$.
The possible sums of the digits for which the number is divisible by $3$ are thus $12,15,18,21,24,27$ and $30$.
But with the stars and bars I didn't really know how to do its because we have to have 4 different digits and no zeros.
The solution my book gave was simply $42*4!$, so I think I'm on the wrong track, but  I have no idea how they got to their solution.
Any nudge in the right direction is appreciated :)
EDIT
I figured out the solution from my book.
If we take the numbers 1 to 9 we can divide them in 3 sets mod 3.
0 mod 3  would be the numbers {3,6,9}
1 mod 3 would be the numbers {1,4,7}
2 mod 3 would be the numbers {2,5,8}
Now we can use that the sum of the 4 digits must be $0$.
We can take 1 number from the 0 mod 3 set and 3 from the 1 mod 3 set, for example 3147. There are 4! ways to use the numbers {3,4,1,7}. There are 3 ways to select 1 number from 0 mod 3 set and 3 from the 1 mod 3 set.
Other ways to get a sum of 3:
2 numbers from the 0 mod 3 + 1 number from 2 mod 3+ 1 number from 1 mod 3. There are 3*3*3=27 ways to do this.
3 numbers from 2 mod 3+1 from  0 mod 3 . There are 3 ways to do this.
2 numbers from 1 mod 3 + 2 numbers from 2 mod 3. There are 3*3= 9 ways to do this.
So there are  3+27+3+9=42 ways to get a 4 digit number with sum equal to 3, and we have 4! ways to rearrange those numbers, so 42*4! numbers between 1000 and 9999  comply with all the requirements.

A: There are $3024$ such numbers in total, as as you say. And exactly one third of these numbers is divisible by $3$.
We can see this by grouping them into three sets $S_0,S_1,$ and $S_2$, according to the sum of their digits modulo $3$. Given any element of $S_0$, we can construct a unique element of $S_1$ simply by adding $1$ to each digit (with $9$ wrapping around to $1$). And we can construct a unique element of $S_2$ in the same way by adding $2$ to each digit.
So these three sets are all the same size, which is $3024/3=1008$.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Starting cell for copying array I have the below code that I'm using to copy some data from one sheet to another, and I can't for the life of me figure out where I can change the starting cell to B5 on the "OHD Leave Tracker" sheet. It's also starting the copy from the last cell with a value, so if I have something in B26 and run the code again, it will paste the new values from B26.
I think it might be in the line:
Target.Range("B" & Lastrow2 & ":D" & Lastrow2).Resize(j) = Application.Transpose(arrData)

I have tried the below which doesn't change anything.
 Target.Range("B6" & ":D" & Lastrow2).Resize(j) = Application.Transpose(arrData)

Edit: I need it to either start from B6 or from the next available cell.
The full code is:
Sub CopyNow()

Call ShtArr

    Dim Start: Start = Timer
    Dim c As Range
    Dim j As Integer
    Dim Source As Worksheet, Target As Worksheet
    Dim arrData As Variant: ReDim arrData(2, 0)
    Dim DevList As Object: Set DevList = CreateObject("System.Collections.ArrayList")
    Dim Lastrow2 As Long
    'Public SheetArr As String

    'SheetArr =

   Lastrow2 = Worksheets("OHD Leave Tracker").Range("B" & Rows.Count).End(xlUp).row
   'Worksheets("OHD Leave Tracker").Range("B6:D" & Lastrow2).Clear
    With Worksheets("Lists")
        For Each c In .Range("G1", .Range("G" & Rows.Count).End(xlUp))
            DevList.Add c.Text
        Next c
    End With

    For Each Source In Worksheets(SheetArr)
        Set Target = ThisWorkbook.Worksheets("OHD Leave Tracker")
        With Source
            For Each c In .Range("F1:F100") ', .Range("F" & Rows.Count).End(xlUp))
                If c = "Approved" Then
                    With c.EntireRow
                        If Not DevList.Contains(.Cells(1, 2).Text) Then
                            ReDim Preserve arrData(2, j)
                            arrData(0, j) = .Cells(1, 1)
                            arrData(1, j) = .Cells(1, 2)
                            arrData(2, j) = .Cells(1, 3)
                            'Debug.Assert Trim(.Cells(1, 3)) <> ""
                            j = j + 1
                        End If
                    End With
                End If
            Next c
        End With
    Next Source
Firstrow = ThisWorkbook.Worksheets("OHD Leave Tracker").Range("B6")
    Target.Range("B6" & ":D" & Lastrow2).Resize(j) = Application.Transpose(arrData)
    Debug.Print Timer - Start

        Dim Lastrow As Long

    Lastrow = ThisWorkbook.Worksheets("OHD Leave Tracker").Range("B" & Rows.Count).End(xlUp).row

    Worksheets("OHD Leave Tracker").Range("A6:A" & Lastrow).Formula = "=IF(ISERROR(VLOOKUP(B6,Lists!G:G,1,FALSE)),""Delete"",""Keep"")"

        Last = Worksheets("OHD Leave Tracker").Cells(Rows.Count, "A").End(xlUp).row
    For i = Last To 1 Step -1
        If Worksheets("OHD Leave Tracker").Cells(i, "A").Value = "Delete" Then
            Worksheets("OHD Leave Tracker").Cells(i, "A").EntireRow.Delete
        End If
    Next i
Call SortNow
    ThisWorkbook.Sheets("OHD Leave Tracker").Range("N6:JE6").AutoFill Destination:=Range("N6:JE188"), Type:=xlFillDefault
    ThisWorkbook.Sheets("OHD Leave Tracker").Range("E6:F6").AutoFill Destination:=Range("E6:F188"), Type:=xlFillDefault

    Sheets("OHD Leave Tracker").Range("B5:D" & Lastrow).RemoveDuplicates Columns:=Array(1, 2, 3), _
        Header:=xlNo
End Sub

A: Option Explicit

Sub CopyNow()

    Call ShtArr

    Dim Start: Start = Timer
    Dim c As Range
    Dim j As Integer
    Dim Source As Worksheet
    Dim arrData As Variant: ReDim arrData(2, 0)
    Dim DevList As Object: Set DevList = CreateObject("System.Collections.ArrayList")
    Dim LastRow As Long
    With Worksheets("OHD Leave Tracker")

        With Worksheets("Lists")
            For Each c In .Range("G1", .Range("G" & .Rows.count).End(xlUp))
                DevList.Add c.Text
            Next c
        End With

        For Each Source In Worksheets(SheetArr)
            With Source
                For Each c In .Range("F1:F100")    ', .Range("F" & Rows.Count).End(xlUp))
                    If c = "Approved" Then
                        With c.EntireRow
                            If Not DevList.Contains(.Cells(1, 2).Text) Then
                                ReDim Preserve arrData(2, j)
                                arrData(0, j) = .Cells(1, 1)
                                arrData(1, j) = .Cells(1, 2)
                                arrData(2, j) = .Cells(1, 3)
                                'Debug.Assert Trim(.Cells(1, 3)) <> ""
                                j = j + 1
                            End If
                        End With
                    End If
                Next c
            End With
        Next Source

        LastRow = .Range("B" & .Rows.count).End(xlUp).Row + 1

        .Rows(LastRow).Columns("B:D").Resize(j) = Application.Transpose(arrData)
        Debug.Print Timer - Start

        LastRow = .Range("B" & .Rows.count).End(xlUp).Row + 1

        .Range("A5:A" & LastRow).Formula = "=IF(ISERROR(VLOOKUP(B6,Lists!G:G,1,FALSE)),""Delete"",""Keep"")"

        For i = LastRow To 1 Step -1
            If .Cells(i, "A").Value = "Delete" Then
                .Cells(i, "A").EntireRow.Delete
            End If
        Next i

        Call SortNow
        .Range("N5:JE188").AutoFill
        .Range ("E5:F188"), Type:=xlFillDefault

        .Range("B5:D" & LastRow).RemoveDuplicates Columns:=Array(1, 2, 3), _
                                                  Header:=xlNo
    End With
End Sub


text:
Q: Adding description between Section in UITableViewController Just wanted to ask you if there is an easy way to add description text between sections in UITableViewController ?
You can take a look at what I want to do in "Settings > General > Keyboard" in your iPhone/iPod.

A: Section footers are often used for descriptions. So, implement the following UITableViewDataSource method in your subclass of UITableViewController:
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section

For more information see the documentation.


text:
Q: At this point, are "military" and "armed forces" synonymous? Looking at the free definitions online, and not including too much history, it seems to me that at one point the Navy was not directly associated as "military".  Or rather, that the Navy included not only military ships, but all ships of a nation.
Today the terms at top seem synonymous.  Only perhaps that the word military carries more weight, and can be used for either a more powerful sentiment, or more pejorative, depending on the context.
Likewise "armed forces", and even more so "armed services" seem to be softer representations of otherwise exactly the same thing.
(..not unlike "dead" vs. "deceased"? [Sorry, couldn't resist.])
Is there any technical difference, or situations today, where these are NOT interchangeable?

A: According to Wikipedia, the difference between Armed Forces and 'military' is the former's inclusion in the former definition of the paramilitary forces:

*

*The Armed  Forces of a country are its government-sponsored defence, fighting forces, and organizations. They exist to further the foreign and domestic policies of their governing body and to defend that body and the nation it represents from external and internal aggressors.

*In broad usage, the terms "armed forces" and "military" are often treated synonymously, although in technical usage, a distinction is sometimes made, in which a country's armed forces may include both its military and other paramilitary forces. Armed force is then the use of armed forces to achieve political objectives.

*

*Under the Law of Armed Conflict, a state may incorporate a paramilitary organisation or armed agency (such as a national police or a private volunteer militia) into its armed forces. The other parties to a conflict have to be notified thereof.

Source:http://en.m.wikipedia.org/wiki/Armed_forces

A: In terms of the United States, there is a distinction, at least in my understanding as a former US Marine.
The United States Armed Forces are the Navy, Army, Marine Corps, Air Force, and Coast Guard.
The Unites States Senate Committee on Armed Services encompasses Legislative oversight of the Department of Defense (which oversees most of the US Armed Forces), but other areas of military interest or national security.
Therefore, I would suggest that, in terms of moving from more general to more specific, the order of the three phrases would be:

*

*Armed Services (all organizations dealing with military interests or national security)

*Military (all organizations dealing with military interests)

*Armed Forces (the five organizations: Navy, Army, Marines, Air Force, Coast Guard)

So, I was a US Marine, part of the Department of the Navy, and therefore was a member of the Armed Forces. As a member of the Armed Forces, I was part of the US military. As a member of the US military, I was also a member of the Armed Services.
From the other direction, a TSA agent could be considered part of the Armed Services of the US, but is not military, and is certainly not a member of the Armed Forces.
Cross-over occurs with the Coast Guard, which is part of the Armed Forces, but not part of the Department of Defense (they are under the Department of Homeland Security, which also oversees TSA).
The word "military" probably gets misused the most, since it also can be an adjective, as in "military action," "military assets," "military interests," and so on. In those usages, it is very generic, so it's not surprising that "military" as a noun also gets used more generically than perhaps it should.

A: Good answer and examples, Orange.
My father was a career Army officer, West Point grad through 3 star General.  We ALWAYS referred to the "armed forces" and never said "military", not that there was anything wrong with the latter, it just was not a term in use by those we knew. (Yet West Point is the USMA: United States Military Academy - go figure).
It was not unusual at our house to have the JCS (Joint Chiefs of Staff) and CJCS (Chair thereof) over for cocktails or a BBQ in our yard, but to my limited knowledge (as an "Army brat") various "military" organizations (Guard, Reserves) did not have the recognition, resources, or responsibilities of the five Armed Forces (Army, Navy, Air Force, Marines, Coast Guard).  Maybe it was a part-time/full-time or  temporary/career distinction, or geographical (local or state, vs federal) difference; I don't really know.
Nobody I knew was ever negative about the Guard, Reserve, or for example, Texas Rangers, though it was unsaid, they just weren't seen as quite "the real thing".  So when POTUS 45, who never was part of any of the above, wanted to show our might and stoke his ego with a "Military Parade", he just sounded ignorant.


text:
Q: Issue with replacing strings in MySQL I want to replace a string with another one using REPLACE(), but I can't seem to make it work. Here is a snippet of the code:

<img alt="" src="/content_images/CD-pin_1.gif"

I want to replace src="/content_images with src="/public/userfiles/content_images so I used this query: UPDATE compudoc_informatie SET Tekst=REPLACE(Tekst, 'src="/content_images"', 'src="/public/userfiles/content_images"') but it didn't work. Any ideas ?

A: You've closed the double-quotes when you shouldn't have.
You're only replacing the first part of the src attribute so you should be searching for src="/content_images (no trailing ") and replacing with src="/public/userfiles/content_images (again, no trailing ").
What you're actually searching for is src="/content_images" (Note the trailing double quote) which won't match the target string src="/content_images/ (trailing character is a /)
Your query should be:
UPDATE compudoc_informatie SET Tekst=REPLACE(Tekst, 'src="/content_images', 'src="/public/userfiles/content_images')


text:
Q: Why do I get question marks instead of symbols when reading from .txt with InputStream? I know it must be obvious but can't find the answer.
What should I do to get the right characteres such as ", ', etc...?
This is the method I am using,
public void read(Context context) {

        InputStream inputStream = context.getResources().openRawResource(
                R.raw.puzzles);
        Scanner scanner = new Scanner(inputStream);
        scanner.useDelimiter(PATTERN);
        for (int i = 0; i < 70; i++) {
            ids[i] = scanner.next();
            titles[i] = scanner.next();
            questions[i] = scanner.next();
            answers[i] = scanner.next();
        }

    }

Thanks

A: After a few days of research I finally found the answer.
First of all I created a BufferedReader from the InputStream for character reading instead of  raw byte reading.
Most importantly I instantiated the InputStream with the constructor with the charSetName.
If you go to 'Save as' in your NotePad you can choose your Encoding.
Finally I found here the supported encodings.
The default one in NotePad seems to be ANSI, which doesn't seem to be supported so I changed it and save my .txt file as UTF8.
Here is the code:
public void read(Context context) {

        InputStream inputStream = context.getResources().openRawResource(
                R.raw.puzzles);

        BufferedReader bufferedReader = null;
        try {
            bufferedReader = new BufferedReader(new InputStreamReader(
                    inputStream, "UTF8"));
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }

        Puzzle p = null;

        Scanner scanner = new Scanner(bufferedReader);
        scanner.useDelimiter(TOKEN);
        // Skips the first strange char
        scanner.next();
        while (scanner.hasNext()) {

            p = new Puzzle();
            p.setId(scanner.next());
            p.setTitle(scanner.next());
            p.setQuestion(scanner.next());
            p.setAnswer(scanner.next());
            puzzles.add(p);
        }

    }

A: The Scanner object seems to recognize only letters and numbers by default... Try an approach without using the scanner like the answer to this question: Android read text raw resource file
And use String.indexOf(), or TextUtils.StringSplitter, or anything similar to read each line and parse the true strings between your tokens.
You might want to use a while loop to read data until the end of the file rather than a fixed number (70 in your case) for future puzzle files that may have more or less data.

A: Try using an instance of Scanner where you pass in a character set, i.e.
new Scanner (InputStream src, String charsetName)
HTH


text:
Q: Ruby on Rails Navigation Helper I am coming from CakePHP where you can make a helper method, not related to any model or controller and simply import that method in a view. This is commonly used to define a menu, and import the menu at the top of all views so that a change to the menu is then global.
I can't find any resources on how to do this in Rails, all I see are form helpers in ERB and Navigation Gems which I am not interested in.
I already have my menu designed etc..., how do I implement it correctly (which I am assuming is the global helper, like in CakePHP).
I'm using Rails 4.0.0.

A: Helper is meant to...help.
So, even you can write a helper to show nav, it's not good idea. This helper would be too heavy, and involves too much on view's business.
The better way is to use partial. Write a partial about nav, then render it in application layout.

A: In Rails helpers are usually for simple view related things. If your nav is simple then a helper would be ok to use. But if it has any sort of logic in it then I'd recommend using a partial.


text:
Q: MUI V5 Variant Overrides I'm trying to add to the variant within MUIPaper and I'm not sure what I'm doing wrong. The types on the component are:
variant?: OverridableStringUnion<'elevation' | 'outlined', PaperPropsVariantOverrides>;

How do I extend the variant prop using PaperPropsVariantOverrides. My expected outcome is:
variant?: 'elevation' | 'outlined' | 'grey' | 'white',

Component: Paper.tsx
import React from 'react';
import MUIPaper, { PaperProps as MuiPaperProps } from '@mui/material/Paper';
import { PaperPropsVariantOverrides } from '@mui/material';

export interface PaperPropsVariantOverrides {
  variant: 'grey' | 'white';
}

export type PaperProps = MuiPaperProps;

const Paper: React.FC<PaperProps> = (props) => {
  const { ...paperProps } = props;

  return <MUIPaper variant="grey" {...paperProps} />;
};
export default Paper;

A: You can extend by declaring the override module like so:
declare module '@mui/material/Paper' {
  interface PaperPropsVariantOverrides {
    myAwesomeVariant: true;
  }
}

then inside of your theme you can define the style for the variant:
export const theme = createTheme({
  components: {
    MuiPaper: {
      variants: [
        {
          props: { variant: "myAwesomeVariant" },
          style: { border: "1px solid red" },
        },
      ]
    }
  }
});

Then you should be able to use it
<ThemeProvider theme={theme}>
  <Paper variant="myAwesomeVariant">Stuff</Paper>
</ThemeProvider>

It's described better here https://mui.com/customization/theme-components/#adding-new-component-variants

A: <MUIPaper variant="grey" {...paperProps} />

No need the interface. just add a CSS with the class like ".MuiPaper-grey", the the style will be change
https://mui.com/api/paper/


text:
Q: JSF tags not rendered in online web server only I am using JSF 2.2.9 and tomcat 8.0 in my local everything works just fine. One i uploaded my content to Online web server. In the welcome file the JSF components doesnt render.
Searching for solution from quiet long time.Please help
url used ins mydomain.com/home.xhtml
Please find web.xml
    <!-- JSF mapping -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!-- Map these files with JSF -->
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>

and XHTML below:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>

Please help :( stuck from a long time..


text:
Q: study inside a finite-dimensional inner product space. I am studying for my test and have completed most of the problems assigned to me, but am having trouble with a few, and this one in particular. Thank you in advance for any help.
Let $V$ be a finite-dimensional inner product space.  Suppose that $U$ and $W$ are subspaces of $V$, such that there is an element $0\neq u ∈ U$ with $u\in W^\perp$.  Prove that there exists an element $0\neq w \in W$ such that $w \in U^\perp$.

A: This is false:
Let $V=\mathbb{R}^3$, $U=\mbox{span}\left(u_1=(0,0,1),u_2=(0,1,0)\right)$, and $W=\mbox{span}\left((0,0,1)\right)$.
$(0,1,0)\in U$ and $(0,1,0)\in W^\perp$, but every $w\in W$ satisfies $w\in U$, so $w \notin U^\perp$.

Following the comments, if you assume $W\not\subseteq U$:
Let $V=\mathbb{R}^3$, $U=\mbox{span}\left(u_1=(0,0,1),u_2=(0,1,0)\right)$, and $W=\mbox{span}\left((1,0,1)\right)$.
$(0,1,0)\in U$ and $(0,1,0)\in W^\perp$, but every $w\in W$ is of the form $(c,0,c)$, so $\left<u_1,w\right>=c \ne 0$, and $w\notin U^\perp$.

If you assume $W\cap U = \{0\}$:
Let $V=\mathbb{R}^3$, $U=\mbox{span}\left(u_1=(1,1,0),u_2=(0,1,1)\right)$, and $W=\mbox{span}\left((0,0,1)\right)$.
$u_1\in U$ and $u_1\in W^\perp$, but every $w\in W$ is of the form $(0,0,c)$, so $\left<u_2,w\right>=c \ne 0$, and $w\notin U^\perp$.


text:
Q: How __promise in ARM-compiler improves the efficiency I read here (page 14) that one way to improve the code efficiency for ARM-devices would be to use ARM_compiler specific keywords like __promiseand the folowing sample code is mentioned:
void f(int *x, int n)
{
  int i;
  __promise((n > 0) && ((n & 7) == 0));   /* My Question: How this line improves efficiency */

  for(i = 0; i < n; i++)
  {
    x[i]++;
  }
}

But I don't undrestand how this extra information (the loop index is positive and divisable by 8) improves the efficiency!
could anybody please explain how?

A: __promise((n > 0) && ((n & 7) == 0));

The binary representation of 7 is 0b111. This tells you that the last 3 bits of n will always be zero. Therefore n must be a multiple of 8. Furtermore n will also be greater than 0.
You thus promise the compiler, that it can safely unroll your loop into blocks of 8, and that it will do at least one iteration.
The compiler could therefore choose to rewrite your code as:
int i = 0;
do
  {
    x[i+0]++;
    x[i+1]++;
    x[i+2]++;
    x[i+3]++;
    x[i+4]++;
    x[i+5]++;
    x[i+6]++;
    x[i+7]++;
  } while ((i+=8) != n);

Which will skip a bunch of comparisons.
NEONs VADD instruction will even allow you to optimize this even further: vaddq_s32 would allow you to add the vector (1,1,1,1) to groups of four elements of your array at once. So your compiler could replace that block with two vadd instructions (if it feels you could benefit from that).


text:
Q: How to move nested objects to a different object in jq? I need to restructure some JSON files to clean up the data representation. Part of this restructuring includes grouping similar objects in a parent object rather than relying on a particular property of the object. We will have five "sections" in the files:
attributes, associatedObjects, inheritedObjects, enumerations, which will be used to represent "active" objects, and then a deprecated section that has those same four subgroups to denote, well, "deprecated" objects. The deprecated objects will be subject to later removal.
Given a structure such as:
    "attributes": {
        "alpha": {
            "deprecated": true,
            "description": "A description of alpha.",
            "dataType": "string"
        },
        "beta": {
            "deprecated": false,
            "description": "A description of beta.",
            "dataType": "associated object",
            "associatedObject": "gamma"
        },
        "kappa": {
            "deprecated": false,
            "description": "A description of kappa.",
            "dataType": "string"
        }
    }
}

How might I reorganize the file using jq to appear more like the following?
    "deprecations": {
        "attributes": {
            "alpha": {
                "description": "A description of alpha.",
                "dataType": "string"
            }
        },
        "enumerations": {},
        "associatedObjects": {},
        "inheritedObjects": {}
    },
    "attributes": {
        "kappa": {
            "description": "A description of kappa.",
            "dataType": "string"
        }
    },
    "enumerations": {},
    "associatedObjects": {
        "beta": {
            "description": "A description of beta.",
            "dataType": "gamma"
        }
    },
    "inheritedObjects": {}
}

I've only been able to add the new, empty sections (without any nesting) at the same level as attributes via jq '.associatedObjects = {} | .inheritedObjects = {} | .enumerations = {} | .deprecations = {} '
I attempted to move the item flagged as deprecated via this command:
jq '.attributes | keys[] as $k |
if (.[$k].deprecated == true) then
(del(.[$k].deprecated) | .deprecated += .[$k] | del(.[$k]))
else empty end '

but this results in invalid JSON and seems to duplicate the structure. I've also not been able to combine it with the creation of the new sections. It appears I don't have to create those new sections separately and/or beforehand.
What would it take to achieve this goal?

A: I cannot entirely follow the criteria for your distribution, especially .enumerations and .inheritedObjects are unclear, but this could get you going:
.attributes | (map_values(select(.dataType == "string")) | {
  deprecations: map_values(select(.deprecated)),
  attributes: map_values(select(.deprecated | not))
}) + {
  associatedObjects: map_values(select(.dataType == "associated object"))
}

{
  "deprecations": {
    "alpha": {
      "deprecated": true,
      "description": "A description of alpha.",
      "dataType": "string"
    }
  },
  "attributes": {
    "kappa": {
      "deprecated": false,
      "description": "A description of kappa.",
      "dataType": "string"
    }
  },
  "associatedObjects": {
    "beta": {
      "deprecated": false,
      "description": "A description of beta.",
      "dataType": "associated object",
      "associatedObject": "gamma"
    }
  }
}

Demo

A: This should generate the expected output :
jq '(.attributes | map_values(select(.deprecated))) as $dep
    | .depreciations.attributes = ($dep | map_values(del(.deprecated)))
    | (.attributes | map_values(select(has("associatedObject")))) as $assoc
    | .associatedObjects = ($assoc
                           | map_values(.dataType = .associatedObject)
                           | map_values(del(.deprecated, .associatedObject))
                           )
    | .attributes |= del(.[]|select(.deprecated))
    | .attributes |= del(.[]|select(has("associatedObject")))
    | .attributes[] |= del(.deprecated)
    | .depreciations += { "enumerations": {}, "associatedObjects": {}, "inheritedObjects": {} }
    | . + { "enumerations": {}, "inheritedObjects": {} }
' input.json

{
  "attributes": {
    "kappa": {
      "description": "A description of kappa.",
      "dataType": "string"
    }
  },
  "depreciations": {
    "attributes": {
      "alpha": {
        "description": "A description of alpha.",
        "dataType": "string"
      }
    },
    "enumerations": {},
    "associatedObjects": {},
    "inheritedObjects": {}
  },
  "associatedObjects": {
    "beta": {
      "description": "A description of beta.",
      "dataType": "gamma"
    }
  },
  "enumerations": {},
  "inheritedObjects": {}
}


text:
Q: Why does running jstack on windows give 'unable to attach to 64 bit process' error'? I tried the command
jstack -l <pid> and got the following error -
unable to attach to 64 bit process' error

I then tried this command -
jstack -F <pid> and got this error -
Attaching to process ID <pid>, please wait...
Error attaching to process: Windbg Error: GetModuleParameters failed!

How do I run jstack successfully on Windows? More specifically, I am running Windows 7.

A: Taking Peter's comment above a little further, I found that, on Windows, you have to
- run the jstack process as an administrator
- use the same Java installation for jstack that was used to start the process you want to analyse.
Trying to get a dump from a process running under Java 1.8.0_40-b26 amd64 using jstack from an installation of 1.8.0_111-b14 didn't work. Using jstack from 1.8.0_40-b26 amd64 did.

A: I think you are running from a different location. You will need to run the command from bin folder of your JDK where jstack is found.


text:
Q: Extent of reference types in C# I have this code for a virtual directory class:
    public class VirtualDirectory
    {

        internal Dictionary<string, VirtualDirectory> directories;
        internal Dictionary<string, VirtualFile> files;

        /// <summary>
        /// Gets the specified directory.
        /// </summary>
        /// <returns>A reference to the specified directory.</returns>
        public VirtualDirectory getDirectory(string name)
        {
            return directories[name];
        }

        /// <summary>
        /// Adds a file to the directory.
        /// </summary>
        /// <param name="file">The file to be added.</param>
        /// <param name="name">The file's name.</param>
        public void addFile(VirtualFile file, string name)
        {
            files.Add(name, file);
        }
    }

If I do this:
// Say this new directory is populated
VirtualDirectory directory = new VirtualDirectory;
directory.getDirectory("exdir").addFile(new VirtualFile(), "exfile");

Is the original directory (directory.directories["exdir"]) modified? Or is it just the instance of the directory "exdir"?

A: Writing:
directory.getDirectory("exdir").addFile(new VirtualFile(), "exfile");

Is like:
var dir = directory.getDirectory("exdir");
dir.addFile(new VirtualFile(), "exfile");

Thus you don't modify the directory instance you got, that said you don't modify the reference, but you add an item in that collection, thus the collection content itself is modified.
Therefore there is a new file in the directory.directories["exdir"].
You can have multiple reference to only one instance of a class and using one of them to manipulate this instance provides the same result as using another.
So here the dir variable is a reference to the instance of directory.directories["exdir"] that is also accessible using this reference directly.
Value Type and Reference Type
Difference between a Value Type and a Reference Type


text:
Q: Woocommerce default styles have been lost after adding add_theme_support('woocommerce) code I wanted to add load more button to Woocommerce shop product's page. For overriding the scripts I have added archive-product.php file and add_theme_support('woocommerce) code in functions.php file.
For functionality I have added everything needed to js and function.php files. Everything works well, but the Woocommerce default styles have been lost after adding add_theme_support('woocommerce) code. How to improve that, besides manually defining in css file.
Thanks in advance.


text:
Q: How long is AppleCare+ "Paid in Full" for a 16" MacBook Pro in November 2021 I'm about to buy AppleCare+. Apple lists 2 options

*

*Annual ($149 per year)

*Paid in Full ($399)

I can't find anywhere where it list how long "Paid in Full" coverage lasts. It's not under "learn more.

*

*It's not here: https://www.apple.com/support/products/mac/

*It's not here: https://www.apple.com/legal/sales-support/applecare/applecareplus/1021/111221_applecareplusmacus.pdf (arrived at from here: https://www.apple.com/legal/sales-support/applecare/applecareplus/us/mac/)

That last one says at most

For Fixed-Term Plans, your Plan Term is fixed as set forth on your Plan Confirmation.

I went through the purchase process, adding credit card, etc, and even up to the last confirmation page I was never told what I was purchasing (what the plan term is)
What is the plan term for the "Paid in Full" option? It certainly can't just be 2 incidents indefinitely. I doubt I could get support in 2050 for this 2021 Mac.

A: I contacted Apple Support. The first support agent on chat told me

Ok. Apple Care+ extends your coverage to 2 years from your AppleCare+ purchase date and adds up to two incidents of accidental damage protection every 12 months. However it will not cover the theft or lost product.

You can also check that in the below link.

https://www.apple.com/support/products/mac/

When I pointed out nothing on that page said 2 years and that that would make the "Paid in Full" option more expensive than the annual option the service representative transferred me to a different division in charge of AppleCare+
The first person on the AppleCare+ line just read the Terms of Service linked above. When I pointed out what they just read to me didn't list a time they escalated to an "Expert"
The "Expert" claimed it was 3 years of coverage and that I'd be able to renew annually after. When I asked where was this written they spent ~10 minutes looking and then escalated to another expert.
That expert verified that it is listed no where online making it impossible to compare plans. They claimed "Paid in Full" coverage is 3 years.
So, after 45 minutes of my time, that means effectively you save $48 for paying up front ($399 vs $447)


text:
Q: Interpretation of $\vec{x}$ in QFT I am still at an early stage of studying Quantum Field Theory (I am reading QFT In A Nutshell by A. Zee).
In the book I'm reading, it starts from a discrete lattice of material "lumps" labeled by $a$, seperated from each other by a finite $l$, so that the position of lump $a$ is $q_a(t)$. The next step is to take $l \to 0$ and "promote":

$$
q \to \varphi
$$
  $$
a \to \vec{x}
$$
  $$
q_a(t) \to \varphi (t, \vec{x}) = \varphi (x)
$$
  $$
\sum_a \to \int d^Dx
$$

If this was in the realm of (classical) continuum mechanics, $\vec{x}$ would simply label the simplified and theoretical (This aspect of physics benefits from this simplification at no cost) infinitesimal lump that was actually displaced by $\vec{x}$ from the origin at $t=0$.
In QFT though, by definition, the field is not meant to be a simplification of anything. It's meant to be quite the contrary. I am not yet confident enough to ask my concrete questions, because I realize that they carry with them implicit assumptions which are probably false. So I'll just ask:
If it's not the displacement $\vec{x}$, and It's not the  classical label $\vec{x}$, then, what is it? What does it mean?

A: Initially the label $a$ represent the site on a lattice with sites separated by distance $l$. i.e., the discrete position for each of a collection of oscillators, $q_a$, with an oscillator at each lattice site.
When we take the continuum limit, $l\to0$, the label $a$ becomes continuous, i.e. it becomes the position variable $x$. We now have an infinite collection of oscillators, labelled by their position $x$ - an oscillator at each point in space.
The oscillators don't themselves move about, they're fixed at the lattice sites (and later points in space). But they are correlated. An oscillation in $q_1$ might be correlated with an oscillation in its next door neighbour, $q_2$. The propagation of oscillations in that way is basically particles propagating.


text:
Q: Use vis.js with materialize : Uncaught TypeError: Hammer.assign is not a function I'm trying to run vis.js in an Angular4 project configured with Angular-cli that is already using Materialize-css
When running the angular application I get this error in console :
Uncaught TypeError: Hammer.assign is not a function
    at propagating (vis.js:37731)
    at Object.<anonymous> (vis.js:1915)
    at __webpack_require__ (vis.js:57)
    at Object.<anonymous> (vis.js:34498)
    at __webpack_require__ (vis.js:57)
    at Object.<anonymous> (vis.js:28975)
    at __webpack_require__ (vis.js:57)
    at exports.__esModule (vis.js:100)
    at vis.js:103
    at webpackUniversalModuleDefinition (vis.js:30)

In package.json :
"vis": "4.21.0",
"jquery": "^2.2.4",
"hammerjs": "^2.0.8",
"materialize-css": "^0.100.2",
"angular2-materialize": "^15.1.10",

In angular-cli.json
"styles": [
        "../node_modules/materialize-css/dist/css/materialize.css",
        "../node_modules/vis/dist/vis.min.css",
        "assets/scss/main.scss"
      ],
      "scripts": [
        "../node_modules/jquery/dist/jquery.js",
        "../node_modules/hammerjs/hammer.js",
        "../node_modules/materialize-css/dist/js/materialize.js",
        "../node_modules/vis/dist/vis.min.js"
      ],

I check that hammerjs, jquery, vis and materialize and correctly installed and present in /node_modules directory
hammerjs, jquery and materialize were already installed and working in the project. Which is a simple web site.

Any idea what could lead to this error and how to correct it ?

A: This is a very difficult question to answer as you don't provide a Minimal, Complete, and Verifiable example.
It would seem from your question that you are having trouble getting the vis.js library to work in an Angular 4 application. Getting vis.js to work in Angular 4 is quite straightforward. Here are the steps I followed:

*

*Create a new project with the cli ng new ng-vis

*Install the vis library and its typings npm install --save vis @types/vis

*Add vis styles to the project

*

*In the .angular-cli.json file add "../node_modules/vis/dist/vis.css" to the styles array(as you have shown above)

*Add vis to a view/view-model

*

*I updated src/app/app.component.html to

*I then updated src/app/app.component.ts to the following
import { Component, ElementRef, ViewChild, AfterViewInit } from '@angular/core';

import * as vis from 'vis';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements AfterViewInit {
@ViewChild('vis') element: ElementRef;
network: vis.Network;

ngAfterViewInit(): void {
  const nodes = new vis.DataSet([
    {id: 1, label: 'Node 1'},
    {id: 2, label: 'Node 2'},
    {id: 3, label: 'Node 3'},
    {id: 4, label: 'Node 4'},
    {id: 5, label: 'Node 5'}
  ]);

  const edges = new vis.DataSet([
    {from: 1, to: 3},
    {from: 1, to: 2},
    {from: 2, to: 4},
    {from: 2, to: 5}
  ]);

  const data = {
    nodes: nodes,
    edges: edges
  };

  const options = {};

  this.network = new vis.Network(this.element.nativeElement, data, options);
 }
}

You seem to be manually adding your external scripts to the .angular-cli.json file which I would think wouldn't be a best practice. Through utilizing Typescript, you will get the explorability of its type system as well as a few other benefits. The types and certain annotations are what allows Angular to help manage loading of dependencies(possibly the cause of the problem you are describing above) and allows the build system to make smarter decisions when it performs AOT and tree-shaking.
UPDATE
As per Ramesh Rajendran's comment, it is possible that the error is coming from utilizing both materialize-css and vis.js in the same project. From his comment, and the referenced GitHub issue, it would see you should just have to update your .angular-cli.json file to have the following scripts:
  "scripts": [
    "../node_modules/vis/dist/vis.min.js",
    "../node_modules/jquery/dist/jquery.js",
    "../node_modules/hammerjs/hammer.js",
    "../node_modules/materialize-css/dist/js/materialize.js
  ]

Again I would caution you against this approach as it doesn't seem to be in line with best practices. I updated my example to work with both materialize-css and vis.js as follows:

*

*Run npm install --save materialize-css @types/materialize-css

*Update app.component.html

filter_dramaFirst

Lorem ipsum dolor sit amet.

placeSecond

Lorem ipsum dolor sit amet.

whatshotThird

Lorem ipsum dolor sit amet.

*Update `app.component.ts'
import { Component, ElementRef, ViewChild, AfterViewInit } from '@angular/core';

import * as vis from 'vis';
import * as $ from 'jquery';
import 'materialize-css';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements AfterViewInit {
  @ViewChild('vis') element: ElementRef;
  @ViewChild('collapse') c_element: ElementRef;
  network: vis.Network;

  ngAfterViewInit(): void {
    const nodes = new vis.DataSet([
        {id: 1, label: 'Node 1'},
        {id: 2, label: 'Node 2'},
        {id: 3, label: 'Node 3'},
        {id: 4, label: 'Node 4'},
        {id: 5, label: 'Node 5'}
    ]);

    const edges = new vis.DataSet([
        {from: 1, to: 3},
        {from: 1, to: 2},
        {from: 2, to: 4},
        {from: 2, to: 5}
    ]);

    const data = {
        nodes: nodes,
        edges: edges
    };
    const options = {};

    this.network = new vis.Network(this.element.nativeElement, data, options);
    $(this.c_element.nativeElement).collapsible();
  }
}


text: Q: проблемы с интерпретатором python установил python 3.7.1 и PyCharm 2018.3.2. все открывается, но при попытке добавить интерпретатор выдает ошибку 'permission denied', а далее нужный интерпретатор и вовсе не отображается в списке


text:
Q: Built apk contains unneeded resources Having an issue where the apk being generated by our Gradle build contains a bunch of unnecessary files inside a test/resources directory
Our application build gradle contains several local module dependencies which are built as android libraries.
I know there is packagingOptions field in Gradle but you can't exclude directories as far as I can tell.  Excluding each file isn't an option.  Anyway, I would like to know the root cause for this.
Application gradle build:
apply from: "${rootDir}/android_application.gradle"

dependencies {
    compile project(':local-lib1')
    //... etc
    compile project(':local-libN')

    testCompile libraries['junit']
 }

android {
    defaultConfig {
        versionCode 1
        versionName "1.0"

        multiDexEnabled true
    }
}

And android_application.gradle:
apply plugin: 'com.android.application'

android {
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            resources.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
    }

    compileSdkVersion android_sdk_version
    buildToolsVersion android_build_tools_version

    defaultConfig {
        minSdkVersion android_min_sdk_version
        targetSdkVersion android_target_sdk_version
    }

    buildTypes {

    }
}

All modules are structured like so:
module
|
--AndroidManifest.xml
--build.gradle
--assets/
--res/
--src
  |
  -- main/
  |  |
  |  --java/
  |  --resources/
  |
  -- test/
     |
     --java/
     --resources/

Why are test/resources being included in apk? How can I exclude them?
Edit (to show lib gradle):
Example lib gradle:
apply from: "${rootDir}/android_library.gradle"

dependencies {
    compile 'com.android.support:multidex:1.0.0'
    // ...etc external deps

    // test deps
    testCompile libraries['logback-classic']
    testCompile libraries['junit']
    testCompile libraries['mockito-core']
    // etc...
}

android {
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
    }
}

android_library gradle:
apply plugin: 'android-library'

android {
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            resources.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }
    }

    compileSdkVersion android_sdk_version
    buildToolsVersion android_build_tools_version

    defaultConfig {
        minSdkVersion android_min_sdk_version
        targetSdkVersion android_target_sdk_version
    }

    buildTypes {
        release {

        }
    }
}

I am building with gradlew.bat -x test build
The test/resources included in the apk contains all the files in the corresponding test/resources for each lib.  The size of directory (uncompressed) is 10mb so adds unreasonable amount to size of overall apk.

A: Try the resource shrinking. As per Google Documentation: "The Gradle build system for Android supports

resource shrinking": the automatic removal of resources that are
  unused, at build time, in the packaged app. In addition to removing
  resources in your project that are not actually needed at runtime,
  this also removes resources from libraries you are depending on if they are not actually needed by your application

android {
    ...
    buildTypes {
        test {
            minifyEnabled true
            shrinkResources true
            ...
        }
    }
}

A: Think I've solved the issue.
I had in app build.gradle and each library build.gradle:
android {
    sourceSets {
        main {
            resources.srcDirs = ['src']
        }
    }
}

Changed to
android {
    sourceSets {
        main {
            resources.srcDirs = ['src/main']
        }
    }
}

I guess gradle was taking every resources dir under src/ and merging them into one - http://tools.android.com/tech-docs/new-build-system/resource-merging


text:
Q: How to customize the appearance of a qr code I've built a QR Code creator, but now I need to know how to customize the appearance of the codes.
The first image is an example of how they are currently outputted. The second is what I'd like to achieve.
The two codes are exactly the same. It's just their appearance that's different.
Just don't no where to begin. Any direction would be helpful.

The Generator Code
For now I've only written for iOS. But will be for android too, which is why I included the android tag.
Note I'm working with NativeScript so this might look a bit odd to iOS developers, but this is how we access native iOS methods etc...
const message = NSString.stringWithString("My Message");
const data = message.dataUsingEncoding(NSUTF8StringEncoding);
const data_filter = CIFilter.filterWithNameWithInputParameters(
    "CIQRCodeGenerator",
    { inputMessage: data, inputCorrectionLevel: "M" }
);
const code = data_filter.outputImage;
const size = CGRectIntegral(code.extent);
const output_size = CGSizeMake(150, 150);
const matrix = CGAffineTransformMakeScale(
    output_size.width / CGRectGetWidth(size),
    output_size.height / CGRectGetHeight(size)
);
const transformed = code.imageByApplyingTransform(matrix);
const image = UIImage.imageWithCIImage(transformed);

This is what I get

This is what I want


text:
Q: Nginx multi store as /pt We have magento2 webstore with enable multi store.
Example:

*

*/domain.com - main store (Spanish)

*domain.com/pt - Portugal web store

We did nginx vhost with mapping:
map $request_uri $MAGE_RUN_CODE {
  domain.com website;
  /pt pt;
}

then we add the variables in magento2 nginx sample config:
....
fastcgi_param  MAGE_RUN_TYPE website;
fastcgi_param  MAGE_RUN_CODE $MAGE_RUN_CODE;
....

Also we enabled in magento2 backend GENERAL->WEB->Add Store Code to Urls=YES
Everything starts working fine, but that option (Add Store Code to Urls) rewrite main store URLs with the language code (es).
For example the urls of main (Spanish) store are now like domain.com/es/product1.html.
We are looking for workaround to remove the 'es' URI store code only from main website.
Any suggestions would be greatly appreciated !

A: You need to create the pt sub directory and then do these  barring any nginx differences. It should be similar.
If this were apache you'd copy your index.php and .htaccess (or any nginx equivilent you need) into the sub folder. Then alter your index.php with a switch on $_SERVER['HTTP_HOST'] the case statement is on your domain. In that case statement set the run code and run type. Then when the $bootstrap is created in create() the paramaters are BP and your $params array with the run code and run type in them. Where you have your require statment in the same file add a .. to the beginning to go up a directory when it's looking for the file. Then change the base link url and secure base link url for that particular store to the link for your pt store, while keeping the base url etc the same your your main store. I hope that makes enough sense to you.  has the full php code. All you need to the switch, the alterations to $bootstrap and the require line.the base link url changes I mentioned get around the need for any messing around in pub.


text:
Q: Using remainder theorem in Pythagoras theorem makes absurd results! At first, I apologize for the title. I really couldn't find anything better than this.
Now,we know, some integers $a,b,c$ (none of them are $0$) can be found so that $$a^2 = b^2 + c^2$$
Now,here,of course $a>b$.
So, let, $$a = b + k $$where $k$ is an integer.
So, $$(b+k)^2=b^2+c^2\\\Rightarrow b^2 + 2bk +k^2 = b^2+c^2\\\Rightarrow2b=\frac{c^2-k^2}{k}$$
Now, let, $$c^2-k^2=f(k)$$
So, as $b$ is an integer, $f(k)$ should be divisible by $$k=k-0$$
So, according to remainder theorem, $f(0)$ should be $0$.
BUT, $$f(0)=c^2-0^2=c^2\neq 0 (!!!)$$
which also concludes that there can beno $a,b,c$ for which $a^2=b^2+c^2 $  (!!!)
I really can't understand what I have done wrong here?? Some help would be highly appreciated.

A: Your mistake is in saying that $f(k)$ is defined for every $k$. You cannot say that.
If you define $f$ as $f(k)=c^2 - k^2$, you can only do that if you already fixed the value of $c$, and once you fix $c$, the function $f(k)$ is determined for each value of $k$. In fact, then, $f(0)$ is equal to $c^2$ by definition.
On the other hand, if you start from the pythagorean triples, you can also say that $f(k)$ is defined as $c^2 - k^2$ where you pick $c$ in such a way that there exists such an integer $b$ such that $(b+k)^2 + b^2=c^2$. But in this case,

*

*you have no basis on which to claim that the function $f$ would be equal to $c^2 - k^2$ for some fixed $c$ (in fact, you have proven that this is not the case)

*you don't even know if $f$ is well defined for all values of $k$, and it is in fact not defined for certain values. It most certainly is not defined for $k=0$, for example.

A: You should have determined the domain of the function prior to testing its value for any specific argument!
$f(0)$ is simply undefined – it does not exist, as $k=0$ means $a=b$, which implies $c=0$ and that contradicts your initial assumptions.


text:
Q: Why can I not read from stdin in this forked process? The following code prints nothing, but it should print out "a" repeatedly.  The forked process blocks on the os.read(0, 1).  The parent process is indeed writing to the stdin_master, but stdin_slave receives nothing.  Any ideas?
import os
import pty
import resource
import select
import signal
import time

stdin_master, stdin_slave = pty.openpty()
stdout_master, stdout_slave = pty.openpty()
stderr_master, stderr_slave = pty.openpty()

pid = os.fork()

# child process
if pid == 0:
    os.setsid()
    os.close(stdin_master)
    os.close(stdout_master)
    os.close(stderr_master)

    os.dup2(stdin_slave, 0)
    os.dup2(stdout_slave, 1)
    os.dup2(stderr_slave, 2)

    max_fd = resource.getrlimit(resource.RLIMIT_NOFILE)[0]
    os.closerange(3, max_fd)

    while True:
        char = os.read(0, 1)
        os.write(1, char)

    os._exit(255)

# parent process
else:
    os.close(stdin_slave)
    os.close(stdout_slave)
    os.close(stderr_slave)

    try:
        while True:
            read, write, err = select.select([stdout_master], [stdin_master], [], 0)
            for to_read in read:
                print os.read(to_read, 1)

            for to_write in write:
                os.write(to_write, "a")

            time.sleep(0.1)

    finally:
        os.kill(pid, signal.SIGKILL)

A: I'm not sure your want to be using the pty module here. What you seem to need is basically a pair of os.pipe's.
Here's a solution that works using pipes:
import os
import select
import signal
import time

stdin_slave, stdout_master = os.pipe()
stdin_master,stdout_slave  = os.pipe()

pid = os.fork()

# child process
if pid == 0:

    while True:
        char = os.read(stdin_slave, 1)
        os.write(stdout_slave, char)

    os._exit(255)

# parent process
else:
    try:
        while True:
            read, write, err = select.select([stdin_master], [stdout_master], [], 0)

            for to_read in read:
                print os.read(to_read, 1)

            for to_write in write:
                os.write(to_write, "a")

            time.sleep(0.1)

    finally:
        os.kill(pid, signal.SIGKILL)

A: Thomas Wouters was kind enough to furnish the answer:
PTYs can only be read from the master fd.  So the child's os.read(0, 1) was not working because of this.  If we change
stdin_master, stdin_slave = pty.openpty()

to
stdin_slave, stdin_master = pty.openpty()

Now the chlid will be reading from the master, and we'll be writing to the slave from the parent.  This works.


text:
Q: Index is used in PostgreSQL but not in YugabyteDB (question from slack)
The following script uses the index in the last select on postgres but not on yugabyte.
drop table if exists entry2;
CREATE TABLE entry2 (comp_id  int,
                     path varchar,
                     index varchar,
                     archtype varchar,
                     other JSONB,
                     PRIMARY KEY (comp_id, path,index));
DO $$
    BEGIN
        FOR counter IN 1..200000 BY 1 LOOP

                insert into entry2 values (counter,'/content[open XXX- XXX-OBSERVATION.blood_pressure.v1,0]','0','open XXX- XXX-OBSERVATION.blood_pressure.v1','{"data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/value" :132,"data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/value": 92}');
                insert into entry2 values (counter,'/content[open XXX- XXX-OBSERVATION.blood_pressure.v1,0]','1','open XXX- XXX-OBSERVATION.blood_pressure.v1',('{"data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/value" :'||(130+ counter) ||',"data[at0001]/events[at0006]/data[at0003]/items[at0005]/value/value": 90}')::jsonb);
                insert into entry2 values (counter,'/content[open XXX- XXX-OBSERVATION.heart_rate-pulse.v1,0]','0','open XXX- XXX-OBSERVATION.heart_rate-pulse.v1','{"data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/value" :132,"/data[at0002]/events[at0003]/data[at0001]/items[at0004]/value/value": 113}');
            END LOOP;
    END; $$;

drop index if exists blood_pr;
create index  blood_pr on entry2(((other ->> 'data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/value')::integer ));

explain analyse
select  (other ->> 'data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/value')::integer  from entry2
where    (other ->> 'data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/value')::integer > 140
order by (other ->> 'data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/value')::integer::integer
limit 10
;

PostgreSQL uses the index to avoid a sort and then get immediately the first 10 rows

A: In PostgreSQL the index is used to avoid a sort because the order of the index is the same as the order by. Sorted indexes (B-Tree) are the default in PostgreSQL but not in YugabyteDB which is a distributed SQL database where indexes are hash-sharded by default on the first column. You can create it as range-sharded with ASC or DESC:
create index  blood_pr on entry2(((other ->> 'data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/value')::integer ) ASC);


text:
Q: Pass Row ID to a custom component in MUI Datagrid Pro I am trying to add an indeterminate state to row checkboxes based on selection status of other checkboxes inside a detail panel. To do this I am creating a custom checkbox component and doing some logic to see if indeterminate should be true, the only problem is the checkbox needs access to the row id it is associated with to do that check. Thus far I've found nothing to pass anything other than the given CheckboxProps given by MUI, which contains no row information. There is something called componentsProps where I can pass other props to a component, but I've yet to find a way to pass the particular row id to its associated checkbox. Does anyone know of a solution to this?
.
.
.
const customCheckbox = (props: CheckboxProps) => {
    return <Checkbox {...props} indeterminate={someArray.includes(theRowIdThisCheckboxIsUsedIn)} />
};

<DataGridPro
        {...data}
        components={{
          BaseCheckbox: customCheckbox,
        }}

/>

A: hi when you use custom checkbox component you cant use onSelectionModelChange to give you rows id you must write their logic too


text:
Q: Why isn't beautifulsoup displaying the text within a div id? Currently, I am trying to access the stock price on seeking alpha in this link, and the price is within this HTTML code.
This code here should look into the contents of div id="symbol_last_trade">149.30</div. But when I run it, the program doesn't output 149.30 as text.
from bs4 import BeautifulSoup
import requests

headers ={'User-Agent': 'Mozilla/5.0'}

url = "https://seekingalpha.com/symbol/AAPL/income-statement"

r = requests.get(url,headers=headers)

source = BeautifulSoup(r.text,"html.parser")
price = source.find("div", {"id" : "symbol_last_trade"})
print(price.text)`

When I run it, the output is this:
div id="symbol_last_trade"></div

Does anyone know why this program doesn't output the text within the div?

A: The data is loaded dynamically via JavaScript, so beautifulsoup doesn't see it. You can use requests module to simulate it:
import json
import requests

api_url = "https://finance.api.seekingalpha.com/v2/real-time-prices"
params = {"symbols[]": "aapl"}
data = requests.get(api_url, params=params).json()

# uncomment to print all data:
# print(json.dumps(data, indent=4))

print("Last price:", data["data"][0]["attributes"]["last"])

Prints:
Last price: 149.32


text:
Q: get source web page's source code, javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? I am trying to get a web page's source code with java 1.8.0_221. (support TLSv1.0, TLSv1.1, TLSv1.2)
I tried Jsoup, URLConnection, HttpURLConnection, none of them works, same error. Could anyone give me some suggestions, thank you!
html = Jsoup.connect("https://news.google.com/rss/search?q=vehicle").get().html();

error: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
html = Jsoup.connect("https://spectrum.ieee.org/rss/energy/fulltext").get().html();

error: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

A: In my browser,
https://news.google.com/rss/search?q=vehicle

redirects to
https://news.google.com/rss/search?q=vehicle&hl=en-US&gl=US&ceid=US:en

Maybe you need to specify a browser user agent in your code.


text:
Q: Comparing performance of software implementations HI all,
This is a more general question, but basically I wanna compare the performance of two multimedia software applications. Although they are doing the same thing, they are running on different platforms and also nothing is known about the implementation. I get quite some different performance figures and I am trying to reason about what could be the case for that. So far I came up with the following:
Better performance due to software optimisations:

*

*loop-unrolling at the cost of higher code memory footprint

*pro-computation of results stored in memory at the cost of a higher data memory footprint

Better performance due to the underlying hardware architectures

*

*running at a higher clock speed

*offering better hardware support for an application

*better caching opportunities

Can someone think of something else or is that all?
Thanks,
Simon

A: I'd say:

*

*If you know nothing about implementations, you won't be interested how that implementation works, including loop unrolling and everything.

*On that abstraction level, you'd probably want to measure end-user-related preformance goals, like in this Wikipedia article.

*Particularly, for single-user system response time and thoughput are more important; while for multi-user systems concurrency and throughput would matter. The former are affected by clock speed and UI design; the latter is also affected by cache size and overall system behavior under high loads.

*Martin Fowler has a good review of performance metrics in his PoEA,

A: Good question. Hardware certainly makes a difference, but software structural differences do too.
It is highly unlikely that micro-level optimizations like unrolling make much difference.
Reasoning about it will not take you very far - you need to investigate.
I'm not saying you can get a definitive answer to this question, but here's what I would do. Somehow, get 10 or 20 random-time stack samples, whether by interrupt-and-dump, pstack, lsstack, or running under a debugger and using Ctrl-C, or a good stack-sampling profiler like RotateRight/Zoom.
You can look at those samples and get an idea, percentage-wise, how each program is spending its time. If they are both near optimal, the pictures should look pretty similar, even if you don't know exactly what they're doing. If one, say, is spending a higher percentage of time in memory management, that's a red flag. If the call stack is typically much deeper on one than on the other, that's also cause for suspicion, not because calls are expensive, but because an over-general wasteful coding style tends to show that.
If you don't have symbols, it may take a fair amount of detective work to figure this out, and you may not be able to, but that is how I would approach it.


text:
Q: How to specify schema attributes for mongoose subdocument? I'm building a plugin and need to specify attributes for one of the subdocument collection fields.  Someone mentioned that statics are the official way of doing this.
So, instead of...
var familySchema = mongoose.Schema({
    surName   : { type: String },
    members   : { type: [ personSchema ], minLength: 1, maxLength: 10 }
});

... it would be this ...
var familySchema = mongoose.Schema({
    surName   : { type: String },
    members   : [ personSchema ]
});
familySchema.static('minLength', 1);
familySchema.static('maxLength', 10);

I realize there is no minLength or maxLength.  The plugin would handle this.
I've been looking through the docs and can't find anything that mentions the official way.  Is there a benefit of one versus the other?

A: You're right, there is no such thing as minLength for ref array. You have to use custom validation
var validateFamilyLength = function (members) {
    return members.length > 1 && members.length < 10;
};

var familySchema = mongoose.Schema({
    surName   : { type: String },
    members   : {
        type: [personSchema],
        validate: [validateFamilyLength, 'Not valid members count']
    }
});

But i strongly recommend to use refs instead
var familySchema = mongoose.Schema({
    surName   : { type: String },
    members   : [{
        type: mongoose.Schema.ObjectId,
        ref: 'Person',
        validate: [validateFamilyLength, 'Not valid members count']
    }]
});


text:
Q: Why is the tip of my PL-259 connector sheared off? I recently ordered a cable with a PL-259 termination and when it arrived I saw that the tip of the plug had been sheared off and at first I thought it was defective and went to return it or downgrade the supplier, however, on examining the product page more closely I saw that the plug was actually shown with a sheared off tip.

What is the purpose of this?

A: That is the way they are manufactured. It makes them easier to connect and facilitates the soldering process. You will find many variations of this but most I have seen have the angle or notch on the tip. I have seen some that are flat across and the solder ball on the tip makes it easier to connect. You can do a google search for pl259 and look at the images to get an idea of the variety available.


text:
Q: A counter-example to disprove that not every adjacency matrix can be made block-diagonal? I have a bunch of clusters of proteins (a disconnected graph) and wanted to present this data as an adjacency matrix for various reasons and have been looking for a way to make these adjacency matrices block-diagonal to make the relationships more apparent, but had no luck. I have tried SciPy's reverse Cuthill-McKee, svd, somebody has recommended Dulmage-Mendehlson and a bunch of other decompositions but to no avail. By this point, somebody told me that this might not even be possible in every case.
Would somebody happen to have an example or a concrete formulation of why exactly? I can't quite convince myself that's it's not possible from just looking at my data which looks like this by the way... Clearly, the structures which I'm trying to present are there (the large and small ribosomal subunits) and would probably become more apparent when I pour more data in there, but I would've so loved to also differentiate the clusters within the two subunits because I know they are there. Should I just use a covariance matrix?

Here is what breadth-first search yields by the way. Still I am not sure what that means, but I can definitely see now that permuting out of this state of band-minimization breaks structure rather than builds it, so maybe that's as far as I get today.

A: You always can permute the rows and columns of the adjacency matrix so that each block corresponds to a connected component.  Just find the connected components and then reorder with all nodes from component 1 first, component 2 next, and so on.

A: Some questions:

*

*What do the colors in your plots represent?

*How can you be sure your graph is disconnected if you haven't block-diagonalized its adjacency matrix?  Is there something in the nature of the data that guarantees this?

Now some comments:
If your graph really does have $n$ disconnected components, than its adjacency matrix certainly can be written in block diagonal form with $n$ blocks, regardless of what anybody says.
Something like the following should work.  Let A be an m by m adjacency matrix.  Create an array componentIdentifier of length m, with every element initialized to 0.  Also create an array permutation of length m.
numberComponents = 0
numberVerticesPermuted = 0
for i from 1 to m:
   if componentIdentifier[i] == 0:
      /* vertex i is in a new component */
      numberComponents = numberComponents + 1
      componentIdentifier[i] = numberComponents
      numberVerticesPermuted = numberVerticesPermuted + 1
      permutation[numberVerticesPermuted] = i

      /* find all vertices connected to i */
      k = numberVerticesPermuted
      while k <= numberVerticesPermuted:
         r = permutation[k]
         for c from 1 to m:
            if A[r,c] == 1 and componentIdentifier[c] == 0:
               componentIdentifier[c] = numberComponents
               numberVerticesPermuted = numberVerticesPermuted + 1
               permutation[numberVerticesPermuted] = c
         k = k + 1

When this concludes, numberComponents will hold the number of disconnected components and permutation will hold the permutation of indices needed to put the adjacency matrix in block-diagonal form.


text:
Q: Uniform Boundedness/Hahn-Banach Question Let $X=C(S)$ where $S$ is compact. Suppose $T\subset S$ is a closed
subset such that for every $g\in C(T),$ there is an $f\in C(S)$
such that: $f\mid_{T}=g$. Show that there exists a constant $C>0$
such that every $g\in C(T)$ can be continuously extended to $f\in C(S)$
such that: $\sup_{x\in S}\left|f(x)\right|\leq C\sup_{y\in T}\left|g(y)\right|$

A: $C(S) \to C(T)$ is a surjective bounded linear map of Banach spaces (with sup norms), so there is a closed linear subspace $M \subset C(S)$ such that $C(S)/M \to T$ is bijective and bounded with the quotient norm. Inverse mapping theorem says that the inverse is a bounded linear map. The statement then follows.
By the way, how is this related to Banach-Steinhaus/Hahn-Banach?

A: So $A:C(S)/M \rightarrow C(T)$, then $A^{-1}:C(T)\rightarrow C(S)/M$,
apply the inverse mapping theorem, we obtain $\left\Vert A^{-1}g\right\Vert \leq\left\Vert A^{-1}\right\Vert \left\Vert g\right\Vert $,
then $\inf_{f'\in M}\left\Vert f+f^{'}\right\Vert \leq C\left\Vert g\right\Vert $.
We must show that there exists a function in $f+M$ whose restriction
is $g$ and it's norm is less than C$\left\Vert g\right\Vert $
But How to show the existence of such function?


text:
Q: Convert Jquery to angular directive Ia m new in Angular, but i know to work in Jquery, i have problem with converting some function into Angular directive. Can someone help me about that, this is my jquery function
$('.spinner .btn:first-of-type').on('click', function() {
  $(this).closest('.spinner').find('input').val(function(i, v) {
    return parseInt(v, 10) + 1;
  });
});
$('.spinner .btn:last-of-type').on('click', function() {
  $(this).closest('.spinner').find('input').val(function(i, v) {
    return parseInt(v, 10) - 1;
  });
});

A: angular.module("yourmodulname").directive("spinnerDirective", spinnerDirective);

function spinnerDirective(){
   return { //Edit -1
 restrict:"A", //restrict the directive to the attribute
 link: "spinnerDirectiveLink"
    }//Edit-1
}

function spinnerDirectiveLink(scope, element, attribute){

 $('.spinner .btn:first-of-type').on('click', function() {
      $(this).closest('.spinner').find('input').val(function(i, v) {
        return parseInt(v, 10) + 1;
      });
    });
    $('.spinner .btn:last-of-type').on('click', function() {
      $(this).closest('.spinner').find('input').val(function(i, v) {
        return parseInt(v, 10) - 1;
      });
    });

}

HTML
<p spinner-directive></p>

Since your question is not clear on the task, this is the general way we write down the directive. Hope from here you need to take over to convert to your task.

A: AngularJS comes with it's own stripped down version of jQuery called jQLite. You can use it like so:
angular.element(<selector>).<operation>

You can find more documentation here
NOTE: You don't normally need to use jQuery. While jQuery does work fine with Angular, you want to use more of an Angular style of development and DOM manipulation, using directives.


text:
Q: initialize a list with 2 digit numbers I have a list of other lists I am using to represent a map of my workspace. Here is a simplified version:
areaMap = [[00,00,00,00,00],[00,00,01,11,01]]

Now, when i print this onto the screen using:
for x in range(len(areaMap)):
    print(areaMap[x])

the leading zero will be chopped off:
[0,0,0,0,0],
[0,0,1,11,1]

I need these numbers to have 2 digits so they are visually appealing when printed. I tried using:
for y in areaMap:
    [str(item).zfill(6) for item in areaMap[y]]

but this creates unneeded quotation marks and spaces.

A: You need to specify the format for the entirety of each line; for example
for x in areaMap:
    print("[%s]" % (",".join(["%02d"%z for z in x])))


text:
Q: How to change the brightness of the phone's home screen in Android? How can i change the Phone's Home screen Brightness programmatically?? i know the below code to change the Brightness. But how to use it for Home Screen??
WindowManager.LayoutParams lp = getWindow().getAttributes();
    lp.screenBrightness = 0.1f;
    getWindow().setAttributes(lp);

A: From the following code it can be seen that changing screen brightness is done on a system wide level(it is done using a hardware manager). It does not look like it is possible to do it per application.
See Code Below:
IHardwareService hardware = IHardwareService.Stub.asInterface(
ServiceManager.getService("hardware"));
  if (hardware != null) {
    hardware.setScreenBacklight(brightness);

The above source was taken from http://www.tutorialforandroid.com/2009/01/changing-screen-brightness.html


text:
Q: Why does the 'open file' dialog contain an 'options' button on some devices but not others? I'm using
<input type="file" accept="image/png, image/jpeg" />

(run it on CodePen to test it).
in my web page to allow the user to select an image file.
In the first picture you can see the options button is the lower left corner.
In the second picture you can see the options available after clicking the options button.

The options button for the open file dialog is confirmed visible on mac devices with the following specs
Mac(Big Sur / 11.6.1): Chrome(96.0.4664.93)
Mac(Monterey / 12.0.1): Chrome(97.0.4692.71)

It is confirmed not visible on a mac device with the following spec
Mac(Big Sur / 11.6), Chrome(Version 97.0.4692.71)

Without more specs the absence of an options button has been confirmed on one more mac device, and the presence of the options button has been confirmed on an additional mac device.
Any insight into why this options button seems inconsistent across mac devices when using Chrome? We discovered this inconsistency when testing an html form with a file input.
Thanks


text:
Q: Visual Studio 2012 Secure Publish? Is there an sftp publish method in VS 2012? I only see ftp.
I may be wrong but I thought VS 2010 had a secure option.

A: The only extension I could find is this one:
http://visualstudiogallery.msdn.microsoft.com/979a73c8-4fb6-4515-aded-f4332c08c195
Oh yeah, same one as you mentioned :)


text:
Q: Multiple Python Installations - both easy_install and pip fail I have a system-level installation of Python 3.3.3, and I want to set up an installation in user space at /usr/local/python33 as part of a multi-version virtualenv-type setup.  I made the directory, and I have attempted to use both easy_install and pip (as easy_install-3.3 and pip-3.3 from the system-level install) to put a copy of Python 3.3.3 there.  No joy.  The logs from both attempts are shown below.  I thought this was supposed to be straightforward, but my confidence if flagging.
EASY_INSTALL
easy_install-3.3 --install-dir="/usr/local/python33" python==3.3.3
Creating /usr/local/python33/site.py
Searching for python==3.3.3
Reading https://pypi.python.org/simple/python/
Reading http://www.python.org
Reading http://www.python.org/2.3
Reading http://www.python.org/2.4
Reading http://www.python.org/2.4.1
Reading http://www.python.org/2.5
Reading http://www.python.org/download/
Best match: Python 3.3.3
Downloading http://www.python.org/ftp/python/3.3.3/Python-3.3.3.tgz
Processing Python-3.3.3.tgz
Writing /var/folders/l0/14nc8kh968l6kqp86s5ddxph0000gn/T/easy_install-3cjpwy/Python-3.3.3/setup.cfg
Running Python-3.3.3/setup.py -q bdist_egg --dist-dir /var/folders/l0/14nc8kh968l6kqp86s5ddxph0000gn/T/easy_install-3cjpwy/Python-3.3.3/egg-dist-tmp-3me0es
error: Setup script exited with error: Modules/Setup: No such file or directory

PIP
pip-3.3 install --target /usr/local/python33 python==3.3.3
You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.
  Downloading from URL http://www.python.org/ftp/python/3.3.3/Python-3.3.3.tgz (from http://www.python.org/download/)
  Running setup.py egg_info for package python

    running egg_info
    creating pip-egg-info/Python.egg-info
    writing dependency_links to pip-egg-info/Python.egg-info/dependency_links.txt
    writing top-level names to pip-egg-info/Python.egg-info/top_level.txt
    writing pip-egg-info/Python.egg-info/PKG-INFO
    writing manifest file 'pip-egg-info/Python.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'pip-egg-info/Python.egg-info/SOURCES.txt'
    writing manifest file 'pip-egg-info/Python.egg-info/SOURCES.txt'
  Source in /private/var/folders/l0/14nc8kh968l6kqp86s5ddxph0000gn/T/pip_build_tipton/python has version 3.3.3, which satisfies requirement python==3.3.3
Installing collected packages: python

  Running setup.py install for python

    Running command /Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3 -c "import setuptools;__file__='/private/var/folders/l0/14nc8kh968l6kqp86s5ddxph0000gn/T/pip_build_tipton/python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/l0/14nc8kh968l6kqp86s5ddxph0000gn/T/pip-x_pk9r-record/install-record.txt --single-version-externally-managed --home=/var/folders/l0/14nc8kh968l6kqp86s5ddxph0000gn/T/tmpf4gi0e
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

       or: -c --help [cmd1 cmd2 ...]

       or: -c --help-commands

       or: -c cmd --help

    error: option --single-version-externally-managed not recognized

A: Both easy_install and pip are for installing Python packages, not for installing Python itself.
How you install Python depends on your operating system. For Unices you typically run the standard configure; make; make install.


text:
Q: Can not upgrade Ubuntu server 19.04 to 19.10 ('ubuntu-minimal' could not be located) $ sudo do-release-upgrade
Checking for a new Ubuntu release
Get:1 Upgrade tool signature [1,554 B]
Get:2 Upgrade tool [1,319 kB]
Fetched 1,320 kB in 0s (0 B/s)
authenticate 'eoan.tar.gz' against 'eoan.tar.gz.gpg'
extracting 'eoan.tar.gz'

Reading cache

Checking package manager
Reading package lists... Done
Building dependency tree
Reading state information... Done
Hit http://asi-fs-n.contabo.net/ubuntu disco InRelease
Hit http://asi-fs-n.contabo.net/ubuntu disco-updates InRelease
Hit http://asi-fs-n.contabo.net/ubuntu disco-backports InRelease
Hit http://security.ubuntu.com/ubuntu disco-security InRelease
Hit http://ppa.launchpad.net/certbot/certbot/ubuntu disco InRelease
Hit http://archive.ubuntu.com/ubuntu disco InRelease
Hit http://repo.mysql.com/apt/ubuntu disco InRelease
Ign http://ppa.launchpad.net/deadsnakes/ppa/ubuntu disco InRelease
Hit http://ppa.launchpad.net/ondrej/php/ubuntu disco InRelease
Err http://ppa.launchpad.net/deadsnakes/ppa/ubuntu disco Release
  404  Not Found [IP: 91.189.95.83 80]
Fetched 0 B in 0s (0 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done

Updating repository information

Third party sources disabled

Some third party entries in your sources.list were disabled. You can
re-enable them after the upgrade with the 'software-properties' tool
or your package manager.

To continue please press [ENTER]

Hit http://archive.ubuntu.com/ubuntu eoan InRelease
Hit http://security.ubuntu.com/ubuntu eoan-security InRelease
Fetched 0 B in 0s (0 B/s)

Checking package manager
Reading package lists... Done
Building dependency tree
Reading state information... Done

Invalid package information

After updating your package information, the essential package
'ubuntu-minimal' could not be located. This may be because you have
no official mirrors listed in your software sources, or because of
excessive load on the mirror you are using. See /etc/apt/sources.list
for the current list of configured software sources.
In the case of an overloaded mirror, you may want to try the upgrade
again later.

Restoring original system state

Aborting

A: You're using unsupported Ubuntu interim release.
Edit your /etc/apt/sources.list file and add the following lines:
deb http://old-releases.ubuntu.com/ubuntu disco main restricted
deb http://old-releases.ubuntu.com/ubuntu disco-updates main restricted
deb http://old-releases.ubuntu.com/ubuntu disco-security main restricted

and remove the lines which doesn't work.
Then run: sudo apt-get update again.
And try to do distribution upgrade again: sudo do-release-upgrade.
Source: How To: Fix apt update in Ubuntu 19.04.


text:
Q: To call dispatch function in react I don't know where to call dispatch(setAlert()) function. I want it after axios.patch request but currently it's not working
  let url = `.....................`;
  const handleSubmit = (e) => {
    e.preventDefault();
    axios
      .patch(url, form_data, {
        headers: {
          Authorization: `JWT ${localStorage.getItem("access")}`,
          "content-type": "application/json",
        },
      })
      dispatch(setAlert('Data changed successfully.', 'success'));
      .then(() => axios.get(url))
      .then((res) => {
        console.log(res.data);
        updateFormData({
          ...formData
        })
      })
      .catch((err) => console.log(err));
    };

A: Add the dispatch call within then right after patch call:
const handleSubmit = (e) => {
    e.preventDefault();
    axios
      .patch(url, form_data, {
        headers: {
          Authorization: `JWT ${localStorage.getItem("access")}`,
          "content-type": "application/json",
        },
      })
      .then(() => {
         dispatch(setAlert('Data changed successfully.', 'success'));
         axios.get(url));
       }
      .then((res) => {
        console.log(res.data);
        updateFormData({
          ...formData
        })
      })
      .catch((err) => console.log(err));
    };

EDIT:
Make sure you either connect the component in case of class component or import useDispatch hook in case of functional component, like:
import { useDispatch } from 'react-redux'

function SomeComponent() {
    const dispatch = useDispatch();
    ...
    // your code place

}

A: You can use async / wait and then wait till the patch call is done.

  const handleSubmit = async (e) => {
    e.preventDefault();
    await axios
      .patch(url, form_data, {
        headers: {
          Authorization: `JWT ${localStorage.getItem("access")}`,
          "content-type": "application/json",
        },
      })
      dispatch(setAlert('Data changed successfully.', 'success'));
      .then(() => axios.get(url))
      .then((res) => {
        console.log(res.data);
        updateFormData({
          ...formData
        })
      })
      .catch((err) => console.log(err));
    };


text:
Q: ¿Poner texto del carousel bootstrap arriba? ¿Cómo puedo subir el texto hacia la parte superior? me lo pone hacia abajo.
Le puedo meter un padding, pero creo que no es la forma correcta de subirlo, además me daría error a la larga, he estado buscando tutoriales y no encuentro la manera, si me podeis ayudar lo agradecería, os paso la pagina web para que veais como el texto esta puesto abajo, también me gustaría ponerle una box con opacidad para que se vea mejor el texto, por que con las imágenes se puede ver mal.
stealand

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam, repellendus.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam, repellendus.

Lorem ipsum dolor sit amet.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam, repellendus.

                Previous

                Next

.carousel-item {
  position: relative;
  display: none;
  float: left;
  width: 100%;
  margin-right: -100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transition: -webkit-transform 0.6s ease-in-out;
  transition: transform 0.6s ease-in-out;
  transition: transform 0.6s ease-in-out, -webkit-transform 0.6s ease-in-out;
}

.carousel-caption {
  position: absolute;
  right: 15%;
  bottom: 20px;
  left: 15%;
  z-index: 10;
  padding-top: 20px;
  padding-bottom: 20px;
  color: #fff;
  text-align: center;
}

A: Si te fijas en el
 que contiene el texto, este, además de tener un position: absolute tiene un bottom: 20px. Estas reglas en conjunto provocan que el texto esté a 20px de la parte de abajo del carrusel. Cambiando bottom por top puedes hacer que esté a los píxeles que necesites contando desde la parte de arriba.
Añadiendo la regla background-color: rgba(0, 0, 0, 0.5) a ese mismo
 puedes ponerle un fondo con opacidad al contenedor del texto.
CSS
.carousel-caption {
    position: absolute;
    right: 15%;
    top: 125px; /* Cambiar bottom por top y los píxeles que necesites */
    left: 15%;
    z-index: 10;
    padding-top: 20px;
    padding-bottom: 20px;
    color: #fff;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.5); /* Añadir para conseguir el fondo con opacidad */
}


text:
Q: Circular Buffer traversal I'm trying to write a for loop that starts from where my currentIndex variable leaves off, and traverses through the circular buffer.
I am using the circular buffer to store load data. Data is periodically stored.
Currently, this is how I populate data:
//currentIndex starts at 0
buffer[currentIndex] = data;
currentIndex = (currentIndex + 1) % size;

Ex: size is 6. 8 entries (1 2 10 11 12 13 8 9) are stored, so 2 entries at index 0 and 1 get overwritten.
Index : 0  1  2  3   4  5
Buffer: 8  9  10 11 12 13
After 9 is populated, currentIndex becomes 2.
I want to traverse indices in this order: 9, 8, 13, 12, 11, 10.
I want to start from the last index (most recent data) populated.
I am having trouble coming up with the logic to do this in a for loop.

A: If you want to begin printing from the element previous to the last indexed value, you can use a do loop that decrements a non-zero array index, or assigns the last available index to the array index:
#include <stdio.h>

int main(void)
 {
     size_t size = 6;
     int buffer[size];
     int input[] = { 1, 2, 10, 11, 12, 13, 8, 9 };

     /* Populate array */
     size_t currentIndex = 0;
     size_t lastIndex = 0;
     for (size_t i = 0; i < 8; i++) {
         buffer[currentIndex] = input[i];
         currentIndex = (currentIndex + 1) % size;
         lastIndex = currentIndex;
     }

     /* Print array contents */
     for (size_t i = 0; i < size; i++) {
         printf("%5d", buffer[i]);
     }
     putchar('\n');

     /* Print in reverse, starting before the last index */
     size_t i = lastIndex;
     do {
         i ? --i : (i = size - 1);
         printf("%5d", buffer[i]);
     } while (i != lastIndex);
     putchar('\n');

     return 0;
 }

Program output:
8    9   10   11   12   13
9    8   13   12   11   10

A: There's on reason to use a circular buffer for a stack. One uses a circular buffer to implement a lock-less queue with one writer and one reader.
int head = 0;
int tail = 0;
int buffer[BUF_SIZE];  // Holds one less than BUF_SIZE elements.

// Returns true if successful, false if empty.
int circular_buffer_read(int* val_ptr) {
   if (head == tail)
      return 0;

   *val_ptr = buffer[tail];
   tail = (tail + 1) % BUF_SIZE;
   return 1;
}

// Returns true if successful, false if full.
int circular_buffer_write(int val) {
   buffer[head] = val;
   int new_head = (head + 1) % BUF_SIZE;
   if (new_head == tail)
      return 0;

   head = new_head;
   return 1;
}

If you have a single reader and a single writer, the above is thread-safe if the comparisons (head == tail and new_head == tail) are thread-safe.
void producer() {
   int i = 0;
   while (1) {
      if (!circular_buffer_write(i)) {
         sleep(1);
         continue;
      }

      ++i;
   }
}

void consumer() {
   while (1) {
      int i;
      if (!circular_buffer_read(&i)) {
         sleep(1);
         continue;
      }

      printf("Got %d\n", i);
   }
}

A: It seems like you need a LIFO kind of structure instead of the circular buffer (queue) which is typically used for FIFO.
A stack might work better for your use case.
As a producer puts elements on the top of the stack, the consumer takes out elements from the very same top, processing newest elements first.

A: for(int i = size; i > 0; --i)
{
    printf("%d ", buffer[(currentIndex + i) % size]);
}

Index calculations:
(currentIndex + size    ) % size ~ currentIndex
(currentIndex + size - 1) % size ~ currentIndex - 1
...