Transcribing Nutcracker suite, running into difficulties

Question: Obviously, going from an orchestral score to a piano duet score is hard in general. But I am running into some difficulties with transposition. 2 instruments I am transposing are Bb clarinet and A trumpet. Usually, this isn't hard. But I have run into a spot where it differs a lot depending on whether or not it is down a third or down 3 notes on the scale. The Bb clarinet note looks like a D so I know it is C. The A trumpet note looks like a D as well. Usually, I would transpose it to B, down a third. But this leads to a minor second. This isn't so bad in an orchestral texture. But in a piano duet, it is quite noticeable and quite dissonant.
Here is the chord I am going to get if I go with my usual transposition:
C
B
F#
B
D#
As you can see, the bottom 4 notes are a B major chord. But it has a C mixed in with it. This not only makes there be a second interval between the C and the B, but also between the C and the D#(thankfully, these notes are several octaves away so the second won't be noticeably dissonant, the top B though is only 1 octave away so it will be noticeably dissonant), and a tritone between the C and the F#. I think that the tritone will be very noticeably dissonant, even with the F# being 3 octaves away from the C.
If I go with a 3 notes down the scale transposition, the top B becomes an A. Same dissonance level but with different notes(2 seconds and 1 tritone). I don't think I want this level of dissonance in a piano duet. But if I change the top note, it won't go to F# as it is supposed to before the A section starting with the G major chord comes back.
Now what? If changing the transposition of the A trumpet line won't work and I can't change the notes in the Bb clarinet line, how am I going to avoid the mixed major/diminished sound from the tritone with the top note and the major chord? How else can I make it not so dissonant, especially since the chord has 2 seconds along with the tritone? Or will the tritone not be noticeably dissonant with the F# being 3 octaves away from the C and thus I won't get much of a diminished sound?
Here is the score I am transcribing. Measure 22 on page 26 is where I am getting trouble related to dissonance.
http://ks4.imslp.info/files/imglnks/usimg/8/83/IMSLP263374-PMLP03607-The_Nutcracker_Suite.pdf
Answer: How does it come that you encounter this problem of dissonnance only in bar 22? How did you transcribe the first bars at the beginning of the secound part?
The solution is very simple: in the 1st movement the clarinet parts are set for Bb clarinet, in the 2nd movement they have to use A clarinets. That means: in the 2nd movement both instruments (clar. & trp.) play the same voice.
Comment to your answers below:
Are you doing the transcription with a computer program a) or by hand b) ? In the first case it must have sounded the same dissonant as in bar 22 if you did it correct (considering there were Bb clarinets, as the clar, and trp). Play in unison from the beginning ... and as you transposed the Bb clar. a secound  up and the A trp. a small third up there must always have been a small second. the C played by a Bb clarinet doesn't sound as a B it is actually a Bb (flat)
I've googled this site in imslp: you'll find several arrangements for four hands or 2 pianos and also for only 1 piano:https://imslp.org/wiki/The_Nutcracker_(suite),Op.71a(Tchaikovsky,_Pyotr)
I've downloaded now the transcription for four hands from imslp. I think they are both useful.
Comment: By the way: Why  transcribe this piece again for 4hands piano? The excerpts for piano surely exist already in ismlp, probably in the same site ( see transcriptions and arrangements). If you are not doing this job as a task for reading and understanding partition scores, you could also download the midifile in classical music archives or any chaikowsky midi site and look at it in a notation program like note worthy ore mus score. Some grograms like finale of klemm contain a tool where you can choose a piano extract.
Comment: I did look at the transcriptions and arrangements and only saw 1 piano duet transcription. I also know that not every transcription is the same. And, wait a second, you're saying that what I think is a C in concert pitch in the clarinet line is actually a B? Also, yes, I was able to transcribe the first bars of the second section of the march using the Bb transposition without any dissonance issues. The score I'm looking at just says Clarinet 1 and Clarinet 2 so I assumed it was Bb clarinet throughout because usually when I just see Clarinet with no key indication, it is a Bb clarinet.
Comment: Now that I look over the score again, I see that the march section that I am starting my transcription with(I will get the overture in there at some point but it is the hardest movement to transcribe I think out of the entire suite) does indeed use the A clarinet. So that means that I have to bring all the notes I transcribed using the Bb transposition down 1 more step in the scale. How come I didn't notice this problem until bar 22? How come it sounded so consonant right until I reached bar 22?
Comment: Are you doing the transcriptio with a computer program a) or by hand b) ?
Comment: Kind of both? I mean I input the transcription into musescore and use it for playback but I don't directly use musescore to transcribe it. I transcribe it first in my head(because I have a great memory and am good at doing some tasks mentally including transcription). Then I input those transcribed notes into musescore which I can then listen to.
Comment: and how about working with  midifiles? you know what I mean?
you could save a lot of time, but you  would miss the training of your great brain ...
Comment: If you're transcribing from the original sheet music, I recommend saving a copy and then copying notes between the (likely PDF) copy and your score. Note that this is a surprisingly unintuitive process, as several instruments used in the original sheet music are probably transposing instruments, and some of them may blank out the key signature. There's also how much of the unpitched percussion you want to transcribe as piano notes--I tend to transcribe them only if the music sounds strange without them.
Comment: @AlbrechtHügli What do you mean by "entry part" and "second part"? Anyway, in the movement the OP refers to, it is clear from the clarinet parts' key signatures that they are clarinets in A (they have key signature 2 flats whereas non-transposing instruments have one sharp), so to convert from clarinet part to concert pitch you must transpose down by a minor 3rd.
Comment: I think the correct term in English is Section or yes, as you say movement. Carter's problem was that he didn't notice that in the 1st. Movement the clarinet part was written for Bb clarinets and in the 2nd mvt. for A clarinets. Thank you, I have edited this passage. In German we say "Satz" or "Teil".


Azumaya algebras

Question: I have seen a few different definitions of an Azumaya algebra in the literature- for example, Wikipedia prefers the following one:
An Azumaya algebra over a commutative local ring $R$ is an $R$-algebra $A$ that is free and of finite rank $r$ as an $R$-module, such that the tensor product $A\otimes_R A^{op}$  (where $A^{op}$ is the opposite algebra) is isomorphic to the matrix algebra $\mathrm{End}_R(A) \sim M_r(R)$ via the map sending $a\otimes b$ to the endomorphism $x \mapsto axb$ of A.
On the other hand, for purposes of checking this definition, I have seen the following characterization used:
$A$ is a finitely generated projective $R$-module and for all maximal ideals $\mathfrak{m}\subset R$, $A/\mathfrak{m}A$ is a central simple $R/\mathfrak{m}$ algebra.
Is there an obvious way to show that these are equivalent?
EDIT: It has been noticed in the comments that the first definition specified "local ring"- this is too specific for the two definitions to be equivalent. I'm interested in what can be said when one removes local (and as Mariano points out, replaces free by projective) from the first definition and allows $R$ to be just a commutative ring.
Comment: If you look on page 186 of *Noncommutative algebra* by Farb and Dennis, it is said that over a field, an algebra is central simple if and only if it is Azumaya. That's probably how one could prove your statement.
Comment: If you remove the local condition from the first definition, you should also replace freeness by projectivity...
Comment: @MTurgeon: Thanks for the reference! Could you possibly expand on your point? Unfortunately, I'm not as well versed in the commutative algebra maximal ideal trickery as I ought to be.
Comment: Well, it's just an idea, but if you can check that $A$ is Azumaya if and only if $A/\mathfrak{m}A$ is Azuyama for all maximal ideals $\mathfrak{m}$, then you can use Frab & Dennis' result to conclude.
Comment: However, I don't know if this is true, and even if it is, I might not be easier than showing directly what you want to show. It's just something I'm suggesting.
Comment: Second definition does not seem to be assuming $R$ is local, so I'd venture they are not equivalent.. but the second may be generalizing the first.
Comment: @rschwieb You're right! I didn't see that!
Comment: Good catch! I've edited the original post.
Comment: Edit added. Thanks for your observation.
Answer: An Azumaya algebra is by definition an álgebra $A$ which is separable over its center, that is, the multiplication map $m\colon A\otimes_{C(A)}A\to A,$ is a $(A,A)$-bimodule epimorphism that splits.
Comment: The map has to be split as an $(A,A)$-bimodule, rather, no?
Comment: Yes, i was mistaking. I already changed my answer.

Azumaya algebras


Loading Xml file from Isolated Storage - Windows Phone 7

Question: I'm trying to load xml data saved in the isolated storage, but I always get an error.
I use the following code to load xml data saved in the isolated storage
 IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication();

        storage.CreateDirectory("Highscores");

        using (var isoFileStream = new IsolatedStorageFileStream("Highscores\\scores.xml", FileMode.OpenOrCreate, storage))
        {
            using (XmlReader reader = XmlReader.Create(isoFileStream))
            {
                XDocument xml = XDocument.Load(reader);
                int i = 0;

                foreach (var score in xml.Root.Element("Highscores").Elements())
                {
                    Count_to_10.Page2.Highscores.scores[i++] = score.Value.ToString();
                }

            }
        }

But I get the following error
Root element is missing.

in this line
XDocument xml = XDocument.Load(reader);

The xml file is:
<HighscoreTable>
  <Highscores length="25">
    <score>00:00:09.000</score>
    <score>00:00:07.000</score>
    <score>00:00:02.000</score>
    <score>00:00:04.000</score>
  </Highscores>
</HighscoreTable>

I'd be glad if you'd help me find the source of the error.
Answer: What that error indicates to me is the XDocument.Load(reader); call is trying to read the file given and cannot find the file.  Essentially your file was not ever saved to isolatedstorage in the first place or it was saved with a different path.
I was testing something for myself and I was able to duplicate your issue when I tried to read the wrong file path.
Try adding storage.FileExists("Highscores\\scores.xml") to make sure your file exists in isolatedstorage before you try to read it.


NOTIFICATION_SERVICE com erro channel=null, como resolver?

Question: Eu fiz funcionar perfeitamente essa notificação no android 19 e na 21 mas não funciona na 27, 28 e 29.
 <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

 private void openNotification(){

        Intent intent = new Intent( MainActivity.this, NotificationActivity.class );
        intent.putExtra( "msg", msg );
        intent.putExtra( "status", status );
        intent.putExtra( "time", DataTime );
        // int id = 1;
        int id = (int) (Math.random() * 1000);
        PendingIntent pi = PendingIntent.getActivity( getBaseContext(), id, intent, PendingIntent.FLAG_UPDATE_CURRENT );
        Notification notification = new Notification.Builder( getBaseContext() ).setContentTitle( "Evento de Pânico" ).setContentText( msg ).setSmallIcon( R.mipmap.panic ).setContentText( DataTime ).setContentIntent( pi ).build();
        NotificationManager notificationManager = (NotificationManager) getSystemService( NOTIFICATION_SERVICE );
        notification.flags |= Notification.FLAG_AUTO_CANCEL;
        notificationManager.notify( id, notification );

}

Na API 29 vem uma toast de aviso:
            Notification(channel=null pri=0 contentView=null vibrate=null sound=null
    defaults=0x0 flags=0x0 color=0x00000000 vis=PRIVATE)

quando funciona na api19 vem o seguinte:
Notification(pri=0 icon=7f0e0005 contentView=br.com.panico/0x109007d vibrate=null sound=null defaults=0x0 flags=0x0 when=1567779581326 ledARGB=0x0 contentIntent=Y deleteIntent=N contentTitle=16 contentText=19 tickerText=N kind=[null])

