我正在使用有角度的ui路由器进行我的前端路由,我似乎无法通过浏览器的后退按钮将我带到最新的URL.
让我来证明一下.
让我们说我从这里开始
/#/myapp/
Run Code Online (Sandbox Code Playgroud)
经过一些点击后,我动态调整了我的网址
/#/myapp/12345
Run Code Online (Sandbox Code Playgroud)
假设我在页面上保留时单击一个日期选择器
/#/myapp/12345?start=2016-01-21&end=2016-01-28
Run Code Online (Sandbox Code Playgroud)
我可以通过使用$ scope'd函数与$ location.url一起完成此操作
真棒.到现在为止还挺好.
假设我通过点击导航远离此
<a href="#"> My App </a>
Run Code Online (Sandbox Code Playgroud)
其中,由于我设置路由的方式
myApp.config([
'$stateProvider', '$urlRouterProvider',
function($stateProvider, $urlRouterProvider) {
$stateProvider.state('myapp',
url : '/myapp/*id?start&end',
templateUrl : '<path to my template>',
controller : '<name of my controller>'
);
// more routes
$urlRouterProvider.otherwise('/myapp/');
}
]);
Run Code Online (Sandbox Code Playgroud)
将默认返回初始状态
/#/myapp
Run Code Online (Sandbox Code Playgroud)
好的,到目前为止,还是那么好.但是,当我点击浏览器的后退按钮时,我会被带回去
/#/myapp
Run Code Online (Sandbox Code Playgroud)
而不是我期望的
/#/myapp/12345?start=2016-01-21&end=2016-01-28
Run Code Online (Sandbox Code Playgroud)
我只能猜测我在浏览页面时生成的中间网址没有被浏览器的历史记录捕获...我认为这是合理的.如何让我的浏览器识别这些中间步骤,以便我可以正确回溯?
我在html中有一个包含下拉菜单的表单
<form name= "gadget_selector">
<select name= "gadget">
<option value = 0> Something </option>
<option value = 1> Something else </option>
//etc..
</select>
</form>
Run Code Online (Sandbox Code Playgroud)
我想在javascript函数中访问所选选项的值,如此
function someFunction(){
//var option = value of selected menu option
}
Run Code Online (Sandbox Code Playgroud)
我该怎么做?
我已经安装了Syntastic with Pathogen,并尝试了几乎所有我能想到的让Syntastic识别我的pylint检查器.
Pylint检查器安装在这里
/home/myself/.local/bin/pylint
Run Code Online (Sandbox Code Playgroud)
我回应了我的道路
/home/myself/.local/bin
Run Code Online (Sandbox Code Playgroud)
确实在$ PATH变量中.
我的.vimrc看起来像这样
set tabstop=4
execute pathogen#infect()
syntax on
filetype plugin indent on
let g:syntastic_mode_map = { 'mode': 'passive',
\ 'active_filetypes': ['python'],
\ 'passive_filetypes': ['perl'] }
let g:syntastic_python_checkers = ['pylint', 'python']
Run Code Online (Sandbox Code Playgroud)
但是当我运行命令时
SyntasticInfo
Run Code Online (Sandbox Code Playgroud)
在vim内部,我仍然看到
Syntastic: passive mode enabled
Syntastic version: 3.4.0-79
Info for filetype:
Available checker(s):
Currently enabled checker(s):
Run Code Online (Sandbox Code Playgroud)
花了很多时间搜索谷歌这个,有没有人知道我忘记了什么?
EDIT/ANSWER:如果其他人需要这样的帮助,那就行了
:setfiletype python
Run Code Online (Sandbox Code Playgroud)
似乎把事情做对了.
有没有人知道如何使用perl作为密钥的字符串对进行散列?
就像是...
{
($key1, $key2) => $value1;
($key1, $key3) => $value2;
($key2, $key3) => $value3;
Run Code Online (Sandbox Code Playgroud)
等等....
我有一个角度2应用程序在firefox和chrome内部工作,而不是内部(叹气)IE.基于我的堆栈跟踪,看起来我的System js设置存在问题.
以下是我在Web控制台中看到的错误说明.
Error: (SystemJS) Syntax error
SyntaxError: Syntax error
at ZoneDelegate.prototype.invoke (http://localhost:8050/node_modules/zone.js/dist/zone.js:230:13)
at Zone.prototype.run (http://localhost:8050/node_modules/zone.js/dist/zone.js:114:17)
at Anonymous function (http://localhost:8050/node_modules/zone.js/dist/zone.js:502:17)
Evaluating http://localhost:8050/app/app.module.js
Error loading http://localhost:8050/app/app.module.js as "./app.module" from http://localhost:8050/app/main.js
Run Code Online (Sandbox Code Playgroud)
看起来好像找不到我的
app/app.module.js
Run Code Online (Sandbox Code Playgroud)
但正如我所说,我没有使用firefox和chrome这个问题.
我在网上看了一下,发现了一些关于polyfill shims的东西..所以我尝试在index.html中包含以下内容
<script src="/node_modules/core-js/client/shim.min.js"></script>
<script src="/node_modules/systemjs/dist/system-polyfills.src.js"></script>
Run Code Online (Sandbox Code Playgroud)
我希望这可以快速修复,但看起来并非如此.有没有人对如何从这一点着手进行任何推荐?
编辑:
我发现了一个404,我进入IE 11 Web控制台.
看起来请求正在尝试命中
URL Protocol Method Result Type Received Taken Initiator Wait?? Start?? Request?? Response?? Cache read?? Gap??
/node_modules/systemjs/dist/Promise.js.map HTTP GET 404 text/html 210 B 16 ms XMLHttpRequest 140 0 16 0 0 5266
Run Code Online (Sandbox Code Playgroud)
或者在systemjs文件夹中的Promise.js.map,我没有它.
所以,一些新的问题
1)为什么在我尝试过的其他浏览器中没有提出/不要求此请求?
2)这个文件做了什么,我从哪里得到它?我仍然不确定在抓住这个之后我的语法错误是否会清楚,但它似乎是一个合理的起点.
我也注意到删除/评论后 …
我正在使用elasticsearch python 客户端对我们托管的elasticsearch 实例进行一些查询。
我注意到有些字符需要转义。具体来说,这些...
+ - && || ! ( ) { } [ ] ^ " ~ * ? : \
Run Code Online (Sandbox Code Playgroud)
除了我已经想到的之外,还有一种干净的方法可以做到这一点吗?当然有比这样做更干净的方法
term
.replace("+", "\+")
.replace("-", "\-")
# ....etc
Run Code Online (Sandbox Code Playgroud)
我希望有一个可以使用的 API 调用,但我在文档中找不到。这似乎是一个很常见的问题,应该由某人来解决。
有谁知道这样做的“正确”方法?
编辑:我仍然不确定是否有 API 调用,但我得到的东西足够简洁,足以让我满意。
def needs_escaping(character):
escape_chars = {
'\\' : True, '+' : True, '-' : True, '!' : True,
'(' : True, ')' : True, ':' : True, '^' : True,
'[' : True, ']': True, '\"' : True, '{' …Run Code Online (Sandbox Code Playgroud) 我正在使用log4j对我的一个应用程序进行一些日志记录。我的配置中的记录器看起来像这样。
<Root level="info">
<AppenderRef ref="Console"/>
</Root>
<Logger name="org.eclipse.jetty.server.Server" level="warn" additivity="false">
<AppenderRef ref="Console"></AppenderRef>
</Logger>
<Logger name="org.eclipse.jetty.util.log" level="warn" additivity="false">
<AppenderRef ref="Console"></AppenderRef>
</Logger>
<Logger name="org.eclipse.jetty.server.ServerConnector" level="warn" additivity="false">
<AppenderRef ref="Console"></AppenderRef>
</Logger>
Run Code Online (Sandbox Code Playgroud)
基本上,我希望从我编写的代码中获得“信息”级消息,但是我希望外部库仅在警告或更严重的情况下记录日志。
正如我所料,这正在工作,但是“ org.eclipse.jetty”下有很多类
有可能做这样的事情吗?
<Logger name="org.eclipse.jetty.*" level="warn">
<AppenderRef ref="Console" level="warn"></AppenderRef>
</Logger>
Run Code Online (Sandbox Code Playgroud)
也就是说,我希望整个程序包中的所有内容仅发出警告/错误/致命信息。
我尝试了上面,但没有效果。是否有“通配符”或我可以用来为软件包中的所有内容设置记录器的东西?
在多播的上下文中,接收消息的进程和传递消息的进程之间有什么区别?
我正在使用角度ui路由器来处理前端的某些路由。这就是我的路由代码的样子。
// angular config
$stateProvider.state('app', {
templateUrl: '/static/partials/home.html',
controller: 'NavCtrl'
});
$stateProvider.state('app.reader', {
url : '/reader/*path?start&end&column&page',
templateUrl: '/static/partials/reader.html',
resolve : {
panelContent : [
'$state', '$stateParams', '$http',
function ($state, $stateParams, $http) {
alert('resolving panel Content');
return []; // simplest thing possible to illustrate my point
}
]
},
controller: 'ReaderCtrl'
});
/// etc etc
$urlRouterProvider.otherwise('/reader/');
Run Code Online (Sandbox Code Playgroud)
我的html使用了多个嵌套视图,我会尽力说明
index.html
<html>
<div ui-view></div> <!-- /static/partials/home.html gets injected here -->
</html>
Run Code Online (Sandbox Code Playgroud)
/static/home.html
<html>
<!-- some side bar stuff -->
<!-- reader --> …Run Code Online (Sandbox Code Playgroud) 我正在努力使自己陷入grpc认证的困境。从示例的外观来看,grpc似乎支持ssl / tls和Google令牌...
我还查看了json网络令牌作为身份验证的一种方法。
我不确定这是否是正确的思考方式,但是如何将JWT与grpc结合使用?
JWT是与oauth2示例一起使用的“令牌”吗?
它与正在打开的“ roots.pem”文件有关吗?
我觉得我对身份验证/令牌了解得很少。我尝试搜索涉及grpc和JWT的python示例,这几乎是徒劳的。
我在想这个错误的方式吗?
javascript ×3
angularjs ×2
python ×2
angular ×1
back ×1
browser ×1
definition ×1
difference ×1
escaping ×1
grpc ×1
hash ×1
html ×1
java ×1
jwt ×1
list ×1
log-level ×1
log4j2 ×1
logging ×1
lucene ×1
multicast ×1
nested-views ×1
path ×1
perl ×1
polyfills ×1
pylint ×1
replace ×1
routing ×1
syntastic ×1
systemjs ×1
token ×1
url-routing ×1
vim ×1
wildcard ×1