Incorporating LogMeIn Hamachi into your own work network as dedicated VPN solution

Question: I've been using LogMeIn Hamachi for a while for personal use and recently I started to wonder how to (and if at all) implement it as full blown VPN solution for my multiple clients.
Those are usually small companies ranging from 5 to 60 people having Active Directory / Exchange / SharePoint and alike. Some of them have static IP's but crappy router or multiple locations where only main location has AD server and rest is kind cut off from the main location. This brings a lot of problems with Active Directory, passwords etc which I think LogMein Hamachi could solve as it would be connected to company at all times, with it's ability to create special types of network that limit users to be able to access only particular servers (depending on group). No need for user to do anything out of ordinary, do anything special. Just plug & play. Sounds Great!
What do you think about it? Is it secure, reliable solution ? What are possible drawbacks? Would you do it for small companies like the ones I support? As additional note I wanted to run multiple companies on same account to split the costs (200$/year isn't the cheapest for small 5-10 people company) but considering I can create special/separate networks I don't consider this to be security risk for any of those companies (or should I worry?).
I've been trying to set it up with my domain controller and my machine but I'm hitting some problems as I set DNS on my  Hamachi IP and my Domain Controller (currently having 2 IP Addresses) seems to respond properly just it's returning internal IP address names instead of Hamachi IP addresses which causes some problems to access resources. Any advice on that would be additonally appreciated.
As a side note I've been using LogMeIn Free for years and it's been a blessing.
Comment: Is there some reason, why you aren't looking at a more enterpiszy VPN setup? (OpenVPN, PPTP, L2TP, etc)
Comment: Non-static ip in some locations that need to be accessed. Easy of setup, easy of control.
Answer: I'd say it's worth a shot, though as https://serverfault.com/users/984/zoredache is mentioning, you may want to look at alternatives.
That said, Hamachi is probably significantly easier to get going with and maintain since you already have experience using it.
You'd definitely want several networks and to plan out which computers should be able to access which in advance.
The easiest approach may be to use the Gateway model, though. I use that personally, and that way I only need to connect to the gateway. I can then talk to other computers on the network as well, even if I'm not connected to them via Hamachi.
I don't recommend using a Hamachi IP as your DNS server, though. I've never done it, but it just sets off warning bells (which may or may not be valid) in me.
Finally, just make sure Hamachi's licensing doesn't say anything about using one account for several clients...since it'd cause trouble for your clients if they suspended your account for a violation! Not saying this is one - just saying to check and not rely on us for an authoritative answer.
You probably also want to talk to Hamachi's sales team or something since I'm sure they get these questions all the time. Take their answers with a grain of salt, obviously :)
Comment: There seems to be only problem with Gateway `Note: The Hamachi client will not act as a gateway on Workstation operating systems if they are domain members.`
Comment: Ah. You could go with Mesh then, though I'm not sure how you would expose other network resources like that. Does the failure apply to domain controllers as well?
Comment: It made bigger mess when I applied Gateway mode to my Domain Controller (SBS). It cut off Internet access and only LAN was working. So I RDP from another local machine and tried to fix it since it created some additional networks. When I did that all networks went down completely and I had to drive to work in the morning :-)
Comment: It seems Gateway works correctly only on Domain Joined servers. The statement on their site tells it won't work for workstations only. So as long as Gateway is server system it works fine. It doesn't support SBS 2003 (and it's what I used) so it broke my connections. When I used gateway on Windows 2008 R2 it works fine. There's no need for DNS server being applied to Hamachi connection as new IP/Network is created by Hamachi and VPN computers get normal ip addresses from INTERNAL network along with DNS settings.
Comment: @MadBoy, could you please elaborate more how you made it work ? I have domain-connected Windows 2008 R2 and Hamachi doesn't want to make it gateway :(
Comment: Try install/uninstall/install. It works for me on Windows 2008 R2 STD without Active Directory. I tried to install it again on other machine for different company and it failed cutting out Inet on it.. but the only thing that differs for me is that where it works is a hardware machine and where it failed was a VM. Maybe something that got to do with that. You may want to check that. I didn't had time to test it on hardware machine after it failed on the VM as i was running out of time and also I'm 3000km away from that machine so if it fails i'm out ;)
Comment: I got this working great. We put the gateway on a non-domain joined XP work station (presumably could use Win7) on the main LAN. Had *major* problems when trying to run it from our SBS 2003 server (also lost network connectivity and had to go in to the office to fix it!) If you get the gateway setup right, the rest just works (in my experience).


Setup Private Cloud on Windows Server 2008 R2

Question: My developers are building an app that may eventually be hosted in Windows Azure. However, we want to host it internally first for a variety of reasons. They pointed me to the concept of a "private cloud". It sounds pretty cool, but almost too good to be true.
I have a Windows Server 2008 R2 server that will be used for the app internally. If the app works well, we'd like to flip a switch essentially and host the app in Azure. My question is, is there a way to do this? I saw this article.
Once they started talking about the System Virtual Machine Manager and the Self Service Portal, it almost seemed like we were getting too far away from Azure. If I do all of this, will I easily be able to promote this app to Windows Azure?
Answer: That damn Cloud Word
Keep in mind that a private cloud is really no different than most of your internal web servers and applications today.  The article you provide takes it a step further by essentially allowing your dev team to create, scale, and control their own virtual machines.  In the end though, with the information you have provided all you are really looking for is IIS to run whatever application you have.
Is There a Difference between Azure and IIS?
The primary different between an Azure web app and one that runs on IIS is pretty simple, one has the Azure application container added to the solution and the other does not.  Azure's offering has expanded and you now have more control over the underlying VMs and even your own VMs but I'll approach this from the most basic viewpoint, using Azure as a PaaS or Platform as a Service model.
Visual Studio Configuration
It's pretty easy within Visual Studio to generate multiple build configurations, one specifically for IIS and the other for Azure.  This simply defines to build mechanisms that either prepares the application by setting up an Azure deployment package or another which simply creates an IIS package.

Remember Azure is essentially IIS just with configuration and settings files that have to go along with the application.

IIS Configuration
There really isn't much above and beyond the standard web server setup required here.  You may have additional requirements such as file storage and even caching (see Server and Azure AppFabric/Caching).  You will have to work with your dev team to determine what the requirements are and setup any necessary systems to support those.
Solution Considerations
Your dev team also needs to understand something important here: design and build the application to run in any environment.  What I mean by this is that regardless of the final deployment medium and path the application should work normally.  So in your situation they most likely will want to use dependency injection for file storage so either the Azure Storage API can be called or it can revert to a standard System.IO file storage mechanism.  Either way, just setting up the hardware to support the application isn't enough, it must be designed to support multiple environments as well.
Answer: This is a bunch of marketing trash. "The Cloud" isn't a single thing that can be easily defined. It's a pool of redundant, highly available storage and server hardware which is usually geographically disparate that provide people the ability to quickly and safely scale up or down their operation as needed.
A "private cloud" is just marketing bullshit for a virtualized server environment that is capable of being abstracted by a set of APIs and automated to scale like a "public cloud."
Azure is Microsoft's public cloud offering. A "private cloud" might come close to it, but it isn't the same.
What I would recommend for you is having two Azure instances. Get one for dev/testing and one for production if this is the service that you choose to use. That way, you know exactly what your application will do when you move it to production, since it's already on Azure.
Comment: Have to agree with this. "The Cloud" is what we describe it as to managers and other non-techincal people. Within the profession, doesn't matter who's hosting it where and what they call their product, you need a well defined set of requirements for your needs, a well defined spec for the product they're giving you and a set of procedures for deploying into / between those environments. Nothing magical happened just because someone said "cloud".


find rows in document term matrix for which row totals are 0 in R

Question: I am trying to perform topic modeling on chat data in R.
I am good till the process of creating of Document term matrix.
dtm<- DocumentTermMatrix(corpus)
dtm<-removeSparseTerms(dtm, sparse=0.995)
library(topicmodels)
rowTotals <- apply(dtm, 1, sum)
dtm2 <- dtm[rowTotals>0,]
ldaGibbs5 <- LDA(dtm,5)

gammaDF <- as.data.frame(ldaGibbs5@gamma)
names(gammaDF) <- terms(ldaGibbs5)
gammaDF

topics<-colnames(gammaDF)[max.col(gammaDF, ties.method = 'first')]

Till here I found the topic to which each document belongs to. i am now trying to map these topics to the original data frame.
Chat2way$topic<-topics

The following is the error
Error in `$<-.data.frame`(`*tmp*`, "topic", value = c("customer", "email",  :
  replacement has 1530 rows, data has 3561

This is because i removed some rows of dtm for which row totals are 0.
I would like to know which rows i removed in dtm so that i could remove the same rows in my original data frame also.
Thanking in anticipatory
Comment: Try `which(slam::row_sums(dtm) == 0)`
Answer: The following code will show the document IDs of empty rows.
rowTotals <- apply(dtm, 1, sum)
empty_rows <- dtm[rowTotals == 0, ]$dimnames[1][[1]]


javascript reduce sum array with undefined values

Question: I have this simple array with numbers:
var arr = [100,200,undefined,450,300];

I would like to use reduce for quickly summing up the values in that array like so...
var total = arr.reduce( function( s, v ){ return s += v } );

In return I am getting NaN.
Is there any way to make reduce to sum values in array with undefined values? like a flag or something... Thanks!
Answer: You could use a default value for falsy values (undefined, null, 0, '', and some more) with a logical OR ||, like
v || 0

That means if v is a truthy value, than take that value, if not, then take zero.

var arr = [100, 200, undefined, 450, 300],
    total = arr.reduce(function (s, v) { return s + (v || 0); }, 0);

console.log(total);

BTW,
s += v
   ^

is not necessary, because you do not use s anymore in the function. The returned value is the new value for s in the next loop. The variables of the callback are independent and they have their own scope.

Based on the comments, you need to normalize the data, if various types of items are given, which are not wanted.

Filter unwanted parts,
.filter(v => !isNaN(v))

convert wanted parts to the same type
.map(Number)

Then you need a function for folding the data, to get only a singel value out of two values, like an addition.
function add(a, b) {
    return a + b;
}

This function is now used as callback for Array#reduce with an

initialValue (Optional)
Value to use as the first argument to the first call of the callback. If no initial value is supplied, the first element in the array will be used. Calling reduce() on an empty array without an initial value is an error.

result = array
    .filter(v => !isNaN(v))
    .map(Number)
    .reduce(add, 0);

Comment: @HMR, good catch, a start value is necessary, if the check is only made for the second parameter of the callback and for an empty array.
Comment: @georg, right different question, different answer: arr.reduce((s, v) => isNaN(v) ? s : s + +v)
Comment: How about `[100,200,"300"]` then? ;))
Comment: Seriously, I'd compose here `.filter(!isNaN).map(Number).reduce(...)`
Answer: You could filter out the non numbers before you reduce your array.
This is not the most efficient way to reduce the list, but it is the most explicit where you are separating the functionality so you can easily follow the logic without needing to read through more complex logic.

var arr = [100,200,undefined,450,300,'string'];

var total = arr
  .filter(function(x) { return typeof(x) === 'number'}) // remove any non numbers
  .reduce(function( s, v ){ return s + Number(v) }, 0);

console.log(
  total
)
Comment: Good thinking, function composition is the way to go. The `Number` cast is obviously superfluous...
Answer: Just a ternary should do

var arr = [100, 200, undefined, 450, 300];

var total = arr.reduce(function(s, v) {
return v ? s += v : s += 0
});

console.log(total);
Comment: You should pass the second argument (in this case 0) to reduce to prevent it from blowing up on empty array.
Comment: Second parameter to reduce would solve `[undefined].reduce(yourReducer)` returning undefined as well
Answer: Try with filter():

var arr = [100,200,undefined,450,300];

var total = arr.filter(i=>i != undefined).reduce( function( s, v ){
    return s += v;
  }, 0);

console.log(total)
Comment: You should pass the second argument (in this case 0) to reduce to prevent it from blowing up on empty array.


create ftp connection using drupal

Question: I have made my own module, that has a form where the user can upload a file.
Once the file has been collected, Drupal should open an FTP connection to a server and upload the file into it.
I have found "Storage API" and "Media Move" modules that seems to have this kind of functionality, but I have no clue on how use those modules with my custom code.
How do I make an FTP connection from Drupal to an external server and upload the file?
Comment: Does the other server support PHP , then this might be helpful http://stackoverflow.com/questions/3135787/upload-file-with-php-to-another-php-server
Comment: @Terix: Looking for Same issue.Did you complete this task.
Comment: I suggest uploading of files(long background jobs) should be done by a cron job instead.
Answer: cURL ist the perfect library for this. It's available on most PHP servers. Check this for an example.

create ftp connection using drupal


Alternative for Node Gallery in Drupal 7?

Question: Will I be able to have show an image gallery for a multiple value image field on the node display in drupal 7 with some alternative module?
http://drupal.org/project/node_gallery is only available for drupal 6
that´s anoying, every alternative that I´ve found is eighter abandoned or only for D6
Comment: I'm voting to close this question because it's asking for recommendations or suggestions on books, tools, modules, themes, distributions, tutorials, or other off-site resources.
Answer: Field slideshow is a good alternative.
Answer: I stumbled upon your from two year question looking for an alternative for Node Gallery – and even though I don't know if your question is still valid, but at least I wanted to let you know a beta3 version of Node Gallery is available for dp7:
https://drupal.org/project/node_gallery
Answer: Here are a couple other image gallery modules for Drupal 7.
Media Gallery
Gallery Formatter
Answer: Use the Gallery Formatter and Multiupload Imagefield Widget module to get your result.


rust folder structure organisation

Question: src
 |-- abc
      |-- main.rs
 |-- logger
      |-- mod.rs
Cargo.toml

#Cargo.toml

[[bin]]
name = "abc"  # This will be the name of the binary executable
path = "src/abc/main.rs"

#logger/mod.rs

pub fn call_logger() {
    println!("Got called!");
}

I want to call this fn call_logger() from main.rs (abc/main.rs), how can I do so?
I tried this way,
I created lib.rs (src/lib.rs), contents of which is
#src/lib.rs
pub mod logger;

and I was able to call call_logger().
Just want to know what is the right way to achieve the above task, as lib.rs is used for library crate ?
Comment: Why won't you use standard layout?
Comment: Is `call_logger` shared? Then it belongs somewhere in the hirarchy of the library crate, if not, it belongs in `main.rs` hierarchy. You must put a `mod logger;` somewhere!
Comment: @ChayimFriedman I don't get it can you elaborate please
Comment: @cafce25 actually I don't want to use lib.rs, so can I still be able to call call_logger()? is there any way
Comment: No, binary crates can't be shared.
Comment: "Standard layout" is the layout Cargo uses by default, with no configuration. Meaning, binary crates are either `src/main.rs` or under `src/bin`, library crate starts from `src/lib.rs` (it defines all `mod`s, it is the root) and all files under `src/**/*.rs` are its submodules.
Comment: See also https://doc.rust-lang.org/stable/cargo/guide/project-layout.html.
Answer: There are two ways to make this work.

The path attribute.
If you only want a binary (no library), you can use the path attribute to specify where the module should be located:
// In src/abc/main.rs
#[path = "../logger/mod.rs"]
mod logger;

Create a library.
Create a file src/lib.rs and put in it:
pub mod logger;

Then, you can refer to the logger in the binary as crate_name::logger.

rust folder structure organisation


List all subgroups of the symmetry group of $n$-gon

Question:
List all subgroups of the symmetry group of the regular $n$-gon.

If $n$ is prime, there are only $n+1$ subgroups: subgroup of all rotations and $n$ subgroups with $2$ elements (one reflection and rotation by zero degrees).
But if $n$ is composite, there are additional subgroups in the group of rotations, namely rotations by angle $\frac{\pi}{k},\ k|n$. Also there are subgroups containing rotations and reflections, number of which I can't found. I know that $s_\alpha s_\beta=r_{2(\alpha-\beta)}$, where $s_\alpha$ is a reflection by the line inlcined at an angle $\alpha$ to the horizontal axis. So if a subgroup contains $r_\alpha$ and $s_\beta$, it contains their product $s_{\beta - \frac{\alpha}{2}}$.
What is the best way to count all subgroups for each $n$?
Update: I have found an group-theoretic answer at http://ysharifi.wordpress.com/2011/02/17/subgroups-of-dihedral-groups-1/
Later I will post the answer below.
Comment: Do it for a few small values of $n$, then look it up in the Online Encyclopedia of Integer Sequences.
Answer: The dihedral group of order $2n$ is generated by rotation $x$ through an angle $\frac{2\pi}{n}$ and a "flip" or reflection $y$. (These satisfy the relations $x^n=y^2=1$ and $yx^i=x^{-i}y$). The subgroup generated by $x$ is isomorphic to $(\mathbb{Z}/n\mathbb{Z},+)$, which has a cyclic subgroup or order $d$ for each positive divisor $d$ of $n$. Likewise, corresponding to each of these cyclic subgroups is a dihedral subgroup of order $2d$, the symmetry group of the $d$-gon. These subgroups can also be represented by the generators:
$$
\left<x^{n/d}\right> \cong C_d \cong \left(\mathbb{Z}/d\mathbb{Z},+\right)
$$
$$
\left<x^{n/d},~y\right> \cong D_d
$$
Thus, up to isomorphism, there are $2\tau(n)$ subgroups of $D_n$. However, the union of each coset $y\left<x^{n/d}\right>x^i=\{yx^{i+jk}|0\leq k<d\}$ with $\left<x^{n/d}\right>$ , for $0\leq i<k=n/d$, is isomorphic to $D_d$, forming a distinct dihedral subgroup of $D_n$ within each isomorphism class (this is Yaghoub Sharifi's Lemma 3 in @sergey-filkin's link). Since for each $d|n$ there are $n/d$ such cosets, we get $\sum_{d|n}\frac{n}d=\sum_{d|n}d=\sigma(n)$ different dihedral subgroups and $\tau(n)$ different cyclic subgroups of $D_n$, or $\tau(n)+\sigma(n)$ total subgroups of $D_n$.
Answer: A formula is given at http://oeis.org/A007503.
Comment: I don't know what you mean. The symmetry group of the regular $n$-gon is $D_{2n}$, which has $2n$ elements. $2n$ is even, whether $n$ is or isn't. The formula at the OEIS, which is the same as the formula at the link in your update, holds for all $n$, whether even or odd. If you don't think so, try it for $n=3$.
Comment: It's only for even $n$.
Comment: thank you for help, I haven't look carefully at the definition of $D_{n}$. Now it's clear.


Index's for largest and smallest values in Vector

Question: If the following code returns the index for the smallest value in the vector:
std::min_element(prices.begin(), prices.end()) - prices.begin();

Then why doesn't this code return the index for the largest value in the vector?
std::max_element(prices.begin(), prices.end()) - prices.begin();

EDIT: Example vector.
vector<int> prices{30, 20, 18, 15, 50}

Thanks.
Comment: Please include real code in your question, as a [mcve], instead of fantasy code. `vector prices{30, 20, 18, 15, 50}` is not valid C++ code. When corrected to "std::vector prices{30, 20, 18, 15, 50};", this works as expected.
Comment: @Sam Varshavchik, Calm down, that is the real code. `#include `
`using std::vector;` is at the top. Yes my bad I forgot to include the `` part. @juanchopanza, thank you for the edit.
Comment: As I wrote, this works as expected. `std::cout << (std::max_element(prices.begin(), prices.end()) - prices.begin()) << std::endl;` results in `4`, which is correct.
Comment: @Tahmid -- That's why you should have posted a [mcve], so that we can see how you're verifying that the index is not correct.  You didn't even assign or output the return value of `std::min_element` or `std::max_element`, leading to believe your real code does much more than what you've posted.
Answer: The code is working fine and as expected.
The index of first element is zero
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    vector<int> prices{30, 20, 18, 15, 50};
    int min_index = std::min_element(prices.begin(), prices.end()) - prices.begin();
    int max_index = std::max_element(prices.begin(), prices.end()) - prices.begin();
    std::cout<<"Minimum position: "<<min_index+1<<endl;
    std::cout<<"Minimum position: "<<max_index+1<<endl;
}