Comment: Relacionado: [Configuração do NotificationCompat](https://pt.stackoverflow.com/q/403040/3774)
Answer: Isso deve esta ocorrendo porque a partir do Android 8.0(API 26), você precisa informar um canal de notificação, como é dito no site do android:

Canais de notificação
A partir do Android 8.0 (API de nível 26), todas as notificações precisam ser atribuídas a um canal ou não serão exibidas. Ao categorizar as notificações em canais, os usuários podem desativar canais de notificação específicos para seu app (em vez de desativar todas as notificações) e podem controlar as opções visuais e sonoras de cada canal, tudo isso a partir das configurações do sistema Android (Figura 11). Os usuários também podem tocar em uma notificação e mantê-la pressionada para alterar os comportamentos do canal associado.
Nos dispositivos com Android 7.1 (API de nível 25) e versões anteriores, os usuários só podem gerenciar as notificações para apps individuais (de fato, cada app tem apenas um canal no Android 7.1 e versões anteriores).

Figura 11. Configurações de notificação para o app Relógio e um dos canais dele

Para isso você vai precisar atualizar seu código para usar o NotificationCompat ao invés do Notification, alem de ter que criar seu canal:
Dependências:
dependencies {
    implementation "com.android.support:support-compat:28.0.0"
}

28.0.0 é a versão da lib support-compat, pode ser que seu projeto utilize uma versão diferente dessa, pois se não estou enganado isso depende da versão do build_sdk ou target_sdk do seu projeto (não lembro qual dos dois, mas seu Android Studio deve mostra um alerta informando).
Criando canal de notificação:
private void createNotificationChannel() {

    // Cria o canal de notificação para a API 26+
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        int importancia = NotificationManager.IMPORTANCE_DEFAULT;
        NotificationChannel channel = new NotificationChannel(CHANNEL_ID, "nomeDoCanal", importancia);
//                                                            ^ ID DO CANAL
        channel.setDescription("Descrição do canal");

        // Registra o canal no sistema, você não pode mudar a importância ou outros comportamentos depois disso
        NotificationManager notificationManager = getSystemService(NotificationManager.class);
        notificationManager.createNotificationChannel(channel);
    }
}

No projeto em que tive que usar algo parecido para criar o Canal de Notificação, eu fazia a criação/registro do canal dentro da onCreate.
Criando a notificação usando o NotificationCompat:
/// Criar uma Intent para abrir uma Activity
Intent intent = new Intent(this, AlertDetails.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);

NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID)
//                                                                        ^ ID DO CANAL EM QUE A NOTIFICACAO SERA DISPARADA

        .setSmallIcon(R.drawable.notification_icon)
        .setContentTitle("Meu titulo")
        .setContentText("Meu texto informativo")
        .setPriority(NotificationCompat.PRIORITY_DEFAULT)

        .setContentIntent(pendingIntent) /// Define a Intent que sera aberta ao clicar na notificação

        .setAutoCancel(true);

