我有以下难看的硬代码:
<div class="label">
<p id="CO-0"></p>
<p id="CO-1"></p>
<p id="CO-2"></p>
<p id="CO-3"></p>
</div>
Run Code Online (Sandbox Code Playgroud)
如何在JavaScript中使用迭代自动插入0,1,2和3 pid?
这是我的开始:
for (i = 0; i< 3; i +=1){
$('.label').html('<p id='+[i]+'></p>');
}
Run Code Online (Sandbox Code Playgroud) 如何将目标_blank传递给js 链接方法?
x = "my link to google"
x.link("www.google.com")
<a href="www.google.com">my link to google</a>
Run Code Online (Sandbox Code Playgroud)
如果它不可能有替代方法我可以使用?
我在使用新的OSX Mountain Lion Install编译Phusion Passenger时遇到了麻烦.你有什么建议吗?
Installing Phusion Passenger Standalone...
[******************************* ] Compiling Phusion Passenger...
*** ERROR: the following command failed:
mkdir -p 'ext/ruby/ruby-1.9.3-x86_64-macosx/'
cd 'ext/ruby/ruby-1.9.3-x86_64-macosx/' && /Users/boris/.rvm/wrappers/ruby-1.9.3-p194@apps2/ruby '/Users/boris/.passenger/standalone/3.0.13-x86_64-ruby1.9.3-macosx-10.8/support/ext/ruby/extconf.rb'
checking for alloca.h... *** /Users/boris/.passenger/standalone/3.0.13-x86_64-ruby1.9.3-macosx-10.8/support/ext/ruby/extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=/Users/boris/.passenger/standalone/3.0.13-x86_64-ruby1.9.3-macosx-10.8/support/ext/ruby
--curdir
--ruby=/Users/boris/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
/Users/boris/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用is.gd中的超级简单API:
http://is.gd/api.php?longurl=http://www.example.com
Run Code Online (Sandbox Code Playgroud)
它返回一个响应头"HTTP/1.1 200 OK",如果URL被缩短如预期,或"HTTP/1.1 500内部服务器错误",如果有,阻止此任何问题.假设请求成功,响应正文将仅包含新的缩短URL
我甚至不知道从哪里开始,或者如果有任何可用的Ruby方法,使发送和接收摩擦这些API请求.我基本上想要将响应(缩短的url)分配给ruby对象.
你会怎么做?提前致谢.
在我的Rails 3 app控制器上,我有以下代码:
array = []
Location.all.each{|x|array<<x.city.html_safe}
@data_dump = array
Run Code Online (Sandbox Code Playgroud)
在Rails控制台中,它看起来很干净:
["Littelside", "Tessmouth"]
Run Code Online (Sandbox Code Playgroud)
在我看来,@ data_dump对象被编码:
["Littelside", "Tessmouth"]
Run Code Online (Sandbox Code Playgroud)
你怎么清理这个烂摊子?我希望我的对象在视图中,以对象在终端中返回.提前致谢!
我有两个提交:
[branch]: [commit_id]
justin: 94943b74ba273a9f4009
jzbranch: 6070aada7b8a690d410b
Run Code Online (Sandbox Code Playgroud)
如何将两个分支合并到jzbranch中,并解决两者之间的任何差异?
这是我的代码:
$('#link').attr("href",link)
$('#link').text(text)
Run Code Online (Sandbox Code Playgroud)
如何使用jQuery更改链接的标题?我正在更改网址,但我无法编辑文本,我做错了什么?
<a id="link" href="" target="_blank">text</a>
$('#link').attr("href",data[1].url)
$('#link').attr("title",data[1].title)
<a href="http://link.com">title</a>
Run Code Online (Sandbox Code Playgroud)
我想简单地改变两件事:
我可以更改链接,但标题不会改变.我选错了.因此,有没有办法列出所有可用的attr?或者你能帮助我改变上面的文字标题吗?
答案都是可以接受的.
<div id="highlight" class="topicHighlight hero1">
<h3 id="h3">hero_1_large_text</h3>
<p id="p"></p>
<span id="coverTextSpan">hero_1_small_text</span>
<a id="link" href="url" target="_blank">text</a>
</div>
Run Code Online (Sandbox Code Playgroud) 我已成功部署了Ruby on Rails应用程序,并按照资产管道指南设置资产编译和压缩.看来我的服务器日志中出现了缓存问题.
在尝试mkdir缓存文件夹时,似乎我有一个Permission被拒绝了?这里发生了什么?我怎么解决这个问题?
nginx/logs error.log ...
cache: [GET /assets/grid.png] miss
cache: [GET /] miss
cache error: Permission denied - /var/www/redmeetsblue/releases/20120212234112/tmp/cache/B27
/usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir'
/usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/fileutils.rb:247:in `fu_mkdir'
/usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/fileutils.rb:221:in `block (2 levels) in mkdir_p'
/usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/fileutils.rb:219:in `reverse_each'
/usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/fileutils.rb:219:in `block in mkdir_p'
/usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/fileutils.rb:205:in `each'
/usr/local/rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/fileutils.rb:205:in `mkdir_p'
Run Code Online (Sandbox Code Playgroud)
tmp文件夹用户/权限......
ls -alh /var/www/redmeetsblue/current/tmp
total 12K
drwxr-xr-x 3 root root 4.0K 2012-02-12 18:43 .
drwxrwxr-x 13 root root 4.0K 2012-02-12 18:41 ..
drwxr-xr-x 3 root root 4.0K 2012-02-12 18:43 cache
lrwxrwxrwx 1 root root 33 2012-02-12 18:41 pids -> …Run Code Online (Sandbox Code Playgroud) 自制语0.9.3 OSX 10.8.2
我想知道你是否见过这样的东西?
==> make install
brew: superenv removed: -O3 -gdwarf-2 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter
20 errors generated.
make[1]: *** [/private/tmp/node-tiuh/node-v0.8.12/out/Release/obj.target/uv/deps/uv/src/unix/darwin.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [node] Error 2
Error: node did not build
Logs: /Users/justin/Library/Logs/Homebrew/node/
Help: https://github.com/mxcl/homebrew/wiki/troubleshooting
https://github.com/mxcl/homebrew/issues/13282
Run Code Online (Sandbox Code Playgroud) 假设我执行以下查询:
results = db.engine.execute(sql_query)
Run Code Online (Sandbox Code Playgroud)
它按预期返回行:
>>> for record in results:
... print(record['path'])
...
Top.Collections.Pictures.Astronomy.Stars
Top.Collections.Pictures.Astronomy.Galaxies
Top.Collections.Pictures.Astronomy.Astronauts
Run Code Online (Sandbox Code Playgroud)
当我尝试第二次或第三次迭代它时,对象为空:
>>> for record in results:
... print(record['path'])
...
>>>
Run Code Online (Sandbox Code Playgroud)
如何保存和重用ResultProxy以多次迭代它?
javascript ×3
hyperlink ×2
jquery ×2
ruby ×2
api ×1
arrays ×1
caching ×1
commit ×1
git ×1
git-branch ×1
git-checkout ×1
homebrew ×1
html ×1
html-safe ×1
loops ×1
macos ×1
merge ×1
nginx ×1
node.js ×1
passenger ×1
permissions ×1
production ×1
python ×1
quotes ×1
sqlalchemy ×1
target ×1
xcode ×1