text:
Q: PHP mail não envia o e-mail Venho encontrando um problema em fazer um formulario de contato, pois não estou obtendo sucesso e não sei o motivo de não funcionar.
Segue código aplicado:
HTML
<form name="sentMessage" id="contactForm" method="POST" action="contact_me.php" novalidate>

                <input type="text" class="form-control" placeholder="SEU NOME*" id="name" required data-validation-required-message="Seu nome faltou.">

                <input type="email" class="form-control" placeholder="SEU E-MAIL*" id="email" required data-validation-required-message="Por favor, adicione um email.">

                <input type="tel" class="form-control" placeholder="SEU TELEFONE*" id="phone" required data-validation-required-message="Por favor, adicione um telefone.">

                <textarea class="form-control" placeholder="SUA MENSAGEM*" id="message" required data-validation-required-message="Por favor, adicione uma mensagem."></textarea>

            <button type="submit" class="btn btn-xl anime">ENVIAR MENSAGEM</button>

</form>

PHP
<?php

if (!$_POST['submit'])
{
    $quebra_linha = "\n";
    $emailsender = "email@dominio.com";
    $nomeremetente = $_REQUEST['name'];
    $emaildestinatario = "email@dominio.com";
    $assunto = "[CONTATO] SITE RESPONSAVEL";
    $mensagem = $_REQUEST['message'];
    $email = $_REQUEST['email'];
    $phone = $_REQUEST['phone'];

    $mensagemHTML = ' Olá,
    tenho uma nova mensagem para você diretamente do site!

    Nome: '.$nomeremetente.' Assunto: '.$empresa.' E-mail: '.$email.' Telefone: '.$phone.' Mensagem: '.$mensagem.'';

    $headers = "MIME-Version: 1.1".$quebra_linha;
    $headers = "Content-type: text/html; charset=iso-8859-1".$quebra_linha;
    $headers = "From: ".$emailsender.$quebra_linha;
    $headers = "Reply-To: ".$emailsender.$quebra_linha;

    if (mail($emaildestinatario, $assunto, $mensagemHTML, $headers, "-r". $emailsender)) {
        echo "";
        echo "";
    } else {
        echo "";
    }
}
?>

Aparentemente o action="" não esta redirecionando quando aperto no botão submit. Tentei com o PHPMailer também, porém encontro o mesmo problema.
O index foi salvo como index.php e ja tentei utilizar o PHP_SELF, porém não obtive muito sucesso também.

A: Não existe nenhum input com nome submit em seu HTML. Logo, o if nunca será executado.
Aliás, nenhum de seus inputs tem o atributo "name". A captura de um campo envia via post é feita através do name deste campo. Exemplo
<form method="post>
   <input type="text" name="nome_do_campo"/>
   <input type="submit" value="Enviar"/>
</form>

O PHP iria pegar o campo acima desta forma:
<?php
$campo = $_POST['nome_do_campo'];
?>

<?php
//Se quisermos executar o código só se o POST tiver sido feito:
if(isset($_POST['nome_do_campo']))
{
   $campo = $_POST['nome_do_campo'];
}
?>

A: RESUMO DA ÓPERA:

No PHP tire o sinal de negação (ponto de exclamação) antes do $_POST.