Referencia: Criar uma notificação - developer.android.com
Comment: Para esse problema do icone essa outra resposta talvez ajude - [Notification icon in Android 5.0](https://pt.stackoverflow.com/a/150034/3774) , você também pode tentar criar o icone usando o **Image Asset Studio** do Android Studio - [Criar um ícone de notificação com o Image Asset Studio](https://developer.android.com/studio/write/image-asset-studio?hl=pt-br#creating-notification)
Comment: Funcionou! Só uma coisa, os icone que deve aparecer na barra de status aparece uma bolinha escura. E na api 19 por exemplo aparece o icone mesmo, que é o icone da empresa que vai usar o app. Já mudei o tamanho do icone, já troquei o icone. Troquei muita coisa, mas não renderiza o icone certo.
Comment: Se puder me ajudar com essa outra questão que está nominda :  "Location entra em looping somente acima da versão API 23 Android 6.0(Marshmallow), por que?" https://pt.stackoverflow.com/questions/406805/location-entra-em-looping-somente-acima-da-vers%c3%a3o-api-23-android-6-0marshmallow


When should I use polyphonic voicing for the upper piano staff?

Question: I am learning to use some notation software, but I am unsure if what I have so far is the best way to notate this piano piece.

The ties kind of bug me, and I am not sure if I should have polyphonic voicing or not.
Is what the software has notated by default the best and easiest to read, or is there something better?
Often my software doesn't give me the best results right away, and it really depends on the knowing what settings to make.
Answer: Music notation software will usually notate what you ask it to and not what looks best. It is hard for a program to know what looks good. Depending on the program the program will help you to keep some conventions, but the choice of how you want to display certain things is up to you and the reason why we still need the job of an (musical) editor.
So this is mostly your choice. Personally I might prefer something like this:
Answer: The voice notation is not there to look nice, but to represent the composer's intention. You need to ask yourself, which notes belong to the same voice.
For example, does the E in the first measure and the G in the second one belong to the same melody, or not? What about B in the second measure? This will guide you to the answer you are searching.
You may imagine you have four singers (four, because I see up to four notes at a time in the score). If you wish them to sing this, which notes would you assign to each of them? Which notes would be doubled, and when some of the singers would pause?
Answer: Between bars 1 and 2, I would flip the tie to the other direction.  That would look more natural.  At the end of bar 2, the two quavers on the note A would look better as a crotchet tied to the minum in the next bar.  You should be able to have layers or different voicings.  The A would be the first layer and the E under it the second layer.  The stems would be respectively up (A) and down (E).  The tie for the A would curve up and for the E curve down.  I think this would look clearer and more natural.  It's more work to achieve this, but you should be happier with the result.
Comment: If you do this, you might want to put a quaver rest on the second layer, before the E, to make clear that you're scoring two lines on the same staff.
Answer: Generally, all music notation software is not actually designed for notation, but rather for the lay-out of the page / printing. In other words, these programs very often notate things incorrectly, or in a rather awkward fashion. Get yourself a copy of Behind the Bars, ask an instrumentalist for the part in question, and finally, try to keep your notation as clear and straightfoward as possible in conveying the intent desired. The last part is crucial,and perhaps goes to the heart of your question. The composer or arranger needs to decide when it is necessary to bring out a given portion of the musics function in a given context via the manner in which it is notated. Ultimately, this relates back to conveying the desired intent. You want to have the music performed in the manner you intend so you should notate it in the clearest manner for the performer and conductor.
Comment: Notation programs only "notate things incorrectly" if the user has input the notation incorrectly. There may be programs that are only designed for layout, but most are designed for entering notation.
Comment: I had lengthy correspondence with reps from Finale / MakeMusic to try to notate correctly some portions of a score of mine. I can assure you, the problem was not all that esoteric, and revolves around correctly notating poymeters. They had to concede that their program was not able to do this. So, at least that program is mostly for layout. I am not aware if Sibelius (or other) similar notation programs can actually do accurate and correct notation. But, would be good to know if that is the case.


How do I re-run updates (change module schema version)?

Question: I'm working on a module, and I changed a couple field types in the schema. I didn't take a backup before testing it and messed up the DB (it's just a dev site). Anyway, I reinstalled everything, and the schema version is set to that of the highest update. However, I actually do need to run the update; a View I have wouldn't install if I had the updated schema in the module code, so I figured this would be a good way to test that update.
How do I reset the schema version of my module to a particular version? In Drupal 7, I would have done this:
drush sqlq "UPDATE system SET schema_version=8102 WHERE name='flllpdf' AND type='module'"
Answer: While accessing state directly works, you can also just use the API: drupal_set_installed_schema_version(), which has existed since 4.7, as visible on the linked documentation page. This function is deprecated in Drupal 9.3.0 and removed in 10.0.0, where you should use \Drupal\Core\Update\UpdateHookRegistry::setInstalledVersion() instead.
To set it from drush:
drush ev "drupal_set_installed_schema_version('fillpdf', 8012)"

Note: In Drupal 7 you need to add extra include 'includes/install.inc';.
or (Drupal >= 9.3):
drush ev "\Drupal::service('update.update_hook_registry')->setInstalledVersion('fillpdf', 8012);"

Comment: Also nice if you simply need to check quick:    drush ev "echo drupal_get_installed_schema_version('MODULE')"; https://api.drupal.org/api/drupal/core%21includes%21schema.inc/function/drupal_get_installed_schema_version/8.3.x
Comment: or drush pm-info modulename
Comment: @Beanluc - using `drush pm-info modulename` will give you the version of the module, but not the schema update version.
Comment: Where do you need to add this: 'Note: In Drupal 7 you need to add extra include 'includes/install.inc';.' in the command or in the .module?
Answer: Drupal 8 now uses the keyvalue service to store information about the schema version. This is the same API the State API itself uses.
Value information is serialized when stored in the database, so using a direct SQL query is sub-optimal. Instead, use drush php-eval (or a script that bootstraps Drupal, if you don't have Drush) to execute the following:
<?php
  \Drupal::keyValue('system.schema')->set('fillpdf', (int) 8102);
?>

Change fillpdf and 8102 to your module name and desired schema version, respectively.
The Drush form of this command is:
drush ev "\Drupal::keyValue('system.schema')->set('fillpdf', (int) 8102)";
Comment: Note that if you're using ddev then this throws a bash error. You'll need to `ddev ssh` into the vm and then the command runs fine.
Comment: It's possible to run it from bash, but the escaping is a bit of a pain, so `ddev ssh` is indeed easier.
Answer: To SET and GET module updates via code (without Drush). Below is the code
GET  = drupal_get_installed_schema_version('moduleName');

SET = drupal_set_installed_schema_version("moduleName", "8000");

Answer: Can also go update it directly in the database. If you're using something like Sequel Pro (mac) or whatever database UI tool windows/linux has it's really easy. Arguably not the best idea, and would not advise doing this against a production level database, but it'll get the job done!
Table = key_value
collection = system.schema
name = fillpdf (your_module)
value = update to i:8102;
Answer: In Drupal 10, the service update.update_hook_registry provides two wrapper functions to get and set the module installed version:
GET:
drush ev "echo \Drupal::service('update.update_hook_registry')->getInstalledVersion('mymodule')"

SET:
drush ev "\Drupal::service('update.update_hook_registry')->setInstalledVersion('mymodule', 8105)"


Problema com autenticação no PHP, retorna PDO::errorCode(): 00000

Question: Estou com um problema para autenticar um site com o php, quando coloco os dados no formulário ele retorna a mensagem de error que introduzir caso falhasse e outra mensagem errorCode 0000 no método de login. Aparentemente não encontrei erros de sintaxe ou outra coisa no código. Segue abaixo o código que estou tendo o problema:
1) Classe Usuario - class.user.php
<?php
   require_once('././conexao/DbConfiguration.php');

class User
{
  private $conn;

  private $userRoles;

 function __construct()
 {
    $database = new Database();
        $db = $database->dbConnection();
        $this->conn = $db;

    $this->userRoles = array();
 }

 public function runQuery($sql)
 {
        $stmt = $this->conn->prepare($sql);
        return $stmt;
 }

 public function doLogin($username, $password, $rolename)
 {
     try
     {
       $query  = "SELECT u.username, u.password, r.rolename FROM user_roles ur LEFT JOIN users u ON ur.userID=u.iD ";
       $query .= "LEFT JOIN roles r ON ur.roleID=r.ID WHERE u.username=:uname && r.rolename=:rolename ";

       $stmt = $this->conn->prepare($query); //"SELECT * FROM users WHERE username=:uname "
       $stmt->execute(array(':uname'=>$username,':rolename'=>$rolename));
       $userRow = $stmt->fetch(PDO::FETCH_ASSOC);
       $passwordAux = md5($password);

       if($stmt->rowCount() > 0)
       {
         if(password_verify($passwordAux, $userRow['password']))
         {
            //$_SESSION['user_session'] = $userRow['user_id'];
            $_SESSION['ss_user_id'] = $userRow['user_id'];
            //$_SESSION['access'] = $userRow['access'];
            return true;
         }
         else
         {
            return false;
         }

       }
       else
       {
         echo "\nPDO::errorCode():\n";
         print_r($stmt->errorCode());
       }
      }
      catch(PDOException $e)
      {
         echo $e->getMessage();
      }
 }

2) Página do Login - login.php
  <?php

  require_once 'includes/inputs.php';
  require_once 'includes/classes/class.user.php';

  if ( !isset($pagetitle) )
  {
     $pagetitle = "QuestWeb - [Acesso Restrito]";
  }

  $user_login = new USER();

  if (isset($_POST['btn-login']))
  {
      $uname  = verifyInput($_POST['nmusr']);
      $upass  = verifyInput($_POST['pswd']);
      $roles  = array("1" => "Administrators", "2" => "Users", "3" =>    "Authors");

  if( $user_login->doLogin($uname,$upass, $roles[1]) )
  {
      $user_login->redirect('modulos/dashboard-1.php');
      //$message = "OK";
  }
  else if( $user_login->doLogin($uname,$upass, $roles[2]) )
  {
     $user_login->redirect('modulos/dashboard-2.php');
  }
  else if( $user_login->doLogin($uname,$upass, $roles[3]) )
  {
     $user_login->redirect('modulos/dashboard-3.php');
  }
  else
  {
      $message = "Falha de acesso";
  }
 }
 ?>

....
<?php
   if(isset($message))
   {
  ?>

         <?php echo $message; ?> !

   <?php
   }
?>
<form method="post" class="login-form" id="login-form">

        Usuúrio
        <input type="text" name="nmusr" placeholder="Usuário" class="form-control" id="form-username">

        Senha
        <input type="password" name="pswd" placeholder="Senha" autocomplete="off" class="form-control" id="form-password">

   <button type="submit" class="btn btn-link-2" name="btn-login">ENTRAR NO SISTEMA</button>

        Esqueceu a senha

    </form>

Answer: Está te aparecendo está mensagem porque esta a condição $stmt->rowCount() > 0 nunca é verdadeira.
Segundo a documentação do PHP a função rowCount:
PDOStatement::rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement executed by the corresponding PDOStatement object.
Ou seja no caso do SELECT essa função não faz efeito.
Você pode contornar este problema utilizando outra comparação como:
userRow = $stmt->fetch(PDO::FETCH_ASSOC);
$passwordAux = md5($password);

if ($userRow) {
    if (password_verify($passwordAux, $userRow['password'])) {
        // $_SESSION['user_session'] = $userRow['user_id'];
        $_SESSION['ss_user_id'] = $userRow['user_id'];
        // $_SESSION['access'] = $userRow['access'];
        return true;
    } else {
        return false;
    }
} else {
    echo "\nPDO::errorCode():\n";
    print_r($stmt->errorCode());
}


Rspec how to checks the value present in the an another method which that method doesn't return anything?

Question: Hi i have written Rspec to validate a body of message\n
 describe "validate_msm" do

  let!(:user) { FactoryGirl.create(:user) }
  it "should contains welcome user" do
    body = user.send_sms("909090990")
    expect(body).to include("welcome")
  end
end

as send_sms will call the send method which i have mentioned in let!
def send_sms

...

..

  body="welcome user"

  Message.send(contact, body)

end

so how to check with the body content is equal to welcome user ,
as send_sms doesn't return anything, so how to checks the value present in the body variable in rspec
Answer: You don't. Or rather you don't that easily. Most of the libraries like this should come together with test adapters and helpers to make such testing possible. If this one does not, you can only test that the message has been sent with correct arguments:
it "should contains welcome user" do
  allow(Message).to receive(:send)

  user.send_sms("909090990")

  expect(Message).to have_received(:send) do |_contact, body|
    expect(body).to include "welcome"
  end
end


Classical Probability Approach

Question: The definition of classical probability is

Classical Probability:  If a random experiment can result in $n$ mutually exclusive and equally likely outcomes and if $n_A$ of these outcomes have an attribute $A$, then the probability of $A$ is the fraction $n_A/n.$

In the book Mood, A. M., Graybill, F. A., & Boes, D. C. (1974). Introduction to the Theory of Statistics 1974. McGraw-Hill Kogakusha, it is written that

difficulty with the classical approach is encounterd when we try to answer the question: What is the probability that a child born in Chicago will be a boy?

Why can't classical definition answer it? Isn't it simply $0.5$, as the child's being a male or female is equally likely?
Comment: The first quotation isn't a definition at all: it's a formula for a *model.*  Should you choose to apply it, your first duty is to demonstrate that it is at least approximately correct--and that puts you right back to the beginning: what is "probability" in the first place and how do you measure it?
Answer: I think the classical definition is an idealization.  In the real world things are very rarely so tidy.  Child birth rates are actually a great example.  At first glance, people tend to think they are 50-50, but they are not!  More males are conceived (one theory is that sperm with the smaller Y chromosomes are slightly faster).  More males are miscarried, but not enough to completely undo the 'advantage.'
Answer: Firstly, you should not confuse the philosophical issue of defining the meaning of probability, with the statistical issue of estimating the probability of a particular event.  Merely defining the meaning of probability does not allow you to deduce the probability of a particular event.  The only way to assess the probability that a child born in Chicago is a boy is to look at data on sex-ratios at birth.  As you can see from this data, it is standard for there to be more males at birth than females, and hence it is unlikely to be true that the a birth of either sex is equally likely in Chicago.  Hopefully this kind of case alerts us to the danger of making a priori statements about probabilities of events, without looking for empirical data.
In relation to the classical formulation of probability, you will notice that it is a count-based method that relies on a pre-existing pre-probabilistic conceptual notion of what is "equally likely".  This is a major drawback of the classical formulation, since it defines probability in terms of a preliminary concept that is arguably a probabilistic determination.  In the quote you supply, the difficulty with assessing the probability of this event is that there is not a clear class of "equally likely outcomes" that can be used as a basis for the count.  The data we have show that male and female births are not equally likely.  (And in any case, if we are going to try to determine the probability of a male birth, we should not beg the question by assuming the answer a priori.)

Classical Probability Approach


Field Collection vs. Paragraphs

Question: I used Field Collection in my previous sites and I faced some performance issue, So this time I am looking a alternative for Field Collection. I find a answer Alternative to Field Collection.
but I can't find much on how different or similar these solutions specially [Field Collection and Paragraphs].
Maybe someone can help to explain? So that I can make a good decision.
Comment: do you got some advance with your research?
Comment: No, Not much still i am looking for some better alternative.
Comment: if you want you can read this http://drupal.stackexchange.com/q/121604/28275
Answer: In many respects the Paragraphs module appears to be a fork of Field Collection. Functionally, the difference between the modules lies in how their respective field widgets operate. The Field Collection widget allows users to embed multiple instances of a single field collection bundle in a node, while Paragraphs allows users to select a different bundle for each instance they embed using the Paragraphs widget. Both of these methods are extremely valuable and I now find myself combining field collections and paragraphs on the same node.
Read more in the issue about "Merge with Paragraphs module?".

Field Collection vs. Paragraphs


Users, subusers, and assigning subuser to multiple users

Question: I want the following functionality in Drupal 7: Create a few parent users/business representatives (e.g. Google, Microsoft); these business representatives will add their business profile, and add employees of that specific company, add/edit/delete them. An employee can be from multiple companies and all business representatives can edit/delete employee's profiles.
Employees can also log in, and manage their own profiles.
Which modules should I use?
Answer: There is a Subuser module to create subusers and a Profile2 module to create user profiles for every user.


Is Continuum Hypothesis false?

Question: The continuum hypothesis states that there is no set whose cardinality is strictly between that of the integers and the real numbers. However, it seems that it is possible to construct sets that consists of integers and some irrational numbers with cardinality lying in between the two. Here is an example.
If we define a set $\{f|(\exists x_1 \in \mathbb{Z}$ (set of integers)) $\wedge$ ($\exists x_2 \in \mathbb{Z^+}$ (set of positive integers)) $\wedge$ $ (f=x_1.\sqrt{x_2})\}$, then the members of the set can be obtained by writing the $x_1$'s and $x_2$'s along the vertical and the horizontal direction as follows:
<code>   1   2   3   4
</code>
1  $\ \sqrt{1}$, $\sqrt{2}$, $\sqrt{3}$, $\sqrt{4}$...
2 $\ 2\sqrt{1}$, 2$\sqrt{2}$, 2$\sqrt{3}$, 2$\sqrt{4}$...
3 $\ 3\sqrt{1}$, 3$\sqrt{2}$, 3$\sqrt{3}$, 3$\sqrt{4}$...
4 $\ 4\sqrt{1}$, 4$\sqrt{2}$, 4$\sqrt{3}$, 4$\sqrt{4}$...
.
Now, the above set consists of all the integers along with some irrational numbers. There are two possible arguments here:
Argument 1: If, we map all the integers to the set of integers then there are still remaining irrational numbers which are not mapped to any elements in the set of the integers. Using this argument, can we state that the above mentioned set has a cardinality that is at least greater than that of the set of integers? This argument as it seems might not be mathematically sound.
Argument 2: If we traverse the set (skipping any repeated elements) to show a one-to-one correspondence with the set of integers, can we say that this set also has the same cardinality as that of the set of integers. Does, this imply that any set that can be expressed exhaustively using integers (finite in number) has the cardinality same as that of the set of integers? Does this also hold for sets that can be expressed using countably infinite integers?
Note: The original argument of George Cantor regarding the cardinality of rational numbers can be obtained by defining a similar set of two variables $\{f|(\exists x_1, x_2 \in \mathbb{Z}$ (set of integers)) $\wedge$ $ (f\neq 0 \wedge  f.x_2=x_1)\}$. He also showed that the cardinality of the set of rational numbers is same as that of natural numbers using a similar approach.
The above mentioned argument can be extended to sets constructed using more variables with increasingly complex expressions as follows:
$\{f|(\exists x_1,x_2 \in \mathbb{Z}$) $\wedge$ ($\exists x_3 \in \mathbb{Z^+}$) $\wedge$ $ (f=x_1.e^{x_2}\sqrt{x_3})\}$
$\{f|(\exists x_1,x_2,x_3 \in \mathbb{Z}$) $\wedge$ ($\exists x_4 \in \mathbb{Z^+}$) $\wedge$ $ (f=x_1.\pi^{x_2}.e^{x_3}\sqrt{x_4})\}$
...
$\{f|(\exists x_1,x_2,x_3,...,x_{\infty} \in \mathbb{Z}$) $\wedge$ $ (f=\phi(x_1,x_2,...,x_{\infty}))=\mathbb{R}\}$ (set of real numbers expressed with an infinitely complex function $\phi(x_1,x_2,...,x_{\infty})$)
Is it possible to say that the set of real numbers can be obtained by a function of infinite complexity expressed using finite or countably infinite number of variables? Does, this imply that the set of real numbers also has the same cardinality as that of the set of integers which is in contradiction with the original proposition of Cantor that the set of real numbers has a larger cardinality than the set of integers. If this seems to be a contradiction then does that mean that all sets constructed using functions of increasing complexity with finite or countable infinite number of variables do not necessary have the same cardinality as that of the set of integers?
Is there any notion of complexity of a function on the basis of what portion of the set of real numbers does it capture in its range?
Comment: Argument 1 is not sound. You can map $\mathbb{Z}$ to $\mathbb{Z}$ by $x \mapsto 2x$, but just because it's not surjective, doesn't mean that $|\mathbb{Z}|$ is strictly greater than $|\mathbb{Z}|$. But Argument 2 is right: $\mathbb{Z}^n$ for any positive integer $n$ has the same cardinality as $\mathbb{Z}$. It doesn't hold for  countably infinite: $\mathbb{Z}^\mathbb{N}$ has the same cardinality as $\mathbb{R}$.
Answer: For any finite $n$, the set $\mathbb Z^n$ of all $n$-tuples of integers is countable, and therefore so is any set that can be obtained by applying some function to all the members of $\mathbb Z^n$.  That includes the first three of the four sets described in your question.
On the other hand, the set $\mathbb Z^\omega$ of infinite sequences of integers is uncountable; it has the cardinality of the continuum.  A set obtained by applying a function to all elements of $\mathbb Z^\omega$ is likely to be uncountable, but it might be countable if the function mapped lots of elements of $\mathbb Z^\omega$ to the same element.  So, without knowing what function is being applied to the infinite sequences, one cannot reach a definite conclusion about the cardinality of the resulting set.
Answer: Whatever function you define with domain an countable set, i.e., with cardinality $\aleph_0$, the cardinality of its image couldn't be greater than $\aleph_0$. So your set is still countable.
On the other hand, your $\phi$ function is actually $\mathbb{Z}^\omega\to\mathbb{R}$, i.e., the domain of which is sequences, so its image could be uncountable.
However, it was proved that CH is independent with respect to ZFC, so you cannot say it's true or false. Assuming ZFC is consistent, both ZFC+CH and ZFC+not CH are consistent.

Is Continuum Hypothesis false?


Explaining the terms of a 2nd degree polynomial equation

Question: This is a pretty basic question, but I have never thought about polynomials in this way before. I want to compare different polynomials of the form C0 + C1x + C2x^2 that I have generated from raw data. I am not a mathematician by degree, so I have never had to explain the theory behind a polynomial before. As an example, if only 1 of 5 polynomial equations I have generated has a negative value for c1 (the raw data are of the same type but from 5 different sources), how could I explain this? Is C1 more heavily affected by the mean of all of the data, or does the total range affect it more etc. I want a way to explain what each term (C0, C1, C2) is most affected by. Thank you.
Answer: I've also never thought about polynomials in this way before. There might be better explanations for specific formulas. But I dont think, there is a general explanation. Might this help?
f(x) = C0 + C1*x + C2*x*x

C0: The constant term. f(0) = C0
C1: The linear term. f(x) is approximatly C0+C1*x for small x
C2: The quadratic term. f(x) is approximatly C2*x*x for large x


Weak and strong computability of real numbers

Question: Let me adopt the following definitions:

A real number $x$ is weakly computable if it satisfies one of equivalent definitions given here.
A real number $x$ is strongly computable if the binary expansion of $x$ is a computable string (we don't need to worry about nonuniqueness of expansion for dyadics, since then both expansion are computable).

As it was explained to me in comments to this answer, these two notions are not equivalent, at least not in an obvious way, because if $x$ had some extremely good dyadic rational approximations, then we couldn't decide whether the binary expansion will contain $0111...$ or $1000...$. Here is my question:

Are there any known weakly computable reals which aren't strongly computable?

A possible, but unlikely, example is $\gamma$, for which we don't have any estimates on well-approximability (at least I don't know of any) of it. Of course many numbers are known to be strongly computable, and we know this because we can show that rational approximations can't be too good. To name a few examples: $\pi$, $e$, any algebraic number and actually any non-Liouville number.
I was thinking of constructing an example using Busy Beaver sequence to get long trails of ones and zeroes, but I didn't manage to get a number which would be weakly but not strongly computable.
Thanks in advance.
Comment: I'd be thankful for the downvoter to explain the reason behind their downvote so that I could improve my question.
Answer: The notions are equivalent;  say we have a real number $x$ that is not a terminating decimal number (a terminating decimal is both strongly and weakly computable), but is weakly computable.  Then there is a function $f(n)$ such that for every positive integer $n$, $\frac{f(n)}{n}$ is within $\frac{1}{n}$ of $x$. Let's say that $x$ has a binary expansion of $. d_1 d_2 \ldots d_m 0 0 \ldots 0 1 \ldots$, where the 1 is in the $n$th place.  To determine that the first $m$ digits of $x$ are $d_1 d_2 \ldots d_m$, we merely need to evaluate the function $f(j)$ for $j \ge 2^{n+1}$, since then we will have $x < \frac{f(j)+1}{j}$, so $\frac{f(j)}{j} > x - \frac{1}{j} > x - \frac{1}{2^{n+1}} > .d_1 d_2 \ldots d_m + \frac{1}{2^{n+1}}$.  So, we will know that $x$ is at least $\frac{f(j)}{j} - \frac{1}{j} > \frac{f(j)}{j} - \frac{1}{2^{n+1}} > .d_1 d_2 \ldots d_m$.  A similar argument works if $x$ is of the form $. d_1 d_2 \ldots d_m 1 1 \ldots 1 0 \ldots$.
The problem is, we don't know in advance what value of $j$ to choose.  So our algorithm is to choose a $j$, and if it doesn't determine the first $m$ decimal digits, keep increasing $j$ until it does.


The $n$-dimensional cube modulus its boundary is homeomorphic to an $n$-dimensional sphere

Question: Let ${I}^{n}$ denote the $n$-dimensional cube, $\partial{I}^{n}$ be its boundary and ${S}^{n}$ denote the $n$-dimensional unit sphere.
Now for a pointed space $(X,x_{0})$ the $n^{th}$$homotopy$ $group$ of $X$ is :

The set of homotopy classes of maps $f:({I}^{n},\partial{I}^{n}) \rightarrow (X,x_{0})$ such that the boundary $\partial{I}^{n}$ goes to the basepoint $x_{0}$ where a homotopy $f_{t}$ satisfies $f_{t}(\partial{I}^{n})=x_{0} \ \forall \ t\in[0,1]$.

Alternatively;

The set of homotopy classes of maps $g:({S}^{n},s_{0}) \rightarrow (X,x_{0})$.

Now this holds as $I^{n}\backslash\partial{I}^{n}$ is homeomorphic to $S^{n}$.
This is where I struggle. Is it true to say that from the second definition we would send $s_{0}$ to $x_{0}$ ( hence one point to one point) but in the first we would be sending the set of boundary points to a unique point $x_{0}$. This many-to-one and one-to-one difference in the mapping defined in the first and the second definition respectively, makes it hard for me to see that the two are alternative to each other since the difference in mapping makes it seem like two contrasting processes, even if I understand that it is an obvious consequence from the homeomorphism between the $I^{n}\backslash\partial{I}^{n}$ and $S^{n}$.
It would seem more natural for me if in definition 1 the mapping was from $f:({I}^{n}\backslash\partial{I}^{n},i_{0}) \rightarrow (X,x_{0})$ is that not possible?
Comment: It's not very clear to me what your issue is. You say you don't see that the two are equivalent, then you say that you understand it is an obvious consequence of something you seem to have no problem with.
Comment: This might help:
https://math.stackexchange.com/questions/24785/the-n-disk-dn-quotiented-by-its-boundary-sn-1-gives-sn
Note that $I^n \cong D^n$
Comment: I see why they are equivalent as a consequence of the homeomorphism, yet if I had to forget that I do know about the homeomorphism between the two it would be counterintuitive for me to say that such mappings are equivalent forms because of this main difference of "many-to-one" versus a"one-to-one" elements that are sent to the base point $x_{0}$. Hope that makes it more clear
Comment: What is your definition of $S^n$?
Comment: $S^{n}$ is the n-dimensional unit sphere ie. $\{x\in \mathbb{R} :\lvert \lvert x \rvert \rvert=1\}$
Comment: How good is your understanding of quotient maps and quotient topologies? Those are key concepts needed to answer your question.
Comment: @LeeMosher I'm familiar with quotient maps mainly from a Metric Spaces course I have previously done, I have a very basic knowledge of quotient topologies
Answer: You write that you are concerned that the function $I^n \mapsto S^n$ is many-to-one on the subset $\partial I^n$ and one-to-one on the rest of $I^n$. Well, that's exactly what the concept of quotient topology and quotient map are designed to do: it's not $I^n$ itself which is homeomorphic to $S^n$, its the quotient space $I^n/\partial I^n$ in which $\partial I^n$ is regarded as a single element, and each other element is regarded as a single point of $I^n - \partial I^n$.
To formalize this, the topological space denoted $I^n / \partial I^n$ refers to the quotient space of $I^n$ with respect to the decomposition of $I^n$ into the following collection of subsets:
$$\mathcal D = \{\partial I^n\} \cup \{\{x\} \mid x \in I^n - \partial I^n\}
$$
In words, each decomposition element of $\mathcal D$ is either the single subset $\partial I^n$ or a one-point subset $\{x\}$ as $x$ varies over $I^n - \partial I^n$. The underlying set of the quotient space $I^n / \partial I^n$ is simply the set $\mathcal D$ itself. The quotient map $q : I^n \to I^n / \partial I^n$ assigns to each $x \in I^n$ the unique element $q(x) \in \mathcal D$ such that $x \in q(x)$. The quotient topology is the strongest topology on $I^n / \partial I^n$ such that the function $q$ is continuous; equivalently, a subset $U \subset I^n / \partial I^n$ is open if, and only if, $q^{-1}(U) \subset I^n$ is open.
If we define the base point of $I^n / \partial I^n$ to be $i_0 = \{\partial I^n\}$, then to show that $(I^n / \partial I^n,i_0)$ is homeomorphic to $(S^n,s_0)$, one may use the universality property of quotient maps: it suffices to construct a surjective function $p : I^n \to S^n$ having the property that $p^{-1}\{s_0\}=\partial I^n$, that $p$ is otherwise one-to-one (i.e. it is one-to-one over the set $S^n - \{s_0\}$), and such that a subset $V \subset S^n$ is open if, and only if, $p^{-1}(V) \subset I^n$ is open.
Constructing the function $p$ is most easily done in two steps, first constructing a homeomorphism $(I^n,\partial I^n) \mapsto (D^n,\partial D^n)$ where $D^n$ is the closed unit disc in $\mathbb R^n$, and then following that by a quotient map $D^n \mapsto S^n$ which takes $\partial D^n$ to $s_0$ and is otherwise one-to-one.
Comment: You meant $I^n$ by $I$?
Comment: Thank you! This was very helpful
Comment: Yes, $I^n$. I'l edit.


Tweepy Cursor.items() not working as expected with api.retweeters

Question: I have some code that looks like this:
import tweepy
auth = tweepy.OAuthHandler(...)
auth.set_access_token(...)
api = tweepy.API(auth)
for e, i in enumerate(tweepy.Cursor(api.retweeters, '1157819926532501504').items()): # 1157819926532501504 is the id of https://twitter.com/NASA/status/1157819926532501504
    print(e, i)

When I run that, I get something like this:
0 3249595190
1 1678701169
2 34877330
...
86 625615049
87 1157852235381870592

If you look at https://twitter.com/NASA/status/1157819926532501504, you will see that the tweet has 3.2K retweets, whereas only 88 are getting printed out. Why is this? I'm using tweepy.Cursor, so pagination should take care of itself, no? I tried api.retweeters(id='1157819926532501504', cursor=-1) to see what was happening to the cursor, and I got a response like this:
([3249595190, 1678701169, ..., 625615049, 1157852235381870592], (0, 0))

Changing the cursor parameter doesn't change the response, neither does using the page parameter.
Am I misunderstanding fundamental? Does twitter not allow one to retrieve all of the retweeters for a tweet? Am I misunderstanding tweepy? I'd appreciate any help. Thank you!
Comment: Just ran into this myself. I think there is a limit to just one page for their free API. I'm still in the midst of searching or where this limit is specifically documented, but I can't get more than one page of retweeters.
Answer: There is a limit really:100. https://developer.twitter.com/en/docs/tweets/post-and-engage/api-reference/get-statuses-retweets-id
Unfortunately, it didn't always return 100. Sometimes, it returns just 40 ou 50 even if the tweet has 50k retweets.
Solutions:
1) Run a regular search with the exact same text of the original tweet. It's the best chance to retrieve more retweets. Retweets are returned on regular searchs too.
2) If the tweet is "fresh" and "hot" (with a lot of engagement), do several calls. You can get the most recent tweets with that.


