text:
Q: Are there any alternatives to access the results of a query that will only produce one row? I query a table on it's primary index, and it will produce only one row result.
$query= $this->db->query('SELECT Name FROM people WHERE PersonID = 1');

To now access that 'Name', it seems to me that I have to always iterate through the result set.
foreach ($query->result() as $row)  {
    echo $row->Name;
}

Does one always have to iterate through the resultset? I understand there maybe good reasons for it, but is it absolutely required in all situations? Is there no way to just go straight to something like
echo $query->result()->Name     //pseudo code - won't actually work

(This is PHP / CodeIgniter)

A: try $this->db->query('...')->fetchObject()->Name as fetch returns array
UPDATE: code works for PDO, for codeigniter can use
$this->db->query('...')->result()->Name

A: please take a look at these 2 functions
function _getColumn($table, $column, $where = array()) {

        $this->db->select($column);
        $q = $this->db->get_where($table, $where);
        return ($q->num_rows() > 0) ? $q->result()[0]->$column : FALSE;

}

//after calling this function your result is as follows

var_dump($this->model_name->_getColumn('people', 'name', array('personID' => '1')));
//output
//string(6) "Maxcot" //or BOOLEAN(FALSE)
//also please note that it can not handle as "$column" parameter this input = "id, name"

second function is to get more columns
function _getColumns($table, $column, $where = array()) {
        $this->db->select($column);
        $this->db->where($where);
        $q = $this->db->get($table);
        return ($q->num_rows() > 0) ? $q->result()[0] : FALSE;
}

//after calling function like this
$person_info = $this->model_name->_getColumn('people', 'name, address, phone', array('personID' => '1'));

//you can access table columns like this (also check if $person_info is not FALSE)
$person_info->name;// ->address, ->phone

A: $query->first_row()->Name

https://www.codeigniter.com/user_guide/database/results.html


text:
Q: Conflict using Bootstrap's display property d-none d-md-block and d-flex In the following code block bootstrap classes d-none d-md-block are cancelling d-flex.
I need to not show this block on anything lower than md but also be able to set d-flex so that bootstraps align-self-end class works, (which currently it does not). How do I get these to play nicely together? Or is there another solution?

Title Here

A: If I understand correctly, you shouldn't be using d-block at all. Replace it and d-flex with d-md-flex to apply flex display only to the medium breakpoint and above.
See https://getbootstrap.com/docs/5.1/utilities/flex/#enable-flex-behaviors and https://getbootstrap.com/docs/5.1/utilities/display/#hiding-elements.

redpajama_set_name: RedPajamaStackExchange


text:
Q: javax.mail.SendFailedException: Invalid Addresses (While trying to send emal using Rediffmail) This program attempts to send email by first connecting to smtp.rediffmail.com . There is no compile time error or compile time exception.But as i try to run the following program it generates the following exception.
javax.mail.SendFailedException: Invalid Addresses;
  nested exception is:
        com.sun.mail.smtp.SMTPAddressFailedException: 421 Authorization failed: please authenticate by
 doing get message first
I can't figure out what the exception is and why i am getting this exception .
Here is the complete program.In this i have tried to make TLS connection with rediffmail server.
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import java.util.Properties;

class rediff {
   public static void main(String args[]) {
      Properties props = new Properties();
      props.put("mail.smtp.host", "smtp.rediffmail.com");
      props.put("mail.stmp.user", "from");

      //To use TLS
      props.put("mail.smtp.auth", "true");
      props.put("mail.smtp.starttls.enable", "true");
      props.put("mail.smtp.password", "password");

      Session session = Session.getDefaultInstance(props, new Authenticator() {
        @Override
            protected PasswordAuthentication getPasswordAuthentication() {
               String username = "from";
               String password = "password";
                return new PasswordAuthentication("from", "password");
            }
      });
       String to = "me@gmail.com";
       String from = "from@rediff.com";
       String subject = "Testing...";
       MimeMessage msg = new MimeMessage(session);
         try {
           msg.setFrom(new InternetAddress(from));
           msg.setRecipient(MimeMessage.RecipientType.TO, new InternetAddress(to));
           msg.setSubject(subject);
           msg.setText("rediff program working...!");
           Transport transport = session.getTransport("smtp");
           transport.send(msg);
           System.out.println("fine!!");
         }   catch(Exception exc) {
                 System.out.println(exc);
              }
   }
}

Why do i get this exception ?

A: as per: http://www.techtalkz.com/microsoft-outlook/193842-pop3.html

In your account settings, enable the "Log on to incoming server before
  sending mail" on the "Outgoing Server" tab of your account properties. How
  to locate these properties and tabs is Outlook version-specific but you
  decided that information wasn't important.

The error is specific to the SMTP service you are trying to use from your client.  It's not a code problem.  Check your rediffmail.com account settings

A: The problem with the code is this:
Transport transport = session.getTransport("smtp");
transport.send(msg);

the send method is a static method and you are not suppose to access it with an instance of Transport class. it should be - Transport.send(msg);

A: You're trying to use TLS auth but I don't see any port settings in your code. Usually smtp server uses different ports for TLS/SSL authentication, try setting it via mail.smtp.socketFactory.port. For TLS default value is 587, for SSL - 993 as far as I remember.
    props.put("mail.smtp.socketFactory.port", port);
    props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");


text:
Q: how to convert our site to https? I would like to convert our extranet, which is currently available via http to use https instead. The server is only accessible by it's ip address, there's no domain name.
I'm looking for a free solution to achieve this with apache2.

A: You can do this with a self signed ssl cert, however, the important part of a certificate is that it's a key certified as belonging to an entity by a trusted third party. By signing your own key you're negating much of the security advantage, in particular for anyone other than you who visits the site.
If anyone other than you will be using the site you should purchase a certificate and a domain name - it can be done for less than $100 per year.
That said, there are several questions dealing with self signed certificate generation:

*

*Generate self signed SSL certificate for apache

*What are the benefits of a self signed certificate on a live site?

*For an intranet server would you buy a ssl cert or use a self signed cert?

*What is the difference between site certificate and signing certificate?
and with configuring apache to deal with https

*

*Listening for https in apache

*SSL - how to make both http and https work

*Setting up https with a self-signed certificate on Apache

A: As far as converting your site to https, it should be easy enough. Just refuse to serv on http and configure apache to use SSL and serv your extranet on https. There should not be anything you need to do on the site itself. All configuration will be done on apache.
As far as ip address vs domain name, you need to speak with whoever you get your SSL Certificate from.
There are many useful documents and howto's available, here's a start:http://ubuntuforums.org/showthread.php?t=3657

*

*yes, check with your SSL guys

*it is free, but you have to pay for the certificate, or you create one yourself.

*apache support ssl, perfect.

*ask questions if you get stuck.

-js

A: You likely don't have a method to push a trusted CA under everyone's client PC.  Internally, companies can do this, but it's a bit more difficult to do this externally.
You can get a 'real' SSL cert from GoDaddy for $29 a year.  With this setup, the users will get SSL, and won't get a security warning.
If you self-sign a cert, then generally, users will get a warning whenever they visit your site.  If you train users to ignore this warning, then you are defeating much of the point of SSL.  If the user is connected via a public wifi hotspot, and someone intercepts their traffic, the only thing preventing the man-in-the middle attack from working is the certificate warning which the users receive.  The book Beautiful Security has a nice chapter explaining how this is done, and what can be don't to prevent this from occurring.

A: In your apache config, you'd probably be best to redirect all http traffic to https.  One way to do this, is to setup two vhosts in the apache config, and have a line similar to
Redirect / https://your.site.tld

This is probably better than refusing to serve non-https traffic.

A: As others have mentioned, it is already simple enough and free to convert to a https only serving (or a combination of both). Apache can be configured to use mod_ssl along with a server certificate. A self-signed server certificate can be created using openssl to generate it.
However, it all depends on your reason for using SSL. If it is merely to encrypt the session, a self-signed certificate may be somewhat helpful but it will not stop any man-in-the-middle attacks. You want the client browser and web-server to trust each other.
Assuming that this is something for the use of your company employees, there is a free solution. You can become your own root CA and generate certificates for both the server and the clients. All that is needed is for the client browsers to be configured to accept your own company CA as a trusted CA and it will help negate some of the authentication issues.
In addition, you can configure Apache to verify all client certificates and to reject any connection from any client that does not present a valid certificate signed with your own root CA. This can help to create a very tight trust mechanism. It will essentially eliminate most attacks.

A: brianegge's answer is spot on.
You can self sign if all you need is the benefit of encryption, but it's hard to manage that for the users.  Buy a cert from a CA that the browsers will recognize, it's more than worth it compared to the aggravation a self-signed cert will cause.


text:
Q: When should I be using React.cloneElement vs this.props.children? I am still a noob at React and in many examples on the internet, I see this variation in rendering child elements which I find confusing. Normally I see this:
class Users extends React.Component {
  render() {
    return (

Users

        {this.props.children}

    )
  }
}

But then I see an example like this:
<ReactCSSTransitionGroup
     component="div"
     transitionName="example"
     transitionEnterTimeout={500}
     transitionLeaveTimeout={500}
     >
     {React.cloneElement(this.props.children, {
       key: this.props.location.pathname
      })}
</ReactCSSTransitionGroup>

Now I understand the api but the docs don't exactly make clear when I should be using it.
So what does one do which the other can't? Could someone explain this to me with better examples?

A: Edit:
Look at Vennesa's answer instead, which is a better explanation.
Original:
First of all, the React.cloneElement example only works if your child is a single React element.
For almost everything {this.props.children} is the one you want.
Cloning is useful in some more advanced scenarios, where a parent sends in an element and the child component needs to change some props on that element or add things like ref for accessing the actual DOM element.
In the example above, the parent which gives the child does not know about the key requirement for the component, therefore it creates a copy of the element it is given and adds a key based on some unique identifier in the object. For more info on what key does: https://facebook.github.io/react/docs/multiple-components.html

A: props.children isn't the actual children; It is the descriptor of the children. So you don't have actually anything to change; you can't change any props, or edit any functionality; you can only read from it. If you need to make any modifications you have to create new elements using React.CloneElement.
https://egghead.io/lessons/react-use-react-cloneelement-to-extend-functionality-of-children-components
An example:
main render function of a component such as App.js:
render() {
    return(
            <Paragraph>
              <Sentence>First</Sentence>
              <Sentence>Second</Sentence>
              <Sentence>Third</Sentence>
            </Paragraph>
    )
}

now let's say you need to add an onClick to each child of Paragraph; so in your Paragraph.js you can do:
render() {
        return (

          {React.Children.map(this.props.children, child => {
            return React.cloneElement(child, {
              onClick: this.props.onClick })
         })}

       )
}

then simply you can do this:
render() {
  return(
        <Paragraph onClick={this.onClick}>
          <Sentence>First</Sentence>
          <Sentence>Second</Sentence>
          <Sentence>Third</Sentence>
        </Paragraph>
   )
}

Note: the React.Children.map function will only see the top level elements, it does not see any of the things that those elements render; meaning that you are providing the direct props to children (here the <Sentence /> elements). If you need the props to be passed down further, let's say you will have a

 inside one of the <Sentence /> elements that wants to use the onClick prop then in that case you can use the Context API to do it. Make the Paragraph the provider and the Sentence elements as consumer.

A: In fact, React.cloneElement is not strictly associated with this.props.children.
It's useful whenever you need to clone react elements(PropTypes.element) to add/override props, without wanting the parent to have knowledge about those component internals(e.g, attaching event handlers or assigning key/ref attributes).
Also react elements are immutable.

React.cloneElement( element, [props], [...children] ) is almost equivalent to:
  <element.type {...element.props} {...props}>{children}</element.type>

