text:
Q: How can i get the position for second model in RecyclerView Adapter This is my RecyclerView Adapter code
class RecyclerAdapterMain(

val product: ArrayList<ModelProductMain>,

val viewmodel: ViewModelRoom,

val newitem: List<ModelItemsNew>

) :

RecyclerView.Adapter<RecyclerAdapterMain.ViewHolder>() {

class ViewHolder(itemview: View) : RecyclerView.ViewHolder(itemview) {

    val title: TextView = itemview.product_txt
    val price: TextView = itemview.price_product
    val imageproduct: ImageView = itemview.product_image
    val btn_add_product: Button = itemview.btn_add_product
    val amount_value: TextView = itemview.amount_value
    val button_remove_product: Button = itemview.button_remove_product

}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {

    val layoutview =
        LayoutInflater.from(parent.context).inflate(R.layout.product_items, parent, false)
    return ViewHolder(layoutview)

}

override fun getItemCount(): Int = product.size

override fun onBindViewHolder(holder: ViewHolder, position: Int) {

    val products = product[position]
    holder.title.text = products.title
    holder.price.text = products.price.toString()
    Picasso.get().load(products.image).into(holder.imageproduct)

    holder.itemView.setOnClickListener {

        val bundle = Bundle()
        val myfragment = ItemDetailsfragment()
        myfragment.arguments = bundle

        val activity = it.context as AppCompatActivity
        activity.supportFragmentManager.beginTransaction()
            .replace(R.id.homepage, myfragment)
            .commit()

        bundle.putString("title", products.title)
        bundle.putString("price", products.price.toString())
        bundle.putString("image", products.image.toString())

    }

    holder.amount_value.visibility = View.GONE
    holder.button_remove_product.visibility = View.GONE
    holder.btn_add_product.setOnClickListener {

        holder.amount_value.visibility = View.VISIBLE
        holder.button_remove_product.visibility = View.VISIBLE

            holder.amount_value++

    }

}

}
the problem is I want when the button is pressed the amount of product would be increased ... for this I need the position of each item but the first model of my product (override fun getItemCount(): Int = product.size ) got the position I need position for my new model (val newitem: List ).
I tried this code val productpos = newitem.position and give me the error that the size is 1 and the index also is 1 ...
I don't know how to fix it . just now that I need the position for a new model. how to get a new position?

A: Try this:
val productpos = newitem.get(position)

and then get the total size:
override fun getItemCount(): Int = product.size + newitem.size


text:
Q: Why Viewstate can contain only serializable object? I have a simple class with some properties and other data. Untill i stick serializable attribute to the class, i cannot save the object of the class into the viewstate.
Why Viewstate can contain only serializable objects?

A: As the viewstate of a request is passed back to the browser as a serialised representation embedded within the generated page's HTML it makes sense that only serialisable objects can be placed within it (otherwise it may fail to represent that which it contains.) That viewstate is then de-serialised during the next request.

If you are using POCO's marking them as serialisable should be trivial enough. There is an excellent resource on understanding how viewstate works, what it is etc. here:
http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx
It goes into the full lifecycle of the state and gives detail about much of it's implementation and use from the prospective of a developer.

A: Because the ViewState is serialized before it is sent to the Client.
Maybe you can store your data in the Session object instead. It depends on what your class does and how it's used.

A: Simply because the data stored in viewstate needs to be serialized (and deserialized).
The viewstate is essentially just text, so anything stored in it needs to be able to be represented as text and to be reconstructed from that serialized text into object form.

A: I think this summarizes the answer:
The state goes out of control from ther Asp.Net code to the HTTP handler which does not understand your code which will go out of scope, and must serialize it in a datastore (it's that lot of garbage you see when you view the source of a asp.net page) then give it back when another postback requires it.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Dismiss makes jump a view controller Swift I have four VCs

*

*main,

*shopVC,

*itemCategories,

*productDetails
and they're all connected in sequence.

main -> ShopVC -> itemCategories -> productDetails

When dismissing productDetails I increment a dismissCounter, so in itemCategories's viewWillAppear I check dismissCounter and if is not 0 it will also dismiss and goes back to shopVc.
It all works as expected if I have set a segue chooseProductCategorySegue from shopVc to itemCategories  as present modally.
If I instead have this segue as show to include the navigation back button in itemCategories, then it directly dismisses to main instead of shopVC. What can be causing this?
I'm thinking that using an unwind segue from all VCs instead of dismissing them would be an option.
Many thanks for your help as always.


text:
Q: Linking python file into functioning HTML/CSS website I'm giving myself a project to better learn these languages which I already know a lot of it's just syncing them together I need to get better with. This project is a pretty basic "SIM" game, generate some animals into your profile with login/logout. So far I've got the website aspect with HTML/CSS done and functioning with all the pages I currently need all of which is local host on my desktop. Now I'm moving on to working with Python and possibly some PHP aspects into this to get the login/logout and generate a new animal into your account.
Everything I've done with python so far has been done in IDEL, I'm wondering how to link my python document to my HTML document. Like you would CSS? Or is that not possible if not then how do I connect the two to have python interact with the HTML/CSS that has been created? I'm guessing to need MySQL for a database setup but seeing how much I can get as a simple local host without hosting online?

A: If you want to setup a localhost with PHP and MYSQL I can recommend XAMP (https://www.apachefriends.org/). In order for your webapp to talk to your Python scripts you will either need to use FLASK or Django to create a python webserver, or use PHP to run python scripts. Either way, you will need to make AJAX requests to an API to get this done.
Edit: Forgot to mention this, but you will need JavaScript in order to do this


text:
Q: Linear independence and basis
*

*For what values of a is the set of vectors (1, 0, a), (0, 1, 0), (1, 0 1) linearly independent?

*For what values of a is the set of the same vectors a basis of $R^3$?
For question 1 I row reduced to (1, 0, 0)(0, 1, 0)(1, 0, 1-a), so I got it's linearly independent for all values except a = 1. And I'm getting the same answer for the 2nd question.
Is there a difference between the 2? Or am I doing something wrong?

A: If a list of vectors with dimension the size of the space is linearly independent, then it is necessarily a basis for the space. So, if you find that
$$a≠1\implies (1,0,a),(0,1,0),(1,0,1)$$
linearly independent in $\mathbb{R}^3$, then from the fact that the dimension of $\mathbb{R}^3$ is $3$, that list of vectors functions as a basis.
So to be clear- in this particular case these questions are identical.


text:
Q: How do I encrypt a string in PHP? I want to make an encryption function that should have some secret key. Something like the following:
function encrypt($string) {
    $key = "mastermind";
    $enc = encryptfunc($string, $key);

    return $enc;
}

The same thing should apply for decryption.

A: I'm not a crypto guy, but I use this kind of things:
function crypt($dataToEncrypt){
  $appKey = '%39d15#13P0£df458asdc%/dfr_A!8792*dskjfzaesdfpopdfo45s4dqd8d4fsd+dfd4s"Z1';
  $td = mcrypt_module_open(MCRYPT_SERPENT, '', MCRYPT_MODE_CBC, '');
  // Creates IV and gets key size
  $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_DEV_RANDOM);
  $ks = mcrypt_enc_get_key_size($td);

  // Creates key from application key
  $key = substr($appKey, 0, $ks);

  // Initialization
  mcrypt_generic_init($td, $key, $iv);

  // Crypt data
  $encrypted = mcrypt_generic($td, $dataToEncrypt);

  // Close
  mcrypt_generic_deinit($td);
  mcrypt_module_close($td);
  return array($encrypted, $iv);
}

To decrypt a string you need the key and the initialization vector ($iv).
function decrypt($encryptedData, $iv){
  $appKey = '%39d15#13P0£df458asdc%/dfr_A!8792*dskjfzaesdfpopdfo45s4dqd8d4fsd+dfd4s"Z1';
  $td = mcrypt_module_open(MCRYPT_SERPENT, '', MCRYPT_MODE_CBC, '');

  // Gets key size
  $ks = mcrypt_enc_get_key_size($td);

  // Creates key from application key
  $key = substr($appKey, 0, $ks);

  // Initialization
  mcrypt_generic_init($td, $key, $iv);

  // Decrypt data
  $decrypted = mdecrypt_generic($td, $encryptedData);

  // Close
  mcrypt_generic_deinit($td);
  mcrypt_module_close($td);

  return trim($decrypted);
}

A: Here is simple, but secure implementation of AES-256 encryption in CBC mode that uses PBKDF2 to create encryption key out of plain-text password and HMAC to authenticate the encrypted message.
It works with PHP 5.3 and higher.
/**
 * Implements AES-256 encryption/decryption in CBC mode.
 *
 * PBKDF2 is used for creation of encryption key.
 * HMAC is used to authenticate the encrypted message.
 *
 * Requires PHP 5.3 and higher
 *
 * Gist: https://gist.github.com/eugef/3d44b2e0a8a891432c65
 */
class McryptCipher
{
    const PBKDF2_HASH_ALGORITHM = 'SHA256';
    const PBKDF2_ITERATIONS = 64000;
    const PBKDF2_SALT_BYTE_SIZE = 32;
    // 32 is the maximum supported key size for the MCRYPT_RIJNDAEL_128
    const PBKDF2_HASH_BYTE_SIZE = 32;

    /**
     * @var string
     */
    private $password;

    /**
     * @var string
     */
    private $secureEncryptionKey;

    /**
     * @var string
     */
    private $secureHMACKey;

    /**
     * @var string
     */
    private $pbkdf2Salt;

    public function __construct($password)
    {
        $this->password = $password;
    }

    /**
     * Compares two strings.
     *
     * This method implements a constant-time algorithm to compare strings.
     * Regardless of the used implementation, it will leak length information.
     *
     * @param string $knownHash The string of known length to compare against
     * @param string $userHash   The string that the user can control
     *
     * @return bool true if the two strings are the same, false otherwise
     *
     * @see https://github.com/symfony/security-core/blob/master/Util/StringUtils.php
     */
    private function equalHashes($knownHash, $userHash)
    {
        if (function_exists('hash_equals')) {
            return hash_equals($knownHash, $userHash);
        }

        $knownLen = strlen($knownHash);
        $userLen = strlen($userHash);

        if ($userLen !== $knownLen) {
            return false;
        }

        $result = 0;
        for ($i = 0; $i < $knownLen; $i++) {
            $result |= (ord($knownHash[$i]) ^ ord($userHash[$i]));
        }

        // They are only identical strings if $result is exactly 0...
        return 0 === $result;
    }

    /**
     * PBKDF2 key derivation function as defined by RSA's PKCS #5: https://www.ietf.org/rfc/rfc2898.txt
     *
     * Test vectors can be found here: https://www.ietf.org/rfc/rfc6070.txt
     * This implementation of PBKDF2 was originally created by https://defuse.ca
     * With improvements by http://www.variations-of-shadow.com
     *
     * @param string $algorithm The hash algorithm to use. Recommended: SHA256
     * @param string $password The password
     * @param string $salt A salt that is unique to the password
     * @param int $count Iteration count. Higher is better, but slower. Recommended: At least 1000
     * @param int $key_length The length of the derived key in bytes
     * @param bool $raw_output If true, the key is returned in raw binary format. Hex encoded otherwise
     * @return string A $key_length-byte key derived from the password and salt
     *
     * @see https://defuse.ca/php-pbkdf2.htm
     */
    private function pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output = false)
    {
        $algorithm = strtolower($algorithm);
        if (!in_array($algorithm, hash_algos(), true)) {
            trigger_error('PBKDF2 ERROR: Invalid hash algorithm.', E_USER_ERROR);
        }
        if ($count <= 0 || $key_length <= 0) {
            trigger_error('PBKDF2 ERROR: Invalid parameters.', E_USER_ERROR);
        }

        if (function_exists('hash_pbkdf2')) {
            // The output length is in NIBBLES (4-bits) if $raw_output is false!
            if (!$raw_output) {
                $key_length *= 2;
            }
            return hash_pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output);
        }

        $hash_length = strlen(hash($algorithm, '', true));
        $block_count = ceil($key_length / $hash_length);

        $output = '';
        for ($i = 1; $i <= $block_count; $i++) {
            // $i encoded as 4 bytes, big endian.
            $last = $salt . pack('N', $i);
            // first iteration
            $last = $xorsum = hash_hmac($algorithm, $last, $password, true);
            // perform the other $count - 1 iterations
            for ($j = 1; $j < $count; $j++) {
                $xorsum ^= ($last = hash_hmac($algorithm, $last, $password, true));
            }
            $output .= $xorsum;
        }

        if ($raw_output) {
            return substr($output, 0, $key_length);
        } else {
            return bin2hex(substr($output, 0, $key_length));
        }
    }

    /**
     * Creates secure PBKDF2 derivatives out of the password.
     *
     * @param null $pbkdf2Salt
     */
    private function derivateSecureKeys($pbkdf2Salt = null)
    {
        if ($pbkdf2Salt) {
            $this->pbkdf2Salt = $pbkdf2Salt;
        }
        else {
            $this->pbkdf2Salt = mcrypt_create_iv(self::PBKDF2_SALT_BYTE_SIZE, MCRYPT_DEV_URANDOM);
        }

        list($this->secureEncryptionKey, $this->secureHMACKey) = str_split(
            $this->pbkdf2(self::PBKDF2_HASH_ALGORITHM, $this->password, $this->pbkdf2Salt, self::PBKDF2_ITERATIONS, self::PBKDF2_HASH_BYTE_SIZE * 2, true),
            self::PBKDF2_HASH_BYTE_SIZE
        );
    }

    /**
     * Calculates HMAC for the message.
     *
     * @param string $message
     * @return string
     */
    private function hmac($message)
    {
        return hash_hmac(self::PBKDF2_HASH_ALGORITHM, $message, $this->secureHMACKey, true);
    }

    /**
     * Encrypts the input text
     *
     * @param string $input
     * @return string Format: hmac:pbkdf2Salt:iv:encryptedText
     */
    public function encrypt($input)
    {
        $this->derivateSecureKeys();

        $mcryptIvSize = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);

        // By default mcrypt_create_iv() function uses /dev/random as a source of random values.
        // If server has low entropy this source could be very slow.
        // That is why here /dev/urandom is used.
        $iv = mcrypt_create_iv($mcryptIvSize, MCRYPT_DEV_URANDOM);

        $encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $this->secureEncryptionKey, $input, MCRYPT_MODE_CBC, $iv);

        $hmac = $this->hmac($this->pbkdf2Salt . $iv . $encrypted);

        return implode(':', array(
            base64_encode($hmac),
            base64_encode($this->pbkdf2Salt),
            base64_encode($iv),
            base64_encode($encrypted)
        ));
    }

    /**
     * Decrypts the input text.
     *
     * @param string $input Format: hmac:pbkdf2Salt:iv:encryptedText
     * @return string
     */
    public function decrypt($input)
    {
        list($hmac, $pbkdf2Salt, $iv, $encrypted) = explode(':', $input);

        $hmac = base64_decode($hmac);
        $pbkdf2Salt = base64_decode($pbkdf2Salt);
        $iv = base64_decode($iv);
        $encrypted = base64_decode($encrypted);

        $this->derivateSecureKeys($pbkdf2Salt);

        $calculatedHmac = $this->hmac($pbkdf2Salt . $iv . $encrypted);

        if (!$this->equalHashes($calculatedHmac, $hmac)) {
            trigger_error('HMAC ERROR: Invalid HMAC.', E_USER_ERROR);
        }

        // mcrypt_decrypt() pads the *RETURN STRING* with nulls ('\0') to fill out to n * blocksize.
        // rtrim() is used to delete them.
        return rtrim(
            mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $this->secureEncryptionKey, $encrypted, MCRYPT_MODE_CBC, $iv),
            "\0"
        );
    }
}

