小编Nor*_*Cat的帖子

Laravel 5 Auth Logout不会破坏会话

我正在使用Laravel5 Auth系统进行我的新项目,我能够使用注册和登录功能,但没有按预期工作,但是注册不能正常工作,但是我被重定向到指定的url,$redirectAfterLogout但它不会破坏会话,所以即使在点击之后注销按钮我能看到仪表板.

laravel在Auth系统中有一些错误,请建议,谢谢

php laravel

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

无法使用class = pull-right或float:right浮动twitter bootstrap导航栏项目

我正在使用Twitter引导程序和Rails,我似乎无法将导航栏项目浮动到右侧.

我试过用这样的东西:

<li class="whoami pull-right"> <%= link_to ("Logged in as: " + current_user.name), edit_user_registration_path , :id=>"Edit account"%> </li>
Run Code Online (Sandbox Code Playgroud)

......但是链接保持不变,萤火虫显示出来了 "float:left;"

所以我试图将css浮在里面bootstrap_and_overrides.css.less和里面home.html.erb,但都没有奏效.Firebug表示它发现了两个css float语句,但选择了bootstrap选项.所以我被困住了,想知道如何自定义导航栏.我可能在这里做错了,但我只是没有看到它.

这是我的代码:

application.html.erb:

<!DOCTYPE html>
<html>
  <head>
  ... removed to shorten the length of this post
  </head>
  <body>
    <header>
          <%= render 'layouts/navigation' %>
    </header>
    <div id="main" role="main">
      <div class="container">
        <div class="content">
           <div class="row">
            <div class="span12">
              <%= render 'layouts/messages' %>
              <%= yield %>
            </div>
          </div>
          <footer>
          </footer>
        </div>
      </div> <!--! end of .container -->
    </div> <!--! …
Run Code Online (Sandbox Code Playgroud)

css formatting firebug ruby-on-rails twitter-bootstrap

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

如何向多个收件人发送邮件?

我在使用Gmail API向多个地址发送邮件时遇到问题.我已经成功地只向一个地址发送了一条消息,但是当我在'To'字段中包含多个以逗号分隔的地址时,会收到以下错误:

发生错误:https: //www.googleapis.com/gmail/v1/users/me/messages/send ?alt = json 返回"标题无效">

我正在使用此Gmail API指南中的CreateMessageSendMessage方法:https: //developers.google.com/gmail/api/guides/sending

该指南指出Gmail API需要符合RFC-2822的邮件.我再次使用RFC-2822指南中的一些寻址示例没有太多运气:https: //tools.ietf.org/html/rfc2822#appendix-A

我的印象是'mary @ x.test,jdoe @ example.org,one @ y.test'应该是一个有效的字符串,以传递给'to'参数CreateMessage,但是我收到的错误SendMessage引导我否则相信.

如果您可以重新创建此问题,或者您对我可能犯错误的地方有任何建议,请告诉我.谢谢!

编辑:这是产生错误的实际代码......

def CreateMessage(sender, to, subject, message_text):
    message = MIMEText(message_text)
    message['to'] = to
    message['from'] = sender
    message['subject'] = subject
    return {'raw': base64.urlsafe_b64encode(message.as_string())}

def SendMessage(service, user_id, message):
    try:
        message = (service.users().messages().send(userId=user_id, body=message)
           .execute())
        print 'Message Id: %s' % message['id']
        return message
    except errors.HttpError, error: …
Run Code Online (Sandbox Code Playgroud)

python mime rfc2822 gmail-api

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

石英和弹簧 - 聚集但不持久?

在我的Spring应用程序中,我使用的SchedulerFactoryBean是与Quartz集成.我们将要有群集的Tomcat实例,因此我希望拥有一个集群的Quartz环境,这样相同的作业就不会在不同的Web服务器上同时运行.

为此,我的app-context.xml内容如下:

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="triggers">
        <list>
            <ref bean="cronTrigger"/>
            <ref bean="simpleTrigger" />
        </list>
    </property>
    <property name="dataSource" ref="dataSource"/>
    <property name="overwriteExistingJobs" value="true"/>
    <!-- found in applicationContext-data.xml -->
    <property name="applicationContextSchedulerContextKey" value="applicationContext"/>
    <property name="quartzProperties">
        <props>
            <prop key="org.quartz.scheduler.instanceName">SomeBatchScheduler</prop>
            <prop key="org.quartz.scheduler.instanceId">AUTO</prop>
            <prop key="org.quartz.jobStore.misfireThreshold">60000</prop>
            <!--<prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>-->
            <prop key="org.quartz.jobStore.class">org.quartz.impl.jdbcjobstore.JobStoreTX</prop>
            <prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.StdJDBCDelegate</prop>
            <prop key="org.quartz.jobStore.tablePrefix">QRTZ_</prop>
            <prop key="org.quartz.jobStore.isClustered">true</prop>
            <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
            <prop key="org.quartz.threadPool.threadCount">25</prop>
            <prop key="org.quartz.threadPool.threadPriority">5</prop>
        </props>
    </property>
</bean>
Run Code Online (Sandbox Code Playgroud)

一切都运行良好,除了当我尝试删除或更改触发器,然后重新启动我的应用程序时,旧的触发器仍然保留在数据库中,仍然运行.我不希望这样,我只是希望在app停止(或重新启动)时删除它们.我将overwriteExistingJobs属性的值设置为true,因为我认为这就是它所做的.

