我试过谷歌搜索,我还没有找到答案我的问题.
我试图通过rails运行一个简单的控制器脚本,当我到达页面时它给了我这个错误.
ExecJS::RuntimeError in Say#hello
Run Code Online (Sandbox Code Playgroud)
显然Say是控制器,hello是方法.在页面的下方,我会获得有关错误的更多信息.
dyld: unknown required load command 0x80000022
(in /Users/JoeMoe/Sites/demoRails/app/assets/javascripts/say.js.coffee)
Run Code Online (Sandbox Code Playgroud)
我已经检查了这个文件,除了注释代码之外没有任何内容.那里应该有什么东西吗?
这是say.js.coffee文件中的内容
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
Run Code Online (Sandbox Code Playgroud)
在页面下面我看到我可以做一个显示我的应用程序跟踪.
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__169683399_21885150'
Run Code Online (Sandbox Code Playgroud)
我也可以做框架跟踪.顺便说一句,这将是一个很长的清单.
execjs (1.2.9) lib/execjs/external_runtime.rb:129:in `exec_runtime'
execjs (1.2.9) lib/execjs/external_runtime.rb:27:in `block in exec'
execjs (1.2.9) lib/execjs/external_runtime.rb:40:in `compile_to_tempfile'
execjs (1.2.9) lib/execjs/external_runtime.rb:26:in `exec'
execjs (1.2.9) lib/execjs/external_runtime.rb:18:in `eval'
execjs (1.2.9) lib/execjs/external_runtime.rb:32:in `call'
coffee-script (2.2.0) …Run Code Online (Sandbox Code Playgroud) 我试图从我的网站下载一个apk文件,它适用于每个Android手机(下载和安装).我在Galaxy Tab 3上尝试了这个,但它无法下载文件.它显示它的下载但它永远停留在进度条上,永远不会下载.它失败了这些浏览器:
我尝试使用Firefox和Firefox工作.它已成功下载,之后我成功安装了它.所以它确实有效(加上它在我测试的手机上工作)
我想也许它与mimetype有关,所以我检查了它,同时检查标题Content-Type我发现它是"application/vnd.android.package-archive".这是根据维基百科的哑剧类型
因此,为了安全措施,我将其添加到我的htaccess文件中
AddType application/vnd.android.package-archive .apk
Run Code Online (Sandbox Code Playgroud)
它仍然失败了.
然后我在以下测试站点url上尝试了这个测试,我能够在所有浏览器上下载它.
http://misc.commonsware.com/Now-debug.apk
所以我认为可能是因为我们的网站是https,这可能是问题所在.我再次使用" http://misc.commonsware.com/Now-debug.apk "网址测试相同的浏览器,但这次在https下除外.它的功能与我们网站上的完全相同.除Firefox之外的所有浏览器都无法下载.他们只是说下载但没有下载.
现在我假设可能这个测试站点没有设置SSL开始(我不知道因为我没有设置服务器)所以这就是为什么它在大多数平板电脑浏览器上失败了.是否有一些奇怪的SSL设置可能会对某些平板电脑浏览器超级挑剔?或者大多数平板电脑浏览器只是糟透了,我必须处理它?我真的不明白为什么在平板电脑上除了主要的浏览器之外的任何浏览器上下载这个apk文件(除了Firefox,仍然有效)
更新
我手机上的Firefox浏览器也没有下载该应用程序.所以我在Galaxy Tab 3上的Chrome浏览器没有下载,但它在我的手机Nexus 5上工作.Firefox在Galaxy Tab 3上下载,但在我的Nexus 5上没有.
我在桌面上设置了远程开发人员工具并连接到我的手机以获取更多信息.我的firefox浏览器向url请求下载并接收正确的内容类型application/vnd.android.package-archive.
所以我决定创建一个强制内容类型的脚本,application/octet-stream并通过php脚本下载它.我设法让我的Nexus 5 Firefox浏览器工作,然而,所有Galaxy Tab 3浏览器仍无效.这是一个非常小的突破,但也许暗示问题可能是什么.
我尝试使用该exec包运行mv命令时收到错误.
这是我想要做的一个例子:
cmd := exec.Command("mv", "./source-dir/*", "./dest-dir")
output, err := cmd.CombinedOutput()
cmd.Run()
Run Code Online (Sandbox Code Playgroud)
错误返回以下内容
exit status 1
输出返回此 mv: rename ./source-dir/* to ./dest-dir/*: No such file or directory
当我改变这一行时,我实际上可以让脚本工作:
cmd := exec.Command("mv", "./source-dir/*", "./dest-dir")
以下内容:
cmd := exec.Command("mv", "./source-dir/file.txt", "./dest-dir")
该命令工作并成功移动文件,但使用通配符不起作用.似乎星号未在命令中用作通配符.这是为什么?还有另一种在GO中使用通配符的方法吗?如果没有那么我怎么能递归地将所有文件从?移动source-dir到dest-dir?
谢谢
我正在把这头发拉出来.我正在使用CodeIgniters分页库,现在它总是停留在第1页作为当前页面.我检查了一堆StackOverflow问题,我没有和其他任何人一样的问题.
这是我的网址结构
website.com/leaders/page/[page_number]
Run Code Online (Sandbox Code Playgroud)
这是我的控制器中的分页代码
$this->load->library('pagination');
$config['per_page'] = $query_config['limit'];
$config['base_url'] = base_url() . 'leaders/page/';
$config['total_rows'] = 2000; // I actually use a function for this number
$config['full_tag_open'] = '<div id="paginate">';
$config['full_tag_close'] = '</div>';
$config['first_link'] = '« First';
$config['last_link'] = 'Last »';
$config['use_page_numbers'] = true;
$config['uri_segment'] = 3;
$this->pagination->initialize($config);
Run Code Online (Sandbox Code Playgroud)
当我在视图中回应分页时,它看起来像是有效的.每个链接上的网址都是正确的,一切都很好.最后一个链接显示最后一个页面url,当前页面为1.但是当我点击页面2或分页中的任何其他页面时,它仍然将页面1显示为当前页面,即使URL如下所示
website.com/leaders/page/2
Run Code Online (Sandbox Code Playgroud)
我使用它$this->uri->segment(3)来获取数据库查询的页码,因此页码位于正确的段中.只是要仔细检查我将$config['uri_segment']值设置为1,2,3,4,5,6只是为了确保.
我写这篇文章时发现了问题,但我仍感到困惑
然后我想也许网址本身就会发生一些事情,因为我有一条路由将它指向控制器中的索引方法.这是我的路线文件的样子
routes.php文件
$route['leaders/page/(:num)'] = 'leaders/index';
$route['leaders/page'] = 'leaders/index';
Run Code Online (Sandbox Code Playgroud)
然后我尝试为分页配置设置base_url,将其直接发送到索引,如下所示:
$config['base_url'] = base_url . 'leaders/index';
Run Code Online (Sandbox Code Playgroud)
现在它似乎正常工作.但是我如何使它与我之前使用的url结构一起工作呢?我认为它看起来更好,我真的不需要控制器中的方法.我的routes.php文件中是否存在冲突?
谢谢
我不知道为什么会这样,但也许有人在这里知道.我遇到了PHP method_exists()函数的问题.我传入一个对象和方法名称作为字符串,如下所示:
method_exists($question, "id")
Run Code Online (Sandbox Code Playgroud)
我对它做了一个var_dump,它说它返回false
echo var_dump(method_exists($question, "id")); // returns bool(false)
Run Code Online (Sandbox Code Playgroud)
但这是一个奇怪的部分.我用以下内容替换该行:
echo $question->id; // returns the id number
Run Code Online (Sandbox Code Playgroud)
那么如果对象方法有效,它怎么能返回false?
我在对象上做了一个var_dump,所以你可以看一看
object(stdClass)#19 (11) {
["id"]=> string(1) "4"
["question"]=> string(67) "This is a question?"
["answer_id"]=> string(1) "0"
["status"]=> string(6) "active"
["author_id"]=> string(1) "1"
["created_on"]=> string(10) "1323221575"
["last_edited"]=> string(10) "1324335140"
["order"]=> string(6) "random"
["answer_position"]=> string(1) "1"
["first_name"]=> string(3) "Joe"
["last_name"]=> string(8) "McMurray" }
Run Code Online (Sandbox Code Playgroud)
你可以马上看到第一个名为"id"的.那为什么它会返回假?
谢谢