text:
Q: Syncing two tables using Apache Camel I've just started using Apache Camel and I would like to try to synchronize two tables. Both tables have two columns, "id" and "name". The scenario would query the first table, check for existence of each record in the second table, and insert each record that doesn't exist. Here is my attempt:
<camel:camelContext id="test">
    <camel:route>
        <camel:from uri="timer://kickoff?period=5s"/>
        <camel:to uri="sql:select id, name from table1?dataSourceRef=dataSource"/>
        <camel:split>
            <camel:simple>body</camel:simple>
            <camel:to uri="sql:select * from table2 where id = #?dataSourceRef=dataSource" />
            <camel:choice>
                <camel:when>
                    <camel:simple>${header.CamelSqlRowCount} == 0</camel:simple>
                    <camel:to uri="sql:insert into table2 (id, name) values (#, #)?dataSourceRef=dataSource" />
                </camel:when>
            </camel:choice>
            <camel:to uri="mock:result" />
        </camel:split>
    </camel:route>
</camel:camelContext>

The problem here is that by the time I reach insert into table2, the original message (the one containing the data) is lost, as I had to make another query in the meantime (where I check for data in the second table). Is my approach good and how can I retrieve the message that contains the data?

A: When you call the 2nd SQL to check, then you can use the content enricher EIP to "merge" the result of this call with the original message. In your case, you only need to know if there was a row or not, and store that in a header.
The content enricher eip is documented here: http://camel.apache.org/content-enricher.html, see for example the enrich.
The caveat is that you would need to use a java code and implement an AggregationStrategy that implements the "merge" logic.
You can also do as Ben suggests to store the 1st data in a header (or property on the exchange), which you can access later.
Though looking at this from the EIP perspective, then its the content enricher EIP that best covers this use-case.

A: you need to preserve the result of the first query in a header field so its not lost when you setup the body for the second query
<header name="myresults"><simply>$body</simple></header>