有任何想法吗?我只想使用数据库进行聚类,而不是任何类型的持久性.

java spring load-balancing quartz-scheduler

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

在Wordpress中上传Ajax文件 - 无法传递FormData

我创建了一个脚本,它使用$ .ajax和FormData将两个表单对象传递给PHP.一个表单对象是文本,另一个是文件.它作为一个独立的脚本运行良好.但是,在我将它添加到Wordpress后,作为一个插件,它一直在给我"Uncaught TypeError: Illegal invocation".

我不能序列化formdata,因为那时我将无法将文件传递给PHP中的回调函数.

JS在ajax调用之前涉及FormData:

var fd = new FormData();
var file = jQuery(this).find('input[type="file"]');
var caption = jQuery(this).find('input[name=img_caption]');
var individual_file = file[0].files[0];
fd.append("file", individual_file);
var individual_capt = caption.val();
fd.append("caption", individual_capt);
Run Code Online (Sandbox Code Playgroud)

以上部分是100%正确的.

Ajax调用:

jQuery.ajax({
    type: 'POST',
    url: fiuajax.ajaxurl,
    data: {
        action: 'fiu_upload_file',
        security: fiuajax.security,
        data: fd,
        contentType: false,
        processData: false,
    },
    success: function(response){
        var dataObj = jQuery.parseJSON(response);
        if(dataObj.message == 'error') {
            jQuery('.fiu_validation').html('The following error occured: '+dataObj.desc);
        }
        else if(dataObj.message == 'success') {
            jQuery('.fiu_file').val('');
        }
        console.log(response);
    }
}); …
Run Code Online (Sandbox Code Playgroud)

php ajax wordpress jquery file-upload

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

php spl_autoload_register和composer autoloader可以一起工作吗?

经过一些研究,无法找到解决问题的方法.我正在使用API​​,这是我通过composer下载的命名空间.API让它依赖于我允许作曲家为我管理和自动加载.与此分开,我有大约10个类,我已经使用php自动加载spl_autoload_register.最近,我开始混合这些类来完成一个项目的部分,整个事情已经变成了废话.我的自定义类不能使用作曲家类,反之亦然.有没有一种方法可以用来自动加载两个独立文件夹中的类,并加载两个独立的外载程序.

这是我目前使用的代码.vender/autoload.php与典型的作曲家自动加载器没有什么不同.谢谢你的帮助.

require 'vendor/autoload.php';
require 'functions/general.php';
require 'include/mailgun.php';

function my_autoloader($class) {
    require 'classes/' . $class . '.php';
}
spl_autoload_register('my_autoloader');
Run Code Online (Sandbox Code Playgroud)

php autoload autoloader spl-autoload-register composer-php

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

将bash函数转换为fish的函数

有人可以帮我把这个bash函数转换为fish吗?这也将是很好,如果你能解释一下这些不喜欢"${@%%.app}”,'s/ /.*/g’,"$@\”等.

bid() {
    local shortname location

    # combine all args as regex
    # (and remove ".app" from the end if it exists due to autocomplete)
    shortname=$(echo "${@%%.app}"|sed 's/ /.*/g')
    # if the file is a full match in apps folder, roll with it
    if [ -d "/Applications/$shortname.app" ]; then
        location="/Applications/$shortname.app"
    else # otherwise, start searching
        location=$(mdfind -onlyin /Applications -onlyin ~/Applications -onlyin /Developer/Applications 'kMDItemKind==Application'|awk -F '/' -v re="$shortname" 'tolower($NF) ~ re {print $0}'|head -n1) …
Run Code Online (Sandbox Code Playgroud)

bash shell fish

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

如何让docker容器与sshuttle一起工作?

我需要容器能够使用sshuttle工具.我尝试在主机或包含器中的任何一种方式.但它都不会起作用.这就是我需要的:我跑:sshuttle -r mysshaccount@my.remote.server --dns 0/0 在主持人.它可以通过sshuttle帮助托管应用程序访问Internet.但对于容器,它无法解析DNS请求.似乎--dns会影响容器的DNS功能.如何让容器与主机的sshuttle一起工作?

如果我在容器内运行sshuttle也是如此.似乎容器没有"--dns"sshuttle中的选项权限.

无论如何,我需要"--dns"在集装箱中使用这个选项,因为这是在中国克服政府防火墙(GFW)的唯一途径.

有人帮忙使它工作?

dns vpn docker

10
推荐指数
3
解决办法
3144
查看次数

PyQt/PySide - 图标显示

我有一个PySide应用程序,它有一个MainWindow(一个QMainWindow实例)的图标.当我正常运行文件时,图标是可见的,一切都很好但是当我创建一个exe时py2exe,图标不会出现.这种情况cx_freeze也会发生(所以我不认为这个问题py2exe).

该应用程序设计使用QtDesigner并转换为python与pyside-uic.我尝试使用图标作为文件和资源(qrc文件),两者似乎都不起作用.

任何帮助或指示将不胜感激.

谢谢.

python pyqt py2exe pyqt4 pyside

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

使用Facebook ShareLink,标记<provider>属性权限在AndroidManifest.xml中具有无效字符"{"

虽然我删除了"{}"括号但仍然会出现.

<provider
        android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider{facebook_app_id}"
        android:exported="true" />
Run Code Online (Sandbox Code Playgroud)

facebook-android-sdk facebook-share

9
推荐指数
2
解决办法
8185
查看次数