However, the children prop in React is especially used for containment (aka composition), pairing with React.Children API and React.cloneElement, component that uses props.children can handle more logic(e.g., state transitions, events, DOM measurements etc) internally while yielding the rendering part to wherever it's used, React Router <switch/> or compound component <select/> are some great examples.
One last thing that worth mentioning is that react elements are not restricted to props.children.
function SplitPane(props) {
  return (

        {props.left}

        {props.right}

  );
}

function App() {
  return (
    <SplitPane
      left={
        <Contacts />
      }
      right={
        <Chat />
      } />
  );
}

They can be whatever props that makes sense, the key was to define a good contract for the component, so that the consumers of it can be decoupled from the underlying implementation details, regardless whether it's using React.Children, React.cloneElement, or even React.createContext.


text:
Q: Is caching in ASP.NET shared across users or specific to an individual? I have a quick question I'm just not sure about. I'm trying to increase performance on an intranet site. I'm trying to limit the trips to the database by implementing some caching. I'm new to caching and I wasn't sure is this shared across users? I'm hoping it's unique to the individual user. Like every user would have their own independent cache much like the session object. I'm trying things like this
   if (Cache["_InfoResult"] == null)
        {
            Cache["_InfoResult"] = db.GetInfoResultBySessionGuid(SessionGuid);
        }

        _InfoResult = (InfoResult)Cache["_InfoResult"];

and then using the _InfoResult object to drive areas of the page. My concern was that I want Cache["_InfoResult"] to be unique for each user. Is this correct or would this object be the same for each user? Thanks for clearing it up.
Cheers,
~ck in San Diego

A: The cache has a global scope and it persists for the lifetime of your web application. It is not per httprequest.
You can test this with some simple code.
<asp:TextBox ID="txtData" runat="server" Width="200px"></asp:TextBox>

<asp:Button ID="btnPutToCache" runat="server" Text="Put to Cache" onclick="btnPutToCache_Click" />

<asp:Button ID="btnGetFromCache" runat="server" text="Get from Cache" onclick="btnGetFromCache_Click" />

<asp:Label id="lblGetFromCache" runat="server"></asp:Label>

And the codebehind:
protected void btnPutToCache_Click(object sender, EventArgs e) {
        Cache["data"] = txtData.Text;
    }
    protected void btnGetFromCache_Click(object sender, EventArgs e) {
        lblGetFromCache.Text = Cache["data"].ToString();
    }

Put all of the above code into one page. Deploy your website. Hit the page from instance of your browser window, put some test text into the text box and hit the Put to Cache button.
Open a new browser window and hit the page. Click the Get from Cache button, and observe the results.

A: The ASP.Net Cache is attached to the application domain, so it's shared for all users.
If you want to cache something for an individual user, use the Session object.


text:
Q: Quartz simple trigger not working after sometime I am using quartz simple trigger (quartz 2.2.1) with setting as repeat indefinitely. All schedules were running fine in production but recently they stopped working and also the next fire time is not updating.
If I update the schedule using rescheduleJob quartz API, it works fine for sometime and then again goes in stuck state.
Any info on as to how this is happening?
Thread dump shows all threads in Timed waiting state with onObject monitoring.
"UDPQuartzScheduler_Worker-8" #49 prio=4 os_prio=0 tid=0x00007f88d71a8000 nid=0x30b6 in Object.wait() [0x00007f8928b30000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568)
    - locked <0x00000006ddc9d6b0> (a java.lang.Object)

"UDPQuartzScheduler_Worker-7" #48 prio=4 os_prio=0 tid=0x00007f88d71a6000 nid=0x30b5 in Object.wait() [0x00007f8928c31000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568)
    - locked <0x00000006ddc9d6f8> (a java.lang.Object)

"UDPQuartzScheduler_Worker-6" #47 prio=4 os_prio=0 tid=0x00007f88d71a4000 nid=0x30b4 in Object.wait() [0x00007f8928d32000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568)
    - locked <0x00000006ddc9f000> (a java.lang.Object)

A: You might face same issue even after increasing thread count because your worker threads will get stuck again.
To resolve this issue, you have to review your worker thread code and check weather they are getting stuck or where some task taking too much execution time ( basically its happen when you write/read too much data ).  This two reasons also creates misfire issue.
if you could not find any thing related to the points i mentioned above then you could create separate thread through worker instead of executing it on worker thread. it will definitely solve your problem but if you have too many threads stuck in application process, then your application will get stuck but as same time you'll get exact reason for this issue from application process stack trace.

A: Exactly the same problem we had on one project (just on Oracle). Never got to the bottom of the problem, but our conclusion was that Quartz also needs to be restarted when DB is restarted.
We had a lot of strange symptoms, besides simply skipping the execution - multiple executions of the same job, workers not synced in the cluster setup, etc. All of this was random, and we couldn't identify any patterns.


text:
Q: Correct place to put downloadable files in Rails 5 I recently made a website for someone in which they want to have a free download of a card game that they made in the form of a .zip file.
I have the download working but was wondering if there is a "correct" place to put public downloadable files according to Rails. When I put the .zip file in my public folder and change my download_cards method to reflect the changes I get an "unable to locate file" error message.
This is my setup for the download:
Controller:
class DownloadsController < ApplicationController
    def download_cards
        send_file "#{Rails.root}/app/assets/downloads/cardgame.zip", type: "application/zip", x_sendfile: true
    end
end

Routes:
Rails.application.routes.draw do

  root 'static_pages#home'

  get 'download_cards', to: "downloads#download_cards"

end

View:
<%= link_to "download the cardz", download_cardz_path %>

A: You could place the file directly in the public/ folder and then use
<%= link_to "Download Card Game", "/cardgame.zip" %>

This will create a the following link
Download Card Game

When Rails receives GET /cardgame.zip it will check the public/ directory for a matching file before looking for a route that matches.  No need for a controller at all to serve static files.


text:
Q: Как сделать картинку адаптивно \ canvas
Можно ли эту картинку нарисовать на канвасе как-нибудь, либо сделать адаптивной, что бы при уменьшении ширины экрана, когда съезжается текст, картинка увеличивалась в величине.

A: Достаточно просто использовать псевдоэлементы:

* {
  margin: 0;
  padding: 0;
}

.wrapper {
  margin: 16px;
  padding-left: 16px;
  font-size: 19px;
  border-left: 8px solid;
}

ul {
  padding: 1rem;
  list-style-type: none;
}

ul li {
  position: relative;
}

ul li::before {
  content: '—';
  position: absolute;
  left: -21px;
}

h2 {
  font-family: Arial;
  position: relative;
}

h2::before {
  content: '';
  position: absolute;
  left: -35px;
  width: 20px;
  height: 20px;
  background-color: white;
  border-radius: 50%;
  border: 5px solid;
}

Title

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Title

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Title

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Title

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.

Lorem ipsum dolor sit amet consectetur adipisicing elit. Soluta ab error quis asperiores temporibus minus est sit doloribus cupiditate laudantium voluptatibus, tempora voluptatum nostrum suscipit ratione tenetur sapiente numquam quidem.


text:
Q: How to backup a partitioned table in GreenPlum 5.18 Is it possible to make a backup of a specific partitioned table with GreenPlum?
When using:
pg_dump -t schema.partitioned_table dbname >/tmp/tlb

I could get all partition tables with DDL if I exe my command on my GP's master node.
I could not get any partitions tables with DDL when I exe my command without my GP's nodes.
What should I do without my GP's nodes to get partition tables with DDL?
pro on  pg 10

A: Ok.
The answer is GP's pg_dump is different from pg's pg_dmp.
Exe the command on GP's master node and any other pg nodes to see the different.
pg_dump --help


text:
Q: Run a script on another machine accessible through another machine over ssh I would like to run a script located on my development machine on machine B that is only accessible via machine A.
So, my development machine --(SSH)--> machineA --(SSH)--> machineB
How do I do that? The script also takes arguments.

A: What you want is a tunnel via a jump host or proxy. There are several ways of doing this based on what exactly you are trying to do, but I believe putting something like this in ~/.ssh/config locally should work for your case:
Host b
        ProxyJump a

Tested with this configuration:
Host localhost
    ProxyJump 127.0.0.1

And it works like this (trimmed to show just the hops):
$ ssh -v localhost 'ls ~'
Authenticated to 127.0.0.1 ([127.0.0.1]:22).
Authenticated to localhost (via proxy).
[ls output]

A: Let's say, you have the below script in the remote dev-machine.
remote-machine-x$ cat /home/userA/dev/zeebash
#!/bin/bash

 echo "$@" | mail -s subject mygmailaccount@gmail.com

To execute this script from local machine, given that you have already set-up ssh-key, you can do it with something like this:
p="hi man" ; ssh userA@remote-machine-x  "/home/userA/dev/zeebash   "$p" "


text:
Q: Display words nicely without blank space with css Facing troubles to display nicely two words lists aside, inquiring some advises.
What I am looking to do is to display two words list in the screen sides, somewhat as a background cloud, keeping them aligned with the css direction (left to right, right to left)
Using calc or grid doesn't provide something better for me than the following snippet.

#suggestL {top:0;left:0;position:fixed;width:32%;direction:rtl ;font-size:9px}

#suggestR {top:0;right:0;position:fixed;width:32%;direction:ltr ;font-size:9px}

 STICK HOUSE HANDS WOMAN WOMEN BUNNY BLOND SHAPE SWEAT TREND PHONE MARKS SKULL ANGER TEARS QUILT TRAIN ENTRY QUICK CAPUT HORSE SUPER SHAFT DOING LOTUS RETURN LETTER SQUARE SYSTEM DOUBLE MIDDLE TURNED SCRIPT BARRED LAMBDA DENTAL OGONEK STROKE CLOSED VOICED RHOTIC RAISED ACCENT BRIDGE MACRON EQUALS ALMOST ZIGZAG LUNATE DOTTED CURLED TAILED LITTLE GERESH QARNEY MERKHA MASORA DAGESH QAMATS NUMBER FOURTH POETIC ALAYHE TRIPLE MADDAH HAMZAH
DDAHAL GHUNNA UIGHUR KAZAKH SHADDA RASOUL SESAME DOLLAR FATHAH DAMMAH KASRAH VESSEL NINETY WEIGHT LIQUID NAXIAN THIRDS TALENT OUNKIA XESTES ARTABE AROURA GRAMMA PLUMED PERMIC WITHIN TURKIC ORKHON SANDHI KISIM5 KASKAL NINDA2 ILIMMU SIXTHS BAHAR2 KUSHU2 SHINDA NGGUOQ TXHEEJ INSIDE PERNIN FORMAT VAREIA OLIGON GORGON OXEIAI PIASMA FTHORA KATAVA MIKRON ETERON SEISMA KLASMA LEIMMA PROTOS TRITOS ISAKIA TELOUS CHROMA FHTORA YFESIS DIESIS GENIKI ARSEOS BREATH OTTAVA COMMON DEGREE MINIMA BREVIS TEMPUS KIEVAN
QUARTERS QUADRANT FROWNING DRAUGHTS CROSSING LOCATION OUTLINED PINWHEEL PETALLED SHADOWED
S-SHAPED DIRECTLY OPERATOR INTEGRAL INTERIOR NEGATION U-SHAPED CIRCLING POSITION LATINATE TAILLESS AKHMIMIC L-SHAPED SPIRITUS BOHAIRIC INDIRECT OMISSION SURROUND STANDARD ENTERING
POMMEE THUMBS FLOPPY BUTTON SPEECH CRYING BOWING PERSON FOLDED BULLET POLICE LITTER CROCUS COPPER SHADED FORMEE COWBOY