A: You can also avoid the problem and use some kind of database specific statements to do the insert.
For mysql for example you can do something like
INSERT IGNORE table2 (id, name) values (#, #)

I'm sure other database engines have something similar. It saves you some queries to the database.


text:
Q: How to solve a problem from Frank Olver's book I'm learning Frank Olver's book, called Asymptotics and Special Functions. There is an difficult exercise.

Problem. Suppose that $f,\frac{1}{f}$ possess the following asymptotic expansions :
  $$f(z)\sim \sum_{s=0}^{\infty}f_s z^{-s},\frac{1}{f(z)}\sim \sum_{s=0}^{\infty}k_s z^{-s}$$
  as $z\to \infty$ in the region F, contained in $\mathbb{C}$. That is to say
  \begin{align*}
f(z)& =\sum_{s=0}^{n-1}f_s z^{-s}+\phi_n(z),\\
\frac{1}{f(z)}& =\sum_{s=0}^{n-1}k_s z^{-s}+\psi_n(z),
\end{align*}
  where $\left|\phi_n(z)\right|\leqslant K_n\left|z\right|^{-n},\left|\psi_n(z)\right|\leqslant L_n\left|z\right|^{-n}$, and $K_n,L_n$ are the least constants satisfying last two inequalities. Show that
  $$L_n\leqslant \frac{1}{m}\sum_{s=0}^{n-1}|k_s|K_{n-s},\ n\geqslant 1,$$
  where $m=\inf_{z\in \mathbf{F}}|f(z)|$.

I have got the recurrence relation :
$$f_0 k_s=-\left(f_1 k_{s-1}+f_2 k_{s-2}+\cdots+f_s k_0\right)$$
for $s=1,2,\cdots$. For example,
$$k_0=\frac{1}{f_0},k_1=-\frac{f_1}{f_0^2},k_2=\frac{f_1^2-f_0 f_2}{f_0^3}.$$
But I absolutely have no idea to prove the origin problem.

redpajama_set_name: RedPajamaStackExchange


text:
Q: converting from XML -> PHP Array -> Json Encode I am setting up an input autocomplete using jquery tokeninput plugin and XML data.
I have an XML file structured as shown:
<?xml version="1.0" encoding="UTF-8"?>
    <majors>
        <major program="GCIS">Computing & Info Sci (PHD)</major>
        <major program="UINT">Business Administration (AAS)</major>
        etc..
    </majors>

I load it into PHP:
$majors = simplexml_load_file('../ajax/majors.xml');
I then want to do the following things:

*

*reformat each <major>element into string, including program attribute

*

*(ex: <major program="GCIS">Computing & Info Sci (PHD)</major> turns into string GCIS - Computing & Info Sci (PHD)

*run the converted string through a filter function. The filter function checks for strpos($convertedString, $userQuery) and returns true/false if the user's query is present

*elements which DO contain the $userQuery are all then encoded with json_encode($arr)

*return JSON data.

This is the code I currently have... I can't seem to get the formatting / filtering to work correctly.
if(isset($_POST['query']) ) {
    $majors = simplexml_load_file('../ajax/majors.xml');

    # iterate through.
    foreach ($majors as $key => $value) {
        $arr = array('major' => $value['program'] . " - " . $value);
    }

    # filter the response using our query
    $arr = array_filter($arr, 'filterArrayWithQuery');

    # JSON-encode the response
    $json_response = json_encode($arr);

    # Return the response
    return $json_response;
}

# ensures that the search query is present
function filterArrayWithQuery( $string ) {
    return !strpos( $string, $query ) === false;
}

The end-result JSON output should look like this:
{"major":"GCIS - Computing & Info Sci (PHD)","major":"UINT - Business Administration (AAS)"}

A: In your iterate through line, you are not appending new entries -
# iterate through.
foreach ($majors as $key => $value) {
   $arr[] = array('major' => $value['program'] . " - " . $value);
//     ^^
}

With this the output would be-
[{"major":"GCIS - Computing & Info Sci (PHD)"},{"major":"UINT - Business Administration (AAS)"}]

A: Try this:
function convert($xml) {
    # ensures that the search query is present
    function filterArrayWithQuery($string) {
        static $query = null;
        if (is_null($query) && isset($_POST['query'])) $query = $_POST['query'];
        return !$query || strpos($string, $_POST['query']) !== false;
    }

    $majors = simplexml_load_string($xml);
    $arr = array();

    # iterate through
    foreach ($majors as $key => $value) {
        $arr[] = array('major' => $value['program'] . " - " . htmlentities($value));
    }

    # filter the response using our query
    $arr = array_filter($arr, 'filterArrayWithQuery');

    # Return the response (JSON-encoded)
    return json_encode(array('majors' => $arr));
}

$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
    <majors>
        <major program="GCIS">Computing & Info Sci (PHD)</major>
        <major program="UINT">Business Administration (AAS)</major>
    </majors>
XML;

$_POST['query'] = 'Info';
echo convert($xml);

A: Thank you to the input I received, however I was able to figure out the solution.
Here is the final PHP script for those interested.
<?php

# vars
$reqMethod    = $_SERVER['REQUEST_METHOD'];
$ref          = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : "http://www.google.com";
$allowedHosts = array('redacted', 'localhost');
$majors       = null;
$arr          = array();
$query        = isset($_POST['q']) ?  $_POST['q'] : "";

# confirm request is being sent from where we allow.
if ( $reqMethod != 'POST' || !in_array(parse_url($ref, PHP_URL_HOST), $allowedHosts) ) {

    header('Location: ' . $ref);

} else {

    # load in XML
    $majors = simplexml_load_file('../ajax/majors.xml');

    # iterate through XML. if element contains query, add it to an array.
    foreach ($majors as $key => $value) {
        if( !stristr( $value, $query ) === false ){
            $arr[] = array('major' => $value['program'] . " - " . $value);
        }
    }

    # Return the response - JSON encoded
    header('Content-type: application/json');
    echo json_encode($arr);

}

?>


text:
Q: How to correctly ldapmodify replace olcAccess lines? This is a part from olcDatabase={1}hdb.ldif
olcAccess: {0}to attrs=userPassword,shadowLastChange
 by self write
 by anonymous auth
 by dn="cn=admin,dc=somesite,dc=com" write
 by * none
olcAccess: {1}to dn.base="" by * read
olcAccess: {2}to *
 by self write
 by dn="cn=admin,dc=somesite,dc=com" write
 by * read

I would like to append by dn="cn=anotheruser,ou=Users,dc=somesite,dc=com" write to the {0} and {2} line.
Before I destroy my LDAP server, is the following LDIF correct?
dn: olcDatabase{1}hdb,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to attrs=userPassword,shadowLastChange
        by dn="cn=admin,dc=somesite,dc=com" write
        by dn="uid=anotheruser,ou=Users,dc=somesite,dc=com" write
        by anonymous auth
        by self write
        by * none
olcAccess: {2}to *
 by self write
 by dn="cn=admin,dc=somesite,dc=com" write
 by dn="cn=anotheruser,ou=Users,dc=somesite,dc=com" write
 by * read

With: ldapmodify -Y EXTERNAL -H ldapi:/// -f ./changes.ldif
My concerns are:

*

*there are 3 olcAccess: lines, I did not include the {1} line
so would it still be there after committing the ldif changes

*is the replace: olcAccess line correct?

A: This ldif worked for me, with previous command
dn: olcDatabase{1}hdb,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to attrs=userPassword,shadowLastChange
        by dn="cn=admin,dc=somesite,dc=com" write
        by dn="uid=anotheruser,ou=Users,dc=somesite,dc=com" write
        by anonymous auth
        by self write
        by * none
olcAccess: {1}to dn.base="" by * read
olcAccess: {2}to *
 by self write
 by dn="cn=admin,dc=somesite,dc=com" write
 by dn="cn=anotheruser,ou=Users,dc=somesite,dc=com" write
 by * read


text:
Q: Tips for share content of my website on facebook I have a job portal website and on that I have a facebook button named as share in fb. I want that when user clicks on that button the that specific job description of my webpage should share on his wall.
share in fbk

Above link go to share page,but its content is coming from webpage about us page,not specific content.

A: Set the meta tags for each site you want to be shareable.
Put them in the HTML Header like this
<meta property="og:url"                content="http://www.nytimes.com/2015/02/19/arts/international/when-great-minds-dont-think-alike.html" />
<meta property="og:type"               content="article" />
<meta property="og:title"              content="When Great Minds Don't Think Alike" />
<meta property="og:description"        content="How much does culture influence creative thinking?" />
<meta property="og:image"              content="http://static01.nyt.com/images/2015/02/19/arts/international/19iht-btnumbers19A/19iht-btnumbers19A-facebookJumbo-v2.jpg" />

The properties include descriptive meta-data about the article that we specifically want to present when


text:
Q: Creating a user editable area of a site - adding to a users collection I'm trying to create a section of a website where users can login and add products to a collections area where they have saved collections of products.
A simple example would be:
Logged in user - Finds product - clicks add to collection - collection is saved for when they log back on.
Also there may be more than one collection eg "add to: Collection 1, Collection 2 etc"
If anyone can help or just point me in the right direction it would be great.
Additional info: I'm a good front end developer with some php knowledge.

A:
I'm trying to create a section of a website where users can login and
  add products to a collections area where they have saved collections
  of products.

Well, for now I can see four tables: users, products, collections, collections_products (association).

A simple example would be: Logged in user - Finds product - clicks add
  to collection - collection is saved for when they log back on.

Login - verify if the user and password exists in the table and store the user data in the session.
Page 1: provide a form with fields that the user can filter to return products
Page 2: show the filters and the products with a link to add to collections.
When the user clicks in the link to add to collections, you can provide a modal dialog with a list of collections and every collection with one checkbox. The list can have the checkbox of a collection already selected if the association already exists.
Example:
Product: My Procuct
Add to collections
[ x ] collection one (already associated)
[   ] collection two
[   ] collection ...
[   ] collection ...

[ Save Associations ]

Note: in your checkboxes you have to use a name like collection[] so the php will handle as an array.
To save the association of the product and the collections, you can delete all associations for the user product and insert just those that return checked.
Well I think that's a start.


text:
Q: cakephp 3.0 routing issue I am facing issue in cakephp3. In routes.php I have used
Router::prefix('admin', function ($routes) {
     $routes->connect('/', ['controller' => 'TblUsers', 'action' => 'index']);
});

I have placed the TblUsers inside Admin folder
In app controller code:
$this->loadComponent('Auth', [
    'authenticate' => [
        'Form' => [
            'fields' => [
                'username' => 'username',
                //'password' => 'password'
            ],
            'scope' => ['role' => '1']
        ]
    ],
    'loginAction' => [
        'controller' => 'Users',
        'action' => 'login',
        'admin'=>true,
        'prefix'=>true

    ],
    'redirectUrl' => [
        'controller' => 'TblUsers',
        'action' => 'index',
        'admin'=>true,

    ],
    'loginRedirect' => [
        'controller' => 'TblUsers',
        'action' => 'index',
        'admin'=>true,

    ]
]);

Now when I access the users/login its giving me error:

Error: A route matching "array ( 'controller' => 'Users', 'action' => 'login', 'admin' => true, 'prefix' => true, 'plugin' => NULL, '_ext' => NULL, )" could not be found.

OR
Is there any way in cakephp3 like cakephp2 to access the functions inside any controller start with admin_functionname and call the admin_functionname.ctp file and also add the admin inside the url.
Thanks

A: You need to change your prefix to the actual prefix, not true.
So change this;
'loginAction' => [
    'controller' => 'Users',
    'action' => 'login',
    'admin'=>true,
    'prefix'=>true

To this;
'loginAction' => [
    'controller' => 'Users',
    'action' => 'login',
    'prefix'=> 'admin'

You'll need to do the same with your loginRedirect and redirectUrl
You can find more information here http://book.cakephp.org/3.0/en/development/routing.html#prefix-routing

A: This example is for Simple page with Admin Panel:
Structure fodlers and files:
src
_Controller
 _admin
   __AppController.php
   __UsersController.php
   __OtherAdminController.php
 _AppController.php
 _UsersController.php
 _OtherPublicController.php

_Template
 _admin
  __Users
    _login.ctp
    _add.ctp
    _etc.ctp
  __OtherAdminTemplate
 _Users
 _Pages
 _etc

config/routes.php
Router::prefix('admin', function (RouteBuilder $routes) {

  $routes->connect('/',['controller' => 'Users', 'action' => 'login']);
  $routes->connect('/:controller',['action' => 'index'],['routeClass' => 'DashedRoute']);
  $routes->connect('/:controller/:action/*',[], ['routeClass' => 'DashedRoute']);

});

Controller/Admin/AppController.php
<?php
namespace App\Controller\Admin; // <---- Name your admin folder

use App\Controller\AppController as Controller;
use Cake\Event\Event;
use Cake\Core\Configure;
/**
 * App Controller
 *
 * @property \App\Model\Table\AppTable $App
 */
class AppController extends Controller
{

    public function initialize()
    {
        parent::initialize();
        $this->loadComponent('Auth', array(
            'authenticate' => array(
                'Form' => array('fields' => array('username' => 'email', 'password' => 'password'))
            ),
            'loginRedirect' => array(
                'controller' => 'Users',
                'action' => 'index'
            ),
            'logoutRedirect' => array(
                'prefix' => false,
                'controller' => 'Pages',
                'action' => 'home',
            ),
        ));

        $this->Auth->deny();

    }

    public function beforeFilter(Event $event)
    {
        // If you want use admin.ctp layout
        if ($this->request->params['prefix'] === 'admin') {
             $this->viewBuilder()->layout('admin');
        }
        //Autorized acctions without registration
        $this->Auth->allow(['forgotPassword', 'resetPassword']);

    }

}

Controller/Admin/UsersController.php
<?php
namespace App\Controller\Admin; // <---- Name your admin folder

use App\Controller\Admin\AppController;  // <---- Name your admin folder
use Cake\Mailer\Email;
use Cake\Routing\Router;
use Cake\Core\Configure;

/**
 * Users Controller
 *
 * @property \App\Model\Table\UsersTable $Users
 */
class UsersController extends AppController
{
    public function login()
        {
      //Admin Login function
        }

    //Rest of Users admin functions
}


text:
Q: Closing lid for clamshell doesn't make external monitor primary under 10.7.3 on MacBook Air 13" I'm connecting a 13" MacBook Air to a Dell 22" screen using the Apple Mini DisplayPort to DVI Adapter, with an Apple Keyboard with Numeric Keypad plugged into a USB on the MacBook and a USB mouse plugged into the keyboard. Also, the MacBook is running off external power.
When I close the MacBook lid, I thought the Dell monitor would become primary and the MacBook screen real-estate would "go away." However, the MacBook screen remains primary and I can move the mouse pointer off the Dell screen and onto the invisible MacBook screen.
Am I misunderstanding how clamshell mode works?

A: According to Apple Support, the clamshell mode (lid closed) requires:

*

*Power adapter

*External keyboard, mouse, or trackpad

*External display

You meet all three criteria. The support article goes on to provide steps for both wired and bluetooth keyboard & mouse combos:

If you are using a wired keyboard and mouse:

*

*Make sure the computer is plugged in to an outlet using the AC power adapter.

*Connect a USB keyboard and mouse to your computer.

*With the computer turned on connect the Apple portable (using the appropriate Apple adapter if necessary) to the appropriate port on the
  external display or projector and turn the display or projector on.

*After your computer's Desktop appears on the external display, close the computer's lid.

*When you close the lid:

*

*In OS X Lion, the external display will change to a blue screen, then will show your desktop.

*In Mac OS X v10.6.8 and earlier, wake the computer up by clicking the mouse button or by pressing a key on your external keyboard. You
  should now be able to use your Apple portable as you normally would,
  with a USB keyboard and mouse.

Perhaps you could try opening and closing the lid again.


text:
Q: Set the border of a subclassed NSTableCellView As mentioned in the title of this post I want to set the border (color and width) of a subclassed NSTableCellView which is used inside a view-based NSTableView. I tried the following
self.layer.borderColor = [[NSColor greenColor] CGColor];
self.layer.borderWidth = 3.0;

I placed the code in initWithCoder and awakeFromNib without the desired result. Changing the backgroundColor is possible within the drawRect-Method. Can someone point me to the right direction?
Thanks
EDIT
Here is my solution using NSFrameRect
- (void)drawRect:(NSRect)dirtyRect
{
    [NSGraphicsContext saveGraphicsState];

    [[NSColor lightGrayColor]set];
    NSFrameRect([self bounds]);

    [NSGraphicsContext restoreGraphicsState];
}

A: Views on OS X are not layer backed by default. You first need to setWantsLayer: YES
But if you are using drawRect: you can just use NSFrameRect() or one of the similar functions or draw with an NSBezierPath in you cell view subclass. However, keep in mind that usually the row view does background drawing in view based tables.
Sounds like you have a bit of learning yet to do about drawing in Cocoa.


text: Q: Where is the 'add platform' button in facebook's app dashboard? I don't seem to find the 'add platform' button anywhere on the basic settings page for my newly created app to configure the platform. Please help me find it. I'm attaching the screenshot as well. Probably just me!


text:
Q: the usual topology on the euclidean plane $\mathbb{R}^2$ is strictly weaker than the topology induced on it by the lexicographic ordering. Prove that the usual topology on the euclidean plane $\mathbb{R}^2$ is strictly weaker than the topology induced on it by the lexicographic ordering.

Can someone please help me solve this problem?

A: You have to prove two things:

*

*Every usual open set is open in the lexicographic order topology, and

*There is at least one set that is open in the lexicographic order topology but not in the usual topology.

If $\tau$ is the usual topology on $\Bbb R^2$, and $\tau'$ is the lexicographic order topology, you're being asked to show that $\tau\subsetneqq\tau'$; (1) says that $\tau\subseteq\tau'$, and (2) says that $\tau'\nsubseteq\tau$, so the two together say that $\tau\subsetneqq\tau'$.
HINTS:

*

*Let $U$ be an open set in the usual topology of the plane. For each $x\in\Bbb R$ let $$U_x=U\cap\Big(\{x\}\times\Bbb R\Big)\;,$$ and show that $U_x$ is open in the lexicographic order topology on $\Bbb R^2$. It may help to look at the projection of $U_x$ on the $y$-axis, i.e., at $\{y\in\Bbb R:\langle x,y\rangle\in U_x\}$.

*Consider the set $\{\langle 0,y\rangle:0<y<1\}$.


text:
Q: Should I use implicit conversions to enforce preconditions? It occurs to me that I could use use implicit conversions to both announce and enforce preconditions.  Consider this:
object NonNegativeDouble {
  implicit def int2nnd(d : Double) : NonNegativeDouble = new NonNegativeDouble(d)
  implicit def nnd2int(d : NonNegativeDouble) : Double = d.v
  def sqrt(n : NonNegativeDouble) : NonNegativeDouble = scala.math.sqrt(n)
}

class NonNegativeDouble(val v : Double ) {
  if (v < 0) {
    throw new IllegalArgumentException("negative value")
  }
}

object Test {
  def t1 = {
    val d : Double = NonNegativeDouble.sqrt(3.0);
    printf("%f\n", d);
    val n : Double = NonNegativeDouble.sqrt(-3.0);
  }
}

Ignore for the moment the actual vacuity of the example: my point is, the subclass NonNegativeDouble expresses the notion that a function only takes a subset of the entire range of the class's values.
First is this:

*

*A good idea,

*a bad idea, or

*an obvious idea everybody else already knows about

Second, this would be most useful with basic types, like Int and String.  Those classes are final, of course, so is there a good way to not only use the restricted type in functions (that's what the second implicit is for) but also delegate to all methods on the underlying value (short of hand-implementing every delegation)?

A: This is an extremely cool idea, but unfortunately its true potential can't be realized in Scala's type system. What you really want here is dependent types, which allow you to impose a proof obligation on the caller of your method to verify that the argument is in range, such that the method can't even be invoked with an invalid argument.
But without dependent types and the ability to verify specifications at compile-time, I think this has questionable value, even leaving aside performance considerations. Consider, how is it any better than using the require function to state the initial conditions required by your method, like so:
def foo(i:Int) = {
    require (i >= 0)
    i * 9 + 4
}

In both cases, a negative value will cause an exception to be thrown at runtime, either in the require function or when constructing your NonNegativeDouble. Both techniques state the contract of the method clearly, but I would argue that there is a large overhead in building all these specialized types whose only purpose is to encapsulate a particular expression to be asserted at runtime. For instance, what if you wanted to enforce a slightly different precondition; say, that i > 45? Will you build an IntGreaterThan45 type just for that method?
The only argument I can see for building e.g. a NonNegativeFoo type is if you have many methods which consume and return positive numbers only. Even then, I think the payoff is dubious.
Incidentally, this is similar to the question How far to go with a strongly typed language?, to which I gave a similar answer.

A: Quite a neat idea actually, though I wouldn't use it in any performance sensitive loops.
@specialisation could also help out by a fair amount here to help make the code more efficient...

A: This would usually be called "unsigned int" in C. I don't think it's very useful, because you wouldn't be able to define operators properly. Consider this:
val a = UnsignedInt(5)
val b = a - 3 // now, b should be an UnsignedInt(2)
val c = b - 3 // now, c must be an Int, because it's negative!

Therefore, how would you define the minus operator? Like this maybe:
def -(i:Int):Either[UnsignedInt,Int]

That would make arithmetics with UnsignedInt practically unusable.
Or you define a superclass, MaybeSignedInt, that has two subclasses, SignedInt and UnsignedInt. Then you could define subtraction in UnsignedInt like this:
def -(i:Int):MaybeSignedInt

Seems totally awful, doesn't it? Actually, the sign of the number should not conceptually be a property of the number's type, but of it's value.


text:
Q: Tweak showlabels/showkeys - wrap the label Can showlabels wrap the label in the margin? A very similar question is showlabels: wrap labels in marginpar, but the solution of @DavidCarlisle does not solve the more general case. Consider the following MWE:
\documentclass{article}
\begin{document}
\begin{figure}[ht]
  \centering
  \rule{1cm}{1cm}
  \caption{default}
  \label{fig:a very very very long and detailed label}
\end{figure}
\end{document}

When adding the package showkeys the output is:

Similar problem occurs with the showlabels package (whether the hack of @DavidCarlisle is used or not):

So, is there a way to fix it?

A: Having labels like this is really a misuse of the label system, labels are intended to be short symbolic names, but anyway

\documentclass{article}
\usepackage{showkeys}
\renewcommand*\showkeyslabelformat[1]{%
  \fbox{\parbox[t]{\marginparwidth}{\raggedright\normalfont\small\ttfamily#1}}}

\begin{document}
\begin{figure}[ht]
  \centering
  \rule{1cm}{1cm}
  \caption{default}
  \label{fig:a very very very long and detailed label}
\end{figure}
\end{document}

A: In order to split a long label without spaces, you can use the \seqsplit command from the seqsplit package. The following is an adaption of David's answer and also shows the necessity of wrapping long labels:
\documentclass{article}
\usepackage[%showframe, % show helper lines
            paperwidth=10cm, paperheight=7cm,
            hmargin=24mm,vmargin=4mm, marginparwidth=17mm,
           ]{geometry}
\usepackage{seqsplit}
\usepackage{showkeys}
\usepackage{xstring}

\renewcommand*\showkeyslabelformat[1]{%
\noexpandarg%
% instead of \textvisiblespace you can also put in ~
% if you want to keep a plain space at space characters
\StrSubstitute{\(\{\)#1\(\}\)}{ }{\textvisiblespace}[\TEMP]%
\parbox[t]{\marginparwidth}{\raggedright\normalfont\small\ttfamily\expandafter\seqsplit\expandafter{\TEMP}}}

\begin{document}
\begin{equation}
    (a\cdot b ) \cdot c = a\cdot (b\cdot c)
    \label{eq:groupassociativity}
\end{equation}
\begin{figure}[ht]
  \centering
  \rule{1cm}{1cm}
  \caption{default}
  \label{fig:a very very very long and detailed label}
\end{figure}
\end{document}

For the spaces, one needs to replace the spaces within the seqsplit, either by ~ for keeping a space or by something else like \textvisiblespace to visualize it better.


text:
Q: Class to template error: invalid use of non-static data member First question here so I hope it's a good one. I have two classes that have several instances of a template inside them. One (grades) is a friend to the other (students), yet when I try to access one of the templates from the other class I get this wonderful g++ error:
error: invalid use of non-static data member 'grades_table::term'
This is the first of a few. I've seen several questions asked in the same vein on here but in looking through them I can't figure out how to apply that information to my problem. Here's all the relevant code.
table_frame.h
class grades_table{

friend class students_table;
public:

grades_table();
    int insert(int& temp_student_ID, std::string& temp_term,
    int& temp_year, char& temp_grade);
    void print(int select_cell = 0);
    void select(std::string& attribute, std::string& identifier);

private:
    int row_number;
    table_column<int> student_ID;
    table_column<std::string> term;
    table_column<int> year;
    table_column<char> grade;
};

tables.cpp
void students_table::print(bool join_id, int select_cell){
    int column_stop;

    column_stop = student_ID.column_depth();
    row_number = 1;

    if(select_cell != 0){
        cout << "(" << student_ID.print(select_cell) << ",";
        cout << first_name.print(select_cell) << ",";
        cout << last_name.print(select_cell) << ")";
    }
    else if(join_id){
        while(row_number <= column_stop){
            //Keep it clean
            if(row_number % 2 == 0){
                cout << "\n";
            }
        cout << "(" << student_ID.print(row_number) << ",";
        cout << first_name.print(row_number) << ",";
        cout << last_name.print(row_number) << ",";
        cout << grades::term.print(row_number) << ","; <<-----ERROR
        cout << grades::year.print(row_number) << ","; <<-----ERROR
        cout << grades::grade.print(row_number) << ")";<<-----ERROR
...

Any help is very much appreciated.
EDIT
Ok, so I changed 'grades_table' to an instance I created called 'grades'. But now it tells me that it hasn't been declared. Here's the main file:
database_control.cpp
#include "table_frame.h"

using namespace std;

void input_output();
void database_actions(const string& command, const string& arguments);
void split(const string &s, char delim, int start, string& argument);

grades_table grades;
students_table students;
bool PROGRAM_EXIT = false;

...

A: Your compiler is right. You should create instance of grades_table and then only you can access non-static members. I cannot see any static member in your class.


text:
Q: How do I increase limits in my docker containers on CoreOS? By default, CoreOS and the Linux kernel has some pretty conservative limits defined for things such as open files and locked memory.
So I upped the values in /etc/systemd/system.conf:
DefaultLimitNOFILE=500000
DefaultLimitMEMLOCK=unlimited

However, when I start my docker containers the limits are still low. ulimit -l prints 64.
Running ulimit -l unlimited prints an error.

ulimit: max locked memory: cannot modify limit: Operation not
  permitted

So I placed
LimitMAXLOCKED=unlimited
LimitNOFILE=64000

In my systemd unit file.
However, these values are not coming through to the docker container and calling them still doesn't work.  I've rebooted the machine after changing the systemwide defaults.
This is probably more of a systemd thing.  How do I fix this?

A: Docker containers are not started nor managed by systemd. The Docker daemon is responsible for setting limits here. Here is an example taken from the official documentation:
# docker run --ulimit nofile=1024:1024 --rm debian sh -c "ulimit -n"


text:
Q: How to get all commit messages in a repo by one author? How can I retrieve a list of all commit messages in a git repo for a given commit author?

A: In command line:
git log --author=<author name> --pretty=format:"%h - %an :%cn  %s"

h - short form of hash
an - author name
cn - committer name
s - message (subject)

A: git log --all --author <author regex>

Easy to work out by reading the documentation. Note that it's a regex, so some characters may need escaped.


text:
Q: How to put a TextView at the end of my ScrollView? I want to add a TextView at the bottom of my ScrollView, in which I can put the version number. So when a user first enters the screen, they don't see the Version Number. After they Scroll down, they can see the version number at the bottom of the screen. I tried all kinds of ways, doesn't work.
The layout is pretty nested.
This is the screenshot of the layout implementing the code below

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ScrollView
            android:id="@+id/scrollView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:id="@+id/linearLayoutThatDoesNotScroll"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/bg_splash"
                android:clickable="true"
                android:orientation="vertical">

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:padding="@dimen/cnt_full">

                    <RelativeLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerHorizontal="false"
                        android:layout_centerVertical="true"
                        android:layout_gravity="center">

                        <com.onkore.app.view.FontTextView
                            android:id="@+id/profile_num_trophies_won"
                            style="@style/Theme.App.Text.Headline"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentStart="true"
                            android:layout_marginTop="@dimen/cnt_half"
                            android:drawablePadding="@dimen/cnt_tiny"
                            android:drawableStart="@drawable/icon_trophy"
                            android:fontFamily="thick"
                            android:gravity="center_vertical"
                            android:text="99"
                            android:textColor="@color/color_text_primary_inverse"
                            android:textSize="32sp" />

                        <com.onkore.app.view.FontTextView
                            style="@style/Theme.App.Text.Caption"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@id/profile_num_trophies_won"
                            android:text="@string/profile_trophies"
                            android:textColor="@color/color_text_primary_inverse" />
                    </RelativeLayout>

                    <RelativeLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerInParent="true">

                        <com.makeramen.roundedimageview.RoundedImageView
                            android:id="@+id/profile_user_pic"
                            android:layout_width="@dimen/profile_image_size"
                            android:layout_height="@dimen/profile_image_size"
                            android:layout_centerInParent="true"
                            android:layout_centerVertical="false"
                            android:src="@drawable/icon_profile_default"
                            app:riv_oval="true" />

                        <com.mikhaellopez.circularprogressbar.CircularProgressBar
                            android:id="@+id/profile_progress_bar"
                            android:layout_width="@dimen/profile_progress_bar_size"
                            android:layout_height="@dimen/profile_progress_bar_size"
                            android:layout_centerHorizontal="false"
                            android:layout_centerInParent="true"
                            android:layout_centerVertical="false"
                            app:cpb_background_progressbar_color="@color/color_base"
                            app:cpb_background_progressbar_width="@dimen/elev_06"
                            app:cpb_progress="25"
                            app:cpb_progressbar_color="@color/color_progress"
                            app:cpb_progressbar_width="@dimen/cnt_tiny" />

                        <com.onkore.app.view.FontTextView
                            android:id="@+id/profile_level"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@id/profile_progress_bar"
                            android:layout_centerHorizontal="true"
                            android:layout_centerInParent="false"
                            android:layout_marginTop="@dimen/cnt_dbl"
                            android:textColor="@color/color_text_primary_inverse"
                            android:textSize="@dimen/text_size"
                            tools:text="Level 99" />

                    </RelativeLayout>

                    <com.onkore.app.view.FontTextView
                        android:id="@+id/profile_okoins"
                        style="@style/Theme.App.Coins.Balance"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentEnd="true"
                        android:layout_centerVertical="true"
                        android:layout_gravity="center_vertical"
                        tools:text="999k" />
                </RelativeLayout>

                <com.onkore.app.view.FontTextView
                    style="@style/Theme.App.Tile.Text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="@dimen/cnt_full"
                    android:layout_marginStart="@dimen/cnt_full"
                    android:layout_marginTop="@dimen/cnt_full"
                    android:background="@drawable/bg_card_empty"
                    android:gravity="center"
                    android:paddingBottom="@dimen/cnt_dbl"
                    android:paddingTop="@dimen/cnt_part"
                    android:text="Tap to Personalize"
                    android:textAllCaps="true"
                    android:visibility="gone" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/color_primary_translucent"
                    android:visibility="gone">

                    <com.onkore.app.view.FontTextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Friends" />
                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="50dp"
                    >

                    <TextView
                        android:id="@+id/versionName"
                        android:layout_width="match_parent"
                        android:layout_height="40dp"
                        android:background="@color/cardview_dark_background"
                        android:gravity="center_vertical|center_horizontal|center"
                        android:text="HAHA"
                        android:textColor="@color/cardview_light_background"
                        android:visibility="visible" />
                </LinearLayout>
            </LinearLayout>
        </ScrollView>

    </RelativeLayout>

A: maybe something like this?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
    tools:layout_editor_absoluteX="8dp"
    tools:layout_editor_absoluteY="8dp">

    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:id="@+id/linearLayoutThatDoesNotScroll"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/colorAccent"
            android:clickable="true"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="1000dp" />

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:text="version"
                android:textSize="50dp" />

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


text:
Q: $AB = BA $ in a group $G$ Suppose $G$ is a group , $ A \subset G $ and $ B \subset G $ are subsets of $G$, if $AB = BA$ is it true that $AB$ is a subgroup of $G$ ? Why ?

A: If $A$ and $B$ are not assumed to be subgroups of $G$ themselves, then the answer is trivial. Take $G = \Bbb{Z}$ and let $A = B = \{ 1 \}$. Then, $AB = BA = \{ 2 \}$. But, clearly $AB$ is not a subgroup of $G$.


text:
Q: readline() не читает первую строку (python) Мне нужно написать программу, которая считывает текст из файла (в файле может быть больше одной строки) и выводит самое частое слово в этом тексте и через пробел то, сколько раз оно встретилось. При решении этой задачи столкнулся с проблемой. Я читаю файл построчно с помощью readline(), но почему-то первая строка не считывается. Если в файле одна строка, то программа выводит пустой словарь. Если более, то выводит словарь с данными, но пропускает первую строку. Почему?
data = {}
with open("input.txt") as f1:
    for line in f1:
        line = f1.readline().lower().split()
        set_line = set(line)
        for i in set_line:
            if i in line:
                 data[i] = line.count(i)
print(data)

A: В вашем коде сам цикл for line in f1: читает файл построчно. В цикле вы игнорируете строку, которую он дает, и самостоятельно читаете строку еще раз, ее значение уже используете. Получается, что вы игнорируете все нечетные строки (первую, третью, пятую и т.д.) Нужно избавиться от повторного чтения строки, вместо этого работать с той строкой, которую вам дает цикл:
data = {}
with open("input.txt") as f1:
    for line in f1:
        line = line.lower().split()
        set_line = set(line)
        for i in set_line:
            if i in line:
                 data[i] = line.count(i)
print(data)

A: Попробуйте такой вариант, через read()
 with open("text.txt") as f:
        doc = f.read()

    words_dict= {}
    for i in doc.split('\n'):
        for j in i.split():
            words_dict[j] = words_dict.get(j,0) + 1

    lst = list(words_dict.items())

    lst = sorted(lst, key=lambda word: word[1], reverse=True)
    print(*lst[0])


text:
Q: Issue with permission on Apache Flume (Binding host with port) I recently just got an api from meteomatics.com and i'm trying to send some data to HDFS using Apache flume btu i got this problem.
Problem :
 '19:56:58.789 [lifecycleSupervisor-1-0] ERROR org.apache.flume.source.http.HTTPSource - Error while starting HTTPSource. Exception follows.
java.io.IOException: Failed to bind to api.meteomatics.com/37.208.109.220:443
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349) ~[jetty-server-9.4.41.v20210516.jar:9.4.41.v20210516]
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_292]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) ~[?:1.8.0_292]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_292]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_292]
at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_292]
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_292]
at sun.nio.ch.Net.bind(Net.java:461) ~[?:1.8.0_292]
at sun.nio.ch.Net.bind(Net.java:453) ~[?:1.8.0_292]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222) ~[?:1.8.0_292]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85) ~[?:1.8.0_292]
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344) ~[jetty-server-9.4.41.v20210516.jar:9.4.41.v20210516]
... 16 more
19:56:58.810 [lifecycleSupervisor-1-0] ERROR org.apache.flume.lifecycle.LifecycleSupervisor - Unable to start EventDrivenSourceRunner: { source:org.apache.flume.source.http.HTTPSource{name:r1,state:IDLE} } - Exception follows.
java.lang.RuntimeException: java.io.IOException: Failed to bind to api.meteomatics.com/37.208.109.220:443
at com.google.common.base.Throwables.propagate(Throwables.java:156) ~[guava-11.0.2.jar:?]
at org.apache.flume.source.http.HTTPSource.start(HTTPSource.java:204) ~[flume-ng-core-1.11.0.jar:1.11.0]
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_292]
at sun.nio.ch.Net.bind(Net.java:461) ~[?:1.8.0_292]
at sun.nio.ch.Net.bind(Net.java:453) ~[?:1.8.0_292]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222) ~[?:1.8.0_292]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85) ~[?:1.8.0_292]
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344) ~[jetty-server-9.4.41.v20210516.jar:9.4.41.v20210516]'