The
output:
Minimum position: 4
Minimum position: 5


Somando valores entre inputs html e javascript

Question: Caros amigos, estou tentando adicionar soma entre inputs do html e do javascript, mas com esse exemplo, apenas consegui colocar no input do html. Como faço para implementar no input do javascript e somar o valor junto com o Valor Total?

No Html ta assim:
html

  Valor Total:
  <input type="text" class="form-control" name="responsavel" id="result" readonly>

    Nome
    CPF
    Cargo
    E-Mail
    Parentesco
    Valor
    Ações

<button onclick="AddTableRow()">
  Adicionar Dependentes
</button>

Como está utilizando jQuery, pode alterar a sua função para isso, se achar mais simples:
 function calcular() {
         $('.valor').each(function() {
            total += parseFloat($(this).val());
          });
          $('#result').val(total);
    }

Answer: Podes simplificar isso e clonar cada tr:
 var AddTableRow = function(el) {
     var tbody = $(el).closest('table').find('tbody'); // ir buscar o tbody
     var row = tbody.find('tr:last').clone(); // criar um clone
     var name = row.find('.calcular').attr('name'); // buscar o nome do clone
     var index = parseInt(name.match(/usuarios\[(\d+)\]\[valor\]/)[1], 10) + 1; // ler o numero (que é do original ainda)
     row.find('.calcular').attr('name', 'usuarios[' + index + '][valor]'); // dar novo numero ao clone
     tbody.append(row); // adicionar no HTML
 };