Usage:
$c = new McryptCipher('secret key goes here');
$encrypted = $c->encrypt('secret message');

$decrypted = $c->decrypt($encrypted);

Notice about performance
By default mcrypt_create_iv() function uses /dev/random as a source of random values. If server has low entropy this source could be very slow. This is why /dev/urandom is used.
Here is a good explanation what is the difference between them http://www.onkarjoshi.com/blog/191/device-dev-random-vs-urandom/
So, if you are not using this encryption for something critical (I hope you don't) then you can use /dev/urandom to improve encryption performance, otherwise just replace MCRYPT_DEV_URANDOM with MCRYPT_DEV_RANDOM.
Important security update #1
Thanks to @HerrK who pointed out that using a simple hash to create an encryption key is not secure enough - now the PBKDF2 algorithm is used for that (read more about PBKDF2 http://en.wikipedia.org/wiki/PBKDF2).
Implementation of the PBKDF2 algorithm is copied from https://defuse.ca/php-pbkdf2.htm.
Important security update #2
Thanks to @Scott who paid attention that encrypted message should be authenticated - now HMAC is used to verify that message was not changed.

A: Here is an updated and secured version to Eugene Fidelin's original code.
Please notice the output has the IV and Salt in it, which you also need to store securely with the decryption key.
class Cipher
{

    /**
        ----------------------------------------------
            Original Code by Eugene Fidelin
        ----------------------------------------------
    **/

    private $key;
    private $salt;
    private $iv;

    function __construct()
    {

    }

    function set_salt( $salt )
    {
        $this->salt = $salt;
    }

    function generate_salt()
    {
        $this->salt = mcrypt_create_iv( 32, MCRYPT_DEV_RANDOM ); // abuse IV function for random salt
    }

    function set_iv( $iv )
    {
        $this->iv = $iv;
    }

    function generate_iv()
    {
        $this->iv = mcrypt_create_iv( mcrypt_get_iv_size( MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC ) );
    }

    function generate_key( $passphrase, $iterations = 10000, $length = 32 )
    {
        $this->key = hash_pbkdf2 ( 'sha256', $passphrase, $this->salt, $iterations, $length );
    }

    function get_key()
    {
        echo $this->key;
    }

    function encrypt( $plaintext )
    {

        $ciphertext = mcrypt_encrypt( MCRYPT_RIJNDAEL_128, $this->key, $plaintext, MCRYPT_MODE_CBC, $this->iv );

        $data_return = array();
        $data_return['iv']          = base64_encode( $this->iv );
        $data_return['salt']        = base64_encode( $this->salt );
        $data_return['ciphertext']  = base64_encode( $ciphertext );

        return json_encode( $data_return );

    }

    function decrypt( $data_enciphered, $passphrase )
    {

        $data_decoded = json_decode( $data_enciphered, TRUE );

        $this->set_iv( base64_decode( $data_decoded['iv'] ) );
        $this->set_salt( base64_decode( $data_decoded['salt'] ) );
        $this->generate_key( $passphrase );

        $ciphertext = base64_decode( $data_decoded['ciphertext'] );

        return trim( mcrypt_decrypt( MCRYPT_RIJNDAEL_128, $this->key, $ciphertext, MCRYPT_MODE_CBC, $this->iv ) );

    }

}

$cipher = new Cipher();

$cipher->generate_salt();
$cipher->generate_iv();
$cipher->generate_key( '123' ); // the key will be generated from the passphrase "123"
// echo $cipher->get_key();

$data_encrypted = $cipher->encrypt( 'hello' );

echo 'encrypted:';
echo '
';
print_r( $data_encrypted );
echo '
';

unset( $cipher );

echo 'decrypted:';

$cipher = new Cipher();
$decrypted = $cipher->decrypt( $data_encrypted, '123' );

echo '
';
print_r( $decrypted );
echo '
';

die();

A:
Security Warning: Encryption without authentication is vulnerable to something called a chosen-ciphertext attack. See Eugene's answer for a solution that offers authenticated encryption.

If you are using PHP >= 5.3, the new openssl_encrypt might help you: It allows encryption of data using a wide range of cypher methods.
Those data can later be decrypted with openssl_decrypt, which, obviously, does the exact opposite.
And if you want to know which cypher functions you can use, openssl_get_cipher_methods will be helpful ;-)
There are quite a lot of those, it seems ^^

Here's a portion of code I posted on my blog some time ago, that should demonstrate the usage of those three functions:
$methods = openssl_get_cipher_methods();

var_dump($methods);

$textToEncrypt = "he who doesn't do anything, doesn't go wrong -- Zeev Suraski";
$secretKey = "glop";

echo '
';
foreach ($methods as $method) {
    $encrypted = openssl_encrypt($textToEncrypt, $method, $secretKey);
    $decrypted = openssl_decrypt($encrypted, $method, $secretKey);
    echo $method . ': ' . $encrypted . ' ; ' . $decrypted . "\n";
}
echo '
';

The output I got when writing this was something like that:
bf-ecb: /nyRYCzQPE1sunxSBclxXBd7p7gl1fUnE80gBCS1NM4s3wS1Eho6rFHOOR73V9UtnolYW+flbiCwIKa/DYh5CQ== ; he who doesn't do anything, doesn't go wrong -- Zeev Suraski
bf-ofb: M9wwf140zhwHo98k8sj2MEXdogqXEQ+TjN81pebs2tmhNOsfU3jvMy91MBM76dWM7GVjeh95p8oDybDt ; he who doesn't do anything, doesn't go wrong -- Zeev Suraski
cast5-cbc: xKgdC1y654PFYW1rIjdevu8MsQOegvJoZx0KmMwb8aCHFmznxIQVy1yvAWR3bZztvGCGrM84WkpbG33pZcxUiQ== ; he who doesn't do anything, doesn't go wrong -- Zeev Suraski
cast5-cfb: t8ABR9mPvocRikrX0Kblq2rUXHiVnA/OnjR/mDJDq8+/nn6Z9yfPbpcpRat0lYqfVAcwlypT4A4KNq4S ; he who doesn't do anything, doesn't go wrong -- Zeev Suraski
cast5-ecb: xKgdC1y654NIzRl9gJqbhYKtmJoXBoFpgLhwgdtPtYB7VZ1tRHLX0MjErtfREMJBAonp48zngSiTKlsKV0/WhQ== ; he who doesn't do anything, doesn't go wrong -- Zeev Suraski
cast5-ofb: t8ABR9mPvofCv9+AKTcRO4Q0doYlavn8zRzLvV3dZk0niO7l20KloA4nUll4VN1B5n89T/IuGh9piPte ; he who doesn't do anything, doesn't go wrong -- Zeev Suraski
des-cbc: WrCiOVPU1ipF+0trwXyVZ/6cxiNVft+TK2+vAP0E57b9smf9x/cZlQQ4531aDX778S3YJeP/5/YulADXoHT/+Q== ; he who doesn't do anything, doesn't go wrong -- Zeev Suraski
des-cfb: cDDlaifQN+hGOnGJ2xvGna7y8+qRxwQG+1DJBwQm/4abKgdZYUczC4+aOPGesZM1nKXjgoqB4+KTxGNo ; he who doesn't do anything, doesn't go wrong -- Zeev Suraski

And if you are not using PHP 5.3, you might want to take a look to the Mcrypt section of the manual, and functions such as mcrypt_encrypt ;-)

This is an interface to the mcrypt
  library, which supports a wide variety
  of block algorithms such as DES,
  TripleDES, Blowfish (default), 3-WAY,
  SAFER-SK64, SAFER-SK128, TWOFISH, TEA,
  RC2 and GOST in CBC, OFB, CFB and ECB
  cipher modes.