Conf file :
a1.sources = r1
a1.channels = c1
a1.sinks = k1

a1.sources.r1.type = http
a1.sources.r1.bind = api.meteomatics.com
a1.sources.r1.port = 443
a1.sources.r1.handler = org.apache.flume.source.http.JSONHandler
a1.sources.r1.handler.properties = ssl,timestamp,status,method,headers,remoteHost,logger,requestURI

a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = hdfs://localhost:9000/user/MeteoData
a1.sinks.k1.hdfs.batchSize = 1000
a1.sinks.k1.hdfs.filePrefix = brahim
a1.sinks.k1.hdfs.fileType = DataStream
a1.sinks.k1.hdfs.rollSize = 0

a1.channels.c1.type = memory
a1.channels.c1.capacity = 10000
a1.channels.c1.transactionCapacity = 100

a1.sources.r1.channels = c1
a1.sinks.r1.channel = c1

i execute with this :
flume-ng agent -n a1 -c conf -f /home/ubuntu1/apache-flume-1.11.0-bin/conf/meteoconf1.conf
Can someone please tell me how to solve this problem.
i don't know what to try to fix this problem i tried executing as sudo (path_of_flume-ng) agent -n a1 -c conf -f /home/ubuntu1/apache-flume-1.11.0-bin/conf/meteoconf1.conf it didn't solve the problem
i also checked :
netstat -an | grep api.meteomatics.com:443
nothing is using the port there
telnet api.meteomatics.com 443
and this one works it gives connected


