小编coo*_*ool的帖子

如何取消选择多选小部件中的所有选项

我正在使用jquery multiselect小部件.我想取消选中所有这些都是手动检查的.我在JSFiddle - > Code中有一个示例代码

这不起作用.当手动选择选择选项时,在选择它时检查未选中的选项是否为第一次给我1(在最后一个选项中单击).所以我检查了是否$this.children("option").not('[selected]').length 是1并且 ui.checked 调用了uncheckAll 但之后它正确地表现了代码,如果$this.children("option").not('[selected]').length 在选择最后一个时给我0.

我想知道发生了什么.

jquery multi-select

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

nodejs强大,不会触发任何事件

我在express3.x并使用强大的

app.post "/up",(req,res)->
formidable = require('formidable')
form = new formidable.IncomingForm()
form.uploadDir = __dirname + "/uploads"
form.encoding = 'binary'


form.addListener 'file',(name,file) ->
    #write file
    console.log('file uploaded')
    return
console.log('$$$$$$$$$$$')
form.addListener 'end', ->
    console.log('end')
    res.end()
    return
console.log('@@@@@$$$$')
form.parse req,(err,fields,files)->
    console.log('parse')
    console.log(err) if(err)
    return
console.log('######')
return
Run Code Online (Sandbox Code Playgroud)

上传表格是

block content
:coffeescript
    $ ->
        formData = new FormData()
        xhr = new XMLHttpRequest()
        onProgress = (e)->
            per_complete = (e.loaded/e.total) * 100 if e.lengthComputable

        onReady = (e)->
            alert("Ready")

        onError = (err)->
            alert("Error Loading "+err)

        $('#upload').click (e)->
            formData.append('img',document.getElementById('img').files[0])
            xhr.open('post','/up',true) …
Run Code Online (Sandbox Code Playgroud)

node.js express formidable

6
推荐指数
1
解决办法
2187
查看次数

表达3.0如何使用app.locals.use和res.locals.use

我在express3.0rc2上.如何使用app.locals.use(它是否仍然存在)和res.locals.use

我看到了这个https://github.com/visionmedia/express/issues/1131但是app.locals.use引发了一个错误.我假设一旦我将该函数放在app.locals.use中,我就可以在路由中使用它.

我想补充一下

app.locals.use(myMiddleware(req,res,next){res.locals.uname = 'fresh'; next();})  
Run Code Online (Sandbox Code Playgroud)

然后在任何路由中调用此中间件

谢谢

node.js express

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

哪个全局变量用于最后一个表达式

Ruby版本 - 1.9.2

在IRB中,最后一个表达式在_中.但是,如果你在ruby程序中如何获得最后一个表达式.

谢谢

ruby

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

coffeescript如何使用extends for Array

我正在尝试使用extends for array ..我应该在构造函数中添加什么..这是代码

class List extends Array
  constructor: ()->
      super arguments
      this

list = new List("hello","world")
alert list[0]
Run Code Online (Sandbox Code Playgroud)

似乎不起作用..

javascript coffeescript

5
推荐指数
2
解决办法
1837
查看次数

为什么我们需要使用除非和"?" 一起而不是一个人

什么是使用除非和"?" 在这种情况下你可以使用if if

unless person.present?
Run Code Online (Sandbox Code Playgroud)

相当于

if person.present
Run Code Online (Sandbox Code Playgroud)

coffeescript

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

如何缓存expressjs响应

如何缓存由 expressjs 路由生成的响应。这条路线有很多数据库访问,对它的更改很少。是否有任何可用的节点模块。

谢谢

caching node.js express

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

chrome文件系统检查 - 重新加载更改

是否有一个扩展用于在整个文件夹中的文件系统更改中加载整个页面.我现在正在使用Tincr,但它不允许我观看整个文件夹.

有一个firefox的自动重新加载,它可以方便地在扩展名上查看文件夹和过滤器

google-chrome-extension google-chrome-devtools livereload

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

PHP SID没有显示

我不能让我的SID工作......

<?php
session_start();
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';?>
Run Code Online (Sandbox Code Playgroud)

没有显示SID号码,但session_id工作不确定我是否遗漏了某些东西.THnks

php

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

nodejs express 3.0 app.use是否被调用

我正在使用Express 3.x和我放的时候

express = require("express")
routes = require("./routes")
http = require("http")
path = require("path")
app = express()
app.configure ->
    app.set "port", process.env.PORT or 3000
    app.set "views", __dirname + "/views"
    app.set "view engine", "jade"
    app.use express.favicon()
    app.use express.logger("dev")
    app.use express.bodyParser()
    app.use express.methodOverride()
    app.use app.router
    app.use express.static(path.join(__dirname, "public"))

app.use (req,res,next)->
    res.locals.name = "Jesse"
    next()


app.use "/", (req,res,next)->
    res.locals.name = "Jesse"

app.configure "development", ->
    app.use express.errorHandler()

app.get "/", routes.index

http.createServer(app).listen app.get("port"), ->
    console.log "Express server listening on port " + app.get("port") …
Run Code Online (Sandbox Code Playgroud)

node.js express

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