HAMZAT BARREE CENTRE FILLED SINDHI SKEWED DALATH PTHAHA ZQAPHA ARABIC RISING SYMBOL CANDRA STRESS KHANDA LENGTH CIRCLE CREDIT POWERS CHILLU SINGLE SPUNGS -KHYUD RNYING SVASTI MEDIAL KHAMTI LABIAL Y-CREE BOTTOM SAYISI R-CREE N-CREE HAGLAZ NAUDIZ PERTHO PEORTH SOWILO MANNAZ LAUKAZ ARLAUG FRANKS CASKET SAMYOK CAMNUC PHNAEK MANCHU BEAVER WIGGLY STRONG TALING ASYURA KEMPUL KEMPLI PAKPAK THYOOM TSHOOK NARROW UDATTA RTHANG KAVYKA SHEQEL UPWARD ITALIC HEADED CORNER PAIRED DASHED SUBSET NORMAL FACTOR SQUISH H-TYPE L-TYPE SCREEN SHORTS MEDIUM ON-OFF DEVICE RECORD DELETE BRANCH AMOUNT ELEVEN TWELVE TWENTY EIGHTH FLORAL SYRIAC TYPE-1 TYPE-2 TYPE-3 TYPE-4 TYPE-5 TYPE-6 TYPE-7 LESSER FEMALE BEHIND SAFETY BALLOT CENTER SPOKED CURVED GAPPED BESIDE ENDING JOINED SERIFS AROUND SCHEMA DOMAIN NESTED MEMBER DIVIDE BINARY HOOKED ARROWS COPTIC NUBIAN DIRECT BERBER TUAREG FORKED SECOND SPIRIT TANNED HIDING REPEAT POSTAL GIYEOG YEOLIN GYEONG HEAVEN HANGUL KIYEOK TIKEUT KOREAN THIRTY EIGHTY BITING COMING GENTLE JOYOUS BEFORE BROKEN POETRY OPEN-O SAMEKH TTEHEH  HINGED SPREAD CUPPED ANGLED RIPPLE OTHERS STRIKE FINGER SPIRAL DREAMY CHEEKS TONGUE LOOPED KNIGHT BOTTLE HOCKEY TENNIS PADDLE CAPPED TELLER POINTS FACING MOBILE ORANGE
CLINGING AROUSING MARRYING SQUIRREL QUANTITY LOGOGRAM BASELINE DAMMATAN KASRATAN

Using a monospace font provide something close to what I am looking for:

#suggestL {top:0;left:0;position:fixed;width:32%;direction:rtl ;font-size:9px;font-family:monospace}

#suggestR {top:0;right:0;position:fixed;width:32%;direction:ltr ;font-size:9px;font-family:monospace}

 STICK HOUSE HANDS WOMAN WOMEN BUNNY BLOND SHAPE SWEAT TREND PHONE MARKS SKULL ANGER TEARS QUILT TRAIN ENTRY QUICK CAPUT HORSE SUPER SHAFT DOING LOTUS RETURN LETTER SQUARE SYSTEM DOUBLE MIDDLE TURNED SCRIPT BARRED LAMBDA DENTAL OGONEK STROKE CLOSED VOICED RHOTIC RAISED ACCENT BRIDGE MACRON EQUALS ALMOST ZIGZAG LUNATE DOTTED CURLED TAILED LITTLE GERESH QARNEY MERKHA MASORA DAGESH QAMATS NUMBER FOURTH POETIC ALAYHE TRIPLE MADDAH HAMZAH
DDAHAL GHUNNA UIGHUR KAZAKH SHADDA RASOUL SESAME DOLLAR FATHAH DAMMAH KASRAH VESSEL NINETY WEIGHT LIQUID NAXIAN THIRDS TALENT OUNKIA XESTES ARTABE AROURA GRAMMA PLUMED PERMIC WITHIN TURKIC ORKHON SANDHI KISIM5 KASKAL NINDA2 ILIMMU SIXTHS BAHAR2 KUSHU2 SHINDA NGGUOQ TXHEEJ INSIDE PERNIN FORMAT VAREIA OLIGON GORGON OXEIAI PIASMA FTHORA KATAVA MIKRON ETERON SEISMA KLASMA LEIMMA PROTOS TRITOS ISAKIA TELOUS CHROMA FHTORA YFESIS DIESIS GENIKI ARSEOS BREATH OTTAVA COMMON DEGREE MINIMA BREVIS TEMPUS KIEVAN
QUARTERS QUADRANT FROWNING DRAUGHTS CROSSING LOCATION OUTLINED PINWHEEL PETALLED SHADOWED
S-SHAPED DIRECTLY OPERATOR INTEGRAL INTERIOR NEGATION U-SHAPED CIRCLING POSITION LATINATE TAILLESS AKHMIMIC L-SHAPED SPIRITUS BOHAIRIC INDIRECT OMISSION SURROUND STANDARD ENTERING
POMMEE THUMBS FLOPPY BUTTON SPEECH CRYING BOWING PERSON FOLDED BULLET POLICE LITTER CROCUS COPPER SHADED FORMEE COWBOY

HAMZAT BARREE CENTRE FILLED SINDHI SKEWED DALATH PTHAHA ZQAPHA ARABIC RISING SYMBOL CANDRA STRESS KHANDA LENGTH CIRCLE CREDIT POWERS CHILLU SINGLE SPUNGS -KHYUD RNYING SVASTI MEDIAL KHAMTI LABIAL Y-CREE BOTTOM SAYISI R-CREE N-CREE HAGLAZ NAUDIZ PERTHO PEORTH SOWILO MANNAZ LAUKAZ ARLAUG FRANKS CASKET SAMYOK CAMNUC PHNAEK MANCHU BEAVER WIGGLY STRONG TALING ASYURA KEMPUL KEMPLI PAKPAK THYOOM TSHOOK NARROW UDATTA RTHANG KAVYKA SHEQEL UPWARD ITALIC HEADED CORNER PAIRED DASHED SUBSET NORMAL FACTOR SQUISH H-TYPE L-TYPE SCREEN SHORTS MEDIUM ON-OFF DEVICE RECORD DELETE BRANCH AMOUNT ELEVEN TWELVE TWENTY EIGHTH FLORAL SYRIAC TYPE-1 TYPE-2 TYPE-3 TYPE-4 TYPE-5 TYPE-6 TYPE-7 LESSER FEMALE BEHIND SAFETY BALLOT CENTER SPOKED CURVED GAPPED BESIDE ENDING JOINED SERIFS AROUND SCHEMA DOMAIN NESTED MEMBER DIVIDE BINARY HOOKED ARROWS COPTIC NUBIAN DIRECT BERBER TUAREG FORKED SECOND SPIRIT TANNED HIDING REPEAT POSTAL GIYEOG YEOLIN GYEONG HEAVEN HANGUL KIYEOK TIKEUT KOREAN THIRTY EIGHTY BITING COMING GENTLE JOYOUS BEFORE BROKEN POETRY OPEN-O SAMEKH TTEHEH  HINGED SPREAD CUPPED ANGLED RIPPLE OTHERS STRIKE FINGER SPIRAL DREAMY CHEEKS TONGUE LOOPED KNIGHT BOTTLE HOCKEY TENNIS PADDLE CAPPED TELLER POINTS FACING MOBILE ORANGE
CLINGING AROUSING MARRYING SQUIRREL QUANTITY LOGOGRAM BASELINE DAMMATAN KASRATAN

As you had maybe guessed with this two examples, I am looking to avoid any blank spaces in the columns.
My word list has different word length, but words can be melted.
What are the simplest possibility here, beside adjusting the margins with a negative value, which would be hiding some words from the offset?
*No blank spaces into the word lists, this is what I am looking to do while keeping the whole list on screen:*

Is css is off limit for this, should I make some wizardry with javascript, word length sorting, pixel offset calculation, while taking care of responsiveness (..)?
Resolved,very simply, thanks everyone!

#suggestL {top:0;left:0;position:fixed;width:32%;direction:rtl ;font-size:9px;font-family:monospace; text-align: justify}

#suggestR {top:0;right:0;position:fixed;width:32%;direction:ltr ;font-size:9px;font-family:monospace; text-align: justify}

 STICK HOUSE HANDS WOMAN WOMEN BUNNY BLOND SHAPE SWEAT TREND PHONE MARKS SKULL ANGER TEARS QUILT TRAIN ENTRY QUICK CAPUT HORSE SUPER SHAFT DOING LOTUS RETURN LETTER SQUARE SYSTEM DOUBLE MIDDLE TURNED SCRIPT BARRED LAMBDA DENTAL OGONEK STROKE CLOSED VOICED RHOTIC RAISED ACCENT BRIDGE MACRON EQUALS ALMOST ZIGZAG LUNATE DOTTED CURLED TAILED LITTLE GERESH QARNEY MERKHA MASORA DAGESH QAMATS NUMBER FOURTH POETIC ALAYHE TRIPLE MADDAH HAMZAH
DDAHAL GHUNNA UIGHUR KAZAKH SHADDA RASOUL SESAME DOLLAR FATHAH DAMMAH KASRAH VESSEL NINETY WEIGHT LIQUID NAXIAN THIRDS TALENT OUNKIA XESTES ARTABE AROURA GRAMMA PLUMED PERMIC WITHIN TURKIC ORKHON SANDHI KISIM5 KASKAL NINDA2 ILIMMU SIXTHS BAHAR2 KUSHU2 SHINDA NGGUOQ TXHEEJ INSIDE PERNIN FORMAT VAREIA OLIGON GORGON OXEIAI PIASMA FTHORA KATAVA MIKRON ETERON SEISMA KLASMA LEIMMA PROTOS TRITOS ISAKIA TELOUS CHROMA FHTORA YFESIS DIESIS GENIKI ARSEOS BREATH OTTAVA COMMON DEGREE MINIMA BREVIS TEMPUS KIEVAN
QUARTERS QUADRANT FROWNING DRAUGHTS CROSSING LOCATION OUTLINED PINWHEEL PETALLED SHADOWED
S-SHAPED DIRECTLY OPERATOR INTEGRAL INTERIOR NEGATION U-SHAPED CIRCLING POSITION LATINATE TAILLESS AKHMIMIC L-SHAPED SPIRITUS BOHAIRIC INDIRECT OMISSION SURROUND STANDARD ENTERING
POMMEE THUMBS FLOPPY BUTTON SPEECH CRYING BOWING PERSON FOLDED BULLET POLICE LITTER CROCUS COPPER SHADED FORMEE COWBOY

HAMZAT BARREE CENTRE FILLED SINDHI SKEWED DALATH PTHAHA ZQAPHA ARABIC RISING SYMBOL CANDRA STRESS KHANDA LENGTH CIRCLE CREDIT POWERS CHILLU SINGLE SPUNGS -KHYUD RNYING SVASTI MEDIAL KHAMTI LABIAL Y-CREE BOTTOM SAYISI R-CREE N-CREE HAGLAZ NAUDIZ PERTHO PEORTH SOWILO MANNAZ LAUKAZ ARLAUG FRANKS CASKET SAMYOK CAMNUC PHNAEK MANCHU BEAVER WIGGLY STRONG TALING ASYURA KEMPUL KEMPLI PAKPAK THYOOM TSHOOK NARROW UDATTA RTHANG KAVYKA SHEQEL UPWARD ITALIC HEADED CORNER PAIRED DASHED SUBSET NORMAL FACTOR SQUISH H-TYPE L-TYPE SCREEN SHORTS MEDIUM ON-OFF DEVICE RECORD DELETE BRANCH AMOUNT ELEVEN TWELVE TWENTY EIGHTH FLORAL SYRIAC TYPE-1 TYPE-2 TYPE-3 TYPE-4 TYPE-5 TYPE-6 TYPE-7 LESSER FEMALE BEHIND SAFETY BALLOT CENTER SPOKED CURVED GAPPED BESIDE ENDING JOINED SERIFS AROUND SCHEMA DOMAIN NESTED MEMBER DIVIDE BINARY HOOKED ARROWS COPTIC NUBIAN DIRECT BERBER TUAREG FORKED SECOND SPIRIT TANNED HIDING REPEAT POSTAL GIYEOG YEOLIN GYEONG HEAVEN HANGUL KIYEOK TIKEUT KOREAN THIRTY EIGHTY BITING COMING GENTLE JOYOUS BEFORE BROKEN POETRY OPEN-O SAMEKH TTEHEH  HINGED SPREAD CUPPED ANGLED RIPPLE OTHERS STRIKE FINGER SPIRAL DREAMY CHEEKS TONGUE LOOPED KNIGHT BOTTLE HOCKEY TENNIS PADDLE CAPPED TELLER POINTS FACING MOBILE ORANGE
CLINGING AROUSING MARRYING SQUIRREL QUANTITY LOGOGRAM BASELINE DAMMATAN KASRATAN

