text:
Q: Show that $\int_0^T\frac{f(x)}{f(x+\alpha)}dx\ge T$ I'm struggling with the following problem, any hint will be appreciated.

The function $f:\mathbb{R}^+\rightarrow\mathbb{R}^+$ is continue and periodic with period $T$ show that:
  $$\forall\alpha\in\mathbb{R}, \int_0^T\frac{f(x)}{f(x+\alpha)}dx\ge T$$

A: Hint: rewrite the inequality as
$$ \frac{1}{T}\int_0^T \frac{f(x)}{f(x+\alpha)} \mathrm{d}x \geq 1$$
and apply Jensen's inequality with the convex function $y \mapsto - \log (y) $.

Observe that $-\log$ is a convex function. So Jensen's inequality for the probability measure $\frac{1}{T} \mathrm{d}x$ on $[0,T]$ (we normalize by $1/T$ to make the measure having total mass 1) implies
$$ - \log \left(\frac{1}{T} \int_0^T \frac{f(x)}{f(x+a)} \mathrm{d}x\right) \leq -\frac{1}{T} \int_0^T \log \frac{f(x)}{f(x+a)} \mathrm{d}x $$
The right hand side we use the fact that
$$ \log a / b = \log a - \log b $$
to get
$$ = - \frac{1}{T} \left( \int_0^T \log f(x) \mathrm{d}x - \int_0^T \log f(x+a) \mathrm{d}x \right) $$
Since $f$ is $T$-periodic, the integral of $\log f(x)$ and $\log f(x+a)$ over $[0,T]$ is the same. So the right hand side vanishes.
This means that
$$ - \log\left( \frac{1}{T}\int_0^T \frac{f(x)}{f(x+a)} \mathrm{d}x \right) \leq 0 $$
or that
$$ \log \left( \frac{1}{T} \int_0^T \frac{f(x)}{f(x+a)} \mathrm{d}x \right) \geq 0 $$
Now, the exponential function $y \mapsto e^y$ is strictly increasing, and so order preserving. So raising both sides to a power you recover
$$ \frac{1}{T}\int_0^T \frac{f(x)}{f(x+a)} \mathrm{d}x \geq e^0 = 1 $$
as desired.

A: After trying a little bit harder I've found a solution.
First, note that $\forall\alpha\in\mathbb{R}$, $$\int_0^Tg(x)dx=\int_0^Tg(x+\alpha)dx \tag1$$ for $g$ a continue and periodic function with period $T$.
The demonstration of $(1)$ is straightforward and only uses basic properties of integrals and the fact that the period of $g$ is T. Also note that this result is very intuitive because it represents the same integral just displaced $\alpha$ units.
Let $I=\int_0^T\frac{f(x)}{f(x+\alpha)}$, as $f$ is periodic then $\frac{f(x)}{f(x+\alpha)}$ must be periodic with the same period $T$. Applying the property $(1)$ we have:
$$I=\int_0^T\frac{f(x+(i-1)\alpha)}{f(x+i\alpha)}$$
for all $i\in\mathbb{N}$. Now, for $n$ a positive integer we have
$$I=\frac{nI}{n}=\frac{\sum_{i=1}^{n}\int_0^T\frac{f(x+(i-1)\alpha)}{f(x+i\alpha)}}{n}=\int_0^T\frac{\sum_{i=1}^n\frac{f(x+(i-1)\alpha)}{f(x+i\alpha)}}{n}\ge\int_0^T\sqrt[n]{\prod_{i=1}^n\frac{f(x+(i-1)\alpha)}{f(x+i\alpha)}}=\int_0^T\sqrt[n]{\frac{f(x)}{f(x+n\alpha)}}\ge\int_0^T\sqrt[n]{\frac{\min f(x)}{\max f(x)}}=T\sqrt[n]{\frac{\min f(x)}{\max f(x)}}$$
And now taking limits as $n\rightarrow \infty$ we get $I\ge T.$


text:
Q: How do I subscribe to a postcast by its URL iPhone Podcasts app? I have a podcast RSS URL (copied in the clipboard) that I want to listen to in the Apple Podcasts app. On the "Listen Now" screen there's a link for "Add a show by URL" but when I tap it, nothing happens. I can't see another option to add a Podcast URL.
Brand new iPhone 12 on iOS on iOS 15.1.

A: It looks like this was a bug in the Podcasts app. An upgrade to iOS 15.4 fixed it.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Thank you message not showing when Ajax form goes through I'm trying to hide the regular content and display a thank you message in it's place after a form is sent. However when the form sends, the fields reset but the thank you message won't appear. Please help. I'm not that great with jQuery.
I'm also using the foundation abide.js, don't know if that makes difference or not.
Here is the ajax code.
$(function() {
// Get the form.
var form = $('#form');

// Get the messages div.
var formMessages = $('#thanks');

// Set up an event listener for the contact form.
$(form).submit(function(event) {
    // Stop the browser from submitting the form.
    event.preventDefault();

    var formData = $(form).serialize();
    $.ajax({
        type: 'POST',
        url: $(form).attr('action'),
        data: formData
    }).done(function(response) {
        $('#thanks').show();
        $(form).hide();

        // Clear the form.
        $('#name').val('');
        $('#email').val('');
        $('#number').val('');
    })
});
});

This is the code for the form.

Thanks! We'll be in touch shortly.

Want more info? Contact us!

Sign up to stay in touch with what's happening. Don't Worry, we don't spam.

    <form data-abide id="form" method="post" action="wp-content/themes/myles_custom/mailer.php">

                    Name:
                    <input type="text" name="name" id="name" placeholder="Name" value="<?php if(isset($name)){echo htmlspecialchars($name);} ?>" required pattern="[a-zA-Z]+">

                Name is required.

                    Email:
                    <input type="email" id="email" name="email" placeholder="Email" value="<?php if(isset($email)){echo htmlspecialchars($email);} ?>" required>

                Email is required

                    Number:
                    <input type="tel" pattern="number" id="number" name="number" placeholder="Name" value="<?php if(isset($number)){echo htmlspecialchars($number);} ?>" required>

                Number is required

                    Campus:
                    <select id="campus" name="campus">
                        <option>FSU</option>
                        <option>FAMU</option>
                        <option>TCC</option>
                    </select>

                Campus is required

            Address
            <input name="address" id="address" type="text" style="display: none;">

                <button id="submit" type="submit" value="Send">Submit</button>

    </form>

A: You have a extra closing bracket in the code, and I also would not use $(form) with jquery instead use an id reference $("#form").
I made a quick working example at https://jsfiddle.net/mum1m1sc/
$("#myForm").submit(function(event) {
// Stop the browser from submitting the form.
event.preventDefault();

var formData = $("#myForm").serialize();
$.ajax({
    type: 'POST',
    url: $("#myForm").attr('action'),
    data: formData
}).done(function(response) {
    $('#thanks').show();
    $("#myForm").hide();

    // Clear the form.
    $('#name').val('');
    $('#email').val('');
    $('#number').val('');
});

});

Thanks! We'll be in touch shortly.

Want more info? Contact us!

Sign up to stay in touch with what's happening. Don't Worry, we don't spam.

<form data-abide id="myForm" method="post" action="">

                Name:
                <input type="text" name="name" id="name" placeholder="Name" value="" required pattern="[a-zA-Z]+">

            Name is required.

                Email:
                <input type="email" id="email" name="email" placeholder="Email" value="" required>

            Email is required

                Number:
                <input type="tel" id="number" name="number" placeholder="Name" value="">

            Number is required

                Campus:
                <select id="campus" name="campus">
                    <option>FSU</option>
                    <option>FAMU</option>
                    <option>TCC</option>
                </select>

            Campus is required

        Address
        <input name="address" id="address" type="text" style="display: none;">

            <button id="submit" type="submit" value="Send">Submit</button>

</form>

Thanks

hope that helps.


text:
Q: Number of posts in page - set per category and exclude sidebar I have a widget in the sidebar that shows recent posts. The code below works to set the number of posts per page in each category, but it also affects the sidebar.
Is there any way to exclude the sidebar?
/** Different number of posts per page depending on the category **/
function hwl_home_pagesize( $query )
{
    if ( is_category( 'video' ) )
{
    // If you want "showposts"
    $query->query_vars['showposts'] = 10;
    return;
}
}
add_action( 'pre_get_posts', 'hwl_home_pagesize', 1 );

A: You should always do the two following checks

*

*Check that your current query is the main query

*Check that the query is a front end query
pre_get_posts alters all instances of WP_query, front end and back end, so you will need to make double sure you are doing the above checks
Also is_category() should be an object of $query
Your conditional should look like this
if( !is_admin() && $query->is_main_query() && $query->is_category() )

A: Check for is_main_query on the query object.
if ( is_category( 'video' ) && $query->is_main_query() )


text:
Q: How to run my c# console application on someone else's computer So a really basic question:
I wrote a c# console app. Not completly basic. There several classes outside the Programm.cs.
Now I wanted to show it to some friends so I send them zipped folder and and told them to go into \bin\Debug\netcoreapp3.1 and open the .exe file.
This works for me, but not for 2 of my friends who tried it.
A new windows opens and closes right away.
They seem to have the .Net framework installed.
Is there a way to open it without having install visual studio?
Thanks
Solved:
The issue was that .Net Core Desktop Runtime wasn't installed
Thanks everyone

A: You should publish your project. You will find the option to publish based on your visual studio.
Once your code is published, open \bin\release\netcoreapp3.1\publish..
And share this complete published folder


text:
Q: Java: Getting one's external IP address programmatically without using web services I would like to find out my external IP address.
A very common solution is to set up a BufferedReader pointing to the website http://checkip.amazonaws.com.
Is there a solution however to do this without connecting to an external website, or in other words, how can I find out my external IP address programmatically?

A: The answer is a little complicated because it depends exactly how your computer is connected to the internet. If the computer is directly allocated a publicly routeable IP address then you can just list the network addresses assigned to each of the machine's network interfaces. For servers, this scenario is typical.
However, the computer may also be connected through a Network Address Translation (NAT) layer. In this case, your computer is not directly assigned a publicly routeable IP address; instead it is given a local IP address (such as 10.x.x.x or 192.168.x.x) and then a router (usually the next hop) will map packets from the local address space to the public address space. These setups can vary wildly, so it is recommended to just use a well known external service (like checkip.amazonaws.com which you mention), because that method should work regardless of the intermediate address translation.

A: What George P is saying is correct of course, you have to connect to an external router. There is actually specific IETF protocols defined for this very purpose, like http://en.wikipedia.org/wiki/STUN RFC 5389. I therefore instead recommend you to use the standardized way of doing this, i.e. by using a public STUN server.
As an example, have a look here:
http://babbly.googlecode.com/svn/trunk/src/org/babbly/core/net/InetAddresResolver.java
For more info and list of public STUN servers, check here:
http://www.voip-info.org/wiki/view/STUN


