jeudi 13 août 2015

This div seems stuck in the navigation area...?

The form at the top of this page: http://ift.tt/1UFowBR is supposed to go under title "Testing the Builder Thing" but no matter where I put the "header" "div" or "article" tags around the iframe for the form, it doesn't budge. I tried looking into the css for it, but I must be missing something. And I know it's gotta be a simple something!

Any ideas?



via Chebli Mohamed

How can I redirect to home page after video stops

I am using Cincopa to embed my video into my website. The page that it is embedded in is hidden and navigation is removed. So I would like everyone to be redirected to the home page once the video is finished.

Here is my code:

<div id="cp_widget_55a42f1b-6e51-4738-87f9-eaf52dc6a826">...</div>
<script type="text/javascript">
    var cpo = [];
    cpo["_object"] = "cp_widget_55a42f1b-6e51-4738-87f9-eaf52dc6a826";
    cpo["_fid"] = "AsBAj2M3MQOr";
    var _cpmp = _cpmp || [];
    _cpmp.push(cpo);
    (function() {
        var cp = document.createElement("script");
        cp.type = "text/javascript";
        cp.async = true;
        cp.src = "//www.cincopa.com/media-platform/runtime/libasync.js";
        var c = document.getElementsByTagName("script")[0];
        c.parentNode.insertBefore(cp, c);
    })();
</script>
<noscript>Powered by Cincopa <a href='http://ift.tt/1kTdl6w'>Video Hosting for Business</a> solution.<span>Test</span><span>bitrate</span><span> 39961 kb/s</span><span>height</span><span> 1080</span><span>duration</span><span> 00:02:35.31</span><span>lat</span>:<span> +33.2269</span><span>long</span>:<span> 21-96.93</span><span>fps</span><span> 59.94</span><span>width</span><span> 1920</span><span>originaldate</span><span> 2015-06-06 19:08:58</span>
</noscript>



via Chebli Mohamed

samedi 1 août 2015

Error in c program when not using header file

Scenario :
A c application created in netbeans ide with below two files

some_function.c

#include <stdio.h>
int function_1(int a, int b){
    printf("Entered Value is = %d & %d\n",a,b);
    return 0;
}

newmain.c

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv) {
    //function_2(); //Error //function name not allowed
    function_1();
    function_1(1);
    function_1(1,2);
    return (EXIT_SUCCESS);
}

When learning the need of the header file in a c program, I tried the above application (as it is). It got compiled and gave the output as below

Entered Value is = 4200800 & 102
Entered Value is = 1 & 102
Entered Value is = 1 & 2

Question 1 : Is my assumption correct, that when linking, "the linker will check for the function name and not the arguments" when the header file not used?

Regarding the header file usage, I came across this link and there it said as, we can include the c file itself using the #include. So i used the below line in the file newmain.c

#include "some_function.c"

As expected it shown the below error

error: too few arguments to function 'function_1()'
error: too few arguments to function 'function_1(1)'

And also i got the below (unexpected) error.

some_function.c:8: multiple definition of `function_1'
some_function.c:8: first defined here

Question 2: What error I did when including the 'c' file itself, as it gives the above said (unexpected) error?

Rust assign to *mut c_void

I am writing bindings for a library, where I have a function with a parameter of type void* aka *mut c_void in Rust. I have to assign a [u8] to this parameter, how can I do this in Rust? I've tried casting, transmute, it doesn't work (transmute says that c_void and [u8] are of different sizes). If it matters, I am getting the array from a vector.

what happens when increment counter and test counter are interchanged in for-loop syntax?

please explain why

int main()
{
    int i;
    for(i=1;i++;i<100)
    printf("%d",i);
    return 0;
}

results in infinite loop, whereas

int main()
{
    int i;
    for(i=0;i++;i<100)
    printf("%d",i);
    return 0;
}

doesn't run the loop even once? Please clarify how to interpret this kind of syntax?

vendredi 31 juillet 2015

Why does this swap operation work in C?

To swap to integers, A and B, this seems to work in C,

A = A + B - ( B = A);

Why does this work? And if this works in all conditions, can this be used to shorten any other commonly implemented algorithms?

Segmentation fault in linked list creation

I wrote the following program to create a singly linked list. However it gives a segmentation fault at line 28: ptr->info =x; The program gets terminated here after inputting the first node of the linked list.

#include<stdio.h>
#include<stdlib.h>

int main(void)
{

struct node
{
    int info;
    struct node *link;
};

struct node *ptr,*start,*prev;
int n,x,i;

printf("enter the number of linked list elements\n");
scanf("%d",&n);
ptr=malloc(n*sizeof(struct node));
prev=malloc(n*sizeof(struct node));
start=malloc(n*sizeof(struct node));
ptr=NULL;
start=NULL;
prev=NULL;
for(i=0;i<n;i++)
{
    printf("enter the element\n");
    scanf("%d\n",&x);
    ptr->info =x;
    ptr->link =NULL;
    if(start==NULL)
    {
        prev=ptr;
        start=ptr;
    }
    else
    {
        prev->link = ptr;
        prev=ptr;
    }
}

ptr = start;
while(ptr != NULL)
{
    printf("%d ",ptr->info);
    ptr = ptr->link;
}
return 0;
}

What is the problem in the code?