text:
Q: Функционирование button под z-index`ом селектора класса Самообучаюсь html/css, хотелось бы спросить у вас: каким образом возможно перекрыть классом .chat всю заданную область .slider, но в то же время сохранить в рабочем состоянии элементы под ним? К примеру класс .button1.

* {
  box-sizing: border-box;
}

body {
  font-family: 'Rajdhani', sans-serif;
  background: #ccccff;
}

.slider {
  width: 340px;
  min-height: 580px;
  overflow: hidden;
  margin: 0 auto;
  position: relative;
  padding-bottom: 30px;
  background: #f7f6ee;
}

.slide {
  position: absolute;
  opacity: 0;
  transition: all 0.4s ease-in;
}

input[type="radio"],
input[type="checkbox"] {
  width: 0;
  height: 0;
  overflow: hidden;
  position: absolute;
  border: 0;
  padding: 0;
  margin: -1px;
}

.slider>label {
  margin: 0 0 0 120px;
  width: 20px;
  height: 5px;
  border-radius: 5px;
  background: #4b3730;
  position: absolute;
  bottom: 22px;
  transition: all .4s ease;
  z-index: 2;
  cursor: pointer;
}

label.second {
  left: 8%;
}

label.third {
  left: 16%;
}

label.fourth {
  left: 24%;
}

#first:checked~div.one {
  left: 0;
  opacity: 1;
}

#second:checked~div.two {
  left: 0;
  opacity: 1;
}

#third:checked~div.three {
  left: 0;
  opacity: 1;
}

#fourth:checked~div.four {
  left: 0;
  opacity: 1;
}

#commentbutton:checked~div.chat {
  left: 0;
  opacity: 1;
}

.slider>label:hover {
  background: orange;
  transform: scale(1);
}

span {
  position: relative;
  font-size: 500%;
  color: black;
}

.one h2 {
  position: absolute;
  top: 135px;
  left: 20px;
  font-weight: lighter;
  font-size: 15px;
  color: white;
  text-shadow: 1px 1px 1px black;
}

.one h1 {
  position: absolute;
  color: white;
  top: 155px;
  left: 20px;
  text-shadow: 1px 1px 1px black;
}

.bot {
  position: absolute;
  bottom: 0px;
  width: 340px;
  height: 50px;
  background: white;
  z-index: 1;
}

#fourth:checked~label.fourth {
  background: orange;
  transform: scale(1.3);
}

#third:checked~label.third {
  background: orange;
  transform: scale(1.3);
}

#second:checked~label.second {
  background: orange;
  transform: scale(1.3);
}

#first:checked~label.first {
  background: orange;
  transform: scale(1.3);
}

.imgoneslide {
  width: 120%;
  object-fit: cover;
  float: left;
}

.two,
.three,
.four,
.chat {
  font-size: 15.4px;
  margin: 0px 30px 0px 30px;
  font-family: 'Sanchez', serif;
}

.button1,
.button2 {
  background: white;
  border: none;
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  outline: 0;
  transition: 0.2s;
}

.button1 {
  position: absolute;
  top: 400px;
  left: 20px;
  width: 75px;
  height: 25px;
  z-index: 2;
}

.button2 {
  float: left;
  margin: 15px;
}

.button1:hover,
.commentbutton:hover {
  color: orange;
  background-color: #4b3730;
}

.button2:hover {
  color: orange;
  text-shadow: 0px 0px 1px black;
}

.button1:focus,
.button2:focus {
  color: orange;
  background-color: #4b3730;
}

.commentbutton {
  position: absolute;
  width: 25px;
  height: 111px;
  right: 20px;
}

.chat {
  background: white;
  margin: 0;
  width: 340px;
  min-height: 580px;
  z-index: 1;
}

.close {
  position: absolute;
  width: 25px;
  height: 20px;
  right: 20px;
  bottom: 15px;
  border: solid black;
  border-width: 1.5px;
}

  <link href="https://fonts.googleapis.com/css?family=Rajdhani&display=swap" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Sanchez&display=swap" rel="stylesheet">

    <input type="radio" name="nav" id="first" checked>
    <input type="radio" name="nav" id="second">
    <input type="radio" name="nav" id="third">
    <input type="radio" name="nav" id="fourth">
    <input type="checkbox" id="commentbutton">

        THE
 DARK SIDE
 OF THE
 DIGITAL

 NOMAD

MARK MANSON

      <button type="button" class="button1">TRAVEL</button>

        The following is the original piece I wrote for CNN last year about location independent entrepreneurs, also known as "digital nomads." Since the whole "Work Online, Travel the World and Live the Dream" angle had been done to death
        in a million places, I decided to go the other direction and show the dark side of being a digital nomad — the challenges one faces, the emotional pitfalls, the social sacrifices.

Predictably, CNN hated it. The editors hacked it to pieces and asked me to rewrite sections to make it less gloomy. And since they're CNN and I'm just an asshole with a book about smut, I said OK. But I was always fond of the original, so I'm posting
        it here unabridged.

        Also note: the people and events in the piece are actually composites and mash-ups of my real life experiences and relationships. I did that for the sake of narrative and space. Enjoy.

It's 12:20PM on a Friday afternoon when most of them shuffle into the hotel conference room. The schedule said 11AM. Wishful thinking.

Floor-to-ceiling windows look out over a rooftop lagoon with the sunny reflective skyline of Bangkok draped behind, 19 floors up.

The people's feet are adorned with flip-flops and Converse sneakers, some of their bodies in button-downs and blazers, others in cargo shorts and tank tops.

        They are mostly men, single, in their 20's and 30's. But as with every group, there are the exceptions. Eventually 44 of them will fill the full-windowed conference room, bathed in natural light, sipping Singha beer and thirty-cent
        Red Bulls, listening to ad hoc presentations about outsourcing, systems management, dropshipping, grey-hat SEO, and other esoteric topics.

Unless someone told you, you would never guess that this was a conference for successful internet entrepreneurs and business owners from around the world, that the median income of the scraggly-faced, wrinkle-shirted crowd is likely well into the
        six-figures.

      ...

      <button type="button" class="button2">CLOSE</button>

A: Если указать pointer-events: none; элемент сможет пропустиь через себя события мышки, а элементы под ним смогут их поймать.
https://stackoverflow.com/questions/1009753/pass-mouse-events-through-absolutely-positioned-element
https://css-tricks.com/almanac/properties/p/pointer-events/
Поддержка браузерами отличная:
https://caniuse.com/#feat=pointer-events
P.S. А перекрыть можно абсолютным позиционированием.
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;

Для родителя конечно нужно указать position: relative.

A:

* {
  box-sizing: border-box;
}

body {
  font-family: 'Rajdhani', sans-serif;
  background: #ccccff;
}

.container {
  position: relative;
  width: 340px;
  min-height: 580px;
}

.slider {
  width: 340px;
  min-height: 580px;
  overflow: hidden;
  margin: 0 auto;
  position: relative;
  padding-bottom: 30px;
  background: #f7f6ee;
}

.slide {
  position: absolute;
  opacity: 0;
  transition: all 0.4s ease-in;
}

input[type="radio"],
input[type="checkbox"] {
  display: none;
}

.slider>label {
  margin: 0 0 0 120px;
  width: 20px;
  height: 5px;
  border-radius: 5px;
  background: #4b3730;
  position: absolute;
  bottom: 22px;
  transition: all .4s ease;
  z-index: 2;
  cursor: pointer;
}

label.second {
  left: 8%;
}

label.third {
  left: 16%;
}

label.fourth {
  left: 24%;
}

#first:checked~div.one {
  left: 0;
  opacity: 1;
}

#second:checked~div.two {
  left: 0;
  opacity: 1;
}

#third:checked~div.three {
  left: 0;
  opacity: 1;
}

#fourth:checked~div.four {
  left: 0;
  opacity: 1;
}

#commentbutton:checked~div.chat {
  left: 0;
  opacity: 1;
}

#commentbutton:checked~div.one button {
  display: none;
}

.slider>label:hover {
  background: orange;
  transform: scale(1);
}

span {
  position: relative;
  font-size: 500%;
  color: black;
}

.one h2 {
  position: absolute;
  top: 135px;
  left: 20px;
  font-weight: lighter;
  font-size: 15px;
  color: white;
  text-shadow: 1px 1px 1px black;
}

.one h1 {
  position: absolute;
  color: white;
  top: 155px;
  left: 20px;
  text-shadow: 1px 1px 1px black;
}

.bot {
  position: absolute;
  bottom: 0px;
  width: 340px;
  height: 50px;
  background: white;
  z-index: 1;
}

#fourth:checked~label.fourth {
  background: orange;
  transform: scale(1.3);
}

#third:checked~label.third {
  background: orange;
  transform: scale(1.3);
}

#second:checked~label.second {
  background: orange;
  transform: scale(1.3);
}

#first:checked~label.first {
  background: orange;
  transform: scale(1.3);
}

.imgoneslide {
  width: 120%;
  object-fit: cover;
  float: left;
}

.two,
.three,
.four {
  font-size: 15.4px;
  margin: 0px 30px 0px 30px;
  font-family: 'Sanchez', serif;
}

.button1,
.button2 {
  background: white;
  border: none;
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  outline: 0;
  transition: 0.2s;
}

.button1 {
  z-index: 1;
  position: absolute;
  top: 400px;
  left: 20px;
  width: 75px;
  height: 25px;
}

.button2 {
  float: left;
  margin: 15px;
}

.button1:hover,
.button2:hover {
  color: orange;
  background-color: #4b3730;
}

.commentbutton {
  position: absolute;
  width: 25px;
  height: 111px;
  right: 20px;
}

.chat {
  background: white;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 50px;
}

.close {
  position: absolute;
  width: 25px;
  height: 20px;
  right: 20px;
  bottom: 15px;
  border: solid black;
  border-width: 1.5px;
}

.end {
  position: absolute;
  right: 5px;
  top: 20px;
  width: 28px;
  height: 28px;
}

.end:before,
.end:after {
  position: absolute;
  content: " ";
  height: 18px;
  width: 2px;
  background-color: #333;
}

.end:before {
  transform: rotate(45deg);
}

.end:after {
  transform: rotate(-45deg);
}

.end:hover:before,
.end:hover:after {
  background-color: orange;
}

  <input type="radio" name="nav" id="first" checked>
  <input type="radio" name="nav" id="second">
  <input type="radio" name="nav" id="third">
  <input type="radio" name="nav" id="fourth">
  <input type="checkbox" id="commentbutton">

      THE
 DARK SIDE
 OF THE
 DIGITAL

 NOMAD

MARK MANSON

    <button type="button" class="button1">TRAVEL</button>

      The following is the original piece I wrote for CNN last year about location independent entrepreneurs, also known as "digital nomads." Since the whole "Work Online, Travel the World and Live the Dream" angle had been done to death
      in a million places, I decided to go the other direction and show the dark side of being a digital nomad — the challenges one faces, the emotional pitfalls, the social sacrifices.

Predictably, CNN hated it. The editors hacked it to pieces and asked me to rewrite sections to make it less gloomy. And since they're CNN and I'm just an asshole with a book about smut, I said OK. But I was always fond of the original, so I'm posting
      it here unabridged.

      Also note: the people and events in the piece are actually composites and mash-ups of my real life experiences and relationships. I did that for the sake of narrative and space. Enjoy.

It's 12:20PM on a Friday afternoon when most of them shuffle into the hotel conference room. The schedule said 11AM. Wishful thinking.

Floor-to-ceiling windows look out over a rooftop lagoon with the sunny reflective skyline of Bangkok draped behind, 19 floors up.

The people's feet are adorned with flip-flops and Converse sneakers, some of their bodies in button-downs and blazers, others in cargo shorts and tank tops.

      They are mostly men, single, in their 20's and 30's. But as with every group, there are the exceptions. Eventually 44 of them will fill the full-windowed conference room, bathed in natural light, sipping Singha beer and thirty-cent
      Red Bulls, listening to ad hoc presentations about outsourcing, systems management, dropshipping, grey-hat SEO, and other esoteric topics.

Unless someone told you, you would never guess that this was a conference for successful internet entrepreneurs and business owners from around the world, that the median income of the scraggly-faced, wrinkle-shirted crowd is likely well into the
      six-figures.

    ...

    <button type="button" class="button2">CLOSE</button>

A: Для того чтобы к кнопке применился эффект от transition необходимо display: none заменить на opacity: 0 + добавить pointer-events: none (который посоветовал пользователь Roman. Спасибо ему), а также transition (для плавного перехода).


text:
Q: Product sku not appearing on frontend I added product sku on to Product list page. Using below code:
<?php echo $_helper->productAttribute($_product, $_product->getSku() , 'sku'); ?>

It was showing the sku like I wanted. But suddenly it disappeared. I checked the code, its there. But it is not showing up on frontend. then I tried
<?php echo $_helper->productAttribute($_product, $_product->getData('sku') , 'sku'); ?>

also didn't work.

A: By going, System > Configuration > Catalog > FrontEnd and select "No" to "Use Flat Catalog Product" solved the problem.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Dynamic subdomain creation in wp I want to create dynamically subdomain in wp. I want to run my complete site on subdomain. As example my site is www.domain.com and i want to run complete site on subdomain.domain.com.
I have added 'A' record in cpanel that redirects me to subdomain. But when click on menu it redirects to domain.com its because of the link which is saved in database. I want to append subdomain name on each link which is retrieved from the database. There may be many user so i don't want to create static subdomain in cpanel.
Can we use .htaccess file for that or any have other suggestions.

A: Nope, You would have to change the domain saved in DB with the new domain.
Just take a MySQL DB dump and find and replace all occurances of http://www.domain.com with http://subdomain.domain.com
Once that is done, import it (please take a backup first).
Everything should work out.


text:
Q: User Interface commands skipped in IBAction Here is my code:
-(IBAction)saveDownloadedImage
{
    NSLog(@"Test");    EXECUTED
    indicatorView.hidden = NO;  NOT EXECUTED
    [indicatorView startAnimating];  NOT EXECUTED
    [statusLabel setText:@"WHY?"];  NOT EXECUTED
    [currentPicture setImage:[imageView image]];   EXECUTED
    ImageFileManager *fileManager = [[ImageFileManager alloc] init]; EXECUTED
    [fileManager saveImageToDisk:currentPicture]; EXECUTED
    indicatorView.hidden = YES;
    [statusLabel setText:@"Image saved successfully."]; EXECUTED
    saveButton.enabled = NO; EXECUTED

}
The proccess of saving takes about 5 seconds. So it would be normal to see the indicator in the UI. But nothing happens! Any idea?

A: Everything is executed. Your problem is that the saveImageToDisk call is synchronous and you are calling it from the UI thread. When you are blocking the UI thread, nothing is ever repainted. The indicator is shown but it cannot be drawn to the screen until the IBAction returns when it will have been hidden again.
You have to call the saving method asynchronously.
Blocking UI thread is never a good idea.
Edit: see the answer for the following question for the correct solution: asynchronous calls to database in ios
Edit2: One of the possible solutions (not tested)

-(IBAction)saveDownloadedImage {
    indicatorView.hidden = NO; //Note you can use hidesWhenStopped property for this
    [indicatorView startAnimating];
    [statusLabel setText:@"BECAUSE..."];
    [currentPicture setImage:[imageView image]];

    [NSThread detachNewThreadSelector:@selector(save) toTarget:self withObject:nil]
}

- (void)save {
    @autoreleasepool {
        ImageFileManager *fileManager = [[ImageFileManager alloc] init];
        [fileManager saveImageToDisk:currentPicture];

        [self performSelectorOnMainThread:@selector(updateUI) withObject:nil waitUntilDone:NO];
    }
}

- (void)updateUI {
    indicatorView.hidden = YES;
    [statusLabel setText:@"Image saved successfully."];
    saveButton.enabled = NO;
}

A: Are you sure that
1) indicatorView and statusLabel are not null, and
2) indicatorView and statusLabel are added as subviews to self.view?

A: In My Perception your are starting the Activity Indicator main Thread.
Instead Showing the Indicator on main thread
you should call Indicator on seperate Thread as Below.
-(IBAction)saveDownloadedImage
{
NSLog(@"Test");    EXECUTED
commented below code
//indicatorView.hidden = NO;  NOT EXECUTED
// [indicatorView startAnimating];  NOT EXECUTED
//instead of main thread create new Thread as Below
[NSThread detachNewThreadSelector:@selector(showloader) toTarget:self withObject:nil];
[statusLabel setText:@"WHY?"];  NOT EXECUTED
[currentPicture setImage:[imageView image]];   EXECUTED
ImageFileManager *fileManager = [[ImageFileManager alloc] init]; EXECUTED
[fileManager saveImageToDisk:currentPicture]; EXECUTED

[statusLabel setText:@"Image saved successfully."]; EXECUTED
saveButton.enabled = NO;
[indicatorView stopAnimating:YES];
indicatorView.hidden = YES;
}

//Custome method For shoing the Indicator.
-(void)showloader{
//call below method  here indicatorView object created already.
[indicatorView startAnimating]
}

It'll definitely work

A: You need to declare your method with a sender like this
-(IBAction)saveDownloadedImage:(id)sender


text:
Q: Running 3.3v over a USB, How to protect against 5V input I am running 3.3V over a USB cable from circuit A to supply voltage to another circuit B.
I am worried that someone may plug 5V into this line and fry my board(s)
There are two scenarios.

*

*5V supplied will go to output of my 3.3VLDO on circuit A and all of my components some of which cannot handle 5V

*5V supplied to my 3.3V circuit B which may handle 5V but I'd rather clamp it to 3.3V max
My initial solutions are:

*

*Is to either use a crowbar (may be overkill) or just put a schottky in series and run 3.1V over the lines to power circuit B (which should be okay, maybe put a boost on the other side to regulate back up to 3.3V)

*Clamp the Voltage to 3.3V using a 3.3V Zener in Parallel

Anyone have any thoughts on how this might be done better, or is this a reasonable/cheap way to get the desired protection?
EDIT: at this stage I took the advice about using a standard jack in a non standard way. I think ill use a TRRS jack (yes I know the irony of using another standard header) This minimizes the risk to almost zero. I can use the switching capability of some TRRS jacks to cut off the pins until fully connected if I need: but I dont think I need to with my circuit. Thanks

A: Sometimes a stupid but convenient design just needs stupid protection.

A: An ideal diode controller on the output and hotswap controller on the input would probably accomplish this.
There are many options, but in general each category will lead to the correct non-blocking diode orientation for each side.  Most of these devices are higher min voltage though, so that will be something to watch out for.
There are also large surge-stopper type devices, but the cost and size can get out of hand really fast.  ADI (previously LT) parts are mostly in that category.

A: Use a voltage regulator. 3.3 Volt regulators are easy to find out.


text:
Q: pulseaudio has no module-dbus-protocol I want to operate PulseAudio using DBus. In several instructions I read about using the module 'module-dbus-protocol'. But it does not exist.
$ pacmd load-module module-dbus-protocol
Module load failed.

I looked for it with autocomplete, 'pacmd list-modules', and even in the built git sources.
Is my PulseAudio properly configured? Or do I have a version problem?
Currently I use pulseaudio 5.0
EDIT:
Found, is in my /usr/lib/pulse/ folder.

A: was my mistake. I had the modules of two different pulsaudio versions in
- /usr/lib
-/usr/local/lib
and my running PA was linking to to the older one.
I just simply deleted all of the pulseaudio files from the /usr* repo by hand and reinstalled pulseaudio


text:
Q: Why does font size impact the height of my
* elements? Basically, I want to be able to specify the height of my "li" element for a horizontal list I'm making.  "line-height" and "height" have no impact on the visible height of the "li".  The only thing that changes the height of the "li" is changing the size of the font used within the "li".  This even happens when the "list-style" is set to "none".
What gives?

A: Set the li to display: inline-block or float: left.
list-style basically just determines the bullets to be used for the list, and doesn't really affect the inner elements otherwise.

A: Do this:
ul {
    overflow: hidden;
}

li {
    float: left;
    height: 200px; /* as required */
}

The above is another method for getting list items to display inline, without using display: inline; which is a very restrictive property and should be applied sparingly.

A: Try setting
display:block on the li

A: *

*font-size could affect the computed height of an li element (depending on what's inside) IF line-height is proportional or relative AND no height is set on li (or li is display:inline).

*line-height could affect the computed height of an li element (depending on what's inside)  IF no height is set on li (or li is display:inline).

*height will affect the computed height of an li element if it's display:inline-block or display:block only (height has no effect at all on display:inline).
See http://moorer.me/mmKVHM for examples of how font-size and line-height can affect the height of li in different ways depending on the technique used.  The differences are somewhat obviated if a is set to display:block, so for example purposes I did not do so.
Others have already shared the two most common solutions to horizontal menus -- inline-block or floated blocks.  Inline can be used, but likely won't give you the control you need.


text:
Q: Error while using Amphp parallel with user defined function I am trying to call a user-defined function using Worker\enqueueCallable.
I have put the function in a separate file and used composer to autoload it.
And I am getting the error :

Fatal error: Uncaught TypeError: Argument 1 passed to Amp\Parallel\Worker\enqueueCallable() must be callable, string given"

My folder structure
Project Folder/
    app/
       funcs.php
       caller.php
    main.php
    composer.json

Used namespace app on top in both caller.php and funcs.php
And then in composer.json used the following snippet and used composer dumpautoload -o
{
    "autoload": {
        "psr-4": {
            "app\\": "app/"
        },
        "files": [ "app/funcs.php" ]
    },
    "require": {
        "amphp/parallel": "^1.3",
        "amphp/parallel-functions": "^0.1.3"
    }

}

From main.php I am calling caller.php which calls a function defined in funcs.php
funcs.php
namespace app;
function f1($param1){
  #Do some stuff
}

caller.php
namespace app;

use Amp\Parallel\Worker;
use Amp\Promise;

class cls
{
    function __construct()
    {

    }

    function Invoker()
    {
        // If I call the function, its working.
        f1($param1);
        // When I am using its not working.
        $promises[] = Worker\enqueueCallable('f1', $param1);
    }

}

main.php
require __DIR__ . '\vendor\autoload.php';
use app\cls;

$obj = new cls();
$obj->Invoker();

I am using windows-10, WAMP server, with PHP version 7.3.5.


text:
Q: Aligning multiple places in equations using align My question is simple. I've played around with the & symbol to align my equations neatly under each other, but I just can't get it to look nice. This is the closest I've got:
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{align}
A_{0} & = -\frac{3\sigma_{1}' h H L^{2}}{E (H+h)^{3}} &=& -1.62\times 10^{-6}\,\mathrm{m} \\
B_{0} & = - \frac{3 h H (\alpha_{2}-\alpha_{1}) L^{2}}{(H+h)^{3}} &=&  2.95\times 10^{-8}\,\mathrm{m\,K^{-1}} \\
C_{0} & = \frac{4 L^{3}}{E W (H+h)^{3}} &=& 1.08\,\mathrm{m\,N^{-1}}
\end{align}
\end{document}

which produces the following output:

How can I remove the horizontal space in the middle yet still align the equal signs under each other? It should be the middle equation that dictates the spaces, i.e. the other two equations need to align to that one.
As a final question I could ask: How would you do it to make it 'look nice'?
And yes, I have looked at the other similar questions without luck.

A: What you need is alignat:
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{alignat}{2}
A_{0} & = -\frac{3\sigma_{1}' h H L^{2}}{E (H+h)^{3}} &{}={}& -1.62\times 10^{-6}\,\mathrm{m} \\
B_{0} & = - \frac{3 h H (\alpha_{2}-\alpha_{1}) L^{2}}{(H+h)^{3}} &{}={}&  2.95\times 10^{-8}\,\mathrm{m\,K^{-1}} \\
C_{0} & = \frac{4 L^{3}}{E W (H+h)^{3}} &{}={}& 1.08\,\mathrm{m\,N^{-1}}
\end{alignat}
\end{document}

\begin{alignat}{2} aligns at two points (two equation columns) and you have to use three &s. To get the proper spacing around = in the second column use {}={}

A: You have to use the alignat environment. Also, use siunitx for the physical quantities.
\documentclass{article}

\usepackage{amsmath}
\usepackage{siunitx}

\begin{document}

\begin{alignat}{2}
  A_{0}
  &= -\frac{3\sigma_{1}'hHL^{2}}{E(H+h)^{3}}
  &&= \SI{-1.62e-6}{\m} \\
  B_{0}
  &= - \frac{3hH(\alpha_{2}-\alpha_{1})L^{2}}{(H+h)^{3}}
  &&= \SI{2.95e-8}{\m\per\K} \\
  C_{0}
  &= \frac{4L^{3}}{EW(H+h)^{3}}
  &&= \SI{1.08}{\m\per\N}
\end{alignat}

\end{document}

Update
Inspired by Barnard's answer, here is a way in case you also want to align the units:
\documentclass{article}

\usepackage{amsmath}
\usepackage{siunitx}

\begin{document}

\begin{alignat}{4}
  A_{0}
  &= -\frac{3\sigma_{1}'hHL^{2}}{E(H+h)^{3}}
  &&={}& -1.62 &\times 10^{-6} && \,\si{\m} \\
  B_{0}
  &= - \frac{3hH(\alpha_{2}-\alpha_{1})L^{2}}{(H+h)^{3}}
  &&={}& 2.95 &\times 10^{-8} && \,\si{\m\per\K} \\
  C_{0}
  &= \frac{4L^{3}}{EW(H+h)^{3}}
  &&={}& 1.08 & && \,\si{\m\per\N}
\end{alignat}

\end{document}

A: Two solutions with alignat; one of them has two alignment points, the other, three, so that the numeric values are aligned on the integer part of the mantissa:
 \documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\begin{document}

\begin{alignat}{3}
A_{0} & = -\frac{3σ_{1}' h H L²}{E (H+h)³} &&= - & & 1.62 × 10⁻⁶\,\mathrm{m} \\
B_{0} & = - \frac{3 h H (α_{2}-α_{1}) L²}{(H+h)³} &&= & & 2.95 × 10⁻⁸\,\mathrm{m\,K⁻¹} \\
C_{0} & = \frac{4 L³}{E W (H+h)³} &&= & & 1.08\,\mathrm{m\,N⁻¹}
\end{alignat}

\begin{alignat}{2}
A_{0} & = -\frac{3σ_{1}' h H L²}{E (H+h)³} &&= - 1.62 × 10⁻⁶\,\mathrm{m} \\
B_{0} & = - \frac{3 h H (α_{2}-α_{1}) L²}{(H+h)³} &&= 2.95 × 10⁻⁸\,\mathrm{m\,K⁻¹} \\
C_{0} & = \frac{4 L³}{E W (H+h)³} &&= 1.08\,\mathrm{m\,N⁻¹}
\end{alignat}

\end{document}


text:
Q: Background Color Change onload JavaScript+Html I am attempting to write my own website, however I had an idea to have an Array of background colors that the site would change to at random (but not repeating the same color back to back) every time the page is loaded / refreshed. I remember doing something very similar to this when I was in school but I just can't quite remember how it was done.
This is what I have so far, I have been fiddling with this for about a day and just can't quite figure out what I am missing.
Any assistance would be greatly appreciated.
<html>
<head>
<script type="text/javascript">
<!--
var color = new Array();
color[0] = "#CC99FF";
color[1] = "#FF99CC";
color[2] = "#FF9999";
color[3] = "#FFCC99";
color[4] = "#FFFF99";
color[5] = "#CCFF99";
color[6] = "#99FF99";
color[7] = "#99FFCC";
color[8] = "#66FFFF";
color[9] = "#66CCFF";

function changeColor()
{
  var randomColor = Math.floor(Math.random() * color.length);
  document.body.style.backgroundColor = color[randomColor];

}
--!>
</script>
</head>
<body onload="changeColor()">
</body>
</html>

A: I noticed that your question had a second part, which is to not repeat the same color twice.  Since you are doing this on a reload, it becomes a little trickier since you cannot just store the last color in a simple variable.
For this, I decided to utilized localStorage.  I leveraged some of the other answers as well that mentioned you need to use the style property on the body element.
Here is a Fiddle of the solution and the code is below:
As mentioned, you need to use the style property to set the background color:
document.getElementsByTagName("body")[0].style.backgroundColor=color[randomColor];

Then, you need to keep looking for an index that wasn't used in the last run:
First, I grab the currently stored index, or -1 if it doesn't exist.
var lastColorIndex = localStorage.getItem('lastColorIndex') || -1;

Then set do the loop while the two indices aren't equal or if random color is -1 (this is for on the initial page load). Note that we are using == for a 'truthy' check since localStorage will return a string and Math.random() returns a number;
while(lastColorIndex == randomColor || randomColor === -1)

Finally, set the randomColor value into local storage.
localStorage.setItem('lastColorIndex',randomColor);

All together now:
function changeColor()
{
    var lastColorIndex = localStorage.getItem('lastColorIndex') || -1;
  var randomColor = -1;
    while(lastColorIndex == randomColor || randomColor === -1) {
  randomColor = Math.floor(Math.random() * color.length);
        console.log('LastIndex: ' + lastColorIndex + ',RandomColor: ' + randomColor);
    };
    localStorage.setItem('lastColorIndex',randomColor);
    //console.log(randomColor);
  console.log(color[randomColor]);
    document.getElementsByTagName("body")[0].style.backgroundColor=color[randomColor];
};

A: you must access to you body style :
function changeColor() {
  var randomColor = Math.floor(Math.random() * color.length);
  document.body.style.backgroundColor = color[randomColor];
}

A: you can change the background color like that
function changeColor()
{
  var randomColor = Math.floor(Math.random() * color.length);
  document.body.style.background = color[randomColor];
}

A: You are not accessing the background color property correctly.Use it this way.
function changeColor()
{
  var randomColor = Math.floor(Math.random() * color.length);
  document.body.style.backgroundColor = color[randomColor]; //THIS IS IMP

}

A: Have a look at this fiddle (click 'run' several times to simulate reload) :
http://jsfiddle.net/4j61r6go/
function changeColor()
{
  var randomColor = Math.floor(Math.random() * color.length);
  console.log(color[randomColor]);
  document.getElementsByTagName("body")[0].style.backgroundColor=color[randomColor];
};

you should call 'changeColor' in windowor document 'onload'.

A: I have found a code in a theme hope this will help you
        $('.animated-bg').each(function(){
        var $this = $(this),
            colors = ['#ec008c', '#00bcc3', '#5fb26a', '#fc7331'];

        setInterval(function(){
            var color = colors.shift();
            colors.push(color);
            $this.animate({backgroundColor: color}, 2000);
        },4000);
    });


text:
Q: Linear system where I can not apply Cramer
I have to solve this linear system,
  $$
\left\{
\begin{array}{c}
ax-2y+z=2 \\
x-3y+2t=b \\
x-6y-3z+8t=-2
\end{array}
\right.
$$

I am stucked because I do not know how to proceed. The number of unknowns is different from the number of equations so I can not apply Cramer. I thought to study the incomplete matrix of the system by applying Rouchè-Capelli but I do not know how to proceed since I should compare the incomplete matrix with the complete matrix of the system! How can I do? Thank you.

A: Hint. Consider $x$, $a$, and $b$ as parameters and solve with respect to $(y,z,t)$:
$$\left\{
\begin{array}{c}
-2y+z+0t=2-ax \\
-3y+0z+2t=b-x \\
-6y-3z+8t=-2-x
\end{array}
\right.$$
Note that
$$-3\cdot(-2y+z+0t)+4\cdot (-3y+0z+2t)=-6y-3z+8t.$$


text:
Q: "Restore Windows Key" Define command as keyboard shortcut I don't love windows but I do like the ability to search applications but pressing the windows key.
I do not want a multi key shortcut like cmd + space.  Is there a way to define the command key to bring up spotlight?

A: This is how you do with Karabiner and El Captain.  Just put this in your private.xml.  If you change command+space to open Launchpad it works well also.
<?xml version="1.0"?>
<root>
  <item>
    <name>Make command key activate spotlight.</name>
    <appendix>(Send an escape key event when escape key is pressed alone.)</appendix>
    <identifier>private.escape_to_control_escape</identifier>
    <autogen>
      __KeyOverlaidModifier__
      <!-- from -->
      KeyCode::COMMAND_L,
      <!-- to -->
      KeyCode::COMMAND_L,
      <!-- alone -->
      KeyCode::SPACE, ModifierFlag::COMMAND_L
    </autogen>
  </item>
</root>

This is also interesting for Sierra https://github.com/tekezo/Karabiner-Elements/pull/247

A: Short Answer
I'm not aware of any way this is possible with macOS natively (neither through System Preferences, AppleScript, or an Automator Service) because the commandspace keyboard shortcut is actually one of the key sequences reserved by macOS.
You may find a way to do this with Karabiner Elements (or for users of Mavericks, Yosemite or El Capitan, Karabiner), but I've never tried using a modifier key on its own to activate something.
Long Answer
According to the macOS Human Interface Guidelines:

You should not override the shortcuts in Table 72-3 that are accompanied by the Apple symbol shown here, because macOS uses the shortcut in some way.

And, when referring to Table 72-3, the very first keyboard shortcut is that for showing/hiding Spotlight:

Also, the macOS Human Interface Guidelines state:

macOS reserves several key combinations for use with localized versions of system software, localized keyboards, keyboard layouts, and input methods.

One of these is the commandspace keyboard shortcut which is also reserved for international systems to rotate through enabled script systems (also mentioned in Table 72-3 above, but referred to also in Table 72-1). So, as a minimum, the commandspace keyboard shortcut will need to remain as is.
The question then becomes whether you can activate Spotlight via another keyboard shortcut, in addition to the default shortcut. This may be possible, particularly with an applescript that is run by an Automator Service (which in turn is activated by a keyboard shortcut). However, this will not be possible with the use of command (or any other modifier key) on its own, which leaves you with the option of investigating whether Karabiner Elements (or for users of an earlier macOS, Karabiner), can do the job.

A: You can assign the left command key as a shorcut using the BetterTouchTool.


text:
Q: How to use KVO to detect when an application gets active? I have the following code in a Cocoa application:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
   NSArray* arrayAppList = [[NSWorkspace sharedWorkspace] runningApplications];
}

My intention is to use KVO to detect an application when changes its state between inactive to active.
I read that I have to use the instance method -addObserver:forKeyPath:options:context:
And then use -observeValueForKeyPath:ofObject:change:context: to respond to change notifications.
I understand that -observeValueForKeyPath is a callback method where I can write code to respond to the properties changes I am interested in.
Nevertheless, I feel confused in how I must to use the addObserver method in order to be notified when the active property of the runningApplications change.  Now, I am wondering where is the place to make the registration, for now I am using -applicationDidFinishLaunching but not sure if is the right place to do it.  Additionally if I use the -observeValueForKeyPath callback method, I have to implement it in the class that inherits from NSObject and is the same class where I am registering the notification?

A: *

*You should call the addObserver:… method on each object in the runningApplications array (using isActive as the key path).

*Starting the observing after your app finishes launching sounds about right. Time-wise, that is. As for the place, there should be a separate class dedicated to these observations. By implementing the observation code right in the app delegate you would violate the single-responsibility principle (and that means headache in the long term).

*The observeValueForKeyPath:… callback should be implemented by the object that called the addObserver:… methods.


text:
Q: Cannot start venv with python3 When trying to start a virtual environment I get:
~$ python3 -m venv homeassistant
The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt-get install python3-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

Failing command: ['/home/gal/homeassistant/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']

But when I try to install python3-venv I get:
~$ sudo apt-get install python3-venv
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-venv is already the newest version (3.6.7-1~18.04).
0 upgraded, 0 newly installed, 0 to remove and 38 not upgraded.

I should have several python versions installed but I remove them as alternatives:
~$ sudo update-alternatives --config python3
There is only one alternative in link group python3 (providing /usr/bin/python3): /~$ sudo update-alternatives --config python3
There is only one alternative in link group python3 (providing /usr/bin/python3): /usr/bin/python3.7
Nothing to configure.usr/bin/python3.7
Nothing to configure.

Python version is 3.7.5:
~$ python3 --version
Python 3.7.5

OS version is:
~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:    18.04
Codename:   bionic

I think that the problem is becuase of 'python3-venv is already the newest version (3.6.7-1~18.04).' while the version I use is 3.7 and not 3.6. But I don't know how to proceed.
Thanks for any suggestions.

A: You can install a venv for your version of python.
sudo apt-get install python3.7-venv


text:
Q: Coin Flip Problem: a competition based on the probability of flipping heads I encountered a difficult coin problem and I wasn't sure how to solve the problem.
A has 30 coins and B has 20 coins. Each coin is only flipped once, and the winner is the individual which received the most amount of heads. If both individuals receive the same amount of heads, A wins. What is the probability that B wins?
I tried searching online but was unable to find any questions of this type. Given my lack of mathematical background, I tried to rely on my intuition. Because both individuals have the same probability of flipping heads when it comes to the first 20 choices, we should only consider the possibility of flipping a head for coins 21-30 for A. However, I believe this to be incorrect, so I would love to hear what the community thinks on this question.
Thank you very much for your help!

A: For the job interview, one can probably approximate throwing $50$ coins as a normal (Gaussian) distribution.  Let the score be
$$X = B - A = C_1 + C_2 + \dots + C_{50}$$
where $C_j$ is the $j$th coin.  The first thirty coins are uniform $\{0, -1\}$ (since they help A) and the last twenty coins are uniform $\{0, +1\}$ (since they help B).  The mean is $E[X] = -5$ and the variance is $Var(X) = 50/4$ so the standard deviation is $\sigma \approx 3.5$.
B wins if $X \ge 1$ and loses if $X \le 0$, so you want the threshold to be $X = 0.5$, which means you are looking at the one-sided tail at ${5.5 \over 3.5} \approx 1.5 \sigma$.
At this point, it depends on what you remember from the z-score tables...  :)  Perhaps you remember that the area within $\pm 1 \sigma$ is about $2/3$?  That means the one-sided tail at $1 \sigma$ is about $1/6 = 16\%$.  Then perhaps you remember that $\pm 2 \sigma$ is about $95\%$?  Which means the one-sided tail at $2 \sigma$ is about $2.5\%$.  This question calls for the one-sided tail at $\approx 1.5 \sigma$, which is a number between $16\%$ and $2.5\%$, and if you remember how the curve drops off dramatically (after $1 \sigma$) you might have guessed about $6$ or $7\%$.
Incidentally if you actually look up the z-score table for $5.5 / \sqrt{12.5} \approx 1.55563491861$ you get a probability of $0.059897$ which is very close to the combinatorially exact answer as calculated by @Tavish in the comments.

Because both individuals have the same probability of flipping heads when it comes to the first 20 choices, we should only consider the possibility of flipping a head for coins 21-30 for A. However, I believe this to be incorrect...

That would be vastly incorrect.  First of all, A wins ties, so this wrong logic would say A wins all the time (since A wins even if A flips $0$ heads in coins 21-30).  Even if A loses ties, the logic is still bad.  E.g. imagine A is flipping $10000$ coins and B is flipping $9990$.  Intuitively you would think B has less than half, but still pretty good chance, to win.  Whereas with the wrong logic B wins iff A's $10$ extra coins all tails (probability $1/1024$).


text:
Q: Interpreting random forest in pySpark Good evening people,
I am trying to find a way of interpreting a random forest in Spark. By interpreting i mean finding out which variables were the most influential in the specific row.
With python, i used to do this:
from treeinterpreter import treeinterpreter as ti
prediction, bias, contributions = ti.predict(rfc, X)

The econtributions array had all the information i needed and then i could manipulate it to get the desired outcome. Is there a way to do this with spark in python?

A: I guess you are talking about features importance.
Implementation in pyspark.ml when you are working with Pipeline object:
tree = model.stages[-1]
# load feature importance from the model object
print(tree.featureImportances)

# You can also print the trees with nodes:
print('Trees with Nodes: {}'.format(tree.toDebugString))

Or when you are working in pyspark.ml without pipeline:
from pyspark.ml.classification import RandomForestClassifier
rf = RandomForestClassifier()
model = rf.fit(data)
print(model.featureImportances)


text:
Q: not able to resolve AttributeError: module 'pandas' has no attribute 'read_csv' I am using Python 3 and working on an ML project. My code ran fine for the first time but suddenly, out of nowhere, this error popped up.
Traceback (most recent call last):

File "<ipython-input-2-3ae66814e4b2>", line 1, in <module>
import pandas as pd

File "C:\Users\ruhani\Anaconda3\lib\site-packages\pandas\__init__.py", line 42, in <module>
from pandas.core.api import *

File "C:\Users\ruhani\Anaconda3\lib\site-packages\pandas\core\api.py", line 10, in <module>
from pandas.core.groupby import Grouper

File "C:\Users\ruhani\Anaconda3\lib\site-packages\pandas\core\groupby.py", line 49, in <module>
from pandas.core.frame import DataFrame

File "C:\Users\ruhani\Anaconda3\lib\site-packages\pandas\core\frame.py", line 67, in <module>
from pandas.core.generic import NDFrame, _shared_docs

File "C:\Users\ruhani\Anaconda3\lib\site-packages\pandas\core\generic.py", line 36, in <module>
trainDF=pd.read_csv("C:\\Users\\ruhani\\Desktop\\Minor Project\\projects\\train.csv\\train.csv")

AttributeError: module 'pandas' has no attribute 'read_csv'

Please help me as I am new to Python and Machine Learning.


text:
Q: Can I verify Data if image using foundation framework only Is it possible, using swift, to verify data: Data is image using Foundation.framework only?
Nothing else from macOS or iOS is available as this is for Server side project only (Vapor)

A: If all you have is the byte array, this might help: Determine MIME type from NSData?.
If you're uploading through multipart, you should have access to the filename (and possibly other data) that you could use to detect whether it's an image. Although this could be spoofed.
Client side validation might also be useful here.


text:
Q: Password protected REDIS with dependency injection nodejs Hey what's going on guys, I have a problem with the dependency injection on my Redis settings. We have an outdoor central Redis server for development, so in my main file (app.js) am I'm trying to connect this to the server. Now, this is password protected and can't find the isue.
I'm using this module redis
app.js
let redis = require('redis');
let redisSettings = {
    host: settings.redis.ip,
    port: settings.redis.port,
    parser: settings.redis.parser,
    password: settings.redis.password
};

let redisClient = redis.createClient(redisSettings);
    redisClient.auth(settings.redis.password, function(){
});

let routes = require('./routes')( redisClient);

settings.js
module.exports = {
    redis: {
        ip: 'domainname.example',
        port: '6379',
        parser: 'javascript',
        password: 'our_very_secure_password'
    }
}

the error page

events.js:182   throw er; // Unhandled 'error' event   ^
ReplyError: DENIED Redis is running in protected mode because
  protected          mode is enabled, no bind address was specified, no
  authentication password is requested to clients.  In this mode
  connections are only accepted from the loopback interface.  If you
  want to connect from external computers to Redis you may adopt  one of
  the following solutions: 1)  Just disable protected mode sending the
  command 'CONFIG SET protected- mode no' from the loopback  interface
  by connecting to Redis from the same host the server is  running,
  , however, MAKE SURE Redis is not publicly  accessible from internet if
  you do so. Use CONFIG REWRITE to make this change permanent. 2)
  Alternatively you can just disable the protected mode by editing the
  Redis configuration file, and setting  the protected mode option to
  'no', and then restarting the server. 3)  If you started the server
  manually  just for testing, restart it with the '--protected-mode no'
  option. 4)  Setup a bind address or an authentication password.  NOTE:
  You only need to do one of the above things in order for the  server
  to start accepting connections from the outside. at parseError
  (/Users/joey.dossche/Documents/DEV/koha_goan/node_modules/redis-
  parser/lib/parser.js:193:12) at parseType
  (/Users/joey.dossche/Documents/DEV/koha_goan/node_modules/redis-
  parser/lib/parser.js:303:14)
[nodemon] app crashed - waiting for file changes before starting...

A: There are 4 possible solutions to your problem included in the error log. You can use the one that is most convenient for you.

A: I found the answer to my question by myself in this time. It's really simple, there is no answer... It's impossible to and keeps the redis password protected and make it usable without binding IP addresses. So now we work with the security turned off and will reconnect the security settings if we enter the production stage.


text:
Q: How can I configure an Active Directory authorisation provider for OAuth2? I've actually came accros Dave Syer's excellent Oauth2 exemple server found here : https://github.com/dsyer/sparklr-boot and the reference documentation of spring-security-Oauth : http://projects.spring.io/spring-security-oauth/docs/oauth2.html.
I understand the concepts of OAuth2 Authorization Server but I am actually looking to plug it on our Active Directory. Before using OAuth2, I used ActiveDirectoryLdapAuthenticationProvider without problem.
I can't find any implementation of ClientDetailsService that is pluggable to an Active Directory.
Did I miss something or do I have to write my own LDAP / AD implementation of ClientDetailsService ?


text:
Q: Query By Set in Postgres I have a table of conversations, table of conversations_owned, and a table of player.  I want to find one and only one conversation_owned for any set (meaning distinct group, without respect to ordering) of player.
converation_owned columns conversation_id and player_id are foreign keys
    CREATE TABLE conversation
(
    id INTEGER PRIMARY KEY NOT NULL,
    created_at TIMESTAMP WITH TIME ZONE,
    modified_at TIMESTAMP WITH TIME ZONE,
    count INTEGER
);
CREATE UNIQUE INDEX conversation_id_uindex ON conversation (id);

CREATE TABLE conversation_owned
(
    id INTEGER PRIMARY KEY NOT NULL,
    conversation_id BIGINT DEFAULT nextval('conversation_owned_conversation_id_seq'::regclass) NOT NULL,
    player_id INTEGER,
    created_at TIMESTAMP WITH TIME ZONE,
    modified_at TIMESTAMP WITH TIME ZONE,
    CONSTRAINT conversation_owned_conversation_id_fk FOREIGN KEY (conversation_id) REFERENCES conversation (id),
    CONSTRAINT conversation_owned_player_id_fk FOREIGN KEY (player_id) REFERENCES
);
CREATE UNIQUE INDEX conversation_owned_id_uindex ON conversation_owned (id);

CREATE TABLE player
(
    id INTEGER PRIMARY KEY NOT NULL,
    player_name TEXT NOT NULL
);

For example: if I type several contacts (Billy, Joe, and Sue) into iMessage or Facebook Messenger compose window the app will retrieve any existing conversation I have with myself, Billy, Joe, or Sue, regardless of the order I entered them.  But I may have a different conversation that pops up if I enter just Billy and Joe (and not Sue).  I'm looking for a query that can give me this kind of behavior in a relatively efficient way.
Note that if I add a "count" column to the conversation table that has the number of participants in the conversation so that it looks like:
CREATE TABLE conversation
    (
        id INTEGER PRIMARY KEY NOT NULL
    );

I can use this query to get what I want, however it seems to me that I should be able to do this without adding and maintaining a "count" column in conversations!
SELECT
  *
FROM
  conversation_owned
  INNER JOIN conversation ON conversation_owned.conversation_id=conversation.id
WHERE
  conversation_id
  NOT IN (
    SELECT
      conversation_owned.conversation_id
    FROM
      conversation_owned
    WHERE
      conversation_owned.player_id
    NOT IN (${playerIDs})
  )
AND
    conversation.count = ${participantCount}
AND
  conversation_owned.player_id = ${requestingPlayerID};


text:
Q: Removing data (refreshing) WebGL Globe I'm playing with the WebGL Globe (http://globe.chromeexperiments.com/) and would like to be able to "refresh" it with new data and then animate it to the new state. The examples provided in the library don't help because they load data series at once when the page loads, but I'd like to load in new data dynamically (say, every 30 seconds)
Repeatedly executing the following with new data only updates the globe's data additively, so the bars "stack up" on the globe when new data comes in:
globe.addData(data, {format: 'magnitude'});
globe.createPoints();
globe.animate();

There doesn't seem to be an obvious way to subtract / clear / reset the globe's data using the built in API (and then animate to a new state of data). Is this easily doable?

A: I figured it out. In your globe.js add the following lines:
function createPoints() {
    ...
    this.points.name = "lines"; // Add this line
    scene.add(this.points);
    }
}

// Create this function
function removeAllPoints() {
    scene.remove(scene.getObjectByName("lines"));
}

// Near the bottom of the code
this.addData = addData;
this.removeAllPoints = removeAllPoints; // Add this line
this.createPoints = createPoints;
this.renderer = renderer;
this.scene = scene;

Now you can simply do something like:
TWEEN.start();
globe.removeAllPoints();
globe.addData(data, {format: 'magnitude', name: 'results', animated: false});
globe.createPoints();

A: The answer given by hobbes3 really helped. But just one small change.
You need not call globe.animate().
I had used it in a project in which i update data every 5 seconds and calling globe.animate() over and over again brought rendering to a crawl.
Comment that out and you are gold.


text:
Q: Cigarette butt sound wave What happens when I extinguish a cigarette in a recipient with some water in it ? It goes like pshhh, but what creates the sound wave ? Is it the water evaporating ?

A: Sound waves can be emitted not only by vibrating bodies, but whenever there are pressure differences as the result of thermodynamical instability. Therefore even putting out the cigarette can produce sound cause of high temperature (and therefore pressure) differences. It's not an event with pronounced frequency characteristics, because the differences aren't in any manner periodic. Therefore is that "pshhh" not "aaaah" (noise not tone).


text:
Q: No funciona Javascript de bootstrap Estoy haciendo una pagina con Spring (JAVA), y Bootstrap 4.0.0. Al principio había hecho las llamadas a los archivos de bootstrap vía link web, y funcionaba todo perfecto. Ahora quiero cambiar esas llamadas para hacerlas utilizando los archivos de forma local, es decir, me baje los archivos de bootstrap. Llamo a los CSS de forma local y funciona sin problema, pero al momento de llamar a los archivos de JS no me funcionan. La sentencias que uso son:
<link  href="<c:url value="/resources/bootstrap/js/bootstrap.min.js"/>"/>
<link  href="<c:url value="/resources/bootstrap/js/bootstrap.bundle.min.js"/>" />

Cabe aclarar, que las llamadas funcionan, es decir, si veo el código compilado e intento entrar al archivo de JS mediante la llamada me lleva al archivo, el problema está en que la página no responde como debería con JS. Por ejemplo tengo un alert con dismiss para cerrarlo y el botón de cerrar no funciona, algo que si anda cuando vuelvo a poner la llamada via web.

A: Debes incluir también jquery en tu archivo es por eso que el javascript de Bootstrap no te funciona correctamente. Siempre debes cargar primero la librería de jquery y luego cargas el ".js" del bootstrap así:
<link  href="<c:url value="/resources/bootstrap/js/jquery.min.js"/>" />
<link  href="<c:url value="/resources/bootstrap/js/bootstrap.min.js"/>"/>
<link  href="<c:url value="/resources/bootstrap/js/bootstrap.bundle.min.js"/>" />


text:
Q: Excel text formatting I need some help guys, I tried searching for this but cant find the correct keywords to find the right solution.
So I currently have a column with text values sort of like this:
1A
1B
2A
2C
10A
10B
120A
120B
Etc.

What I need is to format them into something like this
001A-XXXX
....
....
010A-YYY
...
...
120A-ZZZZZ

So, I got the data after the dash figured out. The thing is I need the data before the dash to always be 4 digits in the format shown above. I can for example =concatenate("00", A19, "-") and it works for the single digit numbers like "1A" because it makes it "001A-" however this would make the double and triple digit #s "0010A-" and "00100A-" which I can't have.
Any help on this issue?
Thanks in advance for your help and let me know if I need to provide more info, Im not really well versed in excel.

A: There may be a more efficient way to do this, but you could probably use a nested IF statement with a length function as follows:
=IF(LEN(cellRef)=1, Concatenate("000",cellRef,"-"), IF(LEN(cellRef)=2, Concatenante("00",cellRef,"-"), ...........
Edit: another option is as follows:
=LEFT(cellRef&REPT("0",4),4)

A: Try
=TEXT(LEFT(A1,LEN(A1)-1),"000")&RIGHT(A1)

or
=REPT("0",4-LEN(A1))&A1


text:
Q: How to properly use Google API Client on Glass XE22 I'm currently trying to use the following code to create an ApiClient connection
mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addApi(Wearable.API)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .build();

mGoogleApiClient.connect();

but in
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
    Log.d(TAG, "Connection failed");
    mGoogleApiClient.reconnect();
}

I'm getting this:
ConnectionResult{statusCode=SERVICE_INVALID, resolution=null}

If I'm reading correctly in the manual, this corresponds to the version of Play being wrong to begin with.
As such, am I missing something from properly connecting running the code on Glass or this is not supported yet?
To give you a rough idea of what I want to do, I want to implement this example.

A: Google Play Services is not supported on Glass at this time. This is currently being tracked as issue 176 in our issue tracker, so you can follow that for more info in the future.


text:
Q: How to improve movement code in Unity? I am making a game in Unity using the 2D format which has the same mechanics as Flappy Bird. But, I fail to make the movement as good as I want it to be.
The main problem is that when I press the mouse button, it does not stop until I release the button. I want with one click just one movement, so that if I press the mouse button down and don't let go the bird will drop. Because, it will bounce just once.
Here is the movement code, please tell me how to fix this issue. I have skipped some parts of the code which are not used in the movement.
float flapSpeed = 25f;
float forwardSpeed = 0.9f;

void Update () {
      if  (Input.GetMouseButton(0)) {
          didFlap = true;
      }
}

void FixedUpdate () {
// Movement
    GetComponent<Rigidbody2D>().AddForce(Vector2.right * forwardSpeed);
    if (didFlap) {
         GetComponent<Rigidbody2D>().AddForce(Vector2.up * flapSpeed);
         didFlap = false;
    }
}

A: It's because you are checking if the mouse button is pressed all the time and reacting to it:
void Update () {
      if  (Input.GetMouseButton(0)) {
          didFlap = true;
      }
}

You need to keep an additional flag which will allow a flap only after the mouse button has been released.  Something like:
private bool allowFlap = true;

void Update () {
      bool mouseDown = Input.GetMouseButton(0);
      if (allowFlap && mouseDown) {
          didFlap = true;
          allowFlap = false;
      } else if (!allowFlap && !mouseDown) {
          allowFlap = true;
      }
}

A: This is all you need
You were calling GetMouseButton which runs once every frame the mouse button is down. Instead try calling GetMouseButtonDown which will fire once on each mouse down.
float flapSpeed = 25f;
float forwardSpeed = 0.9f;

void Update () {
     if (Input.GetMouseButtonDown(0))
          GetComponent<Rigidbody2D>().AddForce(Vector2.up * flapSpeed);
}

void FixedUpdate () {
      GetComponent<Rigidbody2D>().AddForce(Vector2.right * forwardSpeed);
}

A: If you want to use the same mechanics in Flappy Bird you need to work with the rigitbody.velocity instead of applying forces because it doesn't matter if the bird is going up, down or stopped, it will always fly up with the same initial speed.
private void HandleMouse ()
{
    if (Input.GetMouseButtonDown(0)) {
        rigidbody.velocity = new Vector3 (rigidbody.velocity.x, velocityUp, 0f);
    }
}

A: To get the mouse button clicked once, use GetMouseButtonDown.
Then you will need to apply an impulse instead of force, through the second param of AddForce(), ForceMode.Impulse:
void Update () {
    if (Input.GetMouseButtonDown(0))
        GetComponent<Rigidbody2D>().AddForce(Vector2.up * flapSpeed, ForceMode.Impulse);
}

A: You are checking Input.GetMouseButton(0) every frame. this function returns true if the player press and hold the button_0.
what you want is to check Input.GetMouseButtonDown(0) which fires once.
by the way i have two advice for your code.

*

*store return value of Input.GetMouseButtonDown() in a local
variable so you only check it once every frame (each update loop
itteration).

*try to use GetComponent<>() on Start() function and store it in a
global variable. because this function is not cost efficinet to be
called every frame.


text:
Q: Is Cypress.io really faster than Selenium? It looks like Cypress.io launched a massive marketing campaign and one of their selling points that it is '...Much, much, faster than selenium.'
I wrote a test suite of about 5 tests which go through a list of typical login screen validations.
I've used Watir for the selenium-based tests.
Cypress.io execution time 16 seconds.
Watir execution time 13 seconds.
Has anyone come across any proper speed comparison for these tools?


text:
Q: Qual é a finalidade do Array and String Dereferencing implementado no PHP 5.5? No manual do PHP, podemos ver nas New Features a funcionalidade de Array and String literal Dereferencing.
Exemplo:
echo 'string'[2]; // r
echo ['stack', 'overflow'][1]; //overflow

Pensando no caso de se obter um índice de uma string ou array, já funcionaria em outras versões do PHP, desde que o Array ou a string estivessem numa variável.
$var = 'string';
echo $var[2]; // 'r'

No PHP 5.4, eu sei que já temos agora o acesso direto aos membros de um array que são retornados por uma função, e que é muito útil por sinal (Function array dereferencing).
Mas, no caso do PHP 5.5, eu não entendo qual é a finalidade de obter um valor, através de um índice, diretamente de uma string ou de um array, já que estes não estão atribuidos a uma variável?
Pra mim, não faria nenhum sentido o programador fazer uso do primeiro exemplo acima.
Existe alguma finalidade mais robusta do que a do primeiro exemplo?

A: O exemplo da documentação é infeliz (que novidade, né?). Na forma como foi colocado, onde tudo é constante, não há vantagem mesmo. A documentação deveria ajudar entender a finalidade disto, mas preferiram uma abordagem burocrática.
Usando
echo ['stack', 'overflow'][$x];

é "melhor" (ou pelo menos o código fica mais simplificado) que fazer
switch ($x) {
    case 0:
        echo 'stack';
        break;
    case 1:
        echo 'overflow';
        break;
}

Veja funcionando no ideone. E no repl.it. Também coloquei no GitHub para referência futura.
Então é usado primariamente para simplificação de código. Imagine se tiver 10, 20, 30 elementos neste array, como o switch ficaria longo.
E de certa forma para manter um padrão. Se outras operações podem ser feitas diretamente com literais, por que não esta? Operações devem ser feitas em cima de valores e não em cima de variáveis. Se por acaso um valor vem de uma variável, de um retorno de uma função, uma expressão ou de um literal não deveria fazer diferença. Se isto tivesse sido conceituado corretamente quando a linguagem foi criada, existiria esta forma desde a versão 1.0. Só o PHP mesmo para fazer esta confusão.


text:
Q: Composite primary keys and influence on natural/surrogate keys usage I have a fairly simple question about natural/surrogate key usage in a well-defined context which manifests itself often, and that i'm going to illustrate.
Let's assume you are designing the DB schema for a product using SQL Server 2005 as DBMS. For the sake of simplicity let's say there are only two entities involved, which have been mapped to 2 tables, Master and Slave.
Assume that:

*

*We can have 0..n Slave entries for a single Master's row;

*Column set (A, B, C, D) in Master is the only candidate for primary key;

*Column B in Master is subject to changes over time;

*A, B, C, D are a mix of varchar, decimal and bigint columns.

The question is: how would you design keys/constraints/references for those tables?
Would you rather (argumenting your choice):

*

*Implement a composite natural key on Master on (A, B, C, D), and a related composite foreign key on Slave, or

*Introduce a surrogate key K on Master, let say an IDENTITY(1,1) column with a related (single column) foreign key on Slave, adding a UNIQUE constraint on Master's (A, B, C, D), or

*Use a different approach.

As for me I'd go with option 2), mainly because of assumption 3) and performance-wise, but I'd like to hear someone else's opinion (since there is quite an open debate on the topic).

A: I'd go for option 2. Keep it simple.
It ticks the boxes (narrow, numeric, unchanging, strictly monotonically increasing) for a useful clustered index (which is the default of PKs in SQL Server).
You need to force the uniqueness on A,B,C,D, though, to preserve data integrity, as noted.
There is nothing conceptually wrong with option 1, but as soon as you require more indexes on "master" then the wide clustered key becomes a liability. Or more work to determine which index is best as clustered.
Edit:
In case of any confusion

the choice of which index is clustered is separate to the choice of key

A: Your assumption (3) tends to suggest option (2) because it is inconvenient and potentially time consuming to deal with cascading updates of the primary key of Master when B changes.
Of course it depends on how often this will occur: if it is something that you expect to happen "all the time" then it suggests (A,B,C,D) is a poor choice of primary key; on the other hand, if it will only rarely happen, then (A,B,C,D) may be a good choice of primary key, and having those columns in Slave may have some advantages (no need to join to Master all the time to find out those column values).

A: Either 1,2 or 3. There isn't necessarily enough information to determine whether a surrogate is necessary or how useful it might be. Are any of the compound key attributes also part of some key or constraint in the Slave table? Is there some other key of Master that could be used as a foreign key? The fact that a key value may change shouldn't be the deciding factor because any key value may need to change - surrogates are no exception.

there is quite an open debate on the
  topic

Unfortunately, much of that debate is based on the mistaken assumption that you need to choose between either a surrogate or a natural key. As your option 2 rightly suggests you can use both as the need arises. One is not a substitute for the other because simple keys and compound keys on different attributes obviously mean different things in your data model and enforce different constraints on your data.

A: Three.
The first suggestion could be drop composte keys and add a new field for an automatic key, that is not related to the other fields. To both master and detail table.
It could be an integer autoincrement key or a Global Unique Identifier. Keeping composite keys in any S.Q.L. server brand, is dificult, and sometimes innecesarily difficult.
But, if you need to keep the composite key in the master table, you may still wonder how to deal with the slave table primary key. Many developers usually take the same fields for the primary key, from the master table, put it on the slave / detail table, and add an additional consecutive integer key. But, as you mention, if you have to change the key for master table, and keep the already existing detail rows, you get into trouble with the referencial integrity constraints.
Summary: I suggest, add a new field for the slave table, that is not related to the master table, add a foreign key of fields to the slave / detail table, that references the master table. Keep the detail primary key and the foreign key to master table, independant.


text:
Q: I am building a clock but it keeps resetting every minute import os
import time

count = 0
minute = 0
hour= 0

day_week = 1            #this is for the NAME of the day
day_list = [" ", "Monday", "Tuesday", "Wednesday", "Thursday","Friday", "Saturday", "Sunday"]

month_day = 1           #this is for the NUMBER of the month
month_list = [" ", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
month_count = 1

year = 0

while True:
    for second in range(0,60):
        command = 'clear'
        if os.name in ('nt', 'dos'):
            command = 'cls'
        os.system(command)
        print(month_list[month_day], day_list[day_week], f"{hour:02d}", ":", f"{minute:02d}", ":", f"{second:02d}")
        if second == 59 :
            second = 0
            minute += 1

        elif minute == 59 :
            second = 0
            minute = 0
            hour += 1

        elif hour == 12 and count < 2 :
            second = 0
            minute = 0
            hour = 0
            count += 1
            hour += 1

        elif count == 2 :
            second = 0
            minute = 0
            hour = 0
            day_week += 1
            month_day += 1
            count = 0

        elif day_week == 7 :
            second = 0
            minute = 0
            hour = 0
            day_week = 1
            month_day += 1
            count = 0

        elif month_day == 28 and month_count == 2 :
            second = 0
            minute = 0
            hour = 0
            month_day = 1
            month_count += 1
            count = 0

        elif month_day == 29 and month_count == 2 and year/4 :
            second = 0
            minute = 0
            hour = 0
            month_day = 1
            month_count += 1
            count = 0

        elif month_day == 30 and month_count == 4 or 6 :
            second = 0
            minute = 0
            hour = 0
            month_day = 1
            month_count += 1
            count = 0
        elif month_day == 31 and month_count == 1 or 3 or 5 or 7 or 8 or 10 or 12 :
            second = 0
            minute = 0
            hour = 0
            month_day = 1
            month_count += 1
            count = 0

        elif month_count > 12 :
            second = 0
            minute = 0
            hour = 0
            month_day = 1
            month_count = 1
            count = 0

        time.sleep(1)

The problem seems to be coming from the part of the code between "month_day == 29" and "month_count > 12"

A: As pointed out by Michael Butscher problem is f.e. in this part of code:
elif month_day == 30 and month_count == 4 or 6 :
            second = 0
            minute = 0
            hour = 0
            month_day = 1
            month_count += 1
            count = 0

when you write statement like this python interprets it as
(month_day == 30 and month_count == 4) or 6

Where bool(6) = True (for every integer other than zero it returns true)
Therefore code in this if is executed in every iteretion, which you cant see because month_day is 1 as default and second is local for the scope of loop and after changing, it goes to next value in iterator and that's what you print. Also luckily minutes don't get set to zero at sec = 59 because first if statement is true therefore elifs are skiped
Adjust all expressions to sth more like:
month_day == 30 and month_count == 4 or month_count == 6

or:
 month_day == 30 and (month_count == 4 or month_count == 6)

and it may work better


text:
Q: Convert Maven `maven-assembly-plugin` to Gradle I'm converting a Java project from Maven to Gradle.
One of the pom.xml is using maven-assembly-plugin to package dependencies into a single zip file.
I'm using custom configuration to specify the dependencies to package like so:
group = 'com.company'
description = 'projectA'

configurations {
    ciPlugin
}

dependencies {
    ciPlugin group: 'org.apache.httpcomponents', name: 'httpclient', version:'4.3.1'
}

jar {
    into('plugins') {
        from configurations.ciPlugin
    }
}

This works almost fine beside the fact I have the following files in the resulting zip file:

*

*commons-codec-1.10.jar

*commons-logging-1.2.jar

*httpclient-4.5.3.jar

*httpcore-4.4.6.jar

and when Maven runs it only has httpclient-4.5.3.jar.
Just for clarification, I'm not really packaging httpclient, I'm packaging private artifact but the behavior is the same.
How can I get only the direct dependency without transient ones?

A: Add the following (e.g. after the dependencies block):
configurations.ciPlugin.transitive = false

This will turn off transitive dependencies for all artifacts in the ciPlugin configuration.


text:
Q: Shortcode not working after move wordpress website files After I migrate the existing wordpress website files in public_html, the all new plugins installed, there shorcode are not working anymore on any pages.
Here's the page that I put a shortcode from newly installed plugin
http://www.homecredit.ph/2590-2
How to fix this?

A: On the page it shows as [vfb id='1′]
But, when I view source code, it shows as [vfb id='1′]
Look again at the code on the actual page - one mark is a right single quotation mark (8217) and the other character is called a 'prime' (8242).
Try removing the punctuation marks so it's just [vfb id=1] (best to use 'Text' view in editor window for this).


text:
Q: using google maps to get bus stops list Given a certain region in the united states, I'd like to get a set of bus stops in that region. I'd like to use this to catalog the bus stops in Austin, Texas. Is there a way of doing this with a web service from the google maps? I'm using c-sharp to make the web service calls.

A: Never used it, but looks like it may be close:
http://www.transitchicago.com/developers/bustracker.aspx
Did not find a regional one, this one just covers Chicago it looks like.


text:
Q: How to maintain single list instead of having multiple lists using linq? I have to order the list values. Where the first value must remain the same. Remaining values should order by descending.
Eg:
list<> repository={"car","bike","airplane","train","ship"};
After order the list excepted result be:
repository={"car","train","ship" ,"bike", "airplane"};
How can I simplify the code? Without using more than two list variable.
       List<Automobile> vehicle = new List<Automobile >();
       List<Automobile> vehicle1 = new List<Automobile>();
       List<Automobile > vehicle2 = new List<Automobile>();

            using (var entity = new AutomobileEntity())
            {
              vehicle = (from details in entity.dbVechiles.Where(i => i.IsActive == true)
                         join sp in entity.dbSpeed.Where(i => i.IsActive) on details.vspeed equals sp.vspeed
                         select new Automobile
                         {
                           Vid = details.vId,
                           VName = details.vName,
                           Vspeed = sp.vspeed,
                           VRate = sp.vrate
                         }).ToList();
            }

  vehicle1 = vehicle.Where(x => x. VName == "BMW").OrderByDescending(x => x. Vid).ToList();
  vehicle2 = vehicle.Where(x => x. VName != "BMW").OrderByDescending(x => x. Vid).ToList();

  vehicle1.AddRange(vehicle2);

  return vehicle1;

A: You can replace:
vehicle.Where(x => x. VName == "BMW").OrderByDescending(x => x. Vid).ToList();
vehicle.Where(x => x. VName != "BMW").OrderByDescending(x => x. Vid).ToList();

with:
vehicle.OrderBy(x => x.VName == "BMW").ThenByDescending(x => x.Vid).ToList();

A: List<string> repository = new List<string>(new[] { "car", "bike", "airplane", "train", "ship" });
var result = repository.Take(1).Union(repository.Skip(1).OrderByDescending(x => x));

returns
{"car","train","ship" ,"bike", "airplane"}
so in your case use
so in your case use return
vehicle.Take(1).Union(vehicle.Skip(1).OrderByDescending(x => x.Vid));

as mentioned by Marc if you want to prevent duplicates from being removed you can concat the rest of the list or prepend the first item as he suggests.
var result = repository.Take(1).Concat(repository.Skip(1).OrderByDescending(x => x));

A: I am not sure what you exactly want but here is a way to order a list but keeping the first one there:
List<string> repository = new List<string>{ "car","bike","airplane","train","ship"};
repository = repository.Skip(1).OrderBy(value => value).Prepend(repository.First()).ToList();

Edit:
Just saw that @Mr. Belis was a bit quicker with a similar Solution but if you use the ".Union" function you have to be aware that it will also cause a distinct on your list. So duplicates in your list will be removed.

A: This way:
using (var entity = new AutomobileEntity())
{
    return (from details in entity.dbVechiles.Where(i => i.IsActive == true)
               join sp in entity.dbSpeed.Where(i => i.IsActive) on details.vspeed equals sp.vspeed
               select new Automobile
               {
                   Vid = details.vId,
                   VName = details.vName,
                   Vspeed = sp.vspeed,
                   VRate = sp.vrate
               }).OrderBy(x => x.VName).ThenByDescending(x => x.Vid).ToList();
}

A: This could be done in a single query, although I am not sure about use of LINQ keywords.
var list = new List<string> {"car", "bike", "airplane", "train", "ship"};

list = (from x in list
      let firstItem = list.First()
      orderby x descending
      orderby x != firstItem
      select x).ToList();

A: Another option you could do for the same result.
repository.OrderBy(x=> x!= repository.First()).ThenByDescending(x=>x);


text:
Q: Error:(25, 13) Failed to resolve: com.google.android.gms:play-services-auth:9.8.0 I am trying to use the features from Google to create a GMail login system but when I tried to sync the project I got this error
  Error:(25, 13) Failed to resolve: com.google.android.gms:play-services-auth:9.8.0

These are the edited sections I made
Project:MarkRecorder
compile 'com.android.support:appcompat-v7:24.1.0'
 compile 'com.google.android.gms:play-services-auth:9.8.0'
compile 'com.github.bumptech.glide:glide:3.7.0'**

}
apply plugin: 'com.google.gms.google-services'
and   Module:app
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.2'
    classpath 'com.google.gms:google-services:3.0.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

A: You need to download the correct version of the Play Services library dependency you are using before you compile your project. You can do this through the SDK manager bundled with Android Studio.
From developers.google.com:
1. Start Android Studio.
2. On the Tools menu, click Android > SDK Manager.
3. Update the Android Studio SDK Manager: click SDK Tools, expand Support Repository, select Google Repository, and then click OK.

The current version of Google Play Services is 10.2.0, so you might need to go back and manually download 9.8.0 (unless you are willing to upgrade). Check this link for more info.


text:
Q: Swift Error: Cannot invoke 'append' with an argument of list type '(String)' I'm just starting to learn Swift.  I watched a video on getting started with basic swift programming and I copied the instructor's code directly into my Xcode.  However, I'm getting an error in my code that he did not get in his.  I triple checked that I did everything the same.  The code is below.  The last line gives the error in the subject.
var items:[String] = []

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}

@IBAction func additem(sender: AnyObject) {
    if (txtinput.text! == ""){
        return
    }
    items.append(txtinput.text!)
    txtoutput.text = ""
    for item in items {
        txtoutput.text.append("\(item)\n")

A: Presumably text is of type String. String doesn't have a method called append. Normally you would use...
 txtoutput.text = txtoutput.text + "\(item)\n"    // or
 txtoutput.text += "\(item)\n"

However, it is also possible to write an extension, so that you can call append. Perhaps this is what existed in the sample you saw?
extension String {
    mutating func append(str: String) {
        self = self + str
    }
}

A: You need to add the String to your existing String.
So in your case:
@IBAction func additem(sender: AnyObject) {
    if (txtinput.text! == ""){
        return
    }
    items.append(txtinput.text!)
    txtoutput.text = ""

    for item in items {
        txtoutput.text = (txtoutput.text)! + "\(item)\n"
    }
}


text:
Q: rvm and Capistrano not working together: rvm_bin_path setting not taking effect I am trying to set up Capistrano deployment for my Rails project. The server uses rvm. I need the script to run bundle install, hence the need for rvm to work with Capistrano.
When I run "cap production deploy," I get this -- any ideas why?
INFO [a5b60a00] Running /usr/local/rvm/bin/rvm wrapper system coupons bundle gem rake ruby on mydomain.com
DEBUG [a5b60a00] Command: /usr/local/rvm/bin/rvm wrapper system coupons bundle gem rake ruby
DEBUG [a5b60a00]    No bin path suitable for lining wrapper. Try setting 'rvm_bin_path'.
cap aborted!
rvm stdout: Nothing written
rvm stderr: Nothing written
/Users/chad/.rvm/gems/ruby-1.9.3-p194/gems/sshkit-1.1.0/lib/sshkit/command.rb:94:in `exit_status='
/Users/chad/.rvm/gems/ruby-1.9.3-p194/gems/sshkit-1.1.0/lib/sshkit/backends/netssh.rb:125:in `block (4 levels) in _execute'
/Users/chad/.rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `call'
/Users/chad/.rvm/gems/ruby-1.9.3-p194/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `do_request'
...

I have this in deploy.rb:
set :rvm_ruby_string, 'ruby-1.9.3-p194'
set :rvm_bin_path, '/usr/local/rvm/bin'
set :rvm_type, :system

and Capfile:
require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

and Gemfile:
gem 'capistrano'
gem 'capistrano-rails'
gem 'capistrano-rvm'
gem 'capistrano-bundler'

ls /usr/local/rvm/bin shows:
bundle                      rake                         ruby-1.9.3-p194         rvm-smile
erb-ruby-1.9.3-p194         rake-ruby-1.9.3-p194         ruby-1.9.3-p194@global  rvmsudo
erb-ruby-1.9.3-p194@global  rake-ruby-1.9.3-p194@global  rvm                     testrb-ruby-1.9.3-p194
gem-ruby-1.9.3-p194         rdoc-ruby-1.9.3-p194         rvm-auto-ruby           testrb-ruby-1.9.3-p194@global
gem-ruby-1.9.3-p194@global  rdoc-ruby-1.9.3-p194@global  rvm-exec
irb-ruby-1.9.3-p194         ri-ruby-1.9.3-p194           rvm-prompt
irb-ruby-1.9.3-p194@global  ri-ruby-1.9.3-p194@global    rvm-shell

and rvm list:
rvm rubies

=* ruby-1.9.3-p194 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

A: So! Turns out adding my "deploy" user on my server to the "rvm" group solved the problem.


text:
Q: jquery autocomplete to fill in another field I'm using autocomplete on one input field to fill in another:
<input id='fruit' name='fruit' type='text'>
<input id='details' name='details' type='text'>

jQuery code:
var x = ["apple", "kiwi", "lemon"];

$( "#fruit" ).autocomplete({
     source: x
});

jQuery(document).on("change","#fruit", function()
{
    $.each(x, function(key, value) {

        switch(value) {
            case "apple":
                $('#details').val("Delicious");
                break;
            case "kiwi":
                $('#details').val("Yummy");
                break;
            case "lemon":
                $('#details').val("Sour");

        }
    });
});

When someone selects apple, kiwi or lemon with the autocomplete then it fills out the other input field with the corresponding text.
I have two issues:

*

*Currently it always prints out "Sour"

*When you select an entry from the autocomplete you have to click away again to fill out the field. Is there a way to do this when someone selects a choice from autocomplete?

Here is a fiddle

A: I guess you get things bit hard using switch. If you take a look over ui documentaton you will see that you can use array of objects. If i were you i would put the source like this :
var x = [
    { label : 'apple', value : 'Delicious' },
    { label : 'kiwi', value : 'Yummy' },
    { label : 'kiwiooo', value : 'aaa' },
    { label :  'lemon', value : 'Sour' }
];

Now you know that for a certain label you have a certain value, without using switch and other stuff, so the rest of code will looks like
$( "#fruit" ).autocomplete({
    source: x,
    focus : function(){ return false; }
})
.on( 'autocompleteresponse autocompleteselect', function( e, ui ){
  var t = $(this),
      details = $('#details'),
      label = ( e.type == 'autocompleteresponse' ? ui.content[0].label :  ui.item.label ),
      value = ( e.type == 'autocompleteresponse' ? ui.content[0].value : ui.item.value );

  t.val( label );
  details.val( value );

  return false;
});

I put return false on focus because if the user choose to slide down on list with keyboard arrows, in #fruit input will appear the value and this is not ok.
You can play with stuff right here

A: You don't need or want the each loop inside the change handler. Just use the value of your input.
$(document).on("change","#fruit", function()
{
    switch($('#fruit').val()) {
        case "apple":
            $('#details').val("Delicious");
            break;
        case "kiwi":
            $('#details').val("Yummy");
            break;
        case "lemon":
            $('#details').val("Sour");

    }
});

This code could be improved by not performing the $('#fruit') on each invocation of the handler, but it'll solve your problem.

A: You can use autocomplete's change:
$('#fruits').autoceomplete({ source: x,
change: function (event, ui) {
        switch(ui.item){
              case 'apple': break;
              case 'kiwi': break;
        }
}})


text:
Q: If $\sum_{n=1}^{N}f(n)=b$ for all $N$ as natural so $\sum_{n=1}^{\infty}f(n)=b$? This seems clean it looks enough just take a very large natural number to this holds but I'm not sure if it really does since I was told so many times that we can't further a afirmation from $N$ to $N \rightarrow \infty$ so I'm doubting if I'm able to on this case.

A: $\sum\limits_{n=1}^{\infty}f(n)$ needs a definition to handle $\infty$.
The usual one is $\lim\limits_{N \to \infty} \sum\limits_{n=1}^{N}f(n)$, though possibly with a caveat about absolute convergence.
So here $\lim\limits_{N \to \infty} b$, which is $b$.


text:
Q: Function $f$ such that $f$ is non-periodic but $f(f(x))$ is? Is there a "nice" example of a function $f$ such that $f(x)$ is non-periodic but the composition $f(f(x))$ is? By nice I mean that preferably it will be defined entirely on the domain $R$ and be continuous/differentiable with the composition having non-zero period.
For example the function $f(x>0)=-x, f(x \leq 0) = 0$ is not nice.

A: A very simple example: $f(x)=\sin|x|$.

A: Let $a(x)$ be the sum of the binary digits of $\lfloor\,|x|\,\rfloor$.  I think that is not periodic.
$$f(x)=\sin^2(\pi x)(-1)^{a(x)}$$

A: One smooth function that works is
$$
f(x)= \begin{cases}
-\exp[-1/x] & x>0 \\
0 & x \leq 0
\end{cases}
$$
However, this doesn't give us a non-zero period.


text:
Q: the path for phpmyadmin i have www doc in html folder. i go to 192.168.1.1/phpmyadmin to pull it up. but when i ftp there i dont see any phpmyadmin folder under html folder. how can i find where phpmyadmin folder is? i am using centos

A: You don't see any phpmyadmin folder when accessing your hosting via FTP because it's an alias, some kind of virtual folder.
If you have an SSH access to your hosting, phpMyAdmin is usually located in /usr/share/phpmyadmin. If you don't find it there, try to locate it :
$ locate phpmyadmin

A: I've found that many distributions would rather install an application's web files within /usr/lib or /usr/share as a convention. As such, you may want to verify your apache configuration files to determine the exact path.
In this case, most likely you'll have the phpmyadmin apache directives within a file located within /etc/apache2/conf.d or /etc/httpd/conf.d or the like. The configuration file will have a  statement which will detail the location of your files.

A: It's probably in /var/www/html/phpmyadmin, but take a look at your Apache configuration files to make sure (try grepping for phpmyadmin in all your Apache config directories).

A: On CentOS, check: /usr/share/phpMyAdmin
If not there, do a
$whereis phpMyAdmin


text:
Q: Possible to download only updates to OpenStreetMap Data? Given the OpenStreetMap project and its data and the possibility of offline maps for clients, is there an established way to download only the delta of the weekly updates??
I am considering developing an offline capable application for smartphones(android first) and web clients.  This would involve downloading the OSM data for the region, which can be quite large for a mobile connection.  Ideally, there would be an initial large download and then each week as the new OSM data gets updated the client would retrieve only the new data,or data that has changed.
I have yet to dive deep into the workings of OSM to see if this data has a timestamp included with it.  If so you could theoritically set up a server that could serve only the delta.  Is there anyone doing this at this time?

A: Yes. See Planet.osm/diffs in the wiki. There are minutely, hourly and daily diffs available.


text:
Q: iPad 2 with Bluetooth Barcode Scanner I've been searching for a while on a way to read data from a barcode scanner into my iPad 2 application but I can't seem to find some sample code that indicates how. All I need is to know the API to use. I saw some sample code on GameKit but before I spend hours trying to learn an API that doesn't do what I want, I am hoping someone will point me in the right direction.

A: have you tried ZBar to scan bar codes?

A: The iPad 2 features a camera that you can try to use to scan bar codes. ZBar will be a good starting library, and it's open source with examples.


text:
Q: C# WCF - ADO.NET Entity model - DbSet empty? I created a new WCF project in visual studio based on a existing database.
I made two operations. One operation writes a record (createProfile) to the database and one retrieve data (GetProfiles). My project exists of 3 files: web.config, a edmx file and my svc class.
CreateProfile works fine, I checked in SQL and the record is created.
GetProfiles never gives a response. When I debug the context.UserProfileSet always counts 0 values.
Any suggestions on what is going wrong?
[DataContract]
public partial class UserProfile
{
    public int Id { get; set; }
    [DataMember]
    public string UserName { get; set; }
}

public class MusicOwnerService : IMusicOwnerService
{
    IEnumerable<UserProfile> GetProfiles()
    {
        using (MusicOwnerDatabaseEntities context = new MusicOwnerDatabaseEntities())
        {
            return context.UserProfileSet.AsEnumerable();
        }
    }

    public void CreateProfile()
    {
        using (MusicOwnerDatabaseEntities context = new MusicOwnerDatabaseEntities())
        {
            context.UserProfileSet.Add(new UserProfile { UserName = "John" });
            context.SaveChanges();
        }
    }
}

A: As far as I know, you cant pass an IEnumerable object over the wire with WCF (unless youve a duplex binding of some sort??)..  so you would be  best to convert to a list and return that list like below:
List<UserProfile> GetProfiles()
    {
        using (MusicOwnerDatabaseEntities context = new MusicOwnerDatabaseEntities())
        {
            return context.UserProfileSet.ToList();
        }
    }


text:
Q: Dax gives me 2 drastically different answers when I use Date Add When I use
PY Apps = CALCULATE([CY Apps],DATEADD('Transaction Date'[Date],-365,DAY))

I get the Total $4,704 (which is what I was expecting)
When I use
PY Apps = CALCULATE([CY Apps],DATEADD('Transaction Date'[Date],-1,YEAR))

I get $13,926
why such a massive difference? how can it work correctly when i'm lowering it by days and completely fly off the handle when its Years
My Date Table is just a Calendar
Transaction Date = CALENDAR(MIN(Query1[received_date]),max(Query1[received_date]))

my model is just 2 tables, one table that has a list of dates with their respective sales, and then the other table is my date table


text:
Q: How many messages can be queued up in a JMS topic? For my web app, I have a JMS topic which is receiving many messages at any given time. I have a MDB that processes the messages and updates the database based on the message data. I had been getting org.hibernate.exception.LockAcquisitionException when the topic was receiving multiple messages all at the same time so I changed the maxSessions attribute for the MDB to 1 and made it a singleton.
Now I am not seeing the Hibernate exceptions anymore, but I have concerns about performance. How large can I expect the Topic to get before I start seeing problems? I am using JBoss 4.3 EAP and I tried searching for how to configure this but nothing turned up. Will the topic size grow until Java runs out of memory or is this something that can be configured in JBoss?

A: By default, JBoss Messaging will store its messages in an embedded Hypersonic database. If your topic starts filling up, your memory consumption shouldn't increase linearly, but sooner or later the database will fill up (from what I recall, Hypersonic has a 40,000 row limit, in this configuration at least).
More generally, if you're producing messages faster than you're consuming them, then you have a problem.  You either need to produce them more slowly, consumer them more quickly, or work out a way of discarding messages.

A:
How many messages can be queued up in a JMS topic?

Would depend of the available memory or disk space, would depend of the JMS vendor and the queue configuration.
But concerning purely performance of updating to the database, you should do batch processing. (Even with only one thread). Get X message at a time, process them all, and send the batch update to the database using the same transaction. Chances are your database can update/update 100 or 1000 row in nearly the same amount of time as 1 row.
On a side note, are you concerned by performance at all ? Is it too slow right now?


text:
Q: Why am I getting an "undefined column error" I am getting this error when I run my script.
Script

`# Analyze another data set with row / col data using SpATS
library(plantbreeding)    # load library
data(dataset)
head (dataset)
str(dataset)
dataset$genotypes<-as.factor(dataset$genotypes)
m1 <- SpATS(response = "yield", spatial = ~ SAP(columns, rows), genotype = "genotypes", data = dataset)
plot(m1, all.in.one = TRUE)  # see all plots in a common plot`