text:
Q: How to resize table width based on screen size I'm working on this page which contains a table inside modal-body.
The screen i work on is 22 inch and the table looks perfect on that. But when I see it on my laptop Macbook 13 inch, the table extends to the width of the screen.  How do I resize automatically ?

    <loading></loading>

                     {{spec}}
                        <button class="btn btn-xs btn-link" ng-click="details(value)">

                        </button>

                                ---------------
                                ---------------
                                ---------------

                                ----------------
                                ----------------
                                ----------------

A: You can use max-width instead of width to get a maximum size of 1600px
and for smaller screens it gets to 100%
PS: or is there a min-width defined? Whats about other tables? Is the table-layout property really needed?

A: Use percentage to specify width wherever you want


text:
Q: Golang test mock functions best practices I am developing some tests for my code (using the testing package), and I am wondering what's the best way to mock functions inside the tested function:
Should I pass the function as parameter?
In that case, what if that function calls another function? Should I pass both the first and second function as parameters in the tested one?
Note: some of the functions are called on objects (i.e. someObj.Create()) and use HTTP API calls.
UPDATE for clarification:
Example: functions
func f1() error {
  ... //some API call
}

func (s *SomeStruct) f2() error {
  return f1
}

func f3() error {
  return nil
}

func f4() error {
  ...
  err = obj.f2()
  ...
  err = f3()
  ...
}

For the above: if I want to test f4, what's the best way to mock f2 and f3?
If I pass f2 and f3 to f4 as parameters it would work, but then what for the f2 test? Should I pass f1 to f2 as parameter?
And if that's it, should then f4 have f1 as well in the parameters?

A: As a general guideline, functions aren't very mockable so its in our best interests to mock structs that implement a certain interface that may be passed into functions to test the different branches of code. See below for a basic example.
package a

type DoSomethingInterface interface {
    DoSomething() error
}

func DoSomething(a DoSomethingInterface) {
    if err := a.DoSomething(); err != nil {
        fmt.Println("error occurred")
        return
    }
    fmt.Println("no error occurred")
    return
}

package a_test

import (
    "testing"
    "<path to a>/a"
)

type simpleMock struct {
    err error
}

func (m *simpleMock) DoSomething() error {
    return m.err
}

func TestDoSomething(t *testing.T) {
    errorMock := &simpleMock{errors.New("some error")}
    a.DoSomething(errorMock)
    // test that "an error occurred" is logged

    regularMock := &simpleMock{}
    a.DoSomething(regularMock)
    // test "no error occurred" is logged
}

In the above example, you would test the DoSomething function and the branches that happens eg. you would create an instance of the mock with an error for one test case and create another instance of the mock without the error to test the other case. The respective cases are to test a certain string has been logged to standard out; in this case it would be "error occurred" when simpleMock is instantiated with an error and "no error occurred" when there simpleMock is not instantiated with an error.
This can of course be expanded to other cases eg. the DoSomething function actually returns some kind of value and you want to make an assertion on the value.
Edit:
I updated the code with the concern that the interface lives in another package. Note that the new updated code has a package a that contains the interface and the function under test and a package a_test that is merely a template of how to approach testing a.DoSomething.

A: I'm not sure what you're trying to do here but I'll explain how testing should be done in Go.
Lets say we have an application with the following directory hierarchy:
root/
  pack1/
    pack1.go
    pack1_test.go
  pack2/
    pack2.go
    pack2_test.go
  main.go
  main_test.go

We'll assume that pack2.go has the functions you want to test:
package pack2

func f1() error {
  ... //some API call
}

