text:
Q: How can this multiple loop have pagination as described? In the paste below is the code for the template running the CPT archive page at http://www.m.angiemeekerdesigns.com/totd
Everything about the page is working as expected except the pagination. What would like to happen is that when "Next Page" is clicked, Page 2 and forwards show the next posts from the CPT archive that were not also shown in one of the two loops on the first page.
SO, I would not like for the first loop to repeat on subsequent pages, and I do not want subsequent pages to have the first post offset, and since there are 11 total posts on page 1 of this archive, I'd like the next page to not show those first 11 posts.
Right now what is happening is that it is not showing the first loop (good), it is not offsetting the first post (good), but it is showing all 11 posts from the first page - for page 2 and every page after.
Whew!
Can this archive be corrected to paginate as I'd like? I have read MANY other posts and the codex on pagination for loops, and multiple loops (that's how I got to what I have), but alas, what I have is not working.
<?php

/**
 *
 * Display the Tip of the Day Custom Post Type archive custom fields using
 * ACF.
 *
 * @author Angie Meeker
 * @uses   Advanced Custom Fields
 */

add_action('genesis_entry_content','genesis_do_post_title', 2);

 //* Add Tip of the Day body class to the head
add_filter( 'body_class', 'add_tiparchives_body_class' );
function add_tiparchives_body_class( $classes ) {
   $classes[] = 'tiparchives-post-type-archive-{tipoftheday}';
   return $classes;
}

 // Return Category and Tip of the Day on Single Posts
add_action ( 'genesis_before_content', 'show_totd', 9 );
function show_totd() {
        echo '
Tip of the Day
';
}
  // Remove Post Author
add_filter( 'genesis_post_info', 'remove_post_author_totd_posts' );
function remove_post_author_totd_posts($post_info) {
    $post_info = '[post_date]';
    return $post_info;
}

/** Replace the standard loop with our custom loop */
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'totd_do_loop');
add_action( 'genesis_loop', 'totd_teasers_do_loop');

add_action('genesis_loop', 'totd_do_loop');
function totd_do_loop() {
if ( !is_paged() ) {
    global $wp_query;
    // Set up your query here
    $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
    $query = array(
        'post_type'      => 'tipoftheday',
        'orderby'        => 'date',
        'posts_per_page' => '1',

    );

    $wp_query = new WP_Query( $query );

    if( $wp_query->have_posts() ):
        while( $wp_query->have_posts() ): $wp_query->the_post();
            // Get the custom fields
                    // Store the pre tips data
        $tips_data_pre = array(
                'totd_tags' => get_field( 'totd_tags' ),
                'tip_article_headline' => get_field( 'tip_article_headline' ),
                'article_author' => get_field( 'article_author' ),
                'article_author_link' => get_field( 'article_author_link' ),
        );

// Only output if we have tips data
        if ($tips_data_pre['totd_tags'] != '' ||
                $tips_data_pre['tip_article_headline'] != '' ||
                $tips_data_pre['article_author'] != '' ||
                $tips_data_pre['article_author_link'] != '') {
               echo '' , do_shortcode('[post_date]'),'' ;

                echo '

';
               echo '
' . get_the_title() . '
';
                           echo the_excerpt();
                                echo '
' , do_shortcode('[post_terms taxonomy="totd_tags" before="See More Tips For: " taxonomy="totd_tags"] '),'
' ;
                                echo '

Share This Tip:

';

                echo '
';
        }

        endwhile;

    endif;
    // Reset the query
    wp_reset_query();
    }
}

add_action('genesis_loop', 'totd_teasers_do_loop');
function totd_teasers_do_loop() {
    global $wp_query;
    // Set up your query here
    $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 0;
    $query = array(
        'post_type'      => 'tipoftheday',
        'orderby'        => 'date',
        'posts_per_page' => '10',
        'offset'        => '1',
        'paged'  => $paged,
    );

    $wp_query = new WP_Query( $query );

    if( $wp_query->have_posts() ):
        while( $wp_query->have_posts() ): $wp_query->the_post();
            // Get the custom fields
                    // Store the pre tips data
        $tips_data_pre = array(
                'totd_tags' => get_field( 'totd_tags' ),
                'tip_article_headline' => get_field( 'tip_article_headline' ),
                'article_author' => get_field( 'article_author' ),
                'article_author_link' => get_field( 'article_author_link' ),
        );

// Only output if we have tips data
        if ($tips_data_pre['totd_tags'] != '' ||
                $tips_data_pre['tip_article_headline'] != '' ||
                $tips_data_pre['article_author'] != '' ||
                $tips_data_pre['article_author_link'] != '') {
                echo '

                ',get_the_time( 'l' ),'
                ',get_the_time( 'm/d/Y' ),'
';

                echo '

';
echo '
' . get_the_title() . '
';
                $excerpt = get_the_excerpt();
  echo string_limit_words($excerpt,25); echo 'ID) . '"> Continue Reading→';
                                echo '
' , do_shortcode('[post_terms taxonomy="totd_tags" before="See More Tips For: " taxonomy="totd_tags"] '),'
' ;
                                echo '

';

                echo '
';
        }

        endwhile;
        // Pagination! Woo!
        genesis_posts_nav();
    endif;
    // Reset the query
    wp_reset_query();
}

genesis();

EDITED
I've come back to show my progress which used most of that same code offered by @mneil below (someone also mentioned in it the WP.org forums). The pagination does work correctly, and the first post is showing correctly in the first loop, but now the second loop is not offsetting properly (not skipping that latest post - the same shown in the first loop). Besides that though, this does work. Any thoughts on why the second loop would now skip the offset post?
   /** Replace the standard loop with our custom loop */
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'totd_do_loop');
add_action( 'genesis_loop', 'totd_teasers_do_loop');

add_action('pre_get_posts', 'myprefix_query_offset', 1 );
function myprefix_query_offset(&$query) {

    //First, define your desired offset...
    $offset = 0;

    //Next, determine how many posts per page you want (we'll use WordPress's settings)
    $ppp = 11;

    //Next, detect and handle pagination...
    if ( $query->is_paged ) {

        //Manually determine page query offset (offset + current page (minus one) x posts per page)
        $page_offset = $offset + ( ($query->query_vars['paged']-1) * $ppp );

        //Apply adjust page offset
        $query->set('offset', $page_offset );

    }
    else {

        //This is the first page. Just use the offset...
        $query->set('offset',$offset);

    }
}

add_filter('found_posts', 'myprefix_adjust_offset_pagination', 1, 2 );
function myprefix_adjust_offset_pagination($found_posts, $query) {

    //Define our offset again...
    $offset = 0;

    //Ensure we're modifying the right query object...
        //Reduce WordPress's found_posts count by the offset...
        return $found_posts - $offset;
    }

add_action('genesis_loop', 'totd_do_loop');
function totd_do_loop() {
if ( !is_paged() ) {
    global $wp_query;
    // Set up your query here
    $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
    $query = array(
        'post_type'      => 'tipoftheday',
        'orderby'        => 'date',
        'posts_per_page' => '1',

    );

    $wp_query = new WP_Query( $query );

    if( $wp_query->have_posts() ):
        while( $wp_query->have_posts() ): $wp_query->the_post();
        $do_not_duplicate = $post->ID;
            // Get the custom fields
                    // Store the pre tips data
        $tips_data_pre = array(
                'totd_tags' => get_field( 'totd_tags' ),
                'tip_article_headline' => get_field( 'tip_article_headline' ),
                'article_author' => get_field( 'article_author' ),
                'article_author_link' => get_field( 'article_author_link' ),
        );

// Only output if we have tips data
        if ($tips_data_pre['totd_tags'] != '' ||
                $tips_data_pre['tip_article_headline'] != '' ||
                $tips_data_pre['article_author'] != '' ||
                $tips_data_pre['article_author_link'] != '') {
               echo '' , do_shortcode('[post_date]'),'' ;

                echo '

';
               echo '
' . get_the_title() . '
';
                           echo the_excerpt();
                                echo '
' , do_shortcode('[post_terms taxonomy="totd_tags" before="See More Tips For: " taxonomy="totd_tags"] '),'
' ;
                                echo '

Share This Tip:

';

                echo '
';
        }

        endwhile;

    endif;
    // Reset the query
    wp_reset_query();
    }
}

add_action('genesis_loop', 'totd_teasers_do_loop');
function totd_teasers_do_loop() {
    global $wp_query;
    // Set up your query here
    $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 0;
    $query = array(
        'post_type'      => 'tipoftheday',
        'orderby'        => 'date',
        'posts_per_page' => '10',
        'offset'        => '1',
        'paged'  => $paged,
    );

    $wp_query = new WP_Query( $query );

    if( $wp_query->have_posts() ):
        while( $wp_query->have_posts() ): $wp_query->the_post();

            // Get the custom fields
                    // Store the pre tips data
        $tips_data_pre = array(
                'totd_tags' => get_field( 'totd_tags' ),
                'tip_article_headline' => get_field( 'tip_article_headline' ),
                'article_author' => get_field( 'article_author' ),
                'article_author_link' => get_field( 'article_author_link' ),
        );

// Only output if we have tips data
        if ($tips_data_pre['totd_tags'] != '' ||
                $tips_data_pre['tip_article_headline'] != '' ||
                $tips_data_pre['article_author'] != '' ||
                $tips_data_pre['article_author_link'] != '') {
                echo '

                ',get_the_time( 'l' ),'
                ',get_the_time( 'm/d/Y' ),'
';

                echo '

';
echo '
' . get_the_title() . '
';
                $excerpt = get_the_excerpt();
  echo string_limit_words($excerpt,25); echo 'ID) . '"> Continue Reading→';
                                echo '
' , do_shortcode('[post_terms taxonomy="totd_tags" before="See More Tips For: " taxonomy="totd_tags"] '),'
' ;
                                echo '

';

                echo '
';
        }

        endwhile;
        // Pagination! Woo!
        genesis_posts_nav();
    endif;
    // Reset the query
    wp_reset_query();
}

A: First off, to me it looks like the first loop just grabs the first posts of post type tip of the day, and then the second loop grabs the rest minus the first, so unless I am misunderstanding the function of your loops, I would just do 1 loop, check if it is the first iteration, if so, grab the separate data for the first post, then on all other iterations grab the data you need for the rest. Also as a double security measure, when checking if its the first iteration of the loop, also check to make sure it is not paged, i.e. it is on the first page of results, not page 2, 3 etc. That should just be a simple check of $wp_query->is_paged

DISCLAIMER: Upon reaching basically the end of writing this long
  answer, I realized that it pretty much will not work because filtering
  into pre_get_posts affects all queries including the get_posts()
  function. I decided to leave the full answer as some of its
  information may help you and possibly editing it around a little bit
  can solver your issue. However I believe what I wrote above is the
  simplest solution unless I misunderstand your intentions completely.