A: Here is a good PHP library that can help you encrypt and decrypt strings - available via Composer and easy to use too:
https://github.com/CoreProc/crypto-guard
Here is a sample:
<?php

require 'vendor/autoload.php';

use Coreproc\CryptoGuard\CryptoGuard;

// This passphrase should be consistent and will be used as your key to encrypt/decrypt
// your string
$passphrase = 'whatever-you-want';

// Instantiate the CryptoGuard class
$cryptoGuard = new CryptoGuard($passphrase);

$stringToEncrypt = 'test';

// This will spit out the encrypted text
$encryptedText = $cryptoGuard->encrypt($stringToEncrypt);

// This should give you back the string you encrypted
echo $cryptoGuard->decrypt($encryptedText);


text:
Q: Classification of $all$ Entire function. Here is my guess.
Let $f$ be a entire function From $\mathbb C$ to $\mathbb C$
(1) If for $f$, there exist a sequence $z_n$ such that $|z_{n}|\rightarrow \infty$, with  $|f(z_{n})|\rightarrow\infty$, Then $f$ must be polynomial.
(2) If for all  $z_n$ such that $|z_{n}|\rightarrow \infty$,   $|f(z_{n})|\rightarrow z<\infty$, then $f$ is bounded, so that $f$ is constant by Liouville's theorem.
Is this true?

A: (1) is not correct. Let $f(z)=e^z$. Consider sequence $1,2,3,\cdots$. It satisfies the condition. But $f$ is not polynomial. [For $f$ to be polynomial, the condition should be stronger; it should hold for all the possible sequences].
(2) Seems to be correct with your reason.


text:
Q: How are openCV matrices serialized in Google's mediapipe Google's mediapipe framework is able to work with openCV matrices across different languages, certainly C++ and Python.
Since it uses protocol buffers to communicate data among (computational nodes) I'm trying to find out how "image messages" are created. So far I can identify these related .proto definitions and sources:

*

*image_format.proto

*image_file_properties.proto

*image_frame_opencv.h (and respective implementation file)

*image_frame_util.h
But I don't get the whole picture. Where is an "image" defined the mediapipe protocol buffers? And are there helper classes per language, most importantly C++ and Python?


text:
Q: How to create a reference line between a name and a value in LibreOffice In the figure (which is a part of the table of contents of some book) the doted lines help our eyes to easily spot the page number of the mentioned chapter.
When creating similar contents using LibreOffice, how can I create the doted lines easily without typing every dots manually?


text:
Q: cx_Freeze doesn't print to console I have an application that prints a few things to the console upon running. But as a standalone the executable doesn't print anything to the console?
The setup.py script looks like this:
import sys
from cx_Freeze import setup, Executable

setup(
    name = "My App",
    version = "1.0",
    options = {
        "build_exe" : {
            "include_files": ['MyImgs']
        },
    },
    executables = [Executable("Main.py", base = "Win32GUI")]
)

On the command line I run the following: py setup.py build
I then find the executable and run: Main.exe.
What I am missing for some reason is any print() statements. Is there something I need to include in the setup script for this to happen?

A: If you use the "Win32GUI" base, then Windows does not make available stdout and stderr. You will need to redirect those yourself to some other location (such as a file). If you use the "Console" base then stdout and stderr are available and print() will work as expected -- but you will see a console created for you if you haven't run it from a console in the first place!


text:
Q: Sync my website with outlook and gmail calendars I have a website (written in Ruby&Rails) which enable the users to create alert with content and time stamp (e.g "meeting with my parents on 1/8/2013 14:00PM").
I want to be able to schedule them this meeting in their calendar (gmail, outlook, iphone).
Is there a generic way for doing this? what is the best way?
Thanks

A: Google Calendar has an API.
Hotmail Calendar has an API.
iCloud Calendar might have an API, I'm not sure. I think it uses CalDAV, but I'm not familiar with the details of how to interact with it.
There's really no generic way to interface with all of these services, you'd have to integrate to each one independently. (Even if they use the same or very similar protocols and standards, the token authorization for them will be different.)


text:
Q: Representing overlapping polylines in QGIS I have several shapefiles representing bus lines with different colors for each segment, however, because the lines are exactly superposed, only the shapefile on top can be seen. Is there a way to display the lines underneath for example side-by-side on these parts of segments where several lines converge (there might be 4 or 5 of them)? The polylines are made up of series of segments.
I know there are some tools in ArcGIS, but I'm using QGIS 2.8.0

A: In QGIS 2.8.0 you can do that with the offset option in the Style Layer Properties. In my example with three polylines (they are exactly superposed too):

Click in "Simple line" of line2 to display "Offset" option (I set 1 mm):

Click in "Simple line" of line5 to display "Offset" option (I set -1 mm):

The result obtained (Offset of line4 unchanged; 0 mm):

Editing note (answering to alpha-beta-soup comment):
With the next code, executed in the Python Console of QGIS, I have the same result:
from PyQt4.QtGui import *

mc=iface.mapCanvas()

layers=[]
renderer = []

n = mc.layerCount()

symbol = range(n)

symbol[0] = QgsLineSymbolV2.createSimple({'color':'green',
                                       'width':'1',
                                       'offset':'1.0'})

symbol[1] = QgsLineSymbolV2.createSimple({'color':'red',
                                       'width':'1',
                                       'offset':'0.0'})

symbol[2] = QgsLineSymbolV2.createSimple({'color':'blue',
                                       'width':'1',
                                       'offset':'-1.0'})

for i in range(n):
    layers.append(mc.layer(i))

for layer in layers:
    renderer.append(layer.rendererV2())

for i in range(n):
    renderer[i].setSymbol(symbol[i])

iface.mapCanvas().refresh()

for layer in layers:
    iface.legendInterface().refreshLayerSymbology(layer)


text:
Q: What is the meaning of the open record pattern? OCaml has an explicit syntactic construct (See Parsetree.pattern_desc, constructor Ppat_record) to discriminate between "open" and "closed" record patterns.
This seems to have no influence whatsoever on the pattern matching:
utop # type r = {repr:int; foo:int} ;;
type r = { repr : int; foo : int; }
utop # let f = function {repr} -> repr;;
val f : r -> int =  <fun>
utop # let g = function {repr;_} -> repr;;
val g : r -> int = <fun>

So what is/was its purpose? Is this some kind of SML relic?

A: It is just a language extension to tell the compiler that you ignored some fields on purpose so that you can have a warning when you forget a field.
http://caml.inria.fr/pub/docs/manual-ocaml/extn.html#sec226


text:
Q: Count visits by today, this week, last month and total [MySQL query] Hello guys this is a very simplified version of my table:

I will like to make four mysql querys to this table. All of them will have to count the total visits where id_user is equal to some particular value and type different from click. One query have to count the visits today, the other in this week, the month and the total visits. Im not very expert on MySQL, i can certainly solve this using PHP but i prefer to put the load on my sql server. Thanks for your help!

A: You might want to have a look at this page:
http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html
The functions month(), date(), curdate(), week() and a few others should do the trick

A: Give these a go. I don't know what your table is called so I have referrered to it as trafficTable:
-- Visits today
select count(*) as visits_today
from trafficTable tt
where tt.type != 'click'
and tt.id_user = '19d71'
and datetime >= curdate();

-- Visits this week
select count(*) as visits_this_week
from trafficTable tt
where tt.type != 'click'
and tt.id_user = '19d71'
and yearweek(datetime) = yearweek(curdate());

-- Visits this month
select count(*) as visits_this_month
from trafficTable tt
where tt.type != 'click'
and tt.id_user = '19d71'
and year(datetime) = year(curdate())
and month(datetime) = month(curdate());

-- Total visits
select count(*) as total_visits
from trafficTable tt
where tt.type != 'click'
and tt.id_user = '19d71';

--- if you want the last month - this help other ppl in other thread
    select count(*) as visits_this_month
    from trafficTable tt
    where tt.type != 'click'
    and tt.id_user = '19d71'
    and year(datetime) <= year(curdate())
    and month(datetime) <= month(curdate());


text:
Q: a new build error after making change by replacing version=10.0.0.0 with 11.0.0.0 in VS2010 I got the same problem as Build Error + Creating VSTO addin for excel 2010
After making the change according to the solution, I got the new error:
 The "InitializeDefaultProperties" task could not be loaded from the
 assembly
 Microsoft.VisualStudio.Tools.Office.BuildTasks, Version=11.0.0.0,
 Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not load file or
 assembly 'Microsoft.VisualStudio.Tools.Office.BuildTasks,
 Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one
 of its dependencies. The system cannot find the file specified. Confirm
 that the <UsingTask> declaration is correct, that the assembly and all its
 dependencies are available, and that the task contains a public class that
 implements Microsoft.Build.Framework.ITask.

I have installed VS2013 on the same machine so I change version=12.0.0.0 but I got a new error:
 Error  2   The "SetInclusionListEntry" task could not be instantiated from
 the assembly "Microsoft.VisualStudio.Tools.Office.BuildTasks,
 Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
 Please verify the task assembly has been built using the same version of
 the Microsoft.Build.Framework assembly as the one installed on your
 computer and that your host application is not missing a binding redirect
 for Microsoft.Build.Framework. Unable to cast object of type  Micro
 soft.VisualStudio.Tools.Office.BuildTasks.SetInclusionListEntry' to type
 'Microsoft.Build.Framework.ITask'.

A: I know it's an old post, but maybe I have a solution for you...
I ran into exactly the same problem and I have to tell you that the "InitializeDefaultProperties" exception is not fix-able for VS2010.
First of all:
Make sure that your Visual Studio 2010 installation is not modified, anyway make a clean install just to be sure.
If you modified the C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets revert your changes.
If you now try to build your VSTO Project the following error should apppear:

The "FindRibbons" task could not be loaded from the     assembly
  Microsoft.VisualStudio.Tools.Office.BuildTasks, Version=10.0.0.0,
  Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Could not load file
  or   assembly 'Microsoft.VisualStudio.Tools.Office.BuildTasks,
  Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or
  one   of its dependencies. The system cannot find the file specified.
  Confirm      that the <UsingTask> declaration is correct, that the
  assembly and all its   dependencies are available, and that the task
  contains a public class that   implements
  Microsoft.Build.Framework.ITask.

My Solution:
--> Open Visual Studio 2010 (you dont need to load a Project)
--> Go to Help an click About Microsoft Visual Studio
--> Check Version

Microsoft Visual Studio 2010 Version  10.0.40219.1 SP1Rel  Microsoft
  .NET Framework  Version 4.5.51209 SP1Rel

If it says RTMRel download the Microsoft Visual Studio 2010 SP1 from here: http://go.microsoft.com/fwlink/?LinkId=210710
It includes the necessary VSTO and VSTO 4.0 Runtime.
If thats not the Problem, I'm sorry...

A: As I encountered the same problem upgrading our build server... I am gonna put the solution here in case anyone needs it.
I think the way to solve this is to fix your GAC.
Open the .target file of that tool by notepad and take a look at the UsingTask tag, you should get something like
<UsingTask TaskName="InitializeDefaultProperties" AssemblyName=" Microsoft.VisualStudio.Tools.Office.BuildTasks", Version=11.0.0.0,..., PublicKeyToken=sthsthsth

Then, go to your GAC files, e.g. C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.Tools.Office.BuildTasks
Then, create a new folder: v4.0_11.0.0.0_sthsthsth,
which is:
v<.NETFramework Version, mostly 4.0>_<Assembly Version>_<PublicKeyToken>
And then, put the .dll file of Microsoft.VisualStudio.Tools.Office.BuildTasks in it.
This dll should be obtained when you install VSTO either by directly install (VSTO2010) or by Visual Studio installer
e.g.
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.BuildTasks.dll
for Visual Studio 2017 and then directly place the dll inside the folder created
Then this issue should be fixed. Good luck