Set Theory problem with unique numbers

Question: Let $A_0$ be the set {$1, 2, 3, 4$}. Let $A_{i+1}$ be the set of all possible sums which
can be obtained by adding two numbers in $A_i$ , where the two numbers do
not have to be different. How many unique numbers does $A_8$ contain?
Obviously, this seems very difficult to begin with. Without trial-and-error what can you do?
Comment: My hint would have been to calculate $A_2$ by hand.  Then you might have noticed for yourself what paw88789 pointed out.
Comment: @MJD, Wont it be natural to calculate $A_1$ first?
Comment: Yes, $A_1$, then $A_2$.
Comment: @MJD, will you assist me? $A_0$ = {1, 2, 3, 4} so $A_1 = ${2, 3, 4, 5, 3, 4, 5, 7, 4, 5, 7, 5, 6, 7, 8}

There is repitition? So how should I order this set $A_1$?
Comment: Sets never have repetition.  An element is either in a set, or it isn't.  The set $\{2,2,3\}$ is the same set as $\{2,3\}$, because each one contains 2, 3, and nothing else.
Comment: @MJD, Ah - so: $A_1$ = {2, 3, 4, 5, 6, 7, 8} Then what is the next step?
Answer: Hint:
It isn't too hard to show that if you form sums of two elements from a set of positive integers of the form $\{a, a+1, a+2,\dots, b\}$, your possible sums (allowing repetition) are $\{2a, 2a+1, 2a+2,\dots, 2b\}$.
Comment: From {$a, a+1, a+1, ... b$} how do you get to: {$2a, 2a  + 1....$} ?? (+1), good answer.

