Smarty抱怨权限.我为我正在研究的项目编写了一个小的mvc框架,我需要能够在每个控制器中呈现模板.我继续按照Smarty安装说明进行操作,并在我的"前端控制器"或将请求路由到应用程序其余部分的页面中设置所有配置选项.testinstall函数说一切都是犹太洁食,但当我尝试在控制器中渲染模板时,我最终得到了这个.
警告:mkdir():第28行/var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_write_file.php中的权限被拒绝警告:重命名(/ tmp/wrt6piczo,./ templates_c/73b1662b4c376f493278f9873564df03430a0b43.file .poopy.tpl.php):第48行/var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_write_file.php中没有这样的文件或目录警告:chmod():没有这样的文件或目录在/var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_write_file.php第50行警告:include(./ templates_c/73b1662b4c376f493278f9873564df03430a0b43.file.poopy.tpl.php):无法打开流:第423行/var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysplugins/smarty_internal_template.php中没有此类文件或目录警告:include():打开'./templates_c/73b1662b4c376f493278f9873564df03430a0b43.file.poopy失败.在/ var/www/HRTRL/includes/CallLog/lib/Smarty/libs/sysp中包含tpl.php'(include_path ='.:/ usr/share/php:/ usr/share/pear')第423行的lugins/smarty_internal_template.php
我已经独立测试了我的框架的其余部分,一切似乎都有效.我的"前端控制器"将请求正确地路由到正确的控制器,我似乎能够正常渲染常规HTML.
另外,为了测试,我已经将所有Smarty库文件夹以及其他所需目录chmod到777.我仍然收到相同的权限错误.
编辑
这些是我用于所有必需的智能文件夹的设置.
$smarty->setTemplateDir('lib/smarty/templates');
$smarty->setCompileDir('lib/smarty/templates_c');
$smarty->setCacheDir('lib/smarty/cache');
$smarty->setConfigDir('lib/smarty/configs');
Run Code Online (Sandbox Code Playgroud) 我正在研究Michael Hartl的Rails教程,这个教程到目前为止都非常出色.我在高级设置章节中,他以有利于TDD的方式配置Rails环境.我安装了Guard,它通过运行我的spec /文件夹中的测试一直运行正常.但是,它会吐出这个错误:
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/listen-1.0.2/lib/listen/adapter.rb:195:in `require': cannot load such file -- wdm (LoadError)
Run Code Online (Sandbox Code Playgroud)
我安装了wdm.我不知道为什么它无法加载它.
似乎Listen在加载WDM时遇到了问题.在它说"卫兵正在观看......"后它退出了.
由于显而易见的原因,我没有重现堆栈跟踪的其余部分.我使用最新的Rails安装程序安装了Rails.这里发生了什么?我需要担心吗?它似乎至少部分工作......
我在闲暇时间玩Euler项目,而且我需要做一些重构.我已经实施了Miller-Rabin以及一些筛子.我之前听说过,对于小数字来说,筛子实际上更快,就像几百万以下一样.有没有人有这方面的信息?谷歌不是很有帮助.
我最近非常迷恋Seaside web框架.我想开始深入研究源代码,找出它是如何工作的.不幸的是,有很多课程,我不知道从哪里开始!有谁知道我应该先尝试理解哪些课程?我假设有一个路由类,我应该从...开始
我在为我编写的数据类型执行实例声明时使用了类型上下文.
data Set a = Insert a (Set a) | EmptySet
instance (Show a) => Show (Set a) where
show x = "{" ++ show' x ++ "}" where
show' (Insert x EmptySet) = show x
show' (Insert x xs) = show x ++ ", " ++ show' xs
instance Eq a => Eq (Set a) where
(Insert x xs) == (Insert y ys) = (x == y) && (xs == ys)
Run Code Online (Sandbox Code Playgroud)
所以现在,我必须将Eq类型上下文添加到我定义的所有使用我的Set类型的函数中,就像这样,或者我得到一个类型错误:
memberSet::Eq a =>a->Set a->Bool
memberSet _ EmptySet …Run Code Online (Sandbox Code Playgroud) 尝试将文件添加到Mercurial存储库时出现以下错误。
abort: /HRTRL/img not under root
Run Code Online (Sandbox Code Playgroud)
当开发人员决定忽略我们的正常工作流程并直接对生产服务器进行更改,而不是在其工作目录中进行更改,然后将其推送到测试存储库时,此操作就开始了。然后,我需要将测试仓库与他的更改同步,所以最终要做的就是将他的更改复制到当前的工作目录中,然后推送到中央存储库。复制和删除文件时,我没有使用mercurial。现在,我的目录中有未跟踪的文件,想添加它们以便提交。我最终遇到上述错误。
这是hg status的输出
! HRTRL/css/grid.css
! HRTRL/css/ie.css
! HRTRL/css/ie7.css
! HRTRL/css/jquery.lightbox-0.5.css
! HRTRL/css/layout.css
! HRTRL/css/productPages.css
! HRTRL/css/reset.css
! HRTRL/css/typography.css
? HRTRL/img/webheadercenter.jpg
? HRTRL/img/webheaderleft.jpg
? HRTRL/img/webheaderright.jpg
? HRTRL/includes/CallLog/tests/all_tests.php
? HRTRL/includes/CallLog/views/index.php
? HRTRL/includes/CallLog/views/styles/style.css
Run Code Online (Sandbox Code Playgroud) 我正在做一个项目.目前我有一个相当大的条件语句,它根据一些输入参数为变量赋值.所以,我有这样的事情.
if some condition
x = some value
elsif another condition
x = a different value
...
Run Code Online (Sandbox Code Playgroud)
重构这个的最佳方法是什么?我希望我最终会得到像这样的东西
x = some value if some condition || another value if another condition
Run Code Online (Sandbox Code Playgroud)
有这种事情的模式吗?
尝试从生产仓库克隆时出现以下错误.
abort: index data/HR3/globals.php.i is corrupted!
Run Code Online (Sandbox Code Playgroud)
之后mercurial迅速放弃我并且无法克隆.我已经尝试从生产仓库中删除有问题的文件,但失败了.我还尝试删除生产仓库中的.hg目录,然后重新添加并提交所有文件.这会产生相同的错误.
只是fyi,我正在尝试将我们应用程序的当前生产副本克隆到我们的测试服务器.我们的测试服务器在Virtual Box中运行.
UPDATE
我修复了这个问题,删除了globals文件,然后删除.hg目录并重新运行"hg init"和"hg add".和"hg commit".
我尝试克隆时出现内部服务器错误.以下是我使用的克隆命令.
sudo hg clone http://10.1.1.25/ www
Run Code Online (Sandbox Code Playgroud)
奇怪的是,mercurial告诉我,"真正的"网址是"10.1.1.25/HR3/index.php",这绝对不是我的mercurial存储库.我不知道为什么这样做.我检查了我的服务器日志,以下错误是Apache的问题.
[Thu Dec 16 12:25:30 2010] [error] [client 10.1.1.102] PHP Parse error: syntax error, unexpected T_STRING in /var/www/.hg/store/data/_h_r3/includes/_b_n_a_s/_b_n_a_s-_h_r_s201.php.i on line 22
Run Code Online (Sandbox Code Playgroud)
显然,clone命令导致Mercurial启动PHP,并尝试解析Mercurial数据存储中的某些东西?
解析度
我怀疑这是因为我在我的存储库的根目录中有一个index.php文件,它确实重定向.如果您尝试直接导航到我们网络上的http:10.1.1.25,您将自动定向到索引页面,该页面不是根目录中的index.php页面.不知怎的,我认为这导致php开始尝试解析mercurial商店中的项目.我通过克隆ssh解决了这个问题.
我写了一个小程序来做广义的凯撒密码.我无法弄清楚为什么我的强力解密功能无效.我所要做的就是尝试每个可能的乘数和偏移小于26的组合.另外,如果任何人都可以为"tryallcombinations"函数提出更好的方法,那将是值得赞赏的.
import Data.Char
caesarencipher::Int->Int->String->String
caesarencipher r s p = map chr $ map encipher plaintext
where
plaintext = map (\x->(ord x) - 97) p
encipher p = (mod (r*p + s) 26) + 97
caesardecipher::Int->Int->String->String
caesardecipher r s c = map chr $ map decipher ciphertext
where
ciphertext = map (\x->(ord x) - 97) c
inverser x | mod (r * x) 26 == 1 = x
| otherwise = inverser (x + 1)
decipher c = (mod ((inverser 1) …Run Code Online (Sandbox Code Playgroud) 我刚下载了一个intializr生成的Bootstrap版本.我还安装了SimpLESS,以避免不得不手动重新编译我的LESS文件并避免使用浏览器内编译器.但是,SimpLESS拒绝在我的目录中编译非常基本的style.css文件.它吐了:
Result of expresiin style.less on 'e.message' [undefined] is not an object.
Run Code Online (Sandbox Code Playgroud)
注意:"表达式"确实拼写为上面显示的方式.
我的style.less文件目前看起来像这样:
@import "bootstrap/bootstrap.less";
body {
padding-top: 60px;
padding-bottom: 40px;
}
@import "bootstrap/responsive.less";
Run Code Online (Sandbox Code Playgroud)