e agrupando no HTML esses inputs com uma classe poderia ficar assim:
function calcular() {
    var soma = $('.calcular').get().reduce(function(soma, el) {
        return (parseInt(el.value, 10) || 0) + soma;
    }, 0);
    document.getElementById('result').value = soma;
}

jsFiddle: https://jsfiddle.net/1fz9rx41/
Nota: juntei thead e tbody ao teu HTML que tinha tags em falta.
Comment: A pessoa não sabe brincar e responde com dois bloquinhos de código... Isso é roubo :p. +1 pela simplicidade
Comment: Concordo. Além de ser mais simples, evita-se erros de digitação, como a falta de **aspas** no ID.
Comment: @Randrade é mais simples assim do que estar a escrever aquele HTML todo via JavaScript :P


understanding Openstack physical architecture

Question: So, please correct me if I am wrong:
I want to build my own cloud computing platform using openstack.
I buy a rack server- https://www.serverstack.in/
I install say 1TB of Hard disk. 30 GB of RAM and the processor is already built in.
I install redhat Linux on this . I install the required software. I use a deploying tool to install Openstack. Open the port it hosts openstack to the public. Is this correct or am I missing something? I understand there is more to billing and stuff in openstack.
If there is more traffic and people want more computing power, how can a dual core CPU balance all of them? Would I require a more costly CPU server stack?
In case I need to expand my deployment, do I simply replicate the whole setup and add an extra entry server which will load balance to each of the openstack deployments?
I know I am confusing a lot of things here.
Answer: Before I answer your questions, I am curious what you are planning to achieve, and why you think OpenStack is the right tool to achieve it.

I buy a rack server

You don't run a production OpenStack cloud on a single server. Typically, you need three controllers to ensure high availability, plus as many servers as you need to run your workloads (they are the compute nodes of your cloud).

I install redhat Linux on this . I install the required software. I use a deploying tool to install Openstack.

At a very high level, this is correct. However, there is no easy way to install and configure OpenStack, since there are so many options depending on your datacenter environment. It's very different from inserting a Ubuntu DVD, answering a few questions and ending up with a functioning Linux installation after 20 minutes.

Open the port it hosts openstack to the public. Is this correct or am I missing something?

Networking is the most complex part of a simple OpenStack cloud. It's a bit more than just opening a port.

I understand there is more to billing and stuff in openstack.

OpenStack doesn't have a billing module, although Cloudkitty provides some foundation for billing. You will still have to develop your own solution or use an add-on billing solution.
And yes, there is a lot of "stuff" in OpenStack.

If there is more traffic and people want more computing power, how can a dual core CPU balance all of them? Would I require a more costly CPU server stack?

Your cloud can handle a certain workload. If you see that your workload is too much for your current cloud setup, you add a compute node. Larger installations (starting with 50 or 100 compute nodes perhaps) also may have to add controllers and upgrade their network infrastructure.

In case I need to expand my deployment, do I simply replicate the whole setup and add an extra entry server which will load balance to each of the openstack deployments?

Load Balancing has a very specific meaning, and it's not a suitable term here, but in a way, yes, the OpenStack controllers balance the workload (i.e. virtual machines) over the compute nodes. Adding a compute node is not hard.
In my opinion, the best way to learn about OpenStack is installing it manually. Be warned, it's a steep learning curve, but it's rewarding. When I did it, I was forced to learn a lot about fundamental subjects like networking and open-source culture.
Comment: By three controllers I mean three servers running identical control software and linked together with High Availability solutions like Pacemaker or HAProxy+Keepalived. Controllers should not run workloads. Again, this is for a production installation. Of course, you can install OpenStack on a single server, and it's even very simple to do so (see Microstack, Packstack or Devstack for the easiest methods), but only for educational or proof-of-concept purposes.
Comment: OpenStack consists of several components that can run on a single server or be distributed. A cloud normally has Keystone, Glance, Nova, Neutron and most probably Cinder. Swift is not required; many installations use Ceph instead of Swift, for example, or no object service at all. Nova and Neutron have components on the controllers and the compute nodes; Keystone, Glance and Cinder run on controllers only (except if you also have separate storage nodes, in which case the Cinder volume service runs on those). It's not that simple, and therefore please use docs.openstack.org to educate yourself.
Comment: A load balancer is one necessary ingredient for a HA setup, but you also need something that detects that a server becomes inaccessible. I am aware of Pacemaker/Corosync as one solution, and HAProxy/Keepalived as another (used in the now-defunct product HPE Helion and SUSE OpenStack). NGINX is probably not the best fit for this. I don't know what you mean by custom user interface - OpenStack does have a dashboard, do you mean that? It has nothing to do with the physical setup.
Comment: That's an awesome read, thanks. I am thoroughly confused on the physical architecture. The fact that swift/glance services are different means that if the physical storage can be on one server/node, while the nova compute itself could be running on other compute node right? One more final question, you said three controllers- that means three servers where-in, one is the controller and two are the computing and storage nodes. The controller is sort of like an entry point, right?
Comment: so in real world production case, 3 servers which have openstack on them are load balanced by say something like nginx(something I'm familiar with)? Oh...that's why they put up a custom user interface to direct to the right server?
Comment: Thanks for the guidance. :)
Comment: My problem is simple- 3 controllers. All have openstack on them. How does it manage and pool the resources? Say a user(not admin), creates a VM through horizon(dashboard). Where is this VM created at? Server 1, server 2 or server 3? Is each server load balanced at login page itself or it is load balanced at VM creation stage?
Comment: Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/119690/discussion-between-berndbausch-and-vishwa-mithra-tatta).


Distance from point to parabola (quadratic bezier)

Question: I'm trying to draw quadratic bezier curve (as line).
I approximate  quadratic bezier curve as parabola ($y=x^2$), according to this document http://http.developer.nvidia.com/GPUGems3/gpugems3_ch25.html
There, in section "25.5 Antialiasing" Loop/Blinn claims that signed distance from point (x,y) to the curve $f$(which is $y=x^2$) is:

or:

Is this correct? [I read, that it is impossible to have another "parallel" bezier curve]
I ask this because, if I want to detect distance more than 1-2 pixels, and have a high
triangle base/height ratio, than "distance" shrinks on the base direction.
For example, here is 50px distance from inner side of the curve filled green, all other red (all ok):

And this one shrunken (pay attention, that distance on height axis still is correct):

Curve drawing in triangle with coordinates (0,0) (0.5,0) (1,1). Which is 1st quadrant.
Answer: The formula gives only an approximation. If $f(\mathbf x)$ is a continuously differentiable function and the point $\mathbf a$ is ,,close'' to the implicit curve/surface $f(\mathbf x)=0$ and the closest point of the curve is $\mathbf a_0$ then
$$
f(\mathbf a) = f(\mathbf a)-f(\mathbf a_0) \approx (\nabla f)\cdot (\mathbf a-\mathbf a_0).
$$
The vectors $\nabla f$ and $\mathbf a-\mathbf a_0$ must be approximately parallel, so
$$
f(\mathbf a) \approx \pm ||\nabla f(\mathbf a)|| \cdot ||\mathbf a-\mathbf a_0|| = ||\nabla f(\mathbf a)|| \cdot sd.
$$
If the point $\mathbf a$ is far from the curve then the formula is useless.

If you need the precise distance from a parabola then it leads to some cubic equation.
Comment: Why it is important, for $a$ to be close to curve?
Comment: "If you need the precise distance from a parabola then it leads to some cubic equation." - Like what?
Comment: The estimates $f(\mathbf a)-f(\mathbf a_0) \approx (\nabla f(\mathbf a))\cdot (\mathbf a-\mathbf a_0) \approx (\nabla f(\mathbf a_0))\cdot (\mathbf a-\mathbf a_0)$ are valid only if $||\mathbf a-\mathbf a_0||$ is small.
Comment: Is it possible to get some formula to calculate minimal distance from point to $y=x^2$ (where x from 0 to 1)?
Comment: You have to minimize $(x-a)^2+(x^2-b)^2$ which is a quartic poynomial.
Comment: What is $(x-a)^2+(x^2-b)^2$ ?
Comment: squared distance between the points $(a,b)$ and $(x,x^2)$.
Answer: In my opinion, sd is not a distance at all, signed or not.
By analytic geometry, the distance of a point $P=(x_0,y_0)$ to the line given by the equation $f(x,y)=ax+by+c=0$ is $d=\frac{|ax_0+by_0+c|}{\sqrt{a^2+b^2}}=\frac{|f(x_0,y_0)|}{||\vec\nabla f(x_0,y_0)||}$. I think, that is why they defined "signed distance" as $sd=\frac{f}{||\vec\nabla f||}$. But, it really does not make sense for curves of higher degrees. For example, the distance of  $P=(x_0,y_0)$ to the circle given by the equation $f(x,y)=(x-a)^2+(y-b)^2-r^2=0$ is $d=|\sqrt{(x_0-a)^2+(y_0-b)^2}-r|$ which is $d=\frac{|f(x_0,y_0)|}{\sqrt{(x_0-a)^2+(y_0-b)^2}+r}$. But, the denominator of $d$ is not the magnitute of the gradient, that is, it is not $||\vec\nabla f(x_0,y_0)||=2\sqrt{(x_0-a)^2+(y_0-b)^2}$. In fact, the gradient is zero at the center $(a,b)$ and $sd(a,b)$ is not defined.
To find the distance of $P=(x_0,y_0)$ to the parabola $f(x,y)=y-x^2=0$ you have to solve this equation:
$$2x^3+(1-2y_0)x-x_0=0.$$
It is not so difficult to derive it. See this link. Then the distance is $$d=\sqrt{1+\frac{1}{4x^2}}|x-x_0|=||\vec\nabla f(x,x^2)|||\frac{x-x_0}{2x}|$$
where $x\neq 0$ is the solution of the cubic equation above. Again, $sd$ is only a bad signed approximation here as I can see $d\approx\frac{|y_0-x_0^2|}{\sqrt{1+4x^2}}|\approx|sd|$, from a "rough figure" when $P$ is close to the graph of $y=x^2$.


Can we deploy kony dockers into non Azure cloud, As per my understanding kony only supports dockers for Azure cloud

Question: I am struggling to get the details to understand if kony supported docker images can we published to any non Azure cloud, like AWS and google cloud.
Answer: Images for all the components that make up Kony Fabric — Kony's API Manager and Middleware — are published to the Docker Hub under the konyfabric account. These images are agnostic to whatever the external container orchestration layer is.
If you look at this post on Kony Base Camp you'll see there is a diagram that shows the additional dependencies for deploying the Kony Platform onto Azure.