Set Theory problem with unique numbers


Conversion failed when converting date and/or time from character string [XAF ListViewFilter]

Question: I upgraded from framework to .NetCore with XAF 21.2.5
Now if I try to use the following ListViewFilter
 [ListViewFilter("Today",
        "[Created] >= LocalDateTimeToday()",
        "Today", true, Index = 0)]

on my business object which has properties
public DateTime Created { get; set; }

I get an error
  Microsoft.Data.SqlClient.SqlException
  HResult=0x80131904
  Message=Conversion failed when converting date and/or time from character string.
  Source=Core Microsoft SqlClient Data Provider
  StackTrace:
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

The docs indicate this should work
[Update]
After reading this question I started experimenting with
modelBuilder.Entity<MyEntity>().Property(x => x.Created).HasColumnType("datetime");

I am searching for the nullable one so as to map all the datetime properties.
Comment: have you made sure all data in db are valid dates?
Comment: I tried updating them all to the current date.
Comment: reading https://learn.microsoft.com/en-us/ef/core/modeling/entity-properties?tabs=data-annotations%2Cwithout-nrt
Answer: The solution turned out to be to add the following to the OnModelCreating
modelBuilder.Entity<MyEntity>().Property(x => x.Created).HasColumnType("datetime");

And to carefully check each declared property in the entity to ensure that I had whether or not it was nullable set correctly
I had an int? incorrectly declared as an int


How do you figure out how to optimize IPA compile size besides turning off Bitcode?

Question: I'm having a hard time tracking why my compiled project is so large.
Usually it's the assets that's the culprit but i have < 5mb worth of images, the entire project folder is only 10mb [including cocoapod projects], but when i archive it, the xarchive file is 150mb.
The IPA file is 75.5mb
The included frameworks not via cocoapods are: audiotoolbox, quartzcore and mapkit
EDIT
Turning off bitcode reduced the file size to 56.4mb.
It's still 5x's the size of the entire project.  What other optimization tricks are there??
Comment: Could you show a screen shot of the unzipped ipa as displayed in the Finder, with file sizes? Let's see what's in it.
Comment: I added some screenshots matt
Comment: oh whoops, my bad it's been updated, but thanks, now I will step through the frameworks to see what's eating up the space.  Thanks.
Comment: Ok but tell the Finder to show the sizes for folders like those Frameworks. We need all the numbers here.
Comment: Yep, end of story. It adds up perfectly.
Answer: IPA files are just zip files. You can unzip it and see what's so large.
Comment: libSwiftCore doesn't count against you for App Store. They'll optimize that out for you.
Comment: BitCode, while it looks larger, actually makes your project *smaller* when you distribute. You shouldn't turn that off generally. Apple uses it to repackage your code for specific platforms.
Comment: Hmm... so there's a payload folder with an application file in it that's 108.4mb [i can't unzip that], in the Swift Support folder, the only file that stands out is the libswiftCore.dylib file and that's 42.8mb.. **I have updated the sizes in the description.
Comment: @TimNuwin: If by "application file", you mean the .app (has a crossed out circle icon), that's just a directory; you can open it by right-clicking and doing "show package contents". If it's the actual binary (has a black rectangle console icon that says "exec"), that's different.
Answer: Whatever's taking up the space, it's evidently mostly those third party frameworks. And that means there's nothing you can do about it.
Comment: what are your thoughts on enabling BitCode, do they align w/ Rob Napier's thoughts too?

I'll only be targeting iPhones that are 8.0+
Comment: Have you watched the WWDC videos or read any of Apple's documentation explaining bitcode and app thinning? Even better, have you ever _experienced_ this — that is, do you ever download / update an app on your device, rather than through iTunes-plus-syncing? It makes the download smaller (though in _your_ case, the app is so bloated with third-party frameworks that, as you've already shown, the difference is not so dramatic).


how to do a keyboard interrupt of Python3 code in Spyder

Question: I have a simple but long loop in Python 3 that calls a simple function. I want to stop the execution, and that should be possible with Ctrl-C but that doesn't work. How to do this "manual keyboard interrupt"? I use Anconda3 for windows64, with Python 3.7.
Ctrl-C doesnt do anything, and also the red button in the IPython console doesn't do anything.
<code># -*- coding: utf-8 -*-
"""
Python3.7
Created on Wed Jul 24 12:59:31 2019
This proves that Ctr C doesn't work in Spyder
@author: Rob
"""

#%% loop in main program

def hello():
    print('Hello Spyder '+str(nr))

import time
nr = 0
while nr < 42:
    nr +=1
    hello()
    time.sleep(1)

#%% loop in function

def hello():
    nr = 0
    while nr < 42:
        nr +=1
        print('Hello Spyder '+str(nr))
        time.sleep(1)

import time
hello()
</code>
I expect the code to stop when using keyboard CTrl-C. But the code just keeps on executing til the end.
Answer: probably already solved this yourself, but try this.
<code>import time

i = 0

try:
    while i < 100:
        print (i)
        i = i + 1
        time.sleep(1)
except KeyboardInterrupt:
    print("interrupted")
</code>


Bracket of the Lie Derivative and Interior Multiplication. Proving the identity $\mathcal{L}_X \iota_Y - \iota_Y \mathcal{L}_X = \iota_{[X,Y]}.$