text:
Q: ValueError: view limit minimum -36834.700000? I am plotting the maximum and minimum temperatures from a data file, for the years 1998 and 2017. The 2017 section was missing some days so it only had 345 days, and 1998 had 365 days. Here is what I have:
napa=pd.read_csv('MET 51 Final data selection.csv')

maxtemp=napa['TMAX']
mintemp=napa['TMIN']
days=[i for i in range(365)]
days2=[i for i in range(345)]
plot(days,maxtemp[7273:7638],'r--',label='Maximum Temperatures (1998)')
plot(days,mintemp[7273:7638],'b--',label='Minimum Temperatures (1998)')
plot(days2,maxtemp[14172:14517],color='crimson',label='Maximum Temperatures (2017)')
plot(days2,mintemp[14172:14517],color='deepskyblue',label='Minimum Temperatures (2017)')
xlabel('Time (Days)')
ylabel('Temperature (F)')
title('Napa State Hospital Maximum & Minimum Temperatures 1998 VS 2017')
legend()
show()

However, I keep getting the error that says this:
ValueError: view limit minimum -36834.700000000004 is less than 1 and is an invalid Matplotlib date value. This often happens if you pass a non-datetime value to an axis that has datetime units

Do you have any idea what's wrong?


text:
Q: Is there a way to profil an MPI Application during Runtime? - Using the time spent in MPI Calls in runtime I am wondering if there is a way of measuring the time which is spent in MPI calls during runtime. Thus, I can use it for calculating a new load balancing.
I know how to profile and trace the program using some tools from OpenMPI or Intel, but those are all use after runtime. Furthermore, I have tried FPMPI, which was not a success because the last release is not able to be built.
Measuring "by hand" does not make any sense in my application because it is way to big :/

A: First of all, do you really need to profile low-level communication such as MPI? Can't you simply time your high-level routines instead?
Anyway, it is pretty easy to write your own MPI profiler. Practically all MPI libraries (Open MPI included) export their functions (e.g., MPI_Send) as weak aliases of the same function symbols with prefix P (e.g., PMPI_Send). All you need to do is define your own functions with the same prototypes as the ones in the MPI library. Inside, update your call counters, start the timers, then call the original MPI function with a P prefix, and upon return stop the timers:
extern "C"
int MPI_Send(void *buf, int count, MPI_Datatype dtype, int dest, int tag, MPI_Comm comm) {
   // Update call counters and start the timer
   calls["MPI_Send"]++;
   timers["MPI_Send"].start();

   // Call the original MPI function
   int result = PMPI_Send(buf, count, dtype, dest, tag, comm);

   // Stop the timer
   timers["MPI_Send"].stop();

   return result;
}

The extern "C" part is important, otherwise you won't override the correct weak symbol if you write in C++.
This ability to override symbols from the MPI library is standardised - see #14.2 Profiling Interface in the current version of the standard.


text:
Q: Identify SharePoint Foundation or SharePoint 2010 I've a SharePoint installation in my virtual machine. How do I find whether it is SharePoint Foundation or SharePoint 2010? I've run this command -
Get-SPFarm | Select BuildVersion

and it is giving me the build version as 14.0.4762.1000. How do I identify the version from that?

A: Okay, should have searched a bit longer. I found it here - https://sharepoint.stackexchange.com/questions/3886/how-to-detect-the-edition-of-sharepoint-2010-installed. We can verify a regedit key to identify the GUID which matches to a SharePoint edition.

A: There is a page on MSDN http://msdn.microsoft.com/en-us/library/ff721969.aspx using registry access to list installed SharePoint products. However, sometimes you don't have enough permissions to look to the registry, or you want to use SharePoint API only - not to depend on registry paths. (You may need this check in some code that you deploy with a SharePoint solution where the registry access could be an unnecessary requirement.)
Your link to stackexchange above points out also a way using the SPFarm.Products property in PowerShell. This would be a complete code to check the SharePoint Server release in C#:
// B2C0B444-3914-4ACB-A0B8-7CF50A8F7AA0 : SharePoint Server 2010 Standard Trial
// 3FDFBCC8-B3E4-4482-91FA-122C6432805C : SharePoint Server 2010 Standard
// 88BED06D-8C6B-4E62-AB01-546D6005FE97 : SharePoint Server 2010 Enterprise Trial
// D5595F62-449B-4061-B0B2-0CBAD410BB51 : SharePoint Server 2010 Enterprise
Guid[] serverGuids = { new Guid("B2C0B444-3914-4ACB-A0B8-7CF50A8F7AA0"),
                       new Guid("3FDFBCC8-B3E4-4482-91FA-122C6432805C"),
                       new Guid("88BED06D-8C6B-4E62-AB01-546D6005FE97"),
                       new Guid("D5595F62-449B-4061-B0B2-0CBAD410BB51") };

// If a Server ID cannot be detected we are running on Foundation.
bool isServer =  SPFarm.Local.Products.Any(productGuid =>
                     serverGuids.Contains(productGuid));

--- Ferda

A: For a customer project based on SharePoint 2013 we had the same problem. For this case we developed a simple Helper, which can be easily adapted for SharePoint 2010. More Informationen about the helper and how to use it can be found here:
http://msscorner.de/2014/06/11/identify-which-sharepoint-2013-edition-is-in-use/
If you wanna use this Helper for SharePoint 2010, you only have to change the SharePoint 2013 SKUs with the SharePoint 2010 SKUs, which are listed above.
I hope this will help you!


text:
Q: Using MessageReceiver only first time getting message from topic using Azure Function HttpTrigger Using MessageReceiver only first time getting messages from topic using Azure Function after that next time when execute Function though I have messages into service bus topic still getting null into variable messages.
Using below code to get messages from Service Bus Topic , whats the cause?
string serviceBusConnectionString = Environment.GetEnvironmentVariable("ConnectionString");
var messageReceiver = new MessageReceiver(serviceBusConnectionString, Environment.GetEnvironmentVariable("topicName/subscriptions/subscriptionName"), ReceiveMode.PeekLock, null, 500);

var messages = await messageReceiver.ReceiveAsync(500, TimeSpan.FromSeconds(1));

i can't understand this - after every 15 minutes when LA call FA then
  FA should able to read new available messages but it is coming null

is there anything related with lock duration ?

A: var messages = await messageReceiver.ReceiveAsync(500, TimeSpan.FromSeconds(1));

will wait until it receives one or more messages and will then return. Any messages that come in later will not be read. If you want to do that (and I want to doubt that this is a good idea inside an Azure Function), put this in a loop:
while(/* some condition */)
{
     messages = await messageReceiver.ReceiveAsync(500, TimeSpan.FromSeconds(1));
     // do something with the received messages
}

A: If i didn't understand it wrong, you use a timer trigger logic app to call the function to get the service bus message and you always get the old message and you don't want it.
You always get the old message because your ReceiveMode is PeekLock, about this ReceiveMode  you could check this description:Receive mode. After complete the message, the message wouldn't be deleted, that's why you always get the old message.
First way is you could change it to ReceiveAndDelete when you create MessageReceiver like the below code.
            string serviceBusConnectionString = Environment.GetEnvironmentVariable("servicebuscon");
            var messageReceiver = new MessageReceiver(serviceBusConnectionString, "myqueue", ReceiveMode.ReceiveAndDelete, null, 500);

            var tempMessages = await messageReceiver.ReceiveAsync(500, TimeSpan.FromSeconds(1));

Note: if your function go exception or other errors and the message doesn't get processed completely, this message will be deleted with this mode.
The other way is after process the message call the CompleteAsync method, after process the message will be deleted.
You could refer to the below code.
            var messageReceiver = new MessageReceiver(serviceBusConnectionString, "myqueue", ReceiveMode.PeekLock, null, 500);

            var tempMessages = await messageReceiver.ReceiveAsync(500, TimeSpan.FromSeconds(1));

            foreach (Message m1 in tempMessages)
            {

                log.LogInformation($"C# HTTP trigger function processed message: {Encoding.UTF8.GetString(m1.Body)}");
                await messageReceiver.CompleteAsync(m1.SystemProperties.LockToken);

            }

A: Enable Batch Operation should be false.
But this is also working for random times - not a reliable solution for the problem.
Check the below screenshot:


text:
Q: Select Date By Year in CakePHP I've got a system built in CakePHP and one of the selection fields for the data is a year. Is there a simple way to put something into the condition array to match date on the selected year?

A: In your find conditions use:
     $conditions = array('YEAR(Model.date)' => '2009');

A: I'm just going to go out on a limb and guess that your question is

I have a date field in the database that stores dates like '2009-08-03'. How can I select all dates of 2009 using Cake?

In which case my answer would be that the simplest way is probably this:
$conditions = array(
    'Model.date >=' => "$year-01-01",
    'Model.date <=' => "$year-12-31"
);

Mind Reader http://uvshock.co.uk/badges/badge.php?label=Mind%20reader&medal=bronze

A: You mean date("Y")? See http://php.net/manual/en/function.date.php


text:
Q: How do I test result of dispatching async action creator in redux? I have this action creator in react-redux which is dispatched after clicking a button. This AC removes user posts. Clicking a button runs action which first makes some firebase calls, and if they succeed it sends the action creator itself to redux to then make some changes in the redux store. When those changes are made my component is updated automatically and this removed post disappears. I want to test this functionality with jest/enzyme. I simulate pressing the remove button but I don't know how to await for firebase calls to end to then be able to test results that were made after firebase calls succeeded. I must emphasize that in the regular app everything works correctly. My problem is that my test simply doesn't wait for those calls to end and just finishes. How can I await for these firebase calls to end to then be able to test the results which were made after they succeeded?
// post component

// In post component onClick on a button just calls action like this:

 onRemovePost({ index: post.index, authorModifiedEmail: author.modifiedEmail, hasUrl: !!post.url });

// action creator

export const removePost = (post) => {
  const { index, authorModifiedEmail, hasUrl } = post;

  return async (dispatch) => {
    const updates = {};
    updates[`users/${authorModifiedEmail}/posts/posts/${index}`] = null;

    try {
      await fire.database().ref().update(updates);

      hasUrl && (await fire.storage().ref(`users/${authorModifiedEmail}/posts/${index}`).delete());

      dispatch({ type: actionTypes.REMOVE_POST, user: authorModifiedEmail, index });
    } catch (error) {
      failToast(error.message);
    }
  };
};

// test

test('removes post after clicking remove button', async () => {

  // initializing wrapper here with relevant props

  const postEditionIcon = findByTestAttr(wrapper, 'post-edition-icon').first();
  postEditionIcon.simulate('click');
  const removeBtn = findByTestAttr(wrapper, 'remove-btn');
  await removeBtn.simulate('click');

  const post = findByTestAttr(wrapper, 'post-component');
  expect(post.exists()).toBe(false);
})

A: You can try like this:
test('action creator is returned',()=>{
      return actionCreator().then((response) => {
       //write your assertion here
        const post = findByTestAttr(wrapper, 'post-component');
        expect(post.exists()).toBe(false);
        });
});


text:
Q: Command line for Ada version? I am looking for a command line to check for the version of my Ada installation. Any help ?

A: Since you listed gcc as your compiler this gcc -x Ada --version should work.
Alternatively, if you're using GNAT, gnat compile --version should work. This command should give you the version of GNATMAKE.

A: Recommended way is: gnatls -v, output would be like this:
GNATLS Pro 6.3.1 (20100111-43)

or:
GNATLS GPL 2010 (20100603)

to get version relations between Pro, GPL and GCC, see here.


text:
Q: java program file re-processing upon temporary IO Exception I am processing a large number of files, say 1000 files using a java program. Processing each file takes significant amount of time. Problem is : when I process a file, due to some unknown problem (may be antivirus or any other problem) the input file is not able to be accessed by java program, so I get "Access is denied" and ultimately "java.io.FileNotFoundException".
One of the possible solution is to whenever I get the exception I process the file again calling the function, but calling the function with file name is difficult as this function is recursive function, which process the directories and files recursively. Kindly suggest me the  alternative ways.

