Rodar imagem do marker google maps não funcionando

Question: Bom estou precisando rodar a imagem do icone de acordo com o header que chega para mim.
Estou tentando fazer de varias formar porém nenhuma delas funcionou, vamos la aos códigos.
PRIMEIRA TENTATIVA [PATH DO ICONE]
 this.marker = new google.maps.Marker({
  position: new google.maps.LatLng(location.coords.latitude, location.coords.longitude),
  map: this.map,
  optimized: false,
  icon: {
    PATH: 'meu path',
    anchor: new google.maps.Point(0, 0),
    size: new google.maps.Size(32, 32)
  },
})

Esta maneira funcionou porém o svg que preciso é complexo, ele tem mais de um path, se eu consegui-se junta-los em um path apenas, seria interessantíssimo e tudo funcionaria como precisava.
Então o problema desta tentativa é referente a um svg com vários paths o rotate funciona perfeitamente.
SEGUNDA TENTATIVA [URL SVG]
this.marker = new google.maps.Marker({
  position: new google.maps.LatLng(location.coords.latitude, location.coords.longitude),
  map: this.map,
  optimized: false,
  icon: {
    url: 'assets/img/maps/if_map-marker_299087.svg',
    anchor: new google.maps.Point(0, 0),
    size: new google.maps.Size(32, 32)
  },
});

Nesta opção meu problema está quando vou aplicar o rotate na imagem, estou fazendo assim:
document.querySelector('.gmnoprint img').setAttribute('style', 'transform:rotate(-134deg);');

porém  não está funcionando como preciso. Ele adiciona tudo certo no html mas no momento de pegar o comando fica como se o fundo da imagem tive-se girando mas permanecesse no mesmo local; Na imagem do lado podemos ver o quadrado de azul (quando coloco o mouse em cima da imagem) e a imagem em si, o quadrado está rodando porém a imagem não.

TERCEIRA TENTATIVA [URL IMG]
Nesta tentativa utilizei os mesmo métodos da tentativa 2 utilizando imagem em png, o resultado foi o mesmo.
INFORMAÇÕES DO PROJETO
@angular: 5.0.2
@types/googlemaps: 3.30.0
typescript: ^2.6.1

Answer: Existia uma lib JS chamada MarkerWithlabel em que você podia atribuir uma imagem como marcador, e inclusive digitar um texto em cima da imagem. No seu caso, você pode usar qualquer imagem, se rotacionar a imagem desse marcador e atribuir no atributo icon da variável marker (do exemplo abaixo) acho que funciona do jeito que você quer.
Você pode usar essa documentação Não-Oficial para ver
Seu uso basicamente era:

 var marker = new MarkerWithLabel({
   position: homeLatLng, // usa o 'new google.maps.LatLng()'
   draggable: true,  // true or false
   map: map,   // mapa que vai receber o marcador
   labelContent: "$425K",  // Texto em cima da imagem
   labelAnchor: new google.maps.Point(22, 0),
   labelClass: "labels", // the CSS class for the label
   labelStyle: {opacity: 0.75},
   icon: 'img/markers/marker_patrol.png' // SUBSTITUI A IMAGEM AQUI
 });
Comment: Acrescente mais informações sobre o plugin, modo de instalar e tudo mais, teria como /;
Comment: No link da documentação q eu mandei, entra na pasta SRC e baixa aquele markerwithlabel.js.
Inclua ele no seu projeto onde achar conveniente, não esqueça de importar o script (normalmente feito no index.html usando a tag


windows 2012 wierd samba error

Question: so today I set up a new fileserver and auth server running samba. I have already connected both unix systems to the ldap(that it's also running) and have connected 2 windows 2003 servers to the samba auth. The weird problem come when i try to connect my windows 2012 server to the samba. It give me this error:
An Active Domain Controller for the domain "mosek.intranet" could not be contacted

dns query was for the SRV record for _ldap._tcp.dc._msdcs.mosek.intranet

the following domain controllers were indentified by the query:
fredericia
however no domain controllers could be contacted

I find this funny, because all other windows versions works fine (I have also tested 2008)
I encountered this problem before in testing, but the solution was to add these lines to my smb.conf:
domain master = yes
local master = yes

Do someone have a fix for this? I'm almost sure that it's just a line or 2 in the smb.conf that needs to be added, just like my previous fix for the problem, so that newer versions of windows will know that my server is a domain controller.
to help you out to a posibble solution i have a new data:
my auth server is running ubuntu 14.04
the server i'm trying to join is a windwos server 2012
my smb.conf looks like this:
[global]
    workgroup = MOSEK.INTRANET
    netbios name = FREDERICIA
    server string = MOSEK PDC

    deadtime = 10

    log level = 1
    log file = /var/log/samba/log.%m
    max log size = 5000
    debug pid = yes
    debug uid = yes
    syslog = 0
    utmp = yes

    security = user
    domain logons = yes
    domain master = yes
    local master = yes
    preferred master = yes
    os level = 255
    logon path =
    logon home =
    logon drive = x:
    logon script = \\fredericia\logon\logon.bat
    acl allow execute always = True

    passdb backend = ldapsam:"ldap://fredericia.mosek.intranet/"
    ldap ssl = off
    ldap admin dn = cn=admin,dc=mosek,dc=intranet
    ldap delete dn = no

    ## Sync UNIX password with Samba password
    ## Method 1:
    ldap password sync = yes
    ## Method 2:
    ;ldap password sync = no
    ;unix password sync = yes
    ;passwd program = /usr/sbin/smbldap-passwd -u '%u'
    ;passwd chat = "Changing *\nNew password*" %n\n "*Retype new password*"$

    ldap suffix = dc=mosek,dc=intranet
    ldap user suffix = ou=Users
    ldap group suffix = ou=Groups
    ldap machine suffix = ou=Computers
    ldap idmap suffix = ou=Idmap

    add user script = /usr/sbin/smbldap-useradd -m '%u' -t 1
    rename user script = /usr/sbin/smbldap-usermod -r '%unew' '%uold'
    delete user script = /usr/sbin/smbldap-userdel '%u'
    set primary group script = /usr/sbin/smbldap-usermod -g '%g' '%u'
    add group script = /usr/sbin/smbldap-groupadd -p '%g'
    delete group script = /usr/sbin/smbldap-groupdel '%g'
    add user to group script = /usr/sbin/smbldap-groupmod -m '%u' '%g'
    delete user from group script = /usr/sbin/smbldap-groupmod -x '%u' '%g'
    add machine script = /usr/sbin/smbldap-useradd -w '%u' -t 1

[NETLOGON]
    path = /space/logon
    browseable = no
    share modes = no

[PROFILES]
    path = /var/lib/samba/profiles
    browseable = no
    writeable = yes
    create mask = 0611
    directory mask = 0700
    profile acls = yes
    csc policy = disable
    map system = yes
    map hidden = yes

Answer: Could it be the version of Samba.
You can add version 1 by opening powershell. Type Add-WindowsFeature FS-SMB1. Reboot. Some people say it can take up to 10 min after reboot to fully initialize.
You can use the powershell command Get SMBConnection to see version info as well.
EDIT....
If this is 2012R2 then.....
This may be a helpful link  Samba in Server 2012 R2
Here is a statement from this site. ..
If Windows 2012 R2 is used as a domain controller, it means that Windows XP / Server 2003 clients won't be able to execute logon scripts (NETLOGON) and run some of the group policies stored in the network folders on the domain controllers.
Comment: The server said at no features FS-SMB1 was, found but i tried enableling smb1 protocol and disable smb2 protocol with the samme xobfiguration in power Shell, but still no cigar
Comment: I added this link above. It may be helpful. http://woshub.com/smb-1-0-support-in-windows-server-2012-r2/
Comment: I will look into it, though the link is for when windows is a DC, but in my case the windows machine is a client for a Linux DC
Comment: I have locked through the link, and i can confirm that the windows server is configured like the link explained
Comment: Sorry about that. I thought it was a new DC. What linux distro is your DC.
Comment: as stated in the question: 'my auth server is running ubuntu 14.04'
I have used this tutorial, to set up my samba: http://www.unixmen.com/setup-samba-domain-controller-with-openldap-backend-in-ubuntu-13-04/
Comment: I'm not trying to insult you here, just trying to think simple.
Comment: Opps, hit enter too soon. Can you ping both ways and have you tried turning the windows firewall off?
Comment: yes of course, sorry if I sounded harsh :) I meant no offense

yes I can ping both ways, both with host name and FQDN, both works perfectly.
Comment: Not at all,  that was supposed to be one message. And, I should have read that again before asking. Server 2012 is more secure and may require more srv dns records. I'll do some research when I get time.
Comment: hmm I researched a bit my self, and I find it funny. when i try to do an nslookup from the windows server to _LDAP._TCP.DC._MSDCS.mosek.intranet
I get the dns servers name and ip, and not the auth server. Could it be this causing the problem?
Comment: If you do ipconfig /all on one of your server 2003 machines and on the 2012 machine are they using the settings for dns servers?
Comment: Oh, and yes, I think the record is resolving to the wrong server.
Comment: If the DHCP settings are the same try setting the auth server dns to 127.0.0.1 and secondary to blank.                         If none of those work did you try the items from the Unixmen page you used to set this up. There are a couple solutions for win 7 that would probably work in 2012. If you open the page and search 'dns' you'll find it.
Comment: This link shows the requires dns records for AD https://msdn.microsoft.com/en-us/library/bb727055.aspx

windows 2012 wierd samba error


Auditing from a trigger in oracle

Question: I am working with a big database and it had many generators of data basically have alot of data being inserted and updated per day. I have a trigger that updates each row every time there is an update or insert and i use the following code to input the person's name from the apex application (the user from apex)
NVL(v('APP_USER'),USER)

My problem comes when there is heavy data entry, for example 500,000 records are being generated by one person (John) and when john generated this data, each row is audited but as john generated more than one person who are users in the apex application shows up in the audit.
So scenario is that john clicks a button to generate data and in the audit fields, more than one users name show up (Mary, John, Peter)
Does anybody have any idea why this is happening?
the entire code, it is very generic
TRIGGER trg_tableA before insert or update
            on tableA REFERENCING OLD AS OLD NEW AS NEW
            FOR EACH ROW

            begin

            :new.insert_date:=sysdate;
            :new.inserted_by:= nvl(V('APP_USER'),USER);

            :new.modified_date:=sysdate;
            :new.modified_by:= nvl(V('APP_USER'),USER);

    end trg_tableA;

Thank you in advance
Comment: Because Mary and Peter modified some of these rows as well, perhaps?
Comment: Without seeing the code that is actually being executed, it is difficult for anyone else to understand what is going on. Can you share some of the code that is generating the audit rows?
Comment: @Littlefoot no, no rows are specified towards them. Only person who is generating, their name supposed to show up
Comment: @EJEgyed i added the code, it is pretty generic
Comment: Then remove `or update` from the trigger. Because, John might be "generating" (inserting) rows, but if Mary or Peter update some of them, **their** names will be stored in the audit column.
Comment: @Littlefoot ahhhh, i see but this is just a trigger i took from one table. Other places have separate insert and update triggers and it's the same thing happening. I have isolated a system and tested for this and there was no update or insert done while i was testing because it was me alone and the same problem occured.
Comment: No idea, then. Sorry.
Answer: As per this link Use v('APP_USER') as default value for column in Oracle Apex There are other options than V('APP_USER'). Since Apex 5, the APP_USER is stored in the sys_context and that is a lot more performant than the V() function. It is available as SYS_CONTEXT('APEX$SESSION','APP_USER').
Please try the below and see if your issue is getting resolved.
        TRIGGER trg_tableA before insert or update
                on tableA REFERENCING OLD AS OLD NEW AS NEW
                FOR EACH ROW

                begin

                :new.insert_date:=sysdate;
                :new.inserted_by:= nvl(sys_context('APEX$SESSION','APP_USER'),user);

                :new.modified_date:=sysdate;
                :new.modified_by:= nvl(sys_context('APEX$SESSION','APP_USER'),user);

        end trg_tableA;

Comment: another alternate to using `SYS_CONTEXT` is to use the global variable `apex_application.g_user`. This removes the need for a function call completely.
Comment: Thank you for the replies, i will try them and update you guys

Auditing from a trigger in oracle


Windows account for SQL Server backup

Question:
What is the Windows account used to perform SQL Server backups?
Is it the one under SQL Service is running (as nt service\mssqlserver)?
But what about if the backup is executed by means of a maintenance plan and/or job?
In this case, the windows account is the SQL Server account service or the Agent service account?
Comment: Backups aren't performed by themselves. The account used is the account of the user or service that executes the `BACKUP` command. In an agent job, it's either the agent account or the proxy account specified for that step. In SSMS or another client application, it's the account used to connect to the database
Comment: It's the service account, not the Windows Login (if any) of the session.
Answer:
What is the Windows account used to perform SQL Server backups?

The SQL Server Service Account performs the backups.
When running under the default virtual account nt service\mssqlserver, the service account can only be granted privileges on the local server.  Processes running under a per-service virtual account access domain resources using the computer account, just like the old NetworkService local account.
So grant the share access to YourDomain\ServerName$.

Windows account for SQL Server backup


How do I learn to play surf music on the guitar?

Question: I started playing guitar in 1984. Since then, I have learned flat-picking, pinching, slide blues, and three-finger styles of playing. I also started playing the banjo in 1986.
I grew up listening to mom playing old style country music on the radio as well as he autoharp.
Because of hearing her music, and playing the banjo, everything I play comes out country.
What I really want is to develop an ear for surf music...Ventures, Surfaris, Mermen, etc. Unfortunately, everything comes out country.
I even had an instructional album to play Ventures songs. Though I play it note for note, it still sounds country.
Am I stuck with what my fingers play or can I develop a new style?
Comment: Did you have the giant spring reverb going on?
Comment: My amp does have a good reverb, but it still sounds like a cowboy on a surfboard.
Comment: Sounds like it could be cool! Other archetypal aspects of surf are plenty of minor and exotic / middle eastern scales, very aggressive playing with the pick, and of course use of the whammy bar. It's one of those genres that is also very much concerned with instrument timbres - getting the actual sound is half the fun with surf.
Comment: If I could get the surf sound, I would play nothing else, ever. As much as I love playing blues, and bluegrass, surf is like finding the Grail. (To me, anyway.)
Comment: any recordings of your playing? It sounds like you know the path in theory so it would be interesting to hear if the execution was really as wayward as you feel it is!
Comment: This a recording from a few years ago. It's not surf music, but a creation of my own. https://www.youtube.com/watch?v=HChh-fFOZLM
Answer: As you already know, A good spring reverb (or emulation) is an essential part of the sound. The reverb accentuates note attacks a little like a slapback delay in a way that's often described as 'drippy'.
Use of a guitar with a whammy bar is also important. Chordal and melodic parts alike are often quite elaborately and dramatically inflected with the whammy bar, allowing dips in frequency (in contrast to string bending, which pulls your frequency higher).
Tremolo picking is a trademark of some surf musicians.
The three aspects above - 'grungy' reverb sound, exaggerated use of whammy, and aggressive, sometimes tremolo playing - contribute to the ability to get a sound which is 'dirty' without being distorted. In fact, a clean amp sound is quite important to allow the note attacks to come through.
Surf music was one of the first electric-guitar based genres to enthusiastically explore territory away from the major scale. Not all surf music is minor but minor chords and scales are common, as is venturing into more exotic territory like the the Double Harmonic Major Scale in the traditional song "Misirlou" given its famous rendering by Dick Dale.
Simple riffs and repeating figures to animate baselines and accompaniment parts are also common.
One possible issue if playing solo is that surf music is probably more suited to full-band arrangements than solo guitar. Its focus on simple lines each played with energy and expression makes it quite easy and fun to play one surf part on guitar, but unlike folk or country, it's hard to make a full arrangement for a single guitar that still has all the trademarks of 'surf'.


Is this chord progression correct for "false ending" (Ⅴ-Ⅵ)?

Question: Maroon 5 - She Will Be Loved Chords
key:E♭m
[Cm→A♯]←I want to check this chord progression.
link ; https://tabs.ultimate-guitar.com/tab/maroon-5/she-will-be-loved-chords-995857
Comment: If only the site was accurate enough to use the correct chord names, you'd realise it's the same two as your last question. Cm > ***Bb***. There's no A# in key Eb. But I visit, using your link, and there's no Cm or A# in sight! What's going on?
Comment: @Tim - site has a transpose button at the bottom. Pick any key you like, so long as it only has sharps in it ;)
Comment: @Tetsujin - as I suspected. Guitarists can't play flat notes/chords, everyone (except us) knows that...
Answer: You have your Roman numerals backwards. The Cm comes first. Also the VI should either be in lower case or have an m like so: vi or VIm. The chords on the verses are actually Cm to Bb7. The guitar plays an Ab note on the 3+ And also sometimes lightly on the 1+ and 2+ with the D. This doesn't affect the analysis much though. It is a deceptive cadence since the chords loop and the Bb7 resolves to the Cm instead of I or Eb, the relative major. The exception is going into the chorus it actually is a regular cadence, a V-I, Bb7-Eb
The song goes to Eb for the chorus: Eb Bb(4+3) Cm Ab (I V vi IV). That means you can interpret it one of two ways.

