小编XMe*_*Men的帖子

在node.js中上传Ajax文件

想要使用此上传器使用ajax上传文件 http://valums.com/ajax-upload/

并在node.js中编写此代码,该代码使用普通文件上载而不使用ajax.

console.log("request " + sys.inspect(req.headers));

            req.on('data', function(chunk) {
              console.log("Received body data:");
              // console.log(chunk.toString());
            });
            var form = new formidable.IncomingForm();

            form.parse(req, function(err,fields, files) {
                console.log('in if condition'+sys.inspect({fields: fields, files: files}));
                fs.writeFile("upload/"+files.upload.name, files.upload,'utf8', function (err) {
                    if (err) throw err;
                    console.log('It\'s saved!');
                    client.putFile("upload/"+files.upload.name, files.upload.name, function(err, res){
                        if (err) throw err;
                        if (200 == res.statusCode) {
                          console.log('saved to s3');

                          httpres.writeHead(200, {'content-type': 'text/plain'});
                          httpres.write('received 1upload:\n\n');
                          httpres.end();
                        }
                    }); 
                });
            });
Run Code Online (Sandbox Code Playgroud)

但这是错误的?

request { host: 'myhost:8001',
  'user-agent': 'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 …
Run Code Online (Sandbox Code Playgroud)

ajax file-upload node.js

5
推荐指数
1
解决办法
3373
查看次数

在node.js中上传Ajax文件

我想上传使用xhr发送文件数据的ajax文件上传,在客户端m使用此 http://valums.com/ajax-upload/ 我将如何在节点上接受此数据并通过node.js将文件保存到服务器,我需要在node.js中使用哪个模块?

ajax file-upload node.js

5
推荐指数
1
解决办法
1万
查看次数

使用redis给出错误

我通过以下链接安装了redis. https://github.com/mranney/node_redis

并尝试

var redis = require("redis"),
    client = redis.createClient();

client.on("error", function (err) {
    console.log("Error " + err);
});

client.set("string key", "string val", redis.print);
client.hset("hash key", "hashtest 1", "some value", redis.print);
client.hset(["hash key", "hashtest 2", "some other value"], redis.print);
client.hkeys("hash key", function (err, replies) {
    console.log(replies.length + " replies:");
    replies.forEach(function (reply, i) {
        console.log("    " + i + ": " + reply);
    });
    client.quit();
});
Run Code Online (Sandbox Code Playgroud)

并运行 node test.js

给我这个错误为什么?

Error Error: Redis connection to 127.0.0.1:6379 failed - ECONNREFUSED, Connection refused …
Run Code Online (Sandbox Code Playgroud)

redis node.js

4
推荐指数
1
解决办法
2923
查看次数

为什么在backbone.js中查看视图时会渲染额外的div

为什么在backbone.js中查看视图时会渲染额外的div

Backbone.View.extend({
  template :_.template( 
        '<li id="user-<%=user.username%>" class="pp-entry group">'+
            '<img src="i/pp-pic-1.png" class="pp-pic" alt="" />'+
            '<span class="whisper-mode-on hide" title="Whisper mode on"></span>'+
            '<h6 class="pp-name"><%=user.firstname%>&nbsp; <%if(user.lastname!="null"){%><%=user.lastname%><%}%></h6>'+
            '<p id="chat-<%=user.username%>"class="pp-msg"></p>'+
        '</li>'), 
  initialize: function() {
    _.bindAll(this, 'render', 'close');
    this.model.bind('change', this.render);
    this.model.view = this;
  }, 
  // Re-render the contents of the User item.
  render: function() {
    $(this.el).html(this.template(this.model.toJSON()));

                $("#participant-window").prepend(this.el);
}
});
Run Code Online (Sandbox Code Playgroud)

什么时候它正在渲染它像这样:

<ul id="participant-window" class="scroll-pane" style="overflow: hidden; padding: 0px; width: 357px;">
<div>
<li id="user-ashutosh" class="pp-entry group" style="cursor: default;">
<img class="pp-pic" alt="" src="i/pp-pic-1.png">
<span class="whisper-mode-on hide" title="Whisper mode on"></span>
<h6 …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-templates backbone.js

4
推荐指数
1
解决办法
1772
查看次数

如何在zookeeper中查看连接数

我想查看正在运行的 zookeeper 中的连接数,因为 m 正在运行 lily ,所以它给出了异常但想检查 zookeeper 中的连接数。

http://zookeeper.apache.org/doc/r3.1.2/zookeeperStarted.html

hbase apache-zookeeper

4
推荐指数
1
解决办法
9822
查看次数

如何在onclick事件中获取表单字段值

我正在使用这篇建筑文章http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/

在我的代码中:

我有这个Application.DashBoardForm.js,我想在onc​​lick事件函数中传递fromdate的值,我怎样才能传递fromdate值?

Ext.apply(Ext.form.VTypes, {
    daterange : function(val, field) {
        var date = field.parseDate(val);

        if(!date){
            return false;
        }
        if (field.startDateField) {
            var start = Ext.getCmp(field.startDateField);
            if (!start.maxValue || (date.getTime() != start.maxValue.getTime())) {
                start.setMaxValue(date);
                start.validate();
            }
        }
        else if (field.endDateField) {
            var end = Ext.getCmp(field.endDateField);
            if (!end.minValue || (date.getTime() != end.minValue.getTime())) {
                end.setMinValue(date);
                end.validate();
            }
        }
        /*
         * Always return true since we're only using this vtype to set the
         * min/max allowed values (these are tested for after the …
Run Code Online (Sandbox Code Playgroud)

extjs formfield

3
推荐指数
1
解决办法
3万
查看次数

错误即将发现lib-faac-dev

我从这里安装faac http://sourceforge.net/projects/faac/files/faac-src/faac-1.28/faac-1.28.tar.gz/ 然后运行这个命令给我这个错误basicall 我想要为libmp3lame安装带音频转换的ffmpeg,意味着进行音频转换.

sudo apt-get install build-essential subversion git-core checkinstall yasm texi2html libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libvorbis-dev libvpx-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libfaac-dev
Run Code Online (Sandbox Code Playgroud)

以下文章 http://pasindudps.blogspot.com/2010/12/compiling-ffmpeg-in-ubuntu-1010.html

audio ubuntu ffmpeg

3
推荐指数
1
解决办法
3329
查看次数

如何在extjs字段中获取前一天的日期

我有以下日期字段我想获得前一天的日期,我怎么能得到它?在我的表格面板中

 items: [{
    fieldLabel: 'Start Date',
    name: 'fromdate',
    ref: '../fromdate',
    id: 'fromdate',
    vtype: 'daterange',
    value: new Date(),
    endDateField: 'todate' // id of the end date field
}, {
    fieldLabel: 'End Date',
    name: 'todate',
    id: 'todate',
    vtype: 'daterange',
    value: new Date(),
    startDateField: 'fromdate' // id of the start date field
}]
Run Code Online (Sandbox Code Playgroud)

今天我要03/23/2011但是我想要03/22/2011我怎么能得到2011年3月22日?

extjs date

2
推荐指数
1
解决办法
1万
查看次数

如何在extjs中以特定格式呈现日期时间

我有一个网格,有字段更新,这是来自db的日期时间,例如2011-03-22 01:45:00

这是我的读者代码:

{name: 'updatedon', type:'datetime'},
Run Code Online (Sandbox Code Playgroud)

这是我的渲染器代码:

{
    id       :'updatedon',
    header   : ' updatedon', 
    width    : 100, 
    sortable : true, 
    dataIndex: 'updatedon',
    renderer: Ext.util.Format.dateRenderer('d/m/Y')
},
Run Code Online (Sandbox Code Playgroud)

我该如何渲染才能获得22/03/2011

extjs date render

2
推荐指数
1
解决办法
1万
查看次数

extjs文件大小是如此之大

我正在extjs中构建一个应用程序,ext-all.js大小为700kb,这是非常大的,我们的技术架构师无法接受.所以我该怎么做 ?

我应该删除extjs并构建其他UI.

要么

我可以做一些关于尺寸的事吗?

size extjs

2
推荐指数
1
解决办法
4931
查看次数