A: Move the catch() inside the body of the recursive method.
void readFilesRecursively(File dirOrFile){

    boolean successfullRead=false;
    for(; !successfullRead ;){
        try{
            ..........Read....
            successfullRead=true;
        }catch(java.io.FileNotFoundException ex){}
    }

}

A: Keep a list of files whose processing fails and add files in the list whenever u get the exception.
Once recursive call ends, check if list have any data, if yes, process them.


text:
Q: Find the group with presentation $\langle x, y: xy=yx, x^5=y^3\rangle$. Here's the problem:
Find the group with presentation $\langle x, y: xy=yx, x^5=y^3\rangle$.
Here's my answer:
The group is commutative by the first relation, so every "word" is of the form $x^iy^j$ for $i,j \in \mathbb{Z}$. By the second relation we have $x^a y^b $ for $0 \leq a \leq 4$ and $b \in \mathbb{Z}$. Hence the group is  isomorphic to $\mathbb{Z_5} \times \mathbb{Z}$.
Is this correct?

A: Your answer can't be right, since multiplying any element in $ \mathbb Z/5\mathbb Z \times \mathbb Z $ by $ 5 $ gives you something of the form $ (0, 5x) $, and such an element can't be divided by $ 3 $ in this group, so there's no element to play the role of $ y $.
To find the isomorphism class, note that there is a surjective map $ \mathbb Z^2 \to G $ given by $ (n, m) \to x^n y^m $  (where $ G $ denotes your group) whose kernel is precisely $ \langle (5, -3) \rangle $. In other words, we're trying to find the quotient $ \mathbb Z^2/\langle (5, -3) \rangle $.
This quotient is isomorphic to $ \mathbb Z $, as you can see by noting that $ (5, -3) $ and $ (3, -2) $ form a basis of $ \mathbb Z^2 $, so $ G \cong \mathbb Z $.

A: Once you know the group is abelian, then your question can be converted into linear algebra. Namely, the given presentation tells you that your group is isomorphic to the kernel of the homomorphism $h : \mathbb Z^2 \to \mathbb Z$ given by $h(x,y) = 5x-3y$, in other words the kernel of the matrix $\begin{pmatrix} 5 \\ -3 \end{pmatrix}$, or to put it another way the solution set of the matrix equation
$$(x \quad y) \begin{pmatrix} 5 \\ -3 \end{pmatrix} = 0
$$
To determine what that kernel is you can convert the matrix $\begin{pmatrix} 5 \\ -3 \end{pmatrix}$ into Smith normal form, which gives the matrix $$\begin{pmatrix} 1 \\ 0 \end{pmatrix}
$$
From this it now easily follows that the kernel is isomorphic to $\mathbb Z$.

A:
Is this correct?

No.
gap> F:=FreeGroup(2);
<free group on the generators [ f1, f2 ]>
gap> rels:=[(F.1)*(F.2)*((F.1)^(-1))*((F.2)^(-1)), (F.1)^5*((F.2)^(-3))];
[ f1*f2*f1^-1*f2^-1, f1^5*f2^-3 ]
gap> G:=F/rels;
<fp group on the generators [ f1, f2 ]>
gap> P:=PresentationFpGroup(G);
<presentation with 2 gens and 2 rels of total length 12>
gap> TzGoGo(P);
#I  there are 2 generators and 2 relators of total length 12
gap> TzPrint(P);
#I  generators: [ f1, f2 ]
#I  relators:
#I  1.  4  [ 1, 2, -1, -2 ]
#I  2.  8  [ -2, 1, 1, 1, 1, 1, -2, -2 ]
gap> Size(G);
infinity
gap> StructureDescription(G);
"C0"
gap>


text:
Q: react-dropdown-input Module not found: Error I'm trying to use the react-dropdown-input library in my react project.
(https://www.npmjs.com/package/react-dropdown-input)
I used npm i react-dropdown-input and it installed.
But when I run my project, I get this errors:

ERROR in ./~/react-dropdown-input/index.js Module not found: Error: Can't resolve 'react/addons' in 'path\node_modules\react-dropdown-input'

And this one too

ERROR in ./~/react-dropdown-input/index.js
  Module not found: Error: Can't resolve 'react/lib/joinClasses' in 'path\node_modules\react-dropdown-input'

I also tried to run this command: npm install @types/react-dropdown-input but that library doesn't exists.
This is my import line:
import DropdownInput from "react-dropdown-input";

In my code it also says this:
Could not find a declaration file for module 'react-dropdown-input'.

Does anyone knows why this is happening and how to solve this?

A: Tested on npm@6.4.1, node@10.13.0. It fails.
I tried cloning it. Looks like library in not maintained. Its last commit was around 5 years back.
You can have a look at React Autosuggest. Its provides exact features you are looking for.
Hope this helps.


text:
Q: Interactive Timer in Jupyter Notebook I have a function which records data and takes a while to complete.  While the data is being recorded, I would like to have a button which, upon being pressed, displays how much time has elapsed since the data acquisition has started.
Is this possible to do in Jupyter?
I'm having issues as the data acquisition blocks the widget from activating, and if I try and run the widget in the background, it doesn't receive the on_click event until the data acquisition has finished.  On the other hand, if I send the data acquisition to the background, then data is lost once the background job finishes.
Background Job
from IPython.lib.backgroundjobs import BackgroundJobManager
from IPython.core.magic import register_line_magic
from IPython import get_ipython

jobs = BackgroundJobManager()

@register_line_magic
def background_job(line):
    ip = get_ipython()
    jobs.new(line, ip.user_global_ns)

Timer Button
import ipywidgets as widgets
import time

def button_timer():
    t0 = 0
    button = widgets.Button(description="Measure time")
    def action(b):
        time_elapsed = time.perf_counter() - t0
        display("Time elapsed: {}".format(time_elapsed))
    button.on_click(action)

    display(button)
    t0 = time.perf_counter()

Data Acquisition
import numpy as np
import pandas as pd
import time

def acquire(a=None):
    time.sleep(10)
    print("Done")
    if a is None:
        return np.linspace(0, 10, 10)
    else:
        a = np.linspace(0, 10, 10)

## Implementation 1
# This fails because the `on_click` event for the button only runs after the data has been acquired.
button_timer()
data = pd.DataFrame()
data['x'] = np.linspace(0, 10, 10)
data['y'] = acquire()

## Implementation 2
# As before, the `on_click` event isn't activated until after the data has been acquired.
%background_job button_timer()
data = pd.DataFrame()
data['x'] = np.linspace(0, 10, 10)
data['y'] = acquire()

## Implementation 3
# This one fails as the data isn't actually updated
button_timer()
data = pd.DataFrame()
data['x'] = np.linspace(0, 10, 10)
# I can't use the equal sign as that isn't supported by the background job.
# %background_job data['y'] = acquire()
# If I pass in the data I want, the DataFrame isn't updated (even after I wait for the background job to finish)
%background_job acquire(data['y'])
display(data)

If all else fails, I guess one option would be to have a Javascript-only timer which runs entirely within the browser.
Still, I'm wondering if there's a way of doing this in Python (and if possible, have it such that the (last) measured time is programmatically accessible in the rest of the notebook).


text:
Q: On finding simpler symmetries to differential equations I have developed a differential equation for the variation of a star's semi-major axis with respect to its eccentricity. It is as follows:
$$\frac{dy}{dx}=\frac{12}{19}\frac{y\left(1+\left(\frac{73}{24}x^2\right)+\left(\frac{37}{26}x^4\right)\right)}{x\left(1+\left(\frac{121}{304}x^2\right)\right)}$$
Where $y$ is the semi-major axis and $x$ is the eccentricity. The 3-D plots of this equation can be found here
And this is the solution to the above DE: here
My question is this: There is a well defined symmetry for the above equation from the plot. Is it possible to express this in terms of other special function (which have different symmetries). The decay time of stars can be found by solving the following integral:
$$T(a_{0},e_{0})=\frac{12(c_{0}^4)}{19\gamma}\int_{0}^{e_0}{\frac{e^{29/19}[1+(121/304)e^2]^{1181/2299}}{(1-e^2)^{3/2}}}de\tag1$$
Where $$\gamma=\frac{64G^3}{5c^5}m_{1}m_{2}(m_{1}+m_{2})$$
For $e_{0}$ close to $1$ the equation becomes:
$$T(a_{0},e_{0})\approx\frac{768}{425}T_{f}a_{0}(1-e_{0}^2)^{7/2}\tag2$$
Where $$T_{f}=\frac{a_{0}^4}{4\gamma}$$
I used Appell's hypergeometric functions to solve integral (1), but is there any way in which I can express the solutions in terms of special functions with simpler symmetries, which would make analysis easier.


text:
Q: Rasterio grayscale .tif image is empty I'm facing an issue when opening a .tif using rasterio using the code below.
fp = 'image.tif'
image = rasterio.open(fp)
print(image.read())

When printing the content of the image, I get this
[[[0 0 0 ... 0 0 0]
  [0 0 0 ... 0 0 0]
  [0 0 0 ... 0 0 0]
  ...
  [0 0 0 ... 0 0 0]
  [0 0 0 ... 0 0 0]
  [0 0 0 ... 0 0 0]]]

I verified all values and they are all 0. However, when dragging the image in QGIS, I can view it and confirm that the image contains values ranging from 101 to 122.
QGIS image
Any idea on how to read the image and get these 101 to 122 values as a numpy array ?
Here's a link to the image in question


text:
Q: Triple nested JPA Entity to JSON - Spring Boot Project So,
I have 3 @Entity classes
class Campaign
{
  @Id
  private long campaignId;
  //Other fields

  @OneToMany(mappedBy = "campaign",cascade=CascadeType.ALL)
    private Set<Question> questions;
}

class Question
{
  @Id
  private long questionId;

  //Other fields
  @OneToMany(mappedBy = "question",cascade=CascadeType.ALL)
    private Set<Choices> choices;

  @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="CAMPAIGN_ID")
    private Campaign campaign;
}

class Choices
{
  @Id
  private long choiceId;

  //Other fields
    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="QUESTION_ID")
    private Question question;
}

When I create and send a JSON
{
    "campaignName" : "Dummy Quiz Campaign",
    "campaignDescription" : "This is a dummy quiz campaign for testing",
    "noOfQuestions":2,
    "noOfChoices":3,
    "lastUpdatedTime":"2012-04-23T18:25:43.511Z",
    "createdTime":"2012-04-23T18:25:43.511Z",
    "questions":[
        {
            "question":"Question 1",
            "choices":[
                {"choice":"Choice 1"},
                {"choice":"Choice 2"},
                {"choice":"Choice 3"}
                ],
            "correctAnswer":"Choice 2"
        },
        {
            "question":"Question 2",
            "choices":[
                {"choice":"Choice 4"},
                {"choice":"Choice 5"},
                {"choice":"Choice 6"}
                ],
            "correctAnswer":"Choice 2"
        }
    ]
}

It is being created and mapped accurately. It is also being deleted accurately.
But when I am trying to getAllCampaigns()
@GetMapping("/api/campaign/all")
    public List<Campaign> getAllCampaigns() throws Exception
    {
        return campaignService.getAllCampaigns();
    }

It is showing a jackson.bind error, when I tried to write the JSON to a file, it ended up having an infinitely nested JSON.
What I can do to retrieve the Campaigns and there mapped entities like in the format I have send it.
As for the tables,
3 Tables
Campaign Table
Question Table with Campaign_Id
Choices Table with Question_Id
Thanks in advance.