However, I will assume you need two seperate loops for other reasons, so on to my answer. I didnt test any of this so you'll have to test it out and see if it works, but the issue is that you are using offest, which will break pagination. Wordpress suggests that you have to handle pagination manually. http://codex.wordpress.org/Making_Custom_Queries_using_Offset_and_Pagination
Also im going to assume that the second loop that only has posts per page = 1 is that you just want the first post on the archive to be that type etc.
First lets solve the pagination issue with offset following wordpress advice (modified for you).
add_action('pre_get_posts', 'myprefix_query_offset', 1 );
function myprefix_query_offset(&$query) {

    // Before anything else, make sure this is the right page...
    // Assuming this is a page. if its an archive, etc. choose the correct conditional
    // tag
    if ( ! is_page('totd') ) {
        return;
    }

    //First, define your desired offset...
    $offset = 1;

    //Next, determine how many posts per page you want
    $ppp = 10;

    //Next, detect and handle pagination...
    if ( $query->is_paged ) {

        //Manually determine page query offset (offset + current page (minus one) x posts per page)
        $page_offset = $offset + ( ($query->query_vars['paged']-1) * $ppp );

        //Apply adjust page offset
        $query->set('offset', $page_offset );

    }
    else {

        //This is the first page. Just use the offset...
        $query->set('offset',$offset);

    }
}

Next wordpress tells us to modify the found posts variable since it doesnt take into account your offset
add_filter('found_posts', 'myprefix_adjust_offset_pagination', 1, 2 );
function myprefix_adjust_offset_pagination($found_posts, $query) {

    //Define our offset again...
    $offset = 1;

    // make sure this is the right page...
    // Assuming this is a page. if its an archive, etc. choose the correct conditional
    // tag
    if ( is_page('totd') ) {
        //Reduce WordPress's found_posts count by the offset...
        return $found_posts - $offset;
    }
}

Now im pretty sure that since pre_get_posts fires for every posts query, and we are checking if its the totd page, it would fire for both you're loops, so what I would do is now filter into the_posts and just insert that post into front of the $posts array.
function myprefix_add_first_post($posts){
    global $wp_query;

    // make sure this is the right page...
    // Assuming this is a page. if its an archive, etc. choose the correct conditional
    // tag, as well as make sure we are not on page 2, 3 etc of pagination
    if(!is_admin() && is_page('totd') && !($wp_query->is_paged)){
        $query_args = array(
                'post_type'      => 'tipoftheday',
                'orderby'        => 'date',
                'posts_per_page' => '1',

            );
        $first_post = get_posts($query_args);
        $all_posts = array_unshift($posts, $first_post[0])
        return $all_posts;
    }
    else{
        return $posts;
    }
}
add_filter('the_posts', 'myprefix_add_first_post', 1);

This should grab the first post and throw it in. You will still have to check for the first iteration of your loop and style it accordingly. (WARNING: as disclaimer claimed at top, pre_get_posts will still filter the get_posts(), so the above will probably not work without further editing.)

A: Here is the final code that worked:
/** Replace the standard loop with our custom loop */
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'totd_do_loop');
add_action( 'genesis_loop', 'totd_teasers_do_loop');

add_action('pre_get_posts', 'myprefix_query_offset', 1 );
function myprefix_query_offset(&$query) {

    //First, define your desired offset...
    $offset = $query->get('offset');

    //Next, determine how many posts per page you want (we'll use WordPress's settings)
    $ppp = 10;

    //Next, detect and handle pagination...
    if ( $query->is_paged ) {

        //Manually determine page query offset (offset + current page (minus one) x posts per page)
        $page_offset = $offset + ( ($query->query_vars['paged']-1) * $ppp );

        //Apply adjust page offset
        $query->set('offset', $page_offset );

    }
    else {

        //This is the first page. Just use the offset...
        $query->set('offset',$offset);

    }
}

add_filter('found_posts', 'myprefix_adjust_offset_pagination', 1, 2 );
function myprefix_adjust_offset_pagination($found_posts, $query) {

    //Define our offset again...
    $offset = $query->get('offset');

        //Reduce WordPress's found_posts count by the offset...
        return $found_posts - $offset;
    }

add_action('genesis_loop', 'totd_do_loop');
function totd_do_loop() {
if ( !is_paged() ) {
    global $wp_query;
    // Set up your query here
    $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
    $query = array(
        'post_type'      => 'tipoftheday',
        'orderby'        => 'date',
        'posts_per_page' => '1',

    );

    $wp_query = new WP_Query( $query );

    if( $wp_query->have_posts() ):
        while( $wp_query->have_posts() ): $wp_query->the_post();
            // Get the custom fields
                    // Store the pre tips data
        $tips_data_pre = array(
                'totd_tags' => get_field( 'totd_tags' ),
                'tip_article_headline' => get_field( 'tip_article_headline' ),
                'article_author' => get_field( 'article_author' ),
                'article_author_link' => get_field( 'article_author_link' ),
        );

// Only output if we have tips data
        if ($tips_data_pre['totd_tags'] != '' ||
                $tips_data_pre['tip_article_headline'] != '' ||
                $tips_data_pre['article_author'] != '' ||
                $tips_data_pre['article_author_link'] != '') {
               echo '' , do_shortcode('[post_date]'),'' ;

                echo '

';
               echo '
' . get_the_title() . '
';
                           echo the_excerpt();
                                echo '
' , do_shortcode('[post_terms taxonomy="totd_tags" before="See More Tips For: " taxonomy="totd_tags"] '),'
' ;
                                echo '

Share This Tip:

';

                echo '
';
        }

        endwhile;

    endif;
    // Reset the query
    wp_reset_query();
    }
}

add_action('genesis_loop', 'totd_teasers_do_loop');
function totd_teasers_do_loop() {
    global $wp_query;
    // Set up your query here
    $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 0;
    $query = array(
        'post_type'      => 'tipoftheday',
        'orderby'        => 'date',
        'posts_per_page' => '10',
        'offset'        => '1',
        'paged'  => $paged,
    );

    $wp_query = new WP_Query( $query );

    if( $wp_query->have_posts() ):
        while( $wp_query->have_posts() ): $wp_query->the_post();

            // Get the custom fields
                    // Store the pre tips data
        $tips_data_pre = array(
                'totd_tags' => get_field( 'totd_tags' ),
                'tip_article_headline' => get_field( 'tip_article_headline' ),
                'article_author' => get_field( 'article_author' ),
                'article_author_link' => get_field( 'article_author_link' ),
        );

// Only output if we have tips data
        if ($tips_data_pre['totd_tags'] != '' ||
                $tips_data_pre['tip_article_headline'] != '' ||
                $tips_data_pre['article_author'] != '' ||
                $tips_data_pre['article_author_link'] != '') {
                echo '

                ',get_the_time( 'l' ),'
                ',get_the_time( 'm/d/Y' ),'
';

                echo '

';
echo '
' . get_the_title() . '
';
                $excerpt = get_the_excerpt();
  echo string_limit_words($excerpt,25); echo 'ID) . '"> Continue Reading→';
                                echo '
' , do_shortcode('[post_terms taxonomy="totd_tags" before="See More Tips For: " taxonomy="totd_tags"] '),'
' ;
                                echo '

';

                echo '
';
        }

        endwhile;
        // Pagination! Woo!
        genesis_posts_nav();
    endif;
    // Reset the query
    wp_reset_query();
}


text:
Q: Processlist show most of the queries are sending data for select query I have faced some problem like sending data state in processlist. In my application I used parallel processing which send 50 count at a time, and that will do some MySQL database operation (select and insert), but after few minutes nothing happened. Then I see in database with SHOW PROCESSLIST; most of the query is in SENDING DATA state with 1001 threads. my max query size is 1000. I decrease the size 50 to 10 but no luck. Can anyone suggest me how to solve this problem.

A: This is very simply a case where your server does not have sufficient capacity (often disk I/O, but sometimes memory or CPU) to handle the workload.  Poorly-written queries and insufficient or sub-optimal indexes are a common contributor, as are applications that give up too soon and re-send the same query that's already running, and an improperly sized innodb_buffer_pool_size with InnoDB.
Sending Data was a very poorly-chosen name for the thread state.  It simply does not mean that the server is necessarily "sending" anything.  The server may, in fact, still be doing table scans and may have nothing, yet, to send anywhere, and the thread will still be in this state.  A more appropriate name for the state might have been "preparing data to send."
By contrast, when the server is in fact actually sending data to the client, the state is Writing to net and it's pretty rare to actually see that in the processlist unless the resultset is particularly large or the client is particularly slow about accepting data from the network.

Sending data
The thread is reading and processing rows for a SELECT statement, and sending data to the client. Because operations occurring during this state tend to perform large amounts of disk access (reads), it is often the longest-running state over the lifetime of a given query.
Writing to net
The server is writing a packet to the network.
— http://dev.mysql.com/doc/refman/5.6/en/general-thread-states.html

redpajama_set_name: RedPajamaStackExchange


text:
Q: Rename column SQL Server 2008 I am using SQL Server 2008 and Navicat. I need to rename a column in a table using SQL.
ALTER TABLE table_name RENAME COLUMN old_name to new_name;

This statement doesn't work.

A: Try:
EXEC sp_rename 'TableName.OldName', 'NewName', 'COLUMN'

A: Improved version of @Taher
DECLARE @SchemaName AS VARCHAR(128)
DECLARE @TableName AS VARCHAR(128)
DECLARE @OldColumnName AS VARCHAR(128)
DECLARE @NewColumnName AS VARCHAR(128)
DECLARE @ParamValue AS VARCHAR(1000)

SET @SchemaName = 'dbo'
SET @TableName = 'tableName'
SET @OldColumnName = 'OldColumnName'
SET @NewColumnName = 'NewColumnName'
SET @ParamValue = @SchemaName + '.' + @TableName + '.' + @OldColumnName

IF EXISTS
(
    SELECT 1 FROM sys.columns WHERE name = @OldColumnName AND OBJECT_NAME(object_id) = @TableName
)
AND NOT EXISTS
(
    SELECT 1 FROM sys.columns WHERE name = @NewColumnName AND OBJECT_NAME(object_id) = @TableName
)
BEGIN
    EXEC sp_rename @ParamValue, @NewColumnName, 'COLUMN';
END

A: Sql Server management studio has some system defined Stored Procedures(SP)
One of which is used to rename a column.The SP is sp_rename
Syntax: sp_rename '[table_name].old_column_name', 'new_column_name'
For further help refer this article: sp_rename by Microsoft Docs
Note: On execution of this SP the sql server will give you a caution message as 'Caution: Changing any part of an object name could break scripts and stored procedures'.This is critical only if you have written your own sp which involves the column in the table you are about to change.

A: You should also specify the schema of the table or you might get this error:

Msg 15248, Level 11, State 1, Procedure sp_rename, Line 238 Either the
  parameter @objname is ambiguous or the claimed @objtype (COLUMN) is
  wrong.

If it is a deployment script I would also recommend adding some additional security to it.
IF EXISTS (
        SELECT 1
        FROM sys.columns
        WHERE
            name = 'OldColumnName' AND
            object_name(object_id) = 'TableName'
    ) AND
    NOT EXISTS (
        SELECT 1
        FROM sys.columns
        WHERE
            name = 'NewColumnName' AND
            object_name(object_id) = 'TableName'
    )
    EXEC sp_RENAME 'SchemaName.TableName.OldColumnName', 'NewColumnName', 'COLUMN';

A: Since I often come here and then wondering how to use the brackets, this answer might be useful for those like me.
EXEC sp_rename '[DB].[dbo].[Tablename].OldColumnName', 'NewColumnName', 'COLUMN';

*

*The OldColumnName must not be in []. It will not work.

*Don't put NewColumnName into [], it will result into [[NewColumnName]].

A: You can use sp_rename to rename a column.
USE YourDatabase;
GO
EXEC sp_rename 'TableName.OldColumnName', 'NewColumnName', 'COLUMN';
GO

The first parameter is the object to be modified, the second parameter is the new name that will be given to the object, and the third parameter COLUMN informs the server that the rename is for the column, and can also be used to rename tables, index and alias data type.

A: It would be a good suggestion to use an already built-in function but another way around is to:

*

*Create a new column with same data type and NEW NAME.

*Run an UPDATE/INSERT statement to copy all the data into new column.

*Drop the old column.

The benefit behind using the sp_rename is that it takes care of all the relations associated with it.
From the documentation:

sp_rename automatically renames the associated index whenever a PRIMARY KEY or UNIQUE constraint is renamed. If a renamed index is tied to a PRIMARY KEY constraint, the PRIMARY KEY constraint is also automatically renamed by sp_rename. sp_rename can be used to rename primary and secondary XML indexes.

A: Use sp_rename
EXEC sp_RENAME 'TableName.OldColumnName' , 'NewColumnName', 'COLUMN'

See: SQL SERVER – How to Rename a Column Name or Table Name
Documentation: sp_rename (Transact-SQL)
For your case it would be:
EXEC sp_RENAME 'table_name.old_name', 'new_name', 'COLUMN'

Remember to use single quotes to enclose your values.

A: Alternatively to SQL, you can do this in Microsoft SQL Server Management Studio. Here are a few quick ways using the GUI:
First Way
Slow double-click on the column. The column name will become an editable text box.

Second Way
Right click on column and choose Rename from the context menu.
For example:

Third Way
This way is preferable for when you need to rename multiple columns in one go.

*

*Right-click on the table that contains the column that needs renaming.

*Click Design.

*In the table design panel, click and edit the textbox of the column name you want to alter.

For example:

NOTE: I know OP specifically asked for SQL solution, thought this might help others :)

A: Or you could just slow-click twice on the column in SQL Management Studio and rename it through the UI...

A: Run Query:
    SP_RENAME '[TableName].[ColumnName]','NewNameForColumn'


text:
Q: Using inception v4 in retrain example I am trying to adapt the example retrain script ( https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/image_retraining/retrain.py ) to use the Inception V4 model.
The script already supports the retraining of Inception V3 (2015) as well as different versions of Mobilenets.
What I've done so far:
Since the script uses protobuf (.pb) files and not checkpoints (.ckpt), I downloaded the inception_v4.pb from here: https://deepdetect.com/models/tf/inception_v4.pb. As far as I understand, one could also have loaded the checkpoint and used the freeze graph tool to obtain the same file.
Then, I viewed the graph in tensorboard using the tensorflow python tool import_pb_to_tensorboard.py which can be found in the tensorflow github repository.
From there (correct me if I am not wrong) I found that the resized_input_tensor_name is called InputImage whereas the bottleneck_tensor_name is InceptionV4/Logits/Logits/MatMul with bottleneck_tensor_size is 1001.
Having this information I tried to adapt the create_model_info(architecture) function of the retrain script by adding:

    elif architecture == 'inception_v4':
        data_url = 'http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz' #this won't make any difference
        bottleneck_tensor_name = 'InceptionV4/Logits/Logits/MatMul'
        bottleneck_tensor_size = 1001
        input_width = 299
        input_height = 299
        input_depth = 3
        resized_input_tensor_name = 'InputImage'
        model_file_name = 'inception_v4.pb'
        input_mean = 128
        input_std = 128

I run the script using the following command:

python retrain.py --architecture=inception_v4 --bottleneck_dir=test2/bottlenecks --model_dir=inception_v4 --summaries_dir=test2/summaries/basic --output_graph=test2/graph_flowers.pb --output_labels=test2/labels_flowers.txt --image_dir=datasets/flowers/flower_photos --how_many_training_steps 100

and I am getting the following error:

File "retrain.py", line 373, in create_bottleneck_file str(e)))
  RuntimeError: Error during processing file datasets/flowers/flower_photos/tulips/4546299243_23cd58eb43.jpg (Cannot interpret feed_dict key as Tensor: Can not convert a Operation into a Tensor.)

A: I'm working through the same thing currently.
Try to add :0 to the end of your bottleneck_tensor_name and your resized_input_tensor_name.
If you'll notice in retrain.py, Google also uses this :0 nomenclature.
My suspicion is that, for you, InceptionV4/Logits/Logits/MatMul is just an operation, which you're not trying to get for this script, while InceptionV4/Logits/Logits/MatMul:0 is the first tensor instantiated from that operation, which you are trying to get for this script.

A: Add this modification to your script then InputImage is viewed as a Tensor:
resized_input_tensor_name = 'InputImage:0'


text:
Q: Fill armadillo vec from HDF5 vector I am trying to read a vector from and HDF5 file into an Armadillo vector but I keep getting a seg fault at the reading stage. I'm not sure what I'm missing, it seems straight forward but I guess not... Any help would be greatly appreciated
int main(void)
{
    H5::H5File fid = H5::H5File("element_pattern.h5",H5F_ACC_RDONLY);
    H5::DataSet   dataset    = fid.openDataSet("freq_collect");
    H5::DataSpace dataspace  = dataset.getSpace();
    H5::StrType   datatype   = dataset.getStrType();

    const int rank = dataspace.getSimpleExtentNdims();
    hsize_t dims_out[rank];
    const int ndims = dataspace.getSimpleExtentDims( dims_out, NULL);

    vec freq_collect(zeros<vec>(dims_out[0]));

    dataset.read(&freq_collect, datatype, dataspace);

}

A: Solution:
&freq_collect should be freq_collect.memptr()
.memptr() is raw pointer to memory and is the correct way to store the data


text:
Q: How to pass splash cookie to Scrapy Rule attribute in CrawlSpider I am trying to maintain a user session while scraping a site using the splash session handling as described on the splash Github repo. so my question is what is the possible way to maintain the user sessions while following rules?
Just like I was able to pass the cookies and headers to after_login method, is there a way I can do the same while processing requests(process_request="use_splash") in the rules extractor using splash? I am a newbie in scrapy-splash, so I am sorry if my question sounds a bit foggy, and I just posted a minimal example here.
rules = (

 Rule(LinkExtractor(restrict_xpaths="//div[@id= 'archive-tables']//tbody/tr[@xsid=1]/td/a"), process\_request="use_splash", follow=True),
 Rule(LinkExtractor(restrict_xpaths="//div[@class = 'main-menu2 main-menu-gray']//strong/a"),process_request="use_splash", callback= 'parse', follow=True),
     )

def start_requests(self):
    """called before crawling starts. Try to login"""
      yield SplashRequest(
      url=self.login_page,  callback=self.after_login,  endpoint='execute',
       args={'lua_source': self.login_lua,'wait': 2,'timeout':90,'images':0},
        )

def after_login(self, response):
     cookies = response.data['cookies']
     headers = response.data['headers']
     url = 'https://www.oddsportal.com/results/'
     yield SplashRequest(url=url, endpoint='execute',cache_args=\['lua_source'],
                 cookies=cookies, headers=headers, args=
                     {'lua_source':self.lua_request},errback=self.errback_httpbin,
                        dont_filter=True)

def use_splash(self, request, response):
    #print(response.cookiejar)
    #print('check the cookies',response.url,response.meta['splash']['args']['cookies'])
    request.meta.update(splash={'args': {'wait': 0.5,'session_id':1,
 \# 'lua\_source':self.lua\_request --gives me error
            },'endpoint': 'execute','timeout':90,'images': 0})
 return request


text:
Q: C++ insertion operator << with two ints I am new to c++ and I was playing around.
I tried to do
int << int, and it gave me unexpected results.
What is the behavior or the math behind the insertion operator, if you use it on two numbers.
I didn't find anything in the documentation either.
I hope someone can clear this up.
I also tried some sequences:
Here i assumed its the power of 1, but it is clearly not its the power of 2.
1 << 1 = 2
1 << 2 = 4
1 << 3 = 8
1 << 4 = 16
1 << 5 = 32
1 << 6 = 64
1 << 7 = 128
1 << 8 = 256
1 << 9 = 512
1 << 10 = 1024
1 << 11 = 2048
1 << 12 = 4096
1 << 13 = 8192
1 << 14 = 16384
1 << 15 = 32768
1 << 16 = 65536
1 << 17 = 131072
1 << 18 = 262144
1 << 19 = 524288
1 << 20 = 1048576
1 << 21 = 2097152
1 << 22 = 4194304
1 << 23 = 8388608
1 << 24 = 16777216
1 << 25 = 33554432
1 << 26 = 67108864
1 << 27 = 134217728
1 << 28 = 268435456
1 << 29 = 536870912
1 << 30 = 1073741824

3 << 0 = 3
3 << 1 = 6
3 << 2 = 12
3 << 3 = 24
3 << 4 = 48
3 << 5 = 96
3 << 6 = 192
3 << 7 = 384
3 << 8 = 768
3 << 9 = 1536
3 << 10 = 3072
3 << 11 = 6144
3 << 12 = 12288
3 << 13 = 24576
3 << 14 = 49152
3 << 15 = 98304
3 << 16 = 196608
3 << 17 = 393216
3 << 18 = 786432
3 << 19 = 1572864
3 << 20 = 3145728
3 << 21 = 6291456
3 << 22 = 12582912
3 << 23 = 25165824
3 << 24 = 50331648
3 << 25 = 100663296
3 << 26 = 201326592
3 << 27 = 402653184
3 << 28 = 805306368
3 << 29 = 1610612736


text:
Q: Como puedo hacer yo para mostrar el nombre y no el id en un select? Como puedo hacer yo para mostrar el nombre y no el id en un select? Estoy teniendo un problema al mostrar el nombre de un holding en un select. Yo tengo una tabla que se llama holdings con un listado de nombres:
$table->id();
$table->string('name');