A: You can simply use text-align: justify; to spread the words over the whole line due to increasing existing spaces.

#suggestL,
#suggestR {
  top: 0;
  position: fixed;
  width: 32%;
  font-size: 9px;
  font-family: monospace;
  text-align: justify;
}

#suggestL {
  left: 0;
  direction: rtl;
}

#suggestR {
  right: 0;
  direction: ltr;
}

  STICK HOUSE HANDS WOMAN WOMEN BUNNY BLOND SHAPE SWEAT TREND PHONE MARKS SKULL ANGER TEARS QUILT TRAIN ENTRY QUICK CAPUT  HORSE SUPER SHAFT DOING LOTUS RETURN LETTER SQUARE SYSTEM DOUBLE MIDDLE TURNED SCRIPT BARRED LAMBDA DENTAL OGONEK STROKE CLOSED  VOICED RHOTIC RAISED ACCENT BRIDGE MACRON EQUALS ALMOST ZIGZAG LUNATE DOTTED CURLED TAILED LITTLE GERESH QARNEY MERKHA MASORA  DAGESH QAMATS NUMBER FOURTH POETIC ALAYHE TRIPLE MADDAH HAMZAH
  DDAHAL GHUNNA UIGHUR KAZAKH SHADDA RASOUL SESAME DOLLAR FATHAH DAMMAH KASRAH VESSEL NINETY WEIGHT LIQUID NAXIAN THIRDS TALENT  OUNKIA XESTES ARTABE AROURA GRAMMA PLUMED PERMIC WITHIN TURKIC ORKHON SANDHI KISIM5 KASKAL NINDA2 ILIMMU SIXTHS BAHAR2 KUSHU2  SHINDA NGGUOQ TXHEEJ INSIDE PERNIN FORMAT VAREIA OLIGON GORGON OXEIAI PIASMA FTHORA KATAVA MIKRON ETERON SEISMA KLASMA LEIMMA  PROTOS TRITOS ISAKIA TELOUS CHROMA FHTORA YFESIS DIESIS GENIKI ARSEOS BREATH OTTAVA COMMON DEGREE MINIMA BREVIS TEMPUS KIEVAN
  QUARTERS QUADRANT FROWNING DRAUGHTS CROSSING LOCATION OUTLINED PINWHEEL PETALLED SHADOWED
  S-SHAPED DIRECTLY OPERATOR INTEGRAL INTERIOR NEGATION U-SHAPED CIRCLING POSITION LATINATE TAILLESS AKHMIMIC L-SHAPED SPIRITUS BOHAIRIC INDIRECT  OMISSION SURROUND STANDARD ENTERING
  POMMEE THUMBS FLOPPY BUTTON SPEECH CRYING BOWING PERSON FOLDED BULLET POLICE LITTER CROCUS COPPER SHADED FORMEE COWBOY

  HAMZAT BARREE CENTRE FILLED SINDHI SKEWED DALATH PTHAHA ZQAPHA ARABIC RISING SYMBOL CANDRA STRESS KHANDA LENGTH CIRCLE CREDIT  POWERS CHILLU SINGLE SPUNGS -KHYUD RNYING SVASTI MEDIAL KHAMTI LABIAL Y-CREE BOTTOM SAYISI R-CREE N-CREE HAGLAZ NAUDIZ PERTHO  PEORTH SOWILO MANNAZ LAUKAZ ARLAUG FRANKS CASKET SAMYOK CAMNUC PHNAEK MANCHU BEAVER WIGGLY STRONG TALING ASYURA KEMPUL KEMPLI  PAKPAK THYOOM TSHOOK NARROW UDATTA RTHANG KAVYKA SHEQEL UPWARD ITALIC HEADED CORNER PAIRED DASHED SUBSET NORMAL FACTOR SQUISH  H-TYPE L-TYPE SCREEN SHORTS MEDIUM ON-OFF DEVICE RECORD DELETE BRANCH AMOUNT ELEVEN TWELVE TWENTY EIGHTH FLORAL SYRIAC TYPE-1  TYPE-2 TYPE-3 TYPE-4 TYPE-5 TYPE-6 TYPE-7 LESSER FEMALE BEHIND SAFETY BALLOT CENTER SPOKED CURVED GAPPED BESIDE ENDING JOINED  SERIFS AROUND SCHEMA DOMAIN NESTED MEMBER DIVIDE BINARY HOOKED ARROWS COPTIC NUBIAN DIRECT BERBER TUAREG FORKED SECOND SPIRIT  TANNED HIDING REPEAT POSTAL GIYEOG YEOLIN GYEONG HEAVEN HANGUL KIYEOK TIKEUT KOREAN THIRTY EIGHTY BITING COMING GENTLE JOYOUS  BEFORE BROKEN POETRY OPEN-O SAMEKH TTEHEH HINGED SPREAD CUPPED ANGLED RIPPLE OTHERS STRIKE FINGER SPIRAL DREAMY CHEEKS TONGUE  LOOPED KNIGHT BOTTLE HOCKEY TENNIS PADDLE CAPPED TELLER POINTS FACING MOBILE ORANGE
  CLINGING AROUSING MARRYING SQUIRREL QUANTITY LOGOGRAM BASELINE DAMMATAN KASRATAN


text:
Q: How to get information from html in R? I want to get information about price from this page: https://www.coffeedesk.pl/product/16632/Espresso-Miesiaca-Lacava-Etiopia-Yirgacheffe-Rocko-Mountain-1Kg
My code
url <-"https://www.coffeedesk.pl/product/16632/Espresso-Miesiaca-Lacava-Etiopia-Yirgacheffe-Rocko-Mountain-1Kg"
x <- xml2::read_html(url)
price<-x%>% html_node('span.product-price smaller-price') %>%
  html_text()

but it returns NA
What can I do?

A: You have a space in your html statement when you really need to have a period. Try html_node('span.product-price.smaller-price') in your code and see if that works.


text:
Q: Do most mathematicians know most topics in mathematics? How many topics outside of his or her specialization is an average mathematician familiar with?
For example, does an average group theorist know enough of partial differential equations to pass a test in a graduate-level PDE course?
Also, what are the "must-know" topics for any aspiring mathematician? Why?
As a graduate student, should I focus more on breadth (choosing a wide range of classes that are relatively pair-wise unrelated, e.g., group theory and PDEs) or depth (e.g., measure theory and functional analysis)?

A: The answer to your question is easy:
No, an average mathematician specialized in, say, algebraic geometry could not pass without preparation a graduate level exam on partial differential equations.
Wait, it's worse than that: he couldn't even pass an undergraduate level exam on partial differential equations.
Wait, it's even worse: he couldn't pass an exam in algebraic geometry on a different specialized topic from his own.
For example  an elementary exam on the classification of singularities if he is specialised in Hilbert schemes.
Conversely I would be very surprised if a notorious analyst who recently got a Fields medal could solve the exercises in, say, Chapter 5 of Fulton's Algebraic Curves, the standard introduction to undergraduate algebraic geometry.
Some remarks
1) What I wrote is easy to confirm in private but impossible to prove in public:
I can't very well write that in a recent conversation   XXX, a respected probabilist, abundantly proved that he had no idea what the fundamental group of the circle is.
2) If author YYY wrote an article on partial differential equations using techniques from amenable group, this doesn't imply that other specialists in his field know any group theory.
It doesn't even prove that YYY knew much about group theory: he may have realised that group theory was involved in his research  and interviewed a group theorist who would have told him about amenable groups.
3) On the bright side some very exceptional mathematicians seem to know a lot about nearly every subject in mathematics: Atiyah, Deligne, Serre, Tao come to mind.
My sad conjecture is that their number is a function tending to zero as time passes.
And although I couldn't ace an analysis exam, I'm aware what this means for an $\mathbb N$-valued function...

A: My two cents: unless you have a magical brain, or are some sort of epoch-making genius, you're probably going to find that you can only hold only so much mathematics in your mind at any given time. So, for practical reasons—both with respect to writing a dissertation, and with respect to making a career for one's self—you should probably stick to one or two closely related areas, so that you might have sufficient expertise to make yourself useful to a research institution or to whatever it is that you wish to do with your future.
That being said, I've found that elbow grease and skill in mathematics are often woefully uncorrelated with one another. Rather, skill is often dependent more on how much mathematics one has seen. To that end, I would say, though you should definitely pick a subject area or two to call your own, you should strive keep an open mind and maintain an active interest in as wide a variety of mathematical disciplines as possible.
I often find that reading (even if only casually) about forms of mathematics unrelated to my research areas provides a wealth of new ideas and insights. The more patterns and phenomena you are acquainted with, the better the chance that you'll notice something of interest intruding upon your work, and that might give you some intuition you might not have otherwise had. At the very least, it will help you know what topics or sources (or collaborators...) to look up when you stumble across something outside of your area of greatest expertise.
Edit: One more thing. Linear algebra. To paraphrase Benedict Gross, there's no such thing as knowing too much Linear algebra. It's freakin' everywhere.

A: I spent several years on a project to read the first 1-2 chapters of at least one math book on each shelf of the university library. It was an attempt to gain an unbiased survey of mathematics. It was good for me, but it was a luxury: the forced march through a PhD program and into academia offers little time for such behavior. Yet it's important: all of the very best, most famous mathematicians are clearly employing cross-disciplinary tools in their work. And, for me, personally, it was a kind of level-up: suddenly, everything is easier.
Specializing in one field is kind of like lifting weights with just your right arm, ignoring the core, back and legs: it leaves you surprisingly weak and incapable. When you have to master many different styles of abstraction, you get better at abstraction, in general, even in your chosen specialty. This, to me, was the big unexpected surprise.
For the more quantitative question asked here: could I "pass a test in graduate level XYZ course?" for a 1st-year, 1st semester course, maybe, probably. Sort-of. Exams tend to pose questions using phrasing and notation that are closely aligned with the class textbook, and this notation can vary strongly from one textbook to another. So for that, prep would be needed.The point is that such prep becomes easier.