text:
Q: Woocommerce change product style and display it on a page Sorry in advance for my approximative english. I would like to change product page style on woocommerce for a specific product category (don't display pictures and some other important layout changes). Already made it and it works, the problem is that I would like to display these products on a single page. I tried using woocommerce integrated shortcode [product_page id=$id], the problem is that the custom style and layout I created on content-single-product.php (in woocommerce folder) is not applied using this shortcode. I tried to copy my script on class-ws-shortcodes.php (woocommerce folder) but it didn't worked. What should I do to display the products on a specific page, with the real style of these products page (the custom one I created), and not the woocommerce shortcode one?
Thanks in advance for your answers

A: There are two ways to achieve this, it just depends on whether you want to edit single-product.php or content-single-product.php. Both will get you to the same end result.
To do the former, you can use default WordPress functionality and filter the template under given conditions via template_include
add_filter( 'template_include', 'so_29984159_custom_category_template' );
function so_29984159_custom_category_template( $template ){
    if ( is_single() && get_post_type() == 'product' && has_term( 'custom_category', 'product_cat' ) ) {
        $template = locate_template( 'single-product-custom.php' );
    }
    return $template;
}

Or if you'd rather create a custom content-product.php template part, you can use WooCommerce's wc_get_template_part which works in pretty much the same way.
Technically I think you can use the same conditional logic, but I tweaked it here to point out the variables WooCommerce makes available at the filter.
add_filter( 'wc_get_template_part', 'so_29984159_custom_content_template_part', 10, 3 );
function so_29984159_custom_content_template_part( $template, $slug, $name ){
    if ( $slug == 'content' && $name == 'product' && has_term( 'custom_category', 'product_cat' ) ) {
        $template = locate_template( 'content-product-custom.php' );
    }
    return $template;
}

In either case the single-product-custom.php or content-product-custom.php would be in your theme's root folder. To put them somewhere else, just change the path in the locate_template() argument.

A: You can not do coding in wordpress's file i.e. page.php to modify woocommerce pages. Its wrong way. You simply override WooCommerce pages into your theme folder and then modify any pages which you want to do. All templates/pages are located in a woocommerce/templates folder.
Here you can find documentation.
 http://docs.woothemes.com/document/template-structure/

A: edit woocommerce/templates/content-single-product.php for single product view


text:
Q: Extjs 4 upload success function does not react i have a grid with an toolbar and on that toolbar an upload option is added, so the upload is alright and it works , but after the file was uploaded to the server the success function does not react.
here my upload code:
upload: function () {

        Ext.create('Ext.window.Window', {
            title: 'Upload',
            width: 300,
            layout: 'fit',
            draggable: false,
            resizable: false,
            modal: true,
            bodyPadding: 5,

            items: [{
                xtype: 'form',
                bodyPadding: 10,
                frame: true,
                items: [{
                    xtype:'filefield',
                    name:'file',
                    fieldLabel: 'File',
                    buttonText: 'Select File',
                    labelWidth: 30,
                    anchor: '100%'
                }, {
                    xtype: 'button',
                    text: 'Upload',
                    handler: function(){
                         var form = this.up('form').getForm();

                         if(form.isValid()){
                             form.submit({
                                 method: 'POST',
                                 url: 'http://localhost:3000/upload',

                                 success: function (form, action) {
                                     Ext.Msg.alert('Success', 'Your File has been uploaded.');
                                     console.log(action);
                                 },
                                 failure : function (form,action) {
                                     Ext.Msg.alert('Error', 'Failed to upload file.');
                                 }

                             })
                         }

                    }
                }]
            }],

        }).show();

    },

});

and the server response :
app.post('/upload', function(req, res) {

    res.header('Access-Control-Allow-Origin', '*');
    res.header('Content-Type','application/json; charset=UTF8');

    var tmp_path = req.files.file.path;
    var newPath = __dirname + '/files/' + req.files.file.name;
    fs.rename(tmp_path, newPath, function (err){
        if (err) throw err;

    });

    var path = newPath;
    var name = req.files.file.name;

    connection.query('SELECT name FROM audio WHERE name = ?', [name] , function(err,result) {

        if (result[0]) {
            console.log('File already exist');
            res.status(400).send(JSON.stringify());

        } else {

            connection.query('INSERT INTO audio (name, path) VALUES (?,?)', [name,path], function (err,result) {
                if (err) throw err;

                var test = {
                    success: true
                };

                res.send({success:true});
                console.log('success');
            });

        }
    });

});

i can provide more code if necessary, thanks in advance

A: The error message is explicit: your response is lost due to cross-domain iframe issue.
See the doc explanation of how file upload form are handled: a hidden iframe is created to receive the response from the server (because, before HTML5 it was not possible to upload a file using XHR). When the iframe is loaded, Ext parses its content to read the response.
But, it is only allowed for a page to manipulate its iframes content if both are on the same domain, including the port number.
Most probably you're accessing your page at http://localhost/, while you're posting your form to http://localhost:3000. So forbidden: error, and no response for you!

A: This is a Ext js bug identified by Uberdude in the Sencha Forum.
Description of the problem :
When you make an Ext.Ajax.request with a form containing a file input to be uploaded, or manually set the isUpload option to true, rather than doing a proper Ajax request Ext submits the form in the standard HTML way to a dynamically generated hidden . The json response body is then read out of the iframe to create a faked-up Ajax response. A problem arises if the page making the upload Ajax request has changed its document.domain property, e.g. a page at home.example.com includes resources from static.example.com which it wishes to manipulate with javascript without violating the browser's same-origin-policy, so both set their document.domain to "example.com". If home.example.com then makes an upload Ajax request to a url on the home.example.com server, the iframe into which the response is written will have its document.domain as "home.example.com". Thus when the ExtJS code within Ajax.request on the home.example.com page tries to extract the document body from the iframe, it will be blocked by the same-origin-policy and the response passed to the callback functions will incorrectly have empty responseText.
Work Around :
   1. Pass the document.domain to the server when making the upload request.
   2. In your server response, add the document.domain in your response text/html.
response.setHeader('Content-Type', 'text/html');
        response.write('document.domain = "' + params.__domain + '";');
        response.write(JSON.stringify({msg: 'Welcome ' + params.name}));
        response.end('');
Detail :
Please refer to :
http://www.sencha.com/forum/showthread.php?136092-Response-lost-from-upload-Ajax-request-to-iframe-if-document.domain-changed


text:
Q: How to add yticks to one specific point in pyplot? I have bunch of numbers (lets say all less than 500) and some 'inf' in my data. I want to plot them using integer numbers (I represent 'inf' with 1000). However, on y axis of plot, I want to write 'inf' instead of 1000. If I use 'plt.yticks', I can add label to all y points which is not what I want. How can I add a label to one specific point?

A: You can override the both the data position of the ticks and the labels of the ticks.  Here is an example of a scatter plot with 3 extra points at "infinity".  It does not look great because the extra points are at 1000, and there are ticks showing in the white space.
from matplotlib import pyplot as plt
import numpy as np

# create some data, plot it.
x = np.random.random(size=300)
y = np.random.randint(0,500, 300)
x_inf = [0,.1,.2]
y_inf = [1000,1000,1000]

plt.scatter(x,y)
plt.scatter(x_inf, y_inf)

First grab the axis.  Then we can overwrite what data positions should have ticks, in this case 0 to 500 in steps of 100, and then 1000.  Then we can also overwrite the labels of the ticks themselves.
ax = plt.gca()
# set the positions where we want ticks to appear
ax.yaxis.set_ticks([0,100,200,300,400,500,1000])
# set what will actually be displayed at each tick.
ax.yaxis.set_ticklabels([0,100,200,300,400,500,'inf'])

A: Check this out:
plt.plot(np.arange(5), np.arange(5))
plt.yticks(np.arange(5), [200, 400, 600, 800, 'inf'])
plt.show()


text:
Q: Conversion failed when converting the varchar value 'Blue color' to data type int 2
Hi! I am trying to create stored procedure that gone return varchar value, and that value I need to display in textbox.
This is the code for stored procedure:
Create PROCEDURE Status @id_doc int, @Name varchar(50) OUTPUT
AS
select  @Name =items.name
from Doc,Items where @id_doc=IDN and doc.IDN=Items.ID
return @Name

This is the code in vb.net where i need to display returned value from procedure in textbox:
Public Sub Current()
    Dim dtc As New Data.DataTable
    Dim dr As SqlClient.SqlDataReader
    Dim da As New SqlClient.SqlDataAdapter
    Dim cmd As New SqlClient.SqlCommand
    Dim id_doc As Integer
    Dim dset As New DataSet
    Dim recordset As DataRow
    Dim Name As String

    Try
        id_doc = idDocExplorer
        cmd.Connection = pubCon
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "Status"
        cmd.Parameters.Add("@id_doc", id_doc)
        cmd.Parameters.Add("@Name", SqlDbType.VarChar, 50)
        cmd.Parameters("@Name ").Direction = ParameterDirection.Output
        cmd.ExecuteScalar()

        Name = cmd.Parameters("@Name").Value
       TextBox1.text=Name
    Catch ex As Exception
        MsgBox(ex.Message)
    Finally
        dtc = Nothing
        dr = Nothing
        da = Nothing
    End Try
End Sub

When I try to execute this code I get this message in exception:
"Conversion failed when converting the varchar value 'Blue color' to data type int."
What I am doing wrong? Thanks!

A: RETURN takes an integer argument only so return @Name is causing it
Use this instead to return a record set (with a proper JOIN too)
select
    items.name
from
    Doc
    JOIN
    Items ON doc.IDN = Items.ID
where
    @id_doc = IDN

Although, it can be written like this too because @id_doc = doc.IDN = Items.ID:
select
    items.name
from
    Items
where
    Items.ID = @id_doc

If you want to use an OUTPUT parameter rather than a recordset, then simply remove the RETURN statement and leave the assign to @Name
ALTER PROCEDURE Status @id_doc int, @Name varchar(50) OUTPUT
AS
select @Name = items.name from Items where Items.ID = @id_doc
GO

A: I think you are passing "Blue Color" as a parameter value under id_doc.
And the stored procedure call could be failing because it accepts an int type as 1st input parameter


text:
Q: Getting -nan when doing computations with the FPU Nasm x86 Assembly First of all I would like to thank anyone who replies to this, your help is greatly appreciated!
I am trying to compute the standard deviation of a set of floating point numbers passed to my program as command line parameters. First I store each of the parameter strings in a temp variable, then I parse them to floating point numbers using sscanf(). My first problem is that the first (and when I say first, I am talking about the one after the name of my program...so actually the second) command line parameter doesn't get parsed. In the loop that I use to compute the average of the numbers I try to print out each parameter right after I parse it to a floating point number. It always prints all of them except the first one. The first one always gets printed as -nan. Also, the variable std_dev gets printed as -nan as well, even though I never modify it. This puzzles me. What am I doing wrong?
Here is the code:
EXTERN printf
EXTERN sscanf
GLOBAL main