if(isset($_POST['submit']))
{ .....

Modificações no Código HTML:

Dar name para todos os inputs para que o PHP possa obter os dados do formulário HTML

<form name="sentMessage" id="contactForm" method="POST" action="contact_me.php" novalidate>

            <input type="text" class="form-control" placeholder="SEU NOME*" name="name" id="name" required data-validation-required-message="Seu nome faltou.">

            <input type="email" class="form-control" placeholder="SEU E-MAIL*" name="email" id="email" required data-validation-required-message="Por favor, adicione um email.">

            <input type="tel" class="form-control" placeholder="SEU TELEFONE*" name="phone" id="phone" required data-validation-required-message="Por favor, adicione um telefone.">

            <textarea class="form-control" placeholder="SUA MENSAGEM*" name="message" id="message" required data-validation-required-message="Por favor, adicione uma mensagem."></textarea>

        <input type="submit" name="submit" value="vete" class="btn btn-xl anime">

</form>


text:
Q: How to get actual request object in .Net Core API when request object has become NULL? At times, when client sends an incorrect data to a API COntroller method, the request object become NULL when received. The primary cause of request object turning NULL could be client passing NULL value to a Non-Null property etc etc.
I would like to get that actual request object which client had sent so that I can get to know what client has passed and resolve the issue.
I receive my request object as:
HttpPost]
[Route("addQuote")]
public JsonResult AddQuote([FromBody]AddQuoteRequestModel quoteRequestModel)  { //Lines of code  }

Here, at times the quoteRequestModel object is received as NULL. I would like to capture the exact JSON client has passed in to this method.
Is there any way I can capture that?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is /etc/rc.local a good place to run a script before any (normal) user can log in? I have a Ubuntu 14.04 Server which, during boot, should sync some stuff over the network before any normal user can log in (over ssh).
I was wondering whether calling the script from /etc/rc.local is the right place?
Looking at the comment of this script:

This script is executed at the end of each multiuser runlevel.

It looks like it is called after the system is ready to accept logins from users.
This is how I understand the "at the end of each multiuser runlevel".
I have seen the answer here: Purpose and Typical Usage of /etc/rc.local, I still found it a little ambiguous.
UPDATE
A little more context is appropriated: It is an automated process, where user are actually many machines polling the server to log in....

A: Usually /etc/rc.local is the valid option, but it also depends on the amount of work that is involved in "syncing some stuff" and how important it is that users cannot login before this action has completed.
If you want to make sure that the syncing has completed before users login, you can consider one of two "nologin" options.

*

*Write a script that sets the login shell (of a particular group
of users) to /usr/sbin/nologin before syncing and restores it
after syncing.

*Create an empty /etc/nologin file before syncing using touch /etc/nologin and remove it after syncing. Note that this option may easily lock you out if you disabled logging in as root over SSH, since it prevents all non-root accounts from logging in.

A: For the case you describe, calling your sync script from /etc/rc.local is a valid solution. It's the one I would probably go with as well, though there are undoubtedly other solutions that other people would come up with.
It's executed after all the "built-in" rc startup scripts, but before the login prompt is presented at the console. Do keep in mind, though, users will be able to log in to the system via SSH before rc.local is run. If this is a concern, you can put your script in the startup sequence after the network has started but before SSH is started. The reason I would still use rc.local and not worry about moving it's location is that the time between the SSH daemon starting and users realizing the system is available is in all likelihood far longer than it takes the system to get to and execute the rc.local script.

A:
It looks like it is called after the system is ready to accepting
  logins from users. This is how I understand the "at the end of each
  multiuser runlevel".

No, /etc/rc.local get execute when system boot. ( When user login using ssh it will set environment and run scripts from /etc/profile ~/.bashrc, Read this page for more information. )

I was wondering whether calling the script from /etc/rc.local is the
  right place?

Yes, you can

A: I would personally go with @John's solution, but you can also set the startup sequence so that at the very beginning (near the S01 symlinks) it runs this command:
echo "Please try to log in later" > /etc/nologin

And then put in /etc/rc.local:
/root/yourscript.sh
rm -f /etc/nologin

The presence of the /etc/nologin file prevents non-root users to log in, either from SSH or from console.  This will guarantee that users do not log in before your script has finished.


text:
Q: Howto count in Excel based on string beginning Assume the following Excel worksheet:
  A                                B            C
1 Item                         In progress  Completed
2 FOO|01|442532342|fdsfdsfsd4     15            5
3 BAR|05|534527777|gfdsfdsfsd     10            5
4 BAR|9633|fdfssdfdsfdsf|5444     20           10
5 BAR|4543|fgfddsfds|34324325      5            0
6 FOO|efdfs|fdsfs|42321321323      5            5
7 BAZ|eree|34533432432|gfffdd     30           20
8 FOOBAR|fdfsdfs|432432|gdfgf     35            5
9 FOOBAR|sdfs534324324|43|223      0            0

(1) I would like to scan the A column and identify unique Items based on the text before the first pipe (|). In this case this would be:
FOO
BAR
BAZ
FOOBAR

This lookup should be dynamic, so if a tenth Item would be BARBAZ|sdadadsd|34343324322, then the return should be:
FOO
BAR
BAZ
FOOBAR
BARBAZ

(2) I need to tally the B and C columns for each Item type. So the total output for the original example would be (calculations within brackets for clarity)
FOO     20 (15+5)      10 (5+5)
BAR     35 (10+20+5)   15 (5+10+0)
BAZ     30 (30)        20 (20)
FOOBAR  35 (35+0)       5 (5+0)

The B and C colums are hardcoded sort to speak: there will not be a D column with additional values and if there will be, I can update te formula manually. The thing is I'm having a hard time getting started with this. Can it be done with a formula or is there a need for VBA?
After @KazJaws comment, I decided to try and write VBA. I now have this but I need expanding. Any help would be greatly appreciated:
Sub CreateStats()
    Dim itemSplit
    Dim item
    itemSplit = Split(Columns(0).Value, "|")
    item = itemSplit(1)
End Sub

It generates an error, though: "Can't Execute Code in Break Mode"

A: Use text to columns to split column A by the "|" then use an extract distinct list from a list formula that can be found here.
Then use a SUMIFS() formula where it's sum range is the In Progress column, it's criteria range is the Item Column, and the criteria is the first item in the distinct list you created.
Then just add another column for the Completed values.
Cell H3 =INDEX($B$3:$B$10,MATCH(0,INDEX(COUNTIF($H$2:H2,$B$3:$B$10),0,0),0))`
Cell I3 =SUMIFS($F$3:$F$10,$B$3:$B$10,H3)
Cell J3 =SUMIFS($G$3:$G$10,$B$3:$B$10,H3)

Should look like this,


text:
Q: Do....While loop in c++ int f = 1;
    do

    {
        f++;
        int c, d;
        if ( yesNo == 'y' || yesNo == 'Y')
        {
            cout << "Player 1 how many numbers are on your card" << endl;
            cin >> c;
            mf_bingo(c);
        }

        else if ( yesNo == 'n' || yesNo == 'N')
        {
            cout << "Sorry player 1" << endl;
        }
        cout << "Player 2 do you see this number on your card." << endl;
        cin >> yesNo;
        if (yesNo == 'y' || yesNo == 'Y')
        {
            cout << "Player 2 how many numbers are on your card" << endl;
            cin >> c;
            mf_bingo(c);
        }

        else if (yesNo == 'n' || yesNo == 'N')
        {
            cout << "Sorry player 2" << endl;
        }
        cout << "Press 1 to continue generating random numbers." << endl;
        cin >> d;
        mf_numbers(d);
    } while (c < 5);

I need help getting this do... while loop running.  It skips past player one and works one time before I get an error box that says abort, retry close.  I am currently using microsft visual studio.
here is the whole program itself.  Linux users might have trouble getting the random number generator to work.
using namespace std;
void mf_printcard1(int);
void mf_printcard2(int);
int mf_bingo(int);
void mf_numbers(int);

int main()
{
    cout << "   _________________________________________\n"
        "  |         B |  I |  N  |  G  |  O |       |\n"
        "  |     ------|----|-----|-----|----|----   |\n"
        "  |     ------|----|-----|-----|----|----   |\n"
        "  |     ------|----|-----|-----|----|----   |\n"
        "  |     ------|----|-----|-----|----|----   |\n"
        "  |     ------|----|-----|-----|----|----   |\n"
        "   _________________________________________\n" << endl;
    int a, b, c, d;
    char yesNo;
    cout << "\n\n\n\tCard choices" << endl;
    cout << "Bingo Card 1: 12, 5, 32, 18, 50, 46, 2, 29, 1, 30" << endl;
    cout << "Bingo Card 2: 43, 1, 6, 34, 8, 19, 23, 42, 41, 5" << endl;
    cout << "Bingo Card 3: 12, 5, 22, 45, 50, 13, 3, 8, 35, 18" << endl;
    cout << "Bingo Card 4: 34, 50, 1, 6, 21, 39, 8, 49, 9, 19" << endl;
    cout << "Bingo Card 5: 30, 14, 7, 28, 43, 34, 37, 48, 49, 18" << endl;
    cout << "Bingo Card 6: 12, 9, 10, 41, 50, 37, 11, 29, 2, 7, 47" << endl;
    cout << "Bingo Card 7: 15, 6, 35, 27, 8, 11, 32, 9, 39, 23" << endl;
    cout << "Bingo Card 8: 48, 21, 3, 9, 2, 32, 50, 31, 13, 38" << endl;
    cout << "Bingo Card 9: 20, 49, 28, 10, 8, 7, 14, 46, 19, 34" << endl;
    cout << "Bingo Card 10: 18, 26, 43, 5, 27, 45, 38, 50, 2, 29" << endl;

    cout << "Player 1 pick a card that you want." << endl;
    cout << "Be sure to write down your numbers." << endl;
    cin >> a;
    mf_printcard1(a);
    cout << "\n\n";
    cout << "Now player 2, you pick a card that you want.  It can not be the same as player 1" << endl;
    cout << "Be sure to write down your numbers." << endl;
    cin >> b;
    cout << "\n\n";
    mf_printcard2(b);
    cout << "\nHere is your first number: 10" << endl;
    cout << "Player 1 is this number on your bingo card?" << endl;
    cout << "Press y for yes and n for no" << endl;
    cin >> yesNo;
    if (yesNo == 'y' || yesNo == 'Y')
    {
        cout << "Player 1 how many numbers are on your card" << endl;
        cin >> c;
        mf_bingo(c);
    }

    if (yesNo == 'n' || yesNo == 'N')
    {
        cout << "Sorry player 1" << endl;
    }

    cout << "Player 2 is this number on your bingo card?" << endl;
    cout << "Press y for yes and n for no" << endl;
    cin >> yesNo;
    if (yesNo == 'y' || yesNo == 'Y')
    {
        cout << "Player 2 how many numbers are on your card" << endl;
        cin >> c;
        mf_bingo(c);
    }

    else if (yesNo == 'n' || yesNo == 'N')
    {
        cout << "Sorry player 2" << endl;

    }
    cout << "Press 1 to continue generating random numbers." << endl;
    cin >> d;
    mf_numbers(d);
    int f = 1;
    do

    {
        f++;
        int c, d;
        if ( yesNo == 'y' || yesNo == 'Y')
        {
            cout << "Player 1 how many numbers are on your card" << endl;
            cin >> c;
            mf_bingo(c);
        }

        else if ( yesNo == 'n' || yesNo == 'N')
        {
            cout << "Sorry player 1" << endl;
        }
        cout << "Player 2 do you see this number on your card." << endl;
        cin >> yesNo;
        if (yesNo == 'y' || yesNo == 'Y')
        {
            cout << "Player 2 how many numbers are on your card" << endl;
            cin >> c;
            mf_bingo(c);
        }

        else if (yesNo == 'n' || yesNo == 'N')
        {
            cout << "Sorry player 2" << endl;
        }
        cout << "Press 1 to continue generating random numbers." << endl;
        cin >> d;
        mf_numbers(d);
    } while (f < 5);
    cout << "Game over" << endl;
    return 0;
}
void mf_printcard1(int a)
{
    cout << "\n";
    cout << "Player 1 here is your card" << endl;
    cout << "\n";
    if (a == 1)
    {
        cout << "Your Bingo numbers are: 12, 5, 32, 18, 50, 46, 2, 29, 1, 30" << endl;
    }
    else if (a == 2)
    {
        cout << "Your bingo numbers are: 43, 1, 6, 34, 8, 19, 23, 42, 41, 5" << endl;
    }
    else if (a == 3)
    {
        cout << "Your bingo numbers are: 12, 5, 22, 45, 50, 13, 3, 8, 35, 18" << endl;
    }
    else if (a == 4)
    {
        cout << "Your bingo numbers are: 34, 50, 1, 6, 21, 39, 8, 49, 9, 19" << endl;
    }
    else if (a == 5)
    {
        cout << "Your bingo numbers are: 30, 14, 7, 28, 43, 34, 37, 48, 49, 18" << endl;
    }
    else if (a == 6)
    {
        cout << "Your bingo numbers are: 12, 9, 10, 41, 50, 37, 11, 29, 2, 7, 47" << endl;
    }
    else if (a == 7)
    {
        cout << "Your bingo numbers are: 15, 6, 35, 27, 8, 11, 32, 9, 39, 23" << endl;
    }
    else if (a == 8)
    {
        cout << "Your bingo numbers are: 48, 21, 3, 9, 2, 32, 50, 31, 13, 38" << endl;
    }
    else if (a == 9)
    {
        cout << "Your bingo numbers are: 20, 49, 28, 10, 8, 7, 14, 46, 19, 34" << endl;
    }
    else if (a == 10)
    {
        cout << "Your bingo numbers are: 18, 26, 43, 5, 27, 45, 38, 50, 2, 29" << endl;
    }

    else
    {
        cout << "Not a valid option" << endl;
    }
}
void mf_printcard2(int b)
{
    cout << "\n";
    cout << "Player 2 here is your card" << endl;
    cout << "\n";
    if (b == 1)
    {
        cout << "Your Bingo numbers are: 12, 5, 32, 18, 50, 46, 2, 29, 1, 30" << endl;
    }
    else if (b == 2)
    {
        cout << "Your bingo numbers are: 43, 1, 6, 34, 8, 19, 23, 42, 41, 5" << endl;
    }
    else if (b == 3)
    {
        cout << "Your bingo numbers are: 12, 5, 22, 45, 50, 13, 3, 8, 35, 18" << endl;
    }
    else if (b == 4)
    {
        cout << "Your bingo numbers are: 34, 50, 1, 6, 21, 39, 8, 49, 9, 19" << endl;
    }
    else if (b == 5)
    {
        cout << "Your bingo numbers are: 30, 14, 7, 28, 43, 34, 37, 48, 49, 18" << endl;
    }
    else if (b == 6)
    {
        cout << "Your bingo numbers are: 12, 9, 10, 41, 50, 37, 11, 29, 2, 7, 47" << endl;
    }
    else if (b == 7)
    {
        cout << "Your bingo numbers are: 15, 6, 35, 27, 8, 11, 32, 9, 39, 23" << endl;
    }
    else if (b == 8)
    {
        cout << "Your bingo numbers are: 48, 21, 3, 9, 2, 32, 50, 31, 13, 38" << endl;
    }
    else if (b == 9)
    {
        cout << "Your bingo numbers are: 20, 49, 28, 10, 8, 7, 14, 46, 19, 34" << endl;
    }
    else if (b == 10)
    {
        cout << "Your bingo numbers are: 18, 26, 43, 5, 27, 45, 38, 50, 2, 29" << endl;
    }

    else
    {
        cout << "Not a valid option" << endl;
    }
}
int mf_bingo(int c)
{
    if (c == 0)
        cout << "You need to match get 5 more matching numbers to win." << endl;
    else if (c == 1)
    {
        cout << "You only need 4 more matching numbers to win" << endl;
    }
    else if (c == 2)
    {
        cout << "You only need 3 more numbers to win" << endl;
    }
    else if (c == 3)
    {
        cout << "You only need 2 more numbers to win" << endl;
    }
    else if (c == 4)
    {
        cout << "You only need 1 more number to win" << endl;
    }
    else if (c == 5)
    {
        cout << "You win!!!" << endl;
    }
    return true;
}
void mf_numbers(int d)
{
    int xRan;
    srand(time(0));
    xRan = rand() % 50 + 1;
    cout << xRan << endl;

}

A: Its because your condition for the loop is (c < 5) when c is not defined until the loop body. You either need to change while (c < 5) to while (f < 5) or define c outside of the loop body.


text:
Q: TCP: switch to redundant machine, RST not sent immediately consider the following scenario:
2 machines available - A and B (both running on Linux)
A is active.
B is not active.
host x is using TCP to talk with machine A.
everything works fine.
switchover happends - now machine B is active (uses same IP as machine A was using)
machine A is not active.
now host x communicates with machine B but he does not know that fact.
it did not open a tcp connection on machine B so I would expect to receive RST from machine B.
this is not the case - I noticed in the debug capture log that host x retransmits 10 times and only then machine B sends RST.
Can someone explain what happended and why machine B did not send RST on the first request?
10x


text:
Q: Is there a free python debugger that has watchpoints? pdb and winpdb both seem to be missing this essential (to me) feature.  I saw something suggesting WingIDE has it but I'd prefer a solution that is free, and if I do have to pay, I'd prefer to pay for something that is better than Wing.

A: You should check out Eric4
It's a very good Python IDE with a builtin debugger.
The debugger has views for global variables, local variables and watchpoints.

A: Please look what pydev in eclipse offers...

A: Take a look at PyScripter. It has an integrated debugger, watch windows and much more.
It's open source and is developed here.
HTH

A: It's too bad that the standard pdb module that comes with python itself does not yet support watchpoints.
Described here: http://wiki.python.org/moin/PdbImprovments

A: This reimplementation of the built-in pdb.py has watchpoints.
http://morepypy.blogspot.com/2008/06/pdb-and-rlcompleterng.html
I tried it but, in cursory tries was not able to get it to work.


text:
Q: Best practice transferring list data from controller to the another controller I want to display view once the list of content is retrieved from the database display it in the view.
On a high level what I am doing now works more or less but upon first access the previous results appears to be cached or still saved in my storage service.
This is what the service looks like.
function StorageService() {

    var opportunities;

    var getOpportunities = function() {
        return opportunities;
    }
    var setOpportunities = function(data) {
        opportunities = data;
    }
    return {
        getOpportunities: getOpportunities,
        setOpportunities: setOpportunities
    }
}

So when I click on the tab to getOpportunities I go direct to the view first and the load the data.
$scope.getAllOpportunities = function() {
$state.go("app.opportunities");
communicationService.getOpportunitiesAll().then(function(data) {
    StorageService.setOpportunities(data);
    if (!data.length) {
        $("#noShow").html("There are no opportunities");
    }
}, function(error) {})

}
once the view is rendered I retrieve the results and bind it to the view.
controller('OpportunitiesController', function($scope) {

$scope.$on("$ionicView.afterEnter", function(scopes, states) {
    $scope.opportunities = StorageService.getOpportunities();
});

What I am doing here also feels a bit wrong.
Is there a better way or a way that I can improve on the existing.
I want to load the view and the replace the loader with the data once the data is ready.
Thanks in advance

A: You should resolve the promise in the route, using the resolve property. That way, the data will always be available when the controller is instantiated.
https://toddmotto.com/resolve-promises-in-angular-routes/
Unless the resource is huge and you want to show som loading animation while getting the data. Then it would probably be more proper to just get the data in the controller.
controller('OpportunitiesController', function($scope) {

    communicationService.getOpportunitiesAll().then(function(response){
        $scope.opportunities = response;
    })

});

html:
Getting stuff
Stuff fetched

Also, there is no use to have getter and setters in the service. Javascript objects are passed by reference so you can just expose the property directly.


text:
Q: OS X compressed files on a Windows machine I sent myself a compressed folder from my OS X machine to my Windows machine. When I opened it I of course got the __MACOSX folder, but the contents were in an extension-less file of about the right number of bits.
How can I look at this on a Windows box?

A: That folder is a mac generated folder, you ignore that on Windows, the actual files that you placed in the archive will be in the same location.
So you would have:
_MACOSX
file1
file2

You may not have compressed the files correctly, go back and try again.


text:
Q: Why does mysql shell not load any data when I use util.load_dump()? I am using MySQL shell utilities 8.0.23 for both dump and load and the process goes as follows:
On one host:
I use util.dump_Instance() to create a dump of a mysql 8.0.23 instance with multiple schemas.
On another host:
I download partial files from the dump - all the files relevant to a specific schema and the metadata files (@.;${SCHEMA}@)
when I use the load_dump instance it seems the data is not loaded.
here is my code:
util.load_dump(RESTORE_PATH, {'threads': THREADS, 'showProgress': True, 'includeSchemas': [INCLUDE_SCHEMA], 'excludeTables': [EXCLUDE_TABLES], 'loadData': True, 'loadDdl': True })

and the result I am getting when running this process using CI is as follows:
Opening dump...
15:05:40  Target is MySQL 8.0.23. Dump was produced from MySQL 8.0.23
15:05:40  Scanning metadata \ 0 / ~0
Scanning metadata - done
15:05:40  Checking for pre-existing objects...
15:05:40  Executing common preamble SQL
15:05:40  Executing DDL \ 0 / ~0
Executing DDL - done
15:05:40  Executing view DDL \ 0 / ~0
Executing view DDL - done
15:05:40  Starting data load
15:05:40
15:05:40  Recreating indexes \ 0 / 0
Recreating indexes - done
15:05:40  Executing common postamble SQL
15:05:40  No data loaded.
15:05:40  0 warnings were reported during the load.

What am I missing? why is my data not loaded? what can I do to fix this so my data will be loaded properly?

A: I found the issue - no data was loaded because when loading partial data from dump_instance the list of files that need to be copied are as follows:

*

*@.* - dump metadata files

*SCHEMA@* - schema data files

*SCHEMA.* - schema metadata fils (these are the files that were missing and caused no data to load)


text:
Q: Redirecting an already redirected page RewriteRule ^teamstore/(.*)/$ /teamproduct.php?teamproduct=$1&products=true [NC,L]
RewriteRule ^teamstore-(.*)/$ /teamproduct.php?teamproduct=$1&products=true [NC,L]

Here's the situation.  We've already had theese urls rewritten, but we want to change the formatting of these pages so they're separated by hyphen instead of a slash.
I tried redirectmatch but this added additional php value parameters to the end of the urls.  It came out to be
RedirectMatch 301 /teamstore/(.*) http://www.domainname.com/teamstore-$1/

Here was the result...
teamstore-valuehere//?teamproduct=2352323&productes=true

I want someone who types in the original address teamstore/info/ to get directed to teamstore-info/ - Any ideas on how to accomplish this?
The main reason is to avoid duplicate content issues with existing links in Google Search Results.

A: Order of the rules can matter, but if you want to 301 redirect the initial request for SEO reasons, then I would change your RewiteRules to the following.
RewriteRule ^teamstore/(.*)/$ teamstore-$1/ [R=301,L]
RewriteRule ^teamstore-(.*)/$ /teamproduct.php?teamproduct=$1&products=true [NC,L]

This will first translate teamstore/info/ to teamstore-info/ and send the appropriate 301 response. Upon second pass it will redirect to the php you want.
Note, this is not ideal as far as performance. Yet, it does accomplish the goal of making Google happy.


text:
Q: Loading an angular component using a short key I have a requirement to use a short key to load an angular component.
The short key i want to use for this purpose is "."
If period is pressed when the angular component is loaded, then on click of the "." character i want to load the angular component.
However, I want to make sure that the angular component is not fired when I am on a form field entering any value.
In short the keypress should only be fired when not active on any specific form field. What condition should i check to ensure that while the key is pressed the user is not active on any of the form fields of that component.
Following is the code that I have to listen to the keydown event and identifies the key that was pressed.
@HostListener('document:keydown', ['$event'])
handleKeyboardEvent(event: KeyboardEvent) {
alert('Key pressed was :::: ' + (event.key === "."))
alert('Key was pressed');
}

A: I guess you could check that the user is pressing period when the target is body, so you can try the following:
@HostListener('document:keydown', ['$event'])
handleKeyboardEvent(event: KeyboardEvent) {
  if (event.key === "." && ((event.target as HTMLElement).tagName === "BODY")) {
    alert('period pressed outside fields!')
  }
}

DEMO: StackBlitz

A: You can try something like this:
@HostListener('document:keydown', ['$event'])
handleKeyboardEvent(event: KeyboardEvent) {
  if(event.target.tagName === 'INPUT') {
    console.log('input clicked');
    return;
  }

  console.log('Key pressed was :::: ' + (event.key === "."))
  console.log('Key was pressed');
}


text:
Q: Can a PHP extension be used to make calls to a C++ DLL? I have C++ library that I would like to use to create a PHP extension.
I don't have anything besides the compiled DLL file.
I would just like to know if this is possible or does it need to be a C library?

A: Yes, You can build extension using C++ libraries.
There is a very good example describing the process here : http://devzone.zend.com/1435/wrapping-c-classes-in-a-php-extension/


text:
Q: AngularJS email confirmation match not working? here's the HTML

 $scope.updateUser = {};
 $scope.updateUser.details = {};
 $scope.updateUser.email = '';
 $scope.updateUser.confirm = '';
 $scope.updateUser.details.open = $stateParams.openSetting === 0;
 $scope.userName = userProfile.data.firstname + ' ' + userProfile.data.surname;

 $scope.userCurrentEmail = userProfile.data.email;
 $scope.userContactNumber = userProfile.data.phone;
 $scope.editorEnabled = false;

 $scope.enableEditor = function() {
   $scope.editorEnabled = true;
   //$scope.email = $scope.userCurrentEmail;
   $scope.phone = $scope.userContactNumber;
 };

 $scope.disableEditor = function() {
   $scope.editorEnabled = false;
 };

 $scope.submit = function() {
   $scope.userCurrentEmail = $scope.email;
   $scope.userContactNumber = $scope.phone;
   $scope.disableEditor();

 };

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>

<form class="updateUserDetailsForm" name="updateUser" ng-submit="updateUser.$valid && submit()" novalidate>
  Edit details

    Account name

{{userName}}

    Your current email

{{userCurrentEmail}}

    Your phone number

{{userContactNumber}}

      Your new email (Required)

      <input type="email" name="email" class="form-control" placeholder="Please enter your email address" ng-model="email" ng-show="editorEnabled" required>
      Please enter your new email address
      Please enter a valid email

      Confirm your new email (Required)

      <input type="email" name="confirm" class="form-control" placeholder="Please enter your email address" ng-model="confirm" match="email" ng-show="editorEnabled" required>
      Please enter your new email address
      Please enter a valid email
      Email does not match

      Phone number
      <input type="tel" class="form-control" placeholder="Please enter your 10 digit phone number" ng-minlength="10" ng-maxlength="10" name="phone" ng-model="phone" ng-show="editorEnabled">
      Please enter 10 digits phone number

    Update
    Cancel

</form>

Rest of the code is fine but I am struggling with matching email fields and also how to change the value of the "userCurrentEmail" and "userContactNumber" on submit or save? Guys could you please help me?


text:
Q: proc_open is disabled. But not in php.ini Hello i am trying to use php's proc_open() function on my personal Windows server, but i am getting error like, php warning : proc_open is disabled  for security reasons.
But in php.ini i have commented disable_functions and removed anything like blocking these functions. Still getting these errors.
What could be wrong?
I am using ZPanel and Windows 2008.

A: The problem lied in Zpanel's httpd-vhosts.conf file, actually i have a Windows 2008 Server with ZPanel and suhosin installed, so in httpd-vhosts.conf file there was php suhosin.func.blackblist = proc_open,
so i commented this line, and restarted APACHE from services, Now its working flawlessly fine.
Thanks everyone for taking time to read and answer!


text:
Q: Как передать структуру sockaddr_in в функцию? с++ sockaddr_in address[4],from,fromCommand;
 for (int i = 0; i < 5; i++)
 {
address[i].sin_family = AF_INET;
address[i].sin_addr.s_addr = INADDR_ANY;
address[i].sin_port = htons(12340+i);

функция:
void priempackets(struct sock sockets[],int maximum_packet_size,
struct sockaddr_in from,address[],
int line,schetline, struct WAVHEADER wavhead)

ругается на 2рую строчку (struct sockaddr_in from,address[],)и ошибка [BCC32 Error] Unit1.cpp(27): E2303 Type name expected
вот что передаю:
_beginthread( priempackets, 0, sockets,maximum_packet_size,from,address,
line,schetline,wavhead);

A: Нельзя задавать список параметров, не указывая тип каждого из параметров в списке. У вас в объявлении функции написано
void priempackets(struct sock sockets[],int maximum_packet_size,
struct sockaddr_in from,address[],
                   ^^^^^^^^^^^^^^
int line,schetline, struct WAVHEADER wavhead)

То есть следуют друг за другом два идентификатора без указания типа у каждого отдельного идентификатора.


text:
Q: Using Google's libphonenumber library for validation international mobile number without region I'm trying to validate an international mobile number.
For example: "+972523254545".
Afaik, this number should be valid everywhere.
But this library requires "region" too. why is that and how can I overcome it?

A: region should not be a required field.  It is not used for phone numbers with a leading '+'.  Without specifying a region I can parse that number in the python version:
>>> import phonenumbers

>>> phonenumbers.parse('+972523254545')
PhoneNumber(country_code=972, national_number=523254545, extension=None, italian_leading_zero=None, number_of_leading_zeros=None, country_code_source=None, preferred_domestic_carrier_code=None)

And that number parses fine without specifying a region on their demo page.

If you really must speficy a region, then just stick any region in there.  It's going to be ignored because the leading "+" in the number indicates that it's lead by an international calling code.


text:
Q: Calling a C# windows service function through javascript I am working on a windows service that acts as a medium between a web application and a standalone client side program. In a nutshell: Before submitting a form on my web application, I want it to be encrypted by my client side standalone program. The medium of communication has to be the windows service.

My question is: How do I call a C# function in my service through JS? (This function will help me relay data back and forth between the website and the standalone application)

I was successfully using an applet to act as the medium before but I have shunned that idea as many security issues are being plotted off late.

A: Does it have to be a Windows service?
You could write a WCF service that you host inside a Windows service. There's an article on MSDN about how to do that (http://msdn.microsoft.com/en-us/library/ms733069(v=vs.110).aspx) and there are many more on the Web.
You cannot call a function defined in a Windows service directly, you have to expose it to the outside world using some kind of endpoint, like the way WCF does.

A: You can self host a REST based service in a Windows Service. For example using the NancyFx framework http://nancyfx.org/. You can then make an ajax call using localhost as the endpoint, this would mean that the service MUST be installed and running on any clients which access it.
Also just a query, why are you doing your own encryption client side? You can encrypt the communications to the server using SSL and then do whatever encryption you require server side. Is this some design that is being imposed on you?


text:
Q: Find inner layer in matrix I have problem in inner Loop. The output should be M*N matrix by rotating the matrix by K elements.
For example, if the given M and N are 4 and 4 respectively. If the matrix elements are
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16

If the given K is 3. Rotate each ring of the matrix by 3 elements.
In the above matrix, the elements (1, 2, 3, 4, 8, 12, 16, 15, 14, 13, 9, 5) is a ring, similarly, the elements (6, 7, 11, 10) will make a ring.
Therefore, by rotating each ring in clockwise direction by 3 elements will give (13, 9, 5, 1, 2, 3, 4, 8, 12, 16, 15, 14) and (10, 6, 7, 11). So the output should be
13 9 5 1
14 7 11 2
15 6 10 3
16 12 8 4

my Approach:
def matrixRotation(matrix,r):
    m, n = len(matrix), len(matrix[0])
    b = [[None]*n for _ in range(m)]
    indices = []

    for c in range(min(m,n)//2):
        index = []
        for i in range(c,n-c): index.append((c,i))
        for i in range(c+1,m-1-c): index.append((i,n-1-c))
        for i in range(c,n-c)[::-1]: index.append((m-1-c,i))
        for i in range(1+c,m-1-c)[::-1]: index.append((i,c))
        if not index:
            break
        indices.append(index)

    rotated = []
    for index in indices:
        k = r%len(index)
        rotated.append(index[-k:]+index[:-k])

    for (x,y) in zip(indices,rotated):
        for ((c,d),(e,f)) in zip(x,y):
            b[c][d] = matrix[e][f]

    return b

m,n = map(int,input().split())
matrix = [input().split() for i in range(m)]
r = int(input())
for i in matrixRotation(matrix,r):
    print(*i)

for input:
3 4
1 2 3 4
10 11 12 5
9 8 7 6
2

output should be:
9 10 1 2
8 11 12 3
7 6 5 4

my output:
9 10 1 2
8 None None 3
7 6 5 4


text:
Q: Sources to find similar spelling words? When I learn some new words, I think I have seen them before, and then realize that they are probably some close-spelling words, but I can't think of them now. Are there sources where I can look up for similar spelling words for a given word? For example, "grotesque".
Thanks!

A: More accurately (and I had to look this up) the OP is actually asking about "heterographs": words that sound alike but have different spellings and meanings.  Homophones may be either heterographs or heteronyms (words that have the same spelling and different meanings, and may or may not have the same pronunciation, e. g. desert/desert). Examples that native speakers frequently get wrong are principle and principal, affect and effect, discrete and discreet, and even too and to and its and it's.  For a long list of these, see http://www.spellingsociety.org/journals/j4/heterografs2.php .  (Personally, I don't think that a dictionary will help much in identifying these; there are too many words that are not such to make the search easy.)

A: Closely spelled words could be deemed as being "homophones." A homophone is a word which sounds similar to another word, but which may have a different meaning. Any dictionary is a good source for those.
"Grotesque" would be difficult as it is a word of French origin and would have no "similar" words to it in the English language.
Reference:http://www.oxforddictionaries.com/us/


text:
Q: C++: How to work with data type of parameter in member function template I've to do activities in my template based on type of class I get as parameter:
In Class.h
class SomeClass;
class SomeOtherClass;

class Class
{
public:
    template <typename T> void function(T value);
};

In Class.cpp
template<typename T> void Class::function(T value)
{
    // Whole lots of common code here

    if (T == SomeClass)
    {
       // Do something by casting value to SomeClass
       SomeClass* ptrSomeClassObj = (SomeClass*) &value;
       ptrSomeClassObj->MemberFunctionOfSomeClass();
    }
    else
    {
       // Do something else
    }

    // Whole lots of common code here
}

Now I've these questions:

*

*Here if (T == SomeClass) is not correct syntax. How shall I do this?

*Type casting of T the way I've done doesn't give me any syntax error. But is this appropriate to do like this? I believe C++ has better ways.
Update:
Not really looking for Template specialization because it would replicate lots of common code (as mentioned in code above) in specialized functions.

A: You'll want to move the code depending on the actual type of T to a second member (or static) function wich you can then overload, passing any values resulting from the common code as parameters (someParam):
class SomeClass;
class SomeOtherClass;

class Class
{
public:
    void typeDependent(SomeClass value, int someParam);
    template <typename T> void typeDependent(T value, int someParam);

    template <typename T> void function(T value);
};

void Class::typeDependent(SomeClass value, int someParam)
{
    value->MemberFunctionOfSomeClass(someParam);
}

template<typename T> void Class::typeDependent(T value, int someParam)
{
    // Do something else
}

template<typename T> void Class::function(T value)
{
    int someParam = 123; // Whole lots of common code here
    typeDependent(value, someParam);
    // Whole lots of common code here
}

This allows you to call functions that only exist for the SomeClass type without casting. Note that I didn't use template specialization but overloading - Using specialization for function templates is generally a bad idea due to their complicated resolution rules.
If you insist on writing this distiction as a conditional, you can use the std::is_same template (Requires C++11):
#include <type_traits>

template<typename T> void Class::function(T value)
{
    if (std::is_same<T, SomeClass>::value)
    {
         // Do something
    }
    else
    {
        // Do something else
    }
}

This will require you to use a cast like you did in the original post as the function will not compile for T != SomeClass otherwise.

A: I'm pretty sure the most straightforward way to do this is overloading and delegating the work:
class SomeClass;
class SomeOtherClass;

class Class
{
public:
    template <typename T> void function(T value);

    template <typename T> void function_detail(T value);
    void function_detail(SomeClass value);
};

template<typename T> void Class::function(T value)
{
    // Whole lots of common code here

    function_detail(value);

    // Whole lots of common code here
}

template<typename T> void Class::function_detail(T value)
{
    // Do something else.
}

void Class::function_detail(SomeClass value)
{
    value.MemberFunctionOfSomeClass();
}


text:
Q: Upper bound for prime counting function $\pi(x)$ Let $\pi(x)$ denote the number of primes less than or equal to $x$. I want to prove
$$ \pi(x) \leq \frac{9x\log 2}{\log x} $$
for every integer $x\geq 2$. In the problem (from Murty's $\textit{Algebraic Number Theory}$), I have been given the following hint
$$ \prod_{n<p\leq 2n} p \mid {2n\choose n}  $$
but I can't seem to apply it in a usefull way.
I would prefer a subtle hint for the solution, but any help is appreciated.


text:
Q: I'm trying to call a javascript function from the onClick event but as far as I know the function isn't being called.

<?php
include_once("pass.php");
include("common.php");

class ComA
{
    static function reportComment()
    {
        $query = mysql_query("SELECT * FROM comments WHERE Flag =1");
        $number=mysql_num_rows($query);
        // number of rows to show per page
        $rowsperpage = 15;
        // find out total pages
        $totalpages = ceil($number / $rowsperpage);
        // get the current page or set a default
        if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage']))
        {
           // cast var as int
           $currentpage = (int) $_GET['currentpage'];
        }
        else
        {
           // default page num
           $currentpage = 1;
        }
        //if current page is greater than total pages...
        if ($currentpage > $totalpages)
        {
           // set current page to last page
           $currentpage = $totalpages;
        }
        //if current page is less than first page...
        if ($currentpage < 1)
        {
           // set current page to first page
           $currentpage = 1;
        }
        //the offset of the list, based on current page
        $offset = ($currentpage - 1) * $rowsperpage;
        // get the info from the db
        // while there are rows to be fetched...
        $sql = mysql_query("SELECT * FROM comments WHERE Flag = 1 ORDER BY id DESC LIMIT $offset, $rowsperpage");
        ?>

Edit Reported Comments

        <?php
        if($number==1)
            echo $number . " COMMENT";
        else
            echo $number . " COMMENTS";
        ?>

        <?php
        while ($content = mysql_fetch_assoc($sql))
        {
            ?>

            <?php $javaid=$content['id']; ?>
                <a href="<?php $_GET['location'] ?>" onClick="deleteComment(<?php echo $javaid ?>)" >

            <?php
            echo $content['username'] . "
 " ;
            ?>

            <?php
            echo "Posted " . $content['date'];
            ?>

            <?php
            echo $content['comment'];
            ?>

            <?php
        } // end while

        /******  build the pagination links ******/
        // range of num links to show
        $range = 3;
        ?>

        <?php
        // if not on page 1, don't show back links
        if ($currentpage > 1)
        {
            ?>
            <a href="<?php echo $_GET['location'] ?>&currentpage=1" class="blue"><< first
            <?php
            // get previous page num
            $prevpage = $currentpage - 1;
            ?>
            <a href="<?php echo $_GET['location'] ?>&currentpage=<?php echo $prevpage ?>" class="blue">< previous
            <?php
        }
        // loop to show links to range of pages around current page
        for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++)
        {
           // if it's a valid page number...
           if (($x > 0) && ($x <= $totalpages))
           {
              // if we're on current page...
              if ($x == $currentpage)
              {
                 // 'highlight' it but don't make a link
                 echo " $x "; //needs to be RIGHT ALIGNED
              // if not current page...
              }
              else
              {
                 // make it a link
                 ?>
                 <a href="<?php echo $_GET['location'] ?>&currentpage=<?php echo $x ?>" class="blue"> <?php echo $x?>
                 <?php
              } // end else
           } // end if
        } // end for
        // if not on last page, show forward and last page links
        if ($currentpage != $totalpages && $totalpages!=0)
        {
           // get next page
           $nextpage = $currentpage + 1;
           ?>
           <a href="<?php echo $_GET['location'] ?>&currentpage=<?php echo $nextpage ?>" class="blue">  next >
           <a href="<?php echo $_GET['location'] ?>&currentpage=<?php echo $totalpages ?>" class="blue">  last >>
           <?php
        }
        ?>

        <?php
    }
}
ComA::reportComment();
?>

A: You are using XmlHttpRequest in wrong way. Better way is to use something like this - http://api.jquery.com/category/ajax/
Furthermore, you are calling deleteComment() on page load, not on button click

A: If you are working with jQuery, it's pretty simple:
Change your delete button to something like this:
<a class="delete_btn" rel="<?php echo $comment_id; ?>" href="#">

and put this little script somewhere beneath it:


text:
Q: Negative lookahead for "select filenames whithout extansion" I need to add "php" to all urls in href="xxx", that don't end with "php".
I use negetive lookahead (?!php):
find = r'href="(.+?)(?!php)"'
replace =  r'href="\1.php"'
re.sub(find, replace, 'href="url"')
re.sub(find, replace, 'href="url.php"')

both add extension:
href="url.php"
href="url.php.php"

Why negative lookahead doesn't work?

A: The following does work:
In [49]: re.sub(r'href="([^"]*?)([.]php)?"', r'href="\1.php"', 'href="url.php"')
Out[49]: 'href="url.php"'

In [50]: re.sub(r'href="([^"]*?)([.]php)?"', r'href="\1.php"', 'href="url"')
Out[50]: 'href="url.php"'

The reason your original regex (.+?)(?!php) doesn't quite work is that it matches url.php as follows:

*

*(.+?) matches url.php;

*at this point the negative lookahead is satisfied since the next character is a double quote.

In other words, .+? consumes the entire filename including the extension, making the lookahead a no-op.

A: Negative lookahead means the regexp tries to match next pattern, but does not consume the pattern. Your pattern "(.+?)(?!php)" matches 1 or more number of any characters until it meets ", then tries to match next pattern, which is php. This lookahead will always fail, because the next character is ", and since this is a NEGATIVE lookahead, the whole pattern will succeed.
What you need is the negative lookbehind, ((?<!PATTERN)) which will try to match the pattern AFTER the character is consumed. When it meets ", lookbehind pattern tries to match last 3 characters against pattern php.
In short, please try again with below pattern
find = 'href="(.+?)(?<!php)"'


text:
Q: maintain checkbox which were checked after submit I know there's "PHP keep checkbox checked after submitting form" on here, but that thread does not solve my problem, because I have multiple checkbox, what I need is when you check a checkbox, this stay checked after submit.
At the moment with this code nothing happens, I tried another way but when I check "id7" checkbox, all the checkbox get checked.
I have to know which checkbox was checked by the id that I give it, but I do not know how.
while ($fila = mysql_fetch_array($rs)) {
    echo utf8_encode("

                ".$fila['title']."

              ");?>

                <input type="checkbox" name="checklist[]" value="<?php echo htmlspecialchars($fila['id']); ?>" <?php if(isset($_POST['checklist[]']) && is_array($_POST['checklist[]']) && in_array('$fila', $_POST['checklist[]'])) echo 'checked="checked"'; ?> />

              <?php
            }
          }
       ?>

A: First, the value of checkbox is $fila['id'] so when you are checking, use $fila['id'] instead of $fila. Also, when PHP receive array input fields with [] in their names the [] will be removed so that the correct POST variable is $_POST['checklist'].
Try changing this line:
<input type="checkbox" name="checklist[]" value="<?php echo htmlspecialchars($fila['id']); ?>" <?php if(isset($_POST['checklist[]']) && is_array($_POST['checklist[]']) && in_array('$fila', $_POST['checklist[]'])) echo 'checked="checked"'; ?> />

to
<input type="checkbox" name="checklist[]" value="<?php echo htmlspecialchars($fila['id']); ?>" <?php if(isset($_POST['checklist']) && is_array($_POST['checklist']) && in_array($fila['id'], $_POST['checklist'])) echo 'checked="checked"'; ?> />

A: "name" is like a variable name - by using checklist[] you're defining an array as the variable.
Why not just name each checkbox properly? When the form is submitted, use the contents of $_POST to set each variable into the user's $_SESSION.
If the page is refreshed, use the values from $_SESSION to determine if the checkbox should be ticked. Something like (untested):
 <input type="checkbox" name="vehicle" value="Bike"
<?php if (isset($_SESSION['bike_checked']) echo 'checked'; ?>> I have a bike

 <input type="checkbox" name="vehicle" value="Car"
<?php if (isset($_SESSION['car_checked']) echo 'checked'; ?>> I have a car

 <input type="submit" value="Submit">


text:
Q: How to make a desktop icon on centos 7 a trusted app? I am fairly new to Linux.  I have successfully created a desktop shortcut using the method where you create a new .desktop file and add in the information.
The issue I'd like to overcome is that the new shortcut has a dummy icon image and gives the 'untrusted application warning' when first launched.
I'd like to be able to create the shortcut and have it already trusted and have the icon appear nicely as soon as the command is executed.  I've written a bash script for this and I think there must be a way to set this up so that it works nicely.
The end result is to eventually run a script that configures a new box to have all my desktop shortcuts pre-made and ready to go.
Here's the script:
#! /bin/bash
LT_RED='\033[1;31m'
LT_GREEN='\033[1;32m'
LT_BLUE='\033[1;36m'
NC='\033[0m' # NO COLOR

function CreateGeanyEnvVar(){
    if [ ! -n "$GEANY_LN" ]; then
        printf "${LT_GREEN}\n => Creating GEANY_LN env var.${NC}"
        GEANY_LN=$HOME/Desktop
    else
        printf "${LT_RED}\n => GEANY_LN already exits.${NC}"
    fi
}

function CreateGeanyDesktopIcon(){
    printf "${LT_GREEN}\n => Creating Geany Desktop Icon.${NC}\n"
    touch ${GEANY_LN}/geany.desktop
    echo "[Desktop Entry]" >> ${GEANY_LN}/geany.desktop
    echo "Type=Application" >> ${GEANY_LN}/geany.desktop
    echo "Version=1.0" >> ${GEANY_LN}/geany.desktop
    echo "Name=Geany" >> ${GEANY_LN}/geany.desktop
    echo "GenericName=Integrated Development Environment" >> ${GEANY_LN}/geany.desktop
    echo "Comment=A fast and lightweight IDE using GTK+" >> ${GEANY_LN}/geany.desktop
    echo "Exec=geany %F" >> ${GEANY_LN}/geany.desktop
    echo "Icon=geany" >> ${GEANY_LN}/geany.desktop
    echo "Terminal=false" >> ${GEANY_LN}/geany.desktop
    echo "Categories=GTK;Development;IDE;" >> ${GEANY_LN}/geany.desktop
    echo "MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/xml;text/html;text/css;text/x-sql;text/x-diff;" >> ${GEANY_LN}/geany.desktop
    echo "StartupNotify=true" >> ${GEANY_LN}/geany.desktop
    echo "Keywords=Text;Editor;" >> ${GEANY_LN}/geany.desktop
    echo "X-Desktop-File-Install-Version=0.22" >> ${GEANY_LN}/geany.desktop
    chmod 755 ${GEANY_LN}/geany.desktop
}

printf "${LT_GREEN}Setup Geany on CentOS 7\n${NC}"

printf "${LT_GREEN}*********************************\n${NC}"

CreateGeanyEnvVar
CreateGeanyDesktopIcon

A: As described by red-hat documetations: .desktop files with executable permission gives a chance to attacker for ricking the users. So, the new security system treats all the .desktop files from outside pakage as untrusted. Althougth you have generated a good .desktop file, it is still untrusted by system security part. So, how to make it trusted?

*

*First, change the owner and group of .desktop file, so you have the permission to mark is as trusted, such as: # chown john:john ${GEANY_LN}/geany.desktop

*After that, double click the .desktop file, it will show a message-box for you to select "cancel" or "trust and launch". Select the second one and the .desktop will be trusted and shown rightly.
This may not be the best solution and keep in searching docs for it!


text:
Q: Find quartile of range based on value in other column I have the following data in excel starting in cell A1. I want to find the 25th percentile (quartile 1) of the "Time" data based on the Month. For example, what is the 1 quartile of the time data in Apr-17? I wrote this formula, but it did not work.
What formula can one write to answer the question posed above?
=IF(Month = Apr-17, QUARTILE(B2:B9,1),"")

A: Be sure to set as an array formula with ALT-SHIFT-ENTER
=QUARTILE.INC(IF(A2:A10=$E$3,B2:B10,""),1)

https://i.stack.imgur.com/1v8h4.png
I like to break these things up into single steps before combining into a larger formula. In column C I have
=IF(A8=$E$8,B8,"")

Then in E5 I have
=QUARTILE.INC(C2:C10,1)

From there I was able to put together a formula that works.
Also note that I wasn't 100% sure how your date looks, so I used a input month cell. If you prefer you can replace $E$8 with the date
EDIT:
Or even replace with a date(year,month,day)
=IFERROR(QUARTILE.INC(IF(A2:A10=DATE(2018,4,1),B2:B10,""),1),"NONE FOUND")

Again remember to set as an array formula with ALT SHIFT ENTER


text:
Q: How to open a .p file with fopen in Matlab I have an third-party file with the extension .p and I try if it is possible to open it using the function fopen:
fopen(title.p)

This returns 3, which is a file identifier according to the help function:

help fopen
fopen - Open file, or obtain information about open files
This MATLAB function opens the file, filename, for binary read access, and returns an integer file identifier equal to or greater than 3.

What should I do to see (if possible) the content of the file?

A: A file with the extension .p in the context of matlab probably refers to a pcode file. It is obfuscated bytecode, you won't be able to read anything useful. Nevertheless you can run the function calling it like any other matlab function.

A: I was able to open the file using
fid = fopen('file.p')
fgetl(fid)

However, the content was not useful, indeed.


text:
Q: Multiple file uploads with PHP script and iOS Currently I'm uploading a xml file from mac to a server. It works fine. Below is the code:
osx code
  NSString *urlString1 = @"http://username:pwd@ip/files/upload.php";

NSMutableURLRequest *request1 = [[NSMutableURLRequest alloc] init];
[request1 setURL:[NSURL URLWithString:urlString1]];
[request1 setHTTPMethod:@"POST"];

NSString *boundary1 = @"---------------------------14737809831466499882746641449";
NSString *contentType1 = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary1];
[request1 addValue:contentType1 forHTTPHeaderField:@"Content-Type"];

NSMutableData *body1 = [NSMutableData data];
[body1 appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary1] dataUsingEncoding:NSUTF8StringEncoding]];
[body1 appendData:[@"Content-Disposition: form-data; name=\"userfile\"; filename=\"data.xml\"\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
[body1 appendData:[@"Content-Type: application/octet-stream\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
[body1 appendData:[NSData dataWithData:xmlData]];
[body1 appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n", boundary1] dataUsingEncoding:NSUTF8StringEncoding]];
[request1 setHTTPBody:body1];
NSLog(@"xml data %@",xmlData);
NSData *returnData1 = [NSURLConnection sendSynchronousRequest:request1 returningResponse:nil error:nil];

and PHP script:
 <?php
  $target_path = "./";
  $target_path = $target_path.'data.xml';
  if(move_uploaded_file($_FILES['userfile']['tmp_name'],$target_path)) {
    echo "The file has been uploaded";
  } else{
    echo "There was an error uploading the file, please try again!";
  }
?>

Now I have a case where I'm supposed to add multiple files. So how does file naming work? Anyone please help me on this.

A: I think you can check with the PHP Array function if it works it is good. I am not sure about XCode but lets stick to the Basic HTML for for uploading multiple Files. Try the below code:
Multiple files can be selected and then uploaded using the
<input type='file' name='file[]' multiple>

The sample php script that does the uploading:
<html>
<title>Upload</title>
<?php
    session_start();
    $target=$_POST['directory'];
        if($target[strlen($target)-1]!='/')
                $target=$target.'/';
            $count=0;
            foreach ($_FILES['file']['name'] as $filename)
            {
                $temp=$target;
                $tmp=$_FILES['file']['tmp_name'][$count];
                $count=$count + 1;
                $temp=$temp.basename($filename);
                move_uploaded_file($tmp,$temp);
                $temp='';
                $tmp='';
            }
    header("location:../../views/upload.php");
?>
</html>

The selected files are received as an array with
$_FILES['file']['name'][0] storing the name of first file. $_FILES['file']['name'][1] storing the name of second file. and so on.


text:
Q: Build exception with cordova-plugin-smooch I'm trying to integrate smooch into my Cordova app with the official plugin but when I go to build my application it throws a main thread exception back at me. Here's (what I think are the relevant parts of) my build output, if you need any more just comment and I'll put it up.
:app:transformClassesWithDesugarForDebugException in thread "main" java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer$DefaultMethodFinder.visit(DefaultMethodClassFixer.java:471)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:319)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:88)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:85)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at com.google.devtools.build.android.desugar.LambdaDesugaring.visitEnd(LambdaDesugaring.java:150)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at org.objectweb.asm.ClassVisitor.visitEnd(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:401)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:326)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:280)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:584)

The rest is at: https://pastebin.com/9j0ZW7rJ
I've followed the Android installation instructions, changed my app-id and all of that guff... I'm not sure but I have a hunch it might be conflicting with https://github.com/arnesson/cordova-plugin-firebase since they both handle fcm messages and I've had problems like that before.
Here are the other plugins in my app:
cordova-plugin-firebase 0.1.25 "Google Firebase Plugin"
cordova-plugin-headercolor 1.0 "HeaderColor"
cordova-plugin-statusbar 2.4.1 "StatusBar"

If anyone has any ideas for what to try, has had this problem before and knows what's going on, I'd love your help! There's an issue over on github but not sure if smooch is maintaining the plugin anymore.

A: It's not a Cordova specific issue at all, thanks to wmora for pointing me towards dependencies.
First, run gradlew myapp:dependencies inside your app (for cordova projects, this is /platforms/android) and make sure that all of your dependencies match up correctly.
If not, head over to /platforms/android/app/build.gradle and down to dependencies and add the dependency along with an explicit version number.
(This is what I needed, might not work for you)
compile "com.google.firebase:firebase-auth:11.8.0"
compile "com.google.android.gms:play-services-location:11.8.0"

(for cordova projects, outside it after the last quote inside your dependency brackets to make sure cordova doesn't overwrite it)
Clean, build and hopefully you should be good to go!

A: cordova clean

that line help me. if still have problem, try
ionic cordova plugin add cordova-android-play-services-gradle-release


text:
Q: High CPU usage with grunt 1.0.3 and sailsjs Here's my watch.js file :
module.exports = function (grunt) {

grunt.config.set('watch', {
assets: {

  // Assets to watch:
  files: [
    'assets/**/*',
    'tasks/pipeline.js',
    '!**/node_modules/**',
    '!assets/images/**' // <- Added this line to stop watching
  ],

  // When assets are changed:
  tasks: [
    'syncAssets',
    'linkAssets'
  ]
}
});

I followed this to reduce the folder grunt watches for change but to no avail.
Also, I deleted the task folder along with Gruntfile.js file to stop using grunt but doing htop on the server still shows grunt hogging the cpu.

A: Add this in the watch script options : { interval: 1000 } in Gruntfile.js


text:
Q: How to organise dataFrame like this, in Python: I have a file which has some information:
1.Movie ID (the first character before a ":")
2.User ID
4.User Rating
3.Date
All elements are splited by a "," but Movie ID, which is separated by a colon
if I create a dataframe like this:
 df=pd.read_csv('combined_data_1.txt',header = None,names['Movie_ID','User_ID','Rating','Date'])

and print the dataframe, I will get this:

Which is not correct, obviosly.
So, if you look at the "Movie_ID" column, in the first row, there is a 1:1488844. Only the number "1" (just before the colon) should be in the "Movie_ID" column, not "1:1488844". The rest (1488844) should be in the User_ID column.
Another problem is that not every "Movie_ID" column have its correctly ID, and in this case, it should be "1" until I find another movie id, that again, will be the first number before a colon.
I know that the ids of all the movies follow a sequence, that is: 1,2,3,4,...
Another problem that I saw, was that when I read the file, for some reason a split occours when there is a colon, so after the first row (which doesn't get splited), when a colon appears, a row in "Movie_ID" is created containing only, for example: "2:", not something like the first row.
In the end, I would like to get something like this:

But I don't know how to organise like this.
Thanks for the help!

A: I believe the issue might be coming from how your data is being stored and thus parsed due to the way your Movie ID is stored separated by a : (colon) rather than a , (comma) as would be needed in a CSV.
If you are able to parse to have it delineate by commas exclusively. the text before it is opened as a CSV, you may be able to eliminate this issue. I only note this because Pandas does not permit multiple delimiters.
Here is what I was able to come up with regarding making something which delineates by colon and comma for how you desire. While I know this isn't your ultimate goal, hopefully this is able to get you on the right path.
import pandas as pd
with open("combined_data_1.txt") as file:
    lines = file.readlines()

#Splitting the data into a list delineated by colons
data = []
for line in lines:
    if(":" in line):
        data.append([])
    else: #Using else here prevents the line containing the colon from being saved.
        data[len(data)-1].append(line)

for x in range(len(data)):
    print("Section " + str(x+1) + ":\n")
    print(str(data[x]) + "\n\n")

A: Use shift with axis=1 and simply modify the columns:
df=df.shift(axis=1)
df['Movie_ID']=df['User_ID'].str[0]
df['User_ID']=df['User_ID'].str[2:]

And now:
print(df)

Would be desired result.


text:
Q: aggregation issue mssql with join and parent-child level The source table examples
Table1
id      id_parent   product_id
===     =========   ========
154     104389        1043891
155     104389        1995137331

then I have two other inventory tables as below:
(table2)
product_id   location_id       on_hand     transit
1043891          2           12      1
1043891          5           33      0
1043891          6           7       0
1043891          4           3       0
1995137331       2           8       5
1995137331       8           50      9
1995137331       5           95      0
1995137331       11          22      5
1995137331       13          93      1

(table3)
product_id   location_id    on_hand      transit
1043891           1         25       1
1995137331        1         29       0

I have this following query:
; with
O as (select Product_Id, SUM(OnHand) AS AllStore from Table2 group by Product_Id),
S as (select Product_Id, SUM(OnHand) as WH from Table3 group by Product_Id)

SELECT
   L1.id_parent as parent
  ,L1.product_id as child
  , O.AllStore
  , S.WH
FROM Table1 L0 JOIN Table1 L1 ON L0.id_parent = L1.id_parent

LEFT OUTER JOIN S on S.Product_ID = L0.Product_Id
LEFT OUTER JOIN O on O.Product_ID = L0.Product_ID
group by L1.id_parent, L1.product_id, S.WH, O.AllStore

It's somewhat working but duplicating the records. current result:
parent  child       AllStore    WH
1043892 1043891     104         102
1043892 1043891     242         123
1043892 1995137331  104         102
1043892 1995137331  242         123

Expected result:
parent  child       AllStore    WH
1043892 1043891     104         102
1043892 1995137331  242         123

Can someone please look at it and see what I'm doing wrong or if there's a better way to do it.
Thanks.

A: The issues comes due to your join of Table1 onto itself with the condition of
L0.id_parent = L1.id_parent

This join effectively Takes Table 1 with 2 rows of 104389 and joins on itself with the 2 rows. This join condition will produce 4 rows.
SELECT
   *
FROM
    @Table1 L0
    INNER JOIN @Table1 L1 ON
        L0.id_parent = L1.id_parent

id          id_parent   product_id  id          id_parent   product_id
----------- ----------- ----------- ----------- ----------- -----------
154         104389      1043891     154         104389      1043891
154         104389      1043891     155         104389      1995137331
155         104389      1995137331  154         104389      1043891
155         104389      1995137331  155         104389      1995137331

From the examples you have given, this join is completely unnecessary as the data you need is already in L0
The group by statement is also unnecessary as you are not running any aggregates. the end result of leaving it in is the same as putting a DISTINCT on the overall query.
Therefore: to produce the described "Expected Results"
the query can be modified to the below
; with
O as (select Product_Id, SUM(on_hand) AS AllStore from @Table2 group by Product_Id),
S as (select Product_Id, SUM(on_hand) as WH from @Table3 group by Product_Id)

SELECT
   L0.id_parent as parent
  ,L0.product_id as child
  ,O.AllStore
  ,S.WH
FROM
    @Table1 L0

    LEFT OUTER JOIN S ON
        S.Product_ID = L0.Product_Id

    LEFT OUTER JOIN O ON
        O.Product_ID = L0.Product_ID

Note: If the L0 and L1 join is a typo, and there is a 4th table in play but still producing duplicates, you can extract the L0 and L1 join into a sub query and DISTINCT it.


text:
Q: Text is not displayed on Bubbles in Bubble Chart I've a bubble chart built using dc.js in which the texts are not shown on the bubbles. Also, is there is a way to rotate the text on the bubbles.
Here is my code.
wfAvgChartBubble
        .width(658)
        .height(400)
        .margins({top: 10, right: 50, bottom: 30, left: 60})
        .dimension(wfStatusNameAvgDimBubble)
        .group(wfStatusNameAvgGroupBubble)
        .colors(d3.scaleOrdinal(d3.schemeCategory10))
        .keyAccessor(function (p) {
            return p.value.total;
        })
        .valueAccessor(function (p) {
            return p.value.avg;
        })
        .radiusValueAccessor(function (p) {
            return p.value.avg;
        })
        .x(d3.scaleBand().domain(data.map( function(d) {
            return d['workflow_status_name'];
        }
         )))
        .xUnits(dc.units.ordinal)
        //.x(d3.scaleLinear().domain([0, 5000]))
        .r(d3.scaleLinear().domain([0, 9000]))
        .minRadiusWithLabel(15)
        .elasticY(true)
        .yAxisPadding(150)
        .elasticX(true)
        .xAxisPadding(300)
        .maxBubbleRelativeSize(0.07)
        .title(function (p) {
               return p.key
                       + "\n"
                       + "Total Records: " + p.value.total + "\n"
                       + "Average Time Taken: " + p.value.avg;
           })
        .render();

I need to print the text on each bubble

A: showing all the labels
It would be easier to test this with a running example, but I think your problem is this line:
    .minRadiusWithLabel(15)

From your screenshot (thanks!) it looks like the big bubble has its label (which defaults to the key) but the labels are missing on the smaller bubbles. Try
    .minRadiusWithLabel(0)

to display labels no matter what size the bubble.
(minRadiusWithLabel docs)
rotating the text
Since the text transform isn't driven by the data, it's best just to use CSS to change it, unless you need to change them individually.
Here's a reference to some of the relevant dc.js selectors.
From there we can infer a CSS rule like
g.node text {
    transform: rotate(-45deg);
}


text:
Q: Play sound on android java Wrote the code to play the sound. But sometimes the sound is not played and there are no errors. I can't figure out where exactly the error occurs.
Android java
public class AudioPlayer {
    public MediaPlayer mediaPlayer = null;
    private Context mContext;

    public AudioPlayer(Context context) {
        this.mContext = context;
    }

    public void soundPlay(String soundName) {
        new Thread(() -> {
            try {
                audioStopPlayer();
                int resID = mContext.getResources().getIdentifier(soundName, "raw", mContext.getPackageName());
                mediaPlayer = MediaPlayer.create(mContext, resID);
                mediaPlayer.start();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }).start();

    }

    public void audioStopPlayer() {
        try {
            if (mediaPlayer != null && mediaPlayer.isPlaying()) {
                mediaPlayer.stop();
                mediaPlayer.release();
                mediaPlayer = null;
            }
        } catch (Exception e)
        {
            e.printStackTrace();
        }
    }

}

The program has many files with sound and when playing one, without waiting for its end, you need to click on the playback of another file.
As a result, it often comes to stop one sound and start playing another.
For this reason, I translated everything into streams


text:
Q: Column alias not usable in WHERE clause I've written a php script that builds a query based on a keyword/select menu search system. The script works great right up until I try searching on a column alias:
SELECT
    contacts.*,
    orders.order_id AS is_customer,
    purchases.purchase_id AS is_supplier
FROM contacts
LEFT JOIN orders ON orders.customer_id=contacts.contact_id
LEFT JOIN purchases ON purchases.supplier_id=contacts.contact_id
WHERE is_customer IS NOT NULL
AND contacts.account_id=1
GROUP BY contact_id
ORDER BY contact_company_name

It's the line WHERE is_customer IS NOT NULL that's the problem - MySQL tells me it doesn't exist. I understand why this is so but that doesn't help me.
I have tried changing it to HAVING is_customer IS NOT NULL based on a tip I read here Unknown Column In Where Clause, thus:
SELECT
    contacts.*,
    orders.order_id AS is_customer,
    purchases.purchase_id AS is_supplier
FROM contacts
LEFT JOIN orders ON orders.customer_id=contacts.contact_id
LEFT JOIN purchases ON purchases.supplier_id=contacts.contact_id
HAVING is_customer IS NOT NULL
AND contacts.account_id=1
ORDER BY contact_company_name

...and this query works just fine providing I remove the GROUP BY clause. Obviously this breaks my result set.
Can anyone help me polish off this query please?

A: Not sure if it's generally done to answer your own question but I've got it working by having a read of this page https://dev.mysql.com/doc/refman/5.0/en/group-by-handling.html.
Turns out the statement worked with the GROUP BY just fine, I simply needed to rearrange the order of the statement. The GROUP BY comes after the WHERE but before the HAVING, like so:
SELECT
    contacts.*,
    orders.order_id AS is_customer,
    purchases.purchase_id AS is_supplier
FROM contacts
LEFT JOIN orders ON orders.customer_id=contacts.contact_id
LEFT JOIN purchases ON purchases.supplier_id=contacts.contact_id
AND contacts.account_id=1
GROUP BY contact_id
HAVING is_supplier IS NOT NULL
ORDER BY contact_company_name


text:
Q: Error: Unexpected value 'DomSanitizer' imported by the module 'DynamicTestModule'. Please add an @NgModule annotation I try to test a DomSanitizer import.
But I still get this error:
Error: Unexpected value 'DomSanitizer' imported by the module 'DynamicTestModule'. Please add an @NgModule annotation.

And my test case looks like this:
 beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [RouterTestingModule, DomSanitizer, DossierFileService, ErrorProcessor, MatDialog, BrowserModule],
      declarations: [ DossierPersonalDataComponent ],
      providers: [{

        provide: DomSanitizer,
        useValue: {
          sanitize: () =>'safeString',
          bypassSecurityTrustHtml: () => 'safeString'
        }

      }]
    })
    .compileComponents();
  }));

So what I have to change?
Thank you
This are de dependencies in the ts file:
constructor(
    private dossierService: DossierService,
    private route: ActivatedRoute,
    private sanitizer: DomSanitizer,
    private dossierFileService: DossierFileService,
    private errorProcessor: ErrorProcessor,
    private dialog: MatDialog
  )

A: Remove DomSanitizer from imports. You should only import modules, not services. You should provide services. If DossierFileService, ErrorProcessor are services (I am not sure if MatDialog is or not), move them to providers.
beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [RouterTestingModule, MatDialog, BrowserModule],
      declarations: [ DossierPersonalDataComponent ],
      providers: [{

        provide: DomSanitizer,
        useValue: {
          sanitize: () =>'safeString',
          bypassSecurityTrustHtml: () => 'safeString'
        }

      },
      DossierFileService,
      ErrorProcessor,
     ]
    })
    .compileComponents();
  }));


text:
Q: Grid View Update , does not work I have a gridview gVEmployee.  I want to update only one field that is txtCheckIn.
   <asp:GridView ID="gvEmployee" runat="server" AllowPaging="true" ShowFooter="true"
            PageSize="5" AutoGenerateColumns="false"
            HeaderStyle-BackColor="Red"
            HeaderStyle-ForeColor="White" BackColor="#FFCC66" OnRowEditing="GridView1_RowEditing" OnRowUpdating="gvEmployee_RowUpdating">
            <AlternatingRowStyle BackColor="#FFFFCC" />
            <Columns>

                <asp:BoundField DataField="WeekDays" HeaderText="WeekDays" SortExpression="WeekDays" ItemStyle-HorizontalAlign="center">
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:BoundField>

                <asp:TemplateField HeaderText="Date" SortExpression="DateSelcted">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkcheckin" OnClick="lnkbtn_onclick" Text='<%#Eval("Dateselcted")%>' runat="server" CommandArgument='<%#Eval("Dateselcted")%>' />
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField HeaderText="Name">

                    <ItemTemplate>

                        <asp:Label ID="lblCheckIn" runat="server" Text='<%#Eval("checkin") %>'></asp:Label>

                    </ItemTemplate>

                    <EditItemTemplate>

                        <asp:TextBox ID="txtCheckIn" runat="server" Text='<%#Eval("checkin") %>'></asp:TextBox>

                    </EditItemTemplate>

                </asp:TemplateField>

                <asp:TemplateField HeaderText="Edit">

                    <ItemTemplate>

                        <asp:LinkButton ID="btnEdit" Text="Edit" runat="server" CommandName="Edit" />

                            <asp:LinkButton ID="btnDelete" Text="Delete" runat="server" CommandName="Delete" />

                    </ItemTemplate>

                    <EditItemTemplate>

                        <asp:LinkButton ID="btnUpdate" Text="Update" runat="server" CommandName="Update" />

                        <asp:LinkButton ID="btnCancel" Text="Cancel" runat="server" CommandName="Cancel" />

                    </EditItemTemplate>

                </asp:TemplateField>

            </Columns>
        </asp:GridView>

Implemented as :
protected void gvEmployee_RowUpdating(object sender, GridViewUpdateEventArgs e)
{

    TextBox checkin = (TextBox)gvEmployee.Rows[e.RowIndex].FindControl("txtCheckIn");

    db.UpdateReg1(Convert.ToDateTime(eid), 2);
    gvEmployee.EditIndex = -1;
    BindGridView();
}

My grid view's field is not updated. As I debug , I see that value of  checkin remains same . What seems to be problem here?

A: Just need to add GridView in
                protected void Page_Load(object sender, EventArgs e)
                {
                if (!IsPostBack)
                    {
                    BindGridView();
                    }
                }


text:
Q: OAuth1 Authentication of Rest API I need to do a post request according to the scenario given below. I only have consumers_key and consumer_secret. I don't know from where to get all the other fields. and also do i need to send the Authorization request including keys in the header?
A request token for the application must be obtained using the consumer key from the above response.
Request
POST /public/v1/oauth1/request_token
  Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
  Authorization: OAuth
    oauth_consumer_key="btgd2cg2bm3lbjqsfv150fj9q8",
    oauth_signature_method="HMAC-SHA1",
    oauth_timestamp="1467792887",
    oauth_nonce="9fd50a6f-40e0-41be-8809-34aa832b688e",
    oauth_callback="oob",
    oauth_signature="hcE6Q3boTytkHmM72xegCP1Y3W4%3D"

I am doing something like this
import requests
url="https://api.discovergy.com"
request_token_url=url+'/public/oauth1/request_token'
head={'Accept':'text/html, image/gif, image/jpeg, *;q=.2, '/';q=.2',
'Authorization':'OAuth'}
data= dict(oauth_consumer_key=client_key, oauth_signature_method='HMAC-SHA1', oauth_timestamp='1467792887', oauth_nonce='9fd50a6f-40e0-41be-8809-34aa832b688e', oauth_callback='oob', oauth_signature='hcE6Q3boTytkHmM72xegCP1Y3W4%3D')

r=request.post(url=request_token_url, data=data, headers=head)
print(r.content)

It gives 400 status..

A: Oauth1 has a different authorisation building module in python for Requests. See that documentation and the help files for examples of use.
The 400 RC you get is because you try to POST to that endpoint and the method is not supported. Most likely you can only GET from there.

A: The Discovergy API docs are at https://api.discovergy.com/docs/. I've setup a small PHP Discovergy API client at https://github.com/andig/discovergy. It demonstrates the entire process. For the /request_token POST (it is a POST) make sure to use the consumer key obtains from /consumer_token, not the credentials provided by Discovergy.
Update I've also noticed that according to your example you seem to pass the parameters as POST body. These need to be in the header as in the first code block you've shown.
Update 2 Also make sure to accept the right content types, at least application/json, maybe plus text/plain

A:  Recent versions does not have problem to request authentication using OAuth1 from request_oauthlib
from requests_oauthlib import OAuth1, OAuth1Session

OAUTH = OAuth1(API_KEY, API_KEY_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
HEADERS = {'Content-Type': 'application/json', 'Accept': '*/*'}

requests.method(url, data=json.dumps(payload), headers=HEADERS, auth=OAUTH)


text:
Q: Would this mIRC script be possible? how difficult? At my workplace we use mIRC for realtime communication for those of us who need to be constantly in touch with others. Sometimes it happens that I have to leave my desk for an hour or two at a time, and sometimes I get a PM in mIRC that I need someone to get me for.
So, my question is, with the scripting capability of mIRC, is it possible to set up a script that, when running, if I receive a PM it will automatically send a PM to another user that I specify to let him know to give me a call or something? Would it be easy to implement?
(if it would be quick and easy and someone wants to write it for me, that'd be super and worth a top answer vote :P mainly just need to know if its possible and how difficult it would be though)
We use mIRC 6.16 if that matters. Its an older release.

A: Yes it's possible. Yes it's easy.
It's like one line of code. This might work, haven't tried it though since I haven't used mIRC in years, probably made a mistake somewhere..
on *:TEXT:*:?:/notice NICKNAME Got PM, Call me!


text:
Q: trigger function in postgresql not working some help needed simple code I need to make a trigger function that copies the data inserted in a table to another table that has other column names.
here is the insert statement that shows the content of my new table :
INSERT INTO public.mvt(
    idtraitements,
    mode,
    direction,
    date_,
    heure,
    rfid_qr_rtag,
    matricule,
    idpersonnel)
    VALUES (?, ?, ?, ?, ?, ?, ?, ?);

here is the select statement of the source table :
SELECT "IDTraitements", mode, "Direction", date, heure, "RFID_QR_RTAG",
    "Matricule", "IDPersonnel"
    FROM public."MVT_PNT";

here is the trigger function but it doesn't run :
create or replace function emp_log_copy() returns trigger language 'plpgsql'
as $$
begin
insert into mvt(idtraitements, mode, direction, date_, heure,
    rfid_qr_rtag, matricule, idpersonnel)
    values (
        new."IDTraitements" ,
        new."mode" ,
        new."Direction"  ,
        new.date ,
        new.heure,
        new."RFID_QR_RTAG" ,
        new."Matricule" ,
        new."IDPersonnel");
end;
$$

trigger:
CREATE TRIGGER emp_log_copynewt
  AFTER INSERT
  ON "MVT_PNT"
  FOR EACH ROW
  EXECUTE PROCEDURE emp_loging();

some help would be appreciated!
it is not me who created the table "MVT_PNT" but i need to work with it as it is.

A: @regragui-karim, please check the documentation

A trigger function must return either NULL or a record/row value having exactly the structure of the table the trigger was fired for.


text:
Q: sharethis Option showing a Privacy Popup how to disable this I have integrated the https://sharethis.com and i have the We value your privacy in my screen any one have idea how to disable this ?

A: On FAQ you can find more information about GDPR and e.t.c. But popup you can turn off on the https://platform.sharethis.com/gdpr-compliance-tool in option:

WHICH USERS SHOULD BE ASKED FOR CONSENT (display the CMP when they
  appear on the page for the first time)?

A: The whole popup is in div,

That's why You need to put css in main.css
.popup_popup {
    display: none !important;
}

This is working for me. :)


text:
Q: SSR in Angular 5 failing when deployed (using ASP.NET Core) I made an Angular 5 Project in ASP.NET Core using this source:
I followed the steps to enable server side rendering and everything is building/working fine on localhost but when deployed over Azure, I get an error and I have no clue what it is (the network tab says Internal Server Error 500, but don't know what's causing it). In the doc I provided, this is the part where I stop:
<!-- Set this to true if you enable server-side prerendering -->
<BuildServerSideRenderer>true</BuildServerSideRenderer>

Here is the error page I'm seeing after deploying:

I've been able to enable SSR on 3 other different Angluar 5 projects with ASP.NET Core and it works fine even after deployment. Did the exact same thing, followed the exact same steps. I can't seem to find anything related to it online either so I figured I'd ask on here.
I'm not sure what's causing the problem so if anyone wants to request specific pieces of code or files, please do not hesitate to ask. I will try my best to make my question more clear.
Here is my package.json by the way:

{
  "name": "HomeLoanGuys",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --extract-css --prod --build-optimizer",
    "build": "ng build --extract-css --prod --build-optimizer",
    "build:ssr": "npm run build --prod -- --app=ssr --output-hashing=media",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.11",
    "@angular/cdk": "^5.2.5",
    "@angular/common": "^5.2.11",
    "@angular/compiler": "^5.2.11",
    "@angular/core": "^5.2.11",
    "@angular/forms": "^5.2.11",
    "@angular/http": "^5.2.11",
    "@angular/material": "^5.2.5",
    "@angular/platform-browser": "^5.2.11",
    "@angular/platform-browser-dynamic": "^5.2.11",
    "@angular/platform-server": "^5.2.11",
    "@angular/router": "^5.2.11",
    "@nguniversal/module-map-ngfactory-loader": "^5.0.0-beta.5",
    "aspnet-prerendering": "^3.0.1",
    "bootstrap": "^3.3.7",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.4.1",
    "rxjs": "^5.5.6",
    "smoothscroll-polyfill": "^0.4.3",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular/cli": "~1.7.0",
    "@angular/compiler-cli": "^5.2.11",
    "@angular/language-service": "^5.2.11",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3"
  },
  "optionalDependencies": {
    "node-sass": "^4.9.0"
  }
}

One difference between this project and others is that I'm using Angular Material version 5.2.5, not sure if that has anything to do with anything...
Also, I use the commands 'npm run build && npm run build:ssr' to create the dist and dist-server folders. As I've said, everything works fine on localhost (SSR) but I see a 500 error in the network tab, and this error page after deploying. My understanding and experience with Angular and ASP.NET Core is limited as you may be able to tell, so please bear with me.
Update (10/24/2018):
I'm using jQuery, Angular Material, and performing other DOM manipulations throughout the project. Based on the Microsoft docs, this could cause issues with SSR. I'm not sure if using DOM specific API's is the specific issue, however. Any thoughts?


text:
Q: "The box contains, at most, one marble." Can the box contain no marbles? Does the sentence "The box contains, at most, one marble." apply if the box contains no marbles?

A: Yes.
'At most' means means 'not more than'
So, the sentence: "The box contains, at most, one marble.", naturally means that the box would have one marble or less than that(zero).

A: There are at least three contexts in which the statement may be made.
We may be describing the capacity of the box. For example, I want to buy a box to contain marbles and I like the red one with dimensions 1.1 cm cube. My marbles are 1 cm diameter. So the vendor may helpfully point out to me that  this box contains, at most, one marble. This descriptive statement is true whether or not there is a marble in the box.
We may be considering a closed marble box such as my red one, whose contents we do not know. It is correct and logical to say that it contains none or one marble, or the logical equivalent "at most, one". This is a statement about the only two logical possibilities.
If we are looking at my open red box, the statement does not tell us the self-evident fact that there is or is not a marble, it merely describes the capacity of the box.
In all these cases, the box may contain one marble or none.

A: The phrase "at most" indicative an upper bound. Mathematically, any number of marbles that does not exceed the upper bound of 1, such as 1, 0, 0.5, -10, etc. would be consistent with your sentence, although physically it is difficult to have a negative number of marbles.


text:
Q: Remove the comma after the last number in a loop this is my code
 System.out.println("Enter any integer number ");
int number = scan.nextInt();
while (number > 0) { System.out.print( number % 10 + ",");number = number / 10;}

To clarify if the user enter 1234
the output should be 4,3,2,1,
how can i edit the code to remove the comma after the last num?
something like 4,3,2,1

A: Since everyone is having a field day, here's mine:
while (number > 0) {
    System.out.print( number % 10 + ((number/=10)>0 ? "," : ""));
}

A: This is the most elegant approach I have picked along the way:
String delimiter = "";
while (number > 0) {
   System.out.print(delimiter + number % 10);
   number /= 10;
   delimiter = ",";
}

A: I would do the following
if (number > 0) {
    System.out.print( number % 10 );
    number = number / 10;
    while (number > 0) {
        System.out.print("," + (number % 10) );
        number = number / 10;
    }
}

Print the first element and then for all the other ones prepend a ,. In this way, you always end with a
, X

The other options are doing unnecessary if checks.

A: I would do it this way
while (number > 0) {
    System.out.print(number % 10);
    number = number / 10;
    if (number > 0)
        System.out.print(",");
}

A: This could do the trick:
while (number > 0) {
        System.out.print(number % 10);
        number = number / 10;
        if(number!=0) System.out.print(",");
    }

A: Sotirios's solution works but here's an alternative:
// replacing "scan" with an example number.
int start = 123456789;
for (int number = start; number > 0; number = number / 10) {
    if(number < start)
        System.out.print(',');
    System.out.print(number % 10);
}

This will DRY up the calculation of the count down (number/10) but does the test to see if it's not the first one in each loop. I think that that test, however, would turn out to be faster than doing string arithmetic ("," + (number % 10)).
Hope this helps.

A:     int x;
    Scanner scan = new Scanner(System.in);

    System.out.print("Enter integer : ");

    x = scan.nextInt();

    for(x = 4; x>1; x = x-1)
    {
        System.out.print(x + ",");
    }
    if (x != 0) // this is so the last number doesn't end with a comma
    {
        System.out.print(x);
    }

A: All the code that was showed here is invalid because the user can enter 0 and 0 should be printed out.
The valid code will look the following way
do
{
    System.out.print( number % 10 );
    number = number / 10;
    if ( number != 0 )
        System.out.print( "," );
} while ( number != 0 );


text:
Q: z3py: simplify nested Stores with concrete values I'm using the python API of Z3 [version 4.4.2 - 64 bit] and I'm trying to understand why z3 simplifies the expression in this case:
>>> a = Array('a', IntSort(), IntSort())
>>> a = Store(a, 0, 1)
>>> a = Store(a, 0, 3)
>>> simplify(a)
Store(a, 0, 3)

but it doesn't in this case:
>>> a = Array('a', IntSort(), IntSort())
>>> a = Store(a, 0, 1)
>>> a = Store(a, 1, 2)
>>> a = Store(a, 0, 3)
>>> simplify(a)
Store(Store(Store(a, 0, 1), 1, 2), 0, 3)

A: The simplifier only applies the cheapest rewrites on arrays.
So if it finds two adjacent stores for the same key, it knows to squash the inner most key.
There is generally a high cost of finding overlapping keys, and furthermore keys could be variables where it is not possible to determine whether they are overlapping.


text:
Q: how to type function reference in typescript Given the following function getCards - How do i declare a type for the input of memoize? It takes in a reference to a function.
import memoize from "fast-memoize";

function getCards<T>(
  filterBy: string,
  CardsList: T[] = CardsJSON.map((item, i) => ({ ...item, id: i }))
) {
  return CardsList;
}

// This is what i've tried.
// const testType: Array<ICard> = getCards<ICard>("test");

const fn = memoize(getCards);

I also get the following type error for CardsList and i can't figure out what the error is..?

TS2322: Type '{ id: number; spId?: string | undefined; callToAction?: string | undefined; cardTags?: any[] | undefined; campaignId: string; cardTitle: string; cardDescription: string; endAgeLimit?: number | undefined; ... 37 more...; updatedAt: string; }[]' is not assignable to type 'T[]'.
        Type '{ id: number; spId?: string | undefined; callToAction?: string | undefined; cardTags?: any[] | undefined; campaignId: string; cardTitle: string; cardDescription: string; endAgeLimit?: number | undefined; ... 37 more ...; updatedAt: string; }' is not assignable to type 'T'.

A: I guess the issue is that the compiler cannot guarantee that the types are reconcilable when the function is called, consider this example:
getCards<User>("name");

Here the T is explicitly set to User but the card list will be defaulted to essentially Card & { id: number }, so they will not match.

I thought this might be fixable by putting a constraint like the following on the type parameter but unfortunately that does not work:
function getCards<T extends Card & { id: number }>

This does not quite work because the type is used as the type argument of an array. So if you set T to e.g. SpecialCard which has a property bonus (does not exist on the Card type) and you retrieve an item from the default card list, you will not get an object of type SpecialCard, as the property will be missing.
Your constraint has to be a subset, not a superset of the card properties, so a generic might not be suitable here at all.


text:
Q: multiple clients accessing one email account over IMAP I am using Postfix + Dovecot + IMAP + Maildir and I am accessing my server from two different machines (desktop and Laptop), i.e. two clients (Thunderbird). The are sometimes running simultaneously, and sometimes only one or the other client is running.
I have moved a message from from Inbox to Archive in one client, and then started the second client. In the second client, I see the message still in Inbox, and I see it in Archive as well.
I have checked on my server (this is easy because I am using Maildir) and the message is no longer in the Inbox. It is in the Archive.
So why does the second client show it bot in Inbox and Archive. Apparently, it has not realized, that the message has been moved while he was not running.
Is there a problem with syncing?
How can I make two clients accessing the same IMAP server behave orderly?
I have been using IMAP through multiple clients before, although the server was Exchange (not under my control, so I have no idea how it was set up). This problem did not exist.
Is there some setting in Dovecot ?

A: I don't know the details of your setup, but I would suggest that you check that your Thunderbird clients are properly configured, before you start troubleshooting your IMAP server. In particular, you should make sure that in:
Edit
-> Account Settings
   -> Synchronization & Storage
      -> Message Synchronizing -> Advanced

You have all your folders checked as "Synchronized". You can also see per-folder setting when you right-click on the folder and select:
Properties
-> Synchronization

You might need to run the Repair Folder in the General Information tab, in case the folder is inconsistent with the server.