Notice that this guide is based on the use of Kubernetes, and the only other things you'd need besides the pods are a load balancer (NGINX in the diagram) and a database. All you'd really need to do in order to deploy to another IaaS vendor is get equivalent services to Azure's Kubernetes Service, Azure SQL DB and an NGINX pod.
Answer: As of now Kony Fabric docker container is supported for on-premises and Azure Cloud only. Kony is planning to extend its support to other clouds as well in near future.
Answer: Currently it is not supported. However you can raise it as idea in
https://basecamp.kony.com/s/ideation?page=1

article mentioned by @Mig82 given an overview of fabric in docker.
You can download Kony Fabric docker from below link along with installation link.
https://community.kony.com/downloads/archive
The prerequisites can be checked from here. But you may need Kony login to access.


Integrated Windows Authentication, Azure Active Directory and an AAD Joined Azure VM

Question: I'm hoping someone maybe able to help by either helping identify what I'm missing, or confirming if indeed it's possible.
Background
We have a new Azure VM with Windows 2019 Datacenter on and IIS installed.

The machine is Azure AD Joined.
I can log into the VM via RDP with my Azure AD account.
We do not have a local AD.
We do not have AAD Domain Services.
The VM is accessible only via a VPN connection.
On IIS, the default website has been switched to Integrated Windows Authentication only.

The VM has a DNS 'A' record that points to it's IP address. e.g catchyname.ourdomain.com resolves to the VM.  This is set up both in our Private Azure DNS for the internal Azure network and our external DNS provider.
Problem
When logged into the VM directly, I can access the default IIS Welcome page, by browsing to http://machinename/ or via http://localhost and it is served correctly.
If I try to navigate to the same page via http://127.0.0.1, via http://catchyname.ourdomain.com or via the machines IP address the user is challenged for a user name and password.  Interestingly, the challenge box recognises my AD user (as I'm signed into the VM with) and requests the PIN that accompanies it but fails to accept any input and responds with a 401.2.5 error and the message:

You are not authorised to view this page due to invalid authentication headers.

When I check the logs, for successful requests I can see that the source IP Address in the IIS logs is shown as ::1
If I log into web another application on the box (SSRS2017) which relies on Integrated Windows Authentication using the correct URL i.e. http:/machinename/Reports/browse, it also lets me in and displays the user I'm logged in correctly as as AzureAD\MyUserName
If I add machinename to my C:\Windows\System32\drivers\etc\hosts file and try browse to it remotely via http:/machinename/ it also fails.
Question
Is it possible to enable AAD Authentication for sites in IIS that are resolved via a DNS alias that performs in the same manner as when I navigate by the machine name or via localhost? If it is, what steps do I need to take?
If I can resolve this, my next step is to see if we can enable these websites using this method of authentication for our Windows desktops that are also Azure AD joined, so normal users can browse to the sites on the VM and access them successfully.
Things I've Tried
I've googled muchly over the last 24 hours, and investigated articles that recommend registry changes to disable loopback check for local IIS websites, I've read articles on configuring federated auth for .NET apps but with the feeling I'm going too deep at this point.
I keep circling back to the fact that if I browse to http:\\localhost\ everything seems to work and I don't know why this would be different for http:\\dns-alias\
Can anybody help?
Thanks!
Answer: What you're doing will not work, here is why with some alternatives:
You have enabled Windows Integrated Authentication, that really depends on a domain environment to work correctly, which you do not have: https://docs.microsoft.com/en-us/aspnet/web-api/overview/security/integrated-windows-authentication
IIS does not understand Azure AD accounts authentication, IIS will not talk to Azure AD at all for authentication because it simply lacks that feature, doesn't matter what your DNS record is or where it is pointing: https://docs.microsoft.com/en-us/iis/configuration/system.webserver/security/authentication/
You possible options moving forward is to:

Ask your development team to integrate Azure AD authentication within the app code (if you own the app and have access to the code, not my preferred method if you don't want to invest in changing code): https://docs.microsoft.com/en-us/aspnet/visual-studio/overview/2012/windows-azure-authentication
Use Azure AD to publish your app online without the need to use VPN, using a simple proxy service from Microsoft called Azure AD Application Proxy, you install it on the IIS server, register the app online and do some configuration and that's it, your app can be accessed securely anywhere. Best part is that you can use things like Azure AD Authentication and even Azure AD Conditional Access Policies.

There's a lot to read here, have fun learning:
https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/application-proxy
https://docs.microsoft.com/en-us/azure/active-directory/conditional-access/overview
Comment: Noor, Thanks for pointing out a) the problem but also b) very clear way forwards!

I must admit I'm not a fan of option 1 as I was hoping to enable this for some apps where we have no control over the code base so option 2 looks to be an obvious winner.

Unfortunately, I'm currently can't to test it as our AAD environment isn't a Premium subscription however from my initial reading it looked like exactly what we needed which is a shame.

I'll mark this answer as accepted though and hope to secure a trial of premium AAD in the future.

Thanks,

Paul.
Comment: Sure thing, glad I was able to help


A melody is built from both notes and chords

Question: A web site reads :

The difference between notes and chords is that a note is a single
pitch (for example C). ... This is important in music theory because a
note will have no characteristic when played on its own. However, when
a chord is formed from a group of notes then this will form a certain
feel of mood (E.g. happy, sad, bright or dark).

My question is that, since a good melody does have a certain feel of mood, the melody is built from both notes and chords. Am I right?
Comment: SBMVNO - please don't change a question after answers have been posted. It can invalidate existing answers, or at least change the way others would answer. You can always post a new answer, and even refer to the old one for context if applicable.
Comment: My short answer is: I wouldn't put too much effort into making sense of this quote. It doesn't say what it's trying to say very well, and I'm not sure it's thought about it very well either. The point it's trying to make is easy to argue against, and it only applies to certain types of music. I'll post my longer answer later— if I can find time, I'd even like to record a video to disprove it!
Comment: The whole article is amateurish. It is badly written with bad grammar and faulty explanations. Ignore it and find something better!
Comment: I had a quibble with the web site's wording too. Notes and chords are not the horizontal/vertical aspects of pitch. Both melody and chords are notated with notes.
Comment: I vtc as the question is somewhat vague. I tried to answer, but now realise maybe I answered a different question!
Comment: @SBMVO regarding the web site you mention. Almost all web sites are total crap, and I wouldn't even bother reading it.  The quote you give from the web site is incoherent, I wouldn't worry about it either way.
Comment: Direct answer: you understand correctly: what you are hearing in your head when you imagine a melody, contains also the harmony.
Most of the comments (and answers) are more thorough than this one, but seem to miss the important point :)
Comment: @SBMVO  "melody" is simply a *word* that literally means, "the single notes and not the chords".  Your question should say something like "Are songs built from both melodies and chords?" and of course the answer is yes. You can, factually, have an incredible song that is purely melody and no chords.
Comment: It stifles creativity a great deal to  think of minor vs major as sad or happy. It is much better to consider there character as minor or Major.
Answer: Your question deals with pitch and how it is used expressively.
The expressiveness of a single pitch is limited, but I would not say it has no expressiveness, no character. Excluding other factors like timbre or dynamics pitches do fall within some range high or low, and that will give a single pitch some character.
But the really big potential for pitch comes from the relationships of one pitch to another. Those relationships can either be successive - one pitch after another - which is melody, or they can be simultaneous - which is chords and harmony.
There are many ways to compose melody and harmony, but one common way to do it treats melody as being derived from chords. An example is the opening four bars from Mozart's Eine Kleine Nachtmusik where the melody is formed entirely from the pitches of a G major triad and a D7 dominant seventh chord. This can be called arpeggiation or broken chord melody.
You can also think of this chord/melody relationship in the opposite direction: the melody implies the chords G and D7. We don't literally hear the pitches of the chords played simultaneously, but their relationship to the chords is so clear and direct it's like we can hear the chords in our minds.
Melodic lines can also imply chord even when the melody is not a obvious broken chord line. Scale degrees have certain harmonic tendencies which can imply chords. Tendency tones is a term applied to this concept. Probably the most obvious example, given in solfege, is DO TI DO, where DO is the tonic scale degree and TI is the leading tone scale degree, and the strongly implied harmony is I V I. RE and MI can imply the dominant and tonic chords respectively. So, short melodic segments like MI RE DO can imply harmony I V I or I6/4 V I. Notice that these harmonic implications come from step-wise scale movements rather than the more literal chord based melody of broken chords.
Not all melodies work by those methods, but many do, so the answer to your question is: some melodies are built from the pitches of chords.
Comment: @ToddWilcox, I tried adding a little more to cover implied stepwise motion.
Comment: To complete the picture and have timbre and dynamics included rather than excluded, one could talk about pulse and meter, which give meaning and importance to pitches. And timbre and dynamics are an important part in forming a perception of pulse and meter. All transients actually. When a sound starts, when it ends, when it moves, all are rhythmic events. In my opinion, Western music theory and discourse focuses a lot on talking about pitch relationships, and maybe too little on what happens on the time dimension.
Comment: Yes, but unrelated to the question asked.
Comment: Of course it's related. OP asks about the elements of melody, and pulse and meter are very important elements. Sometimes even the only elements.
Comment: I feel like there could be more about implied harmony in here, specifically that it's not just about a melody made from arpeggiation. One quite clear example is a phrase ending with the leading tone followed by the tonic. Stepwise melodies that start with the root of a chord and go up or start with the fifth and go down also imply harmony strongly. I feel like a more complete picture of implied harmony would help the asker with their last question about notes vs chords.
Comment: Without having read this exchange, yeah, I definitely assumed in my answer that timbre and dynamics *should* be considered in disproving the source's statement—seems fair game when it's made so baldly and universally, "a note has no characteristics."
Comment: Also, upvote for directly answering the core question, but I should point out that it doesn't necessarily speak to the underlying fallacy. A melody (*Eine Kleine*, *Fanfare for the Common Man*, opening phrase of *Star Spangled Banner*) might be constructed entirely of arpeggiated chords, but that doesn't necessarily mean that it derives a certain emotive impact (especially, a specific *prescribed* one) from that chord.
Comment: @AndyBonner, I'm trying to avoid a general overview of melody, and only address what read as the fallacy in the linked web site post, which is roughly "pitches only form expressive relationships when played simultaneously in chords." I mean to point out only that expressive pitch relationships also come from successive pitches in a melodic line. I leave all the other aspects of melody to other specific questions.
Answer: I wouldn't work too hard to derive "truths" from this website. It has a point to make, and there are some good aspects to that point, but it's a very simple point and it makes it in a conversational, not-very-careful way (and not entirely clearly either). It makes one indefensible overstatement (or "under-explanation"?), which you disprove by your question. The website itself isn't very valuable as a source for learning about music; people have been thinking (better) and writing (better) about these ideas for centuries. But it's worth discussing if only to clear up some of these limitations.
First, definitions. The website is using informal, conversational definitions, so let's use them as well. This is what most people in most contexts mean by these words:

note: This is a note: . We could get really complicated and scientific about our definition, and talk about fundamentals and harmonics, but conversationally, we can talk about "a single note." A "tone," or "pitch," that we understand as a single unit. Many instruments play only one note at a time—as the human voice usually does (aside from some unusual techniques).
chord: This is a chord: . Several "notes," happening at once—at the same moment in time. Chances are, they fit some recognized pattern, like say a major triad.
melody:  Most people use "melody" to mean "a series of 'notes' happening one after the other." Where chords look vertically, melody looks horizontally. It "connects the dots" from one note to another, across time, to make a recognizable "tune" (motif, theme, riff, lick...). "Melody" is often contrasted with "harmony":
harmony: In this clip:  I've added "harmony" to the "melody." The treble clef still holds single notes—"the melody"—while the bass clef accompanies it with "chords," a.k.a. "the harmony." This kind of conception differentiates between notes by role—why didn't we call the series of lowest notes a "melody"? Because that's how we're thinking of it, that's why. This analysis started by identifying a string of notes as "melodic," and then relegated other notes to a supporting role. This system makes analytic statements and assumptions. And it works for some music. (And even for "that kind of music," these words are only useful in casual talk; for in-depth analysis we might require more careful words like "voice," "harmonic," "tonal," "function," etc.)

Now, let's cut straight to the most problematic bit of the quote:

A note will have no characteristic when played on its own. However, when a chord is formed from a group of notes then this will form a certain feel of mood (E.g. happy, sad, bright or dark).

There are many problems with these two sentences. The second sentence makes assumptions about how certain chords make us feel. This kind of simple discussion can be useful when talking to kids—"How does this chord make you feel? happy? sad?"—but it doesn't hold up to a broader view of "all music." The ancient Greeks had a lot to say about how certain combinations of notes made people feel—warlike, amorous, peaceful, etc—and so do many other music-cultures. The problem is, they don't all agree. A given musical construct might carry an emotional payload, but that's culturally construed. There's nothing about the scientific distances between these pitches that is actually "sad."
Furthermore, it's pretty easy to argue with even within a music-culture. There are plenty of "happy" pieces in minor and vice versa. Even an overall "sad song" uses major chords as well as minor; it's what it does with them. There's are many, many posts on these topics already on this stack exchange; here's a search for "happy minor", and others could be just as fruitful.
But now let's assault the biggest mistake: "... a note will have no characteristic when played on its own." In fairness, I think the author is having trouble expressing what they really mean, and has also overstated their case. A more defensible (but clunkier) rewrite might be: "Within the Western tonal tradition, it's hard (although possible) for a single note to convey much emotion. You can do much more emotively by choosing how you harmonize it." That's fair. But I'm sorry, no, a single note does have "characteristics." Even setting aside hair-splitting arguments, we could stay with the author's intended meaning of "expressive impact," and still pack that into one note.
I could get out a violin and play you a single note—in fact, maybe I'll edit this post to prove it on video later—and I could make it "angry," "wistful," "playful," "tentative," "plaintive," etc. I can change the overall volume of the note and how long it lasts. I'm cheating a bit by picking an instrument that can do a lot to shape the note even after starting it—I can get louder and softer during the note; I can change the timbre by altering the weight or speed of the bow, making it "growly" or "breathy." I can use "vibrato," wiggling the pitch around but still counting it as the same "note."
So no, a note by itself is not helpless to convey meaning. You then extrapolate from the author's point about "notes" to what we can say about "melody." If an individual note carries no emotion, does that mean melodies can't convey emotion either? And your question proves the author's error, because yes, of course, there are many (memorably, famously) moving melodies.  Maybe some of these rely for their power on the chords that they imply, but that's not the whole picture. You could play the theme from Schindler's List unaccompanied and make people cry, but you could also take the underlying chords and write a new, boring, banal melody to go with them. It's the large leaps in the theme that make it work.
And frankly, it's just insulting to monophony ("melody") to suggest that it's incomplete or incapable on its own. With apologies to Goria Steinem and Irene Dunn, a melody needs harmony like a fish needs a bicycle. First of all, if we step back and look at music across the globe, and across time, much of it is music in which we can't talk about this "harmony" thing anyway, or at least not in the same language. The vast majority of music across human experience has been monophonic—that is, one note at a time, a.k.a. "melody." We can't talk about "chords" with the traditional musics of much of Eastern Europe, Asia, Africa, indigenous Americas, etc. You can't talk about them in medieval chant. Even when European classical music started using "multiple notes at once," they didn't think about "chords" in the renaissance, or even all the time in the baroque, and even later. Instead they thought about "counterpoint," "voices," i.e. multiple "melodies happening at once. You can't talk about "chords" in a lot of art music from the twentieth century and ongoing—atonal music is often contrapuntal, or it's easier to talk about "pitch clusters" than chords. And the whole assumption that music does or should convey or cause a "mood" is not an underlying assumption of a lot of work.
So... where does that leave us? If the logic suggested by the website was:

notes can't convey mood
chords can
but melodies can convey mood
therefore... melodies must have chords in them?

... then we've reached a problematic conclusion because we started with a fallacy. A better flow might be:

notes can too convey mood
so can chords
melodies sure as heck can
and adding chords to them can help
and yes, as other answers here have shown, melodies can imply chords, or even yes, "contain" chords by sounding the notes of the chord one at a time.

But we should be careful about making any statements about what's true "of music" without defining how our conversation is limited, and very careful about drawing conclusions from writing that is not careful.
Comment: Seems to me the two groups of bullets at the end of this answer are all the answer really needs and the rest is just tedious.
Comment: @ToddWilcox Heh, true. As usual I've let my answer get so long that it needed a "sum-up."
Comment: You've nailed it with this rather verbose answer, possibly necessary in the circumstances! But +1 at least. If I'm not wrong, OP has a strange conception of what constitutes a note, and even a chord, so answering such a vague, inaccurately based, ill informed  question isn't an easy job!
Answer:
since a good melody does have a certain feel of mood, the melody is
built from both notes and chords

No. A good melody may imply chords, meaning that hearing the melody alone is enough to invoke feelings in the listener's mind, as if the melody had been accompanied by backing chords. The same melody notes can plausibly be accompanied by many different chords, and such chord choice decisions belong to the art of "arranging".
A lot of modern pop melodies are colorless, odorless, tasteless, generic note salad along pentatonic scales, and they can be accompanied by just about any chords. This results from the melodies avoiding the use of pitches with strong harmonic implications, such as the leading tone, or chromatically altered notes. In my opinion, such tunes are not very melodic and the melodies are weak.
There are different opinions on how to define a "melody" to begin with. To me, a melody is any strong central musical idea which draws a listener's attention so effectively that they can remember it and maybe even try to reproduce the idea. A good melody doesn't need chords or even pitches. The opening stomp-stomp-clap rhythm of Queen's "We Will Rock You" is very melodic and catchy, and a lot of ordinary people can reproduce that musical idea by tapping, clapping, stomping, whistling, humming, etc. without any musical training. That's a sign of a good melody. (Someone might say that even lyrics would fit that definition... yes, why not. Good rap is melodic in many ways.)
How a bunch of lawyers and judges might define "melody" to decide a copyright dispute in a court of law, in case X in country Y in year Z, is a different question.
Comment: ...or we could stick to the question asked when it's a sensible question.
Comment: Copyright doesn't seem to be at issue in the page that the question links to, but I would note that it's not necessarily important to define "melody" in the context of a copyright dispute.  Copyright protects musical compositions generally, not only melodies.
Comment: @phoog Yes, like I said copyright is a different question. Mentioned as a reminder and example of different perspectives and dimensions to the meaning of a concept and word like that. I also tried to say that even the legal aspect is subject to opinions and interpretations, which can vary in different places and times, and who is paying who, how much.
Comment: I'm not seeing how coming up with your own definition of melody helps the asker better understand the quote in question.
Comment: @ToddWilcox I tried to demonstrate, by example, that there can be different interpretations and definitions. Whatever is on the web page is someone's opinion, somewhere, sometime, for some purpose. I did not read the linked bage because this site is perfectly capable of containing a question like this. I hope the OP can now see that web page as an imperfect piece of human communication among the vast oceans of imperfect human communication out there. Like there's no single correct kind of music, there's no single correct way of talking about music.
Comment: It's funny what you critique about pop melody and then cite _We Will Rock You_ a song that is heavily minor pentatonic and does not use a leading tone.
Comment: @MichaelCurtis I left that there on purpose so you could have fun. Though I tried to point at the _rhythm_ specifically as a particularly melodic ingredient. I don't think there's anything very pentatonic in the stomp-stomp-clap rhythm? Maybe you get the point, maybe not, and perhaps you've heard some examples of not-very-catchy pentatonic melodies. If not, good for you.
Comment: So, in a question about melody and _pitch_ criticize the pitch aspect of pop melody, then bring up an example to praise... for it's rhythm. You missed the point of the OP's question and your own critique of pop melody.
Comment: @MichaelCurtis No. Don't take assumptions behind questions as correct without second thought. The OP assumes that pitches are the only aspect to consider, but that view is of course too narrow. Rhythm is an important element in melodies. If you read the question very carefully, you may notice that the OP is pondering about the _mood_ that good melodies create, and then goes on to speculate on which musical elements the mood comes from.
Answer: Yes and no. There's often the definition of melody as a serial progression of notes and harmony as notes being played in parallel. So if you imagine a chord as being 2 or more notes being struck at once, then no a melody is just single notes.
However practically speaking even if you just play a melody (succession of single note pitches), you still create harmonics when the last note still lingers around when the next one is being played (either as your strings still resonate when you pluck a new one or if the note is still in the air on in the heads of the listeners). So you still, at the very least play intervals that already have a characteristic and with progressions of intervals you might even play arpeggios or broken chords where you play the notes of a chord just after each other and not all at once.
So no you don't have to deliberately mix single notes with notes being played in parallel to create a melody, but it's very likely that you'll still be able to feel chords even in a progression of single notes.
Answer: A melody is simply a musical "line", a collection of notes that are played sequentially as a cohesive musical thought. Almost any series of notes could be called a melody. A melody requires multiple notes played at different times.
A chord is multiple notes played together that are heard at the same time. Any collection of notes played simultaneously could be called a chord. A chord requires multiple notes played at the same time.
A melody may incorporate chords, playing some beats in multi-part harmony with more than one note, but it doesn't have to. A sequence of notes with none played together is a chordless melody. A melody is built from notes and may or may not have chords.
Answer: There can be further subtleties. Although a melody often implies a harmony, different harmonies can color the same melody. As an example, take this stoke of genius by Schubert in the opening of the 2nd movement of his Piano Sonata in A Major, D.959:

The melody starting in m.1 is harmonized in the minor, but when immediately repeated, starting in m.19, the same notes (with some added embellishment) are harmonized in the major. Rather than a mere repetition, we hear the theme in a new light—a sort of alter ego.
Source: ISLMP (Henle)
Answer: Generally speaking, the main notes that are in a chord are reflected in a melody, and vice versa. As in, chord of C in a bar, melody notes are often (not always!) C, E or G. By main, I mean beat 1 and beat 3, usually. I've often said as much, in that if that doesn't happen, either the melody, or the chord/s at that point, are wrong!
It won't happen all the time - that's where the suspense or dissonance occurs, but if you examine 100 melodies, and their underlying chords, it'll hold true most of the time.
There will of course be those which don't. 'Laura' springs to mind. Although by changing the chords to several m9 instead of simple minors, it fits as above. Or, if you like, the 9th part completes the underlying basic triads. Moon River follows for 2 bars, then has (in key C) a B note held against an F chord - which theoretically shouldn't work - good ol' Hank! But the idea there, I guess, is to resolve in the very next bar.
The concept rings true also when jazzers 'play the changes'. The point there is they regard the chord in a bar as supporting certain notes, rather than others, and that's usually reflected in the chord-note match.
Even when a melody is re-harmonised, which is another favourite jazz trick, the same concept applies - although there's a lot of 'musical licence' with extended chords.
Answer: All melodies have a harmonic basis.
Music is not just a collection of notes. Melodies have to have a harmonic basis, if they don't have the foundation of harmony then the melody is just an incoherent collection of notes.
The basics of harmony is a chord progression. You have a key, you start on the tonic chord and you have phrases (musical sentences) where you move to different chords in the progression. The movement is generally to the chord 4 steps forward, 1 step forward, or three steps backward.
Chords by themselves are pretty boring, so you add a melody to make it interesting. You can deduce the harmonic foundation of a melody by looking at how the notes jump.
For the most part, notes in melodies jump to and from chordal notes. SO for instance if you see the jump of a fifth up from F-C then that wants to tell you the chord has the notes of this bar in the melody has the notes F and C in it, You may then see a jump down a third from a C to an A. Then you know for certain the harmony of this part of melody is built on a F Major chord.
When you have a proper harmonic foundation then there a myriad of ways to make a melody interesting. There truly is a massive amount of literature in regards as to how make quality melodies.
For the most part, what makes good music or great music is the quality of the melody. You may hear a song and say to yourself 'man that is a catchy tune'. A catchy tune just being a quality melody.
Some of the ways melodies are made interesting are, for instance. Notes of Anticipation, Suspensions, Échappée, Upper-Auxiliary Notes, Lower-Auxiliary Notes, Accented Passing Tone, Non-Accented Passing Tone, Escape Tones, Appoggiatura and Acciaccatura
Comment: The entire history on non-Western and pre-Organum music would like to have a word with you.


MATLAB Not properly plotting graph

Question: It seems that my MATLAB has some sort of trouble plotting anything that is over tan(x). For example, trying to plat (tan(x) + sin(x))/(2*tan(x)):
clc
clear all

x = 0:0.1:pi;

y1 = cos(x/2).^2;
subplot(1,2,1);
plot(x, y1);

y2 = (tan(x) + sin(x))/(2*tan(x));
subplot(1,2,2);
plot(x, y2);

I've tried putting it on it's own plot as well, but all I seem to get is a blank graph, but the axes are all lined up for the range I've set. The only thing that has made anything appear is removing the tan(x) on the bottom.
Answer: You should use the element-wise division operator ./:
y2 = (tan(x) + sin(x))./(2*tan(x));

Indeed with a = (tan(x) + sin(x)) and b = (2*tan(x)), what you wrote is:
y2 = a / b;

which is matrix division, y2 = a * pinv(b), a scalar number in this case.
NB: As b cannot be inverted, matlab uses pseudo-inverse pinv

MATLAB Not properly plotting graph


Find the frequency of all words from a concatenated column

Question: I have concatenated text column derived from three columns in a table. I need to have frequency of all single words from that concatenated column.
Column1       Column2   column3
This is       Test       1
This was      Test       two

What I need is concatenation of all three i.e. This is Test 1, This was Test two and then count of each word ie.
This - 2
is  - 1
was -1
Test - 2
1- 1
two - 1

Comment: Just curious.  Where do you land on punctuation and items like "he/she"  is that one word or two?   How about "New York", is that one proper noun or two words.  In other words, this seems like a slippery slope,
Answer: You can use string_split and cross apply to achieve the required result. try the following:
Code:
declare @tab table (col1 varchar(100), col2 varchar(100), col3 varchar(100))

insert into @tab
select 'This is', 'Test', '1'
union
select 'This was','Test','two'

select value, count(*) rec_count
from @tab
cross apply string_split((col1+' '+col2+' '+col3), ' ')
group by value


Is this a V+ or III+6?

Question:
I see a weird chord between the iiø6/5 and the i.  Is it a pun of V+ or an III+6?
Comment: Is this a game, or was omitting a key signature just accidental? Edit: never mind, it looks like the end of the first movement of the second piano concerto by Rachmaninov, but you should really include a bit more context.
Comment: Mildly related, at least in terms of "puns": https://music.stackexchange.com/questions/47788/punning-chord
Comment: @user45266 That meaning is associated with the word scherzo, not necessarily with its musical use, e.g. Chopin uses the word for musical-formal reasons not for its Italian meaning. As for puns, see my answer here https://music.stackexchange.com/questions/76406/how-to-modulate-very-smoothly-and-stealthily-from-major-to-minor/76408#76408 for an example of a pun: the two different spellings in the marked section.
Comment: https://music.stackexchange.com/a/47791/45266 helped me understand. Thanks!
Comment: What is "a pun of V+"? Or for that matter, does anyone know what that "put the joke in the scherzo in F" meant from that earlier question? Are the two humor terms related? Should this be a new question?
Comment: @user45266 The scherzo question came from another user and isn't relevant here.
Comment: But I noticed that both used words related to humor; do they have related special meanings in music?
Comment: could you give me to the link of the scherzo thing if available?
Answer: (This answer assumes that this score is a standard treble and bass clef keyboard score and that tonic is C.)
So much of tonal music is based on a set of common patterns, and one of the many reasons for studying music theory is to learn what these patterns are. These patterns become especially helpful when you look at more advanced tonal practice, because often the tricky aspects of later tonal music are just evolutions of earlier common patterns.
Returning to your example, we're left with one of two progressions: ii–III–i or ii–V–i. The ii–V–i progression occurs constantly throughout tonal music. In contrast, I can't think of a single example that uses the ii–III–i progression.
As such, analysts will prefer the ii–V–i reading because it aligns with earlier tonal practice. And as musicians get their education, they learn what these ii–V–i progressions sound like, so our brains are somewhat primed to hear this as a ii–V–i progression as opposed to a ii–III–i progression.
Furthermore, the augmented triad is exceedingly rare in tonal music. It does occur, but its most common use is as an altered V triad, and it's basically always in root position. This is another reason to be suspicious of a ii–III–i progression that includes an augmented triad on III in first inversion.
Lastly, I would argue that this isn't a V+ triad, and for at least two reasons. First is because V+ would be spelled with a D♯ instead of E♭. Second, the V+ chord really only occurs in major keys so that the raised chordal fifth moves by semitone to the third of the tonic chord. But in minor, the raised chordal fifth is enharmonic to the third of the tonic chord, which destroys the pull of the V+ chord's resolution.
As such, this E♭ is going to be best understood as either a non-chord tone (an anticipation, perhaps), a product of a larger voice-leading pattern (note the parallel sixths between the outer voices in the first two chords), or as a type of added-sixth chord.

Is this a V+ or III+6?


Network driver for Ubuntu 9.10

Question: Running VMWARE Workstation 6.5.3. Installed Ubuntu 9.10 and it cannot get on the network. has anyone else installed Ubuntu 9.10 and not run into this issue?
Error message "The virtual network drivers on the host are incompatible with the installed VMware application. Expected version 5. Please reinstall the product. Virtual device Ethernet0 will start disconnected."
While installing VMWARE tools it automatically guided me through compiling many drivers but somehow I guess it is having a problem with the network driver version. Any suggestions as to what to try next? I'm somewhat green on Linux so please don't hesitate to include obvious details rather than giving me a general suggestion like recompile the network drivers (I wouldn't have the first clue how to). Thanks!
Comment: What is the host OS? What kind of NIC? Have you downloaded all related updates?
Answer: Firstly 9.10 isn't supported on 6.5.3.
Secondly have you installed the vmtools from the 6.5.3 version of VMWare Workstation or from somewhere else? if not then you MUST do this.

Network driver for Ubuntu 9.10


Comparison between datetime64[ns] and date

Question: I have DataFrame with values looks like this
    Date        Value
1   2020-04-12  A
2   2020-05-12  B
3   2020-07-12  C
4   2020-10-12  D
5   2020-11-12  E

and I need to create new DataFrame only with dates from today (7.12) to future (in this example only rows 3, 4 and 5).
I use this code:
df1= df[df["Date"] >= date.today()]

but it gives me TypeError: Invalid comparison between dtype=datetime64[ns] and date
What am I doing wrong? Thank you!
Answer: Use the .dt.date on the df['Date'] column. Then you are comparing dates with dates. So:
df1 = df.loc[df['Date'].dt.date >= date.today()]

This will give you:
        Date Value
3 2020-12-07     C
4 2020-12-10     D
5 2020-12-11     E

Also make sure that your dateformat is actualy correct. For example by print df['Date'].dt.month to see that it gives all 12's. If not, your date string is not converted correctly. In that case, use df['Date'] = pd.to_datetime(df['Date'], format="%Y-%d-%m") to convert the Date column to the correct datetime format after creating the DataFrame.
Answer: Could you please try following. This considers that your dates are in YYYY-DD-MM format, in case its other format then one could change date format accordingly in strftime function.
import pandas as pd
today=pd.datetime.today().strftime("%Y-%d-%m")
df.loc[df['Date'] >= today]

Sample run of solution above: Let's say we have following test DataFrame.
    Date        Value
1   2020-04-12  A
2   2020-05-12  B
3   2020-07-12  C
4   2020-11-12  D
5   2020-12-12  E

Now when we run the solution above we will get following output:
      Date   Value
3   2020-07-12  C
4   2020-11-12  D
5   2020-12-12  E


Secret forum visible only to users of a specific role

Question: I need to create a forum that is visible to only users with a specific role. It should remain hidden to other users including registered users. How can I achieve this?
Answer: Try the Forum Access module.


How should I use key-value coding with the ID type?

Question: How can I use key-value coding messages (setValue:ForKey: and so on) with id type? Key-value coding protocol is implemented as an informal protocol, so it is not included in <NSObject> protocol and I can't simply say id<NSObject> setValue:ForKey:.
Answer: Just call the method. The compiler won't emit warnings for unknown methods on id variables.
id myObj = [myArray objectAtIndex:0];
[myObj setValue:@"value" forKey:@"key"];

Comment: Or redeclare the variable without the protocol specifier.
Comment: Hi, thanks for quick reply. I was using `id setValue:ForKey:` and `MyProtocol` inherits `NSObject`. In this case  compiler emits warnings. Is it possible to find workaround here? I thought it would be better to say 'hey this id means MyProtocol kind of objects' in code.
Comment: Ah, I see. Yeah, the compiler's behavior toward `id` is a little strange IMO. In that case, the only (dirty) workaround I see to get rid of the compiler warning is to actually redeclare the `setValue:forKey:` method (and others you want to use) in your protocol.


What is request signature in citrus pay

Question: I am getting error as <code>{"pgRespCode":"111","redirectUrl":"","txMsg":"Invalid signature key"}</code>
Anyone know what this request signature and how to generate it
Answer: The 111 is error message for Invalid signature key. Check if you are using the right keys for right environment.(Production will work with production keys).
The merchant is required to generate a signature and send it along with the payment request.
You can check here on how to create signature - https://developers.citruspay.com/documentation/web-payments/citrus-hosted-checkout/generate-signature/

What is request signature in citrus pay


Query - Content type

Question: I want to get all created content of some content type by query. By now I can access nodes by their ID.
$MyNode = \Drupal\node\Entity\Node::load(1)
I tried some query, but none of them worked for me. Maybe wrong conditions. My content type is 'beacons'.
$query = \Drupal::entityQuery('node')

Cant find it in my d8 book too.
Comment: You should update your question, it will make it clearer to everyone else arriving at this post to figure out what the problem is. @kiamlaluno is right
Comment: Since you tried some queries, and they didn't work for you, may you show them? Differently, you would be going to get a very minimal answer basing on the few details you told us.
Answer: The following should suffice:
$query = \Drupal::entityQuery('node')
  ->condition('type', 'beacons');
$entity_ids = $query->execute();

Here is a drush one-liner to test this on my D8 instance, where I have one article node:
 drush ev "var_dump(\\Drupal::entityQuery('node')->condition('type','article')->execute());"

Gives me:
array(1) {
  [101]=>
  string(3) "101"
}

where 101 is the nid of the article node.
Good luck!
Comment: Thanks for answer! If i want 'articles' it would be: $query = \Drupal::entityQuery('node')->condition('type', 'articles');?
Comment: It would be $query = \Drupal::entityQuery('node')->condition('type', 'article');    Don't use plural, the machine name is in singular, at least for 'article' and 'page'.
Comment: Are you sure about this? Cause i am getting null even in 'article'. Or maybe i am tring to access content in bad way. I am trying $entity_ids[0]
Comment: Yes, I am sure, I updated the answer with some test code and output. Have a look at your code for some typo.
Comment: Thank you..looks like it work for me too! I tried count($entity_ids) and gives me number of articles i have. I am just new to symfony2 so i have problem accesing fields of my contents. But finaly working example :)
Comment: Great! See you around @RadoInko!