The entire song is in Eb. In that case the verses are vi-V7 (or VIm-V7)

The verses are in Cm and modulate to the relative major for the choruses. In that case the verses are i-VII7 (or Im-VII7)

Either analysis is acceptable, it depends on how you like to approach or conceptualize it.
Answer: Is this chord progression correct for "false ending" (Ⅴ-Ⅵ)?
Yes, V-VI is a "false ending" (deceptive cadence), but ...
This isn't a false ending.
The song just oscillates between two chords, and there's no sense that the tonic should be elsewhere. The conditions for a deceptive cadence aren't present.


Absolute value of a complex number/function

Question: I have a very generic question (maybe I am wrong because I am trying to be too generic): When I compute the absolute value of any function however difficult and complex it is, should I expect to have NO IMAGINARY PART as an output?
However, what if for instance the solver gives me the output in the form of Isinh(Isomething)? As you all know, there are many relationship between hyperbolic functions and trigonometric. Is this the only case in which I may have imaginary unit in my output? Look at the following output coming from the integral of an absoulute value (I see I)
<code>(*  (1/(3 Sqrt[2]))((-2 + 2 I) EllipticF[
ArcSin[((-1)^(1/4) b)/(-Cos[1] + Sin[1])], -1] (Cos[1] - Sin[1])^3 +
b Sqrt[3 + 2 b^4 - Cos[4] - 4 Sin[2]])  *)
</code>
Comment: Yes.  If we have $z=x+iy$, where $x$ and $y$ are real numbers, then $|z|=\sqrt{x^2+y^2}$ and is purely real.
Answer: By definition the absolute value is  real not negative function that has some other properties (see here). So it cannot be an imaginary number.
Answer: That is correct. Let $f$ be a complex-valued function. Then for every $z$ in the domain of $f$, $f(z) = x + i y$ for some $x$, $y \in \mathbb{R}$, so $|f(z)| = |x+iy|=x^2 + y^2$, which is real.
Answer: Hint: $|i|=1$.
So, yes, you shouldn't expect any $i$ in your outcome.
Answer: However, what if for instance the solver gives me the output in the form of Isinh(Isomething)? As you all know, there are many relationship between hyperbolic functions and trigonometric. Is this the only case in which I may have imaginary unit in my output? Look at the following output coming from the integral of an absoulute value (I see I)
<code>(*  (1/(3 Sqrt[2]))((-2 + 2 I) EllipticF[
ArcSin[((-1)^(1/4) b)/(-Cos[1] + Sin[1])], -1] (Cos[1] - Sin[1])^3 +
b Sqrt[3 + 2 b^4 - Cos[4] - 4 Sin[2]])  *)
</code>


Programa de Saque

Question: Galera eu estou tendo problema para resolver esse problema, alguém poderia me ajudar?
O problema de estudo é esse daqui:

Em um pequeno país do planeta Cyber, a moeda vigente é o bit cuja sigla é B$. Nesta moeda existem cédulas de B$50,00, B$10,00, B$5,00 e B$1,00 bits. Você foi contratado para implementar o sistema de saques em um caixa eletrônico e, para isso, você deverá sempre liberar o menor número de notas possíveis para um determinado valor solicitado. O seu algoritmo terá como dado de entrada o valor a ser retirado do caixa e deverá emitir o total de cada nota necessário para compor o valor solicitado (de modo que este total seja o mínimo possível). (2,0 pontos).
  O Algoritmo deverá ser encerrado quando o valor a ser retirado for 0(zero).
  Obs: Nenhum saque poderá exceder B$1000,00 bits.
  Exemplo:
  Valor do Saque: 650,00
  Notas: 6 notas de 100,00 e uma nota de 50,00