Question: This is problem 20.8 from Loring Tu's An Introduction to Smooth Manifolds.
Bracket of the Lie Derivative and Interior Multiplication.
If $X$ and $Y$ are smooth vector fields on a manifold $M$, prove that on differential forms on $M$,
$$\mathcal{L}_X \iota_Y - \iota_Y \mathcal{L}_X = \iota_{[X,Y]}.$$
Hint: Let $\omega \in \Omega^k(M)$ and $Y, Y_1, \dots, Y_{k-1} \in \mathfrak{X}(M)$. Apply the global formula for $\mathcal{L}_X$ to
$$(\iota_Y \mathcal{L}_X \omega)(Y_1, \dots, Y_{k-1}) = (\mathcal{L}_X \omega) (Y,Y_1, \dots, Y_{k-1}).$$
The global formula for the Lie derivative is
However, I can't figure out how to get this identity. I would greatly appreciate some help.
I have solved this problem. For convenience, denote $Y_0 := Y$. Applying the global formula to $i_YL_X\omega$ we get $X(\omega(Y_0,Y_1,\dots,Y_{k-1}))-\sum_{i=0}^{k-1}\omega(Y_0, \dots, [X,Y_i],\dots, Y_{k-1}).$
Meanwhile, $(L_X i_Y \omega)(Y_1, \dots, Y_{k-1}) = (L_X (i_Y \omega))(Y_1, \dots , Y_{k-1}) = X(i_Y \omega(Y_1, \dots, Y_{k-1})) - \sum_{i=1}^{k-1} i_Y \omega (Y_1, \dots, [X,Y_i], \dots, Y_{k-1}). $ Now we see that the first terms equate and the second terms vary only by a single term $-\omega([X,Y],\dots, Y_{k-1}),$ which is $-i_{[X,Y]}\omega(Y_1, \dots, Y_{k-1})$.
Comment: I believe it suffices to prove that they agree on 0-forms and 1-forms. Assuming you've shown they are both derivations (of the same degree) this is sufficient to conclude that they coincide (all forms can be written as a linear combination of wedges of 0-forms and 1-forms).
Answer: $L_X\omega(Y_1,...,Y_k)=X.\omega(Y_1,...,Y_k)- \omega([X,Y_1],..,Y_k)-..-\omega(Y_1,..,[X,Y_k])$
implies that
$i_YL_X\omega(Y_1,..,Y_k)=$
$=X.\omega(Y,..,Y_k)-\omega([X,Y],Y_2,..,Y_k)-\omega(Y,[X,Y_2],..,Y_k)-..-\omega(Y,Y_1,..,[X,Y_k])$. ($Y_1$ is replaced by $Y$).
$i_Y\omega(Y_1,..,Y_{k-1})=\omega(Y,Y_1,..,Y_{k-1})$ implies that
$L_Xi_Y\omega(Y_1,..,Y_{k-1})=$
$=X.\omega(Y,Y_1,...,Y_{k-1})-\omega(Y,
[X,Y_1],Y_2,..,Y_{k-1})-..-\omega(Y,Y_1,..,[X,Y_{k-1})$.
We deduce that
$L_Xi_Y-i_YL_X=i_{[X,Y]}$.


how to write search method code to search more than one id at a time

Question: In my project am trying to display products based on user choice. User can check which department(women, men and kids) and category (dress, tops, tees etc) they wish to see. For this am using check box. If user checks(selects) only women departments they all products which belongs to women will be displayed. If user checks(selects) both women department and dress category then the products which belongs to both women department and dress category will be displayed. If user selects both women and men departments and shoes category then all products which belongs to women and men department and shoes category will be displayed. To achieve this am using solr (sunspot gem). My question is can we pass multiple ids for department_id and category_id at the same time.
For example is it possible to
<code>@search_res=ProductDetail.search do
  with :department_id, 1,2,3
  with :category_id, 1,2,3,4, etc (may be present or absent)
end
</code>
If it is possible please tell me how to do? Please give me syntax? Please help me.
Update
Thank you Salil for your answer, but department id and category id's are not static in this case. I will came to only when user selects at runtime. Means category_id and department_id's are generic. How to achieve this. I want something like this
<code>@search_res=ProductDetail.search do
  with :department_id, params[:deptid]
  with :category_id,   params[:catid]
end
</code>
Please help me.
Answer: Here it is:
<code>@search_res=ProductDetail.search do
  all_of do
    with :department_id, [1,2,3]
    with :category_id, [nil,1,2,3,4] # I am not sure - but category_id nil should be to denote its absence
  end
end
</code>
Refer for more info:
sunspot readme


DHCP Admin Member account not displaying scope

Question: I made a domain name test.com on serv1 computer with dc and dns roles.  On serv2 pc i added it to the domain and added the role of dhcp with 1 scope and authorized it and it is working fine.
I created a new user name email@example.com and added it to the DHCP Administrators Group (proof: http://clip2net.com/s/1rQm8), I am able to log in into serv2 with this account but when I open the dhcp console I am not able to see the scope and other options.  Here is the image of dhcp when when i log in as email@example.com account "http://clip2net.com/s/1rQja".
It is a fresh setup on both pc hence not many changes are made, all of them are default.
Could you please tell me where I have gone wrong on this test bed.
Answer: User must be enrolled as member of DHCP admin group on that local machine too where DHCP role is to be administered.


Windows batch file executes some commands that return output over and over

Question: I tried to put commands that return output into batch file. When I run the batch file it executes the command over and over until I cancel with CTRL+C.
I observed this behavior in Windows CE, Windows XP, Windows 7 and Server 2003. At first I thought I made a mistake with LDIFDE but the same thing goes for PING.
Is there something I missed with batch scripting?
The file contains one line:
ping google.com

Comment: Without knowing the contents of the batch script, this question is going to be impossible to answer :-)
Comment: That's odd, how are you executing the batch script? Without some sort of looping control structure it shouldn't be doing this ...
Comment: Surely I isolated it to one command only.
Comment: I am sorry I left this detail, It seems obvious - I placed only one command in the batch file to isolate the issue.
Comment: I've seen this before a long time ago, but I can't recall what it was. I think it had something to do with it not seeing ping as a command. I also see your runnign this from `D:\Desktop`. Post your batch file so we can help.
Comment: I updated the question: The blockquote is the batch file
Answer: I.think you named your script ping.bat or ping.cmd and it is calling itself.
This happens because of a design decision that was introduced in DOS 2.0.  On MS-DOS, Windows, and MS-DOS clones and derivatives, the current directory is first in the search path.  When DOS is searching for a command it first checks to see if it an internal command, built into command.com (e.g. echo, copy) then it searches the filesystem.  It always starts with the current directory, and then it looks in directories defined in the PATH variable.
You have a couple options:

Rename the script.
Simply include the file extension in your script so it is ping.exe google.com
Use the full path to ping %SystemRoot%\system32\ping.exe
Comment: +1 Nice catch.  Worked for me because I specifically DIDN'T do that.
Comment: Wow, I would have never guessed that.  Nice one!
Comment: THATS IT! Good observation! I've been naming the batch files the same as the command. Thanks a lot!


System.Runtime.Remoting.RemotingException no Designer XAML VS2015

Question: Estou com um problema no Visual Studio. Quando eu crio um novo projeto UWP10 em branco, ele vem o o código básico.
<Page
    x:Class="FoxMovieStoreMain.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:FoxMovieStoreMain"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    </Grid>
</Page>

E o designer mostra o preview da Page normalmente. Porém ao substituir o código XAML por esse:
<Page x:Name="AppMainPage"
    x:Class="FoxMovieStoreMain.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:FoxMovieStoreMain"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid x:Name="GridToMainPage">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <RelativePanel x:Name="RelatMainPanelTop" Background="#FFFF6800">

            <Button x:Name="HamburgerMenuButton" Content="" FontFamily="Segoe MDL2 Assets" FontSize="22" VerticalAlignment="Stretch" Background="#FFFF6800" Height="39.5" Width="{Binding CompactPaneLength, ElementName=MainSplitView}"/>
            <TextBlock x:Name="NavigationTitle" Text="Início" RelativePanel.RightOf="HamburgerMenuButton" Margin="10,0,0,0" FontSize="30" FontWeight="Bold"/>
            <TextBox x:Name="MainSearchTextBox" Width="200" PlaceholderText="Buscar" RelativePanel.AlignVerticalCenterWithPanel="True" RelativePanel.LeftOf="MainSearchButtom"/>
            <Button x:Name="MainSearchButtom" Content="" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignVerticalCenterWithPanel="True" FontFamily="Segoe MDL2 Assets" FontSize="20" Margin="0,0,10,0"/>

        </RelativePanel>
        <SplitView x:Name="MainSplitView" Grid.Row="1" DisplayMode="CompactOverlay" CompactPaneLength="46.4" OpenPaneLength="{Binding ActualWidth, ElementName=MainSplitViewListView}">
            <SplitView.Pane>
                <RelativePanel x:Name="MainSplitRelativPanel">

                    <ListView x:Name="MainSplitViewListView">
                        <ListViewItem x:Name="HomeSplittem" HorizontalAlignment="Left">
                            <StackPanel x:Name="HomeStackPanelViewItem" Orientation="Horizontal">
                                <TextBlock x:Name="HomeIconSplitItem" FontFamily="Segoe MDL2 Assets" FontSize="22" Text="" VerticalAlignment="Center"/>
                                <TextBlock x:Name="HomeTextSplitItem" FontSize="22" Text="Início" Margin="11,0,0,0"/>
                            </StackPanel>
                        </ListViewItem>

                        <ListViewItem x:Name="PersonsSplitItem" HorizontalAlignment="Left">
                            <StackPanel x:Name="PersonsStackPanelViewItem" Orientation="Horizontal">
                                <TextBlock x:Name="PersonsIconSplitItem" FontFamily="Segoe MDL2 Assets" FontSize="22" Text="" VerticalAlignment="Center"/>
                                <TextBlock x:Name="PersonsTextSplitItem" FontSize="22" Text="Pessoas" Margin="11,0,0,0"/>
                            </StackPanel>
                        </ListViewItem>

                        <ListViewItem x:Name="MediaSplitItem" HorizontalAlignment="Left">
                            <StackPanel x:Name="MediaStackPanelViewItem" Orientation="Horizontal">
                                <TextBlock x:Name="MediaIconSplitItem" FontFamily="Segoe MDL2 Assets" FontSize="22" Text="" VerticalAlignment="Center"/>
                                <TextBlock x:Name="MediaTextSplitItem" FontSize="22" Text="Mídias" Margin="11,0,0,0"/>
                            </StackPanel>
                        </ListViewItem>

                        <ListViewItem x:Name="MovementsSplitItem" HorizontalAlignment="Left">
                            <StackPanel x:Name="MovementsStackPanelViewItem" Orientation="Horizontal">
                                <TextBlock x:Name="MovementsIconSplitItem" FontFamily="Segoe MDL2 Assets" FontSize="22" Text="" VerticalAlignment="Center"/>
                                <TextBlock x:Name="MovementsTextSplitItem" FontSize="22" Text="Movimentações" Margin="11,0,0,0"/>
                            </StackPanel>
                        </ListViewItem>

                    </ListView>
                </RelativePanel>
            </SplitView.Pane>
            <Frame x:Name="MainSplitViewFrame" FocusVisualPrimaryBrush="{x:Null}"/>
        </SplitView>
    </Grid>
</Page>

O Designer gera o erro:

Isso só acontece com o meu código, se eu voltar o código anterior o designer volta a funcionar.
Answer: Em algumas pesquisas que fiz parece ser bug no VS
Quando cola o código completo trava:

Depois, adicionando em pequenas partes, o XAML funcionou:

Adicione tags vazias e em pequenas partes <Grid>, etc,
Salve, faça reload no Xaml
os ListViewItem pode copiar o conteúdo completo.
Comment: Verdade, bug grotesco, :-\. Na verdade esse código é parte de um projeto que já estava funcionando quando o designer parou do nada apresentando o erro da imagem. Então para verificar se o problema era com meu código XAML criei um projeto em branco para testar e colei o código lá, mas o erro se repetia.


Characteristic chords of a mode/scale

Question: What makes a chord a characteristic chord of a mode? Apparently, the characteristic chords of Lydian is I and II, why is that? Why not, for instance, vii, as Lydian is the only mode that contains a vii?
Comment: What source are you using  for this information?
Comment: If my calculations are correct, you can only play 6 different notes with two triads, so whichever two triads you choose, one of the seven notes is left out. If you make it II 6, then the missing note gets exposed? It's an approximation and opinion anyway. If you read the text surrounding this chart in wherever it was taken from, you may find a description of what the chart is meant for, who made it etc.
Comment: @Tim https://youtu.be/AAxZzySz_UE?t=403
Comment: Have a listen to  the whole thing. I don't necessarily agree with his dark/darker ideas, though. Seems somewhat subjective.
Comment: Wait, so there is no such thing as a characteristic chord?
Answer: There is never one chord isolated  characteristic for a mode. It's always the position in a progression and its specific function.
I just  can tell you some examples - knowing there are more others. I'll choose the key of C major.

D- Dorian versus d-minor: the major sixth of the Dorian scale is the major 3rd of the IV. So in dorian you may think we are in d-minor but then the "subdominant" would be G,B,D = a major chord, but we would expect a minor iv, so the characteristic chord is the IV degree.
Mixolydian: similar to G-major, I = G,B,D IV = C,E,G but the characteristic chord is built by the minor 7th which is the minor 3rd of the expected dominant chord which now is a minor v.

So we could go through all modes:
 As you see I would list  all cadences  and compare them with the major I IV V I and minor i-iv-V-i.

Dorian: i IV v i versus minor
Mixolydian: I IV v I and also bVII versus major

In the same way you can compare all other modes and find zhe characteristic chords.

Characteristic chords of a mode/scale


Prove that for $m_i >0$ $\frac{n \sum_{i=1}^{n}\frac{1}{m_i}}{\sum^{n}_{i=1}m_i}< 1$

Question: Suppose that $m_i >0$ for all $i=1,...,n$
How can I prove that
$\frac{n \sum_{i=1}^{n}\frac{1}{m_i}}{\sum^{n}_{i=1}m_i} < 1$?
Comment: Taking $m_1 = 0.5, m_2 = 0.5$ is a counter example
Comment: I think you can conclude with Jensens inequality that
$$
\frac{n}{\sum_i m_i} \leq \frac{\sum_i 1/m_i}{n}
$$
Answer: If all the $m_i=m$,
the expression is
$\frac{n^2/m}{nm}
=\frac{n}{m^2}
$ which can take any value
by choosing $m$
appropriately.
So the inequality is false.


Can't understand this remainder solution

Question: The problem is:

$W$ is a positive integer when divided by $5$ gives remainder $1$ and when divided by $7$ gives remainder $5$. Find $W$.
Answer: Take the larger divisor , So Expression becomes $7k+5$. Now this number when divided by $5$ gives remainder $1$ so expression becomes $7k+4$ which is divisible by $5$. Now plugging in values for $k$ as $0,1,2,..$ we get $7(3)+4$ which is divisible by $5$ so $k=3$.
I know that
$\frac{W}{5} => remainder~1$ so $5q+1=W$
$\frac{W}{7} => remainder~5$  so $7k+5=W$
Edit:
Now I know that $5q+1 = 7k+5$
This implies $q=\frac{7k+4}{5}$
Now how did the text assume that $7k+4$ is divisible by $5$ and there would be no remainder?
Comment: $5k+1=7K+5 \Rightarrow 5k=7K+4$
Answer: If $7k+5$ leaves a remainder of 1 when divided by 5, then $7k+4$ leaves a remainder of 0 when divided by 5, and so is divisible by 5.
To say that a number, say $7k+5$ "leaves a remainder of 1 when divided by 5" is exactly to say that it has the form $5q+1$ for some integer $q$.  So we have $7k+5=5q+1$ for some integer $q$, and so $7k+4 = 5q$. Therefore $7k+4$ is a multiple of 5.
In general, of $x$ leaves a remainder of $r$ when divided by $n$, then $x-1$ leaves a remainder of $r-1$, unless $r=0$.
Comment: Could you explain "7k+4 leaves a remainder of 0 when divided by 5" a bit in detail..
Comment: I hope this elaboration makes it clearer.
Comment: Yes thanks for the explanation.
Answer: Hint $\rm\ \, 7k+5\, =\, 5\, q + 1\:\Rightarrow\: 7k+4\, =\, 5\,q,\ $ i.e. $\rm\:5\:|\:7k+4.$
Remark $\ $ You may find helpful my posts on Easy CRT.
Comment: Thanks for your post. Could you briefly explain what $5|7k+4$ means ? links ?
Comment: @Rajeshwar $\rm\ M\:|\:N\:$ means $\rm\:M\,$ divides $\rm\,N\ $ (standard number theory notation)
Comment: Thanks but I still dont get how the text assumes that 7k+4 is completely divisible by 5 ?
Comment: @Rajeshwar It follows by subtracting $1$ from both sides of my first equation above (which says that $\rm\:W = 7k+5\:$ has remainder $1$ when divided by $5).$
Comment: Just added to my question..


How do i print each line in a .txt file one by one in a while loop in python

Question: Ok so, lets say i have data from a .txt file here:
ToddShields74

GeorgeGutierrez18

ReginaHenry71

JohnBlair34

PaigeKirby47

...

Now, i want a python code that will print each line one by one in a loop, for example:
while/if (imagine some random thing here):
print(line1 of the text file)

(obviously not a real code but presenting what i need.)
Then the next loop should print the next line, and the next, until it has printed all the lines in the file
Help is really appreciated!
Comment: This is very basic stuff. You're much better off going through some tutorials than posting here. You can [`open`](https://docs.python.org/3/library/functions.html#open) files, iterate with a for loop and [`print`](https://docs.python.org/3/library/functions.html#print)
Comment: Please update the question with the research you've already carried out. Where *exactly* do you need help? Happy to help with *specific* questions; yet not willing to just hand out code, without seeing diligent effort on your part.
Answer: You can simply open the file and iterate through it:
file_name = "file.txt"

with open(file_name) as f:
    for line in f:
        print(line.strip()) # strip to remove extra newline after each line
        # whatever else you want to do


Prove that $ \lim\limits_{z \to 0} \frac{1}{z}= \infty$ and $ \lim\limits_{z \to \infty} \frac{1}{z}=0$

Question: Prove that $ \ \lim_{z \to 0} \frac{1}{z}= \infty \ $ and  $ \ \lim_{z \to \infty} \frac{1}{z}=0 \ $ .
Answer:
Let  $ z=x+iy \ $ . Then   $ \ z \to \ $ implies   that $ \ x+iy \ \to \ 0 $ , which implies $ (x,y) \to (0,0) \ $.
Now,
$ \lim_{z \to 0} \frac{1}{z} \\ = \lim_{(x,y) \to \infty} \frac{1}{x+iy} \\ = \lim_{(x,y) \to 0} \frac{x-iy}{x^2+y^2} \\ = \lim_{(x,y) \to 0 } \frac{x}{x^2+y^2} -i \lim_{(x,y) \to 0} \frac{y}{x^2+y^2} \\ = \lim{(x,y) \to 0} \frac{1}{2x+2y}-i \lim{(x,y) \to 0} \frac{1}{2x+2y}  \\ =  \infty -i \infty \\ = \infty $
Am I right ?
Any help ?
Comment: So this is about the *one-point* compactification of $\Bbb C$? What is the definition of $f(z)\to\infty$?
Comment: ... what book are you reading?
Comment: The first is a false statement. $1/z$ approaches $\infty$ on the real axis from the right, but approaches $-\infty$ on the real axis from the left. It is true however that the limit does not exist.
Comment: it is from  a  competitive book question of limits in complex analysis
Comment: @MANMAID The restriction $\theta\ne2k\pi$ seems ludicrous, why mention it?
Comment: You are not right.
Comment: but how ? I can not find the fault. can you reason ?
Comment: One can suspect that the crucial step $$\lim_{(x,y) \to 0 } \frac{x}{x^2+y^2}= \lim{(x,y) \to 0} \frac{1}{2x+2y}$$ which should actually read $$\lim_{(x,y) \to (0,0) } \frac{x}{x^2+y^2}= \lim_{(x,y) \to (0,0)} \frac{1}{2x+2y}$$ is yet again another malfeasance of the nefarious so-called "L'Hopital rule".
Answer: If $z \rightarrow 0$, then you've been given a a sequence of complex numbers $ \{z_i\}$ having the property that all but finitely many of them are in a neighborhood of zero.  Now choose (a real number) $B > 0$.  Then for all but finitely many $z_i$, $|1/z_i| > B$.  This shows your first claim.
Now  $z \rightarrow \infty$ means that for any $B > 0$  all but finitely many of the $z_i$ have $|z_i| > B$.  Now fix $\epsilon > 0$.  You need to show that all but finitely many $z_i$ satisfy $|1/z_i| < \epsilon$.  Well, this is true for the $z_i$ such that  $|z_i|> B = 1/\epsilon$.  And that fact is true for all but finitely many of these $z_i$.


ASP.NET MVC 5 form doesn't send table rows details(with jQuery datatables 1.10.15)

Question: I created view with form that included table with rows that initialize from list, the table designed with jQuery.datatables 1.10.15.
When I tried to send the form then the table not send, I get null in the list parameter in the action controller.
View page:
@model List<SendMails.ViewModels.ViewModelDetailsFile>
@{
    ViewBag.Title = "UpdateItems";
}

@using (Html.BeginForm("UpdateItems", "Home", FormMethod.Post)) {
    @Html.AntiForgeryToken()

                IndexRow
                InvoiceNumber
                NumberClient
                NameClient
                Amount
                Email
                ContactPerson
                Details

            @if (Model != null)
            {
                for (var i = 0; i < Model.Count(); i++)
                {

                        @Model[i].IndexRow
                        @Model[i].InvoiceNumber
                        @Model[i].NumberClient
                        @Model[i].NameClient
                        @Model[i].Amount
                        <input type="email" id="Email" name="Email" value=@Model[i].Email />
                        <input type="text" id="ContactPerson" name="ContactPerson" value=@Model[i].ContactPerson>
                        @Model[i].Details

                }
            }

        <button type="submit" class="btn btn-primary">send</button>

}

JS file:
$(document).ready(function () {
    var dataTable = $("#DetailsExcelChoose").DataTable();
});

Controller action:
[HttpPost]
[ValidateAntiForgeryToken]
[Route("UpdateItems")]
public async Task<ActionResult> UpdateItems(List<ViewModelDetailsFile> iObjsUpdate)
{
    /// iObjsUpdate is null
}

I read that need to set the name attribute for the asp.net know what the columns are...
But all my searching in google not success.
If I didn't clear what I want so... I want to send the rows details to controller action as list of object (yes I know that I can do this in ajax but I want in this way)
Answer: For send or post row details to controller you have to use hidden fields on .cshtml or view page.
 try this
for (var i = 0; i < Model.Count(); i++)
   {

         @Html.HiddenFor(x => x.Model[i].IndexRow)
         @Html.HiddenFor(x => x.Model[i].InvoiceNumber)
         @Html.HiddenFor(x => x.Model[i].NumberClient)
         @Html.HiddenFor(x => x.Model[i].NameClient)
         @Html.HiddenFor(x => x.Model[i].Amount)
         @Html.HiddenFor(x => x.Model[i].Email )
         @Html.HiddenFor(x => x.Model[i].ContactPerson)
         @Html.HiddenFor(x => x.Model[i].Details)

         @Model[i].IndexRow
         @Model[i].InvoiceNumber
         @Model[i].NumberClient
         @Model[i].NameClient
         @Model[i].Amount
         <input type="email" id="Email" name="Email" value=@Model[i].Email />
         <input type="text" id="ContactPerson" name="ContactPerson" value=@Model[i].ContactPerson>
         @Model[i].Details

   }

Comment: Thanks it's work but the email and contact person didn't send
Comment: You can help me with the other problem


How to create a relative symlink without changing directory?

Question: I have directory factory under which I have app dir app_1_2_3_4. I want to create a symlink under factory for app -> app_1_2_3_4 from /home/user/ dir without using os.chdir(), just like this. Don't want full path in link.
user@ubuntu % ls -l factory/
total 0
lrwxrwxrwx@  1 user  user   13 Mar 15 04:27 app -> app_1_2_3_4
drwxrwxr-x@ 18 user  user  576 Mar 18 17:09 app_1_2_3_4

I tried this in python
import os

app_dir_path = '/home/user/factory' + '/' + 'app'
app_dir_ver_path = '/home/user/factory' + '/../' + 'app' + '_{}_{}_{}_{}'.format(major, minor, bugfix, build)
os.symlink(app_dir_ver_path, app_dir_path)

But this one creating symlink with full path
user@ubuntu % ls -l factory/
total 0
lrwxrwxrwx@  1 user  user   13 Mar 15 04:27 app -> /home/user/factory/app_1_2_3_4
drwxrwxr-x@ 18 user  user  576 Mar 18 17:09 app_1_2_3_4

What I am missing here?
Comment: check: https://stackoverflow.com/questions/169070/how-do-i-write-a-decorator-that-restores-the-cwd
Comment: also, never user '/' or '..', us the os methods / helpers like os.path.relpath, os.path.join os.sep, os.pardir ...
Comment: you forgot `major, minor, bugfix, build = 1, 2, 3, 4`
Answer: Simply leave out the directory.
$ ls -l factory
total 0
-rw-r--r-- 1 user user 0 mar 18 18:06 app_1_2_3_4

$ python
>>> import os
>>> os.symlink('app_1_2_3_4', 'factory/bar')
>>> quit()

$ ls -l factory/bar
lrwxrwxrwx 1 user user 11 mar 18 18:10 factory/bar -> app_1_2_3_4

By the way, ln -s works the exact same way:
$ ln -s app_1_2_3_4 factory/foo

$ ls -l factory/foo
lrwxrwxrwx 1 user user 11 mar 18 18:09 factory/foo -> app_1_2_3_4

Answer: os.symlink() takes an argument dir_fd which is a directory descriptor, from the docs:

If dir_fd is not None, it should be a file descriptor referring to a directory, and the path to operate on should be relative; path will then be relative to that directory.

You can acquire a directory descriptor with help of os.open(), see below.
(Ideally you also want to use f-strings and os.path.join() when joining paths.)
import os

# Assuming you are getting 'app_dir_ver_path' from somewhere else
# and 'major', 'minor', 'bugfix', 'build' are defined.
# "/home/user/factory/app_1_2_3_4"
app_dir_ver_path = os.path.join(
    /home/user/factory,
    f'app_{major}_{minor}_{bugfix}_{build}'
)

# Get the directory where the symlink is supposed to be created:
# "/home/user/factory"
app_dir_ver_name = os.path.dirname(app_dir_ver_path)

# Get the name of the directory to be linked:
# "app_1_2_3_4"
app_dir_ver_base = os.path.basename(app_dir_ver_path)

# Get the directory desciptor:
dir_fd = os.open(app_dir_ver_name, os.O_RDONLY)

# Full path for the symlink:
# "/home/user/factory/app"
app_dir_path = os.path.join(app_dir_ver_name, 'app')

os.symlink(src=app_dir_ver_base, dst=app_dir_path, dir_fd=dir_fd)

Run from anywhere on the system, creates symlink in /home/user/factory:
ls -l /home/user/factory/
lrwxrwxrwx@  1 user  user   13 Mar 15 04:27 app -> app_1_2_3_4
drwxrwxr-x@ 18 user  user  576 Mar 18 17:09 app_1_2_3_4

Comment: `app_dir_ver_name` is `app_dir_name`, no?


IIS SMTP and TLS 1.2

Question: Is it possible for SMTP on IIS to use TLS 1.2?  We are using Windows Server 2012 R2.  According to PCI-DSS requirements, we should be migrating all TLS connections to version 1.2.  I am not referring to the websites in IIS themselves, but the SMTP service.  While using IISCrypto, I limited TLS to 1.2, and it caused our SMTP with TLS connections to fail.  It does not work with version 1.1 either.  Only TLS 1.0 seems to work.
I have not been able to find any definitive answers regarding SMTP and TLS 1.2.  I am open to suggestions, but please keep in mind that budget is a concern.
Thank you in advance.
Comment: What are you using the SMTP service for? It's hard to offer suggestions, or know why it might break with TLS 1.2 if we don't know what you are using it for.
Comment: The iis SMTP is extremely limited, you should use postfix or exchange or an email API solution like mailgun
Comment: @Appleoddity, we are using it to send outbound mail.  I'm not sure what else is to be answered there.
Comment: @JacobEvans, Thank you for the answer.  I feared it was such an answer. We'll do some research to find a cost-effective solution that has high rate limits.
Comment: Look at AWS SES.
Comment: Postfix in docker :)
Answer: Based on @JacobEvans comment, it looks like it would be best to use something other than IIS SMTP.