Query - Content type


Building a dominant triad in a minor key - are these double sharps correct?

Question: As I understand it, one builds the dominant triad of a minor key using its harmonic scale based on the dominant, leading tone and supertonic notes. Under this criteria I seem to get some weird concoctions for the indicated minor keys …
A♯ minor --> E♯, A/(G♯♯), B♯
D♯ minor --> A♯, D/(C♯♯), E♯
G♯ minor --> D♯, G/(F♯♯), A♯

Is this correct?
Comment: Stuff like this is why I strongly prefer writing music in E flat minor instead of D sharp minor.
Comment: Is there a *reason* for using A# minor and D# minor instead of Bb and Eb minor?
Comment: A sharp minor?! Yikes... Because you're using the sharp forms of the keys, you will need to use the ♯♯ notation. Using B♭, E♭, and A♭ minors would be way easier for this (and just in general, with the exception of sometimes G♯)
Comment: I think G#m would be normal rather that Abm. 5 sharps versus 7 flats. Every tone flatted for Abm!
Comment: What is the question here? All these  chords are correct except for the D# chord which has a A#.
Comment: @NeilMeyer - As far as I can tell, the question is whether the chords are correct despite their double sharps.
Comment: @MichaelCurtis - Yes--I once wrote a piece in B major that modulated to...well...A# minor. I kinda regret the decision to not notate the section as being in Bb minor, but adding two sharps to the key signature is arguably easier than replacing five sharps with five flats.
Comment: Funny thing is: this question made me start telling myself mentally "G#m" because in truth I had been thinking "Abm" while playing at the piano. I guess that's from the habit of playing Ab _major_ more than G# minor. Flipping the tonic spelling for the sake of the mode change is confusing. Thank goodness we don't have the same switch for Eb and Bb. Same tonic in either mode.
Answer: I'm not 100% sure what your question is, but your chords are correct, with two small adjustments:

In A♯ and D♯ minor, we must spell the thirds of the dominant chord as G-doublesharp and C-doublesharp, respectively. These triads are what are called tertian sonorities, and as such they must be spelled in thirds; G-doublesharp and C-doublesharp are thirds above their roots (E♯ and A♯), whereas A and D are fourths above those roots.
In G♯ minor, the correct pitches will be D♯, F-doublesharp, and A♯ (you currently have A♮).