A: The reason you are getting the infinite recursion is because, the question is mapped in the campaign class and the campaign is mapped in the question class. This bi-directional relation causes the infinite recursion. This can be solved by using @JsonManagedReference, and @JsonBackReference annotations on the mappings. You can use the @JsonManagedRefernce annotation on the one to many relation and @JsonBackReference annotation on the Many to one relation. This should solve the recursion problem. You can get more info from here  . Let me know if this helps.

A: Here you need to add @JsonIgnore Anotation like this:
class Question{
@Id
private long questionId;

//Other fields
@OneToMany(mappedBy = "question",cascade=CascadeType.ALL)
private Set<Choices> choices;

@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="CAMPAIGN_ID")
@JsonIgnore
private Campaign campaign;
}


text:
Q: UnauthorizedSessionRequestException: SESN0008E If user leaves application inactive in browser for some time I keep getting following error in my JSF application when I leave app sitting in browser for some time, then try using it again;
com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException: SESN0008E: A user authenticated as anonymous has attempted to access a session owned by user:localRealm/uid=testUser,ou=People,o=internet.
My Liberty settings.xml file has following settings that could be related:
<ltpa expiration="1200" />
<webAppSecurity logoutOnHttpSessionExpire="true" singleSignonEnabled="true" />

My web.xml has
<session-config>
    <session-timeout>60</session-timeout>
</session-config>

What is causing this error and how to resolve it?

A: I figured it out.
SESN0008E happens when LTPA token expires before than user session (HttpSession in your app) expires.
In JSF, we normally have Http session expiration time set in web.xml file like:
<session-config>
    <session-timeout>60</session-timeout>
</session-config>

This means user session (HttpSession) will expire in 60 minutes.
For Liberty (Websphere or Openliberty), we typically set LTPA token expiration in server.xml file like:
<ltpa expiration="120" />

This means that Libety LTPA token will expire in 120 minutes.
REPRODUCTION STEPS

*

*Set above ltpa expiration="1" to set it to 1 minute

*set above session-timeout to 5 minutes.  (This will make your ltpa token expire before your Http session expires.)

*Start your app and login in

*do something in it, like search or whatever you do then wait just
above your ltpa expiration time of 1 minute.  Basically, make it inactive to 1+ minutes but less than 5 minutes

*Now try doing something again like search or whatever your app does and it should result with SESN0008E exception (•    UnauthorizedSessionRequestException).

SOLUTION

*

*Leave above settings as they are

*In server.xml add <httpSession invalidateOnUnauthorizedSessionRequestException="true"/>

*Repeat same steps as in REPRODUCTION STEPS and your application will
no longer throw SESN0008E but will instead take you back to login
screen where you can login and continue your work

MORE INFORMATION

*

*https://www.ibm.com/support/pages/logging-out-results-websphere-application-server-error-message
this

*https://www.ibm.com/docs/en/ftmfm/3.2.3?topic=center-ltpa-timeout-session-management

*https://knowledge.broadcom.com/external/article/31342/session-killed-by-agent-heartbeat.html

*https://jazz.net/help-dev/rational-insight/index.jsp?topic=%2Fcom.ibm.jazz.install.doc%2Ftopics%2Ft_s_server_installation_setup_WAS.html

*https://erikwramner.wordpress.com/2016/03/06/handle-unauthorizedsessionrequestexception-was-8-5-5/

*https://github.com/OpenLiberty/open-liberty/issues/10696

*https://www.ibm.com/docs/en/was-nd/9.0.5?topic=tracking-session-management-custom-properties#invalidateonunauthorizedsessionrequestexception

*https://www.ibm.com/docs/en/was-liberty/base?topic=configuration-httpsession

*https://mobilefirstplatform.ibmcloud.com/tutorials/it/foundation/8.0/product-overview/release-notes/known-issues-limitations/


text:
Q: Ionic Horizontal Scroll - Keeping or Bringing Selected Item into View I am using a horizontal scroll in my application for selecting menu categories.
I used the CodePen example here and everything works great.
I have implemented swipe left/right to change between the categories, but if I to a category that is off the screen, I want it to be shown, not hidden to the right/left.
How can I programmatically (or through CSS) make sure that a selected item (defined by a class) is always visible on on scrolled into view?
Here is an example of what it looks like when a selected category is in view (its bolded from a CSS class)

Here is an example of the result of swiping right until a category is selected that is off screen.

The code for the horizontal scrolling bar is the following
    <div class="bar bar-sub-header item-input-inset">
        <ion-scroll direction="x" class="wide-as-needed">
            <button ng-repeat="category in model.selectedMenu.categories"
                ng-click="selectCategory(category)"
                ng-style="model.selectedCategory.id == category.id && {'font-weight': 'bold'}"
                class="button button-clear category">
                {{category.name | uppercase}}
            </button>
      </ion-scroll>
    </div>

And the CSS class used is the following:
.wide-as-needed {
  overflow: scroll;
  white-space: nowrap;
}


text:
Q: What is the Regex to capture only digits from some data I have some thing log like this
[2/16/18 3:07:24:515 GMT] 0000026b LoggerScripta I   ******Print all instances******10075
[2/16/18 3:07:24:516 GMT] 0000026b LoggerScripta I   ******Print all instances******10078
[2/16/18 3:07:24:516 GMT] 0000026b LoggerScripta I   ******Print all instances******10080

Around 300 lines..But I need only those digits(10075) in each line and rest shoulbe removed.Is there any regex that can help easily to get those,
I m using Notepad++
Any help would be very useful since will save our day

A: I am going to go ahead and assume that each of those lines is a string and each string is an element in an array. If that assumption holds true, then here is the code. Otherwise, please update with how that data is stored in JavaScript and I will rewrite my answer:

// If your logs are an array of strings...
var logs = [
  '[2/16/18 3:07:24:515 GMT] 0000026b LoggerScripta I ******Print all instances******10075',
  '[2/16/18 3:07:24:516 GMT] 0000026b LoggerScripta I ******Print all instances******10078',
  '[2/16/18 3:07:24:516 GMT] 0000026b LoggerScripta I ******Print all instances******10080'
];

var numbersFromArray = logs.map((val) => {
  return val.split('***')
    .reverse()[0];
});

console.log(numbersFromArray);

// If your logs are a single string...
var logs = '[2/16/18 3:07:24:515 GMT] 0000026b LoggerScripta I ******Print all instances******10075 [2/16/18 3:07:24:516 GMT] 0000026b LoggerScripta I ******Print all instances******10078 [2/16/18 3:07:24:516 GMT] 0000026b LoggerScripta I ******Print all instances******10080';

var numbersFromString = logs.split('[')
  .map((val) => {
    return val.split('***')
      .reverse()[0]
      .trim();
  })
  .filter((val) => val !== '');

console.log(numbersFromString)

A: If you're using notepad++ and you want to remove everything but the last digits before the newline character, it should be sufficient to do a find/replace with regex enabled
Find: (.*\*)(\d+(\r\n)?)
Replace (regex): \2
What it does:
The first capture group looks for anything (greedy) that ends with an asterisk.
The second capture group looks for a group of digits plus newline if it's there (it might not be for the last log statement).
The replace will leave you only with the second capture group for each line.

A: With Notepad++:

*

*Ctrl+H

*Find what: ^.+?(\d+)$

*Replace with: $1

*check Wrap around

*check Regular expression

*DO NOT CHECK . matches newline

*Replace all
Explanation:
^       : beginning of line
.+?     : 1 or more any character but newline, not greedy
(       : start group 1
  \d+   : 1 or more digits
)       : end group
$       : end of line

Replacement:
$1      : content of group 1

Result for given example:
10075
10078
10080


text:
Q: Git: Ignored a file, now says there's unmerged files and can't pull Previously, I had WordPress' wp-config.php committed; since then, I've now ignored this file in .gitignore, which is fine.
Unfortunately - now when pulling to live, it provides this error:
M   .htaccess
U   wp-config.php

Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.

Before this issue happened, I had an issue with pulling where it said I had uncommitted changes with these files - so I let it overwrite them, then I uploaded the actual files manually via FTP, which caused this new error.
I want to keep the files in their current state on the live server, but get around this error now and in the future.
What is the process of being able to pull the latest changes with this?

A: UPDATE - I'm adding an answer to a question posed in comments, and clarifying a related point

First let's clear up a little confusion: This error has nothing to do with putting the file in .gitignore.  In fact, since the file is present in the index, .gitignore has no effect whatsoever on the file.

Before this issue happened, I had an issue with pulling where it said I had uncommitted changes with these files - so I let it overwrite them

You may need to be more clear about what commands you issued and what output you saw, because this is where your trouble is coming from.
When you say you "let it overwrite them", what does that mean?  git resists overwriting local changes (especially uncommitted changes)...
I'm guessing what really happened is that git tried to merge changes from the remote repo into your local changes for those files, but had merge conflicts on wp-config.php.
And most likely it's still in a merging state, which you'll have to resolve before you can move on.  If you say git status it will likely tell you that you're merging, with some changes "to be committed" (likely including the .htaccess file) and some "unmerged paths" (likely including the .php file).
If you have the .php file looking the way you want it in the work tree, then you can say git add wp-config.php and then git commit which should cause the merge to complete.  (More generally, you have to get the file looking how you want it in the index, and do this in a way that tells git the conflict is resolved; and then you can commit to get out of the merging state.)
Now in comments you ask about whether this will put the file "back" into git.  And that comes down to what it means to "have the .php file looking the way you want it".
If you never want git to provide the .php file (even during a fresh clone), then you need to remove it from the index and subsequent commit.
You could (at least temporarily) remove the file from the working tree and then do a git add (as noted above).  Or, if you don't want to affect your working tree version, you can
git rm --cached wp-config.php

directly making the index look "how you want it".  At this point it becomes possible for your .gitignore entry to help you avoid accidentally reintroducing the file.
If what you mean is that the file should be there, but only a default version should be in the repo (not taking any changes that might be made in the working tree), git won't do that.  You'll have to get where you're going a different way.  For example you could put the file in the repo as wp-config.php.default and ignore the wp-config.php path.  After cloning the repo you would then copy the default file, and any local changes would be made only to the ignored copy.


text:
Q: SSIS Package Based on a avariable Hi I've an SSIS Package which Does tasks like a)Truncate Last 7 days data from a table if any and then re-load it and all theses are placed in a sequence container and it run's fine.Now I'm planning to remove the hard coded value of 7 and introduce a variable NoOfDays which I can provide at run time.Can this be achieved?
I added a variable and tried to map it to the parameter of the ExecuteSQL Task...It gave the following error:
I even want the value to be available to the next step Data Flow Task
[Execute SQL Task] Error: Executing the query "delete  from USER_CONTENT where CONVERT..." failed with the following error: "The variable name '@NoOfDays' has already been declared. Variable names must be unique within a query batch or stored procedure.
Statement(s) could not be prepared.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

The query I'm using is
delete from USER_CONTENT
where CONVERT(date,ISSUE_DATE)>=CONVERT(DATE,GETDATE()-7)

and it is against an OLE-DB connection.

A: I do not have enough points to post a comment so I will have to ask you this way: are you using query parameters with a "?", if not, then in order to use a package variable with a stored procedure, you will need to write your statement to use them, also, don't name your parameters, use the default 0,1,2 etc.. that the package assigns.


text:
Q: Localization doesn't work for german? I googled a lot and did these changes to my project:
.csproj:
<SupportedCultures>
  en-US;de-DE;ru-RU;
</SupportedCultures>

WPAppManifest.xaml:
<DefaultLanguage xmlns="" code="en-US" />
  <Languages xmlns="">
    <Language code="en-US" />
    <Language code="de-DE" />
    <Language code="ru-RU" />
  </Languages>

