Warning: Illegal string offset 'woo_layout' in - warnings

Warning: Illegal string offset 'woo_layout' in
/home/lifeguru/public_html/wp-content/themes/canvas/includes/theme-actions.php
on line 736
Please help

Related

Error in using pcap loop with mysql con as My argument

I want to add the mysql connection with the pcap loop which I am using in the code
MYSQL *con;
u_char *my_arguments = con;
pcap_loop(handle, total_packet_count, my_packet_handler, my_arguments);
but it is giving error
warning: initialization from incompatible pointer type
[-Wincompatible-pointer-types]
u_char *my_arguments = con;^~~
SO what should I do help is needed please
When I am directly putting value of con in pcap loop like pcap_loop(handle, total_packet_count, my_packet_handler, con); it is showing new error
Error is
passing argument 4 of ‘pcap_loop’ from incompatible pointer type
[-Wincompatible-pointer-types]
pcap_loop(handle, total_packet_count, my_packet_handler, con);
note: expected ‘u_char * {aka unsigned char *}’ but argument is of type ‘MYSQL * {aka struct st_mysql *}’
PCAP_API int pcap_loop(pcap_t *, int, pcap_handler, u_char *);
but I want it to be pushed in pcap loop
The "user" argument to pcap_loop(), pcap_dispatch(), and the callback probably should have been defined to be a void *, as it's a pointer to some arbitrary data that the callback understands, but it was defined to be a u_char * instead.
So you should cast the MYSQL * to u_char *:
pcap_loop(handle, total_packet_count, my_packet_handler, (u_char *)con);

How to make multiplication in octave?

I need to multiply some values bys using this line of code:
% Apply hypothetical keys
tmp = bitxor( Y_i*ones(1,length(K)) , ones(length(Y_i),1)*K );
The error that I found is:
error: binary operator `*' not implemented for `int32 matrix' by `matrix' operations
error: evaluating binary operator `*' near line 49, column 17
error: evaluating argument list element number 1
error: evaluating assignment expression near line 49, column 7

Decimal to Binary Conversion Error

How do you fix the following problem converting from decimal to binary?
void tobinary(int bin) {
string binary = Convert.ToInt32(bin, 2);
}
These are the errors:
Error 2: Argument 2: cannot convert from 'int' to 'System.IFormatProvider' 42
Error 1: The best overloaded method match for 'System.Convert.ToInt32(object, System.IFormatProvider)' has some invalid arguments 42
see:
Decimal to binary conversion in c #
it should be:
void tobinary(int bin) {
string binary = Convert.ToString(bin, 2);}

How to assign a char in Xtend?

How can a variable of type char be assigned? I am looking for the Xtend equivalent of javas:
char c='?';
In Xtend the compiler reject all quotation marks like ' or " because they produce a String:
var char c='?';
^ Error: Incompatible types. Expected char or java.lang.Character but was java.lang.String
Xtext Version is 2.2
Since 2.4 you can write:
val char c = '?'
Currently you have to use '?'.charAt(0).

Get data with a c program from an HTML form

I have created the following C program to get data from an HTML form. But when I try to compile and run it, I get:
segmentation fault 11 (core dumped)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main()
{
char *N1,*N2,*N3,*N4,*N5;
int cgi_length;
char *cgi_data;
printf("Content-type:text/html\n\n");
cgi_length=atoi(getenv("CONTENT_LENGTH"));
cgi_data=malloc(cgi_length+1);
fread(cgi_data,1,cgi_length,stdin);
printf("<HTML>");
printf("<HEAD><TITLE>DATA</TITLE></HEAD><BODY>\n");
printf("<H3>DATA</H3>\n");
if(cgi_data == NULL)
{
printf("<P>Error! Error in passing data from form to script.");
}
else {
printf("%s",cgi_data);
sscanf(cgi_data,"N1=%s&N2=%s&N3=%S&N4=%SN5=%s",&N1,&N2,&N3,&N4,&N5);
printf("<P>N1 is %s and N2 is %s and N3 is %S and N4 is %S and N5 is %s.",N1,N2,N3,N4,N5);
}
}
Also if I use the ls command to see the data in the cgi-bin directory I see that a file named myprogram.cgi.core is created.
Does anyone know what is wrong?
I had the same problem before. I used fgets in a while loop. fread didn't work for me. Try this:
cgi_length=atoi(getenv("CONTENT_LENGTH"));
cgi_data=malloc(cgi_length+1);
while(fgets(cgi_data,cgi_length,stdin)!=NULL){
//insert some processing here
}
You have to check that the return value of your getenv function call is not a null pointer. Passing a null pointer to atoi is undefined behavior. I suggest also to check the return value of all your function calls and to use strtol function instead of atoi because atoi cannot detect errors.
Load the coredump in GDB. Try something like:
gdb myprogram.cgi myprogram.cgi.core
maybe replace myprogram.cgi with the proper name of the CGI.
When you are in GDB you could get a back trace to see where the application crashed by typing bt in the console.
Here you can find a quick tutorial on howto GDB: http://cs.baylor.edu/~donahoo/tools/gdb/tutorial.html
Few notes...:
Check what getenv returns, maybe it returns NULL instead of the value of the environment variable.
sscanf copies the values of the strings to the buffers where N1 N2 N3 N4 N5 are pointing to, it would be wise to allocate some memory for those pointers first...
You don't have to get the reference of the points N1 N2 N3 N4 N5
As Daniel Fischer noted: fread doesn't 0 terminate the string.
If you compile with -Wall (all warnings), it will give you an idea what's wrong
cgi.c: In function ‘main’:
cgi.c:23:9: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘char **’ [-Wformat]
cgi.c:23:9: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘char **’ [-Wformat]
cgi.c:23:9: warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 5 has type ‘char **’ [-Wformat]
cgi.c:23:9: warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 6 has type ‘char **’ [-Wformat]
cgi.c:23:9: warning: format ‘%s’ expects argument of type ‘char *’, but argument 7 has type ‘char **’ [-Wformat]
cgi.c:24:9: warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 4 has type ‘char *’ [-Wformat]
cgi.c:24:9: warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 5 has type ‘char *’ [-Wformat]
cgi.c:26:1: warning: control reaches end of non-void function [-Wreturn-type]
There are several fundamental C programming errors. Use e.g. lint to find out some of them. For example, you’re declaring N1 as a character pointer but do not initialize it, and you pass its address as argument. You need to allocate a character array somehow and pass a pointer to it as an argument to sscanf.
I am pretty sure that you are getting zero in this line
cgi_length=atoi(getenv("CONTENT_LENGTH"));
Check if there is this environment variable actually defined. And always check for sizes before allocating memory and before putting some data into it.