我正在尝试将 cronjob 设置为每 20 分钟运行一次。文件路径为/srv/www/mysite.co.uk/public_html/PP/Make_Xml.php
但我需要向它转移一个 var 所以基本上到 cron:/srv/www/mysite.co.uk/public_html/PP/Make_Xml.php?db=LONDON
我尝试使用“crontab -e”并将其设置为每分钟:
* * * * * /srv/www/mysite.co.uk/public_html/PP/Make_Xml.php?db=LONDON
Run Code Online (Sandbox Code Playgroud)
它保存到 /tmp/crontab.something/crontab
它似乎不起作用。我是 linux 新手,请帮忙。
这是php代码:
$stringquery = "INSERT INTO sikurim(name, title, desc, category, subcategory)
VALUES ('$contact', '$heading','$comments', '$catF', '$catS' ) ";
mysql_query($stringquery) or die(mysql_error());
Run Code Online (Sandbox Code Playgroud)
我得到错误:
您的SQL语法有错误; 查看与您的MySQL服务器版本对应的手册,以便在'desc,category,subcategory'附近使用正确的语法.在第1行的VALUES('jhjh','fffff','fffff','2','4')'
我找不到代码有什么问题,有人可以帮忙吗?
我正在尝试匹配仅包含 a、g、c 或 t 的字符串(不敏感),因此字符串:“AAaaatCCCc”有效,而“catb”无效。这是我的功能:
var pattern = "/^[agct]+$/i";
if (!this.inputSeq.value.trim().match(pattern)){
this.errMsg = "Invalid input sequence -must contain only a,g,c or t"
updateErrorBox(this.errMsg);
}
Run Code Online (Sandbox Code Playgroud)
当我输入有效字符串时,我仍然收到错误消息
我正在尝试hfun使用指向结构中保存的函数的指针来调用函数.
这些是类型定义:
typedef struct Table* TableP;
typedef struct Object* ObjectP;
typedef int(*HashFcn)(const void *key, size_t tableSize);
typedef struct Object {
void *key;
ObjectLink *top;
} Object;
typedef struct Table{
ObjectLink *linkedObjects;
size_t size, originalSize;
HashFcn hfun;
PrintFcn pfun;
ComparisonFcn fcomp;
} Table;
Run Code Online (Sandbox Code Playgroud)
在这里,我正在尝试拨打电话但得到一个错误,我正试图访问一个内存不足的地方:
Boolean InsertObject(TableP table, ObjectP object)
{
int i = (*table->hfun)(object->key, table->size);
if (table->linkedObjects[i].key == NULL)
{
table->linkedObjects[i].key = object;
} else
{
table->linkedObjects[i].next->key = object;
}
return TRUE;
}
Run Code Online (Sandbox Code Playgroud)
使用Eclipse调试器我可以告诉我,在调用时,变量的值是:
object->key类型void*值0x804c018 …
我想传递一个指向变量的指针.有时它会是一个整数,有时可能是一个字符.在下面的例子中我传递指针p,CreateObject但当我尝试检索指针指向的变量的值时,我得到一个尴尬的结果:
int i =0;
int *p = malloc(sizeof(int));
*p = i;
ObjectP object = CreateObject(p);
Run Code Online (Sandbox Code Playgroud)
假设我想将它强制转换为int并显示它:
void CreateObject(void *key)
{
printf("%d\n", (int)key);
}
Run Code Online (Sandbox Code Playgroud)
我得到:160637064而不是0.我得到的是什么,而不是我之前分配的整数,我如何检索它而不是当前值?
我有一个内联函数的声明恰好是递归的.因为它是递归的,所以没有必要将其内联声明,所以当我删除它时,为什么我的链接会失败?
3个档案:
\\File1.h
#ifndef FILE1_H
#define FILE1_H
inline int Factorial(int a)
{
if (a < 2)
return 1;
return a*Factorial(a-1);
}
int PermutationsNum(int b);
#endif
\\File1.cpp
#include "File1.h"
int PermutationsNum(int b)
{
return Factorial(b);
}
\\File2.cpp
#include <iostream>
#include "File1.h"
int main()
{
std::cout << "permutations of 7 elements: " << PermutationsNum(7) << std::endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud) 我正在使用base64_encode函数来散列字符串.字符串必须是a-zA-Z0-9,有时base64_encode最后输出=符号(有时两次).
更改base64_encode函数(覆盖?)以省略=符号的最有效方法是什么?
这是我的代码:
if(strcmp(pch,map[i].name)==0){
printf("Equal\n");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
pch从文件中读取,map[i].name已知大小为64.这适用于小于64的字符串.当比较大小为63的以下两个字符串时:
file11111111111111111111111111111111111111111111111111111111111 和
file11111111111111111111111111111111111111111111111111111111111
Run Code Online (Sandbox Code Playgroud)
一切都是桃子,预期的结果是相同的,但是当比较这两个(大小为64)时:
file111111111111111111111111111111111111111111111111111111111111 和
file111111111111111111111111111111111111111111111111111111111111
Run Code Online (Sandbox Code Playgroud)
回报是假的.我想到了:
if(strncmp(pch,map[i].name,64)==0){
printf("Equal\n");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
它适用于精确大小为64的字符串,但对于较小的字符串,结果是随机的.我在这里处理的是什么样的怪癖?
编辑:这是完整的代码:
char * pch;
char tempFilesNeeded[100*64+100];
strcpy(tempFilesNeeded,map[i].filesNeeded);
pch = strtok(tempFilesNeeded,",");
while (pch != NULL)
{
if(strcmp(pch,map[i].name)==0){
printf("Equal\n");
return 0;
}
pch = strtok (NULL, ",");
}
Run Code Online (Sandbox Code Playgroud) 我在valgrind中遇到错误,不知道出了什么问题.错误是:valgrind输出:
Run Code Online (Sandbox Code Playgroud)==1112== Conditional jump or move depends on uninitialised value(s) ==1112== at 0x402BF0D: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
并且它表明问题发生在第226行:
if(reallocate ==TRUE)
{
char** temp_values = NULL;
temp_values = (char**) realloc(theBoard->_values, theBoard->_size_r*sizeof(char*) );
if(temp_values!=NULL)
{
theBoard->_values = temp_values;
} else
{
reportError(MEM_OUT);
return FALSE;
}
int i = 0;
for (i=0; i<theBoard->_size_r; i++)
{
char* temp_values_c = NULL;
HERE( line 226)-> temp_values_c = realloc(theBoard->_values[i], theBoard->_size_c*sizeof(char) );
if(temp_values_c != NULL)
{
theBoard->_values[i] = temp_values_c;
} else
{
reportError(MEM_OUT);
return FALSE;
}
}
// initialize …Run Code Online (Sandbox Code Playgroud) 我的数据结构如下所示:
- testSet: a list of records in the test set, where each record
is a dictionary containing values for each attribute
Run Code Online (Sandbox Code Playgroud)
并且在每个记录中都有一个名为"ID"的元素.我现在想要testSet通过ID值搜索内部记录.因此,当我给出ID = 230时,我想返回记录,它的ID元素等于230.
我怎样才能做到这一点?