Despues mi tabla customers contiene el id de la tabla holdings:
$table->unsignedBigInteger('holding_id');
$table->foreign('holding_id')->references('id')->on('holdings');

Y mi tabla contacto contiene un campo que es el id de la tabla customers:
$table->unsignedBigInteger('customer_id');
$table->foreign('customer_id')->references('id')->on('customers');

Y mi select de mi vista es el siguiente

   Cuenta
   <select name="customer_id" id="" class="form-control" required>
      <option value="">Seleccione la cuenta del contacto</option>
      @foreach ($customers as $key => $customer)
      <option value="{{$customer->id}}">{{$customer->holding_id}}</option>
      @endforeach
   </select>

Pero las opciones del select son solo el id. Como puedo hacer para poder mostrar el nombre del holding asociado a las otras tablas y no el id?

A: Debes utilizar tus modelos ,crea dos modelos uno Holding y otro Customer
en tu modelo Customer debes añadir la relación
 public function holding()
 {
    return $this->belongsTo(Holding::class,'holding_id');
 }

y a si ya puedes acceder al holding de cada customer
 <select name="customer_id" id="" class="form-control" required>
    <option value="">Seleccione la cuenta del contacto</option>
    @foreach ($customers as $key => $customer)
       <option value="{{$customer->id}}">{{$customer->holding->name}}</option>
    @endforeach
 </select>


text: Q: Android,adding an image asset when ever i add a image asset in drawable,i get those images in mipmap folder.And what is the difference between mipmap and drawable and why i am facing this problem.I have tried adding image asset in drawable and res folder.


text:
Q: Making my whole  clickable I want to make the whole "topic" div clickable. You can see the code down below. I tried using  before the first div but it will only make the picture clickable and not the whole div.
<?php
   $toppic = $app->get_topics();
   foreach($toppic as $topic){
    echo '
';
    echo '
';
      if(file_exists('assets/images/profielfotos/'.$topic['klant_id'])) {
   echo '';
      } else {
         echo '';
      }
      echo '

';
      echo ' '.$topic['topicnaam'].'';
      echo ' - ' . $topic['voornaam'] . " " . $topic['achternaam'] . '' ;
      echo ' reacties ';
      echo '
' . $board['topic'] . '';
      echo '

';
     }
  ?>

How it looks like

This works!
now the only problem is that because I cant nest the a tag I am not abble to display the reacties on the right because it was styled with a float: right.
<?php
       $toppic = $app->get_topics();
       foreach($toppic as $topic){
        echo '
';
        echo '
';
          if(file_exists('assets/images/profielfotos/'.$topic['klant_id'])) {
       echo '';
          } else {
             echo '';
          }
          echo '

';
          echo ' '.$topic['topicnaam'].'';
          echo ' - ' . $topic['voornaam'] . " " . $topic['achternaam'] ;
          echo ' reacties ';
          echo '
' . $board['topic'] . '';
          echo '

';
         }
      ?>

A: Try to embrace your div in the a tag.
Examples are:

In the above example, you should be able to click anywhere on your div and you should land on google's page.
Well in HTML5 it is allowed to have a block content like div to be placed inside an anchor tag. This depends on the HTML version your a using because it will not work in HTML 4.

A: Your code doesn't work because you have nested a element, which is invalid HTML - This is how to do it:
<?php
    $toppic = $app->get_topics();
    foreach($toppic as $topic){
        echo '
';
        echo '
';
        if(file_exists('assets/images/profielfotos/'.$topic['klant_id'])) {
           echo '';
        } else {
            echo '';
        }
        echo '

';
        echo ' '.$topic['topicnaam'].'';
        echo ' - ' . $topic['voornaam'] . " " . $topic['achternaam'] . '' ;
       echo ' reacties ';
       echo '
' . $board['topic'] . '';
       echo '

';
    }
?>

Note that I replaced the id attributes with class because you can't have multiple elements with the same ID, so in your css/JS selector you need to address those as .topic {


text:
Q: How to distribute ios app without UUID I am exporting file using AdHoc and generate a link after uploading ipa file on Diawi.
When i install my app On my iphone, it is not installing. i am getting error
Unable to install, cancel or retry.
Any suggestions for the same
Thanks

A: 1: code signing the IPA is required
for installing it you have 3 options to sign it
a. adhoc with UUIDs (the device identifier has to be registered)
b. 'enterprise-inhouse' (requires no registration of UUIDs!)
*c. developer certificates (only devs in your home team can install those apps)

--> if you can, buy b (check if the license is appropriate)

A: You are very likely only having a "Developer" license with Apple, the $99 a year plan. In order for you to install ipa files onto a device, you have to register the device's UUID in your Apple Account.  You can view your device UUID by connecting the device to iTune.
Enterprise license, the $299 plan does not require knowledge of device UUID.
More information is available at Can I distribute my App for any device without UDID?

A: I have already faced this problem for that I have sent the app through AppStore, the user can install it via testflightapp for the first time after that we can use diawi.com to distribute

A: When you export AdHoc build, you need to make sure that code signing identities have the device UDID on which you are trying to install. If you want to install .ipa without UDID, set code signing to none. But I am not sure exporting this way would allow you to install.


text:
Q: C#. Google Sheets API v4 | Если в массиве данных строки последняя ячейка пустая, то в response возвращается на 1 элемент меньше
C#. Google Sheets API v4 |

Хелп. Кто разбирается в Google Spredsheets API C# есть вопрос.
Я новичок в программировании, поэтому не судите строго)
В общем, есть  гугл таблица. Состоит из трех столбцов и нескольких строк.
В диапазоне есть пустые ячейки.
Если в таблице ячейка последнего столбца пустая, то этот список на 1 объект меньше.
Т.е. список объектов в response из строки таблицы, где все три заполнены данными, составляет 3 объекта. List("data","data","data")
Если последняя ячейка пустая, то приходит только два объекта List("data","data"). Последнего почему-то нет. Это и странно.
Если последняя заполнена данными, а первая и/или вторая пустые, то возвращается List("","","data")
Вот и вопрос - куда девается пустая ячейка? Уже всю голову себе...


text:
Q: Pulling repository docker shows error image not found I tried pulling latest image and it shows image not found. Please help!
$ docker pull url.org/image-sample:latest
Pulling repository url.org/image-sample
Error: image image-sample:latest not found

A: Correct. url.org is not a docker image.
Solution is to check the available images.


text:
Q: Gnome-terminal not starting on Ubuntu 20.04.03 I messed up my system and need urgent help. Please bare with me. I'll be more than happy to provide all details. This PC has really important work for me. I know it won't start again if it is somehow shut down. Please help.
I tried to install kernel 5.16 on ubuntu 20.04.03.

*

*For that I downloaded the missing packages from 20.4.03 and force-installed them. Following instructions here. This changed some locale files and force-installed those packages. When I ran the sudo apt --fix-broken install, it prompted me to remove several packages and libc-bin. I had to type 'Yes, do as I say!' for this. Then it removed everything and showed dpkg error code: 2.

*Now I was having three issues:
a. ldconfig not found on PATH.
b. root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
c. dpkg error in point 1 was never gone.
I tried everything to fix this like trying to install libc-bin again and other stuff but couldn't as no command would run due to path variable issue. I tried to fix it using the solutions mentioned here by changing $PATH variable in /.root/.bashrc/ and .bashrc but nothing worked. So I tried restarting my terminal and boom, it doesn't open now.
So to conclude this, now my gnome-terminal isn't opening, pressing ctrl+alt+F1 redirects me back to GUI and I can't do anything. I tried installing VScode but snap isn't working too. I know I messed up badly. But I can't clean install this system. Please help even if there is slight hope. I have tried to mention every issue as clearly as I remember.
For reference, these are the list of all ubuntu 22.04 packages I tried to force-install:
libc6-dev_2.34-0ubuntu3_amd64.deb
libc-bin_2.34-0ubuntu3_amd64.deb
libc-dev-bin_2.34-0ubuntu3_amd64.deb
libnsl2_1.3.0-2build1_amd64.deb
libnsl-dev_1.3.0-2build1_amd64.deb
libssl3_3.0.1-0ubuntu1_amd64.deb
locales_2.34-0ubuntu3_all.deb
rpcsvc-proto_1.4.2-0ubuntu5_amd64.deb

Error message for PATH:
perl: warning: Falling back to the standard locale ("C").
Can't exec "locale": No such file or directory at /usr/share/perl5/Debconf/Encoding.pm line 16.
Use of uninitialized value $Debconf::Encoding::charmap in scalar chomp at /usr/share/perl5/Debconf/Encoding.pm line 17.
dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: error: 1 expected program not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)


text:
Q: Android: kernel info and hardware requirements? I am new to android technology. Can somebody answer few of my question:

*

*What are the similarities and differences between linux kernel and android kernel?

*What is the minimum hardware requirement for mobile device to have android support?

*Whether it is required to have a touch-screen mobile to run android technology?

A: Q1. The Android kernel is the Linux kernel with added device drivers for the hardware components that are not supported by the pure Linux kernel. However, there are also other differences. Quoted from here, and here:

The Android kernel code is more than
  just the few weird drivers that were
  in the
  drivers/staging/androidsubdirectory in
  the kernel. In order to get a working
  Android system, you need the new lock
  type they have created, as well as
  hooks in the core system for their
  security model. In order to write a
  driver for hardware to work on
  Android, you need to properly
  integrate into this new lock, as well
  as sometimes the bizarre security
  model. Oh, and then there's the
  totally-different framebuffer driver
  infrastructure as well.