E eu fiz isso:
<code>int cedCinq = 50;
int numCedCinq;
int cedDez = 10;
int numCedDez;
int cedCinc = 5;
int numCedCin;
int cedUm = 1;
int numCedUm;`

double dinheiro = 1000;
double saque, resto;

Console.WriteLine("Digite o valor que deseja sacar: ");
saque = double.Parse(Console.ReadLine());

if (saque > dinheiro)
{
    Console.WriteLine("Valor de limite excedido, não pode ser sacado esse valor!");
}
else if (saque == 0)
{
    Console.WriteLine("Saque realizado!");
}

numCedCinq = Convert.ToInt32(saque / cedCinq);
resto = saque % cedCinq;
numCedDez = Convert.ToInt32(resto / cedDez);
resto = saque % cedDez;
numCedCin = Convert.ToInt32(resto / cedCinc);
resto = saque % numCedCin;
numCedUm = Convert.ToUInt16(resto / cedUm);
resto = saque % numCedUm;

Console.WriteLine("Do valor que foi solicitado " + saque + " foram usadas essas cédulas - Cinquenta: " + numCedCinq +
" Dez: " + numCedDez + " Cinco: " + numCedCin + " Um: " + numCedUm);
Console.ReadLine();`
</code>
Como posso resolver isso de um modo bem mais fácil?
Comment: Você pode usar array para isto. Conhece sobre?
Comment: Qual é sua dúvida específica? Dê uma olhada no [tour] e [ask]. Você chegou ler a resposta que dei na sua outra pergunta? https://pt.stackoverflow.com/a/348159/101.
Comment: Sim Maniero, eu vi a sua resposta e acredito que lhe agradeci sobre ela.
A minha dúvida é se há um modo mais simples de resolver esse problema, pois não estou conseguindo deduzir de um modo diferente e também a minha resolução está com um problema que não sei resolver.
Comment: @IgorPompeo você não especificou algum problema na sua thread. Você teve dúvidas quanto a implementação, se havia um modo mais fácil.
Comment: Desculpe pessoal estou tentando resolver isso o quanto antes pois descobri que preciso desenvolver isso para hoje e fui pego de surpresa, não é merito mas enfim... O meu problema maior é a lógica de pegar o valor dividir ele e trazer o minimo de cedulas para saque daquele valor.
Comment: Se alguma resposta é útil, seja do seu post anterior ou este, marque-a como resposta.
Answer: Bom, fiz um código com comentários para você.
Existem outras formas de fazer, obviamente, mas acho que esta é bem simples e pode te ajudar.
Comentei o código ao inveé de explicar aqui pois enquanto escrevia já ia comentando. Se ficou alguma dúvida, comente que irei te ajudar.
<code>// Aqui listamos todas os valores de cédulas que estarão disponíveis
static readonly decimal[] valorCedula  = { 50.0M, 10.0M, 5.0M, 1.0M };

static void Main(string[] args)
{
    // O uso correto para valores monetários seria DECIMAL. Existem threads aqui na SOpt com informações sobre
    decimal dinheiro = 1000M;
    decimal saque = 0.0M;

    saque = decimal.Parse(Console.ReadLine());

    if(saque <= 0.0M || saque >= dinheiro)
        Console.WriteLine("Valor de limite excedido, não pode ser sacado esse valor!");
    else if (saque == 0.0M)
        Console.WriteLine("Saque realizado!");
    else
    {
        // Criamos uma lista de cédulas que iremos receber do tamanho máximo de cédulas disponíveis
        // Cada índice vai ser respectivo a quantas cédulas de valorCedula que será dado
        // Ou seja , cedulas[0] corresponderá a nota de 50, cedulas[1] a de 10
        int[] cedulas = new int[valorCedula.Length];

        // Fazemos um loop entre todos os valores de cédulas disponíveis
        for(int i = 0; i < valorCedula.Length; i++)
        {
            // Adicionamos no respectivo índice o valor de quantas cédulas vamos ter
            cedulas[i] = Convert.ToInt32(Math.Floor(saque / valorCedula[i]));

            // Diminuímos do valo total, você pode ter uma variável auxiliar neste caso
            saque -= (cedulas[i] * valorCedula[i]);
        }

        // Escrevemos em tela
        for (int i = 0; i < cedulas.Length; i++)
            Console.WriteLine($"Cedula de { valorCedula[i] }: { cedulas[i] }");
    }

    Console.ReadLine();
}
</code>
Veja funcionando no .NET Fiddle
Comment: Kevin, quando eu fui executar o seu código ele não me retornou nada, ele simplesmente aceitou o meu valor e não retornou nada e ainda fechou a tela em seguencia.
Comment: Fiz um dotnetfiddle para você ver em andamento: https://dotnetfiddle.net/rYnXP7
Comment: Eu vi Kevin obrigado.
Agora minha única dúvida sobre o seu código para conseguir entender melhor, pq vc usa isso?
`static readonly decimal[] valorCedula  = { 50.0M, 10.0M, 5.0M, 1.0M };`
Comment: Eu substitui seu `cedCinq`, `cedDez` e etc por um array de valores. Então, ai basicamente tem a mesma quantidade de variáveis que você criou mas de forma que eu possa acessá-las mais facilmente. Se houver mais cédulas que queira adicionar, basta adicionar a esta array e o trabalho já estará feito.
Comment: Blz, obrigado... agora eu entendi

Programa de Saque


Showing that in a two variable model with an interaction, the lines for regression of $Y$ on $X_1$ at fixed values of $X_2$ cross at a point

Question: I am trying to show that in the model $E(Y) = \beta_0 + \beta_1X_1 + \beta_2X_2 + \beta_3X_1X_2$, the lines for regression of $Y$ on $X_1$ at various fixed values of $X_2$ all cross at a point. I've tried the following:
# Generate some data
x1 <- 11:30
x2 <- runif(20,5,95)

# True population coefficients
b0 <- 17
b1 <- 0.5
b2 <- 0.037
b3 <- -5.2
sigma <- 1.4

eps <- rnorm(x1,0,sigma)  # Error term
y <- b0 + b1*x1  + b2*x2  + b3*x1*x2 + eps  # Generate "true" y for our data

regression = lm(y ~ x1*x2)  # Regress y on x1, x2, and their interaction
coeffs = regression$coefficients  # Get their coefficients

temp = vector('list', 8)  # We want to plot 8 lines
for (X2 in 1:8) {  # Fixes values of X2
  points = coeffs[[1]] + coeffs[[2]]*1:8 + coeffs[[3]]*X2 + coeffs[[4]]*1:8*X2  # Y values for the lines we will plot
  temp[[X2]] = points
}

plot(1:8, temp[[1]], type='l')
lines(1:8, temp[[2]], type='l')

Clearly, though, these lines do not intersect, and so I am doing something wrong. Any help would be much appreciated!
Comment: What happens if you extend the range of values plugged into the equations?
Comment: @assumednormal Ah I think this fixes it... changing the range from `1:8` to `-2:2` works. Does this make sense? Do you think my code makes sense?
Answer: You have to assume $\beta_3\ne 0.$  When that's the case, the model can be rewritten as
$$\eqalign{y &= \beta_0 + \beta_1x_1 + \beta_2 x_2 + \beta_3 x_1x_2 \\
&= (\beta_0 - \beta_1\beta_2/\beta_3) + (\beta_1+\beta_3x_2)(x_1 + \beta_2/\beta_3) \\
&= \alpha + f(x_2)(x_1-\lambda)
}$$
where $\alpha=\beta_0 - \beta_1\beta_2/\beta_3,$ $\lambda = -\beta_2/\beta_3,$ and $f(x_2) = \beta_1 + \beta_3 x_2.$  These are all linear functions of $x_1$ and they all have the common value $\alpha$ for $x_1 = \lambda,$ showing they all intersect at the point $$(\lambda,\alpha) = (-\beta_2/\beta_3,\beta_0-\beta_1\beta_3/\beta_3).$$

When $\beta_3=0,$ the lines all intersect at the "point at infinity" given by the slope $\beta_1.$

Here is an illustration.  $\beta=(\beta_0, \ldots, \beta_3)$ is given in the title.  The lines correspond to various values of $x_2.$

If you would like to experiment, here's the R code to produce figures like it.
# set.seed(17)
beta <- rnorm(4)                        # Create random coefficients
lambda <- -beta[3]/beta[4]
alpha <- beta[1] + beta[2] * lambda
#
# Set up a plotting area around the common intersection.
#
plot(c(-3,3) + lambda, c(-3,3) + alpha, type="n", asp=1,
     main=paste(signif(beta,3), collapse=", "),
     xlab=expression(x[1]), ylab=expression(y))
#
# Plot the model for various values of x[2].
#
invisible(sapply(seq(-2,2,length.out=8)/beta[4], function(x2) {
  curve(beta[1] + beta[2]*x + beta[3]*x2 + beta[4]*x*x2, add=TRUE)
}))
#
# Highlight the common point.
#
points(lambda, alpha, pch=21, bg="Red")


If $X$ is an exponentially distributed variable with mean $ \lambda$, $Y=−3\ln(X)$ has Gumbel distribution?

Question: Let X be a random variable which follows an exponential distribution with parameter $\lambda$ ($\lambda>0$), find the distribution of the random variable $Y = −3\ln(X)$.
So this is my answer for that
$P(Y\leq y) = P(−3lnX \leq y) = P(X\geq e^{-\frac{y}{3}}) = 1-F_x(e^{-\frac{y}{3}})$
$f_Y(y) = \frac{\lambda}{3} e^{-\frac{y}{3}} e^{-\lambda e^{-\frac{y}{3}}}, -\infty \leq y \leq \infty$
We have this definition

If T follows an Gumbel distribution with parameters $\alpha$ and $\beta$, with Probability Density Function $$f_T(t)=\frac{e^{-(t-\alpha)/\beta}}{\beta}e^{-e^{-(t-\alpha)/\beta}}, -\infty \leq t \leq \infty$$