IIS SMTP and TLS 1.2


Content type for multi-part request in soap web services

Question: I am writing a Java client to call a SOAP web service.It accepts a file as an attachment so in java, I need to declare the content type as multipart.I am using apache http library to write Java client.
I specified it i Java as below

httppost.setHeader( "Content-Type", "multipart/related" );

but I got the below error
Couldn't create SOAP message due to exception: javax.xml.ws.WebServiceException: MIME boundary parameter not foundmultipart/related

Please let me know how to resolve this error. What should be the content type to be specified in Java.
When I specified it as
httppost.setHeader( "Content-Type", "text/xml; charset=utf-8" );

Again, i got the below exception
 Caused by: com.sun.xml.ws.streaming.XMLStreamReaderException: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '<'

Which one should i go ahead with and how to resolve the respective exception?
Answer: I assume you are trying to use MTOM+XOP?
The first error is clear: you have no boundary. A multipart is more than simply a content-type, it requires you to mark the different parts with a boundary that has to be declared in the headers and requires linefeeds etc to be in the correct place.
Secondly, you can't just send a file to a SOAP endpoint if that is what you are trying to do, you need to have a soap body in the first part that references the file in the second part.
Comment: I am using apache http library. could you please let me know how to do it
Comment: For effective MTOM+XOP interaction, you need to a know a lot beyond multipart, please read up on it first.
Comment: I am not using MTOM/XOP. There is already a service written. I just need to call it using Java code and apache http library. I am currently stuck with File attaching part. May be I am setting content type incorrectly or anything related to it.