SEGMENT .data
form0:      DB "The standard deviation is: %d", 10, 0
form1:      DB "The standard deviation is: %f", 10, 0
fpform:     DB "%f", 0
avg:        DD 0.0
std_dev:    DD 0.0
temp:       DD 0.0

debugform:  DB "temp=%f, std_dev=%f, avg=%f", 10, 0

SEGMENT .text
main:
        push    ebp                         ; compose stack frame
        mov     ebp, esp
        push    ebx
        push    ecx

        mov     ebx, [ebp + 8]              ; ebx = # of params
        mov     ecx, [ebp + 12]             ; ecx = &param_table
        cmp     ebx, dword 1                ; no params passed?
        je      .end_0                      ; YES - print 0
                                            ; NO - compute and print std_dev
        finit                               ; initialize fpu
        fldz                                ; initialize fpu registers with 0's
        fldz
        fldz
        fldz
        fldz
        fldz
        fldz
        fldz

        call    findStdDev                  ; find the standard deviation of the numbers passed as command line params
        call    debugPrint
        pushad                              ; preserve all registers before making system call
        fld     dword [avg]                 ; load standard deviation into fpu
        sub     esp, 8                      ; reserve space for a qword in the stack
        fstp    qword [esp]                 ; load the 64-bit representation of std_dev into stack
        push    form1                       ; pass format string
        call    printf                      ; print out the standard deviation
        add     esp, 12
        popad

        jmp     .end                        ;
        pop     ebp
        ret
.end_0:                                     ; if no parameters are passed, print std_dev = 0
        push    dword 0
        push    form0
        call    printf
        add     esp, 8
.end:
        pop     ecx
        pop     ebx
        pop     ebp                         ; restore used register and return from program
        ret

;-----------------------------------------------------------------------------------
findStdDev:                                 ; assumes ebx = # params, ecx = &param_table
        push    edi                         ; save used regs
        push    esi
        xor     esi, esi                    ; clear esi as a precaution
        mov     esi, dword 1                ; loop counter for loop to find average of numbers
.find_avg:
        cmp     esi, ebx                    ; esi == number of params?
        je      ._break                     ; YES - break
        pushad                              ; preserve registers before calling a C function
        push    temp                        ; temp storage for string representation of input nums
        push    fpform                      ; format string
        push    dword [ecx + esi*4]         ; current command line param
        call    sscanf                      ; parse string to f.p.
        add     esp, 12
        popad

        call    debugPrint                  ; should leave the CPU and FPU registers how they were before the call

        fld     dword [temp]                ; st0 = temp ; st1 = sum
        faddp   st1, st0                    ; st0 = sum + temp
        ;call   debugPrint                  ; should leave the CPU and FPU registers how they were before the call
        inc     esi                         ; move to next command line param
        jmp     .find_avg