Dataset is arranged as follows.

Variables are as follows.
> str(dataset) tibble [87 x 4] (S3: tbl_df/tbl/data.frame) $ genotypes: Factor w/ 87 levels "1","2","3","4",..: 66 51 64 62 77 2 86 69 21 74 ... $ Columns  : num [1:87] 47 47 47 47 47 47 47 47 47 47 ... $ Rows     : num [1:87] 55 57 59 61 63 65 67 69 71 73 ... $ yield    : num [1:87] 235 NA 152 119 146 ...

Error that I am getting.
Error in [.data.frame(data, , model.terms) : undefined columns selected
I have tried taking the quotes of variables but it doesn't solve the problem.


text:
Q: "Importing" phonegap project into new phonegap app So I have a software provider that gave me the source code of the app. But he removed all the phonegap files, so I ended up with the following file structure:

I tried importing from phonegap, which just does not work.
How could I create a new project but reuse that source code?

A: Create a new project (Using command line or anything you prefer)
Goto your old project and copy config.xml, plugins folder and www folder.
Paste them into your new project.
Try compiling in your new project.


text:
Q: Role.IsUserInRole I am adding a user to a role as follows (note that I run the code shown below on my machine):
    Roles.AddUserToRole(oMU.UserName, "Role1");

With the following code I check to see if the user is in the role:
    if (Roles.IsUserInRole(txtUserName.Text.Trim(), "Role1"))

and the user is indeed in the role.
I run the following to check if the current logged in user is in Role1 but it fails to enter the if statement - WHY? :
     if (User.IsUserInRole("Role1"))
     {
       // does not enter this code
     }

A: You cannot call Roles.IsUserInRole("Role1")
as soon as user is assigned to a role like this -
Roles.AddUserToRole(oMU.UserName, "Role1");

Why?
IPrincipal object is injected to HttpContext.Current.User on  Application_AuthenticateRequest only.
Therefore, you'll have to wait for next request in order to access Roles.IsUserInRole("Role1").
Updated
Make sure cacheRolesInCookie is set to false, because it has some issues.
<roleManager enabled="true" cacheRolesInCookie="false"
   defaultProvider="DefaultRoleProvider">
      ....
</roleManager>

A: I believe it should be User.IsInRole instead of Roles.IsUserInRole, or specifically specify the username as a parameter by passing Roles.IsUserInRole(User.Identity.Name,"Role1")
Roles.IsUserInRole, with one parameter, calls GetCurrentUser() for the username which will pull it from the CurrentPrincipal.  It sounds like it your currently logged in user is different from that on the current principal.


text:
Q: Concurrent bruteforce and memory overflow : the best of both worlds? I'm working on a bruteforce algorithm for solving a kind of Puzzle.
That puzzle is a rectangle, and for some reasons irrelevant here, the number of possible solutions of a rectangle whose size is width*height is 2^(min(width, height)) instead of 2^(width*height).
Both dimensions can be considered as in range 1..50. (most often below 30 though)
This way, the numbers of solutions is, at worst, 2^50 (about 1 000 000 000 000 000 so). I store solution as an unsigned 64 bits number, a kind of "seed"
I have two working algortihms for bruteforce solving.
Assuming N is min(width, height) and isCorrect(uint64_t) a predicate that returns whether the solution with given seed is correct or not.
The most naive algorithm is roughly this :
vector<uint64_t> solutions;
for (uint64_t i = 0; i < (1 << N); ++i)
{
    if (isCorrect(i))
        solutions.push_back(i);
}

It works perfectly (assuming predicate is actually implemented :D) but does not profit from multiples cores, so I'd like to have a multi-threadead approach.
I've come across QtConcurrent, which gives concurrent filter and map functions, that automatically create optimal number of threads to share burden.
So I have a new algorithm that is roughly this :
vector<unit64_t> solutionsToTry;
solutionsToTry.reserve(1 << N);
for (uint64_t i = 0; i < (1 << N); ++i)
    solutionsToTry.push_back(i);
//Now, filtering
QFuture<unit64_t> solutions = QtConcurrent::filtered(solutionsToTry, &isCorrect);

It does work too, and a bit faster, but when N goes higher than 20, There's simply not enough room in my RAM to allocate the vecotr (with N = 20 and 64 bits numbes, I need 8,3 GB of RAM. It's okay with swap partitions etc, but sinces it gets multiplied by 2 every time N increases by 1, it can't go further)
Is there a simple way to have concurrent filtering without bloating memory ?
If there isn't, I might rather hand-split loops on 4 threads to get concurrency without optimal size, or write the algorithm in Haskell to get lazy-evaluation and filtering of infinite lists :-)


text:
Q: Solve an algebraic equation involving complex numbers Please, solve for $x$ and $y$,
$$(x+i)(3-iy)=1+13i,
\quad x,y \in \text{Reals}$$

A: $$(x+i)(3-iy) = 1+13i $$
$$  3x+y+i(3-xy) = 1+13i \implies \left\{
3x+y = 1 \atop
3-xy = 13
\right.$$
Now solve the system for x and y.