So Y follows Gumbel distribution with parameters $\alpha=0$ e $\beta=3$?
Comment: This is correct if $\lambda =1$.
Answer: Your PDF: $f_Y(y)=\frac{\lambda}{3} e^{-y/3}e^{-\lambda e^{−y/3}}$. All good
Target PDF: $f_T(y) = \frac{e^{-(y-\alpha))/\beta}}{\beta}e^{-e^{-(y-\alpha)/\beta}}$.
So we would like $\lambda e^{-y/3} = e^{-(y-\alpha)/\beta}$.
How do we do that? Taking logs (just for exploratory purposes)
$\ln (\lambda) - y/3 = -y/\beta + \alpha/\beta$
So we will want $\beta = 3$, $\alpha = 3 \ln (\lambda)$.
It also follows that $e^{-(y-\alpha)/\beta}/\beta  = \lambda/3 e^{-y/3}$. So it all works!
Hence you can fit a Gumbel to it regardless of the value of $\lambda$ in your exponential distribution.


Right-hand thumb position for playing recorder

Question: I am approaching the (soprano) recorder by myself, and have checked several resources online with very valuable advice (e.g. placing the left-hand thumb slightly inclined so as to allow it roll — life changer). However, I've found very little on the position of the right hand, in particular with regards to the thumb.
From various pieces of information I have managed to gather, it seems that the ideal position is with slightly bent fingers, except for the pinky finger which should be straight.
Does the community have any good "rule of thumb"?
Comment: Put it where it feels most comfortable. It's not covering any holes, so is purely support. Use it more as a balance point than anything.
Answer: I guess the reason you've found no answer to your question is that it will be different for everyone. You place your right thumb wherever you need to so your fingers can reach all the holes comfortably and so that the instrument feels secure in your hand.
Rule of thumb: if it feels awkward or tense it's not right.
It may also help to watch professionals to get some more ideas.
Hope you come right!
Comment: I was asking simply because generally videos and the like never show a profile of the player, so difficult to see what's going on behind the recorder. Absence of tension seems like a good starting point!
Answer: A good analogue is looking at how clarinet players tackle this problem. When I started learning tenor recorder I quickly realized that the weight made it very hard to hold up the instrument, especially on notes that raised more fingers. Since I had already worked on clarinets it wasn't hard for me to install a metal thumbrest. I noticed that most clarinets are have their thumbrest located so that the thumb rests somewhat between the index and middle finger. When you hold the end you'll notice that as you move the body away from you your wrist has to rotate towards you to compensate and allow all of your fingers to touch the holes. This makes the thumb lower and more in line with the middle finger. In contrast, bringing the instrument closer to your body puts it more in line with your index. This also depends on if your index hole plays an F sharp or an F natural.
Otherwise make sure you have little tension, a straight wrist, and your hand in a C shape. If you plan to play for a long period of time I'd highly suggest getting a thumbrest installed.
Comment: Are you really suggesting a thumb-rest for a soprano recorder?
Answer: It's hard to go past Genevieve Lacey as a gold standard for recorder technique. This video shows that her right thumb stays under her second finger.


Musical notes for single string lead acoustic guitar

Question: Question Edited
I wrote the guitar strumming notes of a song on a music street on one staff, now I am trying to write the lead notes on another staff. The lead part consists of single string notes. I lead part, may be due the single string composition, don't seem to sound good. Any advice?
As per the inputs of John Belzaguy, the edited strumming pattern is listed below:
Comment: Not sure if I understand the question. The video shows tabulature. What is missing in the video is notation of rhythm. Is that what you're asking about, how to notate rhythm?
Comment: So do I understand, you wish to notate rhythm of your music, and you don't know anything about rhythm notation so far? I'm not sure if this can be answered in a concise manner, but I'm sure someone could provide references to some basic teaching materials...
Comment: I want to be able to write the lead also in a music sheet so that I can play the strumming and the lead like in a multi track. Presently the representation and timing is based on hearing only. I want to sync with the guitar strumming beats if possible to get the timings right.
Comment: I am aware how to write the strumming notation of the music but not sure about the lead  part. Question edited to include the strumming rhythm.
Comment: But there's no difference! You notate eight notes, quarter notes etc. the same way. This video shows notation of tab with rhythm, including solo in the middle https://www.youtube.com/watch?v=04xDZj0smHQ Is that what you're looking for?
Comment: What you would normally do would be putting two scores or tabulatures on top of each other, making sure that they are aligned, like in this example: https://www.youtube.com/watch?v=uJVlbLK7VbA&list=PLgvWsy0-mt4TFra_ldczTmscbFxlvV_2x Most score/tabulature writing software can do it for you
Comment: @user1079505: I am doing similarly on Guitar Pro. I issue is the lead part isn't coming right theoretically.  If I pick a guitar I am able to do so. It's rather issue representing the lead on the music sheet. Within a bar, trying to make the lead sound right on a music sheet is the issue.
Comment: I see you got the answer you wanted, but one suggestion: get a rhythm practice book and learn notation from playing. Most methods go from simple to more complex rhythms. Something with a CD playalong would probably help a lot. When you can play from reading, then writing rhythms will be much easier. Your issue is not specifically about writing, it's about understanding rhythm notation generally.
Comment: @MichaelCurtis: I agree. Thanks for the input.
Answer: I'm not sure what exactly do you struggle with but I hope I will be able to give you some pointers here.
In this link you can find arrangement to one of the songs you mentioned in comments: https://musescore.com/user/99729/scores/4141356 This is score, not tab, but the rules for rhythm notation are the same.
Let's look at the first couple of measures:

I marked the beats for you.

Note that the melody (upper staff) and the accompaniment (lower staff) have different rhythms. We call them separate voices. Sometimes you may have multiple voices written in a single staff, this happens often in classical guitar or fingerstyle repertoire.
Note how beats in the melody match those in the accompaniment. So note on beat 4 in the melody is exactly above note on beat 4 in accompaniment.
Note that melody starts with anacrusis or pickup notes, in plain language it starts before beat 1.
Note that also there is some graphical flexibility, e.g. the first quarter note in the second measure in the bottom staff takes a bit more space than the others, because there is more activity in the melody there.

I would say counting the beats is the most critical thing to work on. Try to play the accompaniment while counting the beats aloud. Then try doing the same for the melody. And also try playing the accompaniment while singing the melody, and analyze which notes come at the same time.
Comment: I think your answered almost my question. Let me digest your reply . +1 Thanks.
Comment: Wow, the link you have given is exactly what I was looking for. Is the music sheet lead + piano?
Comment: @seccpur This is piano notation for right hand (upper staff) and left hand (lower staff), and I think the right hand is meant to play the same notes as the voice. But music for multiple instruments is notated the same way (except of the brace on the left side indicating both staves are for the same instrument).
Comment: Can it apply on guitar lead as well?
Comment: @seccpur Yes, definitely, accompaniment guitar on one staff and the lead guitar on another.
Comment: Is it fair to conclude that playing instrument is much easier than writing on the score?
Comment: @seccpur This certainly varies case by case. But here I would argue, if writing down the score forces you to understand better what you play, it will help you to perform as well.


The chords of a hyperbola, which touch the conjugate hyperbola, are bisected at the point of contact.

Question: While studying coordinate geometry I came across a question -

Prove that chords of a hyperbola, which touch the conjugate hyperbola, are bisected at the point of contact.

Since everyone hyperbola can be transformed into a standard hyperbola, whose transverse and conjugate axis are along the coordinate axis by suitable shifting of origin, I can prove this question for a standard hyperbola.
Unfortunately, in spite of many tries, I'm not able to prove this statement. Any help will be greatly appreciated.
Here's my try, it includes the figure (in case if statement is not clear, also note that the figure is not to scale.)

It seems I've proved that the point can't bisect the chord, which sounds contradictory. I guess something is wrong in my proof.
Comment: https://math.stackexchange.com/questions/1488751/finding-equation-of-chord-of-hyperbola
Comment: What do you want to say?.Well I guess I used equation of chord correctly
Answer: The upper branch of the conjugate hyperbola can be described by the following parametric equations:
$$
x=a\sinh t \\
y=b\cosh t \\
$$
Consider now a generic point $P=(a\sinh\bar t,b\cosh\bar t)$ on that hyperbola: the equation of the line tangent at $P$ (with parameter $s$) is then
$$
x=(a\cosh\bar t)s+a\sinh\bar t \\
y=(b\sinh\bar t)s+b\cosh\bar t \\
$$
To find the intersections of this line with the hyperbola, we must insert $x$ and $y$ given above into the equation $x^2/a^2-y^2/b^2=1$ and then solve for $s$: this gives the simple result $s^2-1=1$, that is: $s=\pm\sqrt2$.
We have then two intersection points, whose coordinates are obtained by adding and subtracting the same quantities to the coordinates of $P$, which is their midpoint.
EDIT.
With your parameterization, the equation of the tangent line gives
$$
{y\over b}=\cos\theta+{x\over a}\sin\theta
$$
and substituting that into the equation $(x/a)^2-(y/b)^2=1$ of the other hyperbola one readily gets the coordinates of the intersection points $A$ and $B$:
$$
x_{A/B}=a\tan\theta\pm\sqrt2 a\sec\theta,
\quad
y_{A/B}=b\sec\theta\pm\sqrt2 b\tan\theta.
$$
As you can check, $x_C=(x_A+x_B)/2$ and $y_C=(y_A+y_B)/2$.
Comment: But what's wrong in my solution? Why am I getting a different answer? Sorry, but I'm currently learning high school mathematics and we haven't been told anything about hyperbolic functions. :(
Comment: Your solution doesn't work because $\alpha$ and $\beta$ are not independent among them: you didn't take into account the equation for $\sec\theta$. It's simpler, in my opinion, to find the intersections between the tangent line and the other hyperbola.
Comment: See also my edit.
Comment: Thanks your solution is absolutely correct, but I'm still not able to understand what went wrong with my method, can you please elaborate a bit more. Well, you said 'you didn't take into account the equation for sec (theta).' What does it mean? When I assumed the coordinates for conjugate hyperbola involving variable theta, (parametric form) it automatically implies that the point will have to lie on that curve, moreover the tangent to the conjugate hyperbola is the chord of standard hyperbola, so equation of tangent and chord will have to be same.
Comment: What do you mean by saying "alpha and beta are not independent among them"?
Comment: Angles $\alpha$ and $\beta$ are given once $\theta$ is given. When you write $${\cos(\alpha/2-\beta/2)\over\cos(\alpha/2+\beta/2)}\ne{\sec\alpha+\sec\beta\over2}$$ you base your statement on the fact that the above formula is not an identity, that is it doesn't hold for all values of $\alpha$ and $\beta$. But that formula needn't be true for all values of the angles, but just for the particular value they have in this case.
Answer: This is proven by Apollonius of Perga (about a half century after Euclid) in Conics II, 19. "If some straight line is drawn touching some one of the conjugate opposite sections at random, it will meet the adjacent sections and will be bisected at the point of contact." This was of course before coordinate geometry. Apollonius' proof uses no trigonometry, but rests on earlier propositions in Conics I & II, which in turn rest on Euclid's Elements.