And of course I have AppResources.de-DE.resx, AppResources.en-US.resx, AppResources.resx and AppResources.ru-RU.resx.
When I set the phone to russian, the app starts in russian as expected. But that doesn't work with german. I checked the AppResources-files many times. It's all in there, they should work. but somehow de-DE doesn't get recognized.
Tried the same with simple "en;de;ru;" with the same result.
Any ideas?
Edit:
I found this tutorial: http://www.silverlightshow.net/items/Windows-Phone-8-Localization.aspx and they also use "de". So I changed all appearances of those strings to "de", "en" and "ru". Still russian works, german appears as english - the default language =/

A: Okay, stupid, but it was in the project's properties. For some reason the defaultlanguage was set to german.
Still think that it's in confusingly many places. I'll summarize them for everybody who might need it in the future:

*

*project's properties, 1st tab "supported cultures" and "asseblmy information" button!

*WPAppManifest.xaml view Code

*AppResources.xx.resx

*inside AppResources files the "ResourceLanguage"-tag should be set to "de", "en", "fr" or whatever.

That's many places and I hope I didn't forget one O-o


text:
Q: Autohotkey Fn key remapping on Logitech k750 keyboard I've googled, read forums but unsucceed in this.
Tried "Mystery of the Fn key" http://www.autohotkey.net/~daonlyfreez/tutorials/3p/Veil/fnkey.htm
But stucked at AutoHotkeyRemoteControlDLL.ahk, that doesn't react on my Fn key on all devices (1-5 HID, 6-9 Keyboard, 10-16 mouse).
Any suggestions?

A: The problem with the Fn key is, that a lot of keyboards don't implement it as normal key, but as a modifier that changes the key messages of other keys pressed at the same time.
So here is an example scenario of how Windows could see your input:
Press F1 down - Windows receives the F1 down code
Press F1 up - Windows receives the F1 up code
Press Fn down - Windows doesn't get anything
Press F1 down - Windows  receives the media ▶ down code
Press F1 up - Windows  receives the media ▶ up code
Press Fn up - Windows doesn't get anything


text:
Q: Nvidia graphics cards displaying picture larger than LCD TV I have a strange issue and not sure what the problem is.
I have a 720p TV hooked up to a NVidia 7300.  Everything is fine.  But when I put in a 9500 or a GT220 the resolution is detected at 720p, but the display is slightly larger than the screen... the edges are offscreen.
This is the case in windows and in ubuntu.  The nvidia windows driver let me resize the screen, but that actualy lowers the resolution, which I dont want to do.  Plus, the 7300 worked fine.  The problem persists if I use HDMI (if the card supports it) or a DVI to HDMI adapter.
Any thoughts?

A: Did you have the HDMI plugged into the same port on the TV? Some TVs have one HDMI port set to "PC Mode" which has no overscan. Your manual should tell you which.
I had this problem with my WXGA capable 32" Philips TV. Any HDMI port other than HDMI1 and it would overscan like that.

A: This sounds like an overscan issue I experienced with my Toshiba lcd tv.
My TV has an overscan setting that sometimes likes to reset itself back to 5% overscan..
Check if your TV has something like this.

A: I had a similar problem recently - different card, 1080p tv.  For me, changing the refresh rate of my monitor from 60Hz to 59Hz fixed the problem.  I don't know why (if anyone has a guess, please leave a comment), but at 59Hz the screen fit the TV and at 60Hz it was a bit too big and part of the picture was cut off.
So, try changing the refresh rate.  In Win 7 it's Control Panel\All Control Panel Items\Display\Screen Resolution, click Advanced Settings and choose the Monitor tab.  I don't know the procedure for Ubuntu, but it should be in the official docs.

A: This happened to me with a Samsung SyncMaster 2333HD monitor connected via HDMI. I solved the problem using this video.
Basically, you need to open the monitor menu (the hardware menu), select Input -> Edit Name and select PC for the HDMI input name. This tells the monitor that it's connected to a VGA output.
It's really counter-intuitive that the setting name is "Edit name" instead of "Connected to", or similar, but that's just how it is.

A: I had the same issue (started with updating to win10) on my laptop with TV, I simply plugged in the HDMI to HDMI2 (instead of 1) and it fixed the problem. Both of them are set to PC mode.
Graphic card: NVIDIA® GeForce® GT 630M
TV: Samsung LE26A330J1


text:
Q: Use Printable String when generating a certificate with Bouncy Castle I'm successfully signing a x509v3 certificate from a CSR using BouncyCastle in Java, but I have a problem: the string format from some of the certificate fields (Subject in this case) is UTF8_STRING and I need it to be PRINTABLE_STRING
When generating the certificate I use an X509v3CertificateBuilder and a CertificateFactory objects plus a JcaX509ExtensionUtils to add some extensions to it.
Any help on how to do this?
Thanks in advance.


text:
Q: Passing multiple Parameters in single Azure Storage Script for various environments I have a powershell script that creates the storage and blob account for a given subscription that works fine . Subscription Name, resource group keeps changing for different environments like DEV,UAT,PROD
STRUCTURE OF MY TEMPLATE / CODE :

param(

 [string] $subscriptionName ="ABC",
 [string] $resourceGroupName = "XYZ",
 [string] $resourceGroupLocation ="westus",
 [string] $templateFilePath = "template.json",
 [string] $parametersFilePath = "parameters.json"
)

Function RegisterRP {
    Param(
        [string]$ResourceProviderNamespace
    )

    Write-Host "Registering resource provider '$ResourceProviderNamespace'";
    Register-AzureRmResourceProvider -ProviderNamespace $ResourceProviderNamespace;
}

$ErrorActionPreference = "Stop"
$confirmExecution = Read-Host -Prompt "Hit Enter to continue."
if($confirmExecution -ne '') {
    Write-Host "Script was stopped by user." -ForegroundColor Yellow
    exit
}
# sign in
Write-Host "Logging in...";
Login-AzureRmAccount;

# select subscription
Write-Host "Selecting subscription '$subscriptionName'";
Select-AzureRmSubscription -SubscriptionName $subscriptionName;

# Register RPs
$resourceProviders = @("microsoft.storage");
if($resourceProviders.length) {
    Write-Host "Registering resource providers"
    foreach($resourceProvider in $resourceProviders) {
        RegisterRP($resourceProvider);
    }
}

#Create or check for existing resource group
$resourceGroup = Get-AzureRmResourceGroup -Name $resourceGroupName -ErrorAction SilentlyContinue
if(!$resourceGroup)
{
    Write-Host "Resource group '$resourceGroupName' does not exist. To create a new resource group, please enter a location.";
    if(!$resourceGroupLocation) {
        $resourceGroupLocation = Read-Host "resourceGroupLocation";
    }
    Write-Host "Creating resource group '$resourceGroupName' in location '$resourceGroupLocation'";
    New-AzureRmResourceGroup -Name $resourceGroupName -Location $resourceGroupLocation
}
else{
    Write-Host "Using existing resource group '$resourceGroupName'";
}

# Start the deployment
Write-Host "Starting deployment...";
if(Test-Path $parametersFilePath) {
   New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -Name $deploymentName -TemplateFile $templateFilePath -TemplateParameterFile $parametersFilePath -storageAccounts_name $storageAccountName
} else {
   New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -Name $deploymentName -TemplateFile $templateFilePath; -storageAccounts_name $storageAccountName
}

Approach 1 :
Created multiple powershell scripts for each denvironment
Created 1 Menu Based powershell script that calls the other script and executes like : Select 1 for Dev , 2 for UAt , 3 for PROD , this approach works but is not effective .
Approach 2 :
I would like to combine all scripts and just have one script for all environments and based on select should allow me to create the storage accounts. Only Subscription and resource group change rest all structure of the powershell remains same .
I tried using GET function commandlets and it selects but still throws the error

 [string] $subscriptionName = Get-AzureSubscription,
 [string] $resourceGroupName = Get-AzureRmLocation,

If i try to use it using an array based approach like passing the values as below im unable to understand how do i pass these array based values to the code and get it to work .
$environment=@('DEV','TEST','QA','PROD')
$resourcegroupname = @('test','test1','test2','test3')
$subscriptionName = @('devsub1','devsub2','test3','prod4')

I'm trying to call the functions using :
$environment[0]
$subscriptionName[0]

It returns the value as below if i execute it seperately but how do i pass these values to my script to create storage account ?
DEV
devsub1

Requesting expert help if anyone has come across such scenarios earlier and if you can help in changing the above code and provide a tested code that would be of great help.
APPROACH 3:

$subscription = @(Get-AzureRmSubscription)
$resourcegroup = @(Get-AzureRmResourceGroup)
$Environment = @('DEV','TEST','QA','PROD')
$resourceGroupName = $resourcegroup | Out-GridView -PassThru -Title 'Pick the environment'
$subscriptionName = $subscription | Out-GridView -PassThru -Title 'Pick the subscription'

Write-Host "Subscription:" $subscriptionName
Write-Host "ResourceGroup:" $resourcegroup

OUTPUT :
If you look at resource group it fails to give the selection option for resource group .
Subscription: < it returns the subscription name >
ResourceGroup: Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.PSResourceGroup Microsoft.Azure.Commands.ResourceManager.Cmd
lets.SdkModels.PSResourceGroup Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.PSResourceGroup Microsoft.Azure.Commands.Res
ourceManager.Cmdlets.SdkModels.PSResourceGroup

A: What you are proposing is an interesting approach.  I would likely an input parameter that defines which environment the work will be done in, and then have a conditional block that sets the dynamic variables for that environment.  There would be some duplication of initialization code for each environment, but the main code block would still be unified.


text:
Q: List of questions to review/edit Could we have a "to-review" page? Posts that might not be of top quality could be submitted for review automatically by the little green unicorns (aka "servers") running StackOverflow.
Possible "to-review" questions/answers can be automatically be detected if they contain:

*

*Errors in punctuation (Under/Excessive/Incorrect Capitalization Like This, no periods, etc).

*Extremely long run on sentences.

*A large number of spelling errors.

*Multiple !?!?!?!?s

*Non-english. (i.e. Unformatted code.)

*Incorrect formatting.

*1337 & 07H3r vv13rd txt, lol!

*Etc

A: I've been maintaining a small editing guide for Ask Ubuntu, maybe some of those can apply here.
It would be nice if there was a collection of SEDE queries that people could try for a while, then see if they are useful, and then have that feedback sent to the SE team so they could incorporate it into /review. For example, I've been searching for "problem" in question titles and usually that seems to be indicative of a too-generic title. Low hanging fruit I guess!


text:
Q: Minimize the product of the least and largest root of a cubic equation. Let $\alpha <0 <\beta$ be real numbers and consider the polynomial $f(x)=x(x-\alpha)(x-\beta).$ Let $S$ be the set of real numbers $s$ such that the polynomial $f(x)-s$ has three real roots. For each $s \in S$ let $p(s)$ be the product of the least and largest root of $f(x)-s$. Determine the least possible value of $p(s)$ when varying $s$ in $S$ and the corresponding values of $s$ at which the minimum is obtained.
This question is from a math Olympiad http://ciim.uan.edu.co/ciim-2018-pruebas. I've been trying to get and answer but I don't seem to get anywhere. I tried using Vieta relations to express the product of the roots in terms of s, $\alpha$ and $\beta$ to then minimize $p(s)$ but no significant progress has been made. I appreciate any help.