You may also refer to this page for an opinion on this matter.
Q2. You may take a look at the Android 2.3 Compatibility Definition
 (I haven't read it). For 3.0 the requirements are (quoted from here):

1GHZ processor, 512MB RAM, a display
  screen that is at least 3.5-inches in
  size

Q3. No, your device does not need to have a touchscreen to be compatible with Android. Refer to the compatibility guide above, but this is also evidenced by the first Android testing devices, that were running android (picture).


text:
Q: Get Nuget to pass a client certificate to a private ProGet server using SSL I have a ProGet server that currently uses SSL and requires a client certificate in order to communicate with it. We would like to be able to use this server directly from the command line or within the Visual Studio package manager.
When accessed via a browser there are no issues with viewing the repository. When using nuget.exe on the command line the result is 403 Forbidden. I have used Fiddler to monitor the request and it highlights that the server is asking for a client certificate, Fiddler allows you to inject the required certificate and the nuget request is then successful.
Is it possible to provide a client certificate when using NuGet:
nuget install PackageName -Source https://myhost -Cert ???

Or with a setup like this we are going to have to fall back to using an API key to gain access?
Are we able to provide the certificate when using Visual Studio?

A: Starting from NuGet 5.7.2 you can use client-cert feature.
Configuration example:
<configuration>
    ...
    <packageSources>
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
        <add key="Contoso" value="https://contoso.com/packages/" />
        <add key="Example" value="https://example.com/bar/packages/" />
    </packageSources>
    ...
    <clientCertificates>
        <storeCert packageSource="Contoso"
                   storeLocation="currentUser"
                   storeName="my"
                   findBy="thumbprint"
                   findValue="4894671ae5aa84840cc1079e89e82d426bc24ec6" />
        <fileCert packageSource="Example"
                  path=".\certificate.pfx"
                  password="..." />
        <fileCert packageSource="Bar"
                  path=".\certificate.pfx"
                  clearTextPassword="..." />
    </clientCertificates>
...
</configuration>

Also you can use nuget client-certs CLI command for configuration.

A: I have realised that some years later I never posted the answer to this issue. In order to get NuGet to use certificates the certificate had to be added to the Credential Manager in Windows as a certificate based credential. NuGet then automatically picked this up when communicating with a matching URL.


text:
Q: New -> Image Asset | result: Android resource linking failed I used the Android Studio build in dialog from "New -> Image Asset" and created an adaptive and legacy launcher icon with foreground and background layer in the Res Directory "main".
After that I get the following error on "flutter run":
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
   > Android resource linking failed

~/build/app/intermediates/packaged_manifests/debug/AndroidManifest.xml:36: error: resource mipmap/ic_launcher (aka com.example.buildId:mipmap/ic_launcher) not found.

~/build/app/intermediates/packaged_manifests/debug/AndroidManifest.xml:42: error: resource style/LaunchTheme (aka com.example.buildId:style/LaunchTheme) not found.

~/build/app/intermediates/packaged_manifests/debug/AndroidManifest.xml:57: error: resource style/NormalTheme (aka com.example.buildId:style/NormalTheme) not found.
     error: failed processing manifest.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 26s
Exception: Gradle task assembleDebug failed with exit code 1


text:
Q: If I have an google experiment running against a page, can I effectively pause the experiment just by removing the chooseVariation call? If I have an google experiment running against a page, can I effectively pause the experiment by removing the chooseVariation call, or will the subsequent call to ga('send', 'pageview') still register the visitor in a participant in the experiment?
The powers that be want to pause a checkout experiment for a weekend to try a weekend-only special offer, and I'm trying to find a way to accomplish this without flat-out destroying all tracking for the period

A: @DaImTo: I think this is programming related, since Google doesn't allow to pause an experiment over their web interface, but there is a 'hack' to achieve this:
Removing only the cxApi.chooseVariation() call will not help with visitors that have been already exposed to the experiment. Google Analytics Content Experiments are using the __utmx and __utmxx cookies to send experiment data along with your analytics tracking calls. Therefore you'll need to

*

*remove cxApi.chooseVariation() to prevent the creation of new cookies

*remove the experiment cookies to prevent tracking returning visitors

If you want to reenable tracking you will have to save the experiment cookies before removing them from the client-side and be able to associate them with a specific user (you might just rename the cookie). Reapply the experiment cookies to continue experiment tracking.
But be aware, the experiment cookies are tracking all started experiments. So if you are running multiple experiments, and you want to pause only a subset, you'll need to rewrite the cookies (temporarily removing just the experiment's data to be paused from the cookie).
If you remove the experiment cookies permanently, returning users might see a different variation and/or be included/excluded in/from the experiment where before they've been not.


text:
Q: mat-menu theme color not changing I have got my themes all working perfectly, but for some reason my mat-menu will only get themed on whatever default is called and not otherwise.
So for its theme to not be broken I have to call
@include angular-material-theme($dark-theme);
right at the top of my styles.scss and then have my custom classes that I set, which my light is loaded by default as shown here:
import {OverlayContainer} from "@angular/cdk/overlay";

@Component({
    selector: 'app-navbar',
    templateUrl: './navbar.component.html',
    styleUrls: ['./navbar.component.scss']
})
export class NavbarComponent implements OnInit, AfterViewInit {
    title:string = "Callum.Tech";

    themeClass: string = "light-theme";

    overlay;

    constructor(
        private overlayContainer: OverlayContainer
    ) {
        this.overlay = overlayContainer;
    }

    setDarkTheme(): void {
        this.themeClass = "dark-theme";
    }

    setLightTheme(): void {
        this.themeClass = "light-theme";
    }

    ngOnInit() {
        this.overlay.themeClass = this.themeClass;
    }
}

Everything else will re-theme and work fine without calling the start include I mentioned but mat-menu will throw a fit and only use the first theme its fed on the site launching, and doesnt change with the rest of the theme.
Here is what it looks like with the dark theme called at the start of styles.scss and the light theme loaded like normal

And here is the dark theme chosen, but the dark theme not called at the start of styles.scss:

A: In the breaking changes for 2.0.0-beta.11:

overlay: Now that the Overlay is part of the cdk rather than Angular Material directly, the themeClass property has been removed. To add a class to the overlay for theming, you can do

overlayContainer.getContainerElement().classList.add('my-theme-class');

So, you can change your code as follows:
constructor(
    private overlayContainer: OverlayContainer
) {
    this.overlay = overlayContainer.getContainerElement();
}