Iterate over array content without knowing the keys values

Question: Can someone tell me how to iterate over array keys without knowing their values ?
For example:
array:3 [▼
  "name" => "AccountId"
  "activated" => "false"
  "type" => "string"
]

I'd like to get a select list with:
<select name="select">
  <option>name: AccountId</option>
  <option>activated: false</option>
  <option>type: string</option>
</select>

Answer: You can Iterating over Keys and Values as described in the doc, as example:
<select name="select">
    {% for key, value in users %}
       < option > {{ key }}: {{ value }}</option >
    {% endfor %}
</select>

Comment: uhmm seems due to the `{{ array.key }}` try with `{{ value }}` as described in the provided answer
Comment: Thank you for your answer ! can you please tell me about this error  ?
Key "key" doesn't exist ? why it doesn't take the value of key instead of "key"

     {% for key,value in array %}
       {% if (key !=  'id') and (key != 'type') %}
         {{ array.key }}
       {% endif %}
     {% endfor %}

Comment: Well actually your answer helped me to write the for loop but in my page 'value' is an array so I thought that I could access to its attributes by the doing value.key but it doesn't work when it dynamically ( if i do value.type it works )
Answer: Something like this should do the trick:
<select>
    {% for key, value in data %}
        <option>{{ key }}: {{ value }}</option>
    {% endfor %}
</select>

You can read more about for loop in Twig's documentation.


Flask-Restless case-insensitive query

Question: How to make case-insensitive search query using Flask-Restless?
Example:
api/user?q={"filters":[{"name":"lastname","op":"like","val":"%davidson%"}]}

I would like the previous code to return "davidson", "Davidson", "DAVIDSON"...
But it only returns "davidson".
Answer: You can use the ilike operator like so:
api/user?q={"filters":[{"name":"lastname","op":"ilike","val":"davidson"}]}

This is not really documented in the Flask-Restless docs, but the operator is documented in SQLAlchemy which is the OR mapper Flask-Restless uses under the hood. See the relevant docs here or this answer.

Flask-Restless case-insensitive query


code to know whether the file has been downloaded or not

Question: I wanted to know if there is a way to know whether or not a file has been downloaded completely.
i.e., Is it possible to trigger some action(like send a message to server or alert d user etc.) once a file has been downloaded.
Possibly in java, php.
Thank you.
Comment: @rdlowrey I anxiously await your answer below, sir!
Comment: What is your case? do you download a file from a webserver? What type of webserver is this? etc. a little more information please
Answer: Despite comments to the contrary, this is possible, though it's not for the faint of heart because it requires some knowledge of the HTTP protocol as well as understanding of file streaming.
Assuming PHP ...

Run the file download through a PHP script -- i.e. don't have the web server serve the file directly from disk, have a php script return it.
Tell the PHP script to ignore_user_abort() -- this will allow the php script to continue to run after the user closes the connection
Send a Connection: close header AND a Content-Length: 1234 header where 1234 is the size of the file being served.
Stream the file to the client using fwrite, tracking the number of bytes you've output. Once the number of output bytes have reached the filesize, you know you're finished. The client will have closed the connection but your script will continue to run.
Do anything you want to notify yourself or a database or a text log file that the download completed successfully.

Be careful, though, because in a web SAPI you can easily run up against the max time limit in PHP.

UPDATE:
It's worth mentioning that if you do something like this, you should also add a check to connection_aborted in your output loop so that you don't continue to stream output if the client aborts the connection before completing the transfer. This should be common sense, but don't say I didn't warn you.
Comment: Wow! This is awesome. I am always glad to be proven wrong on SO because I learn something new and awesome every time! +1!
Comment: @Matt If I had a dollar for every time someone proved me wrong on this site I'd be a rich man :)
Answer: Just send files via phpscript..
e.g http://exmaple.com/download.php?filename=some_filename.txt
$file=$_GET['filename'];
if (file_exist($file)){
 send_message_to_somebody(); //DO what ever you want here and then

 $mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $file);
 header("Content-Type: " . $mime);
 header("Content-Transfer-Encoding: binary");
 header('Accept-Ranges: bytes');
 header('Content-Disposition: attachment; filename="' .  basename($file).'"');
 header('Content-Length: ' . filesize($file));
 readfile($file);
}

Comment: This will not work, because with the above code php will terminate the process as soon as the client closes the connection. There will be no way for the server to know if the file was actually downloaded in full.
Comment: you right, i didnt read carefully - missed that _complete_ download is important
Answer: Write info in database, if download is canceled/aborted, column like "is_downloaded" will be 0, instead of 1... poor description, don't have time.
What is important here is _destruct(), that is the trigger for download complete.
<?php

class Download
{
  protected $file;
  private $session;
  private $_last_insert_id;

  public function __construct($file, $session)
  {
        $this->file = $file;
        $this->session = $session;
  }

  public function send()
  {

        $info = pathinfo($this->file);

        $query = DB::insert('downloads', array('user_id', 'file', 'path', 'start'))
        ->values(array($this->session->get('id'), $info['basename'], $this->file, DB::expr('NOW()')))
        ->execute();

        $this->_last_insert_id = $query[0];

        $this->session->set('downloading', 1);

        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename="'.$info['basename'].'"');
        header('Content-Transfer-Encoding: binary');
        header('Expires: 0');
        header('Cache-Control: must-revalidate');
        header('Pragma: public');
        header('Content-Length: ' . filesize($this->file));

        readfile($this->file);
  }

  public function __destruct()
  {
    $aborted = connection_aborted();
    $this->session->set('downloading', 0);
    $query = DB::update('downloads')->set(array('stop' => DB::expr('NOW()')))->where('id', '=', $this->_last_insert_id)->execute();
  }

}


How do I setup rsyslog to send all logs to multiple remote servers?

Question: I am trying to make rsyslog to send all logs to 2 remote servers, but it seems rsyslog only sends to the secondary server if the first one fails.
*.* @@server1
*.* @@server2

If I put the above in /etc/rsyslog.conf, server2 will not receive any logs as long as server1 is up. How do I tell rsyslog to send to both servers no matter what?
Also, as an extra bonus, I would like to use 2 different local "buffer"-files for local storing if the remote servers goes down.
Answer: From
Forwarding to More than One Server;

What is important to know, however, is that the full set of directives make up an action. So you can not simply add (just) a second forwarding rule, but need to duplicate the rule configuration as well. Be careful that you use different queue file names for the second action, else you will mess up your system.

So, actually, you have to use 2 different local queues.
Configure a working directory.
$WorkDirectory /var/spool/rsyslog

Configure your forwarding rules (obsolete legacy format).
$ActionQueueType LinkedList
$ActionQueueFileName Forward1
$ActionResumeRetryCount -1
$ActionQueueSaveOnShutdown on
*.* @@server1

$ActionQueueType LinkedList
$ActionQueueFileName Forward2
$ActionResumeRetryCount -1
$ActionQueueSaveOnShutdown on
*.* @@server2

Configure your forwarding rules (new advanced format).
action(type="omfwd" target="server1" resumeRetryCount="-1"
    queue.type="LinkedList" queue.filename="Forward1" queue.saveOnShutdown="on")

action(type="omfwd" target="server2" resumeRetryCount="-1"
    queue.type="LinkedList" queue.filename="Forward2" queue.saveOnShutdown="on")

Comment: Sorry, I need 15+ reputation to upvote
Comment: Firewalls will do it every time.. I should have asked about that! :) Regardless of your existing config working, how about an upvote for my efforts? This site works best when the voting system encourages participation. Please see the [about] page when you get a chance.
Comment: That is actually exactly the config I used, including the different queue-files. But it still does not work. I only see logs comming to "server2" if I turn off "server1"
Comment: Sorry, my bad. I had some wrong firewall rules :) My original config was working after I fixed the firewall issues.


fastest web server for static, dynamic content?

Question: I'm looking for the fastest http server available for:

serving static content -- huge set of large images.  Minimal features need, just as fast as possible.
dispatching dynamic content plugins -- think a web server that does on-the-fly watermarking or image transcoding.  I'm looking for the fastest, lowest-overhead way of dispatching this.

Environment: linux or OS/X.  any language acceptable.
Comment: why does the water-marking have to be "on-the-fly"? Couldn't images be processed server-side *outside* the webapp to add/remove the watermark, and then just serve the proper image to the site?
Answer:
serving static content -- huge set of large images. Minimal features need, just as fast as possible.

nginx is the current favored choice. LigHTTPd still works fine, but is less actively developed nowadays. LiteSpeed is also a good choice, and may be the best if you want commercial support or a nicer GUI. All of these are very fast, raw speed will not be a meaningful competitive differentiator within this group of webservers.

dispatching dynamic content plugins -- think a web server that does on-the-fly watermarking or image transcoding. I'm looking for the fastest, lowest-overhead way of dispatching this.

Hmnn, a custom extension module to nginx is the lowest overhead option. But writing modules in C / C++ is seriously time-consuming. OP says "any language acceptable", well, if that is so then nginx with a C extension, or maybe Apache with a C extension to benefit from Apache's richer set of modules and documentation.
But realistically, who writes C code today for non-mass-market products? I would consider Python code with Tornado, or a similar event-driven webserver in a high-level language to be a better match.
Comment: @Mark: Well, in that case, have a look at the 3rd party modules for nginx that I linked to above, for inspiration... And do the math of course, while nginx is fast, it may not be so much faster that it justifies porting over code that already works on Apache.
Comment: @Mark: See this presentation on nginx internals: http://www.slideshare.net/joshzhu/nginx-internals

