我的应用程序在多个控制器中成功使用Codeigniter验证,用于各种输入字段.但是,当涉及上传和验证上传的图像时,验证会抱怨.
我有以下形式:require_once('head.php'); 回声'
if($info)
echo '<div class="info">'.$info.'</div>';
$attributes = array('class' => 'updateavatarform', 'id' => 'updateavatarform');
echo form_open_multipart('user/avatar', $attributes);
echo '<div>Select Image</div>';
$data = array(
'name' => 'avatar',
'id' => 'avatar',
'value' => '',
'maxlength' => '',
'size' => '48',
);
echo form_upload($data);
echo '<br/><br/>';
echo form_submit('submit', 'Submit');
echo form_close();
require_once('footer.php');
Run Code Online (Sandbox Code Playgroud)
控制器看起来像:
function avatar()
{
$data['user'] = $this->authorize->isLoggedIn();
if(!$data['user'])
$this->authorize->protectUser();
$data['title'] = 'Evcenter User Update Avatar';
$data['keywords'] = 'alternative fuel';
$data['description'] = 'evcenter.org';
$data['info'] = FALSE;
if($_POST)
{ …Run Code Online (Sandbox Code Playgroud) 我确信这是一个非常简单的解决方案,但我不确定为什么我推送到GitHub失败了.
现在它看起来像:
$ git push origin master
To git@github.com:user_name/project_name.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:user_name/project_name.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)
和:
$ git remote show origin
* remote origin
Fetch URL: git@github.com:user_name/project_name.git
Push URL: git@github.com:user_name/project_name.git
HEAD branch: master
Remote branch:
master tracked
Local ref configured for 'git push': …Run Code Online (Sandbox Code Playgroud) 经历了经典的数据结构并停止在链表上.只是实现了一个循环的单链表,但我印象深刻的是这个列表可以用更优雅的方式表达,特别是remove_node函数.记住效率和代码可读性,任何人都可以为单链循环列表提供更简洁有效的解决方案吗?
#include <stdio.h>
#include <stdlib.h>
struct node{
struct node* next;
int value;
};
struct list{
struct node* head;
};
struct node* init_node(int value){
struct node* pnode;
if (!(pnode = (struct node*)malloc(sizeof(struct node)))){
return NULL;
}
else{
pnode->value = value;
}
return pnode;
}
struct list* init_list(){
struct list* plist;
if (!(plist = (struct list*)malloc(sizeof(struct list)))){
return NULL;
}
plist->head = NULL;
return plist;
}
void remove_node(struct list*a plist, int value){
struct node* current, *temp;
current = plist->head;
if (!(current)) return; …Run Code Online (Sandbox Code Playgroud) 这对你来说很难.
我正在创建一个类项目,在那里我创建一个点对点聊天程序,我有这个问题:
当我打开聊天窗口时,没有问题.当我打开第二个窗口并尝试登录聊天时,我收到此错误:
**[Fatal Error] :1:120: The processing instruction target matching "[xX][mM][lL]" is not allowed.
org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
at chatter2.Chatter.process(Chatter.java:240)
at chatter2.Chatter.run(Chatter.java:222)
at java.lang.Thread.run(Thread.java:680)**
Run Code Online (Sandbox Code Playgroud)
我很确定它与我的代码如何为参与者创建XML有关.
这是我写的所有代码:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* NewJFrame.java
*
* Created on Nov 10, 2010, 2:11:39 PM
*/
package chatter2;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import …Run Code Online (Sandbox Code Playgroud) 有谁知道如何在调试期间查看游标中的内容,以便我可以确定数据库帮助程序的功能?
它一直表现得像是在返回数据,但是当我尝试使用该cursor.isNull(0)方法时,我不断被NullPointerException抛出而无法看到光标在其中的内容,而单步执行则让我非常沮丧.
任何帮助将非常感激.
谢谢.
我可以通过调用[UIImagePickerController takePicture:]以编程方式用iPhone拍照,但是当我这样做时,iPhone会播放快门点击的大声录音.当我谷歌关于如何关闭点击时,我找到建议重命名iPhone播放的声音文件.在我看来,我的应用程序会这样做会导致它被App Store拒绝访问系统框架.是否有一种程序化的方式来关闭这种声音?我的应用程序的性质要求相机保持沉默.
有人可以展示如何使用fastcgi_finish_request()函数的简单示例吗?我用谷歌搜索,但只发现了一些一般提及它,有些人说他们成功使用它但我找不到一个代码的例子.
例如,我有一个PHP对象.要向浏览器发送响应,我会生成HTML,然后通过它返回getResult().然后回应结果.
像这样:
$obj = new controller();
echo $o->getResult();
Run Code Online (Sandbox Code Playgroud)
假设我想利用这种优化技术将结果发送到浏览器,然后完成一些可能很长的过程,比如连接到某些API,比如Facebook API.
我该怎么做呢?我明白,基本上我可以调用fastcgi_finish_request();然后继续执行PHP脚本.
我只需要查看示例代码,我自己也不够聪明.
我正在尝试在apache mod-wsgi上部署一个用于生产的django应用程序.我有一个名为freecad的第三方python应用程序,它将python模块打包在FreeCAD.so库文件中.请求挂起'import FreeCAD'.一些apache日志错误告诉我,它可能是zlib的问题?尝试导入此模块时压缩.请注意,使用django的runserver时一切正常.
在进一步研究之后,这不是压缩问题,也不是许可.我做了www-data用户使用
$ sudo -u www-data python
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('/usr/lib/freecad/lib')
>>> import FreeCAD
FreeCAD 0.10, Libs: 0.10R3225
>>>
Run Code Online (Sandbox Code Playgroud)
但它仍然依赖于网页请求中的"导入FreeCAD"
最近,我一直在尝试使用apoc发布的treesharp库来实现健壮的行为树.我一直在阅读我书中的迭代器和接口,但我仍然无法弄清楚如何测试更不用说使用这个库了.接口如何与彼此连接以及如何用它们实际执行测试/构建树是令我感到困惑的.
通常在这种情况下,我会查找代码示例并从查看其他人的工作中获得启发,但是,对于此库,似乎没有任何示例代码.
任何人都可以帮我弄清楚如何使用这个库开始构建行为树?我很抱歉,如果这个问题非常无趣(我认为可能是这样),但接口中的枚举器和渐进式接口对我来说现在非常难以理解.
我正在尝试启动Store.Client.UI.exe进程,该进程位于:"C:\ Program Files\Intel\IntelAppStore\bin\Store.Client.UI.exe"或"C:\ Program Files"( x86)\ Intel\IntelAppStore\bin\Store.Client.UI.exe"对于像我这样的64位,所以我使用代码:
If My.Settings.instpathtype = 86 Then
Process.Start("C:\Program Files\Intel\IntelAppStore\bin\Store.Client.UI.exe")
Else
Process.Start("C:\Program Files (x86)\Intel\IntelAppStore\bin\Store.Client.UI.exe")
End If
Run Code Online (Sandbox Code Playgroud)
my.settings.instpathtype的位置是计算机是64位还是32位.但是当我运行它时,由于某种原因它不会运行Store.Client.UI.exe.当我进入资源管理器并键入"C:\ Program Files(x86)\ Intel\IntelAppStore\bin\Store.Client.UI.exe"时,它运行Store.Client.UI.exe.怎么了?
android ×1
audio ×1
c ×1
c# ×1
camera ×1
codeigniter ×1
cursor ×1
debugging ×1
django ×1
fastcgi ×1
file ×1
forms ×1
git ×1
git-pull ×1
git-push ×1
git-remote ×1
github ×1
iphone ×1
java ×1
linked-list ×1
module ×1
php ×1
process ×1
python ×1
shutter ×1
tree ×1
upload ×1
validation ×1
vb.net ×1
wsgi ×1
xml ×1