What is the correct way to notate a no3/sus chord?

Question: If I have a chord made up of the root, 5th, 7th and 9th intervals, what would be the correct way of notating this? I have seen two different conventions that are as follows:
CMaj9 (sus)
or
CMaj9 (no3)
Is there a favoured convention? Or could one even do something like:
C5 (add7,add9)
or
Cmaj7 (sus9)
Thanks for any help!
Answer: If you want those exact chord values (root, 5th, 7th and 9th), depending on the key, for your chosen chord (Cmaj9) I would write it as G/C. As soon as I see Maj in a chord I immediately think that the chord has a major third in it.
Comment: Me too. I like G/C.
Comment: @Numpy Root, 5th and 7th I write as Cmaj7 (no3).
Comment: How would you notate just the root, 5th and 7th for example?
Comment: I agree, Cmaj7 (no3), but to be honest, i have rarely, if ever, come across a situation where that is required. I suppose you could write Cmaj7sus, but it implies a suspended 4th or 2nd. Depends on the context and if its a notated piece of music or a chord chart.
Answer: The term sus is used to indicate something other than the 3rd of the chord and shouldn't be used by itself, it should have a number after it:
sus4 = 4 instead of 3
sus2 = 2 instead of 3
In this case I would opt for Cmaj9 (no 3)
or G/C a G triad with a C in the bass.
I suppose Cmaj7 (sus2) could also work but that chord spelling is unusual.
Always opt for clarity and simplicity, your last 2 choices complicate things a bit, plus I've never seen anything other than sus2 or sus4 in any rhythm part or published music that I can recall.
Comment: I've seen sus on its own enough as a shorthand for sus4 that I would imagine this is a pretty standardized notation. But sus on its own certainly doesn't mean what the OP thinks it does.
Comment: @DonHosek I too have seen sus as shorthand for sus4 on charts many, many times and sus4 is probably used at least 20/1 over sus2 but the fact is the 4 should be there for clarity so that's why I explained it the way I did.
Comment: Thanks for your comments guys. For reference, here is where I saw the sus notation mentioned in my question. Try setting the notes to A, E, G# to find what their algorithm calls the chord.
https://www.scales-chords.com/chordid.php
Comment: @Numpy My pleasure, hope my answer helped you even though some nameless person dinged me with a -1. I experimented a bit with that page and any chord that doesn't have a 2 3 or 4 in it is generically labeled a "sus". Other than that it seems to work ok.
Comment: @OldBrixtonian - I usually wonder why something has been downvoted. It's not only polite, but useful to give a valid reason. Sadly, it rarely happens.


Practice PSAT Question About Rational Functions

Question: This is taken directly from a PSAT Practice Test:

$f(x)=\dfrac{2x-4}{2x^2+2x-4}$
  A rational function is defined above. Which of the following is an equivalent form that displays values not included in the domain as constants or coefficients?
A) $f(x)=\dfrac{x-2}{x^2+x-2}$
B) $f(x)=\dfrac{2(x-2)}{2(x+2)(x-1)}$
C) $f(x)=\dfrac{1}{x+1}$
D)$f(x)=\dfrac{1}{2x^2}$

My understanding is that this question is asking for the form that includes $-2$, and $1$ as either a coefficient or constant, and is equal to the original equation. Both A and B seem to satisfy this, both of them have $-2$ as a constant, and 1 as a coefficient.
The answer key in the back says it is B, but I and a few of my teachers thought it was A, since A was a simpler version of B. What are we doing wrong here?
Comment: In option A, I see both the constant $-2$ and the coefficient $1$. In option B, I do not see the coefficient $1$.
Comment: @barakmanos Ah, my bad. I meant to say "...includes -2 and 1 as either ..." up above.
Answer: Factoring the denominator, as in (b), displays the values not included in the domain plainly.  It's clear by inspection that $-2, 1$ aren't in the domain when looking at choice (b), whereas it's not in (a).
Comment: Choices (a) and (b) are the same function as in the question, but (b) "displays" $-2, 1$, while (a) doesn't. It's not the best question in the world, but that's all I've got for you! :)
Comment: Ah, okay. I see that "display" might be the keyword here. A _does_ have some coefficients of $1$,but since it is $1$,  they don't bother _displaying_ it and therefore doesn't count. Thank you. :)
Comment: But isn't the question asking if -2 and 1 are constants and/or coefficients? Sure b may show them more clearly, but doesn't A also show them?
Comment: I can "see" that $x+2 = 0$ when $x=-2$.  I can "see" that $x-1=0$ when $x=1$. The purpose of factoring is so that you can "see" the roots.  (Just trying to get into the head of the person writing the question, that's all.)  The factored version shows the values not included in the domain as constants (via the terms $(x-b)$ where $b$ is a root of the polynomial).
Comment: I'm still a bit confused. I understand that B is more clear than A, but I don't think that that would invalidate it.
Comment: To clarify:  *Your* question *here* is fine!  The PSAT question is a tad odd.
Answer: The answer should be (b). The domain does not include -2 and 1.  Answer (a) has "-2" as a constant (for x-2 and x^2+x-2) and "1" as a coefficient (for x^2(="1"*x^2) and x terms). No values other than "-2" and "1" as constants or coefficients are in (a).
Though (b) has "-2" as a constant for x-2 and "1" as a coefficient for x+2 (="1"*x+2), x-2, and x-1, (b) also has "+2" as a constant for x+"2" and as a coefficient for 2(x+2).
Comment: Welcome to math stackexchange. You should write your posts with [mathjax](https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference)


Trig Question: Angle sum identities

Question: Given that $x$ and $y$ are acute angles such that
$\frac{\sin x}{\sin y} = \frac{1}{2}$ and $\frac{\cos x}{\cos y} = \frac{3}{2}$, find $\tan (x + y).$
I got $-2$. Is that right?
Comment: HI.Welcome To MSE . can you show your work?
Comment: one helpful identity is $$\tan(x+y) = \frac{\tan(x) + \tan(y)}{1 - \tan(x)\tan(y)}$$
Comment: Yup. Here's my work. I substituted $\tan(x) = \frac{\sin(x)}{\cos(x)}$ and $\tan{y} = \frac{\sin(y)}{\cos(y)} = \frac{2\sin(x)}{2/3\cos(x)}$
Comment: Whoops, I see a mistake now.
Do I need to find $x$ and $y$?
Answer: We have that
$$\frac{\cos x}{\cos y} = \frac{3}{2} \implies \frac{1-\sin^2 x}{1-\sin^2 y}=\frac94 \implies 9 \sin^2y-4\sin^2 x=5$$
and by $\frac{\sin x}{\sin y} = \frac{1}{2}$
$$9 \sin^2y-4\sin^2 x=5 \implies 8\sin^2 y=5 \implies \sin y=\sqrt{\frac58} \quad \sin x=\frac12\sqrt{\frac58}$$
and then
$$ \cos y=\sqrt{\frac38} \quad \cos x=\frac32\sqrt{\frac38}$$
finally we can use that
$$\tan(x+y)= \frac{\sin x \cos y+\sin y \cos x}{\cos x \cos y-\sin x \sin y}=\frac{\frac1{16}\sqrt{15}+\frac3{16}\sqrt{15}}{\frac9{16}-\frac5{16}}=\sqrt{15}$$
Answer: You have
$$\frac{\sin x}{\sin y} = \frac{1}{2} \quad \text{i.e.} \quad 2\sin x = \sin(y) \quad \quad (1)$$
and
$$\frac{\cos x}{\cos y} = \frac{3}{2} \quad \text{i.e.} \quad 2\cos x = 3\cos(y) \quad \quad (2)$$
so $(1)^2+(2)^2$ gives
$$4=4\sin^2(x)+4\cos^2(x)=\sin^2(y)+9\cos^2(y)=1+8\cos^2(y)$$
so
$$\cos^2(y)=\frac{3}{8} \quad \text{and} \quad \sin^2(y)=\frac{5}{8}, \quad \text{so} \tan^2(y)=\frac{5}{3}$$
Now, $(1)/(2)$ gives
$$\tan(x)=\frac{\sin(y)}{3\cos(y)}=\frac{\tan(y)}{3}$$
You deduce that
$$\tan(x+y)=\frac{\tan(x) + \tan(y)}{1 - \tan(x)\tan(y)} = \frac{4\tan(y)}{3 - \tan^2(y)} = 3\tan(y) =\sqrt{15}$$
because $x$ and $y$ are acute angles.

Trig Question: Angle sum identities


Derivative of Mittag-Leffler type function

Question: I am working on the following function for a fixed $0<\nu<1$.
$$
f(t) = E_\nu (-t^\nu) = \sum \limits_{n=0}^\infty (-1)^n\frac{t^{n \nu}}{\Gamma(n\nu +1)}
$$
where $E_\nu(\cdot)$ is a Mittag-Leffler function.
I want to show that

$f(t) = E_\nu (-t^\nu)$ is decreasing for $t>0$.

I have tried the usual idea: Showing the derivative is negative. However the derivative function which is
$$
f'(t) = \frac{d}{dt}E_\nu (-t^\nu) = \sum \limits_{n=1}^\infty (-1)^n\frac{t^{n \nu-1}}{\Gamma(n\nu)}
$$
also hard to deal with. I have tried separating the cases $0<t<1$ and $t >1$. I believe for large $t$ the derivative function should be "much more negative". I couldn't prove that either.
Any help will be appreciated.
Answer: Using the integral representation for $0<\nu<1$ (e.g. see this paper https://arxiv.org/pdf/1305.0161 , equation 2.14)
$$
f(t)=E_\nu (-t^\nu) = \sum \limits_{n=0}^\infty (-1)^n\frac{t^{n \nu}}{\Gamma(n\nu +1)}=\frac{1}{\pi}\int_0^\infty e^{-xt}\frac{x^{\nu-1} \sin (\pi  \nu)}{x^{2 \nu}+2 x^\nu \cos (\pi  \nu)+1}dx
$$
we immdediately see that $f(t)$ is decreasing for $t>0$.
Comment: This paper is great. This is exactly what I was looking for. Thank you for your answer!