func (s *SomeStruct) f2() error {
  return f1
}

func f3() error {
  return nil
}

func f4() error {
  ...
  err = obj.f2()
  ...
  err = f3()
  ...
}

Looks good so far. Now if you want to test the functions in pack2, you would create a file called pack2_test.go. All test files in go are named similarly (packagename_test.go). Now lets see the inside of a typical test for a package (pack2_test.go in this example):
package pack2

import (
  "testing"
  "fmt"
)

TestF1(*testing.T) {
  x := "something for testing"
  f1() // This tests f1 from the package "pact2.go"
}

TestF2(*testing.T) {
    y := new(somestruct)
    y.f2() // tests f2 from package "pact2.go"
}

TestF3(*testing.T) {
   /// some code
   f3() // tests f3
}

TestF4(*testing.T) {
    /// code
    f3() // you get the gist
}

Let me explain. Notice how in pack2_test.go, the first line says that the package is pack2. In a nutshell, this means that we're in the "scope" of the package pack2 and thus all the functions found in pack2 can be called as if you're within pack2. Thats why, within the Testf* functions, we could've called the functions from pack2. Another thing to note is the imported package "testing". This helps with two things:
First, it provides some functionality for running tests. I won't go into that.
Second, it helps identify the functions that go test should run.
Now to the functions. Any function within a test package that has the prefix "Test" and the parameters "t *testing.T" (you can use "*testing.T" when you don't need to use the testing functionality) will be executed when you run  go test. You use the variable t to reference the testing functionality I mentioned. You can also declare functions without the prefix and call them within the prefixed functions.
So, if I go to my terminal and run go test, it will execute the functions you want to test, specified in pack2_test.go
You can learn more about testing here and here


text:
Q: JavaFX add a component to a list, dynamically changing it's content Using Fxml, I have my main screen with a ListView on it.
I have then made a separate Fxml. This is called a card and displays financial stock information (Stock symbol and current price with 2 labels)
How would I create multiple instances of the card so that they each have a different stock name and price, and the price can be updated?
public ListView searchList;
public Button searchButton;

@FXML
public void handleSearchButton(ActionEvent event) throws IOException {
    loadFxml();
}

public void loadFxml () throws IOException {
    Pane newLoadedPane = FXMLLoader.load(getClass().getResource("card.fxml"));
    searchList.getItems().add(newLoadedPane);
}

Currently that code will add a hard coded version of the card to the ListView. And I believe they are all the same, so if I were to update the text, they would all update.

A: To create multiple instances of the UI component defined by your FXML, you simply load the FXML file multiple times. If you want each to have different data, define methods in the controller to change the data. Then you can basically do
for (int i = 0 ; i < numberOfStocks ; i++) {
    FXMLLoader loader = new FXMLLoader(getClass().getResource("card.fxml"));
    Pane stockView = loader.load();
    StockController controller = loader.getController();
    controller.setXXX(...);
    // ...
}

I strongly do not recommend populating a ListView with UI nodes, as you show in the code in the question. UI elements are quite expensive objects to create (they have hundreds of properties, and are supported by CSS which may need to be parsed, etc). The data you are representing is pretty simple: a string and a double representing the stock symbol and price. A ListView is designed to be highly efficient, in that it only creates UI elements for the visible data, reusing those elements as, for example, the user scrolls through them. So your ListView should use only the data in its backing list, not the UI elements.
So create a simple class to represent a stock:
public class Stock {

    private final String symbol ; // doesn't change

    private final DoubleProperty price = new SimpleDoubleProperty() ; // mutable and observable

    public Stock(String symbol, double price) {
        this.symbol = symbol ;
        setPrice(price);
    }

    public DoubleProperty priceProperty() {
        return price ;
    }

    public final double getPrice() {
        return priceProperty().get();
    }

    public final void setPrice(double price) {
        priceProperty().set(price);
    }

    public String getSymbol() {
        return symbol ;
    }
}

This Stock class used JavaFX properties which will make it easy to bind to them later (so the UI can automatically update if the price changes).
Now you can define a simple FXML:
<!-- imports etc -->

<VBox xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.StockController"/>
    <Label fx:id="symbolLabel"/>
    <Label fx:id="priceLabel" />
</VBox>

with its controller, which can implement the binding of the labels to the stock it is displaying:
public class StockController {

    private Stock stock ;

    @FXML
    private Label symbolLabel ;

    @FXML
    private Label priceLabel ;

    public void setStock(Stock stock) {
        this.stock = stock ;
        priceLabel.textProperty().unbind();
        if (stock == null) {
            symbolLabel.setText(null);
            priceLabel.setText(null);
        } else {
            symbolLabel.setText(stock.getSymbol());
            priceLabel.textProperty().bind(stock.priceProperty().asString("Price: $%.2f"));
        }
    }
}

Now you can create a ListView<Stock> and use its cell factory to display each stock using the FXML:
public class MainController {

    @FXML
    private ListView<Stock> searchList ;

    public void initialize() {
        searchList.setCellFactory(lv -> new StockListCell());
    }

}

public class StockListCell extends ListCell<Stock> {

    private final Pane stockView ;
    private final StockController stockController ;

    public StockListCell() {
        try {
            FXMLLoader loader = new FXMLLoader(getClass().getResource("card.fxml"));
            stockView = loader.load();
            stockController = loader.getController();
            setGraphic(stockView);
            setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
        } catch (IOException exc) {
            // IOException here is fatal:
            throw new UncheckedIOException(exc);
        }
    }

    @Override
    protected void updateItem(Stock item, boolean empty) {
        super.updateItem(item, empty);
        stockController.setStock(item);
    }
}

Note that the ListView will not create many StockListCells (just one for each visible cell), so it's OK to do fairly heavy work (such as loading the FXML) in the constructor. The updateItem(...) method, by contrast, might be called quite frequently (e.g. as the user scrolls), and should do minimal work. Here we just update the stock that our UI is displaying, which just essentially changes the text of a couple of labels.
And, finally, you can simply populate the list view with Stocks as you expect:
for (int i = 0 ; i < numberOfStocks ; i++) {
    String symbol = "Stock "+i ;
    double price = 1000*Math.random();
    Stock stock = new Stock(symbol, price) ;
    searchList.getItems().add(stock);
}


text:
Q: About SKU in magento I want to know if i created one simple product with e.g sku:YJR
then i have to create the same product as bundle product with same sku, then it create any problem in future, if not then what's the rightway ?
Any guidence is accepted.
Thanks in advance.

A: Firstly I would like to tell you something about : SKU
SKU StockKeeping Unit, is a unique identification code, usually alphanumeric. It allows a particular product to be tracked for inventory purposes. Typically, an SKU (pronounced with the individual letters or as SKYEW) is associated with any purchasable item in a store or catalog. You can choose any format you like for SKU but usually there is some system for choosing numbers, for example, a woman's blouse of a particular style and size might have an SKU of "3726-8," meaning "Style 3726, size 8."
SKU is unique identification code.You can not create a product a with already existed SKU its not possible.
Hope this one is useful for you


text:
Q: Python pysqlite2 dbapi2 problem I'm having an issue with the line:
from pysqlite2 import dbapi2 as sqlite

The error i'm getting is:
ImportError: /usr/lib/python2.4/site-packages/pysqlite2/_sqlite.so: undefined symbol: sqlite3_enable_shared_cache

What can I do to solve this problem?
Thanks!

A: Sounds like _sqlite.so was compiled against a newer version of sqlite than you have installed.  That function wasn't added to SQLite's API until version 3.5.0.

A: The easiest way around this problem is to get the AS package Python 2.6 or later from Activestate and install that. It comes with SQLITE in the standard library.
The AS package is a tarball and you install it in a user directory by running a shell script after unpacking the archive. This does not touch any of the Python bits installed with your system, and gives you a fully controlled Python environment that is easy to replicate on other systems regardless of the distro.
Python's packaging system doesn't interoperate well with Linux distro package systems, especially because the Linux distros can be considerably out of date.


text:
Q: knex with pg_column_size in the returning function
*

*Knex: 0.95.12

*Database: PostgreSQL 11.7

*OS: Debian GNU/Linux 9 (stretch) (official Docker image)

*Node: v12.22.6

Is it possible for knex to return the results of a call to pg_column_size via the returning function call?
This works in native SQL:
create table "MyTable"
(
    "ID"       serial
        constraint "MyTable_pkey"
            primary key,
    "MyColumn" varchar
);

INSERT INTO "MyTable" ("MyColumn")
VALUES ('Whatever')
RETURNING "ID", pg_column_size("MyColumn");

Result:
+--+--------------+
|ID|pg_column_size|
+--+--------------+
|4 |9             |
+--+--------------+

But I suppose I'm not surprised that knex expects an actual column to return when doing ...
.returning(["ID", 'pg_column_size("MyColumn")'])

Result:
ERROR:  column "pg_column_size("MyColumn")" does not exist ...

I am hoping for a way to return that data without resorting to a subsequent select query after the insert.

A: A fix is to use knex.raw() inside the returning array like this:
.returning(["ID", source.raw('pg_column_size("MyColumn")')])

Worked for me on a similar issue where i had to run a query in there.
(Just in case, make sure to be on Knex latest version - as today - v1.0.7)


text:
Q: To prove the Upper Riemann Integral $\geq$ Lower Riemann Integral This is the question below :

Problem.1) Prove that if $f : [a, b] \to \mathbb{R}$ is a bounded function, then
  $$ \underline{\int_{a}^{b}} f(x) \, \mathrm{d}x \leq \overline{\int_{a}^{b}} f(x) \, \mathrm{d}x. $$

This is my attempt at the question, I would like to get some guidance on how to go about doing this proof and the corresponding notation.
Attempted Solution.2)
$$ \text{For any partition } \Delta x = x_{i} - x_{i-1} $$
$$ \inf\left(f(x)\right) \leq \sup\left(f(x)\right) \ : \ x \in [x_{i-1}, x_{i}] $$
$$
m_{i} = \inf\{ f(x) : x \in [x_{i-1}, x_{i}]\}
\leq
M_i = \sup\{ f(x) : x \in [x_{i-1}, x_{i}]\}
$$
$$
L(P, f) = \sum_{i=1}^{n} m_{i} \Delta x_{i}
\leq
U(P, f) = \sum_{i=1}^{n} M_{i} \Delta x_{i}
$$
$$ \underline{\int_{a}^{b}} f(x) \, \mathrm{d}x = \sup\{ L(P, f) : P \in \mathcal{P}[a, b]\}
\leq \overline{\int_{a}^{b}} f(x) \, \mathrm{d}x = \inf\{ U(P, f) : P \in \mathcal{P}[a, b]\}, $$
where $\mathcal{P}$ is a partition.
$$ \underline{\int_{a}^{b}} f(x) \, \mathrm{d}x \leq \overline{\int_{a}^{b}} f(x) \, \mathrm{d}x. $$

From the editor. Some typos are fixed by the editor, such as incorrect use of inf/sup and upper/lower sums, as well as sudden change in fonts.