If your question is "are these doublesharps correct?", then the answer is yes!
Comment: @DickRitchie Those are doublesharps. I'll edit accordingly!
Comment: @Tim Yeah, but it somehow always looks odd to me, so I just wrote it out.
Comment: Richard, some of the pitch letters in your answer are followed by a box (e.g. D#, Fbox, A#). This is probably because my laptop doesn't recognize the character code.  Are the boxes special characters? BTW many thx for the reply.
Comment: Doesn't 'x' work for double sharp?
Answer: I'll add an answer just to show how using standard key signatures and chord spellings will probably make things easier to understand.
The main reason to use Bb versus A# and Eb versus D# for minor keys is the arrangement of tonics on the circle of fifths where starting with A for minor keys ascending by fifths gives us keys with sharps and descending by fifths gives us keys with flats. The practical implications of that are:
A# minor would require 7 sharps! Bb minor requires only 5 flats. Granted that's a lot of flats but it still is easier to read.
D# minor would use 6 sharps which is the same number of flats for Eb minor. That would seems to make them about the same, but when raising the ^7 scale degree for the leading tone we would need a double sharp Cx in D# minor and only a natural D♮ in Eb minor. Double sharps and flats are considered hard to read.
Also, spelling chords in thirds makes their identifies and inversions clearer. I could write C F♭ G but it's much clear to write C E G to see it is a triad. The other - with F looks almost like a suspension at first glance.
The original spellings...

A# minor --> E#, A/(G##), B#
D# minor --> A#, D/(C##), E#
G# minor --> D#, G/(F##), A#

On staff...

...it may seem like a subtle difference, but playing double sharps and flats is confusing, because you end up playing what seems like a natural, ie. Gx looks like A natural.
If we use the standard key signature and spellings in thirds we get...

Bb minor --> F, A♮, C
Eb minor --> Bb, D♮, F
G# minor --> D#, Fx, A#

On staff...

...again, it may not seem like a big change, but we eliminate two double sharps and an unnecessary sharp.
I know you did not ask directly about key signatures, but...

...I seem to get some weird concoctions for the indicated minor
  keys...

I think the reason you got weird and confusing results isn't from misunderstanding how the dominant chord is constructed in minor keys, but by not following the conventions of key signatures and chord spellings. I hope explaining those conventions helps.
Comment: WOW, bit of a Pandora's box but really appreciated. Further to this however, I can find no pop chord symbols for dominant triads for any particular key being played.  But from my reading, I'm guessing that using the root letter of the triad to relate to the associated major key tonic triad would be the same.
Is this correct?
Comment: @DickRitchie, that's right about pop chord symbols. Since the dominant *triad* is simply a major chord only a capital letter is used, like "G" to mean G major triad. Of course that doesn't distinguish it's function with a tonic major triad. That's the downside of such shorthand systems. You might put a '7' on the chord to make the dominant identity clear, like "G7."
Comment: If you really didn't want the 7th that would be misleading, however pop/jazz chords are often 'interpreted' by the performers who sometimes add/omit tones. In that sense the '7' could a sort of _hint_ the chord is a dominant and thereby imply a key.
Comment: Great answer! Are your first two key signatures switched, or am I crazy?
Comment: I switched Bbm for A#m and Ebm for D#m to illustrate the enharmonic change. Did I get something wrong? I admit these are tricky spellings for me! My intention is to show Bbm is easier to read and spell than A#m.
Comment: Oh wait. I see it. I have sigs for A#m and D#M reversed!. I will fix that now.
Answer: Yes, that's correct (apart from the A in G# minor, should be A#).  That's why we rarely use A# minor (or A# major for that matter).  The spelling falls into place much better if we call it Bb minor.
Answer: It's so simple:
You just write the chords as a-minor, d-minor and g-minor (where the third has to be altered #). Then you add to every note of the triad another sharp, that means the third needs a double sharp: x or maybe ##) but to transcribe the en-harmonic doesn't make sense as the third has to be the lead tone.


Has any player on the Edmonton Oilers roster (16-17 season) played a postseason game as an Oiler before this season?

Question: The Edmonton Oilers advanced the NHL playoffs this season (2016-17) for the first time since the 05-06 season when they reached the Stanley Cup Final. So given the 11 year hiatus, I'm wondering if there are any current Oilers who also played for them the last time they made the playoffs?
Or equivalently, are there any players on the Oilers roster who have played in the playoffs for the Oilers before?
Answer: No. Eberle has the longest tenure with the Oilers with 7 seasons played, but as you mentioned before, it has been an eleven year hiatus.
With an eleven year drought, the only eligible members on the roster who could be in the league are as follows (I've included their age at the last time Edmonton got into the playoffs along with when they joined the NHL):

Matt Hendricks, 24, entered NHL in 08-09, COL
Jonas Gustavson, 21, 09-10, TOR
Mark Letestu, 20,  09-10, PIT
David Desharnais, 19, 09-10, MTL
Benoit Pouliot, 19, 06-07, MIN
Andrej Sekera, 19, 06-07, BUF
Mark Fayne, 18, 10-11, NJD
Kris Russell, 18, 07-08, CBJ
Cam Talbot, 18, 13-14, NYR
Comment: Probably correct, but a player could have left the Oilers and returned.


How to pass wildcard via drush exec?

Question: How to pass wildcard via drush exec on remote host (via ssh)?
I've tried already:
$ drush @foo exec 'ls -al *'
$ drush @foo exec "ls -al *"
sh: 1: ls -al *: not found
Command 'ls -al *' failed.
$ drush @foo exec "ls -al \*"
sh: 1: ls -al \*: not found
Command 'ls -al \*' failed.
$ drush @foo exec 'sh -c "ls -al *"'

Local shell is bash, remote shell is sh.
Answer: $ drush @foo ssh 'ls -al *' works great, for any @foo alias that is remote.
Answer: Why are you passing exec a string?

✔ aw-dgurba ~ > drush help exec
Execute a shell command. Usually used with a site alias.

Examples:
 drush core-execute git pull origin  Retrieve latest code from git
 rebase

Arguments:
 command                                   The shell command to be executed.

Options:
 --escaped                                 Command string already escaped; do not add additional quoting.
 --ssh-options                             A string of extra options that will be passed to the ssh command (e.g. "-p 100")
 --tty                                     Create a tty (e.g. to run an interactive program).

Aliases: exec, execute
aw-dgurba ~ > drush exec "ls ~/*"
sh: 1: ls ~/*: not found
Command 'ls ~/*' failed.

Yet,

aw-dgurba ~ > drush exec ls ~/*.txt
/home/dgurba/catch22_excerpt.txt

Note the help description does not pass a quoted string. If you escaped options already than use --escaped option. If you need special handling via ssh then supply the necessary --ssh-options.
Comment: Without quotes it doesn't work as well, as wildcard would be interpreted by the local shell. And I'd like to pass wildcard to be interpreted by the remote shell, not local.

How to pass wildcard via drush exec?


Automatic folder syncing on Windows Home Server

Question: Is there a way for Windows Home Server to keep one of its share folders sync'd with a folder on one of the computers on the network?
Answer: I use synctoy - there is another question regarding this here
Comment: Just learned how to setup SyncToy to run on as scheduled task. Sweet!
Answer: According to this page: Windows Live Sync as a Service on Windows Home Server, Windows Live Sync should run fine, and would do what you want.
You'll need a Live account, and then you just set up a private folder and share it on the two machines, and they'll be kept in sync.
Answer: Offline Files?
Answer: I use Unison. It's a pain to configure on Windows, but it's much much faster than any other syncing tool


Dell iDRAC express and Broadcom Team

Question: I have a few Dell servers that I'm trying to configure Broadcom NIC teams and use the iDRAC 6. It seems that when I setup a broadcom Smart Load Balancing(TM) and Failover (SLB) team, I loose connection to the iDRAC, the Dell rep said that it was probably the Broadcom BACS locking the LOM. Is there a way to have both?
<code>  Team Software: BACS3 Version 188.8.131.52
  NICS: BCM5709C
</code>
Answer: This was an issue with the 1.0 iDRAC6 firmware - it would fail when the NIC Teaming drivers kicked in on the Host operating system, this was seen with both Linux and Windows installations. The 1.5 iDRAC firmware resolves this - if you update that it should resolve your problem.
Comment: We are using Firmware 1.54 Build 15 with BIOS 2.1.15
Comment: Hmmh- interesting. What is the sharing mode set to?
Comment: Shared with failover all loms, but I think I might have gotten it working by downgrading from NIC firmware 5.0.6 -> 4.6.8
Comment: Interesting bug - good to know.
Comment: This seems to have worked for one of my servers, but not the other. I'll have to look into it more tomorrow.

Dell iDRAC express and Broadcom Team


How to deploy new and changed files only via FTP

Question: I'm working for a company who in some circumstances HAVE to deploy php web applications via FTP. I'm in the process of automating the deployment process and need to write a script to FTP the files to the staging and production environments.
Requirements:

Should only transfer new or changed files to the remote server

Restrictions:

No shell access of any kind on the remote environments
Not able to use rsync
Only FTP available

My question: Is there any FTP based utility I can employ that fulfils these requirements rather than write my own?
Answer: As long as you control the client, you could use FTPFS on the client, then rsync the local directory to the apparently-local-but-really-mounted-via FTPFS directory.
I understand that FTPFS is now part of LUFS.
Edit: I'd love to link to a tutorial, but I normally just start with the project wiki, and something seems to be up with sourceforge right now.  CurlFTPFS, which seems to be based on cURL and FUSE, can be found here, and the mounting/unmounting there seems to be as simple as:
<code>$ mkdir sunet
$ curlftpfs ftp://ftp.sunet.se/ sunet/
$ cd sunet/
$ ls -l
total 0
Dr-xr-xr-x   3 root root        96 Feb 23  2004 bin
dr-xr-xr-x   2 root root        72 Mar  2  2004 dev
dr-xr-xr-x   2 root root        48 Feb 23  2004 etc
dr-xr-xr-x   2 root root       120 Feb 23  2004 lib
-rw-r--r--   1 root root 622187310 Mar 11 06:13 ls-lR
-rw-r--r--   1 root root  76389037 Mar 11 06:15 ls-lR.gz
drwxrwxr-x  37 root root      1272 Feb 27 14:17 pub
dr-xr-xr-x   3 root root        72 Feb 23  2004 usr
$ cd ..
$ fusermount -u sunet/
</code>
Comment: Thanks - Do you have any links to a good tutorial?
Comment: In the end I decided to go with lftp - the mirror mode was failry trivial to implement. However I also followed your instructions and gave this a try. It works really well to - so am choosing this as answer.
Comment: Glad it was helpful and of interest, and above all that you have something in place that works for you!
Answer: We use ant for scripting and automation. The ant FTP task has a 'depends' param that transfers only new or changed files http://ant.apache.org/manual/Tasks/ftp.html
Answer: Maybe something along the lines of ncftp to sync a directory to the server. You could go as far as to drop that into capistrano (override :deploy and run the ncftp command once you have  checked out the version you want to deploy).


Error Code: 1054. Unknown column 'ExamQuestions.Employees.Number' in 'field list'

Question: Below is query-
select
    Employees.Number,
    Employees.Surname,
    Employees.ProjectName
from
    ExamQuestions.Projects p,
    ExamQuestions.Employees e
where
    p.Number = e.Number;

Comment: I have no idea why it is giving me this error, I have the correct syntax and conditions as far as my notes go, any help would be greatly appreciated!!
Answer: First, never use commas in the FROM clause.  Always use proper, explicit JOIN syntax.
Second, you have defined table aliases, you need to use them:
SELECT e.Number, e.Surname, p.ProjectName
FROM ExamQuestions.Projects p JOIN
     ExamQuestions.Employees e
     ON p.Number = e.Number;

Presumably, the project name comes from Projects and not Employees.
Comment: Thanks, appreciate the help!!


VS 2012 solution and projects - incompatible with VS 2010?

Question: I was under the assumption the solutions and / or C# projects created in VS 2012 could also be opened in VS 2010 (with SP1 applied).
But I wasn't able to do so - VS 2010 didn't want to load the solution file, and after I manually "tweaked" it, now it complains about the *.csproj project file being incompatible with this current version of VS 2010 .....
What am I missing?
Comment: possible duplicate of [Is Visual Studio 2012 csproj backward compatible with 2010?](http://stackoverflow.com/questions/10902865/is-visual-studio-2012-csproj-backward-compatible-with-2010)
Answer: You can fix it by,
1- Change 12.00 to 11.00
2- open *.csproj file by text editor and change this line
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

to
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

Project will open after restart of VS 2010
Answer: If you create a solution with visual studio 2012 on the top of your solution-file there are the following two lines:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012

You can Replace the Version 12 to 11. And than the solution should work in Visual Studio 2010.  I'm not sure if the visual studio 2010 can handle project-files which have target .net-framework 4.5
Comment: Try to open the solution again in visual studio 2012 and set the target framework of each project to .net 4.0.
Comment: That's what I tried - I can now open the **solution** - but the project file is still considered "incompatible" ....
Comment: Yup - setting the target framework to `4.0` solved that problem - thanks!
Comment: This works the first time but as soon as I compile again in VS2012, the solution file gets checked out and the version changes back to 12 again.
Comment: My coworker helped me create a copy named projectVS2010.sln in addition to the existing project.sln (still in 2012). Maybe that's a good solution... or do bad things happen when having both of those side by side? (Fortunately, no one's actively working on this using the 2012 one right now.)
Answer: Removing:
<AppContainerApplication>true</AppContainerApplication>

Under the tag:
<PropertyGroup Label="Globals">

Solved it for me. Though it is funny, on another PC (Win10 instead of 7) it worked including this line.


To design a Multilayer Perceptron, should I use more units per layer and less layers or more layers and less units, which is better?

Question: I feel confused about how to design a Multilayer Perceptron(MLP). I have read a number of papers about how to design a deep CNN structure, like VGG or ResNet. However, for a Multilayer perceptron, a more basic ANN structure, should I follow this trend to make the MLP deeper? Actually, I try some trials on python that stacking more layers in one network, but the result showed it make no sense.
Therefore, I just wanna ask the question above.
can anybody give me some suggestions?
Answer: The optimal neural network architecture depends on your data set.
FYI:

Why are neural networks becoming deeper, but not wider?
What are the effects of depth and width in deep neural networks?
Is there any method for choosing the number of layers and neurons?
Comment: One more: https://stats.stackexchange.com/questions/182734.


Finding a closed form for the sum $\sum_{i=1}^n (1+ \sum_{j=1}^m j)$

Question: Trying to simplify this sigma notation to possible closed notation.
Could anybody please help me with this?
$$\sum_{i=1}^n\Big(1+\sum_{j=1}^m j \Big)$$
Comment: well I've got the basic idea down for summing up here. I can read this as 1 + the sum of j to integer m. all starting with i. which is 1 up to integer n. I've been able to do the preceeding questions, but this one just kind of stumped me. Anything helps! thank you
Answer: We have
$$\sum_{i=1}^n\left(1+\sum_{j=1}^mj\right)=\sum_{i=1}^n\left(1+\frac{m(m+1)}2\right)=n\left(1+\frac{m(m+1)}2\right)=\frac{n(m^2+m+2)}{2}$$


Fusing a google bucket on centos 6.7 permission error

Question: Currently I'am trying to mount a google bucket to a VM running Centos 6.7.
I have generated a .json file from the developer console and uploaded it to the server, I then went and pointed GOOGLE_APPLICATION_CREDENTIALS to the files location. However when I run gcsfuse, the following error message appears:
mountFromContext: mount: Mount: mount: Starting fusermount: fork/exec /bin/fusermount: permission denied
Comment: Try to use `$ sudo gcsfuse` command. If not resolved, use `--debug_fuse` option with command and post the debug output.
Comment: Sudo seemed to work, although in the doc it specifically says not to use sudo. I should have done this sooner.
Answer: The problem as I can see is that you are trying to mount on the /bin/fusermount and the /bin directory belongs to root, that is why you managed to mount using sudo.
Probably you created the folder using sudo or the root user otherwise you couldn't create the folder.
You need to change the permission of fusermount/ to the user you want to mount using gcsfuse.
Or create the folder in the home directory of the user you want to mount using gcsfuse.