A: There is, of course, terrific ambiguity in the question. But, with any interpretation, the answer would be generally, "no, most practitioners of some part of X do not remember all of X... because they do not need to".
Thus, if only because most even-very-smart people's memories fade with time, there'll only be a slight residue of the standard-basic things in the mind of mathematicians who're working on one particular sort of thing for some years. Apart from teaching calculus, there's scant need to remember much else. Yes, from the viewpoint of scholarship, this is potentially distressing, but, in fact, in nearly all professional mathematics situations, there's scant motivation/reward for genuine scholarship. It somehow does not fit into salary-increase formulas, tenure, or much else. (Not that I myself care whether I try to understand things "for pay", or not...)
True, most graduate programs in the U.S. in mathematics do attempt to engender some minimal competency/appreciation for a big part of basic mathematics, but after "passing qualifiers" it seems that the vast majority of people do not find much interest in further pursuing broad scholarship, either in principle or for possible direct benefits.
Also, I take issue with the (what I think is) simplistic picture that "specialization" is like "zooming in with a microscope", and so on. Sure, this is a defensible world-view, and subject-wise world-view, and, sure, by one's actions one can make it be an accurate description... but I think it is not accurate of the reality. Specifically, I do not see the genuine ideas as being nearly so "localized" as a "physical zoom-microscope" would be relevant-to. That is, the idea that "math" can in any reasonable way be depicted as a physical thing, entailing all the local-ness that that implies, I think is wildly inaccurate. Again, yes, we can make it be accurate, if nothing else by ignorance or ignorant-fiat. But...

A: Your question is philosophical rather than mathematical.
A colleague of mine told me the following metaphor / illustration once when I was a bachelor student and he did his PhD. And since now some years have passed I can relate.
It is hard to write it. Think about drawing a huge circle in the air, zooming in, and then drawing a huge circle again.
This is all knowledge:
[--------------------------------------------]

All knowledge contains a lot, and math is only a tiny part in it - marked with the cross:
[---------------------------------------x----]
                                        |
Zooming in:
[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx]

Mathematical research is divided into many topics. Algebra, number theory, and many others, but also numerical mathematics. That is this tiny part here:
[xxxxxxxxxxxxxxxxxxxoxxxxxxxxxxxxxxxxxxxxxxxx]
                    |
Zooming in:
[oooooooooooooooooooooooooooooooooooooooooooo]

Numerical Math is divided into several topics as well, like ODE numerics, optimisation etc. And one of them is FEM-Theory for PDEs.
[oooooooooooooooooooρoooooooooooooooooooooooo]
                    |

And that is the part of knowledge, where I feel comfortable saying "I know a bit more than most other people in the world".
Now after some years, I would extend that illustration one more step: My knowledge in that part rather looks like
[   ρ    ρρ  ρ         ρ   ρ          ρ     ρ]

I still only know "a bit" about it, most of it I don't know, and most of what I had learned is already forgotten.
(Actually FEM-Theory is still a huge topic, that contains e.g. different kinds of PDEs [elliptic, parabolic, hyperbolic, other]. So you could do the "zooming" several times more.)

Another small wisdom is:
Someone who finished school thinks he knows everything. Once he gained his masters degree, he knows that he knows nothing. And after the PhD he knows that  everyone around him knows nothing as well.

Asking about your focus: IMO use the first few years to explore topics in math to find out what you like. Then go deeper - if you found what you like.
Are there "must know" topics? There are basics that you learn in the first few terms. Without them it is hard to "speak" and "do" math. You will learn the tools that you need to dig deeper. After that feel free to enjoy math :)
If your research focus is for example on PDE numerics (as mine is) but you also like pure math - go ahead and take a lecture. Will it help you? Maybe, maybe not. But for sure you had fun gaining knowledge, and that is what counts.
Don't think too much about what lectures to attend. Everything will turn out all right. I think most mathematicians will agree with that statement.

A: The question of how many mathematics topics an average mathematician knows, heavily depends on two definitions:

*

*Topic

*Know

Of course it also depends on other definitions (like mathematician) but to a lesser extent.
Quantitive approach to answer this question
Let us define levels of topics in the as follows, loosly based on wikipedia:

*

*Mathematics (1 topic on this level)

*Pure mathematics/ Applied mathematics (2 topics on this level)

*Algebra, ..., Operations research (13 topics on this level)

*Abstract algebra, Boolean algebra, ... (??? topics on this level)

Now, based on personal experience and an image of the average mathematician, I can answer how much such a mathematician would know about this, for each level:

*

*Can pass a graduate course on this topic

*Can pass a graduate course on these topics

*Can pass a graduate course on some of these topics, can pass an introductory course on most of these topics

*Can pass a graduate course on a few of these topics (perhaps 5~15%)

Note that if you move beyond level 4, you get so specific that you may not find complete graduate courses on such a topic. Hence my conclusion:
Based on personal experience, I expect an average mathematician to have decent knowledge of between 5% and 15% of topics on the graduate course level

A: Pauli is said to have suffered from uks....ubiquitous knowledge syndrome.  Because he knew too much. He said that there was no more physics problems for him to solve,because he already knew too much. However, Poincare and Hilbert were the only 2 mathematicians who had surveyed nearly all of mathematics!

A: Certainly not. For example, the great mathematician Grothendieck was insufficiently well acquainted with arithmetic to recognize the integer $57$ as a non-prime. The many accounts of this story can be accessed by an internet search for the key terms; say, look for grothendieck prime 57.
An earlier example is given by Ian Stewart on page 72 of his book Professor Stewart's Cabinet of Mathematical Curiosities, which I quote verbatim without any endorsement as to the degree of its truth:
Ernst Kummer was a German Algebraist, who did some of the best work on Fermat's Last Theorem before the modern era. However, he was poor at arithmetic, so he always asked his students to do the calculations for him. On one occasion he needed to work out $9\times7$. "Umm ... nine times seven is ... nine times ... seven ... is ..."
$\qquad$"Sixty-one," suggested one student. Kummer wrote this on the blackboard.
$\qquad$"No, Professor! It should be sixty-seven!" said another.
$\qquad$"Come, come, gentlemen," said Kummer. "It can't be both. It must be one or the other."


text:
Q: A nested array schema with object element returns an array with empty object I want to have array of objects i.e teamMembers should be an array and should have object as its element with properties name and role.I do not receive any error, when I console.log(req.body), its in the format i want, but the the array element which is object is not be posted to the schema.
  _id: mongoose.Schema.Types.ObjectId,
  teamName: { type: String, unique: true },
  teamMembers: {
    name: {
      type: String, unique: true, lowercase: true, required: true
    },
    role: {
      type: String,
      enum: ['goal keeper', 'central back', 'central midfield', 'central forward', 'left wing',
        'attacking midfield', 'central forward', 'left midfielder', 'striker', 'defending', 'right midfielder'],
      required: true
    },
    type: Array
  },
  description: String,
  createdAt: { type: Date, default: Date.now() },
  updatedAt: { type: Date, default: Date.now() }
});

