使用Chrome 12.0.742.112,如果我使用以下标头重定向:
HTTP/1.1 302 Found
Location: http://0.0.0.0:3000/files/download.zip
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache
X-Ua-Compatible: IE=Edge
X-Runtime: 0.157964
Content-Length: 0
Server: WEBrick/1.3.1 (Ruby/1.9.2/2011-02-18)
Date: Tue, 05 Jul 2011 18:42:25 GMT
Connection: Keep-Alive
Run Code Online (Sandbox Code Playgroud)
如果遵循,则返回以下标题:
HTTP/1.1 200 OK
Last-Modified: Tue, 05 Jul 2011 18:18:30 GMT
Content-Type: application/zip
Content-Length: 150014
Server: WEBrick/1.3.1 (Ruby/1.9.2/2011-02-18)
Date: Tue, 05 Jul 2011 18:44:47 GMT
Connection: Keep-Alive
Run Code Online (Sandbox Code Playgroud)
Chrome不会重定向,也不会更改上一页,它只会在控制台中报告以下警告:
资源解释为Document但使用MIME类型application/zip传输.
该过程在Firefox中正常运行,如果我打开一个新标签并直接进入,也可以在Chrome中正常运行http://0.0.0.0:3000/files/download.zip.我做错了什么,或者这是Chrome的错误/怪癖?
我以一种不那么优雅的方式杀死了一个IRB提示(开始heroku run irb),现在我有一个僵尸进程,我似乎无法杀死它:
Process State Command
------------ ------------------ ------------------------------
run.3 up for 2h irb -r ./init.rb
web.1 up for 0s thin -p $PORT -e $RACK_ENV -R $HER..
Run Code Online (Sandbox Code Playgroud)
我试过了:
heroku restartheroku ps:scale run=0heroku ps:restart run.3有谁知道我怎么强行退出呢?
有没有办法将值向量扩展为函数的参数?例如:
(defn addnums [a b]
(apply + (flatten [a b])))
(def args [[1 2 3] [1 2 3]])
(addnums *args)
Run Code Online (Sandbox Code Playgroud) 根据我的阅读,我应该如何设置YouTube API:
<!DOCTYPE html>
<html lang="en">
<head>
<meta content='text/html;charset=UTF-8' http-equiv='content-type' />
<title>Youtube Player</title>
<script src="jquery.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8">
function onYouTubePlayerReady(id) {
console.log("onYouTubePlayerReady() Fired!");
var player = $("#youtube_player").get(0);
}
var params = { allowScriptAccess: "always" };
var atts = { id: "youtube_player" };
swfobject.embedSWF("http://www.youtube.com/apiplayer?enablejsapi=1",
"youtube", "425", "356", "8", null, null, params, atts);
</script>
</head>
<body>
<div id="youtube"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
但是,'onYouTubePlayerReady()'根本不会触发,如果我手动获取对播放器的引用,则很多方法都是未定义的; 例如,cueVideoById()可以工作,但playVideo()不能.
我该如何解决这个问题?
它可以追溯到第7行的config/boot.rb:
require 'rubygems'
require 'bundler'
Bundler.setup
Run Code Online (Sandbox Code Playgroud)
据说安装了Bundler 0.8.1:
../Users/ashley$ sudo gem install bundler
Successfully installed bundler-0.8.1
1 gem installed
Installing ri documentation for bundler-0.8.1...
Installing RDoc documentation for bundler-0.8.1...
Run Code Online (Sandbox Code Playgroud)
我所做的一切都遵循了本指南.任何人都有任何线索有什么不对?
谢谢 :)
我正在尝试将属性传递到另一个组件。将数组作为<VideoList videos={this.props.channel.video_list}></VideoList>结果传递会this.props.videos成为一个空对象:
{
"videos": {
"__dataID__": "client:5610611954",
"__fragments__": {
"2::client": "client:5610611954"
}
}
}
Run Code Online (Sandbox Code Playgroud)
(GraphQL根据React Chrome扩展程序的确认返回了正确的数据,只是没有传递给VideoList。)
组件/video_list.js
import React from 'react'
import Relay from 'react-relay'
import VideoItem from '../containers/video_item'
export default class VideoList extends React.Component {
render() {
return(
<div>
{
this.props.videos.edges.map(video =>
<VideoItem key={video.id} video={video.node}/>
)
}
</div>
)
}
}
Run Code Online (Sandbox Code Playgroud)
组件/channel_list.js
import React from 'react'
import Relay from 'react-relay'
import VideoList from './video_list'
export default class ChannelView extends React.Component {
render() { …Run Code Online (Sandbox Code Playgroud) 假设我有一个18行的spresheet,我可以硬编码D列中最后7个值的范围并平均它们的值,如下所示:
=AVERAGE(D12:D18)
Run Code Online (Sandbox Code Playgroud)
如果不对其进行硬编码,我怎么能这样做呢,所以当我添加更多行时它会起作用?
TDD的一个常见做法是你做出微小的步骤.但有一件事让我感到烦恼,就是我看到过一些人所做的事情,他们只是硬编码值/选项,然后重构以使其正常工作.例如…
describe Calculator
it should multiply
assert Calculator.multiply(4, 2) == 8
Run Code Online (Sandbox Code Playgroud)
然后你尽可能让它通过:
class Calculator
def self.multiply(a, b)
return 8
Run Code Online (Sandbox Code Playgroud)
它确实如此!
为什么人们会这样做?它是否确保他们实际上在正确的类或其他东西中实现该方法?因为它似乎是一种可靠的方式来引入错误并在忘记某些事情时给予虚假信心.这是一个好习惯吗?
我们有一个Figure装饰器,允许我们插入一个链接,您可以将鼠标悬停在该链接上以获得图像的预览。我们使用模态形式将此图像以及一些元数据(标题等)插入。这一切都很好。但是,我们还希望能够单击链接并弹出模式进行编辑。
Entity.replaceData()对于更新元数据非常有用,剩下的唯一问题就是来自模式的修饰文字。看来,实体对其装饰的内容一无所知。
我们如何查找和替换文本?有没有解决的办法?
(我尝试将“草稿”中的内容设置为任意单个字符,并让装饰器显示内容/标题(这很好),但是,当尝试删除图形时,“草稿”似乎跳过了内容并删除了之前的内容我猜这是由于文字长度不同所致。我认为将其设置为“ IMMUTABLE”可以解决此问题,但这无济于事。)
编辑:
这是我的装饰工:
function LinkedImageDecorator(props: Props) {
Entity.mergeData(props.entityKey, { caption: "hello world" });
const entity = Entity.get(props.entityKey);
const data = entity.getData();
return <LinkedImage data={data} text={props.children} offsetKey={props.offsetKey} />
}
function findLinkedImageEntities(contentBlock: ContentBlock, callback: EntityRangeCallback) {
contentBlock.findEntityRanges((character) => {
const entityKey = character.getEntity();
return (
entityKey != null &&
Entity.get(entityKey).getType() === ENTITY_TYPE.IMAGE
);
}, callback);
}
export default {
strategy: findLinkedImageEntities,
component: LinkedImageDecorator,
editable: false,
};
Run Code Online (Sandbox Code Playgroud)
如您所见,我正在测试Entity.mergeData哪个最终将是我LinkedImage组件的回调(它将打开一个模式onClick。)因此,元数据很容易更新,我只需要能够更新传递的修饰文字即可。作为props.children。