._break:
        mov     [temp], ebx                 ; temp = num of params
        sub     [temp], dword 1
        fld     dword [temp]                ; st0 = #params; st1 = sum of params
        fdivp   st1, st0                    ; st0 = (sum of params)/(#params)
        fstp    dword [avg]                 ; set avg; clear st0

        pop     esi
        pop     edi
        ret

;----------------------------------------------------------------------------------------
debugPrint:

        pushfd
        pushad
        sub     esp, 24
        fld     dword [avg]
        fld     dword [std_dev]
        fld     dword [temp]
        fstp    qword [esp]
        fstp    qword [esp+8]
        fstp    qword [esp+16]
        push    debugform
        call    printf
        add     esp, 28
        popad
        popfd
        ret

Thanks again!
[Edit: I haven't finished actually computing the standard deviation. What I have there is just the loop that computes the average.]


text:
Q: Ember Data not Serializing Date field properly According the docs

Please note: Ember Data serializes and deserializes dates according to
  ISO 8601. For example: 2014-05-27T12:54:01

I get from the server JSON like this:
"createDate" : "2014-08-07T22:30:58.438Z"

My model looks like this:
createDate: DS.attr('date'),

At this point I have a valid javascript date stored in createDate, however, when I save the model, my ember app is serializing as follows:
"createDate" : "Thu, 07 Aug 2014 22:30:58 GMT"

Why is this?  I would expect it to serialize as 2014-08-07T22:30:58 as the docs mention.

A: This has been fixed on master by https://github.com/emberjs/data/pull/1985 and should work for you if you use Ember-Data canary


text:
Q: Need Platform SDK for VC6 Does anyone know where I can download the last Platform SDK to work with VC6? The links I could find by Googling all seem to be dead.

A: I managed to find it here... (official or not)
http://docs.moodle.org/dev/FebruaryPlatformSDK

A: If you have an MSDN subscription, the Platform SDK (February 2003) and others are available under "Tools and Resources -> Platform SDK and DDKs"

A: The last Windows Platform SDK that fully supported VC6 was the Windows 2003 SDK, February 2003. However, through legitimate channels, you can not find this SDK for download anymore, and it looks like no one even has it for ordering, as links to the order sites are dead as well.
See this old MSDN blog post about the unavailability of the PSDK online, and the link to order it is dead: http://blogs.msdn.com/b/windowssdk/archive/2006/06/20/640172.aspx
However, not all hope is lost. From this more recent post on the MSDN forums: http://social.msdn.microsoft.com/Forums/en/windowssdk/thread/d63fb448-c417-4f8e-9260-5a8082daa2af
As Karin Meier says, you can obtain a copy of the February 2003 PSDK from this site:
http://mssdk.orderport.net/22221848/showall.asp
The disc itself doesn't cost anything, but you will probably have to pay shipping.
And of course, unless it is absolutely necessary to use VC6, I'd recommend moving up to a current and supported version of the VC++ compiler.

A: On official Windows® Server 2003 SP1 Platform SDK Web Install page, quote:
This SDK does not support working with Microsoft Visual C/C++®, 6.0 as
support for VC 6.0 has ended. The last SDK that will work with VC
6.0 is the February 2003 Edition, you can order a CD on the
fulfillment site. Side by side installations are not supported.

Links to download Platform SDK February 2003 Edition in case you have not subscribed to MSDN:
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.1.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.2.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.3.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.4.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.5.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.6.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.7.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.8.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.9.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.10.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.11.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.12.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.13.cab
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.bat
http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/Extract.exe

Term of use available after unpacking distribution.
If that links once disappear try http://archive.org/web/ or contact members of https://winworldpc.com/ or similar comunity for abandonware.
For example all .cab available on https://web.archive.org/web/20100318065128/http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm page.


text:
Q: Apache doesn't see pm file I have installed Apache 2.2 and strawberry perl. I have textxx.pm. And I prepare simple script
#!/usr/bin/perl
use textxx;
print("HelloWorld!");

When I run it via cmd it works. When I run it via web browser I get and error:
Can't locate textxx.pm in @INC (@INC contains: C:/strawberry/perl/site/lib C:/strawberry/perl/vendor/lib C:/strawberry/perl/lib .)
It's weird because script without "use" works.
My module is located at the same directory as script

A: You are trying to use the textxx.pm perl module.. but it is not found while running through apache, if you remove the use line it will obviously work since it's not looking for the module.
a quick fix, if your textxx.pm is in let's say C:/strawberry/perl/site/lib  then just add this at the top of your script:
#!/usr/bin/perl
use lib "C:/strawberry/perl/site/lib";
use textxx;
print("HelloWorld!");

A: Lack of permission could be the issue, but I'm betting the problem is that you're expecting Perl to look in the directory containing the script for the module. Perl doesn't do that, at least not by default.
It worked from the console because you set the current work directory happened to the be the same as the script, but that's not the case when you're running it through apache.
To tell Perl to look in the same directory as the script, add the following because use textxx;:
use Cwd qw( realpath );
use File::Basename qw( dirname );
use lib dirname(realpath($0));


text:
Q: Brown out reset Is it possible under brownout situation can we reset the processor(running Linux (Ubuntu/Fedora Os))which is called as BOR(brown out reset) ??
I want to reset the processor when it will face unexpected Power cut or low voltage while it is performing a write operation.
Then the processor will be in hold in reset rather than try and keep running. It should then resume once the power/voltage has gone above the brownout threshold.
As a result due to unwanted power cut/voltage down it should not corrupt the linux filesystem or any directory structure along with my application.
If anyone have any suggestion please share with me.
Your suggestions will be highly appreciated...

A:
Is it possible under brownout situation can we reset the processor(running Linux (Ubuntu/Fedora Os)) which is called as BOR(brown out reset) ??

No, this is not possible, and modern x86 (Intel or AMD) processors have no such feature. (Even if they had - the hard drive and all the other parts would also need to be powered so that they can finish what they were doing without data loss)
Get a UPS or a laptop with a built in battery.


text:
Q: Vline.js is giving cryptic error message I am trying the room example of vline and getting a cryptic error message which is am not able to figure out.
Please see the exception stack below.
    vline.js?t=1231:732
Local stream: W91AhWvMK6ohUoNi meeting:108
User came online, starting mediasession with: bakbak:biplav.saraf@gmail.com meeting:123
 [140623 12:31:36.22] [vline.person] Cannot read property 'log' of undefined
TypeError: Cannot read property 'log' of undefined
    at Qh.f (https://static.vline.com/vline.js?t=1231:195:297)
    at oh (https://static.vline.com/vline.js?t=1231:187:418)
    at W.n.dispatchEvent (https://static.vline.com/vline.js?t=1231:186:432)
    at W.n.vj (https://static.vline.com/vline.js?t=1231:194:348)
    at W.n.dispatchEvent (https://static.vline.com/vline.js?t=1231:193:416)
    at Kl (https://static.vline.com/vline.js?t=1231:366:162)
    at W.n.start (https://static.vline.com/vline.js?t=1231:358:142)
    at bm.n.Oe (https://static.vline.com/vline.js?t=1231:374:279)
    at startPeerMediaSession (http://localhost:5000/schedule/meeting:93:26)
    at bm.<anonymous> (http://localhost:5000/schedule/meeting:124:13)
 vline.js?t=1231:132
Be vline.js?t=1231:132
ze.Vs vline.js?t=1231:132
n.log vline.js?t=1231:127
Qh.f vline.js?t=1231:195
oh vline.js?t=1231:187
n.dispatchEvent vline.js?t=1231:186
n.vj vline.js?t=1231:194
n.dispatchEvent vline.js?t=1231:193
Nh vline.js?t=1231:194
n.xn vline.js?t=1231:384
oh vline.js?t=1231:187
n.dispatchEvent vline.js?t=1231:186
n.vj vline.js?t=1231:194
n.vj vline.js?t=1231:201
n.dispatchEvent vline.js?t=1231:193
Nh vline.js?t=1231:194
S vline.js?t=1231:207
ci vline.js?t=1231:206
mi vline.js?t=1231:209
n.kr vline.js?t=1231:439
Fo vline.js?t=1231:471
Go.send vline.js?t=1231:471
(anonymous function) vline.js?t=1231:488
$a.forEach.d vline.js?t=1231:75
sp vline.js?t=1231:488
(anonymous function) vline.js?t=1231:500
xh vline.js?t=1231:189

Is it possible to get unminified version of this file?

A: On further debugging i figured out that i was using a global variable which was conflicting with vline.js.


text:
Q: Sorting ArrayList> as row fields I have a function which reads a CSV file and after some processing put the data into an
ArrayList<ArrayList<String>>.
So I have this:
  ArrayList = list of rows
  sub-ArrayList<String> = list of columns

Now I have to do this (I'm guessing the java way of doing this is to
use a Comparator): I need to sort these rows according to the string values of each field.
So, for example, if I have the rows (where each field is the final String in the ArrayList<ArrayList<String>> structure):
Name|Birthdate|FathersName
John,2001-01-01,Steven
John,2001-01-01,Albert

the sorting action should reverse these two rows (because the first 2
fields are equal so the third field determines the order).
Any tips on how to do this would be greatly appreciated.
Answer: Arnaud Denoyelle's answer led me to the following generic solution
private Comparator<List<String>> comparator = new Comparator<List<String>>() {
      @Override
      public int compare(List<String> list1, List<String> list2) {
          int size = list1.size();
          int diff = 0;
          for (int i=0; i<size; i++) {
              diff = list1.get(i).compareTo(list2.get(i));
              if (diff != 0) {
                  break;
              }
          }
          return diff;
      }
};

Note: this assumes that the rows being compared have the same number of columns, which in my case is a valid assumption.

A: You want to use comparators.
On the other hand, if you columns are always the same and a fixed number (as in your example), your could create a class Person, extend Comparable and have an ArrayList<Person> which in general is better. Especially for instance if you want those dates to be actual Date objects and not Strings.

A: Yes, Comparators are the way to sort your list. As you are sorting a List<List<String>>, you need a Comparator<List<String>>.
In Java < 8, create an anonymous implementation of Comparator :
Comparator<List<String>> comparator = new Comparator<List<String>>() {
  @Override
  public int compare(List<String> o1, List<String> o2) {
    int diff = o1.get(0).compareTo(o2.get(0));
    if (diff == 0) {
      diff = o1.get(1).compareTo(o2.get(1));
      if (diff == 0) {
        diff = o1.get(2).compareTo(o2.get(2));
      }
    }
    return diff;
  }
};

From Java 8, you can write it easier :
Comparator<List<String>> comparator =
    Comparator.comparing((List<String> l) -> l.get(0))
        .thenComparing((List<String> l) -> l.get(1))
        .thenComparing((List<String> l) -> l.get(2));

Then sort :
Collections.sort(list, comparator);

A: You should consider using a container the sorts automatically such as TreeMap or 'TreeSet'.
http://docs.oracle.com/javase/7/docs/api/java/util/TreeMap.html
You can customise the sorting by implementing the Comparator interface for your own need.

A: Java version < 8: could use Comparator and Collections.sort()
Java version >= 8: could use Lambda Expressions

A: This is a java sample with a generic Comparator>
package test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class ArrayListComparator {

    public static void main(String[] args) {
        ArrayList<String> one=new ArrayList<>();
        one.add("John");one.add("2001-01-01"); one.add("Steven");
        ArrayList<String> two=new ArrayList<>();
        two.add("John");two.add("2001-01-01"); two.add("Albert");
        List<ArrayList<String>> container=new ArrayList<ArrayList<String>>();
        container.add(one);
        container.add(two);
        Collections.sort(container, new ArrayComparator());
        System.out.println(container.get(0).get(2));

    }

    public static class ArrayComparator implements Comparator<List<String>> {

        @Override
        public int compare(List<String> o1, List<String> o2) {
            if (o1!=null && o2!=null) {
                for (int index=0; index<o1.size(); index++ ) {
                    if (index<o2.size()) {
                        String o1Element=o1.get(index);
                        String o2Element=o2.get(index);
                        if (o1Element!=null) {
                            int result=o1Element.compareTo(o2Element);
                            if (result!=0) {
                                return result;
                            }
                        } else {
                            return -1;
                        }
                    } else {
                        return 1;
                    }
                }
                if (o2.size()>o1.size()) {
                    return -1;
                }
                return 0;
            }
            if (o1==null && o2!=null) {
                return -1;
            }
            if (o1!=null && o2==null) {
                return 1;
            }
            return 0;
        }

    }

}

As stated by others with java 8 you could use lambda expression.


text:
Q: MouseOver performance I am trying to build something like this in jQuery UI ( http://jqueryui.com/selectable/#default )

*

*Click on item 1 and then drag your mouse - you will see a [outline rectange] as visual cue for selected items.

while i was trying thsi in Google Closure . I created a container and items within container. soemthing very similar to what we have in demo here
http://closure-library.googlecode.com/git/closure/goog/demos/container.html
I modified the demo add 4 lines of code
  goog.events.listen(goog.dom.getElement('tb4'),
        goog.events.EventType.MOUSEOVER,
        function(e) {
          logger.info('e.clientX :'+e.clientX +' - e.clientY :'+ e.clientY);
        });

which is hosted here (http://jsbin.com/ixEvocA/1/watch?output)

*

*Go to end in Scrolling Container section

*try mouse over  vertically -  this is very fast and event response is good

*horizontally -> stay in one item - this is very slow

what i am doing wrong ? or how can i make this faster. so that i have smooth [outline rectangle] as jquery ui have.

A: The mouseover event is not fired as you would expect. Instead it is just a "slightly complicated form" of mouseenter (see https://developer.mozilla.org/en-US/docs/Web/Reference/Events/mouseover).
If I understood well, what you wanted to do could be achieved by replacing the event, which you listen to, to mousemove.
Try
goog.events.listen(goog.dom.getElement('tb4'),
    goog.events.EventType.MOUSEMOVE,
    function(e) {
      logger.info('e.clientX :'+e.clientX +' - e.clientY :'+ e.clientY);
    }
);


text:
Q: "May be the best" or "May be a best" or "Might be"? I want to describe that something may be a very very good one. I would like to use "best" because I think it'd be really very good that I personally believe it's the best (just need more evidence).
Which should I say:

*

*May be the best

*May be a best

*Might be the best

*Might be a best

Thanks for helping out!

A: When you're talking about the thing that is better than every other thing in the world,
 use "the best".
The phrase "a best" implies that you're talking about many "best" things, e.g.,

*

*A best practice (one of several very good practices; collectively, the best)

*A personal best.
The best that I have ever done (e.g., my fastest time in a race) is my personal best.
You, Archa, and Louis have your own personal bests.

A: It depends what you are talking about, and you will need to add a subject to the beginning of your sentence.
It may be a best. could be used if you are talking about something personal like a game score. For example you got a new great bowling score, and think it might be the highest you've ever gotten. In this case, "a best" is used as a short form of "a personal best".
It may be the best. could be used to talk about any situation where there are multiple candidates and one is believed better. For example, when discussing how awesome song #12 is on a CD.
In either of these cases you could substitute "might" for "may". You should keep in mind that "best" is a relative term. Something god awful can still be the best if its competition is worse.

A: May be the best may be the best. ;)


text:
Q: Unable to use grunt-connect-proxy while running Karma I am trying to execute unit-test using Karma. When I load up the application, the mapping which I have done for the grunt-connect-proxy is been utilized. But while testing, the plugin does not works. I have the following configuration for running the unit-test
grunt.registerTask('unit-test', 'run karma-jasmine unit tests', [
   'clean:server',
   'concurrent:test',
   'autoprefixer',
   'connect:test',
   'karma'
]);

Can anyone help me in making the use of grunt-connect-proxy while executing tests for Karma ?


text:
Q: Use HtmlXPathSelector to return string containing HTML entities I have a JSON string I've parsed from a webpage, and I'm attempting to use json.loads() to turn it into a Python dictionary. However, some of the values in the JSON string contain double quotes, for example
'{"title": "The "Star Wars Kid": Where is he now?"}'

Obviously this is not a proper JSON string, and json.loads() complains. Using something like string.replace('"', '\\"') doesn't work either, since this is a single string, and doing so would affect the double quotes that are correct as well as the bad ones.
By the way, this does not cause an HtmlXPathSelector error when scraping because on the webpage, the bad quotes are encoded like so
'{"title": "The "Star Wars Kid": Where is he now?"}'

How can I parse this string correctly with json.loads()?
EDIT: I understand that it would be simple to parse the string before the encoded quotes have been decoded (as in the second example), so I guess what I'm really asking is how to get this type of still-encoded result from a python HtmlXPathSelector.
If the HTML document I'm scraping contains this string
'{"title": "The "Star Wars Kid": Where Is He Now?"}'

How can I get HtmlXPathSelector to return that exact string without decoding the encoded quotation marks?

A: {"title": "The "Star Wars Kid": Where is he now?"}

Here is when you want to decode the JSON. Then replace the "bad quotes" later.


text:
Q: Firebase/AngularFire - Is Authentication, Login.Logoff necessary? I am new to Firebase. I believe it is a great tools for developing real-time applications.
I am wondering though, since objects/arrays in applications receiving updates(sync) from the firebase server, will those connections occupy and eat up a lot of bandwidth? Will firebase disconnect the clients that has no traffic after a certain time period? (like after one hour for example?)
How do I release the resources after my clients (mobile clients specially) "turn-off" the app? How do I re-connect to firebase resources when my clients "open" my app?
More specifically, I wrote a simple chat app without authentication, neither have any session logon/off.  My app can work on browsers (via ionic serve) and it can also work on the real mobile devices. However, after a couple of hours, I got a SSL connection error as below:(on real-mobile devices)
Failed to load resource: An SSL error has occurred and a secure connection to the server cannot be made.
Then my mobile app can no longer connect to firebase resources any more, unless I re-deploy the app, then it will live for a couple of hours then "die" again.
I am looking for the best practice to use firebase, or at least use it correctly.  Any good example code out there? Thank you for your help :-)

A: When an app is backgrounded, the connection will continue to live until the OS terminates the app from memory.
However, you can call Firebase.goOffline() when the user leaves the app and Firebase.goOnline() when the user enters the app. This will ensure that the connection only lives when the user is active in the app.
As for the SSL error, if this is on iOS you may want to check out ATS configuration with iOS9 and Firebase.


text:
Q: Задача "Суперчисла" Имеется задача:

Суперчислом называется число, являющееся суммой двух простых чисел из диапазона [2…B]. Требуется найти все суперчисла из заданного диапазона [A…B]. (2 <= A <= B <= 40000)
Пример:  Ввод: 3 10; Вывод: 4 5 6 7 8 9 10

Я написал код Python:
a, b = map(int, input().split())

prime = [x for x in range(b + 1)]
prime[1] = 0
prime_list = []

i = 2
while i <= b:
    if prime[i] != 0:
        prime_list.append(prime[i])
        for j in range(i, b - 1, i):
            prime[j] = 0
    i += 1

ans = []
for i in range(len(prime_list)):
    for x in range(0, len(prime_list) - 1):
        g = prime_list[i] + prime_list[x]
        ans.append(g) if g <= b and g >= a else None

ans = sorted(list(set(ans)))
for x in ans:
    print(x)

И на С++
#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main()
{
    int a; int b;
    cin >> a >> b;
    vector<int> prime (0);
    vector<int> prime_list (0);
    for (int i = 0; i <= b; i++)
        prime.push_back(i);
    prime[0] = 1;
    int i = 2;
    while (i <= b)
    {
        if (prime[i] != 0)
        {
            prime_list.push_back(prime[i]);
            for (int j = i; j < b - 1; j *= 2)
                prime[j] = 0;
        }
        i += 1;
    }
    set<int> ans;
    for (int i = 0; i < prime_list.size(); i++)
    {
        for (int x = 0; x < prime_list.size() - 1; x++)
        {
            int g = prime_list[i] + prime_list[x];
            if (g <= b && g >= a)
                ans.insert(g);
        }
    }
    for (int x: ans)
        cout << x << endl;
}

Python благополучно прошёл все тесты, но С++ "Выдаёт ошибку в процессе выполнения".
Подскажите пожалуйста, что не так с С++ кодом? (Тестовые данные мне не известны)

A: Не хотите немного короче?
#include <vector>
#include <iostream>
#include <set>
#include <iomanip>

using namespace std;

bool p[40000] = { false };

int main(int argc, char * argv[])
{
    vector<int>ps;
    int a, b;
    cin >> a >> b;
    for(int i = 2; i < b; ++i)
        if (p[i] == false)
        {
            ps.push_back(i);
            for(int j = i*2; j < b; j += i) p[j] = true;
        }
    set<int>s;
    for(int i = 0; i < ps.size(); ++i)
        for(int j = i; j < ps.size(); ++j)
        {
            int x = ps[i]+ps[j];
            if (x < a ) continue;
            if (x <= b) s.insert(x); else break;
        }
    for(int x: s) cout << x << " ";
}

A: Добавляем отладочную печать:
    if (prime[i] != 0)
    {
        cout << "prime " << i << '\n'; // debug print
        prime_list.push_back(prime[i]);
        for (int j = i; j < b - 1; j *= 2)
            prime[j] = 0;
    }

$ echo 10 20 | ./a.out
prime 2
prime 3
prime 5
prime 7
prime 9       # ???
prime 11
prime 13
prime 15      # ???
prime 17
prime 19
prime 20      # ???

Непорядок в заголовке цикла for. Исправляем (это минимальная правка, есть варианты быстрее):
    if (prime[i] != 0)
    {
        cout << "prime " << i << '\n'; // debug print
        prime_list.push_back(prime[i]);
        for (int j = i; j <= b; j += i)
            prime[j] = 0;
    }

$ echo 10 20 | ./a.out
prime 2
prime 3
prime 5
prime 7
prime 11
prime 13
prime 17
prime 19

Стало лучше. Ошибка верхней границы перекочевала из Питона, ошибка с шагом цикла - новодел.


text:
Q: Fetch with authorization and cors? Is there a way to call the clash royale API from a browser, with a different origin?
The API requires a authorization header.
I'm trying to use fetch(), but whether or not I use mode cors, it doesn't work.

A: In order to use the API, the documentation says,

Keys help in controlling access and traffic to the API. When creating a key you need to specify the IP addresses that are allowed to access the API endpoints.

So basically you create an API token and specify the IP addresses that make the call to the API. In such a case, the API will allow those listed IP addresses to make calls.


text:
Q: In Mongoose how do I create a MongooseArray/Collection in a model that has .create(), .id(), and .remove() functionality My Schemas:
Account: mongoose.model('Account', new Schema({
    account_name: String,
    company: String,
    notes: String,
    contact_info: [this.ContactInfo]
})),
ContactInfo: mongoose.model('ContactInfo', new Schema({
    name: String,
    email: String,
    phone: String,
    notes: String
}))

When I try to do any actions on contact_info though, it says that the methods don't exist.
var c = new ContactInfo...);
var a = new Account(...);

a.contact_info.create(c); //error, create doesn't exsit
a.contact_info.push(c); //works
a.contact_info.id(...).remove(); //id doesn't exist

Am I doing something wrong?
My full code is here (not too much of it): https://github.com/nycitt/node-survey-builder-api-server/blob/master/accounts.js
I'm receiving input from Backbone.js by the way

A: Your issue may be within schemas.js. When defining an object by literal, this won't refer to the object being defined:
// ...
    contact_info: [this.ContactInfo]
// ...

It'll instead refer to the context surrounding the literal -- in the case of Node modules, the exports object -- which doesn't have a ContactInfo property. So, the result is:
// ...
    contact_info: [undefined]
// ...

You'll still have an Array, which is why push is available. But, Mongoose doesn't know to make it a MongooseDocumentArray, so it won't have the id, create, etc. methods.
You'll have to define your models outside the object to have a reference to them. Also note the change in order:
var ContactInfo = mongoose.model('ContactInfo', new Schema({
    // ...
});

var Account = mongoose.model('Account', new Schema({
    // ...
    contact_info: [ContactInfo]
});

module.exports = {
    Account: Account,
    ContactInfo: ContactInfo
};

Or, attach them to exports so this.ContactInfo is set (same order):
exports.ContactInfo = ...;
exports.Account = ...;

A: So apparently I did a few things wrong:
In Schemas, reference other Schemas NOT Models:
Good:
var ContactInfoSchema = new Schema({
    name: String
});

var AccountSchema = new Schema({
    account_name: String,
    contact_info: [ContactInfoSchema]
});

var ContactInfo = mongoose.model('ContactInfo', ContactInfoSchema);

var Account = mongoose.model('Account', AccountSchema);

Bad:
    var ContactInfoSchema = new Schema({
        name: String,
        email: String,
        phone: String,
        notes: String
    });
var AccountSchema = new Schema({
    account_name: String,
    contact_info: [ContactInfo] //subtle difference
});

var ContactInfo = mongoose.model('ContactInfo', ContactInfoSchema);

var Account = mongoose.model('Account', AccountSchema);

The other thing is doing the following doesn't save anything!!!
account.contact_info.create(params);
account.save();

You also have to do
var c = account.contact_info.create(params);
account.contact_info.push(c);
account.save();

For those interested here are the CRUD methods I created for Account and ContactInfo.
https://github.com/nycitt/node-survey-builder-api-server/blob/f94fcd4b05bf0af4f34a0e00f4ff79ebf64e24e1/accounts.js


text:
Q: Method in method in method c# Is it bad to have a lot of methods referring to each other, like the following example?
public void MainMethod()
{
   GetProducts();
}

public void GetProducts()
{
   var _products = new Products();
   var productlist = _products.GetProductList;
   GetExcelFile(productlist);
}

public void GetExcelFile(List<product> productlist)
{
   var _getExcelFile = new GetExcelFile();
   var excelfile = _getExcelFile.GetExcelFileFromProductList(productlist);

   //create excel file and so on...
}

So I am creating a new method for every little action. It would be just as easy to call GetProducts from the MainMethod and do all actions in that method, but I think that isn't the way to create re-usable code.
The following tells me that there should be no more than 7 statements in a method:
Only 7 statements in a method
So the advantages of using methods with a minimal amount of code:

*

*Code is re-usable

*Every task can get his own method

The disadvantages of using methods with a minimal amount of code:

*

*It's like spaghetti code

*You get: refer to refer and so on

My question:
Should my methods be bigger, or should I keep creating small methods, that do little and refer to a lot of other methods?

A: The guideline is right. Methods should be small and you are doing the right thing be giving not only each operation its own method, but a well defined name. If those methods have a clear name, one responsibility and a clear intention (and don't forget to separate commands from queries), your code will not be spagetti. On top of that, try to order methods like a news article: most important methods on top of the file, methods with the most detail on the bottom. This way anyone else can start reading at the top and stop reading when they're bored (or have enough information).
I can advice you to get a copy of Robert Martin's Clean Code. There's no one in the industry who describes this more clearly than he does.

A: The guideline is generally a good one, not so much for reuse, but for readability of your code.
Your example, though, is not a good one. What you're doing is basically creating a long list of methods where each one stops when you feel it's too long and calls another one to perform the rest of the operations.
I would follow more this kind of approach, where reading the main method tells you the "story" that your code needs to tell by steps and the detail of each step is in smaller methods.
public void MainMethod()
{
   var productlist=GetProducts();
   string excelfile=GetExcelFile(productlist);

   // do something in the excel file
}

public List<product> GetProducts()
{
   var _products = new Products();
   return _products.GetProductList;
}

public string GetExcelFile(List<product> productlist)
{
   var _getExcelFile = new GetExcelFile();
   var excelfile = _getExcelFile.GetExcelFileFromProductList(productlist);

   return excelfile;
}

A: I don't really agree with '7 statements in a method'. A method can have dozens of statements, as long as the method performs a single function and the specific logic will only be used in one place, I don't really see the point of cutting it into parts just because some guyideline says so, it should be seperated based on what makes sense.
Re-use of code is good if it makes sense, but I don't think you should make everything everywhere re-usable, when you have no plans in the near future to actually re-use it. It increases the development time needlessly, it often makes the software more complex and harder to interpret then it needs to be, and (at least in my company) the majority of the code never gets re-used, and even if it is it still needs modifications in new products. Only the most generic parts of our codebase actually gets used in several applications without modifications for each product.
And I think that's fine.

A: this is mostly opinion based question, but i'll tell you one thing:
if you're not going to use a method from more then one place, it might be better not to create a method for that.
you can use regions for clarity and you might not want a method that is larger then a full page, but not every 2-3 commands should get a method.


text:
Q: Split dataframe dynamically I have df with 300-ish rows that are not always equally distributed. They look like this:
Lags     Rep 1      Rep 2     Rep 3
12.500000000E-9     7671.039418     6605.763724     10144.873125
25.000000000E-9     -1.000000   -0.479659   1.454251
37.500000000E-9     31.978402   23.456005   29.678136
50.000000000E-9     5.315013    4.723746    0.227125
62.500000000E-9     1.806673    2.642384    2.681376
75.000000000E-9     NaN     NaN     NaN
83.500000000E-9     NaN     NaN     NaN

Time    PhtA count 1     PhtA count 2     PhtA count 3
0.000000000E+0  42.743683   10.890961   12.454987
2.428800000E-3  14.533997   8.125305    7.534027
4.857600000E-3  8.621216    7.686615    7.133484
7.286400000E-3  5.779266    10.147095   6.561279
9.715200000E-3  6.046295    8.201599    5.187988
12.144000000E-3     5.226135    7.343292    5.855560

Time    PhtB count 1     PhtB count 2     PhtB count 3
0.860800000E-3  12.626648   13.580322   8.220673
1.289600000E-3  10.814667   21.381378   7.038116
2.718400000E-3  7.915497    17.261505   7.648468
3.147200000E-3  9.403229    21.266937   10.013580

When split, it would be nice to have 3 dfs like this:
First df:
Lags     Rep 1      Rep 2     Rep 3
12.500000000E-9     7671.039418     6605.763724     10144.873125
25.000000000E-9     -1.000000   -0.479659   1.454251
37.500000000E-9     31.978402   23.456005   29.678136
50.000000000E-9     5.315013    4.723746    0.227125
62.500000000E-9     1.806673    2.642384    2.681376

Second df:
Time    PhtA count 1     PhtA count 2     PhtA count 3
0.000000000E+0  42.743683   10.890961   12.454987
2.428800000E-3  14.533997   8.125305    7.534027
4.857600000E-3  8.621216    7.686615    7.133484
7.286400000E-3  5.779266    10.147095   6.561279
9.715200000E-3  6.046295    8.201599    5.187988
12.144000000E-3     5.226135    7.343292    5.855560

Third df
Time    PhtB count 1     PhtB count 2     PhtB count 3
0.860800000E-3  12.626648   13.580322   8.220673
1.289600000E-3  10.814667   21.381378   7.038116
2.718400000E-3  7.915497    17.261505   7.648468
3.147200000E-3  9.403229    21.266937   10.013580

The length of the three chunks is not always the same, that's why I'm asking for help to solve this programatically. A couple of details about the first df I can say is that:

*

*the first chunk always end up with a bunch of lines with values NaN (in the example are only two)

*There are two more chunks that start with named column headers (Time, PhtA count 1, PhtA count 2, ...)

*The last two chunks do not have any NaN values

*All chunks have variable number of rows, although the headers are always the same

*There is always an empty line separating the chunks
Any help will be appreciated.
Thanks in advance.

A: First read all data into a df preserving empty lines and then split it at these empty lines and convert to numeric:
df = pd.read_csv('data.csv', sep='\s{2,}', skip_blank_lines=False, engine='python')
x = df[df.Lags.isnull()==True].index.values

df1 = df[0:x[0]].dropna().apply(pd.to_numeric)

df2 = df[x[0]+2:x[1]].apply(pd.to_numeric)
df2.columns=df.iloc[x[0]+1].values

df3 = df[x[1]+2:].apply(pd.to_numeric)
df3.columns = df.iloc[x[1]+1].values

Output of print(df1);print(df2); print(df3):
           Lags        Rep 1        Rep 2         Rep 3
0  1.250000e-08  7671.039418  6605.763724  10144.873125
1  2.500000e-08    -1.000000    -0.479659      1.454251
2  3.750000e-08    31.978402    23.456005     29.678136
3  5.000000e-08     5.315013     4.723746      0.227125
4  6.250000e-08     1.806673     2.642384      2.681376
        Time  PhtA count 1  PhtA count 2  PhtA count 3
9   0.000000     42.743683     10.890961     12.454987
10  0.002429     14.533997      8.125305      7.534027
11  0.004858      8.621216      7.686615      7.133484
12  0.007286      5.779266     10.147095      6.561279
13  0.009715      6.046295      8.201599      5.187988
14  0.012144      5.226135      7.343292      5.855560
        Time  PhtB count 1  PhtB count 2  PhtB count 3
17  0.000861     12.626648     13.580322      8.220673
18  0.001290     10.814667     21.381378      7.038116
19  0.002718      7.915497     17.261505      7.648468
20  0.003147      9.403229     21.266937     10.013580

Bonus: Generic solution for an arbitrary number of data blocks in the csv, devided by empty lines (their number need not to be known in advance):

df = pd.read_csv('data.csv', sep='\s{2,}', skip_blank_lines=False, engine='python', header=None)
x = [-1] + list(df[df.iloc[:,0].isnull()==True].index.values) + [len(df)]
for i in range(1,len(x)):
     globals()[f'df{i}'] = df[x[i-1]+2:x[i]].dropna().apply(pd.to_numeric)
     globals()[f'df{i}'].columns = df.iloc[x[i-1]+1].values


text:
Q: I succeeded allocating a pointer to an array of 3 ints in the heap, but I still don't understand how does the access to the array work? After several trials I've succeeded allocating a pointer to an array of 3 ints with a new expression. In the snippet below, I show first the use of this pointer in the stack, and then I show where I've got with the heap allocation, after several trials.
#include <iostream>
int main()
{
    // First, pointer p to an array of 3 int's in the stack.

    int a[3] = { 10, 11, 12 };
    int(*p)[3] = &a;
    std::cout << **p << "  " << *(*p + 1) << "  " << *(*p + 2) << '\n';
    std::cout << p[0][0] << "  " << p[0][1] << "  " << p[0][2] << '\n';

    // Second, the pointer is allocated on the heap.

    int(**q)[3] = new (int(*)[3]) {p};

    // That's what I've got after several trials. But I'm still trying to
    // understand how does the access to the array work in the next two lines of code?

    std::cout << ***q << "  " << ***q + 1 << "  " << ***q + 2 << '\n';
    std::cout << q[0][0][0] << "  " << q[0][0][1] << "  " << q[0][0][2] << '\n';
}

The code prints
10  11  12
10  11  12
10  11  12
10  11  12

See live example
Edit @A.S.H. found an error in my code, in his comment below. I'm making the necessary changes to clarify the example.
#include <iostream>
int main()
{
    // First, pointer p to an array of 3 int's in the stack.

    int a[3] = { 100, 200, 300 };
    int(*p)[3] = &a;
    std::cout << **p << "  " << *(*p + 1) << "  " << *(*p + 2) << '\n';  // Change here
    std::cout << p[0][0] << "  " << p[0][1] << "  " << p[0][2] << '\n';

    // Second, the pointer is allocated on the heap.

    int(**q)[3] = new (int(*)[3]) {p};
    std::cout << ***q << "  " << *(**q + 1) << "  " << *(**q + 2) << '\n';  // Change here
    std::cout << q[0][0][0] << "  " << q[0][0][1] << "  " << q[0][0][2] << '\n';
}

With these changes the code is much clearer. If I knew about this error before, I wouldn't have placed the question. Thanks @A.S.H. for your input.

A: q is a pointer to a pointer to an array. So if you dereference it twice, you get an array. If you dereference it one more time, it undergoes an array-to-pointer conversion to give a pointer to the first element of that array (10) and is then dereferenced, so you get 10. Addition has lower precedence than the unary prefix operators, so ***q + 1 means (***q) + 1, so it's 11.
q[0][0][0] is equivalent to dereferencing q 3 times, because q[i] just means *(q+i). For q[0][0][1], it's the same as dereferencing twice and then returning the element at index 1 of the array, so it's 11.


text:
Q: Add string to the first dimension on a two dimensional list I have created a two dimensional List. I want to add two different strings for both dimensions using a for loop. But the problem is that there is any option as Add for saving my string in the first dimension. May anyone could help?
        List<Tuple<int, List<string>>> List_type1 = new List<Tuple<int, List<string>>>();
        List<Tuple<int, List<string>>> List_type2 = new List<Tuple<int, List<string>>>();
        int indx1;
        int indx2;
        List<TreeNode> IndexList1 = new List<TreeNode>();
        IndexList1 = FindIndex(treeView1.Nodes, IndexList1);
        indx1 = IndexList1[0].Index;

        foreach (TreeNode node1 in nodes1)
        {
            for (int i = 0; i < actions1.Count; i++)
            {
                List_type1.Add(new Tuple<int, List<string>>(i, new List<string>()));
                TreeNode str1 = node1.Nodes[indx1].Nodes[i];
                string TypeAction1 = actions1[i].Attributes["type"].Value;
                string NameAction1 = actions1[i].Attributes["name"].Value;
                List_type1[i].Item1.Equals(TypeAction1);
                List_type1[i].Item2.Add(NameAction1);
            }
        }

Where nodes1 is a TreeNodeCollection and FindIndex find the number of nodes in TreeNodes.

A: At the moment when you do this
List_type1[i].Item1.Equals(TypeAction1);

List is empty. You should add new Tuple and only then compare. But your comparision is useless? because of don't use result of it.
Another way is initialize List before loop.
Or maybe you mix up two lines of code and you mean this:
List_type1[i].Item2.Add(NameAction1);
List_type1[i].Item1.Equals(TypeAction1);

But anyway second line of code means nothing.

A: I found out that it could be as the following:
        List<Tuple<int, List<string>, List<string>>> List_type1 = new List<Tuple<int, List<string>, List<string>>>();
        foreach (TreeNode node1 in nodes1)
        {
            for (int i = 0; i < actions1.Count; i++)
            {
                List_type1.Add(new Tuple<int, List<string>, List<string>>(i, new List<string>(), new List<string>()));
                TreeNode str1 = node1.Nodes[indx1].Nodes[i];
                list1.Add(str1);
                string TypeAction1 = actions1[i].Attributes["type"].Value;
                string NameAction1 = actions1[i].Attributes["name"].Value;
                List_type1[i].Item2.Add(TypeAction1);
                List_type1[i].Item3.Add(NameAction1);
            }
        }

Or another way which would be useful too is creating an array:
        string[,] Match_result = new string[list1.Count, 2];
        foreach (TreeNode node1 in nodes1)
        {
            for (int i = 0; i < actions1.Count; i++)
            {
                TreeNode str1 = node1.Nodes[indx1].Nodes[i];
                list1.Add(str1);
                string TypeAction1 = actions1[i].Attributes["type"].Value;
                string NameAction1 = actions1[i].Attributes["name"].Value;
                Match_result[i, 0] = TypeAction1;
                Match_result[i, 1] = NameAction1;
            }
        }

A: In the line :
List_type1[i].Item1.Equals(TypeAction1);

You call an object by its index, but the list is empty.


text:
Q: FFmpeg - Concat videos with different time base I'm trying to concat videos with the concat demuxer, but it does not work when using one video ("video2.mp4" below). By does not work, I mean playing the concatenated video on a player will work until the second video part starts (it just cannot read the video anymore). It works with the concat filter though. They are both mp4 videos, so I think it's because of the time base ? I can concat other videos with the concat demuxer and it works fine (even with different resolutions/bitrate). It only happens when trying to concat "video2.mp4".
Also, I have a lot of warning/errors like this, probably when ffmpeg starts concatenating the 2nd video :
[mp4 @ 0x7f847a814800] Non-monotonous DTS in output stream 0:0; previous: 906906, current: 302359; changing to 906907. This may result in incorrect timestamps in the output file.

What would be the best way to have a minimum concat time ? Do I really need to use the concat filter or can I change the time base of "video1.mp4" if it's really the problem ?
Any help would be appreciated, thanks !
Video 1 :
ffprobe version 3.2.2 Copyright (c) 2007-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 34.100 / 55. 34.100
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.100 / 57. 56.100
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video1.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-08-17T22:50:35.000000Z
  Duration: 00:00:10.11, start: 0.000000, bitrate: 38018 kb/s
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 1696x848, 37832 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2016-08-18T00:02:24.000000Z
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      creation_time   : 2016-08-18T00:02:24.000000Z
      handler_name    : SoundHandle

Video 2 :
ffprobe version 3.2.2 Copyright (c) 2007-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 34.100 / 55. 34.100
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.100 / 57. 56.100
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video2.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2017-01-06T22:30:23.000000Z
  Duration: 00:00:08.19, start: 0.000000, bitrate: 101474 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 4096x2048 [SAR 1:1 DAR 2:1], 101549 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2017-01-06T22:30:23.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2017-01-06T22:30:23.000000Z
      handler_name    : #Mainconcept MP4 Sound Media Handler

FFMpeg Command :
ffmpeg -f concat -safe 0 -i concat.txt -c copy result.mp4

concat.txt :
file '/path/to/video1.mp4'
file '/path/to/video2.mp4'

Command result :
ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 34.100 / 55. 34.100
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.100 / 57. 56.100
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fbd8b808c00] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'concat.txt':
  Duration: N/A, start: 0.000000, bitrate: 38021 kb/s
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 1696x848, 37832 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
    Metadata:
      creation_time   : 2016-08-18T00:02:24.000000Z
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s
    Metadata:
      creation_time   : 2016-08-18T00:02:24.000000Z
      handler_name    : SoundHandle
Output #0, mp4, to 'result.mp4':
  Metadata:
    encoder         : Lavf57.56.100
    Stream #0:0(eng): Video: h264 (Baseline) ([33][0][0][0] / 0x0021), yuv420p, 1696x848, q=2-31, 37832 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc
    Metadata:
      creation_time   : 2016-08-18T00:02:24.000000Z
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 189 kb/s
    Metadata:
      creation_time   : 2016-08-18T00:02:24.000000Z
      handler_name    : SoundHandle
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  112 fps=0.0 q=-1.0 size=   12701kB time=00:00:03.70 bitrate=28092.2kbits/s speed= 7.4x
frame=  151 fps=151 q=-1.0 size=   18853kB time=00:00:05.00 bitrate=30857.5kbits/s speed=   5x
frame=  224 fps=149 q=-1.0 size=   30042kB time=00:00:07.44 bitrate=33074.8kbits/s speed=4.95x
frame=  268 fps=134 q=-1.0 size=   36596kB time=00:00:08.90 bitrate=33650.8kbits/s speed=4.44x
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fbd8a808000] Auto-inserting h264_mp4toannexb bitstream filter.9x
[mp4 @ 0xb545d000] Non-monotonous DTS in output stream 0:1; previous: 484352, current: 445939; changing to 484353. This may result in incorrect timestamps in the output file.
[concat @ 0xb545c400] DTS 304057 < 906906 out of order
[mp4 @ 0xb545d000] Non-monotonous DTS in output stream 0:0; previous: 906906, current: 304057; changing to 906907. This may result in incorrect timestamps in the output file.
[mp4 @ 0xb545d000] Non-monotonous DTS in output stream 0:1; previous: 484353, current: 446963; changing to 484354. This may result in incorrect timestamps in the output file.
...
... like 100 DTS errors ...
...
[mp4 @ 0xb545d000] Non-monotonous DTS in output stream 0:0; previous: 907150, current: 548301; changing to 907151. This may result in incorrect timestamps in the output file.
frame=  548 fps=169 q=-1.0 Lsize=  148399kB time=00:00:18.28 bitrate=66493.7kbits/s speed=5.64x
video:148027kB audio:359kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.008622%

Thank you in advance !

A: There's something funky about the H.264 bitstream in video2.mp4
The steps below (to be applied once) resolves it for me and the resulting concat plays fine with ffplay, Potplayer, VLC, WMP, Chrome and Firefox.
#1 Convert video 2 to match video 1
ffmpeg -i video2.mp4 -vf scale=1696x848 -profile:v baseline -c:a copy v2.mp4

#2 Extract to raw bitstream
ffmpeg -i v2.mp4 -c copy -f h264 v2.h264

#3 Mux it to new container
ffmpeg -i v2.h264 -i v2.mp4 -c copy -video_track_timescale 90000 -map 0 -map 1:a v2-ok.mp4

Now, you can concat v2-ok.mp4 with video1.mp4

A: The problem is the timebase. Ffmpeg adds an offset to the streams in the second, but otherwise doesn't change their timestamps even though it should.
I have never been able to get any timebase-related options to do anything. What did work for me: copy to mkv, which has 1/1000 timebase for video streams (ffmpeg reports this as '1k tbn'). This makes all timestamps consistent. Then concat.
For normal purposes, webm and mkv are basically the same thing, but mkv accepts H.264 while webm currently doesn't.
Note that timestamps with any slight jitter from rounding can lead to dropped or duplicated frames with poorly-designed fps-changing filters.
If there's still a gap (but no speed change or error messages), make sure the audio isn't slightly longer than the video stream, and trim it if necessary; you could do this automatically with 'ffmpeg -i video1.mp4 -i video1.mp4 -c copy -map 0:v -map 1:a -shortest trimmed.mp4'.
I'm pasting this answer to both questions, don't know if that's allowed.

A: In my opinion, the key to the problem is that on examination of the two videos in question they very obviously have widely different bitrates. Unlike other factors, this is a problem that can only be corrected by re-encoding.
From the data posted by the user, video 1 has a video bitrate of 37,832 kb/s, but video 2 has a very different video bitrate of 101,549 kb/s.
Whatever other measures are taken (such as matching the frame size), the video player is going to pause at the join point, because it has to adjust from accumulating and displaying data at the (low) initial bitrate, and begin instead to display a revised image at a new (much higher) bitrate.
Interestingly, this might not have been so (i.e. might not have been noticeable) had the problem been posed to the player the other way round: if video 1 had been encoded at the high bitrate, and the combined file had then dropped to a lower bitrate part way through. In that situation, the initial level of buffering would have been more than enough for both halves of the movie, as the second half would have required less buffering. The pause in playback, in my experience, is a consequence of the necessity to raise the buffering rate at the join point, time being needed to buffer additional data, and would not occur if the buffering rate was being reduced instead.
Additionally, I would also point out the extreme nature of the discrepancy. The bitrate increases by 200 percent, the new bitrate being 3 times the size per second of the initial rate. This is indeed an extreme challenge to the player, which has been pottering along at one rate and then meets an instantaneous - and permanent - tripling of the bitrate. If the jump had been modest, the pause in playback might not have been perceptible at all. But if the bitrate triples without warning the initial video buffer has little chance of being able to smooth it out, and is bound to need time to buffer additional data. It isn't even a spike in the data rate, but a permanent increase.
Little wonder that some players will crash. It says a lot for the robustness of any video software player that it merely pauses, or stutters, faced with this situation. On the whole, I would not expect a pause if the increase was under 50 percent of the initial bitrate, but a 200 percent increase is just begging for trouble.
Obviously, if you don't equalise the frame size of the image, the change will be very noticeable even if the buffering is entirely adequate. What  I'm talking about is that even if both video 1 and video 2 have the same image size, a pause in playback will still occur if the bitrate leaps to a much higher value at the join point.


text:
Q: Can a non-significant regression model be used for prediction? I am planning to predict Y (speech recognition scores) from X (age). There is a linear relationship. Hence examined the data using linear regression. Linear regression is not significant. Can I still predict if linear regression is not significant?

This is the ANOVA table:


text:
Q: Internal server error while trying to delete rows in sqlite based on their value [
I am trying to create an app for buying and selling stocks. If I sell all stocks from the same company, I want to delete the row instead of displaying 0 shares.
I am not sure how to delete the row based on its value.
It gives me error incomplete input here:
db.execute("INSERT INTO stocks (user_id, symbol, name, shares, price, total_cost, transaction_type) VALUES(:user_id, :symbol, :name, :shares, :price, :total_cost, :transaction_type", user_id=user_id, name=name, symbol=symbol, shares= -1*shares, price=price, total_cost=total_cost, transaction_type=transaction_type)

This line of code was working before I added the delete condition.
@app.route("/sell", methods=["GET", "POST"])
@login_required
def sell():

    """Sell shares of stock"""
    #Access the current user
    user_id= session["user_id"]

    if request.method =="POST":
        if not request.form.get("symbol") or not request.form.get("shares"):
            return apology("Enter a valid symbol or number of shares")

        #Define data
        symbol=request.form.get("symbol")
        shares=int(request.form.get("shares"))
        stock=lookup(symbol)
        price=stock.get("price")
        total_cost=int(shares)*stock["price"]
        name=stock.get("name")
        transaction_type="sale"

        if stock is None:
            return apology("Enter a valid symbol")

        #Access existing data in DB

        rows= db.execute("SELECT symbol, sum(shares) as shares FROM stocks WHERE user_id=:user_id GROUP BY symbol", user_id=user_id)

        #Validate if the current user owns the shares they are trying to sell
        for row in rows:
            if row["symbol"]==symbol:
                if shares > row["shares"]:
                    return apology("Enter a valid number of shares")
                if row["shares"]-shares==0:
                    db.execute("DELETE FROM stocks WHERE user_id = :user_id AND symbol = :symbol",
                          symbol=symbol, user_id=session["user_id"])

        user=db.execute("SELECT cash FROM users WHERE id=:user_id", user_id=user_id)
        new_cash=user[0]["cash"]+total_cost
        #Add transaction to the db
        #Update DB cash of the user

        db.execute ("UPDATE users SET cash=:new_cash WHERE id=:id", new_cash=new_cash, id=user_id)
        db.execute("INSERT INTO stocks (user_id, symbol, name, shares, price, total_cost, transaction_type) VALUES(:user_id, :symbol, :name, :shares, :price, :total_cost, :transaction_type", user_id=user_id, name=name, symbol=symbol, shares= -1*shares, price=price, total_cost=total_cost, transaction_type=transaction_type)

        return redirect("/")

    else:
        share_symbols=[]
        symbs = db.execute("SELECT symbol FROM stocks WHERE user_id=:user_id GROUP BY symbol",
        user_id=user_id)
        for symb in symbs:
            share_symbols.append(symb)
        return render_template("sell.html", share_symbols=share_symbols)

A: One problem is order of execution. This
db.execute("DELETE FROM stocks WHERE user_id = :user_id AND symbol = :symbol",
                          symbol=symbol, user_id=session["user_id"])

deletes all stocks rows  if shares will become 0.
Subsequently,
db.execute("INSERT INTO stocks (user_id, symbol, name, shares, price, total_cost, transaction_type) VALUES(:user_id, :symbol, :name, :shares, :price, :total_cost, :transaction_type", user_id=user_id, name=name, symbol=symbol, shares= -1*shares, price=price, total_cost=total_cost, transaction_type=transaction_type)

inserts a row with negative shares.
It looks like the stocks table keeps one row per transaction, not one row per stock. Which would be useful for the history route. Don't delete any rows.
One solution would be a modification, probably in index. Assuming a SELECT with sum(shares), add a HAVING clause to filter out rows where sum(shares) is 0.


text:
Q: SellectCommad.connection Property not initialized When i debug my application, it gives an error that SelectCommand.Connection Property is not been initialized. i dont know what am i doing here wrong :s. I actually want to add a filter over my search on the textchanged event of a textbox.
public class ConnectionClass
{
    static SqlConnection cn;

    public static SqlConnection Connection()
    {
        string myConnection = ConfigurationManager.ConnectionStrings["_uniManagementConnectionString1"].ConnectionString;
        if (cn != null)
        {
            cn = new SqlConnection(myConnection);
            cn.Open();
        }
        return cn;
    }

}

public class ClassDataManagement
{
    SqlConnection cn = ConnectionClass.Connection();

    public DataTable GetData(string SQL)
    {
         SqlCommand cmd = new SqlCommand(SQL, cn);
         SqlDataAdapter da = new SqlDataAdapter(cmd);
         DataTable dt = new DataTable();
         da.Fill(dt);
         return dt;
    }
}

protected void TextBoxFilterText_TextChanged(object sender, EventArgs e)
{
   ClassDataManagement dm = new ClassDataManagement();
   string query = "Select CourseCode from _Courses where coursecode like'%" + TextBoxFilterText.Text.TrimEnd() + "%'";
   dm.GetData(query);
   GridViewCourses.DataBind();
}

A: That's because your cn variable is null, and not getting initialized.  Yet another example why it's a bad idea to initialize and open database connections in a static method.
Try this:
public class ClassDataManagement
{
   public DataTable GetData(string SQL)
    {
          string YourConnectionString = ConfigurationManager.ConnectionStrings["_uniManagementConnectionString1"].ConnectionString;
          DataTable dt = new DataTable();

          using (SqlConnection cn = new SqlConnection(YourConnectionString))
          using (SqlCommand cmd = new SqlCommand(SQL, cn))
          using (SqlDataAdapter da = new SqlDataAdapter(cmd))
          {
              da.Fill(dt);
          }
          return dt;
    }
}

With the SqlDataAdapter class, you don't need to explicitly call SqlConnection.Open().  The SqlDataAdapter.Fill() method handles all of the connection opening (and closing).
MSDN Reference on SqlDataAdapter.Fill()
As per the above reference, quoted:

The connection object associated with the SELECT statement must be valid, but it does not need to be open. If the connection is closed before Fill is called, it is opened to retrieve data, then closed. If the connection is open before Fill is called, it remains open.

A: Open connection and close as soon as possible.
    public DataTable GetData(string commandString)
    {
        var result = new DataTable();

        using (var cn = new SqlConnection(ConfigurationManager.ConnectionStrings["_uniManagementConnectionString1"].ConnectionString))
            using (var cmd = new SqlCommand(commandString, cn))
                using (var da = new SqlDataAdapter(cmd))
                {
                    da.Fill(result);
                }

        return result;
    }

A: Shouldn't that be
if (cn == null)
{
    cn = new SqlConnection(myConnection);
    cn.Open();
}

A: Although Sebastian's answer covers a good portion of what's wrong.  Here is a more complete list.

*

*You have SQL Injection issues.  All queries should be parameterized otherwise you are asking for trouble.  Especially when you are directly appending text entered by the user.

*You are leaking resources: SqlConnection and SqlCommand.  These need to be as close to the code that actually utilizes the connection and command as possible.  Trust me, Windows is more than capable of handling all of the open/closing of connections through the build in connection pool.  You don't need to maintain this yourself.

*The code itself is brittle due to use of embedded SQL in your display layer.  By way of example, let's say CourseCode is renamed to CourseId.  You will have to search through and modify, potentially, a lot of code files just to make that change.  There are multiple ways of limiting exposure to this issue; I'll leave that for you to research.
If I ran across this code in the wild, I would delete the ConnectionClass in its entirety.  There is nothing that it is going to do for your that shouldn't be done elsewhere in a more robust manner.
Next I would delete the GetData() method.  That is just bad code.  You should never accept a full sql string and blindly execute it.  There are a lot of security issues just in that one block of code.
Then I would rewrite the ClassDataManagement such that my SQL (if I really wanted it to stay embedded, which I wouldn't because I don't roll that way) was the container for all of my queries.  I would have good methods like GetCourseByCourseCode(String courseCode) which would validate that the courseCode is in an expected format then pass it to my sqlcommand object as a parameter to the query.
For bonus points I'd expand on the above by looking at what calls could be better served by cached data.  By having them in identified methods, it's much easier to pick and choose what can come from the cache vs what I really need to go across the network and run a query for.
Next, I would make sure that everywhere I made a SQL call, I had my SqlConnection, SqlCommand and readers wrapped in using clauses.  It's the best way to ensure that everything is properly closed and disposed of prior to leaving the method.  Anything less and you are inviting trouble.
Finally, I would highly consider using Enterprise Library for my data access.  It's much better.

A: Having all given advices, to solve your current problem, you may try this way also:
 public class ConnectionClass
 {
 static SqlConnection cn;

   public static SqlConnection Connection()
    {
       string myConnection = ConfigurationManager.ConnectionStrings["_uniManagementConnectionString1"].ConnectionString;

       return new SqlConnection(myConnection);
      }
   }

public class ClassDataManagement
{
 public DataTable GetData(string SQL)
   {
    using (SqlConnection cn = ConnectionClass.Connection())
     {
     //SqlCommand cmd = new SqlCommand(SQL, cn);
     SqlDataAdapter da = new SqlDataAdapter(SQL,cn);
     DataTable dt = new DataTable();
     da.Fill(dt);
     return dt;
     }
   }
......

A: public DataTable GetData()
{
    using (System.Data.SqlClient.SqlConnection con = new SqlConnection("YourConnection string"))
    {
        con.Open();
        using (SqlCommand cmd = new SqlCommand())
        {
            string expression = "Parameter value";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "Your Stored Procedure";
            cmd.Parameters.Add("Your Parameter Name",
                        SqlDbType.VarChar).Value = expression;
            cmd.Connection = con;
            using (SqlDataAdapter da = new SqlDataAdapter(SQL, cn))
            {
                DataTable dt = new DataTable();
                da.Fill(dt);
                return dt;
            }
        }
    }
}


text:
Q: Clean up array produced by DooPHP I use DooPHP for my Json service, Everything is ok except 1 problems:
Mysql Orm of DooPHP produced unclean result (I had try all config).
I have a Model:
public $id;
public $name;
public $content;
public $image_small;
public $image_large;
public $category_id;
public $orderday;
public $creat_time;
public $_table = 'recipe';
public $_primarykey = 'id';
public $_fields = array('id','name','content','image_small','image_large','category_id','orderday','creat_time');

And i write query like this:
$food = Doo::db()->find('Recipe',array('select' => 'id, name, image_small, image_large,category_id'));

But the result in array: (SELECT id, name, image_small, image_large,category_id FROM recipe  )
 Array
 (
  [0] => Recipe Object
    (
        [id] => 1
        [name] =>  Chicken
        [content] =>
        [image_small] => image_small/0872c3146bc78b74a006b41353aab13c.jpg
        [image_large] => image_large/0872c3146bc78b74a006b41353aab13c.jpg
        [category_id] => 1
        [orderday] =>
        [creat_time] =>
        [_table] => recipe
        [_primarykey] => id
        [_fields] => Array
            (
                [0] => id
                [1] => name
                [2] => content
                [3] => image_small
                [4] => image_large
                [5] => category_id
                [6] => orderday
                [7] => creat_time
            )

    )

[1] => Recipe Object
    (
        [id] => 3
        [name] => Bak Kut Teh 2
        [content] =>
        [image_small] =>
        [image_large] =>
        [category_id] => 4
        [orderday] =>
        [creat_time] =>
        [_table] => recipe
        [_primarykey] => id
        [_fields] => Array
            (
                [0] => id
                [1] => name
                [2] => content
                [3] => image_small
                [4] => image_large
                [5] => category_id
                [6] => orderday
                [7] => creat_time
            )

    )

 )

I want to remove all unrelated data for speed (_fields, _table..) and which not select: content, creat_time ...

A: Method find returns a model object or associative array of the queried result. Try this:
$food = Doo::db()->find('Recipe',array(
'select' => 'id, name, image_small, image_large, category_id',
'asArray' => TRUE));

A: An alternative method by adding this function to your DooController.php
 /**
     * remove unused parameters from query object
     * @param object $obj models object
     *
     */
 public function sanitizeQuery($obj){

 foreach($obj as $k){

unset($k->_fields);

unset($k->_primarykey);

unset($k->_table);

}
return $obj;
     }

then in your controller action after retrieving a "collection" do this:
$food = Doo::db()->find();
$this->data['food'] = $this->sanitizeQuery($food);


text:
Q: Angular.js - Attaching DOM items from the model I am learning Angular and am getting json data externally.
If parts of the data come back undefined or blank I want to hide the certain element on the page.
How can you do this from the model?
I am doing all my logic from the model so it seems against programming practice to then do an if statement in the controller to validate undefined data to attach it to an ng-show or a hide css class?

A: check ngShow & ngHide documentation
https://docs.angularjs.org/api/ng/directive/ngShow
https://docs.angularjs.org/api/ng/directive/ngHide
<div ng-repeat="item in items" ng-show="angular.isDefined(item.value)">
...
</div>

This only shows an item when value attribute is defined


text:
Q: Is MLF a fair scheduling protocol? Is MLF(multiple level feedback) a fair protocol? does it favor any types of jobs in particular? short/long? does it cause performance issues?

A: In general they prefer short jobs (or I/O bound jobs). Since your question is broad, I'd suggest you read a summary of the linux implementation of this on IBM's website. Linux has moved on to a red-black queue based scheduler (completely fair scheduler).