teamSchema.plugin(uniqueValidator); ```

I am not getting the desired result. Here is my collection from mogodb

{
"_id":{"$oid":"5d89d5da3f33f36579bfed25"},
"teamMembers":[{}],
"createdAt":{"$date":{"$numberLong":"1569314251247"}},
"updatedAt":{"$date":{"$numberLong":"1569314251247"}},
"teamName":"Arsenal",
"__v":{"$numberInt":"0"}
}

Expected result
``` "teamMembers":[{"name": "bernd leno", "role": "goal keeper"}] ```

Gotten result ``` "teamMembers":[{}] ```

Here is my below

```static async addTeam(req, res) {
    const {
      teamName, teamMembers, description
    } = req.body;
    try {
      if (!req.user.isAdmin) {
        return response(res, 404, 'error', {
          message: messages.unAuthorizedRoute
        });
      }
      const teams = new TeamModel({
        _id: new mongoose.Types.ObjectId(),
        teamName,
        teamMembers,
        description
      });
      const team = await teams.save();
      if (team) {
        return response(res, 201, 'success', { team });
      }
    } catch (error) {
      (error.errors.teamName.name === 'ValidatorError')
        ? response(res, 409, 'error', {
          message: messages.duplicateName
        })
        : response(res, 400, 'error', {
          message: messages.error
        });
    }
  }```

A: My code is correct, I wasn't posting the array of objects correctly from postman.Right way to post an array of objects in postman using urlencoded
It also works with raw json/urlencoded
{
    "teamName": "Arsenal",
    "teamMembers": [{"name": "bernd leno", "role":"goal keeper"}, {"name": "Emiliano Martinez", "role":"goal keeper"}]
}


text:
Q: Please convert this cursor into CTE I am fetching the Objectid from the Table with Cursor.
I need the same using CTE or any other way.
DECLARE  @TagID int,@ObjectID int,@ObjectTypeID int ,@UserAccountID int

DECLARE curs CURSOR FOR
  SELECT distinct TagID,ObjectID,ObjectTypeID,UserAccountID  FROM   taglink  WHERE  TagID in(1000528,1000482)
    AND ObjectTypeID =5  and UserAccountID=1036144
OPEN curs
FETCH next FROM curs INTO @TagID, @ObjectId, @ObjectTypeID, @UserAccountID
CREATE TABLE #tagids  (TaglinkId INT,     TagId     INT ,ModifiedDate datetime )
WHILE @@FETCH_STATUS = 0
  BEGIN

      INSERT INTO #tagids(TaglinkId,TagId,ModifiedDate)
      SELECT TaglinkId,TagId,ModifiedDate      FROM   taglink      WHERE  UserAccountID = @UserAccountID   AND ObjectTypeID = @ObjectTypeID AND ObjectId = @ObjectId
            and TagID not in (1000528,1000483,1000482)
         and    TagID not in (select  TagId from #tagids)
            order by ModifiedDate desc

      FETCH next FROM curs INTO @TagID, @ObjectId, @ObjectTypeID, @UserAccountID
  END
SELECT * FROM   #tagids ORDER BY ModifiedDate DESC
DROP TABLE #tagids

CLOSE curs
DEALLOCATE curs

A: You can eliminate the cursor by using JOIN. Try this:
;WITH CTE AS(
    SELECT DISTINCT
        TagId,
        ObjectID,
        ObjectTypeID,
        UserAccountID
    FROM taglink
    WHERE
        TagID IN(1000528,1000482)
        AND ObjectTypeID = 5
        AND UserAccountID = 1036144
)
INSERT INTO #tagids(TagLinkId, TagId, ModifiedDate)
SELECT
    tl.TagLinkId,
    tl.TagId,
    tl.ModifiedDate
FROM tagLink tl
INNER JOIN CTE c
    ON c.UserAccountID = tl.UserAccountID
    AND c.ObjectTypeID = tl.ObjectTypeID
    AND c.ObjectID = tl.ObjectID
WHERE
    tl.TagID NOT IN(1000528,1000483,1000482)
    AND NOT EXISTS(
        SELECT TagId FROM #tagids WHERE TagId = tl.TagId
    )
ORDER BY tl.ModifiedDate DESC


text:
Q: NSTimer doesn't work on swift I wrote this code to use a Timer inside of a View Controller:
var timer:NSTimer!
override func viewDidLoad() {
    super.viewDidLoad()
    timer = NSTimer(timeInterval: 2, target: self, selector: "goTakingPhoto", userInfo: nil, repeats: false)
    timer.fire()
    // Do any additional setup after loading the view.
}
 func goTakingPhoto(){
   // doSomething
}

But the function goTakingPhoto is invoked immediately, not after 2 seconds.
Can anyone help me? Many thanks.

A: Try this:
override func viewDidLoad() {
    super.viewDidLoad()
    var timer = NSTimer.scheduledTimerWithTimeInterval(2, target: self, selector: Selector("goTakingPhoto"), userInfo: nil, repeats: false)}
}

func goTakingPhoto() {
   // doSomething
}

A: I found it works with NSTimer.scheduledWithTimeInterval(...). And you don't have to add timer.fire() otherwise the func will be invoked imediately
Reference here


text:
Q: Valgrind: INVALID READ OF SIZE 1 in constructor I am getting an invalid read of size 1 in the following function:
ubigint.cpp
ubigint::ubigint (unsigned long that){
   //DEBUGF ('~', this << " -> " << uvalue)
   ostringstream convert;  // stream for converting numbers to strings
   convert << that;  // output the number to the stream

    for(string::reverse_iterator rit = convert.str().rbegin(); rit != convert.str().rend(); rit++) // iterate through the string
    {
        ubig_value.push_back(*rit); // push the character
    }
    size_t current_size = ubig_value.size();
    while(current_size != 0 && ubig_value.back() == '0')
    {
        ubig_value.pop_back();
        current_size--;
    }

}

ubigint.h
// $Id: ubigint.h,v 1.11 2016-03-24 19:43:57-07 - - $

#ifndef __UBIGINT_H__
#define __UBIGINT_H__

#include <exception>
#include <iostream>
#include <limits>
#include <utility>
using namespace std;

#include "debug.h"
#include "relops.h"

    class ubigint {
       friend ostream& operator<< (ostream&, const ubigint&);
       private:
          /*using unumber = unsigned long;
          unumber uvalue {};
          */
          using udigit_t = unsigned char;
          using ubigvalue_t = vector<udigit_t>;
          ubigvalue_t ubig_value;

       public:
          void multiply_by_2();
          void divide_by_2();

          ubigint() = default; // Need default ctor as well.
          ubigint (unsigned long);
          ubigint (const string&);

          ubigint operator+ (const ubigint&) const;
          ubigint operator- (const ubigint&) const;
          ubigint operator* (const ubigint&) const;
          ubigint operator/ (const ubigint&)const;
          ubigint operator% (const ubigint&) const;

          bool operator== (const ubigint&) const;
          bool operator<  (const ubigint&) const;

          //helper functions
          string vectorToString(ubigvalue_t& myVector)const;
    };

    #endif

Error Message:
==4025== Invalid read of size 1
==4025==    at 0x40309C: ubigint::ubigint(unsigned long) (ubigint.cpp:23)
==4025==    by 0x40412F: udivide(ubigint const&, ubigint) (ubigint.cpp:260)
==4025==    by 0x404418: ubigint::operator/(ubigint const&) const (ubigint.cpp:285)
==4025==    by 0x40709D: bigint::operator/(bigint const&) const (bigint.cpp:89)
==4025==    by 0x40CCEB: do_arith(iterstack<bigint>&, char) (main.cpp:35)
==4025==    by 0x40D58F: main (main.cpp:143)

I didn't put the other functions because I think that the cause of the problem is the constructor. I noticed that I was comparing ubig_value.back() against the integer 0. I changed it to char and that still didn't solve the problem. What is wrong with the constructor?. Line 23 is ubig_value.pop_back();. When I run the program without using valgrind, it runs properly.

A: convert.str() returns a temporary string instance, by value. Two calls to convert.str() produce different instances of string, so convert.str().rbegin() and convert.str().rend() do not form a valid range - they are iterators into different containers.
Moreover, rit is a dangling iterator - the string it points into, being a temporary, is gone by the time the iterator is used.
Therefore, your function exhibits undefined behavior.


text:
Q: Buttons in a ListView row with two layouts and one activity I want to add two buttons in each row of a listview. While using only one Activity means that in my code i have one MainActivity.java and its layout (activity_main.xml) and an additional layout (list_item.xml) which have items in each row (Textviews) but when i add two buttons in a list_item.xml and initialize in MainActivity and add listners on it it shows me an exception which is shared below.Help me to solve my problem, Any sort of help will be highly appreciated.
MainActivity.java
public class MainActivity extends ActionBarActivity
{

String myJSON ;
String id;
private static final String TAG_RESULTS="result";
private static final String TAG_ID = "id";
private static final String TAG_NAME = "name";
private static final String TAG_ADD ="address";

JSONArray peoples = null;

ArrayList <HashMap <String, String> > personList;

ListView list;
TextView quant;
int count=0;
Button b_plus,b_minus;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    list = (ListView) findViewById(R.id.listView);
    personList = new ArrayList<HashMap<String,String>>();
    quant=(TextView)findViewById(R.id.quantity);

    b_plus=(Button)findViewById(R.id.ib_plus);
    b_minus=(Button)findViewById(R.id.ib_minus);

    b_plus.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            count++;
            quant.setText(Integer.toString(count));
        }
    });
    b_minus.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            count--;
            quant.setText(Integer.toString(count));
        }
    });

    getData();

}

protected void showList(){
    try {
        JSONObject jsonObj = new JSONObject(myJSON);
        peoples = jsonObj.getJSONArray(TAG_RESULTS);

        for(int i=0;i<peoples.length();i++){
            JSONObject c = peoples.getJSONObject(i);
            id = c.getString(TAG_ID);
            String name = c.getString(TAG_NAME);
            String address = c.getString(TAG_ADD);

            HashMap<String,String> persons = new HashMap<String,String>();

            persons.put(TAG_ID,id);
            persons.put(TAG_NAME,name);
            persons.put(TAG_ADD,address);

            personList.add(persons);
        }

        final ListAdapter adapter = new SimpleAdapter
                (
                MainActivity.this, personList, R.layout.list_item,
                new String[]{TAG_ID,TAG_NAME,TAG_ADD},
                new int[]{R.id.id, R.id.name, R.id.address}

                );

        list.setAdapter(adapter);
       list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
           @Override
           public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
               switch(i)
               {
               case 0 :
               Intent appInfo = new Intent(MainActivity.this, MainActivity2.class);
               startActivity(appInfo);
               break;
               case 1 :
               Intent ap = new Intent(MainActivity.this, MainActivity3.class);
               startActivity(ap);
               break;
               case 2 :
               Intent Info = new Intent(MainActivity.this, MainActivity2.class);
               startActivity(Info);
               break;
           }}
       });
    } catch (JSONException e) {
        e.printStackTrace();
    }

}

public void getData(){
    class GetDataJSON extends AsyncTask<String, Void, String>{

        @Override
        protected String doInBackground(String... params) {
            DefaultHttpClient httpclient = new DefaultHttpClient(new BasicHttpParams());
            HttpPost httppost = new HttpPost("http://10.0.2.2/in.php");

            // Depends on your web service
            httppost.setHeader("Content-type", "application/json");

            InputStream inputStream = null;
            String result = null;
            try {
                HttpResponse response = httpclient.execute(httppost);
                HttpEntity entity = response.getEntity();

                inputStream = entity.getContent();
                // json is UTF-8 by default
                BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"), 8);
                StringBuilder sb = new StringBuilder();

                String line = null;
                while ((line = reader.readLine()) != null)
                {
                    sb.append(line + "\n");
                }
                result = sb.toString();
            } catch (Exception e) {
                // Oops
            }
            finally {
                try{if(inputStream != null)inputStream.close();}catch(Exception squish){}
            }

            return result;

        }

        @Override
        protected void onPostExecute(String result){
            myJSON=result;
            showList();
        }
    }
    GetDataJSON g = new GetDataJSON();
    g.execute();
} }

activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"        android:layout_width="match_parent"
 android:layout_height="match_parent"     android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
   android:orientation="vertical"
android:background="#ff3c3f41"
android:paddingBottom="@dimen/activity_vertical_margin"   tools:context=".MainActivity">

<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/listView"
/>

</LinearLayout>

list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp" >

<TextView
    android:id="@+id/id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="2dip"
    android:paddingTop="6dip"
    android:textColor="#fff9f9f9"
    android:textStyle="bold" />

<TextView
    android:id="@+id/name"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="2dip"
    android:textColor="#fff9f9f9"
    android:textStyle="bold"/>

<TextView
    android:id="@+id/address"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="left"

    android:textColor="#fff9f9f9"
    android:textStyle="bold" />
    <TextView
    android:id="@+id/quantity"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="left"

    android:textColor="#fff9f9f9"
    android:textStyle="bold" />

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="166dp"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="10dp"
    android:paddingLeft="10dp"
    android:paddingRight="10dp" >

    <ImageButton
        android:layout_width="58dp"
        android:layout_height="52dp"
        android:src="@drawable/plus"
        android:layout_gravity="start"
        android:id="@+id/ib_plus" />

    <ImageButton
        android:layout_width="58dp"
        android:layout_height="52dp"
        android:src="@drawable/minus"
        android:id="@+id/ib_minus"
        android:layout_gravity="center_horizontal"
        android:layout_alignBottom="@+id/ib_plus"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_alignTop="@+id/ib_plus" />

</RelativeLayout>

logcat:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
        at com.example.abdul.zx.MainActivity.onCreate(MainActivity.java:62)

A: Your buttons are not defined in R.layout.activity_main so findViewById will return null since they are not there.
quant is also null, by the way, for the same reason.
You must define your buttons in your SimpleAdapter class because they are in the list_item.xml. (Assuming SimpleAdapter inflates list_item.xml)

A: You need to inflate the list_item layout first as a view. Then, you need to initialize your ImageButtons by view.findViewById(). Now, you are trying to use the ImageButton's of a layout other than what you have set in onCreate. Or another approach would be to set onClick methods inside the adapter.

A: The problem is that list_item.xml is inflated for each row of data in your ListView. At the point in onCreate() where you try to get the button views, they have not yet been created. In order to set listeners to each button, you need to create a custom adapter class. You will then set the listeners in the getView() method.

A: You'll have to make your adapter more complicated, because there is not one but many buttons and text fields. Pseudo code like solution below. Replace the line where you create your adapter with something like this:
final ListAdapter adapter = new SimpleAdapter
            (MainActivity.this, personList, R.layout.list_item,
            new String[]{TAG_ID,TAG_NAME,TAG_ADD},
            new int[]{R.id.id, R.id.name, R.id.address}) {

         public View getView(int position, View convertView, ViewGroup parent) {
             View view = super.getView(position, convertView, parent);

             final TextView quant=(TextView)view.findViewById(R.id.quantity);
             final ImageButton b_plus=(ImageButton)view.findViewById(R.id.ib_plus);
             final ImageButton b_minus=(ImageButton)view.findViewById(R.id.ib_minus);

             b_plus.setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View view) {
                     count++;
                     quant.setText(Integer.toString(count));
                 }
             });
             b_minus.setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View view) {
                     count--;
                     quant.setText(Integer.toString(count));
                 }
             });

             return view;
         }
     };

Remove everything related to quant, b_minus, b_plus from other places in your activity

A: I believe that you might be doing these steps in the wrong place:
quant=(TextView)findViewById(R.id.quantity);
b_plus=(Button)findViewById(R.id.ib_plus);
b_minus=(Button)findViewById(R.id.ib_minus);

I think what's happening is that the code is searching for them in activity_main.xml but because they're not there, they end up being null. Hence, the exception you're seeing.
Since the TextView and the Buttons are related to each ListView item, then that's where the initialization should go. I see you're using a SimpleAdaptor which I am not familiar with. But if you create your custom adaptor for ListView, then you can initialize the TextView and the Buttons in the getView() of the Adaptor kind of like this: Custom Adapter for List View.
You can set the button listeners there as well which will provide you with the position of the ListItem where a certain button was clicked.


text:
Q: Shorter REGEXP for MySQL query I want to do a MySQL query to get the following effect:
table_column [varchar]
-----------------------
   1|5|7
      25
   55|12
       5
     3&5
    5|11

I want a reliable way to get all the values where 5 is the complete value.
So, for example, if I do a REGEXP query for the number 5 on the upper table I would like to get all rows except the ones containing "25" and "55|12".
This is the best I've come up with so far:
[^[:digit:]]5[^[:digit:]] | [^[:digit:]]5 | 5[^[:digit:]] | ^5$

is there a shorter way?
Thanks.

A: Try using word boundaries:
[[:<:]]5[[:>:]]

A: ^.*[^[:digit:]]*5[^[:digit:]]*.*$


text:
Q: Printing a text file using pthread and signals I have the following code
typedef struct
{
    char word[64];
} DataStructure;

sigset_t set;
FILE *pFile;

static void *print(void *ptr)
{
    char *message;
    message = (char *)ptr;
    int sig;

    while(!feof(pFile))
    {
        sigwait(&set, &sig);
        printf("%s \n", message);
        sleep(2);
    }
    return 0;
}

int main(int argc, char *argv[])
{
    DataStructure Data;

    sigemptyset(&set);
    sigaddset(&set, SIGUSR1);
    pthread_sigmask(SIG_BLOCK, &set, NULL);

    pthread_t thread;
    pthread_create(&thread, NULL, print, (void *)Data.word);

    pFile = fopen("rhyme1.txt", "r");

    while(!feof(pFile))
    {
        fscanf(pFile, "%s", Data.word);
        pthread_kill(thread, SIGUSR1);
    }

    pthread_join(thread, NULL);
    pthread_exit(NULL);
}

/*The output should look like:
Hickory,
dickory,
dock,
The
mouse
ran
up
the
clock.

This code results in:
clock. */

I am trying to open a text file and read in each word on the line using scanf. The word is then sent to the 'print' method (via parameter of pthread_create) and prints the word which was read in, when a signal is sent (via pthread_kill). The process repeats until the file has been completely read in and printed.

A: Exactly what Duck suggested.
What you could do is use one thread for reading and one for printing, where each signal eachother in order to stay synced:
static void *print(void *ptr)
{
    char *message = (char *)ptr;
    int sig;

    while(!feof(pFile))
    {
        sigwait(&set, &sig);
        printf("%s\n", message);
        pthread_kill(thread2, SIGUSR1);
    }

    return 0;
}
static void *readstr(void *ptr)
{
    char *message = (char *)ptr;
    int sig;

    while(!feof(pFile))
    {
        fscanf(pFile, "%s", message);
        pthread_kill(thread1, SIGUSR1);
        sigwait(&set, &sig);
    }

    return 0;
}

A: It results in "clock" because you are passing a pointer to Data.word that is going to overridden multiple times before the loop in the thread ever runs.  "Clock" just happens to the last thing that is at that memory location.
while(!feof(pFile))
{
    fscanf(pFile, "%s", Data.word);
    pthread_kill(thread, SIGUSR1);
}

Above is going to flip through the file quickly, possibly before the thread ever executes and certainly before the 2 second sleep ends.
while(!feof(pFile))
{
    sigwait(&set, &sig);
    printf("%s \n", message);
    sleep(2);
}

You could potentially get a different result on subsequent runs but I doubt you will ever what you expect.  The signal is not going to be queued.


text:
Q: NetSuite List of File Types with Alpha & numeric IDs Does anyone have a list of NetSuite File Type IDs, both the alpha id, and the numeric id.
Need to expand on the following list
var filetype = {
    10 : 'PLAINTEXT',
    12 : 'XMLDOC',
    14 : 'CSV',
    17 : 'PDF',
    38 : 'JSONFILE',
};

The requirement is to get a custom preference of list type "File Type", which returns the numeric ID.
Then pass that to filetype[numeric_id] to return the actual alpha ID.

A: AutoCad = 34
BMP Image = 6
Compressed Tar File = 37
CFF File = 46
Configuration File = 39
CSV File = 14
EOT File = 47
CSS File = 11
Excel File = 22
Flash Animation = 1
FreeMarker Template File = 41
GIF Image = 4
GNU Zip File = 27
HTML File = 9
Icon Image = 8
Image = 31
JavaScript File = 13
JPEG Image = 2
JSON Response = 38
LZH File = 49
Message RFC = 35
MP3 Audio = 30
MPEG Video = 29
OTF File = 45
Other Binary File = 32
PDF File = 17
PJPEG Image = 3
Plain Text File = 10
PNG Image = 5
PostScript File = 21
PowerPoint File = 23
Project File = 25
QuickTime Video = 28
RTF File = 20
SMS File = 18
SuiteScript File = 16
SuiteScript Page = 15
SVG Image = 48
Tar File = 36
Text File = 33
TIFF Image = 7
TTF File = 44
Visio File = 24
WOFF File = 42
WOFF2 File = 43
Word File = 19
XML File = 12
XSD File = 40
Zip File = 26

I believe these should be all of the file types in Netsuite. For further reference, you can look into SuiteAnswers 67814 and 10496. (Requires NS login)

A: For those who want a useful object constant for the common file types:
const FILETYPES = {
'AUTOCAD' : {typeid : 'AUTOCAD', name : 'AutoCad', extension : '.dwg', contentType : 'application/x-autocad', internalid : 34},
'BMPIMAGE' : {typeid : 'BMPIMAGE', name : 'BMP Image', extension : '.bmp', contentType : 'image/x-xbitmap', internalid : 6},
'CSV' : {typeid : 'CSV', name : 'CSV File', extension : '.csv', contentType : 'text/csv', internalid : 14},
'EXCEL' : {typeid : 'EXCEL', name : 'Excel File', extension : '.xls', contentType : 'application/vnd.ms-excel', internalid : 22},
'FLASH' : {typeid : 'FLASH', name : 'Flash Animation', extension : '.swf', contentType : 'application/x-shockwave-flash', internalid : 1},
'GIFIMAGE' : {typeid : 'GIFIMAGE', name : 'GIF Image', extension : '.gif', contentType : 'image/gif', internalid : 4},
'GZIP' : {typeid : 'GZIP', name : 'GNU Zip File', extension : '.gz', contentType : 'application/x-gzip-compressed', internalid : 27},
'HTMLDOC' : {typeid : 'HTMLDOC', name : 'HTML File', extension : '.htm', contentType : 'text/html', internalid : 9},
'ICON' : {typeid : 'ICON', name : 'Icon Image', extension : '.ico', contentType : 'image/ico', internalid : 8},
'JAVASCRIPT' : {typeid : 'JAVASCRIPT', name : 'JavaScript File', extension : '.js', contentType : 'text/javascript', internalid : 13},
'JPGIMAGE' : {typeid : 'JPGIMAGE', name : 'JPEG Image', extension : '.jpg', contentType : 'image/jpeg', internalid : 2},
'JSON' : {typeid : 'JSON', name : 'JSON File', extension : '.json', contentType : 'application/json', internalid : 38},
'MESSAGERFC' : {typeid : 'MESSAGERFC', name : 'Message RFC', extension : '.eml', contentType : 'message/rfc822', internalid : 35},
'MP3' : {typeid : 'MP3', name : 'MP3 Audio', extension : '.mp3', contentType : 'audio/mpeg', internalid : 30},
'MPEGMOVIE' : {typeid : 'MPEGMOVIE', name : 'MPEG Video', extension : '.mpg', contentType : 'video/mpeg', internalid : 29},
'MSPROJECT' : {typeid : 'MSPROJECT', name : 'Project File', extension : '.mpp', contentType : 'application/vnd.ms-project', internalid : 25},
'PDF' : {typeid : 'PDF', name : 'PDF File', extension : '.pdf', contentType : 'application/pdf', internalid : 17},
'PJPGIMAGE' : {typeid : 'PJPGIMAGE', name : 'PJPEG Image', extension : '.pjpeg', contentType : 'image/pjpeg', internalid : 3},
'PLAINTEXT' : {typeid : 'PLAINTEXT', name : 'Plain Text File', extension : '.txt', contentType : 'text/plain', internalid : 10},
'PNGIMAGE' : {typeid : 'PNGIMAGE', name : 'PNG Image', extension : '.png', contentType : 'image/x-png', internalid : 5},
'POSTSCRIPT' : {typeid : 'POSTSCRIPT', name : 'PostScript File', extension : '.ps', contentType : 'application/postscript', internalid : 21},
'POWERPOINT' : {typeid : 'POWERPOINT', name : 'PowerPoint File', extension : '.ppt', contentType : 'application/vnd.ms-powerpoint', internalid : 23},
'QUICKTIME' : {typeid : 'QUICKTIME', name : 'QuickTime Video', extension : '.mov', contentType : 'video/quicktime', internalid : 28},
'RTF' : {typeid : 'RTF', name : 'RTF File', extension : '.rtf', contentType : 'application/rtf', internalid : 20},
'SMS' : {typeid : 'SMS', name : 'SMS File', extension : '.sms', contentType : 'application/sms', internalid : 18},
'STYLESHEET' : {typeid : 'STYLESHEET', name : 'CSS File', extension : '.css', contentType : 'text/css', internalid : 11},
'TIFFIMAGE' : {typeid : 'TIFFIMAGE', name : 'TIFF Image', extension : '.tiff', contentType : 'image/tiff', internalid : 7},
'VISIO' : {typeid : 'VISIO', name : 'Visio File', extension : '.vsd', contentType : 'application/vnd.visio', internalid : 24},
'WORD' : {typeid : 'WORD', name : 'Word File', extension : '.doc', contentType : 'application/msword', internalid : 19},
'XMLDOC' : {typeid : 'XMLDOC', name : 'XML File', extension : '.xml', contentType : 'text/xml', internalid : 12},
'ZIP' : {typeid : 'ZIP', name : 'Zip File', extension : '.zip', contentType : 'application/zip', internalid : 26},
'AutoCad' : {typeid : 'AUTOCAD', name : 'AutoCad', extension : '.dwg', contentType : 'application/x-autocad', internalid : 34},
'BMP Image' : {typeid : 'BMPIMAGE', name : 'BMP Image', extension : '.bmp', contentType : 'image/x-xbitmap', internalid : 6},
'CSV File' : {typeid : 'CSV', name : 'CSV File', extension : '.csv', contentType : 'text/csv', internalid : 14},
'Excel File' : {typeid : 'EXCEL', name : 'Excel File', extension : '.xls', contentType : 'application/vnd.ms-excel', internalid : 22},
'Flash Animation' : {typeid : 'FLASH', name : 'Flash Animation', extension : '.swf', contentType : 'application/x-shockwave-flash', internalid : 1},
'GIF Image' : {typeid : 'GIFIMAGE', name : 'GIF Image', extension : '.gif', contentType : 'image/gif', internalid : 4},
'GNU Zip File' : {typeid : 'GZIP', name : 'GNU Zip File', extension : '.gz', contentType : 'application/x-gzip-compressed', internalid : 27},
'HTML File' : {typeid : 'HTMLDOC', name : 'HTML File', extension : '.htm', contentType : 'text/html', internalid : 9},
'Icon Image' : {typeid : 'ICON', name : 'Icon Image', extension : '.ico', contentType : 'image/ico', internalid : 8},
'JavaScript File' : {typeid : 'JAVASCRIPT', name : 'JavaScript File', extension : '.js', contentType : 'text/javascript', internalid : 13},
'JPEG Image' : {typeid : 'JPGIMAGE', name : 'JPEG Image', extension : '.jpg', contentType : 'image/jpeg', internalid : 2},
'JSON File' : {typeid : 'JSON', name : 'JSON File', extension : '.json', contentType : 'application/json', internalid : 38},
'Message RFC' : {typeid : 'MESSAGERFC', name : 'Message RFC', extension : '.eml', contentType : 'message/rfc822', internalid : 35},
'MP3 Audio' : {typeid : 'MP3', name : 'MP3 Audio', extension : '.mp3', contentType : 'audio/mpeg', internalid : 30},
'MPEG Video' : {typeid : 'MPEGMOVIE', name : 'MPEG Video', extension : '.mpg', contentType : 'video/mpeg', internalid : 29},
'Project File' : {typeid : 'MSPROJECT', name : 'Project File', extension : '.mpp', contentType : 'application/vnd.ms-project', internalid : 25},
'PDF File' : {typeid : 'PDF', name : 'PDF File', extension : '.pdf', contentType : 'application/pdf', internalid : 17},
'PJPEG Image' : {typeid : 'PJPGIMAGE', name : 'PJPEG Image', extension : '.pjpeg', contentType : 'image/pjpeg', internalid : 3},
'Plain Text File' : {typeid : 'PLAINTEXT', name : 'Plain Text File', extension : '.txt', contentType : 'text/plain', internalid : 10},
'PNG Image' : {typeid : 'PNGIMAGE', name : 'PNG Image', extension : '.png', contentType : 'image/x-png', internalid : 5},
'PostScript File' : {typeid : 'POSTSCRIPT', name : 'PostScript File', extension : '.ps', contentType : 'application/postscript', internalid : 21},
'PowerPoint File' : {typeid : 'POWERPOINT', name : 'PowerPoint File', extension : '.ppt', contentType : 'application/vnd.ms-powerpoint', internalid : 23},
'QuickTime Video' : {typeid : 'QUICKTIME', name : 'QuickTime Video', extension : '.mov', contentType : 'video/quicktime', internalid : 28},
'RTF File' : {typeid : 'RTF', name : 'RTF File', extension : '.rtf', contentType : 'application/rtf', internalid : 20},
'SMS File' : {typeid : 'SMS', name : 'SMS File', extension : '.sms', contentType : 'application/sms', internalid : 18},
'CSS File' : {typeid : 'STYLESHEET', name : 'CSS File', extension : '.css', contentType : 'text/css', internalid : 11},
'TIFF Image' : {typeid : 'TIFFIMAGE', name : 'TIFF Image', extension : '.tiff', contentType : 'image/tiff', internalid : 7},
'Visio File' : {typeid : 'VISIO', name : 'Visio File', extension : '.vsd', contentType : 'application/vnd.visio', internalid : 24},
'Word File' : {typeid : 'WORD', name : 'Word File', extension : '.doc', contentType : 'application/msword', internalid : 19},
'XML File' : {typeid : 'XMLDOC', name : 'XML File', extension : '.xml', contentType : 'text/xml', internalid : 12},
'Zip File' : {typeid : 'ZIP', name : 'Zip File', extension : '.zip', contentType : 'application/zip', internalid : 26},

}


text:
Q: C Negation Operator Prints Unexpected Results In Debian Terminal This is purely academic but I've created a simple truth table in C:
#include <stdio.h>

int main() {
  for(int j=0; j<=2; j++) {
    int bitB = (j&1);
    printf("~%d = %d\n", bitB, ~bitB);
  }
  return 0;
}

Running in terminal yields:
~1 = -2
~0 = -1

Debugging in gdb by setting a break on printf yields what I'd expect, however:
(gdb) print bitB
$5 = 1
(gdb) cont
Continuing.
~1 = -2
(gdb) x/xw &bitB
0xbffff3d8: 0x00000000

Why is the program output showing negative numbers?

A: This is a perfectly expected result, at least on systems where negative numbers are represented in two's complement system:

*

*Negative one is represented with all bits set to 1, and

*Negative two has all bits set to 1 except the last bit.

Hence, flipping all bits of zero yields -1, and flipping all bits of 1 yields -2:
0000000000000000 -> 1111111111111111 // Zero becomes negative 1
0000000000000001 -> 1111111111111110 // One becomes negative 2

Mathematically, to flip the sign of a number in two's complement representation you flip all bits of the number, and then add 1 to the result. Simply flipping all bits of x yields -x-1. This is precisely the result that you see.

Why is the program output showing negative numbers?

Because you use signed int with %d format specifier, and the bit patterns that you print happen to be representations of negative numbers.

A: On all systems and number representations this will give negative numbers. You are complementing all bits, including the sign bit.

A: Because you use the type int (containing its sign), and inverting the highest bit also changes the sign according to Two's complement rules (note that ~ inverts/complements all bits).
You probably want to use unsigned int (and %u), if you expect that ~ gives you the representation without sign.


text:
Q: Display different language text in  tag, depending on browser language I'm new to HTML, and I want to display a message when JavaScript is disabled. So I put the message inside <noscript> tag, which works fine.
<noscript> Need to enable Javascript. </noscript>

But I want to change this language to Chinese when the browser language is Chinese. I can't use JavaScript because this message only displays when JavaScript is disabled. Is there any way to solve this? Thank you!

A: When a browser makes an HTTP request, it sends an Accept-Language request HTTP header.
So, for example if you are using PHP, you could use the following to get this header value:
$_SERVER["HTTP_ACCEPT_LANGUAGE"]

or
$_SERVER["HTTP_ACCEPT_CHARSET"]

You can use this value to decide on the server-side which language is being used and insert the text in the correct language.

A: You can use Python in browser with Transcrypt
Download Python  from www.python.org
Install Transcrypt from the command prompt by typing python -m pip install transcrypt
Create a new folder hello containing hello.html and hello.py
Go to that new folder and type python -m transcrypt -b -m -n hello.py
In that same new folder start an HTTP server by typing python -m http.server
In your browser, navigate to localhost:8000/hello.html to see the result
print request.META['HTTP_ACCEPT_LANGUAGE']

A: that's quite easy if I'm getting what you actually want and assuming that you dont change the HTML file, do as below
const userLang = navigator.language || navigator.userLanguage; //1-this detects the browser language
//2-in my case i use en-US, change it to zh-sg or any other language iso for chinese
if(userLang === "en-US"){
//3-i used a nonScript class on <nonscript> tag to chnage the language
document.querySelector(".nonScript").textContent = "Change to chinese language";
}

you can use alert(userLang); to detect your browser language and use the iso u get for the if condition


text:
Q: Flowtype spread operator not working Here is a link to the FLOW bin with a working version that still doesn't seem to work. A function is getting an undefined param that should be passed in using the spread operator. The error I am talking about is #78 when you open the link.
--> Flow Bin
I cannot seem to make the spread operator work with Flow. Am I doing something wrong here? Im using the latest version of Webstorm and "flow-bin": "^0.48.0". Any help would be very appreciated! Thanks
type Actions = {
  authenticateUser: (formProps: RegisterUserProps) => Dispatch,
  errorMessage: string,
  handleSubmit: any,
  valid: boolean
}

type Props = {
  ...Actions
}

This code just makes my IDE think there is nothing being passed into Props - so I get errors for each of the types in Actions.

A: There's a thread here discussing the issue: https://github.com/facebook/flow/issues/3534
You can work around this temporarily by using
type Props = {
  ...$Exact<Actions>
}

or
type Actions = {|
  authenticateUser: (formProps: RegisterUserProps) => Dispatch,
  errorMessage: string,
  handleSubmit: any,
  valid: boolean
|}

A: Flow spreads will be supported in upcoming WebStorm 2017.2 - see WEB-26408


text:
Q: How to compute LST every 3rd day for 19 years (Earth Engine) I want to calculate LST for every 3rd day from 01-02-2000 to 31-12-1-2019, I don't Know how to do that.
Using MODIS/006/MOD11A1
var lst = lstImg.select('LST_Day_1km')
         .filter(ee.Filter.date('2000-01-01', '2019-12-31'))
         .map(function(image){return image.clip(table)})
        .sort('CLOUD COVERAGE',false)
         .filterBounds(table);
var lstVis = {
  min: 13000.0,
  max: 16500.0,
  palette: [
    '040274', '040281', '0502a3', '0502b8', '0502ce', '0502e6',
    '0602ff', '235cb1', '307ef3', '269db1', '30c8e2', '32d3ef',
    '3be285', '3ff38f', '86e26f', '3ae237', 'b5e22e', 'd6e21f',
    'fff705', 'ffd611', 'ffb613', 'ff8b13', 'ff6e08', 'ff500d',
    'ff0000', 'de0101', 'c21301', 'a71001', '911003'
  ],
};
//Map.setCenter(6.746, 46.529, 2);

Map.addLayer(lst,lstVis,'LST');

print(ui.Chart.image.series(lstt.select('LST_Day_1km'), table, ee.Reducer.mean(),30));

A: Something like the below? You need to decide how to combine multiple days of images into one, here I took the median value. You also have some 3-day intervals without any imagery that you need to filter out. This code relies on that median() returns a 0-band image when there are no images in the collection.
var table = ee.Geometry(Map.getBounds(true))
var startDate = ee.Date('2000-01-01')
var endDate = ee.Date('2020-01-01')

var lst = ee.ImageCollection('MODIS/006/MOD11A1')
  .select('LST_Day_1km')
  .filterBounds(table)

var days = endDate.difference(startDate, 'days')
var daysStep = 3
var timeSeries = ee.ImageCollection(
  ee.List.sequence(0, days.subtract(1), daysStep)
    .map(function (offsetDays) {
      var start = startDate.advance(offsetDays, 'days')
      var end = start.advance(daysStep, 'days')
      var composite = lst
        .filterDate(start, end)
        .median() // You need to decide how to combine the images
      return composite
        .set('system:time_start', start.millis())
        .set('empty', composite.bandNames().size().eq(0))
    })
  ).filterMetadata('empty', 'equals', 0)

https://code.earthengine.google.com/f75f7bcc1af63ce8e1b74872555168c9
You will probably run into trouble charting this by taking the mean at 30m scale.


text:
Q: Custom Gmail color theme I hate Gmail's new color themes. I am looking for a way to change it back to the older color theme. Does anyone know any GreaseMonkey script or Firefox addon to do this?

A: It looks like the answer now is "just wait".  The Gmail Themes help page says:

What happened to custom themes?
We're working on a way to bring back the ability to choose your own
  background.

A: Use Stylish with The Return of Old Gmail  userstyle to get back old Gmail interface in Firefox/Chrome. It is quite easy, just follow the instructions.


text:
Q: Single table version controled data So I have a table designed as such:
create_table "entries", :force => true do |t|
  t.integer  "id", :null => false, :autoincrement => true
  t.text     "text"
  t.string   "uuid"
  t.datetime "created_at", :null => false
end

I have a similar problem to " Database - data versioning in single table" except that I have multiple sources (some of which do work offline) writing into this database, so the current bit doesn't really work well for me.
What I'm wondering is what is the best way to get the most recent of each UUID.
In sqlite: SELECT "entries".* FROM "entries" GROUP BY uuid ORDER BY updated_at DESC works great, but it's not valid syntax in postgres, and it kind of feels janky. Is there a good way to do this, or do I need to redo my schema?

A: One way to get the results you're after is to use a window function and a derived table. ActiveRecord doesn't understand either of those but there's always find_by_sql:
Entry.find_by_sql(%q{
    select id, text, uuid, created_at
    from (
        select id, text, uuid, created_at,
               row_number() over (partition by uuid order by created_at desc) as r
        from entries
    ) as dt
    where r = 1
})

The interesting part is this:
row_number() over (partition by uuid order by created_at desc)

partition by uuid is similar to group by uuid but it doesn't collapse the rows, it just modifies how the row_number() window function behaves so that row_number() is computed with respect to rows with matching uuids; the order by created_at desc similarly applies only to the window that row_number() will be looking at. The result is that r = 1 peels off the first row in each group.


text:
Q: AWS Educate - Launch EC2 instance authorization issue I am working on my school project and seeing permission issues using AWS Educate for students.
I am unable to launch EC2 instance (Spot instance). Read through the documentation about changing roles and policies to grant permission but it says my user is unauthorized to. Neither is it permitting to create a role - No permissions to change anything in IAM.

Also, since it's student access AWS doesn't provide support to raise a Case Request with them. I understand this is a redundant question but I tried the solutions provided but in vain due to student access limitations. To ask administrator to add permissions it just redirects me to documentation.
Help much appreciated!

A: I am under the impression that spot instances are not available through AWS Educate. You would need to use a regular account which is what you did apparently.

A: The problem is this: The IAM user does not have permissions to do what you want. If you are the administrator, then you can assign (add) permissions to the user's attached policy. If you are not the administrator then you will need to contact that person for help.