A: Your first steps show that $L(P,f) \leqslant U(P,f)$, where the same partition $P$ is used in the lower and upper sum. To finish you need to show that for (different) partitions $P$ and $Q$ we also have
$$\tag{*}L(P,f) \leqslant U(Q,f)$$
It then would follow that with $Q$ fixed,
$$\sup_P L(P,f) \leqslant U(Q,f),$$
and, subsequently,
$$\sup_P L(P,f) \leqslant \inf_QU(Q,f)$$
To prove (*) take a common refinement $R = P \cup Q$ and show that we must have
$$L(P,f) \leqslant L(R,f) \leqslant U(R,f) \leqslant U(Q,f)$$
I'll leave that to you with the hint that you should consider what happens to the ordering of lower and upper sums when a single new point is added to a partition.


text:
Q: What is the minimum set of permissions when using Facebook login with omniauth? I am using omniauth-facebook 1.4.1 with Ruby on Rails 3.2.8
I want users to be able to authenticate using their Facebook account. All I need from them is their email address or first name.
How do I configure omniauth so that I get just the email or first name?
Specifying 'email' as :scope comes back far more data than just email.
config.omniauth :facebook, "appid", "appkey", :strategy_class => OmniAuth::Strategies::Facebook, :scope => 'email'

A: Same here, but it's not possible as basic information includes the friend list.
From official docs:

  Reference

  Basic Info (Default)

  Basic info is part of every request for permissions.  It includes
  several elements from a person's public profile and a list of their
  friends.
On the web, basic_info is implied with every request
  and isn't required, although the best practice is to include it.
  Passing basic_info is required on iOS and Android
  with every permission request.
A person's public profile refers to the following properties on the
  user object by default:

*
*id
*name

*first_name
*last_name

*link
*username

*gender
*locale
*age_range

*Other public information The friend list is the friend list node on
  the user object.User permissionDescriptionbasic_infoGives
  access to a subset of a person's public profile and friend list.
  Required when requesting permissions on iOS and
  Android.


text:
Q: Finding missing matrix values We have three matrices A; B; C that satisfy AB = C and such that
$$
A =
\begin{pmatrix}
-1&2&-2&*\\
2&-3&*&1\\
0&-1&2&1
\end{pmatrix}
$$
$$B =
\begin{pmatrix}
2&3&*&4\\
-1&*&0&1\\
*&1&-2&0\\
0&1&0&1
\end{pmatrix}
$$
$$
C =
\begin{pmatrix}
*&2&5&1\\
*&1&-2&-6\\
3&1&-4&0
\end{pmatrix}
$$
where a  indicates a missing values. Find the missing values and show the resulting
matrices A; B; C.
After, multiplying A and B, I get the following matrix.
$$
AB =
\begin{pmatrix}
-2&-2&-2*&0\\
6&-3*&*&1\\
0&-1&-4&1
\end{pmatrix}
$$
Do I set AB equal to C and solve by getting it to reduced row echelon form? After that, assuming I get values for *, how do I know which * value goes to which matrix?

A: Just give labels to the unspecified entries, like $a,b,c,\ldots$. And it appears that your matrix multiplication is broken. See here for the correct result, for instance.


text:
Q: HTML 5, History.js and Jquery .load() implementation I am trying to teach myself how to use HTML5 hisory api and jquery to create a web app.
I am loading the contents of a page into a div but when I try to go back or forward, nothing happens. Below is the code
$(document).on('click',".ul_links",function(e){

      loader_img();

      var teamid = $(this).attr('id');
      var href = '/Myapp/Pages/FundingSourceView.php?teamid='+teamid;

      $('#midpanel').load(href,function(response,status,xhr){
          if(status=='error')
          {
              alert('An error occured. Contact admin. Specific error is '+ xhr.status + " " + xhr.statusText);

          }
          });

           var currentState = history.state;
           History.pushState(currentState,'',href);

           e.preventDefault();
          return false

      });

I am using the History.js plugin and I am having some difficulty implementing this feature.
I get 404 errors if the variable href is not absolute. When href is absolute, the link works but I cannot use the forward or back buttons to load the previous contents
All help greatly appreciated.


text:
Q: How to write own browser for the Android, without re-inventing the wheel? I really don't want to write an entire browser from scratch but the answers I received so far, regarding the ability to access rendered Javascript OUTPUT in existing WebView, lead me to believe that this is the ONLY way for me to accomplish that.
How do I write my own NON-VISUAL web browser for the Android, without re-inventing the wheel?

A: Having never developed for Android, I'm afraid I'd be of limited help, so take this with a grain of salt.
I see three options, the hard way writing from scratch (re-inventing the wheel)
A second option which combines existing tools with a minimal wrapper written by yourself, for which the basic components you would need are:

*

*A DOM Parser

*JavaScript engine (e.g. V8)

*wget

The last option would be to go the way of NVDA. And it might be worth working with them directly on something like this.
I'm not familiar enough with the inner-workings of NVDA to speak on their methods specifically, however it is a rather successful project and a working model of what your trying to do, albeit on a different platform.

A:
How do I write my own NON-VISUAL web browser for the Android, without re-inventing the wheel?

Screen readers for Windows computers, like Jaws, rely on what the browser shows them.


text:
Q: zeep SOAP client unexpected double base64 encoding Please help me understand why value in my request gets encoded to base64 twice:
relevant parts of wsdl, that I use:
<wsdl:types>
      <xsd:schema targetNamespace="http://www.blabla.com/">
         <xsd:element name="createHeaderSecurityRequest" type="xsd:base64Binary"/>

 <wsdl:message name="createHeaderSecurityRequestMessage">
      <wsdl:part element="tns:createHeaderSecurityRequest" name="parameters"/>
   </wsdl:message>

<wsdl:operation name="createHeaderSecurity">
         <wsdl:input message="tns:createHeaderSecurityRequestMessage"/>
         <wsdl:output message="tns:createHeaderSecurityResponseMessage"/>
         <wsdl:fault message="tns:faultMessage" name="createHeaderSecurityFaultMessage"/>
/wsdl:operation>

my code:
from zeep import Client
message = 'my message, that needs to be encoded in base64 only once'
wsdl = 'http://xxxxxxx?wsdl'
client = Client(wsdl)
request = client.create_message(client.service, 'createHeaderSecurity', message.encode())

what I get(message automatically encoded to base64 twice): request =
<soap-env:Body xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
   <ns0:createHeaderSecurityRequest xmlns:ns0="http://www.blabla.com/">YlhrZ2JXVnpjMkZuWlN3Z2RHaGhkQ0J1WldWa2N5QjBieUJpWlNCbGJtTnZaR1ZrSUdsdUlHSmhjMlUyTkNCdmJteDVJRzl1WTJVPQ==</ns0:createHeaderSecurityRequest>
</soap-env:Body>

what I want (message value encoded to base64 only once): request =
<soap-env:Body xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
   <ns0:createHeaderSecurityRequest xmlns:ns0="http://www.blabla.com/">bXkgbWVzc2FnZSwgdGhhdCBuZWVkcyB0byBiZSBlbmNvZGVkIGluIGJhc2U2NCBvbmx5IG9uY2U=</ns0:createHeaderSecurityRequest>
</soap-env:Body>

I will be very grateful for any help
zeep 3.4.0
python 3.7.3

A: Try to remove encode() on your string.
request = client.create_message(client.service, 'createHeaderSecurity', message)

Zeep automatically encodes bytes data to base64.


text:
Q: SSH not passing LANG environment variable I'm running a Debian server (uname -v output #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23)). When I log in from any of several clients (macOS 10.13 laptop with default ssh, the "Prompt" app on iOS, among others), LANG=C, despite passing in LANG=en_US.UTF-8 from the client. Here is some relevant information:
client$ env | grep LANG
LANG=en_US.UTF-8
client$ ssh -v server
...
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
server$ env | grep LANG
LANG=C
server$ grep -in lang /etc/profile ~/.bash_profile ~/.bash_login ~/.profile ~/.bash_logout ~/.bashrc
grep: ~/.bash_profile: No such file or directory
grep: ~/.bash_login: No such file or directory
server$ locale -a
C
C.UTF-8
POSIX
en_US.utf8
server$ sudo sshd -T | grep acceptenv
acceptenv LANG
acceptenv LC_*

So, ssh claims to be sending LANG, sshd claims to be accepting LANG, and LANG is not being set in any of the bash startup/shutdown files.
I know I could "fix" this with a setting in ~/.profile or somesuch, but I'm more interested in why the environment isn't getting passed properly.
Edit:
I just noticed that the LANG name is different on macOS and Debian. This still doesn't work, however:
client$ LANG=en_US.utf8 ssh -v server
...
debug1: Sending environment.
debug1: Sending env LANG = en_US.utf8
server$ env | grep LANG
LANG=C

Edit 2:
This difference in names isn't, it turns out, a Mac-vs-Linux issue. locale -a reports a different name for the locale than is used by $LANG. I haven't bothered to investigate why.

A: In my Kubuntu or Debian there is a file /etc/default/locale like:

#  File generated by update-locale
LANG="pl_PL.UTF-8"