toggleTheme(): void {
    if (this.overlay.classList.contains("dark-theme") {
        this.overlay.classList.remove("dark-theme");
        this.overlay.classList.add("light-theme");
    } else if (this.overlay.classList.contains("light-theme") {
        this.overlay.classList.remove("light-theme");
        this.overlay.classList.add("dark-theme");
    } else {
        this.overlay.classList.add("light-theme");
    }
}
ngOnInit() {
    this.toggleTheme();
}


text:
Q: Answering a question with another question when the answer is obviously 'Yes' I heard it in the TV Series Fargo, Episode 9. Here is the transcript:

A: We still on for golf next week?
  B: Course we are, Burty Burt.
  A: But more importantly, are you and Louise still gonna make it on Sunday?
  B: Do dogs smell each other's butts?
  A: I think I might have observed that type of behavior on occasion.

Also in Prison Break, Season 1 episode 11:

A: You still interested in getting in on PI?
  B: Does my momma got big breastices?
  A: I wouldn't know.
  B: Hell, yeah, she does. And hell, yeah, I do.

What is the name of this construction?

A: While I concede to Frank the phrase "rhetorical affirmation," I must add that according to some, the linguistic source of rhetorical affirmation comes from the influence of Yiddish.
Leo Rosten, in his great book, "The Joys of Yiddish," writes of the rhetorical affirmation in the preface of the book, although he doesn't give it a name.  There Rosten lists nine classic Yiddish linguistic devices that have invaded the English language, the last of which is answering a question with a question.  The first eight are worthy of note and include:

*

*Blithe dismissal via repetition with an sh ("Fat-shmat, as long as she's happy");

*Mordant syntax ("smart, he isn't);

*Sarcasm via innocuous diction ("he only tried to shoot himself");

*Scorn through reversed word order ("already you're discouraged?");

*Contempt via affirmationa: ("My son-in-law he wants to be");

*Fearful curses sanctioned by nominal cancellation ("a fire should burn in his heart, God forbid!");

*Politeness expedited by truncated verbs and eliminated prepositions ("You want a cup coffee?");

*Derisive dismissal disguised as innocent interrogation ("I should pay him for such devoted service?") and to the point here,

*The use of a question to answer a question to which the answer is so self-evident that the use of the first question (by you) constitutes an affront (to me) best erased either by (a) repeating of the original question or (b) retorting with a question of comparably asinine self-answeringness.

[Examples omitted.]
Source:  Rosten, Leo, "The Joys of Yiddish" (McGraw Hill 1968), pp xiv - xv.

A: It's a called rhetorical affirmation.
The respondent answers by asking a rhetorical question.
The answer that is implied by the rhetorical question is the answer to the the original question.
In the Prison Break quote, the rhetorical question isn't sufficiently well known for the original questioner to determine if the respondent means yes or no, which is why they reply to the rhetorical question of Does my momma got big breastices? with I wouldn't know which then causes the respondent to supply the answer to both their own 'rhetorical' question and the original question.


text:
Q: Node SSH2 sudo password I'm trying to use the node SSH2 package. This is my code

var Client = require('ssh2').Client;

var password = 'xxxxxx'
var conn = new Client();
conn.on('ready', function() {
    console.log('Client :: ready');
    conn.exec('sudo ls -la', { pty: true }, function(err, stream) {
        if (err) throw err;
        stream.on('close', function(code, signal) {
            console.log('Stream :: close :: code: ' + code + ', signal: ' + signal);
            conn.end();
        }).on('data', function(data) {
            if (data.indexOf(':') >= data.length - 2) {
            stream.write(password + '\n');
            }
            else {
                console.log('STDOUT: ' + data);
            }
        }).stderr.on('data', function(data) {
            console.log('STDERR: ' + data);
        });
    });
}).connect({
    host: 'xxx.xxx.xxx.xxx',
    port: 22,
    username: 'user',
    password: 'xxxxx',
});

// example output:
// Client :: ready
// STDOUT:  17:41:15 up 22 days, 18:09,  1 user,  load average: 0.00, 0.01, 0.05
//
// Stream :: exit :: code: 0, signal: undefined
// Stream :: close

When I run the code it prompts for the password as follows:
Client :: ready
STDOUT: [sudo] password for venafi:

How can write the password into the password prompt?

A: OK so I worked it out and have updated my example to help anybody else that hits this problem. This is the code I needed.

if (data.indexOf(':') >= data.length - 2) {
            stream.write(password + '\n');
            }
            else {
                console.log('STDOUT: ' + data);
            }


text:
Q: Best DRY Method for PHP methods 2 levels deep in a Class? I am working inside of a large class that is one of the backbones of an application, we'll call this myClass. I need to create a new public method of this class and have it accept a variable array that calls out to the individual methods of the function I'm writing: my_new_iterative_function()... In a sense, I need to have a "class within a class" (javascript is nice for this ;) ... how can I achieve the following, where I iterate over the $fallback_order parameter array to change the order these methods are called and then have a default order, which is executed if $fallback_order is false as defined in the default paramater?
class myClass {
    public function existing_app_method_1() {
        // other code
    }
    public function existing_app_method_2() {
        // other code
    }
    // large app-centric class with many more methods

    public function my_new_iterative_function( array $fallback_order = false ) {
        method_foo() {
            // do stuff
        }
        method_bar() {
            // do stuff
        }
        method_more_methods() {
            // there are at least 5 of them in total
        }

        if ( $fallbackorder == false ):
            method_foo();
            method_bar();
        else:
            foreach ( $fallback_order as $index => $this_fallback ) {
                $name = $this_fallback;
                if ( $this_fallback == $name ):
                    $this->$name();
                endif;
            }
        endif;
    }
}

The goal would be the following in the view templates:

<?php $myClass->my_new_iterative_function( array( 'method_more_methods', 'method_bar', 'method_foo', ) ); ?>

EDIT: Fixed some obviously faulty logic

A: You could have your methods as anonymous functions in an array inside your method and index those arrays with the input, something like this:
class Foo {
    private $stuff = 'tickle me elmo';

    public function my_new_iterative_function(array $fallback_order = array('method_foo', 'method_bar')) {

        $self = $this; // this acts as a keyword, you can't use in the `use ()` part

        $order_functions = array(
            'method_foo' => function() use ($self) {
                print "im in foo: {$self->stuff}
";
            },
            'method_bar' => function(){
                print "im in bar
";
            },
        );

        foreach ( $fallback_order as $index => $this_fallback ) {
            $order_functions[$this_fallback]();
        }
    }
}
(new Foo)->my_new_iterative_function(); // look, one-line `new` and method call, since php 5.4
(new Foo)->my_new_iterative_function([ 'method_bar', 'method_foo', ]); // and even [] for array literals too!

I've also embeded the default order in the default parameter. (setting it to false when you typehint it as an array is a fatal error)

A: I realise you already have a good answer which you've accepted, and I should caveat this by saying that I don't really know PHP very well, but thought I might chime in regardless as I've given this a little bit of thought.
I wondered if it might be neater to abstract the logic in the methods you iterate over into separate commands (with the obvious advantages that you can add further methods without touching the iteration code and you'll minimise the amount of additional code you add to your large class). You could then set a default order array as a property of myClass but override it, if required, in the parameter of the my_new_iterative_function method (or, probably better, via a setter on myClass).
Excuse the code, but something like this:
class myClass
{

    // override default order via class setter if required
    protected $fallback_order = array(new FooCommand(), new BarCommand(), new ANOtherCommand());

    public function my_new_iterative_function(  ) {

            foreach ( $this -> fallback_order as $value ) {
                $value -> execute();
            }
    }
}

Or maybe like this:
class MyClass
{

    // override default order in method invokation if required
    protected $default_fallback_order = array(new FooCommand(), new BarCommand(), new ANOtherCommand());

    public function my_new_iterative_function( $fallback_order = null ) {

            // Use default fallback order if an override has not been
            // specified in method parameter
            if (is_null($fallback_order))
                $fallback_order = $this -> default_fallback_order;

            foreach ( $fallback_order as $value ) {
                $value -> execute();
            }
    }
}

$myClass = new MyClass();
$myClass -> my_new_iterative_function(); // use default fallback order
$myClass -> my_new_iterative_function(array(new ANOtherCommand(), new BarCommand(), new FooCommand()));


text:
Q: Не проходит SQL запрос на создание таблицы Вот такой запрос делю в SQL phpmyadmin
CREATE TABLE internet_magazin_sales
(
id INT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY,
rng VARCHAR(255) NOT NULL,
rngid VARCHAR(255) NOT NULL DEFAULT 'noting',
name VARCHAR(255) NOT NULL,
image VARCHAR(255) NOT NULL DEFAULT 'noting',
text LONGTEXT NOT NULL,
sst INT(9) NOT NULL DEFAULT '1'
)

но мне выдает почему то:
Статический анализ:

Найдено 3 ошибок при анализе.

A symbol name was expected! (near "name" at position 167)
Неожиданное начало выражения. (near "255" at position 180)
Unrecognized statement type. (near "NOT NULL" at position 185)

не могу понять что не так до этого кучу таблиц так создал, почему ругается именно на это?


text:
Q: JsonParseException on Valid JSON I am having an issue calling a RESTful service from my client code. I have written the RESTful service using CXF/Jackson, deployed to localhost, and tested using RESTClient successfully. Below is a snippet of the service code:
@POST
@Produces("application/json")
@Consumes("application/json")
@Path("/set/mood")
public Response setMood(MoodMeter mm) {

    this.getMmDAO().insert(mm);
    return Response.ok().entity(mm).build();
}

The model class and dao work successfully and the service itself works fine using RESTClient. However, when I attempt to call this service from Java Script, I get the error below on the server side:
Caused by: org.codehaus.jackson.JsonParseException: Unexpected character ('m' (code 109)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
I have copied the client side code below. To make sure it has nothing to do with the JSON data itself, I used a valid JSON string (which works using RESTClient, JSON.parse() method, and JSONLint) in the vars 'json' (string) and 'jsonData' (JSON). Below is the Java Script code:
//var json = '{"mood_value":8,"mood_comments":"new comments","user_id":5,"point":{"latitude":37.292929,"longitude":38.0323323},"created_dtm":1381546869260}';
//var jsonData = JSON.parse(json);

var pointData = new Object();
pointData.latitue = 23.43433;
pointData.longitude = 25.393939;

var jsonData = new Object();
jsonData.mood_value = 8;
jsonData.mood_comments= "sample comment";
jsonData.user_id = 10;
jsonData.point = pointData;
jsonData.created_dtm = 1381546869260;

$.ajax({
      url: 'http://localhost:8080/moodmeter/app/service/set/mood',
      dataType: 'json',
      data: jsonData,
      type: "POST",
      contentType: "application/json"
    });

I've seen the JsonParseException a number of times on other threads, but in this case the JSON itself appears to be valid (and tested). Any thoughts are appreciated.
Here is the model class.
public class MoodMeter {
Point point;
int user_id;
int mood_value;
Timestamp created_dtm;
String mood_comments;

public MoodMeter() {
    super();
}

public MoodMeter(Point point, int user_id, int mood_value,
        Timestamp created_dtm, String mood_comments) {
    super();
    this.point = point;
    this.user_id = user_id;
    this.mood_value = mood_value;
    this.created_dtm = created_dtm;
    this.mood_comments = mood_comments;
}

public Point getPoint() {
    return point;
}
public void setPoint(Point point) {
    this.point = point;
}
public int getUser_id() {
    return user_id;
}
public void setUser_id(int user_id) {
    this.user_id = user_id;
}
public int getMood_value() {
    return mood_value;
}
public void setMood_value(int mood_value) {
    this.mood_value = mood_value;
}
public Date getCreated_dtm() {
    return created_dtm;
}
public void setCreated_dtm(Timestamp created_dtm) {
    this.created_dtm = created_dtm;
}
public String getMood_comments() {
    return mood_comments;
}
public void setMood_comments(String mood_comments) {
    this.mood_comments = mood_comments;
}

}

A: You need to check what exact content server is getting: it is not what your code sample shows.

A: Try to send valid jsonData by creating objects like this :
var jsonToSend = new Object();
jsonToSend.mood_value = 8;
jsonToSend.mood_comments = "new comments";
....


text:
Q: Breakpoint in GetHashCode of IEqualityComparer + GroupBy not hit Code example:
 var positions = new List<Position>();

 for (int i = 0; i < 20; i++)
 {
     positions.Add(new Position { Code = "A", Value = i });
     positions.Add(new Position { Code = "A", Value = i });
 }
 var test = positions.GroupBy(p => p, new PositionComparer());

public class Position
{
    public string Code;
    public int Value;
}
public class PositionComparer : IEqualityComparer<Position>
{
    public bool Equals(Position x, Position y)
    {
        return x.Code == y.Code && x.Value == y.Value;
    }
    public int GetHashCode(Position pos)
    {
        unchecked
        {
           int hash = 17;
           hash = hash * 31 + pos.Code.GetHashCode();
           hash = hash * 31 + pos.Value;
           return hash;
         }
     }
 }

I have a breakpoint in GetHashCode (and in Equals).
The breakpoint is not hit during the GroupBy, why not?

A: From the documentation for GroupBy:

This method is implemented by using deferred execution. The immediate return value is an object that stores all the information that is required to perform the action. The query represented by this method is not executed until the object is enumerated either by calling its GetEnumerator method directly or by using foreach in Visual C# or For Each in Visual Basic.

Unless you actually do something with test in your code the grouping won't actually be executed and therefore your PositionComparer won't get executed either.


text:
Q: nodejs print file with child-process I'm learning nodejs and I want to send some file to the printing queue.
I tried elctron-printer and node-printer modules but actually they do not work proprly (can't detect printer with printer.list command for example). Now I'm trying to make it with child_process module and I want to know is there any posibility to start file with its associated application with "print" argument like a python can do it?
For example, this is a code sample of file execution with nodejs:
var childProcess = require('child_process');
childProcess.exec('start printme.txt', function (err, stdout, stderr) {
        if (err) {
        console.error(err);
        return;
    }
    console.log(stdout);
    process.exit(0);// exit process once it is opened
})

Unfortunately it seems that "print" argument is invalid for this code.
And this is a code sample for python and it works fine on windows:
import os
os.startfile('printme.txt', 'print')

All in all I hope that there is possibility to emulate system commands with nodejs.
Otherwise I will have to execute python script via nodejs just for file printing, something like this:
let python = spawn('python', [path.join(app.getAppPath(), '..', 'python_scripts/print_file.py'])

But it is terrible way to do it.


text:
Q: Adjective for "nonbinding, advisory" The legislation recommends, but does not require, that women make up at least 40% of the board. The legislation is ___________.
I think there's a perfect word for this, but it eludes me at the moment.

A: Four possible words come to my mind (all definitions are from Merriam-Webster's Eleventh Collegiate Dictionary):

aspirational adj 1 a : [characteristic of] a strong desire to achieve something high or great b : [related to] an object of such desire
hortative adj giving exhortation [in the sense of "language intended to incite and encourage"] : ADVISORY
precatory adj : expressing a wish
toothless adj 1 : having no teeth 2 a : lacking in sharpness or bite b : lacking in means of enforcement or coercion : INEFFECTUAL

Which option seems most accurate depends on the precise circumstances surrounding the legislation and on how optimistic you happen to be feeling.

A: As noted by @brasshat, advisory seems to fit your need.
A related term, usually applied to judicial rather than legislative matters is obiter dictum

(law) an observation by a judge on some point of law not directly in issue in the case before him and thus neither requiring his decision nor serving as a precedent, but nevertheless of persuasive authority [Collins]

The term is often shortened to dictum and that is often used in the plural as dicta

A: The legislation is 'conciliatory', in other words, any recommendation aimed at engendering conciliatory feelings or goodwill, rather than taking on the force of law.


text:
Q: How to verify system file change warnings in rkhunter When running rkhunter I try to use
rkhunter --propupd

when it is finished, but once in a while I forget, and the next time it is run I get the inevitable file changed warning for a few files.
Are hashes of Ubuntu's current version of system files posted somewhere to compare with the file I have on my system?
If not, what is the best way to verify that the file was changed as part of an update.


text:
Q: Adduser to ssh into Aws Ec2 I am testing to setup a Git on the Server (Ec2 - Linux Amazon). All things are going fine but I did one thing that I can not reproduce and I would like to understand.
I am following this tutorial for Git on the Server
https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server
I created 4 users to test and created their ssh key on server. (User Git) On /home/git/.ssh/authorized_keys file, I added the other 3 users public key (id_rsa.pub) to allow them push.
I use this commands to create users and ssh keys. I checked all permissions on /home/username/.ssh folders (700) and authorized_keys (600) file.
$ sudo adduser git
$ sudo su - git
$ cd
$ mkdir .ssh && chmod 700 .ssh
$ touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys

I created ssh key on ec2 using the following commands
$ ssh-keygen -o
or
$ ssh-keygen -t rsa -m PEM

My question is, why one user I can ssh into ec2 using public-key (id_rsa.pub)? The other 3 users I only can ssh into ec2 using private key (id_rsa)
I am ssh into ec2
$ ssh -i username.pem username@public.ip

Thanks

A:
The other 3 users I only can ssh into ec2 using private key (id_rsa)

Double-check that using, with one of the three users:
ssh -Tv git@ip-number.us-east-2.compute.internal

You will see exactly what ssh is using for its connection.
"They are effectively interchangeable.": John alluded to the fact:

*

*ssh needs to send the public key to the remote user

*the public key can be derived from the private key (at least, in practice)

*therefore, you can use one or the other.


text:
Q: Rails 5.2 Cache Store with Redis not allowing user to login in development env I am running a rails 5.2 application in docker, everything was working well with session storage until today, I tried to change the session_store from cookie_store to cache_store, using Redis.
In my config/initializers/session_store.rb file I have this, this is the only option that works in development (take note of the cookie_store):
Rails.application.config.session_store :cookie_store,
                                           key: "_app_#{Rails.env}_session",
                                           domain: %w[.example.ru .example.io],
                                           expire_after: 24.hours,
                                           httponly: false

The config with the cache_store doesn't work in development env but works in production.
Rails.application.config.session_store :cache_store,
                                       key: "_app_#{Rails.env}_session",
                                       domain: %w[.example.ru .example.io],
                                       expire_after: 24.hours,
                                       httponly: false

In the my env files i have this:
config.cache_store = :redis_cache_store, { url: ENV['REDIS_URL'] }
In the .env file my redis url is REDIS_URL=redis://0.0.0.0:6379/0

And there's no error log in the console. Any idea why cache_store isn't working in development env?
And by the way, I'm using Devise gem for authentication.
Update with server logs
Log when using cookie_store
web_1        | Started POST "/api/v1/auth" for 172.23.0.1 at 2018-10-10 15:21:12 +0000
web_1        | Cannot render console from 172.23.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
web_1        |    (1.0ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
web_1        |   ↳ /usr/local/bundle/gems/activerecord-5.2.1/lib/active_record/log_subscriber.rb:98
web_1        | Processing by API::V1::AuthenticationController#create as HTML
web_1        |   Parameters: {"email"=>"user1@yandex.ru", "password"=>"[FILTERED]", "authentication"=>{"email"=>"user1@yandex.ru", "password"=>"[FILTERED]"}}
web_1        |   User Load (3.1ms)  SELECT  "users".* FROM "users" WHERE "users"."email" = $1 LIMIT $2  [["email", "user1@yandex.ru"], ["LIMIT", 1]]
web_1        |   ↳ app/controllers/api/v1/authentication_controller.rb:15
web_1        |    (0.3ms)  BEGIN
web_1        |   ↳ app/controllers/api/v1/authentication_controller.rb:19
web_1        |   User Update (1.9ms)  UPDATE "users" SET "current_sign_in_at" = $1, "last_sign_in_at" = $2, "sign_in_count" = $3, "updated_at" = $4 WHERE "users"."id" = $5  [["current_sign_in_at", "2018-10-10 15:21:14.709422"], ["last_sign_in_at", "2018-10-10 14:05:32.458533"], ["sign_in_count", 15], ["updated_at", "2018-10-10 15:21:14.716641"], ["id", 106]]
web_1        |   ↳ app/controllers/api/v1/authentication_controller.rb:19
web_1        |    (1.5ms)  COMMIT
web_1        |   ↳ app/controllers/api/v1/authentication_controller.rb:19
web_1        | [active_model_serializers] Rendered ActiveModel::Serializer::Null with Hash (0.15ms)
web_1        | Completed 200 OK in 615ms (Views: 165.5ms | ActiveRecord: 16.7ms)
web_1        |
web_1        |
web_1        | Started GET "/dashboard" for 172.23.0.1 at 2018-10-10 15:21:14 +0000
web_1        | Cannot render console from 172.23.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
web_1        | Processing by UsersController#show as HTML

Log when using cache_store (this doesn't redirect to the dashboard, it stays on the same page and simply rerenders the login page).
web_1        | Started POST "/api/v1/auth" for 172.23.0.1 at 2018-10-10 15:29:43 +0000
web_1        | Cannot render console from 172.23.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
web_1        | Processing by API::V1::AuthenticationController#create as HTML
web_1        |   Parameters: {"email"=>"user1@yandex.ru", "password"=>"[FILTERED]", "authentication"=>{"email"=>"user1@yandex.ru", "password"=>"[FILTERED]"}}
web_1        |   User Load (1.6ms)  SELECT  "users".* FROM "users" WHERE "users"."email" = $1 LIMIT $2  [["email", "user1@yandex.ru"], ["LIMIT", 1]]
web_1        |   ↳ app/controllers/api/v1/authentication_controller.rb:15
web_1        |    (0.4ms)  BEGIN
web_1        |   ↳ app/controllers/api/v1/authentication_controller.rb:19
web_1        |   User Update (3.2ms)  UPDATE "users" SET "current_sign_in_at" = $1, "last_sign_in_at" = $2, "sign_in_count" = $3, "updated_at" = $4 WHERE "users"."id" = $5  [["current_sign_in_at", "2018-10-10 15:29:44.123755"], ["last_sign_in_at", "2018-10-10 15:21:14.709422"], ["sign_in_count", 16], ["updated_at", "2018-10-10 15:29:44.132142"], ["id", 106]]
web_1        |   ↳ app/controllers/api/v1/authentication_controller.rb:19
web_1        |    (1.6ms)  COMMIT
web_1        |   ↳ app/controllers/api/v1/authentication_controller.rb:19
web_1        | [active_model_serializers] Rendered ActiveModel::Serializer::Null with Hash (0.17ms)
web_1        | Completed 200 OK in 489ms (Views: 199.9ms | ActiveRecord: 16.1ms)
web_1        |
web_1        |
web_1        | Started GET "/dashboard" for 172.23.0.1 at 2018-10-10 15:29:44 +0000
web_1        | Cannot render console from 172.23.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
web_1        | Processing by UsersController#show as HTML
web_1        | Redirected to http://localhost:3000/login
web_1        | Filter chain halted as :authenticate_user! rendered or redirected
web_1        | Completed 302 Found in 4ms (ActiveRecord: 0.0ms)
web_1        |
web_1        |
web_1        | Started GET "/login" for 172.23.0.1 at 2018-10-10 15:29:44 +0000
web_1        | Cannot render console from 172.23.0.1! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
web_1        | Processing by HomeController#login as HTML
web_1        |   Rendering home/login.html.haml within layouts/application
web_1        |   Rendered home/login.html.haml within layouts/application (5.0ms)
web_1        | Completed 200 OK in 760ms (Views: 739.1ms | ActiveRecord: 0.0ms)

From updating the logs, I noticed the difference, the cache_store log has this error - Filter chain halted as :authenticate_user! rendered or redirected This must be the proble.
Currently researching on the possible ways to fix that.


text:
Q: Does Html.TextBox uses Request.Params instead of Model? I have a simple test application:
Model:
public class Counter
{
    public int Count { get; set; }

    public Counter()
    {
        Count = 4;
    }
}

Controller:
public class TestController : Controller
{
    public ActionResult Increment(Counter counter)
    {
        counter.Count++;
        return View(counter);
    }
}

View:
<form action="/test/increment" method="post">
    <input type="text" name="Count" value="<%= Model.Count %>" />
    <input type="submit" value="Submit" />
</form>

Clicking Submit I get such values:

5, 6, 7, 8, ...

With Html.TextBox I expected the same behaviour
<form action="/test/increment" method="post">
    <%= Html.TextBox("Count") %>
    <input type="submit" value="Submit" />
</form>

but actually got

5, 5, 5, 5.

It seems Html.TextBox uses Request.Params instead of Model?

A: Html.TextBox() uses internally ViewData.Eval() method which first attempts to retrieve a value from the dictionary ViewData.ModelState and next to retrieve the value from a property of the ViewData.Model. This is done to allow restoring entered values after invalid form submit.
Removing Count value from ViewData.ModelState dictionary helps:
public ActionResult Increment(Counter counter)
{
    counter.Count++;
    ViewData.ModelState.Remove("Count");
    return View(counter);
}

Another solution is to make two different controller methods for GET and POST operations:
public ActionResult Increment(int? count)
{
    Counter counter = new Counter();

    if (count != null)
        counter.Count = count.Value;

    return View("Increment", counter);
}

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Increment(Counter counter)
{
    counter.Count++;

    return RedirectToAction("Increment", counter);
}

Counter object could also be passed via TempData dictionary.
You may also be interested in the article Repopulate Form Fields with ViewData.Eval() by Stephen Walther.

A: That's not the issue here.  Specifying
<%= Html.TextBox("Count") %>

is equivalent to specifying
<%= Html.TextBox("Count", null) %>

which will pull the matching value (named "Count") from the ModelStateDictionary.
But even so, explicitly passing in
<%= Html.TextBox("Count", Model.Count) %>

results in the same behavior described by alex2k8.

A: Html.TextBox has more parameters than one..first parameter is the name or id of input element, and the second one is the value...
so write your textbox helper like this:
<%= Html.TextBox("Count",Model.Count) %>

cheers


text:
Q: Tmux Keyboard Shortcut I pasted the following into my ~/.tmux.conf
bind -n <C-w>h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
It now yields the error:
/home/machine/.tmux.conf:2: unknown key: <C-w>h
I am trying to mimic the vim command " + h" switches to the left buffer.

A: The only multi-key bindings that tmux accepts are those single keys preceded by the tmux prefix (Control-b by default), which is implicit when using bind without the -n flag. With the flag, you are telling tmux to use the single key itself, not in combination the prefix. Otherwise, you cannot create multi-key bindings in tmux.


text:
Q: Angular chart (angular-chart.js) on click on pie chart, how to get the clicked portion data I am using angular-chart.js,
 on click of any of the portion of pie chart, how to get the selected portion data's, please find the below sample code and help to get the data of selected pie portion data on click on the pie chart.
or is that any way to get the chart-index to pass on the chartClick($index) ?
refer: https://jtblin.github.io/angular-chart.js/#reactive
HTML:
<canvas id="pie" class="chart chart-pie"
  chart-data="data" chart-labels="labels" chart-click="chartClick($index)">
</canvas>

Js:
angular.module("app", ["chart.js"]).controller("PieCtrl", function ($scope) {
  $scope.labels = ["Download Sales", "In-Store Sales", "Mail-Order Sales"];
  $scope.data = [300, 500, 100];
});


text:
Q: Stop Debug.Assert? I'm using a library which attempts to do Debug.Assert when I do a certion thing, is there anyway to stop it from using Debug.Assert?

A: If you compile it without the DEBUG symbol defined, then no calls to Debug.Assert will be compiled (the methods are defined with [Conditional("DEBUG")])

A: If you can recompile the library, then Marc is correct; just recompile it without DEBUG defined and all the assertions will disappear.
If you can't do that, because say you don't have the source code of the library, then you can have your program clear out the Trace Listeners. That way when the assertion fires, it still fires but it does nothing. (When an assertion fires, it just checks to see what trace listeners are registered, and informs them about the assertion. No listeners means nothing happens.)
In that scenario you might consider replacing the default trace listener with a customer trace listener of your own that does something like logs the assertion to a file. That way you can review the log and see what assertions would have popped up in the "normal" execution of the debug version of the library.

A: Are you using a binary or do you have library source?  In the former case, I suggest you contact your vendor to ask why they released a Debug build and also let them know about the Assert, which is a bug in their code (Assertion failures should never occur if code is executing as expected, even in exceptional cases.)

A: You can add the following section to your app.config file which inhibits breaking on Debug.Assert(false):
<configuration>
   <system.diagnostics>
   <assert assertuienabled="false"/>
   </system.diagnostics>
</configuration>

For details see assert element and DefaultTraceListener.AssertUiEnabled Property.


text:
Q: Still have error "value copy is not a member of Nothing" even I filter Nothing class I use scala 2.11.2. This is part of my function:
import scala.reflect.runtime.universe._
p => p.filter(p => typeOf[p.type] != typeOf[Nothing]).flatMap {
    case Some(profile) => {
        ...
        env.userService.save(profile.copy(passwordInfo = Some(hashed)),...) //<---------error here
    }
    case _ => ...
}

the compile error is:
PasswordReset.scala:120: value copy is not a member of Nothing
[error]                   env.userService.save(profile.copy(passwordI
nfo = Some(hashed)), SaveMode.PasswordChange);
[error]                                                ^

I think I use filter phase filter the Nothing type, but why it is still give me type Nothing error. I do not want to:
profile.getDefault().copy(...)

Because I really need to copy the profile instead of to copy the default value, if profile is Nothing just delete it.
How to do it?

A: Filter doesn't change types.
scala> def f[A](x: Option[A]) = x filter (_ != null)
f: [A](x: Option[A])Option[A]

Option[A] comes in, Option[A] goes out.
You're suggesting that the runtime check in your filter function should instruct the compiler to accept that your type param is not Nothing, but that's not how it works.
scala> f(None)
res2: Option[Nothing] = None

If Nothing is inferred, then Nothing is what you get.
You want to keep the compiler from inferring Nothing somewhere.  Sometimes it's necessary to provide explicit type args to do that:
scala> f[String](None)
res3: Option[String] = None

scala> f[String](None) map (_.length)
res4: Option[Int] = None

compare to
scala> f(None) map (_.length)
<console>:9: error: value length is not a member of Nothing
              f(None) map (_.length)
                             ^

But it's also possible you could express your code differently.


text:
Q: How to build and run the TensorFlow Lite iOS examples? How does one build and run the TensorFlow Lite iOS examples?
(https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/examples)

A: Here are instructions for building and running the following (22 Aug 2018) TensorFlow Lite iOS examples from both Source (Method 1) and Pod file (Method 2);

*

*https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/examples/ios/camera (classification with internal camera)

*https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/lite/examples/ios/simple (classification with image)

How to get the TensorFlow Lite iOS camera/sample example to run [tensorflow/contrib/lite/examples/ios/camera / simple]
(e.g. camera classification models; mobilenet_quant_v1_224.tflite/labels.txt, simple classification models; mobilenet_v1_1.0_224.tflite/labels.txt)
Method 1 (Source: integrate with existing project)
Instructions based on; https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/lite/g3doc/ios.md

*

*git clone https://github.com/tensorflow/tensorflow

*cd tensorflow

*git checkout r1.10 (select a version of tensorflow that contains tensorflow/contrib/lite/download_dependencies.sh)

*

*[these instructions are based on https://github.com/tensorflow/tensorflow/tree/r1.10 ]

*cd tensorflow/contrib/lite

*./download_dependencies.sh

*./build_ios_universal_lib.sh

*cd examples/ios

*./download_models.sh (download tensorflow models to simple/data and camera/data)

*Show the project navigator

*Update various settings in your app to link against TensorFlow Lite (see tensorflow/contrib/lite/examples/ios/simple/simple.xcodeproj / camera/tflite_camera_example.xcworkspace for example):

*

*select [APPLICATIONNAME] project (blue document icon) - [default target] - Build Phases

*Link Binary With Libraries - add (+) library tensorflow/contrib/lite/gen/lib/libtensorflow-lite.a

*select [APPLICATIONNAME] project (blue document icon) - [default target] - Build Settings

*Library Search Paths - add [INSERTTENSORFLOWSOURCELOCATIONHERE]/tensorflow/contrib/lite/gen/lib

*Header Search paths - add [INSERTTENSORFLOWSOURCELOCATIONHERE] (the root folder of the tensorflow git repository)

*Header Search paths - add [INSERTTENSORFLOWSOURCELOCATIONHERE]/tensorflow/contrib/lite/downloads

*Header Search paths - add [INSERTTENSORFLOWSOURCELOCATIONHERE]/tensorflow/contrib/lite/downloads/flatbuffers/include

*C++11 support (or later) should be enabled by setting C++ Language Dialect to GNU++11 (or GNU++14), and C++ Standard Library to libc++.

*project navigator - in [INSERTAPPLICATIONNAME] project (blue document icon) - create new group called data

*drag and drop data folder items from tensorflow/contrib/lite/example/ios/simple/data (grace_hopper.jpg, labels.txt, mobilenet...) to the newly created data folder in xCode (when asked, select Destination: Copy items if needed)

*modify the application's existing AppDelegate.m accordingly with tensorflow/contrib/lite/examples/ios/simple/AppDelegate.mm/.h contents

*drag and drop source code items from tensorflow/contrib/lite/example/ios/simple (ios_image_load.h, ios_image_load.mm, RunModelViewController.h, RunModelViewController.mm, RunModelViewController.xib [NOT: AppDelegate.h, AppDelegate.mm, main.mm])

Method 2 (Pod file)
Instructions based on; https://www.tensorflow.org/mobile/tflite/demo_ios

*

*git clone https://github.com/tensorflow/tensorflow

*cd tensorflow

*

*OPTIONAL: git checkout r1.10 / 5b63ee85acc0676a35252c50014a178b55aabaa4

*[these instructions are based on https://github.com/tensorflow/tensorflow/commit/5b63ee85acc0676a35252c50014a178b55aabaa4]

*OPTIONAL: extract tensorflow/contrib/lite/examples/ios folder from tensorflow

*cd tensorflow/contrib/lite/examples/ios

*./download_models.sh (download tensorflow models to simple/data and camera/data)

*cd camera/cd simple

*pod repo update

*pod install

*open tflite_camera_example.xcworkspace / open simple.xcodeproj

*select tflite_camera_example/simple project (blue document icon) - [default target] - General

*select 'Automatically manage signing' (required for simple project)

*Change project developer to [INSERTDEVELOPERNAMEHERE]

*Build/run


text:
Q: Speed up parsing in Android I have a feed that I need to parse into an android application. The data needs to be stored in a data base, and Im currently having problems with the performance.
I need to categories the items into Categories and Sub Categories.
I do have ID's for the Categories, so that is cool. But for the sub categories I don't. This causes a lot of string comparison to make sure that no duplicates are added to the db.
Would it be good practice to generate a ID from the name of the sub category? Or is this just as painful to compute?
EDIT:
Category A (ID 1)
    Sub Category C (no ID)
    Sub Category Z (no ID)
    Sub Category V (no ID)

Category B (ID 7)
    Sub Category O (no ID)
    Sub Category C (no ID) (this is not the same Sub Category 'C' as under Category 'A')

The data looks something like this above. I store Category in one table and subcategory in another, and I don't want to add duplicates. So in order to avoid duplicated records I need to check what already exists. But I don't have any IDs for the Sub Cateogries

A: There are multiple ways to solve this problem, and it really depends on how many inserts you're actually doing.  If it isn't too many, then it would be sufficient to index the sub-cateogory column and then before each insert simply do:
select count(*) from sub_category_table where sub_category_field = 'subCategory'
If the query returns greater than 0, you can skip the insert.
If that's not good enough performance-wise, then it would help to have more information on your data and schema.


text:
Q: Was the Hulk based on Jekyll/Hyde? I've always wondered about the parallels between Bruce Banner and Dr Jekyll. Both are good natured men of science and both transform into questionable alter egos...
Is there any evidence that Bruce Banner was based on the character created by Robert Louis Stevenson?

A: Yes, Stan Lee said he was inspired by Jekyll/Hyde and Frankenstein's Monster
Lee explained this in an interview with Rolling Stone

When you read the first issue of the Incredible Hulk, it doesn't seem like a superhero title at all – it feels more in the vein of the monster comics you had been writing beforehand. How conscious was that direction?
I was getting tired of the normal superheroes and I was talking to my publisher. He said, "What kind of new hero can we come up with?" I said, "How about a good monster?" He just walked out of the room. I remembered Jekyll and Hyde, and the Frankenstein movie with Boris Karloff and it always seemed to me that the monster was really the good guy; he didn't want to hurt anybody, but those idiots kept chasing him up the hill until he had to strike back. So why not get a guy who looks like a monster and really doesn't want to cause any harm. But he has to in self-defense, because people are always attacking him.

A: I went searching for a canonical explanation behind any simialrities, and unfortunately, neither the Hulk, Banner, Jekyll or Hyde show up in Deadpool Killustrated - where Deadpool jumps into the 'Ideaverse' to kill the classical literary inspirations behind the Marvel characters.
However, I did find evidence that General Thaddius "Thunderbolt" Ross is inspired by Captain Ahab, forever hunting his 'White whale', the Hulk.

A: Yes, in part:

[Stan] Lee said that the Hulk's creation was inspired by a combination of Frankenstein and Dr. Jekyll and Mr. Hyde.

This quote is from the Hulk Wikipedia page, and sourced from DeFalco, Tom (May 5, 2003). The Hulk: The Incredible Guide. London: Dorling Kindersley. p. 200. ISBN 978-0-7894-9260-9.

A: Yes in a autobiography of there work on the hulk he explained that the creature was based of of Frakensteins monster and that Bruce Banner pulled from Dr.Jekyll