我在这里经历了一些奇怪的事情,我不记得曾经遇到过.我正在对我的服务器(codeigniter后端)执行正常的$ .ajax调用,如果找不到某个资源,我将返回一些错误消息以及404标头.jQuery识别出发生了错误并运行了正确的错误回调.问题是它也会在浏览器中抛出一个js异常,因此firebug会抱怨(或浏览器可能使用的任何js控制台).这是一种新行为吗?我不记得jquery在返回404标头时抛出一个js错误.相关代码如下:
$.extend({
gallery: function (url, data) {
//send a request to an arbitrary url with some data. Expects to
//get json returned.
return $.ajax(State.url + url, $.extend({
dataType: 'json',
type: 'post'
}, data));
}
});
Run Code Online (Sandbox Code Playgroud)
以上是我在我的应用程序中使用的全局ajax函数.我在该函数中尝试过各种各样的错误函数,但无济于事,我总是在firebug中抛出一个js错误.有任何想法吗?我得到的实际js错误是:
NetworkError: 404 Not Found
Run Code Online (Sandbox Code Playgroud) 我有一个内部网络应用程序,我的公司使用谷歌认证系统登录.它在大多数情况下运行良好,他们可以通过谷歌进行身份验证,同意我的应用程序访问基本用户详细信息,然后当它们返回到我的应用程序时,我确实可以获得他们的用户详细信息.
问题在于,我认为一旦他们同意,他们就不必每次都这样做.这是一个不正确的假设吗?就像现在一样,每次他们点击"使用谷歌登录"时,他们必须同意而不是重定向回我的应用程序.
我正在使用PHP(codeigniter)和在github上发现的非常好的Oauth lib(phil sturgeon的库的叉子).是否有一些我应该通过的参数,以便用户在第一次之后不必每次都给予同意?
我的应用程序有以下需要js设置:
app.js
require.config({
paths: {
jquery: '../thirdparty/jquery-1.9.1.min',
moment: '../thirdparty/moment',
spinningwheel: '../thirdparty/datepicker/spinningwheel',
handlebars: '../thirdparty/handlebars',
colorgenerator: '../usercolors',
baseconfig: '../config' },
shim: {
'baseconfig': [],
'spinningwheel': {
deps: [],
exports: 'SpinningWheel'
},
'handlebars': {
deps: [],
exports: 'Handlebars'
}
}
});
require(['jquery', 'dom', 'helpers', 'actions', 'history', 'store'], function ($, dom, helpers, actions, hist, store) {
//all good on the home front at this point
//all modules loaded properly
history.render();
})
Run Code Online (Sandbox Code Playgroud)
history.js
define(['renderview'], function (renderview) {
//all good here, render view is loaded properly …Run Code Online (Sandbox Code Playgroud) 我正在使用grunt,我想按特定顺序连接某个目录中的所有js文件(它是一个角度js应用程序,所以我想首先执行我的模块定义,然后是其他所有内容).我的grunt concat目标看起来像:
concat: {
mobile: {
expand: true,
cwd: "static/javascript/mobile/app/",
src: ["main-module.js", "**/*-module.js", "**/*.js", "!static/javascript/mobile/dist/*"],
dest: "static/javascript/mobile/app/dist/ngmobile.concat.js"
}
}
Run Code Online (Sandbox Code Playgroud)
上面的配置好像应该连接main-module.js,然后是所有其他module.js文件,然后是其他所有内容,省略dist文件夹中的所有内容.但是,当使用--verbose运行grunt时,结果如下:
Running "concat:mobile" (concat) task
Verifying property concat.mobile exists in config...OK
Files: static/javascript/mobile/app/main-module.js -> static/javascript/mobile/app/dist/ngmobile.concat.js/main-module.js
Files: static/javascript/mobile/app/clients/clients-module.js -> static/javascript/mobile/app/dist/ngmobile.concat.js/clients/clients-module.js
Files: static/javascript/mobile/app/reports/reports-module.js -> static/javascript/mobile/app/dist/ngmobile.concat.js/reports/reports-module.js
Files: static/javascript/mobile/app/schedules/schedules-module.js -> static/javascript/mobile/app/dist/ngmobile.concat.js/schedules/schedules-module.js
Files: static/javascript/mobile/app/services/services-module.js -> static/javascript/mobile/app/dist/ngmobile.concat.js/services/services-module.js
Files: static/javascript/mobile/app/clients/addclient-ctrl.js -> static/javascript/mobile/app/dist/ngmobile.concat.js/clients/addclient-ctrl.js
Files: static/javascript/mobile/app/clients/clientprofile-ctrl.js -> static/javascript/mobile/app/dist/ngmobile.concat.js/clients/clientprofile-ctrl.js
Files: static/javascript/mobile/app/clients/clients-ctrl.js -> static/javascript/mobile/app/dist/ngmobile.concat.js/clients/clients-ctrl.js
Files: static/javascript/mobile/app/clients/clients-service.js -> static/javascript/mobile/app/dist/ngmobile.concat.js/clients/clients-service.js
Files: static/javascript/mobile/app/common/directives.js -> static/javascript/mobile/app/dist/ngmobile.concat.js/common/directives.js
Files: static/javascript/mobile/app/common/filters.js -> static/javascript/mobile/app/dist/ngmobile.concat.js/common/filters.js
Files: static/javascript/mobile/app/common/header-ctrl.js -> static/javascript/mobile/app/dist/ngmobile.concat.js/common/header-ctrl.js …Run Code Online (Sandbox Code Playgroud) 在尝试使用简单的hasOne关系更新模型时,我今天遇到了一个有趣的问题.我正在做以下事情:
public function update(MyRequest $request, $id)
{
$project = Project::find($id);
$data = $request->all(); //has a client_id
$project->update($data);
return $project->client; //Project model holds this hasOne relationship
}
Run Code Online (Sandbox Code Playgroud)
问题是$project->client从update函数返回的仍然是客户端的旧版本.不应该$project->update(...)刷新那些关系吗?我们现在正在使用的代码是:
public function update(MyRequest $request, $id)
{
$project = Project::find($id);
$data = $request->all(); //has a client_id
$client = Client::find($data['client_id']);
$project->update($data);
$project->client()->associate($client);
return $project->client; //Project model holds this hasOne relationship
}
Run Code Online (Sandbox Code Playgroud)
在这一点上,我们都很好.那么,该函数的更高版本是否正确的方法(IE获得客户端对象的刷新版本)?
我正在通过Ansible设置UFW规则.我能够安装它,启动它并拒绝一切.然后我尝试允许来自http,https和ssh的连接.所有为这些项添加允许的尝试都会遇到如下错误:
failed: [lempy1] (item={u'service': u'http'}) => {"failed": true, "item": {"service": "http"}, "msg": "ERROR: Could not find a profile matching 'http'\n"}
failed: [lempy1] (item={u'service': u'https'}) => {"failed": true, "item": {"service": "https"}, "msg": "ERROR: Could not find a profile matching 'https'\n"}
failed: [lempy1] (item={u'service': u'ssh'}) => {"failed": true, "item": {"service": "ssh"}, "msg": "ERROR: Could not find a profile matching 'ssh'\n"}
Run Code Online (Sandbox Code Playgroud)
整个角色如下所示:
---
- name: Install ufw
apt: name=ufw state=present
tags:
- security
- name: Allow webservery things
ufw:
rule: allow …Run Code Online (Sandbox Code Playgroud) 我看到的问题是当我执行以下操作时,鼠标悬停事件似乎没有泡沫:
<div data-bind='events: {mouseover: someFunc, mouseout: someOtherFunc}'>
<div data-bind='text: someText'></div>
</div>
Run Code Online (Sandbox Code Playgroud)
我所看到的是当我最初悬停时,someFunc函数触发(我正在使用这些函数来应用类来获得悬停效果).但是,当我的光标进入内部div时,我的mouseout函数会触发,即使mouseover事件应该从内部div传递到外部div.
这个小提琴演示了这个问题:http: //jsfiddle.net/cSBcC/1/
在小提琴中,只需尝试鼠标悬停在各种li上,当光标进入内部div时,"hover"类被删除,即使我们仍然在鼠标悬停在li上.
有任何想法吗?
javascript ×2
amd ×1
angularjs ×1
ansible ×1
codeigniter ×1
eloquent ×1
google-oauth ×1
gruntjs ×1
jquery ×1
knockout.js ×1
laravel-5 ×1
login ×1
model ×1
oauth-2.0 ×1
php ×1
requirejs ×1
ufw ×1