小编Dav*_*vit的帖子

路由错误 - 未初始化的常量

我无法在Rails 3.2.12中解决这个问题,也许我错过了一些东西.

配置/ routes.rb中

get "home/index"
root :to => "home#index"
devise_for :users, :only => :omniauth_callbacks
match 'users/auth/:provider/callback' => 'authentications#create'
match '/auth/:provider/signout' => 'authentications#signout'
Run Code Online (Sandbox Code Playgroud)

应用程序/控制器/ authentication_controller.rb

class AuthenticationsController < ApplicationController
  ...
end
Run Code Online (Sandbox Code Playgroud)

应用程序/模型/ authentication.rb

class Authentication < ActiveRecord::Base
  ...
end
Run Code Online (Sandbox Code Playgroud)

我认为它应该符合我目前的知识,但有些东西我想念.

我的问题是告诉我有什么问题.

计数错误

uninitialized constant AuthenticationsController

这是一条显示在的消息 http://localhost:3000/auth/facebook/signout

ruby ruby-on-rails rails-routing

32
推荐指数
2
解决办法
5万
查看次数

如何在RubyMine中更改过去的git commit + push消息?

我不小心给出了错误的消息并使用RubyMine推送了它.有什么方法可以纠正吗?RubyMine方式最好不要搞砸git,但其他值得信赖的方式也是受欢迎的.

git bitbucket rubymine

10
推荐指数
1
解决办法
2万
查看次数

如何突出显示输入字段中的文本?

开发一个应用程序,我必须突出显示输入的字符input[type=text].字符可以spacestabs太.这是我不想为文本赋予颜色的原因,而是背景颜色,以便我的用户知道在元素内部写了一些东西.

我没有什么可以帮助你回答,但是我想要实现的手工制作的图片以及一个jsfiddle链接,我将与那些不介意帮助我实现免费目标的人一起尝试.

我想通过我的问题实现的目标

html css css3

10
推荐指数
1
解决办法
5982
查看次数

使用重写引擎时正确编码URL

我正在使用从Akelos Framework中提取的mod_rewrite和路由系统.

在搜索关键参数中使用某些符号时,我遇到了一个非常大的问题.

路由映射如下:

$map->connect(":lang/search/:string", array('controller' => 'search','action' => 'index'));
Run Code Online (Sandbox Code Playgroud)

在控制器中,我现在得到$this->registry->map['params']['get']['string']一个搜索关键字.

我找不到正确编码网址的方法.例如,让我们取一个字符串t\ /#%&=

urlencode()给出t%5C+%2F%23%25%26%3D和页面显示The requested URL /site/en/search/t\+/#%&= was not found on this server.

rawurlencode()给出t%5C%20%2F%23%25%26%3D和页面显示相同.

您可以在此页面上下载或查看路由器类源

我真的不想使用base64作为url和你无法阅读任何东西的编码.

如果你需要这里也是一个.htaccess文件内容:

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)

更新

这里实际上是用于进行测试的工作文件.

如果您有时间,请下载这些文件并在您的服务器上进行测试.

指南:

controllerclass.php - 简单的控制器框架,通过在其中定义类"Controller"来使searchcontroller.php工作

routerclass.php - 从Akelos Framework中提取的路由器类,可能存在bug

routes.php - 您定义路线的地方,在我们的情况下,我们只有 /search/:string

searchcontroller.php - 测试字符串的基本应用程序 - /search/stringhere指向此文件

index.php - 所有启动和路由都开始的地方

.htaccess …

php mod-rewrite url-rewriting url-routing

6
推荐指数
1
解决办法
1118
查看次数

php mysql SET NAMES'utf8'COLLATE'utf8_unicode_ci'不适用于mysqli

我正在从php mysql_*方法将我的网站迁移到php mysqli.

我有以下代码完成了这项工作:

mysql_query("SET NAMES'utf8'COLLATE'utf8_unicode_ci'");

没有这个查询我的字符串字符(格鲁吉亚语)是用问号写的.比如它写的是????????? 而不是გამარჯობა

因为它完成了它的工作我很高兴,但现在我不能用mysqli做同样的事情.

$mysqli = new mysqli("localhost", "root", "", "test");
$mysqli->query("SET NAMES 'utf8' COLLATE 'utf8_unicode_ci'");
Run Code Online (Sandbox Code Playgroud)

有人可以帮帮我吗?谢谢.

php mysqli

5
推荐指数
1
解决办法
3万
查看次数

强制通过curl或其他方法下载远程文件

我有一个远程链接,我想从中强制下载文件.现在我正在使用cURL.

我的脚本适用于此URL(因为我测试了另一个):http: //images.mob.org/iphonegame_img/rip_curl_surfing_game_live_the_search/real/1_rip_curl_surfing_game_live_the_search.jpg

但我需要它来处理这个问题:https: //googledrive.com/host/0B_3oJnpnNoF9UjlkVUwtWE5CY0U/city.jpg

这是我的PHP代码

 <?php
    $file = 'http://images.mob.org/iphonegame_img/rip_curl_surfing_game_live_the_search/real/1_rip_curl_surfing_game_live_the_search.jpg';
    download($file,2000);

    function download($file,$chunks){
        set_time_limit(0);
        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-disposition: attachment; filename='.basename($file));
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Expires: 0');
        header('Pragma: public');
        $size = get_size($file);
        header('Content-Length: '.$size);

        $i = 0;
        while($i<=$size){
            //Output the chunk
            get_chunk($file,(($i==0)?$i:$i+1),((($i+$chunks)>$size)?$size:$i+$chunks));
            $i = ($i+$chunks);
        }

    }

    //Callback function for CURLOPT_WRITEFUNCTION, This is what prints the chunk
    function chunk($ch, $str) {
        print($str);
        return strlen($str);
    }

    //Function to get a range of bytes from the remote …
Run Code Online (Sandbox Code Playgroud)

php

2
推荐指数
1
解决办法
1万
查看次数

jquery关闭统一插件

Uniform是一个用于样式表单的jQuery插件.在我的应用程序中,我正在使用它,我必须关闭制服并再次打开它,我的意思是我需要重新启动它.

要在以下某些表单元素上打开uniform的功能 $("select, input, button, textarea").uniform();

现在我需要关闭它,我的意思是我希望有一个功能来回滚并恢复旧的外观.

可以吗?谢谢.

javascript jquery uniform

1
推荐指数
1
解决办法
2572
查看次数

真正的多类继承,而不是通过特征的方法集合

我理解你extend的课程方式ChildClass extends ParentClass,我理解使用class abstractioninterfaces,我明白traits

在我阅读的文章中,大多数人都表示在实践中使用traits来实现多功能继承,而这种继承不是由extends功能完成的,因为它只支持单个扩展.

据我所知,它更像是一组函数,可以被不同的类或其他特征使用.

在这个问题中,我请你告诉我如何正确地完成多个类的扩展,而不是添加一些函数集合.

php

0
推荐指数
1
解决办法
25
查看次数