It was linked from this so-so thread: http://serverfault.com/questions/86674/why-is-nginx-so-fast
Comment: C or C++ is no problem... my current code base is a C-level apache module.
Comment: In that case, I'd imagine that a port to nginx wouldn't be the end of the world.
Answer: NGINX http://nginx.net for requirement 1) static file serving at least.
SEE Why is Nginx so fast?
Answer: Choose between lighttpd and nginx for static content. Choose Apache with modules that do in-house fastcgi process management efficiently (mod_fcgid, mod_wsgi, mod_passenger) for generating the dynamic content.
Answer: One solution would be nginx + php-fpm + apc.  It'll handle static content and it'll handle dynamic content pretty f'ing quickly, too.
It's also worth noting that nginx has plugins, as well, and you could always write a plugin  that did the watermarking.  Doing it that way is probably the fastest possible way, although not the simplest to build.
Here's an example module that uses libgd:
http://wiki.nginx.org/NginxHttpImageFilterModule
There's no reason you couldn't modify it to spit out watermarked images instead...
Answer: My faster Web Server podium is :
1) Nginx
2) Lighttpd
3) Cherokee
Here some benchmark :
http://www.cherokee-project.com/benchmarks.html
http://www.rkblog.rk.edu.pl/w/p/lighttpd-and-cherokee-benchmark/
http://www.rkblog.rk.edu.pl/w/p/pylons-benchmark-various-servers/
Cherokee is fast and simple to configure, for this maybe is the better choice.
Answer: Perhaps lighttpd, but I'm not sure about the watermark part.
Comment: Watermarking would be passed off to an external process, I'd imagine (or hope).  I used to use lighttpd a lot, but I'm not a huge fan of it any more, I think nginx has taken over it's niche.
Answer: If your talking about the fastest/easiest web server to setup, i'd point to HFS File Server .  It doesn't support anything but static content, but its SOOOO easy to use.


getting started with firebase with javascript

Question: I'm just getting started with firebase and javascript html to make a website for my app.
all I'm trying to do is access any value from firebase and print it on the website.
I followed firebase's quickstart tutorial and copied the exact same code they have: https://www.youtube.com/watch?v=k1D0_wFlXgo
here is the code:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Javascript</title>

am I missing something? I am new so there might be one small step that I'm missing.
Comment: You have an extra `)` at the end of this line `dbRef.on('value', snap => bigOne.innerText) = snap.val())`.
Comment: But as a side note, I also suggest that you check your Rules under `Databases` in `console.firebase.google.com` to make sure that you actually have `read`/`write` permissions! For development, you can change `false` to `true`.
Answer: Try with:
dbRef.on('value', function(snapshot) {
    bigOne.innerText = snapshot.val();
});


Is it mandatory to clear cache for each and every change made?

Question: It takes more time to clear caches and it also needs to be done more frequently for the each CSS or functionality wise changes.
Are there any alternatives available?
Answer: Disable Drupal 8 caching during development

When you are developing a module or a theme you have to clear Drupal's
  cache (render cache, dynamic page cache, Twig cache) very often to see
  the changes being applied. You can disable caching for development.

Steps

Copy and rename the file sites/example.settings.local.php to sites/default/settings.local.php:

$ cp sites/example.settings.local.php sites/default/settings.local.php

Uncomment these lines in sites/default/settings.php:

if (file_exists(__DIR__ . '/settings.local.php')) {
    include __DIR__ . '/settings.local.php';
}

If you want to keep CSS and JS aggregation and preprocessing, change these lines in sites/default/settings.local.php to TRUE:

$config['system.performance']['css']['preprocess'] = TRUE;
$config['system.performance']['js']['preprocess'] = TRUE;

Uncomment these line in sites/default/settings.local.php:

$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = cache.backend.null';

Add the following lines to sites/development.services.yml:

parameters:
  twig.config:
    debug: true
    auto_reload: true
    cache: false

(source: drupal.org)
Comment: This doesn't work.  Changing $config['system.performance']['css']['preprocess'] to FALSE does not disable CSS aggregation.  Additional steps must be needed to disable CSS aggregation besides those supplied here.
Answer: The easier way to "Disable Drupal 8 caching during development" is using DrupalConsole.
drupal site:mode dev

Source - Debugging compiled Twig templates
Comment: This no longer works.
Answer: Depend on your working area.
Steps 01)
a) You can disable cache from /admin/config/development/performance
b) You can copy a file from sites/example.settings.local.php to sites/default/example.settings.local.php then replace by settings.local.php. For this file you have comment out the following codes from settings.php.
/**
 * Load local development override configuration, if available.
 *
 * Use settings.local.php to override variables on secondary (staging,
 * development, etc) installations of this site. Typically used to disable
 * caching, JavaScript/CSS compression, re-routing of outgoing emails, and
 * other things that should not happen on development and testing sites.
 *
 * Keep this code block at the end of this file to take full effect.
 */
if (file_exists(__DIR__ . '/settings.local.php')) {
  include __DIR__ . '/settings.local.php';
}

Then you have to comment out the following section from /sites/default/settings.local.php
/**
 * Disable the render cache (this includes the page cache).
 *
 * Note: you should test with the render cache enabled, to ensure the correct
 * cacheability metadata is present. However, in the early stages of
 * development, you may want to disable it.
 *
 * This setting disables the render cache by using the Null cache back-end
 * defined by the development.services.yml file above.
 *
 * Do not use this setting until after the site is installed.
 */
$settings['cache']['bins']['render'] = 'cache.backend.null';

If you may get an error. Do not worry. Just enter in your browser address bar your_site_domain.com/rebuild.php.
Steps 02)
Specially for Drupal 8 there is a nice tools is called Drupal Console. Installation and documentation is great. You can see using the site http://www.drupalconsole.com/.
When you will finish the installation, I hope you will be more happy for the command line features. Like you can clear cache using the following command-
$ drupal cache:rebuild

OR
$ drupal cr all

Answer: Source Disable Drupal 8 caching during development
Steps

Copy and rename the sites/example.settings.local.php to be sites/default/settings.local.php

$ cp sites/example.settings.local.php sites/default/settings.local.php

Open settings.php file in sites/default and uncomment these lines:
if (file_exists(DIR . '/settings.local.php')) {    include
  DIR . '/settings.local.php';  }

This will include the local settings file as part of Drupal's settings file.

Open settings.local.php and uncomment this line to enable the null cache service:

$settings['container_yamls'][] = DRUPAL_ROOT .
  '/sites/development.services.yml';

NOTE: Do not create development.services.yml. It exists under /sites

In settings.local.php change the following to be TRUE if you want to work with enabled css- and js-aggregation:

$config['system.performance']['css']['preprocess'] = FALSE;
  $config['system.performance']['js']['preprocess'] = FALSE;

Uncomment these lines in settings.local.php to Disable the render cache and Disable Dynamic Page Cache

$settings['cache']['bins']['render'] = 'cache.backend.null';
  $settings['cache']['bins']['dynamic_page_cache'] =
  'cache.backend.null';

If you do not want to install test modules and themes, set following to FALSE

$settings['extension_discovery_scan_tests'] = TRUE;

Open development.services.yml in the sites folder and add the following block (to disable twig cache)

parameters:
  twig.config:
    debug: true
    auto_reload: true
    cache: false

Afterwards you have to rebuild the Drupal cache. Otherwise your website will encounter an unexpected error on page reload. This can be
  done by with drush:

drush cr

or by visiting the following URL from your Drupal 8 website:
http://yoursite/core/rebuild.php

Finished! Now you're able to develop in Drupal 8 without manual cache rebuilds on a regular basis.


How to add new user level in Orangehrm and add some credentials?

Question: I am trying to create a new level of user which is like an admin but has less credentials. He cant configure settings of the modules but can view, add, edit, delete data of the employees. Thanks in advance.
Answer: There is hidden "User Roles" module in OrangeHRM, it provides you all the permissions required to change/assign particular menu items to various roles. This needs some custom work such as updating the values on check/uncheck but should be a simple job to do. And tables names are shared by @patxrick should help you to do the modification easily.
Comment: How to access this hidden module? Is that a part of free version? I am using v4.7
Answer: You need to insert new user role in ohrm_user_role table.
Then add related records in tables like ohrm_user_role_screen table and ohrm_user_role_data_group.


JavaScript assignment explanation

Question: I'm working off w3schools.com and I generally try to read through the code and make sense of what line of code does what, and I am a little confused on this code:
function myFunction() {
 var message, x;
 message = document.getElementById("message");
 message.innerHTML = "";
 x = document.getElementById("demo").value;
 try {
    if(x == "") throw "empty";
    if(isNaN(x)) throw "not a number";
    x = Number(x);
    if(x < 5) throw "too low";
    if(x > 10) throw "too high";
 }
 catch(err) {
    message.innerHTML = "Input is " + err;
 }
}

on the section:
var message, x;
message = document.getElementById("message");
message.innerHTML = "";
x = document.getElementById("demo").value;

