最近,我把我的项目php + smarty + mysql放在我的httpd服务器上.但是我遇到了一个错误:
500 Internal Server Error
Run Code Online (Sandbox Code Playgroud)
我的操作系统是archlinux,httpd服务器和php安装如下:
sudo pacman -S apache php
Run Code Online (Sandbox Code Playgroud)
如果我使用包含以下内容的测试本机php文件:
<html>
<head>
<title>PHP Test Page</title>
</head>
<body>
This is Arch Linux, running PHP.
<?php
phpinfo();
?>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
它运行正常.它告诉我php可以很好地工作.但为什么我的智能项目不起作用?有没有人遇到过这个问题?
我对进化算法感兴趣.我用R测试了遗传算法,但有人尝试过遗传编程吗?你知道吗,如果有代码用R写的代码
以下是我的python代码:
>>> item = 1
>>> a = []
>>> a.append((1,2,3))
>>> a.append((7,2,4))
>>> sums=reduce(lambda x:abs(item-x[1]),a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: <lambda>() takes exactly 1 argument (2 given)
>>>
Run Code Online (Sandbox Code Playgroud)
我该如何解决?谢谢!
我正在使用这样的结构:
define struct _Fragment{
int a;
char *seq;
}Fragment;
Run Code Online (Sandbox Code Playgroud)
我想初始化struct,并使用malloc()方法返回这样的动态内存
Fragment *frag=malloc(10*sizeof(Fragment));
Run Code Online (Sandbox Code Playgroud)
然后我会像这样使用frag指针:
frag->seq="01001";
Run Code Online (Sandbox Code Playgroud)
然后当我返回大量片段时会出现问题.错误消息说(使用valgrind工具):
Uninitialised value was created by a heap allocation
Run Code Online (Sandbox Code Playgroud)
谁能告诉我如何处理它.谢谢!
给定log(a)和log(b),返回log(a + b)
double log_sum(double log_a, double log_b){
double v;
if(log_a < log_b){
v=log_b+log(1+exp(log_a-log_b));
}
else{
v=log_a+log(1+exp(log_b-log_a));
}
return v;
}
Run Code Online (Sandbox Code Playgroud)
我想知道上述功能有什么好处?
现在我有以下代码:
SentenceModel sd_model = null;
try {
sd_model = new SentenceModel(new FileInputStream(
"opennlp/models/english/sentdetect/en-sent.bin"));
} catch (InvalidFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
SentenceDetectorME mSD = new SentenceDetectorME(sd_model);
String param = "This is a good senttence.I'm very happy. Who can tell me the truth.And go to school.";
String[] sents = mSD.sentDetect(param);
for(String sent : sents){
System.out.println(sent); …Run Code Online (Sandbox Code Playgroud) 如何在C++中没有科学记数法的情况下将double转换为浮点字符串表示形式."小"样本(有效数字可以是任何大小,例如1.5E200或1e-200):
0.0000000000000000000000000000000000000000000000000000000023897356978234562
Run Code Online (Sandbox Code Playgroud)
谢谢.
在这里,我想将一个"大"字典转储到json中,如下所示:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
doc = {}
# appending the doc, so that the doc is more than 2G
.....
json_doc = json.dumps(doc)
Run Code Online (Sandbox Code Playgroud)
然后我收到以下错误消息:
File "C:\Python27\lib\site-packages\simplejson\__init__.py", line 286, in dump
s
return _default_encoder.encode(obj)
File "C:\Python27\lib\site-packages\simplejson\encoder.py", line 228, in encod
e
chunks = list(chunks)
MemoryError
Run Code Online (Sandbox Code Playgroud)
我该如何解决?谢谢!
我有这些结构:
typedef struct _Frag{
struct _Frag *next;
char *seq;
int x1;
int length;
}Frag;
typedef struct _Fragment{
int type;
Frag *frag_list;
}Fragment;
Run Code Online (Sandbox Code Playgroud)
然后我创建了一个数组
Fragment *fragments=malloc(1,sizeof(Fragment)); // or more
fragments->frag_list=malloc(1,sizeof(Frag)); // or more
Frag *frag=malloc(10,sizeof(Frag));
frag->seq="test str\n";
...
frag->next=malloc(1,sizeof(Frag));
frag->next->seq="test str\n";
Run Code Online (Sandbox Code Playgroud)
在程序结束时,我想释放内存,功能是:
static void free_frags(){
int i;
Fragment *fragment;
Frag *current,*next;
for(i=0;i<1;i++){
fragment=&snp_frags[i];
current=fragment->frag_list;
next=current->next;
while(next!=NULL){
free(current->seq);
//free(current->next);
free(current);
current=next;
next=current->next;
}
free(current->seq);
//free(current->next);
free(current);
//free(fragment->frag_list);
free(&snp_frags[i]);
}
free(snp_frags);
}
Run Code Online (Sandbox Code Playgroud)
如果我使用valgrind来调试它,valgrind说:
=============================================
==3810== Invalid read of size 4
==3810== at 0x80490FD: …Run Code Online (Sandbox Code Playgroud)