A: Let
$$g(x) = f(x) - s = x^3 -(\alpha+\beta)x^2+\alpha\beta x-s$$
Setting
$$\begin{align*} x_N & = \dfrac{\alpha+\beta}{3} \\
\\
\delta^2 &= x_N^2 -\dfrac{\alpha\beta}{3}\\
\\
y_N &= g(x_N) = f(x_N)-s \\
\\
h &= 2\delta^3  \\
\\
\theta(s) &= \dfrac{1}{3}\arccos\left(\dfrac{-y_N}{h}\right) = \dfrac{1}{3}\arccos\left(\dfrac{s-f(x_N)}{h}\right)
\end{align*}$$
The product of the greatest and least root of $g(x)$, $p(s)$ can be expressed as
$$p(s)=\left[x_N +2\delta\cos\left(\theta(s)\right)\right]\left[x_N +2\delta\cos\left(\theta(s)+\dfrac{2\pi}{3}\right)\right]$$
Note that $\theta(s)$ is restricted to $\left[0, \dfrac{\pi}{3}\right]$.
If you can make the argument that $p(s)$ is least when the greatest and least roots of $g(x)$ are farthest apart, then you can make a geometric argument, using a circle of radius $2\delta$ and the triangle formed by the circle's center and the two roots, that the two roots are farthest apart when $\theta(s) = \dfrac{\pi}{6}$, because the projection of the hypotenuse onto the x-axis is maximized for that angle.  See figure 2 on page 6 of this paper for why that projection matters for the placement of the roots on the x-axis.
If $\theta(s) = \dfrac{\pi}{6}$, then
$$\begin{align*} s_{min} &= f(x_N) = f\left(\dfrac{\alpha+\beta}{3}\right) \\
\\
&= x_N^3 - (\alpha+\beta)x_N^2 +\alpha\beta x_N\\
\\
&= \left[\dfrac{\alpha+\beta}{3}\right]\left[-2\left(\dfrac{\alpha+\beta}{3}\right)^2+\alpha\beta\right] \\
\end{align*}$$
So
$$\begin{align*} p(s_{min}) &= \left(x_N + 2\delta\dfrac{\sqrt{3}}{2}\right)\left(x_N - 2\delta\dfrac{\sqrt{3}}{2}\right)\\
\\
&= x_N^2 -3\delta^2\\
\\
&= x_N^2 -3x_N^2 + \alpha\beta\\
\\
&= -2\left(\dfrac{\alpha+\beta}{3}\right)^2 + \alpha\beta\\
\end{align*}$$
And we end up with a curious relationship between the average of the roots, $x_N$, and $s_{min}$ and $p(s_{min})$:
$$s_{min} = x_N \cdot p\left(s_{min}\right)$$


text:
Q: Google Chrome extension Temporary files' location It's been more than 3 hours that I've been looking for the exact location (under OS X 10.6.8), but still can't find it.
I'm using PageSpeed Insights and try to find where e.g. the temporary compressed images are being stored.
The "web" location shown in chrome is :
filesystem:chrome-extension://gplegfbjlmmehdoakndmohflojccocli/temporary/some-file-name
Any ideas?

A: Extension folders can be reached through this:
Library/Application Support/Google/Chrome/Default/Extensions/extensionguid
You can then browse through the specific folder.


text:
Q: How to call Biztalk orchestrations without using the messagebox Is there anyway you could call a Biztalk orchestration without placing a message in the messagebox? The point here is to use an orchestration that is stored and configured in Biztalk but avoid the performance loss of using a database to trigger it.

A: Message box is an integral part of BizTalk server and no transaction can occur without message box. In most cases it works great and having message box provides lots of benefits for message delivery and processing. If you are having performance issues, I would recommend you measure your solution performance and identify bottlenecks. Some key points you can look:

*

*Orchestration Persistent points

*Use BizTalk host settings and change Polling intervals for messaging
and Orchestration to reduce from 500 ms to 50 ms, it does help.

*If message box is a bottleneck (which is usually not the case until your volume is very high) add slave message boxes. BizTalk allows to scale out message box by adding slave message boxes. In this case one message box serves as master and rest others as slaves to process the request. Scale out message box

A: The answer to the question is NO, but, you are probably laboring under a false assumption.
There is no 'performance loss' due to the MessageBox.  If you can prove the MessageBox causes you to miss an SLA, then you should be considering a completely different app platform such as a Windows Service.  However, many of us have implemented very low latency apps with BizTalk without issue.
So, unless you SLA approaches the definition of 'real-time', I wouldn't worry about it.


text:
Q: ORDER BY is not working when I try to use this psql query I have a psql database storing reviews for a certain product.
When the client requests data from the api, it sends in a request with a product_id, count, and a sort as query parameters.
I have this snippit of code below that should query the database and bring back the correct data.
async (query) => {
const sort = {
  relevance: 'helpfulness DESC, date DESC',
  helpfulness: 'helpfulness DESC',
  newest: 'date DESC'
};

const sql = 'SELECT id, product_id, rating, to_timestamp(date / 1000) AS date, summary, body, recommend, reviewer_name, reviewer_email, response, helpfulness, photos FROM reviews WHERE product_id=$1 AND reported=false ORDER BY $2 LIMIT $3'

try {
  const result = await pool.query(sql ,[query.product_id, sort[query.sort] || sort.relevance, query.count || 5]);
  return result;
} catch (error) {
  throw new Error(error);
}}

My issue is that the sort does not apply at all during the query. It will grab the right product_id and also limit the rows that are returned properly but the sort just won't apply.


text:
Q: How could I get CGContextRef from UIImage?     CGContextRef context = ??; // get from UIImage *oldImage

    CGContextSaveGState(context);
    CGRect drawRect = CGRectMake(0, 0, 320, 480);
    CGContextConcatCTM(context, transform);
    UIImage *newImage = [[UIImage alloc] init];
    CGContextDrawImage(context, drawRect, newImage.CGImage);
    [newImage drawInRect:CGRectMake(0, 0, 320, 480)];

    CGContextRestoreGState(context);
In short, what I want to do is [ UIImage -> make some transform -> transformed UIImage].
Any ideas? Big thanks!!

A: I think what you need is this:
UIGraphicsBeginImageContextWithOptions(newImageSize, YES, 0);
CGContextRef context = UIGraphicsGetCurrentContext();
// drawing commands go here
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

Note that UIGraphicsGetImageFromCurrentImageContext() returns an autoreleased UIImage instance.


text:
Q: Large logo in centre of nav She gave me a design, with a big logo in the middle (height is 100px, 6.250em) while the normal list items are 50px in height (3.125em). Now I don't know how to do this.
This is what I have
And this'll be the endresult:

So, can anyone help me?
HTML

home

about

fotoreportage

navatushots

portfolio

voorwaarden

contact

CSS:
body{
    background-color:#c3c3c3;
}

nav{
    width:100%;

    list-style:none;
    text-align:center;

    background-color:#fff;
}

nav li{
    display: inline-block;
}

nav li a{
    height:3.125em;
    line-height:50px;

    text-decoration:none;
    color:#000;
}

nav li#logo{
    height:100px;
    line-height:6.250em;
    background-color:#595450;
    color:#fff;
}

A: As @DaveRook suggested in the comments, using separate ul-li sections would be much easier.
Fiddle link
HTML

home

about

fotoreportage

navatushots

portfolio

voorwaarden

contact

CSS
body {
    background-color:#c3c3c3;
}
nav {
    width:100%;
    list-style:none;
    text-align:center;
    background-color:#fff;
}
nav ul, nav li {
    display: inline-block;
}
nav li a {
    height:3.125em;
    line-height:50px;
    text-decoration:none;
    color:#000;
}
nav li#logo {
    height:100px;
    line-height:6.250em;
    background-color:#595450;
    color:#fff;
}

A: Just to provide you a little re-thinking on your markup, here's a more kind of semantic solution: http://jsfiddle.net/Qh3X5/

NavatuShots

home

about

fotoreportage

portfolio

voorwarden

contact

The Logo is now wrapped in a H1, which contains the word "NavatuShots", but is not displayed due to "text-indent: -9999px;", instead your logo is shown with a background-image. It's also recommended, that you add your home-link to the H1, since people might try to click it.
The positioning of the logo is made by "position: absolute; left: 50%; top: 0;". Then a negative margin of the half of the logo's width is added to the H1 element, so it's centered correctly.
On the other side, the ul-element isn't split up, I've added to helper classes, which provide some margin to the li-elements in the middle.
That's pretty much it.

A: If you're looking to display the logo in its position but not stretch the height of its container, maybe this is what you're looking for: http://jsfiddle.net/d92Ux/1/
--EDIT--
Updated demo: http://jsfiddle.net/d92Ux/4/


text:
Q: Linux kernel remote debugging: Can not break back into debugger I am debugging linux ubuntu kernel using kgdb / remote gdb. I have 2 computers - ubuntu target and windows host. Computers are connected using serial port and null-modem cable.
KGDB support is enabled in target ubuntu system, command options fro KGDB:
kgdbwait kgdboc=ttyS0,115200
On my Windows system i have MinGW gdb build (x86_64):

GNU gdb (GDB) 7.4 Copyright (C) 2012 Free Software Foundation, Inc.
  This GDB was configured as "x86_64-w64-mingw32".

I start my target system and it waits till remote debugger connection. I enter the following commands in GDB window:
(gdb) set remotebaud 115200
(gdb) target remote COM4

My gdb is able to connect to target and prints the following:

Remote debugging using COM4
     ???() at kernel/debug/debug_core.c:1043                                            wmb(); /* Sync point after breakpoint */

I then enter command to set breakpoints to be able to return to gdb when OS is booted:
(gdb) b sys_sync

Breakpoint 1 at 0xffffffff8124a710

I also tried hardware-assisted breakpoints in another run of same setup:
(gdb) hbreak sys_sync

This breakpoint setup should lead to kernel beak back to debuger when i enter sync command from target ubuntu console.
After i hit continue in GDB, OS is booted OK, but i never able to bring control back to gdb. I tried setting breakpoints on sys_sync, i tried
echo g > /proc/sysrq-trigger

in all cases with no success.
Very interesting: if i dont initially set breakpoint in sys_sync, entering sync command later does nothing. If i set sys_sync breakpoint, entering sync command later do halt target computer completely - so i suppose breakpoint actually set in this case.
How to break into debugger? GDB becomes irresponsive to any CTrl-C commands, so no way to continue debuging after i initially hit continue.
May be architecture incompatibility (Windows gdb - Linux target) - but seems like breakpoints are really set.
Please help

A: On your Test machine: login as a superuser.
sudo su

and after that generate a sysrq-trigger
echo g > /proc/sysrq-trigger

After this your target machine should freeze but the dev machine should break into target.

A: Lower the baud rate on both ends.  In my experience, while the 115200 baud rate is theoretically supported, it rarely works properly.  I recommend dropping the baud rate down to 9600 (on both ends), and finding success.  Once that is achieved, then you can step the speed back up one step at a time.  I am rarely able to get the kgdb to work reliably beyond 34K baud, and often lower.  And I have also made sure to use the proper RTS/CTS cross linked connectors, some store bought, and some hand-made.  It never matters, I think the problem is some issue in kgdboc on the SUT side that does not really always work at full 115200 baud rate.   Solution is just to lower the baud rate to 9600.  The data is small, so the lower speed does not hurt anything, and having it work reliably is worth any speed penalty.


text:
Q: Añadir fila de campos input Hola me gustaría que al hacer click en un botón por ejemplo me apareciesen tantas de campos como clicks de al boton +

A: lo que deberías hacer es crear una variable:any[] = [] y en el evento  de (click) y luego hacerle push ejemplo:
components.ts
crear variable:
public subPeriodos:any[] = [];

evento click
public addElemnt(){
    this.subPeriodos.push({
      "descripcion":"",
      "fechainicio":"",
      "fechafin":"",
      "estadovisible":1,
      "estadoactivo": 0
    });
  }

en tu html seria de esta forma:

      {{i+1}}

      <input type="text" class="form-control" [(ngModel)]="d.descripcion">

          <input type="date" class="form-control has-feedback-left" [ngModel]="d.fechainicio | dateInBootstrap" >

      <input type="date" class="form-control has-feedback-left" [ngModel]="d.fechafin | dateInBootstrap" >