Does the first line declare both variables message and x? The second line makes sense, but on the third line is it declaring undefined? And what exactly does the fourth line do?
Comment: _"Anyways, it still stands - `message` is reassigned to an empty string"_ - no, it's not. The `innerHTML` property of the HTML element that `message`references is set to the empty string, thereby clearing the element of all content.
Comment: I strongly recommend that you learn the developer tools that come with the browser (press F12 key). Each browser gives the sections different names but in Chrome look under to Source tab. Then learn how to set breakpoints and single step through your code. Seeing the code in action is better than trying to explain it.
Comment: @AndrewLi only it's not initializing `message` to an empty string. On the second line, an HTML element with the ID of "message" is being assigned to the `message` variable. On the 3rd line, *the HTML value* of the previously mentioned element is being set to an empty string.
Comment: @CBroe Ugh. I'm blind. Yes, `innerHTML` property is assigned to an empty string.
Comment: @AndrewLi, look at the code provided. `message` is an instance of a(n) [`Element`](https://developer.mozilla.org/en-US/docs/Web/API/Element) (so long as the element with the ID of "message" exists). On the 3rd line, the `innerHTML` property of the `message` variable is being set to an empty string, thus emptying the "html value" of the element on the page.
Comment: @BryndenBielefeld I know, just a simple misunderstanding. I missed the lines mentioned thus I didn't understand what you were saying.
Answer: 1. var message, x;
2. message = document.getElementById("message");
3. message.innerHTML = "";
4. x = document.getElementById("demo").value;

Line 1:  You can declare (and optionally assign values to) multiple variables, separated by commas, after a single var statement.
Line 3: is setting the 'property' innerHTML, on the object 'message', to the empty string.
Note : the object 'message', returned in line 2 would already have the property 'innerHTML'  of type string, (if the element with id="message" exists), because it is a particular type of object (an HTMLElement) but in general, you can assign any value to a previously undefined property on an object, and it will create that property. For example:
var obj = {}
alert (typeof obj.newproperty) // undefined
obj.newproperty = "hello"
alert (typeof obj.newproperty) // string

Line 4:
document.getElementById("demo")

is a reference to the element with id = "demo"
x = document.getElementById("demo").value

sets the variable, x, to the value of the property 'value' on that element (if it exists, or to undefined if it does not.)
Note : it no element with id="demo" exists then that line would throw an error trying to reference a property (value) on a null object.
Answer: The first line declares both the message and the x variables. I don't know what you mean with declaring undefined, but the third line sets the content (inner HTML) of the message element to be an empty string. The last line sets to x the value attribute of the demo element. The value property contains the default value or the value a user types in a text field (or a value set by a script).
Answer: function myFunction() {
  var message, x; // declarations separated by a comma - end declarations with ;
  message = document.getElementById("message"); // assignment of an Element (which is an Object) to var message
  message.innerHTML = ""; // assignment to the Element's innerHTML property which writes inside the HTML Element itself - won't work on inputs (use .value)
  x = document.getElementById("demo").value; // assign the demo input value to var x
  try { // try things and send to catch if throw occurs
    if(x == "") throw "empty"; // == is a truthy test use === for more accuracy
    if(isNaN(x)) throw "not a number"; // not numeric-ish - isNaN() works on strings too
    x = Number(x); // cast var x to a number - could also be done like x = +x;
    if(x < 5) throw "too low";
    if(x > 10) throw "too high";
  }
  catch(err) { // err argument receives throw if there is an error
    message.innerHTML = "Input is " + err; // assign
  }
}

JavaScript assignment explanation


Why can RF learn multiplicative interaction but not additive interaction

Question: The answer to the post Including Interaction Terms in Random Forest shows how a random forest can learn a multiplicative interactive term without it being specified as a feature. On the other hand, I read in ESL that tree-based models cannot learn linear combinations of features that are not pre-specified. Can someone explain why a RF is able to learn multiplicative interaction but not additive interaction?
Comment: Where in ESL can we find that passage?
Comment: Some table in Section 10.7.
Answer: The two arguments have competing definitions of "learn."  A random forest can approximate a functional form with additive and multiplicative interaction terms, but it cannot reproduce either exactly, and will have a particularly hard time approximating the function outside the range of inputs provided during training.
As a comment to the accepted answer in the linked question alludes (reference link), even the approximation on the training range is subject to caveats.  Here I play around with XOR style interactions, and among other things show that when other effects are being modeled, the trees may get distracted from faithfully representing the interaction.
Comment: No, I mean when the XOR is not the only part of the target; when the model is e.g. $x_1 + x_2 + sign(x_3 \cdot x_4)$, the trees may spend more time splitting on $x_1$ and $x_2$ so that they only occasionally find the xor structure in $x_3, x_4$.


Xaml Binding in Windows Phone 7.1

Question: I have a problem with my xaml and binding in windows phone 7. I have a listbox and it's itemSource is sent in the code-behind. The ItemsSource is a class that has several variables that are bound in my xaml and everything works flawlessly on startup. The problem is everythime I want to change a value of a property that is bound for example:
<TextBox Name="x" Text="{Binding Path=Name}" />
when I change this in the code-behind x.Text = "Name" All the bindings for the text of the textbox 'x' which is a listboxitem are blocked and can never be changed all of the items in the listbox are now set with the string 'Name'. I have the INotifyPropertyChanged added to my class and that does not resolve this issue. Please help.
Comment: If you have it bound change it in the collection in your viewmodel.
Comment: Add some code, that will help others on helping you!
Answer: The value of the bound property can be changed, although is not a good practice.
This works only for TwoWay binding, so your code should look like this <TextBox Name="x" Text="{Binding Path=Name, Mode=TwoWay}" />.
Documentation can be found here.
Answer: Setting a bound property clears the data binding (for one way binding). I have never seen any Microsoft documentation on this but I have experienced it many times in my code and have come to accept it.
It makes sense if you think about it, since changing the property value means the property no longer reflects the value in the bound data.

Xaml Binding in Windows Phone 7.1


What is time complexity of my algorithm

Question: I have this algorithm:
<code>n=3;                          1
m=2;                          2
func(int n, int m)            3
{
    for(int i=1; i<=m; i++)   4
    {
        if(n>1)               5
        {
             func(n-1,m);     6
        }
    }
}
</code>
How can I find the time complexity of this one? I know that for the for loop I can write:
$$\sum_{i=1}^{m}c$$
But I don't know how can I write the recursion in this loop.
Comment: How is `recLoop` defined?
Comment: @VHarisop I fixed it.
Comment: `func` seems to accept two arguments, but you only pass it one recursively
Comment: @DanUznanski Sorry copy-paste stuff. I think now it's correct!
Answer: The running time follows the recurrence
$$T(n,m)=mT(n-1,m)+mc$$ with $$T(1,m)=mc.$$
($c$ accounts for one execution of the loop and the if.)
Then applying the recurrence several times
$$T(1,m)=mc,\\T(2,m)=m^2c+mc,\\T(3,m)=m^3c+m^2c+mc,\\\cdots$$
and finally
$$T(n,m)=\frac{m^n-1}{m-1}mc$$ which is of order $O(m^n)$.
Comment: I would ask you to collaborate a bit your answer and also if you can to express it in summation?
Comment: What don't you understand, precisely ?
Comment: Two things: 1) Why $T(1,m) = cm$ ? and 2) If the solution is $cm^n$ than for $n=3$ and $m=3$ it is $T(3,3) = 27$, but If I add a ```count++``` before line ```6``` I'm getting 39 and not 27.
Comment: @J.Doe: I have refined the solution.
Comment: OK, what about the count variable I still don't get the right number i.e $T(3,3)$
Comment: @J.Doe: you do have the right number !
Comment: Yes, my mistake, sorry, typo!
Comment: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/73567/discussion-between-j-doe-and-yves-daoust).
Comment: @J.Doe: for me this case is closed. Enter another question if you need more.

What is time complexity of my algorithm


How to find the basis for $\mathrm{Ker}(T)$ of the following linear transformation?

Question: $\newcommand{\Ker}{\mathrm{Ker}}$Find a basis for the vector space $V$ so that the first $\dim(\Ker(T))$ vectors are a basis for $\Ker(T)$, $T:V\rightarrow W $ a linear transformation.

$T:R^4 \rightarrow P_2(R)$ defined by $T(a_1, ..., a_4)=(a_1+a_2)+(a_2+a_3)x+(a_3+a_4)x^2$

$T:P_n(R) \rightarrow P_n(R)$, which is given by differentiation.

In terms of 1), does the matrix look something like $\begin{bmatrix}a_1+a_2&0&0\\0&a_2+a_3&0\\0&0&a_3+a_4\end{bmatrix}$? The answer says that $\{(1,-1,1,-1), e_1, e_2, e_3\}$ is the basis, but why?
For 2), the answer says $\{1, x, ..., x^n\}$ is the basis, but I still cannot write out the matrix.
Answer: Hints:

For your first problem

Do you see how to get each of $1$, $x$, and $x^2$ in the image (using $e_1$, $e_2$, and $e_3$)?
Do you see that this implies that the image is all of $P_2(R)$ so the kernel is one dimensional?
Are you able to solve $a_1 + a_2 = 0, a_2 + a_3 = 0, a_3 + a_4 = 0$?  Do you see that the first given vector solves this system?

For your second problem

Are you able to take the derivative of $x$?  What is it?  Where does this tell you is a $1$ in your matrix?
Are you able to take the derivative of $x^2$?  What is it?  Where does this tell you is a $2$ in your matrix?
Are you able to take the derivative of $x^3$?  What is it?  Where does this tell you is a $3$ in your matrix?
$\vdots$
Answer: for (1), choose the standard basis $\{(1,0,0,0)^\top, (0,1,0,0)^\top, \cdots\}$ in $R^4$ and $\{1, x, x^2\}$ for $P_2(R).$ with respect to these basis $T$ has the matrix representation $\pmatrix{1&1&0&0\\0&1&1&0\\0&0&1&1}.$


Android M, not ask every start for storage permission

Question: My app needs to access the user's storage in near to every activity. How can I access the storage without making the app ask at every app startup for the permission to access it with the new Android M permission model? (Read and write)
Thanks!
Comment: You only need to ask if you do not already hold the permission. What is your specific concern?
Comment: That the user is prompted on every app startup to give memory access to be able to do anything
Answer: If you do not want to prompt the user "on every app startup to give memory access to be able to do anything", then don't do that. Only call requestPermissions() if checkSelfPermission() returns PERMISSION_DENIED.
@Override
public void onCreate(Bundle icicle) {
  if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE)==
    PackageManager.PERMISSION_GRANTED) {
    init();
  }
  else {
    requestPermissions(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE },
      REQUEST_STORAGE);
  }
}