It is mentioned in various /etc/pam.d/* files. This is a fragment of /etc/pam.d/sshd:

# Read environment variables from /etc/environment and
# /etc/security/pam_env.conf.
session    required     pam_env.so # [1]
# In Debian 4.0 (etch), locale-related environment variables were moved to
# /etc/default/locale, so read that as well.
session    required     pam_env.so user_readenv=1 envfile=/etc/default/locale

Now from man 5 pam.conf:

When a PAM aware privilege granting application is started, it activates its attachment to the PAM-API. This activation performs a number of tasks, the most important being the reading of the configuration file(s): /etc/pam.conf. Alternatively, this may be the contents of the /etc/pam.d/ directory. The presence of this directory will cause Linux-PAM to ignore /etc/pam.conf.

When a user logs in via SSH, sshd forks itself and this is the moment /etc/pam.d/sshd does its job. See man 8 pam_env, it is responsible for setting/unsetting environment variables. I wasn't sure if sshd forks before or after accepting variables from a client, so I made a simple test. I commented out this single line on my Debian server:

session    required     pam_env.so user_readenv=1 envfile=/etc/default/locale

and the issue you pointed out was fixed (tested with LANG=C ssh myserver in my case). I uncommented the line and the issue reappeared.


text:
Q: Replace Emojis in R with replace_emoji() function does not work due to different encoding - UTF8/Unicode? I am trying to clean my text data and replace Emojis with words so that I can perform a sentiment analysis later on.
Therefore, I am using the replace_emoji function from the textclean package. This should replace all emojis with their corresponding words.
The dataset I am working with is a text corpus, that is also the reason why I used the  VCorpus function from the tm package in my sample code below:
text <- "text goes here bla bla <u+0001f926><u+0001f3fd><u+200d><u+2640><u+fe0f>" #text with emojis

text.corpus <- VCorpus(VectorSource(text)) #Transforming into corpus
text.corpus <- tm_map(text.corpus, content_transformer(function(x) replace_emoji(x, emoji_dt = lexicon::hash_emojis)))  #This function should change Emojis into words

inspect(text.corpus[[1]]) #inspecting the corpus shows that the Unicode was NOT replaced with words

head(hash_emojis) #This shows that the encoding in the lexicon is different than the encoding in my text data.

Although the function itself works, it does not replace emojis in my text as it seems that the Encoding within the "hash_emojis" dataset is different than the one I have in my data. Thus, the function does not replace the Emojis into words. I have also tried to convert the "hash_emojis" data by using the iconv function but unfortunately did not manage to change the encoding.
I would like to replace the Unicode values are shown in my dataset with words.

A: I found an answer to your question. I will mark this one as a duplicate later today when you read my answer.
Using my example:
library(stringi)
library(magrittr)

"text goes here bla bla <u+0001F600><u+0001f602>"  %>%
  stri_replace_all_regex("<u\\+([[:alnum:]]{4})>", "\\\\u$1") %>%
  stri_replace_all_regex("<u\\+([[:alnum:]]{5})>", "\\\\U000$1") %>%
  stri_replace_all_regex("<u\\+([[:alnum:]]{6})>", "\\\\U00$1") %>%
  stri_replace_all_regex("<u\\+([[:alnum:]]{7})>", "\\\\U0$1") %>%
  stri_replace_all_regex("<u\\+([[:alnum:]]{8})>", "\\\\U$1") %>%
  stri_replace_all_regex("<u\\+([[:alnum:]]{1})>", "\\\\u000$1") %>%
  stri_replace_all_regex("<u\\+([[:alnum:]]{2})>", "\\\\u00$1") %>%
  stri_replace_all_regex("<u\\+([[:alnum:]]{3})>", "\\\\u0$1") %>%
  stri_unescape_unicode() %>%
  stri_enc_toutf8() %>%
  textclean::replace_emoji()

[1] "text goes here bla bla grinning face face with tears of joy "

Now be carefull of the unicode representation. The example answer has the "U" in upper case, I changed this to lower case "u" to reflect your example.
To combine everything:
# create a function to use within tm_map
unicode_replacement <- function(text) {
  text %>%
    stri_replace_all_regex("<u\\+([[:alnum:]]{4})>", "\\\\u$1") %>%
    stri_replace_all_regex("<u\\+([[:alnum:]]{5})>", "\\\\U000$1") %>%
    stri_replace_all_regex("<u\\+([[:alnum:]]{6})>", "\\\\U00$1") %>%
    stri_replace_all_regex("<u\\+([[:alnum:]]{7})>", "\\\\U0$1") %>%
    stri_replace_all_regex("<u\\+([[:alnum:]]{8})>", "\\\\U$1") %>%
    stri_replace_all_regex("<u\\+([[:alnum:]]{1})>", "\\\\u000$1") %>%
    stri_replace_all_regex("<u\\+([[:alnum:]]{2})>", "\\\\u00$1") %>%
    stri_replace_all_regex("<u\\+([[:alnum:]]{3})>", "\\\\u0$1") %>%
    stri_unescape_unicode() %>%
    stri_enc_toutf8()
}

library(tm)
library(textclean)
text.corpus <- VCorpus(VectorSource(text)) #Transforming into corpus
text.corpus <- tm_map(text.corpus, content_transformer(unicode_replacement))
text.corpus <- tm_map(text.corpus, content_transformer(function(x) replace_emoji(x, emoji_dt = lexicon::hash_emojis)))

inspect(text.corpus[[1]])

<<PlainTextDocument>>
Metadata:  7
Content:  chars: 92

text goes here bla bla <f0><9f><a4><a6><f0><9f><8f><bd><e2><80><8d> female sign <ef><b8><8f>

Now using your example you get the above outcome. Checking the emoji tables, your unicode examples do not appear in the table except for the female sign. But that is another issue. If I use "text goes here bla bla " the outcome is as expected.


text:
Q: Abelian group generated by two elements subject to two relations isomorphic to a quotient group We were given the following example in lectures:
Consider the abelian group $G$ generated by $a$ and $b$ such that the relations
$2a + b = 0 $
$-a + 2b = 0$
hold.
Then $G \cong \frac{\mathbb{Z}^2}{N}$ where $N$ is generated by $(2,1)$ and $(-1,2)$.
Question: I can't seem to understand why this is the case.
Attempt at a solution: I have tried to write an explicit isomorphism e.g.
$\phi : G \rightarrow \frac{\mathbb{Z}^2}{N}$
$a \mapsto (2,1)$, $b\mapsto (-1,2)$ - does this even work?
Alternatively this might just be a case of applying the isomorphism theorem, but I'm not sure how to surject $G$ into $\mathbb{Z}^2$....
Any help would be appreciated!

A: The free Abelian group $F$ generated by two elements $a,b$ is isomorphic to $\Bbb Z^2$ by sending $a$ to $(1,0)$ and $b$ to $(0,1)$.
Then the relation $2a+b\ \sim\ 0$ turns into $(2,1)\sim(0,0)$, so in order to obtain it as equality, we consider the quotient $F/\langle 2a+b\rangle$, or, via the isomorphism, $\Bbb Z^2/\langle (2,1)\rangle$.
And similarly for the other relation.
The first isomorphism theorem is a good attempt, but do it the other way around: look for a surjective map $\Bbb Z^2\to G$ whose kernel is just $\langle (2,1),\,(-1,2)\rangle$.

A: Write an explicit isomorphism in the other direction. Start with
$$
\psi : \mathbb Z^2 \to G,
\qquad
\psi(1,0)=a,
\qquad
\psi(0,1)=b
$$
or $\psi(x,y)=xa+yb$.
Then $\psi$ is a surjective homomorphism with kernel $N$. This latter part is the one that needs careful checking.
Here is an ad hoc solution.

*

*$b=-2a$ implies that $G = \langle a,b \rangle = \langle a \rangle$.

*$a=-2b$ implies $5a=0$ and so $a=0$ (and $G$ is trivial) or $a$ has order $5$. Let's assume the latter.

*$\psi(x,y)=xa+yb=(x-2y)a$ and so $\psi(x,y)=0$ iff $x-2y \equiv 0 \bmod 5$. Write $x-2y=5k$.

*We want to write $(x,y)=u(2,1)+v(-1,2)$. The solution is
$$
u = (2 x + y)/5 = 2k + y ,\quad v = (2 y - x)/5  = -k
$$


text:
Q: OS Distro benchmarks website? Im looking for website which contains OS distro benchmarks (comparing in 32 & 64 bit, comparing PHP execution on the distro, etc.)

A: Phoronix is really good about os benchamrks:
http://www.phoronix.com/scan.php?page=category&item=Operating%20Systems


text:
Q: How do I make it so that if my input is lower or capital, my bot responds responds I made a pls search (command from dank memer) command, but it only responds when I type in the exact word as the key in my dictionary search_list. I'm trying to make it so that the argument I enter is case insensitive, for example after I type pls search, it should respond to Park or park or PARK (This is typed during the wait_for() function).
My code:
@client.command()
@commands.cooldown(1, 7, commands.BucketType.user)
async def search(ctx):
  amount_of_coins_found = random.randrange(3000)
  search_list = {
    "Sewer": f'You searched the sewer and found {amount_of_coins_found} coins!',
    'Area51': f'You raided Area51 and found {amount_of_coins_found} coins! NOW RUN THE GOVERNMENT IS CHASING YOU!',
    'Tree': f'You climbed the tree and found {amount_of_coins_found} coins! Good thing you didn\'t fall off and break your neck.',
    'Dog': f'You pet the dog and found {amount_of_coins_found} coins! That poor poor dog... Doge also got mad at you and slapped you! You died!',
    'Street': f'You searched the street and found {amount_of_coins_found} coins! Good thing you didn\'t get run over by a bus!',
    'Hospital': f'You searched the hospital and found {amount_of_coins_found} coins! Did you steal from a sick person?!',
    'Dumpster': f'You climbed inside the dumpster and found {amount_of_coins_found} coins! Good thing the garbage truck only comes on Thursdays.',
    'Air': f'You searched the air and found {amount_of_coins_found} coins!',
    'Attic': f'You searched the attic and found {amount_of_coins_found} coins!',
    'Bank': f'You searched the bank and found {amount_of_coins_found} coins! WTF did you just rob that bank?!',
    'Bed': f'You searched your bed and found {amount_of_coins_found} coins! I wonder how that got there...',
    'Bus': f'You looked under the bus seat and found {amount_of_coins_found} coins! You also found a peice of gum.',
    'Bushes': f'You looked in the bushes and found {amount_of_coins_found} coins! Good thing you didn\'t get pricked, you lucky prick!',
    'Uber': f'You searched the Uber and found {amount_of_coins_found} coins! Did you just steal from your uber driver?',
    'Car': f'You searched the car and found {amount_of_coins_found} coins!',
    'Coat': f'You searched your coat and found {amount_of_coins_found} coins! I wonder how long that has been there...',
    'Couch': f'You couchsurfed and found {amount_of_coins_found} coins! You also found your TV remote from 10 years ago.',
    'Discord': f'You sifted through your dms and found {amount_of_coins_found} coins!',
    'Dresser': f'While looking for your pants, you found {amount_of_coins_found} coins!',
    'Laundromat': f'You searched the laundromat and found {amount_of_coins_found} coins!',
    'Mailbox': f'You searched your mailbox and found {amount_of_coins_found} coins plus a love letter from a creepy stalker.',
    'Pocket': f'You reached into your pocket and found {amount_of_coins_found} coins!',
    'Purse': f'You looked in an old lady\'s purse and found {amount_of_coins_found} coins!',
    'Grass': f'You searched the grass and found {amount_of_coins_found} coins!',
    'Pantry': f'While looking for the cookies, you found {amount_of_coins_found} coins!',
    'Shoe': f'You took off your shoe and found {amount_of_coins_found} coins!',
    'Sink': f'You searched in the sink and found {amount_of_coins_found} coins!'
  }

  a = random.choice(list(search_list.keys()))
  b = random.choice(list(search_list.keys()))
  c = random.choice(list(search_list.keys()))

  if a == b or a == c or b == c:
    a = random.choice(list(search_list.keys()))
    b = random.choice(list(search_list.keys()))
    c = random.choice(list(search_list.keys()))

  message = await ctx.send(f"<@{ctx.author.id}> Where do you want to search?\n Pick from the list below and type it in the chat:\n`{a}`, `{b}`, `{c}`")
  message = await client.wait_for('message', timeout=10, check=lambda message: message.author == ctx.author)
  await open_account(ctx.author)
  if message.content.startswith(a):
    await message.channel.send(str(search_list.get(a)))
    await update_bank(ctx.author, amount_of_coins_found)
  if message.content.startswith(b):
    await message.channel.send(str(search_list.get(b)))
    await update_bank(ctx.author, amount_of_coins_found)
  if message.content.startswith(c):
    await message.channel.send(str(search_list.get(c)))
    await update_bank(ctx.author, amount_of_coins_found)
  if message.content != a or b or c:
    await ctx.send(f"<@{ctx.author.id}> That's not a valid option lmao.")

A: You can use the lower() function. So your condition would look like this:
if message.content.lower().startswith(a.lower()):
    await message.channel.send(str(search_list.get(a)))
    await update_bank(ctx.author, amount_of_coins_found)
elif message.content.lower().startswith(b.lower()):
    await message.channel.send(str(search_list.get(b)))
    await update_bank(ctx.author, amount_of_coins_found)
elif message.content.lower().startswith(c.lower()):
    await message.channel.send(str(search_list.get(c)))
    await update_bank(ctx.author, amount_of_coins_found)
else:
    await ctx.send(f"{ctx.author.mention} That's not a valid option lmao.")

I found a few more issues with your command, so I went ahead and fixed them for you:
@client.command()
@commands.cooldown(1, 7, commands.BucketType.user)
async def search(ctx):
    amount_of_coins_found = random.randrange(3000)
    search_list = {
        'Sewer': f'You searched the sewer and found {amount_of_coins_found} coins!',
        'Area51': f'You raided Area51 and found {amount_of_coins_found} coins! NOW RUN THE GOVERNMENT IS CHASING YOU!',
        'Tree': f'You climbed the tree and found {amount_of_coins_found} coins! Good thing you didn\'t fall off and break your neck.',
        'Dog': f'You pet the dog and found {amount_of_coins_found} coins! That poor poor dog... Doge also got mad at you and slapped you! You died!',
        'Street': f'You searched the street and found {amount_of_coins_found} coins! Good thing you didn\'t get run over by a bus!',
        'Hospital': f'You searched the hospital and found {amount_of_coins_found} coins! Did you steal from a sick person?!',
        'Dumpster': f'You climbed inside the dumpster and found {amount_of_coins_found} coins! Good thing the garbage truck only comes on Thursdays.',
        'Air': f'You searched the air and found {amount_of_coins_found} coins!',
        'Attic': f'You searched the attic and found {amount_of_coins_found} coins!',
        'Bank': f'You searched the bank and found {amount_of_coins_found} coins! WTF did you just rob that bank?!',
        'Bed': f'You searched your bed and found {amount_of_coins_found} coins! I wonder how that got there...',
        'Bus': f'You looked under the bus seat and found {amount_of_coins_found} coins! You also found a peice of gum.',
        'Bushes': f'You looked in the bushes and found {amount_of_coins_found} coins! Good thing you didn\'t get pricked, you lucky prick!',
        'Uber': f'You searched the Uber and found {amount_of_coins_found} coins! Did you just steal from your uber driver?',
        'Car': f'You searched the car and found {amount_of_coins_found} coins!',
        'Coat': f'You searched your coat and found {amount_of_coins_found} coins! I wonder how long that has been there...',
        'Couch': f'You couchsurfed and found {amount_of_coins_found} coins! You also found your TV remote from 10 years ago.',
        'Discord': f'You sifted through your dms and found {amount_of_coins_found} coins!',
        'Dresser': f'While looking for your pants, you found {amount_of_coins_found} coins!',
        'Laundromat': f'You searched the laundromat and found {amount_of_coins_found} coins!',
        'Mailbox': f'You searched your mailbox and found {amount_of_coins_found} coins plus a love letter from a creepy stalker.',
        'Pocket': f'You reached into your pocket and found {amount_of_coins_found} coins!',
        'Purse': f'You looked in an old lady\'s purse and found {amount_of_coins_found} coins!',
        'Grass': f'You searched the grass and found {amount_of_coins_found} coins!',
        'Pantry': f'While looking for the cookies, you found {amount_of_coins_found} coins!',
        'Shoe': f'You took off your shoe and found {amount_of_coins_found} coins!',
        'Sink': f'You searched in the sink and found {amount_of_coins_found} coins!'
    }

    a = random.choice(list(search_list.keys()))
    search_list.pop(a)  # Removing a so that that b and c can never get it
    b = random.choice(list(search_list.keys()))
    search_list.pop(b)  # Removing b so that that c can never get it
    c = random.choice(list(search_list.keys()))

    await ctx.send(f"<@{ctx.author.id}> Where do you want to search?\n Pick from the list below and type it in the chat:\n`{a}`, `{b}`, `{c}`")

    try:
        message = await client.wait_for('message', timeout = 10, check = lambda message: message.author == ctx.author)
    except:
        await ctx.send("Sorry, you took too long to respond")
        return

    await open_account(ctx.author)

    if message.content.lower().startswith(a.lower()):
        await message.channel.send(str(search_list.get(a)))
        await update_bank(ctx.author, amount_of_coins_found)
    elif message.content.lower().startswith(b.lower()):
        await message.channel.send(str(search_list.get(b)))
        await update_bank(ctx.author, amount_of_coins_found)
    elif message.content.lower().startswith(c.lower()):
        await message.channel.send(str(search_list.get(c)))
        await update_bank(ctx.author, amount_of_coins_found)
    else:
        await ctx.send(f"{ctx.author.mention} That's not a valid option lmao.")

A: To add the case-insensitive command for your bot, you can do like this
bot = commands.Bot(command_prefix='!', case_insensitive=True)

So that every command will work with any cases['upper'/'lower'].
[documentation]

A: Use .lower() with a b c lowered too
if message.content.lower().startswith(a.lower()):
    await message.channel.send(str(search_list.get(a)))
    await update_bank(ctx.author, amount_of_coins_found)
elif message.content.lower().startswith(b.lower()):
    await message.channel.send(str(search_list.get(b)))
    await update_bank(ctx.author, amount_of_coins_found)
elif message.content.lower().startswith(c.lower()):
    await message.channel.send(str(search_list.get(c)))
    await update_bank(ctx.author, amount_of_coins_found)
elif message.content.lower() not in (a.lower(), b.lower(), c.lower()):
    await ctx.send(f"<@{ctx.author.id}> That's not a valid option lmao.")


text:
Q: The enveloping $C^*$ algebra of $C^k[0,1]$. We know that $C^k[0,1]$ is an abelian $*$-Banach algebra, but it is not a $C^*$ algebra in general unless $k=0$.
I wonder what's the enveloping $C^*$ algebra of $C^k[0,1]$? I guess it might be $C[0,1]$. However, I am not able to prove it right now.
What I can show right now is that the maximal ideal space of $C^k[0,1]$ is $[0,1]$, In another word, all the $1$ dimensional $*$-representation are in this form.
In order to find the enveloping $C^*$ algebra, I think we need to find all the $*$-representation instead of those in only $1$ dimension. However, I have no idea how to do this.
Any help will be truly grateful!

A: Observe that $f\in C^k=:A$ is invertible if and only if $f$ does not vanish on $[0,1].$ Hence $\sigma_A(f)=f([0,1]).$
For any $*$-representation $\pi: A\to B(\mathcal{H})$ and $f\in A,$ the operator $\pi(f)$  is normal. Therefore $$\|\pi(f)\|=\max\{|z|\in \mathbb{C}\,:\,z\in \sigma(\pi(f))\}$$
In other words the norm is equal to the spectral radius. As $\pi$ is a homomorphism ( $\pi(1)=I$) we have $$\sigma(\pi(f))\subset \sigma_A(f)=f([0,1])$$
Therefore
$$\|\pi(f)\|\le \max_{0\le x\le 1}|f(x)|=\|f\|_\infty$$
For every $t\in [0,1]$ we have the one-dimensional representation $\pi_t(f)=f(t).$ Therefore
$$\sup_{0\le t\le 1}\|\pi_t(f)\|=\|f\|_\infty$$
Summarizing the norm of $f$ in the $C^*$-enveloping algebra of $C^k[0,1]$ is equal $\|f\|_\infty.$ Therefore this algebra is $*$-isometrically isomorphic to $C[0,1].$
Remark Another way is to use the fact that the norm on the enveloping algebra can be determined by irreducible representations of $A,$ i.e. one-dimensional in the commutative case.


text:
Q: Stop dash running on server I want now to stop dash from running on my localhost and want to change code, then to run it again and to see the updates (p.s. dash is not running if debug = True).
The option CTRL+C does not work and dash does not stop. If I try to change code then run it again it does not work.
Thank you in advance for your reply and help!

A: In Jupyter Notebook Ctrl + C does not terminate your running code. You could either write your code to a .py file and execute it from the command line for example
python dash.py

where Ctrl + C is working or if you prefer to stick to Jupyter Notebook you can terminate the execution by clicking in the Jupyter Notebook menu Kernel --> Restart, change the code and run the cell again.

A: how about this, it kills the server, but i wish it would restart the kernel instead
import os, signal

os.kill(os.getpid(), signal.SIGTERM)


text:
Q: Reason for my interposer classes not being compiled? I have:
unit unt_QuantumGridInterceptor;

{$OPTIMIZATION OFF}

interface

uses
  { DevExpress }
  cxGridRows,
  cxGridTableView,
  cxGridCustomTableView,
  cxCustomData,
  cxGraphics;

type
  TcxGridDataCellViewInfo = class(cxGridRows.TcxGridDataCellViewInfo)
  protected
    procedure InitTextSelection; override;
  end;

  TcxGridDataRowViewInfo = class(cxGridRows.TcxGridDataRowViewInfo)
  protected
    function GetCellViewInfoClass(AIndex: Integer): TcxGridDataCellViewInfoClass;    override;
  end;

  TcxGridDataRow = class(cxGridTableView.TcxGridDataRow)
  protected
    function GetViewInfoClass: TcxCustomGridRecordViewInfoClass; override;
  end;

  TcxGridViewData = class(cxGridTableView.TcxGridViewData)
  protected
    function GetRecordClass(ARecordInfo: TcxRowInfo): TcxCustomGridRecordClass;   override;
  end;

implementation

....

end.

I use it as
unt frm_MainForm;

uses
  ...
  cxGridRows,
  cxGridTableView,
  cxGridCustomTableView,
  cxCustomData,
  cxGraphics
  cxClasses,
  cxData,
  cxGridRows,
  // Really the last unit
  unt_QuantumGridInterceptor;

type
  TcxGridDataCellViewInfo = class(unt_QuantumGridInterceptor.TcxGridDataCellViewInfo);
  TcxGridDataRowViewInfo = class(unt_QuantumGridInterceptor.TcxGridDataRowViewInfo);
  TcxGridDataRow = class(unt_QuantumGridInterceptor.TcxGridDataRow);
  TcxGridViewData = class(unt_QuantumGridInterceptor.TcxGridViewData);

  TfrmMainForm = class sealed(TForm)
  ...

but yet the interposer classes overriden methods do not get called and their brakepoints stay in "dark green" inactive color instead of "pale blue" active.
What I am missing?

A: I missed:
TcxGridBandedTableView = class(cxGridBandedTableView.TcxGridBandedTableView)
protected
  function GetViewDataClass: cxGridCustomView.TcxCustomGridViewDataClass; override;
end;