我有一个Symfony 2.0应用程序使用Vagrant运行Linux客户端和主机O/S(Ubuntu).但是,它运行缓慢(例如,加载页面需要几秒钟,通常超过10秒),我无法解决原因.我在本地运行站点而不是Vagrant VM的同事让它运行得更快.
我在其他地方读过,如果没有启用NFS,Vagrant VM的运行速度非常慢,但我已经启用了.我也在使用APC缓存试图加快速度,但问题仍然存在.
我使用http://webmozarts.com/2009/05/01/speedup-performance-profiling-for-your-symfony-app上的说明对我的网站运行xdebug ,但我不清楚从哪里开始分析来自此的数据.我已经在KCacheGrind中打开它并在"Incl."下寻找高数字.和"自我",但这表明php::session_start需要相当长的时间.
关于我应该在这里尝试什么的任何建议?对不起稍微宽泛的问题,但我很难过!
我正在尝试使用Capistrano部署项目.我的开发机器正在运行Windows 7; 我正在部署的服务器是Linux.
在deploy.rb脚本中,设置以下内容:
ssh_options[:forward_agent] = true
Run Code Online (Sandbox Code Playgroud)
Capistrano脚本从本地运行git命令开始,此时我被提示输入SSH密钥的密码:
* executing `deploy:update_code'
executing locally: "git ls-remote git@github.com:pathto/gitproject.git develop"
Enter passphrase for key '/c/Users/Sam/.ssh/id_rsa':
command finished in 6999ms
Run Code Online (Sandbox Code Playgroud)
(我可能已经从中看到了真正的git路径.)
我输入我的密码,这很好用.然而,Capistrano然后尝试在远程机器上做类似的事情(在下面重命名为staging-server.com)并且我得到一个错误 - 请参阅此提取的最后一行:
[staging-server.com] executing command
[staging-server.com] sh -c 'git clone git@github.com:pathto/gitproject.git /home/perstest/releases/20120412074500 && cd
/home/perstest/releases/20120412074500 && git checkout -b deploy 50eaf06d06d66fd20c3e55038276f420d8c308a8 && (echo 50eaf06d06d66fd20c3e55038
276f420d8c308a8 > /home/perstest/releases/20120412074500/REVISION)'
** [staging-server.com :: out] Initialized empty Git repository in /home/perstest/releases/20120412074500/.git/
** [staging-server.com :: err] Error reading response length from authentication socket.
Run Code Online (Sandbox Code Playgroud)
如果我在deploy.rb中注释掉forward_agent行,则此安装成功,可能是使用部署服务器本身的密钥.
我的SSH密钥似乎正在工作 - 毕竟,最初的git命令工作,我可以在git …
谷歌appengine的webapp2有关于上传文件处理的非常神秘的文档.
Uploaded files are available as cgi.FieldStorage (see the cgi module) instances directly in request.POST.
Run Code Online (Sandbox Code Playgroud)
我有一个表单,它发出我想要存储在NDB.JsonProperty中的JSON文件的POST请求.
任何人都可以提供一个简短的例子,说明如何从请求对象中读取文件?
我一直在我的tsconfig.json. 作为其中的一部分,我想重新编译我所有的 TypeScript 文件,以查看发出的 JavaScript 与新设置(例如更改module选项)有何不同。
.ts然而,底层文件本身并没有改变,因此调用tsc什么也不做。
tsc即使它认为不需要重新创建所有文件,我怎么知道它?
作为参考,我像这样调用 TypeScript 编译器:
node_modules/typescript/bin/tsc --build src/tsconfig.json
Run Code Online (Sandbox Code Playgroud) doctrine:fixtures:load命令中的--no-interaction标志在Symfony命令中无法运行.它通过终端工作.我是在正确地说它?
当我从捆绑中运行时:
/**
* Loads the fixtures
* @param \Symfony\Component\Console\Output\OutputInterface $oOutput
* @return \Symfony\Component\Console\Output\OutputInterface
*/
protected function loadFixturesCommand($oOutput) {
$oOutput->writeln('<fg=white>Attempting to load fixtures</fg=white>');
$updateCommand = $this->getApplication()->find('doctrine:fixtures:load');
$updateArguments = array(
'command' => 'doctrine:fixtures:load',
'--no-interaction' => true,
);
$updateInput = new ArrayInput($updateArguments);
$updateCommand->run($updateInput, $oOutput);
try {
$updateCommand->run($updateInput, $oOutput);
} catch (ContextErrorException $e) {
//..
}
return $this;
}
Run Code Online (Sandbox Code Playgroud)
我被提示加载灯具
但运行这个:
php app/console doctrine:fixtures:load --no-interaction
Run Code Online (Sandbox Code Playgroud)
不提示我.
我究竟做错了什么?
我有一个带有两个防火墙的Symfony应用程序,一个用于管理员,一个用于普通用户.
admin:
provider: admin
# etc
main_site:
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
Run Code Online (Sandbox Code Playgroud)
我希望管理员用户能够冒充普通用户.我怎么能这样做,因为他们使用单独的防火墙和单独的用户提供商?
我正在尝试使用钩子测试反应功能组件。useEffect 钩子调用第三方 API,然后在返回时调用 setState。
我有测试工作,但不断收到警告,指出组件的更新未包含在行为中。
我遇到的问题是期望在 moxios.wait 承诺内,因此我无法将其包装在行为函数中,然后对其结果进行断言。
测试通过了,但我知道不包装在行为函数中更新状态的代码可能会导致误报或未发现的错误。我只是想知道我应该如何测试这个。
我已经尝试在 react 16.9.0 alpha 版本中使用新的 async await act 函数,以及我在许多 github 问题(如 jest setTimers)中发现的许多建议,但似乎都没有解决问题。
组件
const Benefits = props => {
const [benefits, setBenefits] = useState([])
const [editing, setEditing] = useState(false)
const [editingBenefit, setEditingBenefit] = useState({id: null, name: '', category: ''})
useEffect(() => {
axios.get('#someurl')
.then(response => {
setBenefits(response.data)
})
}, [])
}
Run Code Online (Sandbox Code Playgroud)
考试
describe('Benefits', () => {
it('fetches the list of benefits from an api and populates the benefits table', (done) …Run Code Online (Sandbox Code Playgroud) symfony ×3
python ×2
capistrano ×1
doctrine-orm ×1
fixtures ×1
git-bash ×1
moxios ×1
pipenv ×1
reactjs ×1
ssh-agent ×1
typescript ×1
vagrant ×1
webapp2 ×1