(native API Level 23 methods shown; you may want to use ContextCompat andActivityCompat` for backwards compatibility)
Or, only call requestPermissions() if the user does something positive in the UI that needs WRITE_EXTERNAL_STORAGE (e.g., clicks an action bar item) and you do not already have the permission.


How do i stop my list overlapping my header image?

Question: I have a website I'm building, i'm using Skeleton CSS and everything is responsive and works fine.
i have a menu bar (list) in the correct place, but when I resize, it seems to overlap my header image, does anybody know how I can stop this?
Example here: http://www.cosworth-europe.co.uk/test/indextest.html
Please resize your browser down.
HTML:

<hgroup class="one-third column alpha">

</hgroup>

                Home

                About Us

                News

                Dealers

                Products

                Buy Online

                Contact

CSS:
#top {background-image: url(../images/header-gradient.gif);
 background-repeat: repeat-x;
 max-width:100%;
 height:110px;}

#header {margin-top: -5px; margin-bottom: 30px;}
h1 a { text-indent: -9999px; }
#site-title { padding-top: 10px;}

#main-nav {
    position:absolute;
    right:120px;
    bottom:0px;
}

#main-nav ul, #main-nav li {display: inline; padding: 7px;}
#main-nav a {text-decoration:none; color: black;}

Comment: Could we see what your site looks like, and a comparison of the css you changed versus the css of the original?
Comment: You're setting a static value for the 'right' property of #main-nav. That's not very responsive. As your screen shrinks, it's always going to try to be 120px from the right. You should change that value to be a percentage, or find some way to make it scale with window size.
Comment: Theres a link above Connor ^^
Comment: ahh I see @Eric Guan, I removed the static value and replaced it with 'float:right;' which has solved the issue - but I can't use padding to move it around?
Answer: It's because your nav is absolutely positioned. Depending on what you want to happen to it, I'd probably add some media queries to into the correct place.
I'd probably move the header image left a little and nudge the nav right - that'l only work until a certain size though, after that you'll need a different layout for the nav bar.
Answer: You should use media queries to deal with how elements are positioned depending on the different sizes. You are using position: absolute for the #main-nav which is fixing the navigation bar in place, regardless of the screen size.
Example:
CSS:
#main-nav {
    position: absolute;
    right: 120px; /* Default */
}

@media only screen and (max-width: 700px) {
    body {
        #main-nav {
            position: absolute;
            right: 50px; /* Will apply when the screens width is smaller than 700px */
        }
    }
}


Button dissapears when textview text change

Question: I have a problem with my layout. I have a textview that changes the text when you answer a question. All the question texts and answer texts are on a online database and I have all the texts correctly download.
The problem is that when you answer a question correctly, you have to change the question text and the answer text. Sometimes it does it fine, but sometimes the answer buttons dissapear.
Can anyone help me? I put the code below:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.prodintec.am_motion.QuizActivity">

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <TextView
        android:id="@+id/HeaderTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="20dp"
        android:text="FOUR OPTIONS QUESTION"
        android:layout_alignParentEnd="true"
        android:layout_alignParentStart="true" />

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingTop="20dp"
        android:paddingEnd="10dp"
        android:paddingStart="10dp"
        android:layout_below="@+id/HeaderTextView"
        android:layout_alignParentStart="true">

        <TableRow
            android:padding="2dp"
            android:id="@+id/tableRow2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <Button
                android:id="@+id/answer1"
                android:layout_width="0dip"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:layout_gravity="center"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"
                android:background="@color/primary"
                android:textColor="@color/accent"
                android:textSize="10dp"
                android:text="ANSWER 1" />

            <Button
                android:id="@+id/answer2"
                android:layout_width="0dip"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:layout_gravity="center"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"
                android:background="@color/primary"
                android:textColor="@color/accent"
                android:textSize="10dp"
                android:text="ANSWER 2" />
        </TableRow>

        <TableRow
            android:padding="2dp"
            android:id="@+id/tableRow3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <Button
                android:id="@+id/answer3"
                android:layout_width="0dip"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:layout_gravity="center"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"
                android:background="@color/primary"
                android:textColor="@color/accent"
                android:textSize="10dp"
                android:text="ANSWER 3" />

            <Button
                android:id="@+id/answer4"
                android:layout_width="0dip"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:layout_gravity="center"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_marginBottom="2dp"
                android:background="@color/primary"
                android:textColor="@color/accent"
                android:textSize="10dp"
                android:text="ANSWER 4" />
        </TableRow>

        <TableRow
            android:padding="2dp"
            android:id="@+id/tableRow4"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/HeaderTextView2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="SEE ACRONYM BUTTON FOR MORE INFORMATION" />
        </TableRow>
    </TableLayout>

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:paddingStart="10dp">

        <TableRow
            android:padding="2dp"
            android:id="@+id/tableRow6"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <Button
                android:id="@+id/acronism"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:padding="5dp"
                android:background="@color/primary"
                android:textColor="@color/accent"
                android:textSize="20dp"
                android:text="ACRONYM" />
        </TableRow>
    </TableLayout>

    <TextView
        android:id="@+id/PointsTextView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:padding="5dp"
        android:text="POINTS:  "
        android:textAlignment="textEnd" />
</RelativeLayout>

</android.support.constraint.ConstraintLayout>

I put two images, the first is showing all correctly:

The second not:

I think it's importante say that this problem only happens since I change the layout, at the first time I have the textview into the tablelayout, but it makes size problems cutting the text near the screen limit. With this new layout I solve the issue, but I have now this other problem.
Comment: just user linear layout insted of relative layout]
Comment: I use a linearlayout now and it goes all to the right border of the screen :/
Comment: can you paste image of of layout that you want to create so i will send you code for that design
Comment: @NileshRathod I want the design I have on my question, but without loosing the buttons when the text change. Can you do it? Thanks!
Comment: first imag3...?
Comment: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/147604/discussion-between-nilesh-rathod-and-imrik).
Answer: try this my friend
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ScrollView
    android:layout_width="match_parent"
    android:fillViewport="true"
    android:layout_height="match_parent">
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <TextView
        android:id="@+id/HeaderTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentStart="true"
        android:text="FOUR OPTIONS QUESTIOgfgfdgdfgdfhghdfghdfjghjdfhgjdfhgjkhdfjghjdfjhgjdhfgjfhddgjhdfjghdjfghjdfhgjfdhgjhdfjghfdjghfdjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjheuireuiwN"
        android:textSize="20dp" />

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentStart="true"
        android:layout_below="@+id/HeaderTextView"
        android:paddingEnd="10dp"
        android:paddingStart="10dp"
        android:paddingTop="20dp">

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="2dp">

            <Button
                android:id="@+id/answer1"
                android:layout_width="0dip"
                android:layout_height="fill_parent"
                android:layout_gravity="center"
                android:layout_marginBottom="2dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_weight="1"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="ANSWER 1"
                android:textSize="10dp" />

            <Button
                android:id="@+id/answer2"
                android:layout_width="0dip"
                android:layout_height="fill_parent"
                android:layout_gravity="center"
                android:layout_marginBottom="2dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_weight="1"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="ANSWER 2"
                android:textSize="10dp" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="2dp">

            <Button
                android:id="@+id/answer3"
                android:layout_width="0dip"
                android:layout_height="fill_parent"
                android:layout_gravity="center"
                android:layout_marginBottom="2dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_weight="1"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="ANSWER 3"
                android:textSize="10dp" />

            <Button
                android:id="@+id/answer4"
                android:layout_width="0dip"
                android:layout_height="fill_parent"
                android:layout_gravity="center"
                android:layout_marginBottom="2dp"
                android:layout_marginLeft="2dp"
                android:layout_marginRight="2dp"
                android:layout_weight="1"
                android:paddingLeft="20dp"
                android:paddingRight="20dp"
                android:text="ANSWER 4"
                android:textSize="10dp" />
        </TableRow>

        <TableRow
            android:id="@+id/tableRow4"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="2dp">

            <TextView
                android:id="@+id/HeaderTextView2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="SEE ACRONYM BUTTON FOR MORE INFORMATION" />
        </TableRow>
    </TableLayout>

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:paddingStart="10dp">

        <TableRow
            android:id="@+id/tableRow6"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="2dp">

            <Button
                android:id="@+id/acronism"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:padding="5dp"

                android:text="ACRONYM"
                android:textSize="20dp" />
        </TableRow>
    </TableLayout>

    <TextView
        android:id="@+id/PointsTextView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:padding="5dp"
        android:text="POINTS:  "
        android:textAlignment="textEnd" />
</RelativeLayout>
</ScrollView>
</LinearLayout>

Comment: I am using this layout with more questions and answers and I have a problem. When the text of the textview or the buttons is longer than 3 lines, it only writes the first three lines but the next one is missed. Can you help me one more time? @Nilesh Rathod


Who wins if an opponent's last ball is pocketed while pocketing the 8-Ball?

Question: During a 8 Ball Pool game when I potted the black ball it hit the opponents last Coloured ball and it went into a pocket. Who wins the frame?
Comment: Please specify exactly which set of rules you are playing under; without that it is pretty much impossible for us to give a definitive answer.
Answer: There are multiple official rule books for 8-Ball.  However, I believe that WPA, APA, and VNEA rules all agree on this.
Assuming that the 8-ball pocket was called correctly, and that the 8-Ball was the first ball contacted by the cue ball, and that no other fouls were committed, it doesn't matter that the opponent's ball was struck and pocketed by the 8-ball.  The shooter wins the rack.


Lasso for feature selection in classification models

Question: I want to perform classification of breast cancer cases by using models like SVM or Random Forest. When I was browsing the web I saw that one could use Lasso for feature selection, and then applied these features as input to my ML models. The question that I have is if its useful to use Lasso as a feature selector for classification tasks. I ask this, because for what I know Lasso is used in Regression models.
Could I use Lasso as a feature selector in classification tasks?
Thanks
Comment: @Dave is right that it's possible for things to go wrong in several ways. But the only way to know for sure if it's going to work in your tasks or not is to try it out. The way to use lasso in classification tasks is to use it for a "binomial GLM" or "multinomial GLM" (for two class and multi-class problems, respectively). In R, you could use the package "glmnet", using the setting family = "binomial" or "multinomial".
Answer: THERE IS NO REASON TO EXPECT THIS TO WORK
LASSO selects features for a linear model. There is no reason to expect these to be the key features once you start allowing for nonlinearities and interactions that are not present in that original model. For instance, it might be that $X_3$ is a terrible predictor of the outcome when you just consider a linear combination of predictors as is done in, say, a logistic regression (to which it sounds like you would be applying the LASSO penalty), yet there is a quadratic relationship between $X_3$ and the outcome that the random forest or support vector classifier is able to detect. By flitering out the unselected $X_3$ variable, you deny the random forest and support vector models the opportunity to determine if $X_3$ is important to the way they model. In my example here, a logistic regression cannot make accurate predictions from either feature and would regard both as being unimportant. However, a particular kernel trick in an SVM would handle that X shape just fine.
Indeed, some of the point of using models like random forests and support vector machines is that they discover such behavior without being explicitly told, so there is a sense in which you are denying these models the opportunity to do what they exist to do.
Finally, LASSO, like other feature selection methods, is often unstable in what it selects. Frank Harrell discusses this in a $2020$ keynote address to Why R? (a recording is here) where he recommends bootstrapping the procedure and weeping over how much variability there is in the features that get selected. He has other posts about feature selection instability if you search through his posts on his profile here. One such post is here.