我正在尝试使用OutputCache属性在ASP.NET MVC 4中实现缓存.
这是我的控制器动作:
[HttpGet]
[OutputCache(Duration = CACHE_DURATION, VaryByCustom = "$LanguageCode;myParam", Location = OutputCacheLocation.Server)]
public JsonResult MyAction(string myParam)
{
// this is called also if should be cached!
}
Run Code Online (Sandbox Code Playgroud)
这是Global.asax中的GetVaryByCustomString:
public override string GetVaryByCustomString(HttpContext context, string arg)
{
var pars = arg.Split(';');
if (pars.Length == 0) return string.Empty;
var res = new System.Text.StringBuilder();
foreach (var s in pars)
{
switch (s)
{
case "$LanguageCode":
var culture = CultureManager.GetCurrentCulture();
res.Append(culture.Name);
break;
default:
var par = context.Request[s];
if (par != null)
res.AppendFormat(par); …Run Code Online (Sandbox Code Playgroud) 当我在包含JQuery UI Dialog小部件的网页中使用HERE Maps API时,我遇到了问题.Chrome浏览器中出现此问题.打开和关闭"对话框"小部件后,如果我尝试缩放或平移,则无法正确刷新地图,并且控制台显示以下错误:
Coroutine 'nokia.maps.map.render.p2d.Engine#_renderCo' aborted abnormally with exception base.js:159
TypeError: undefined is not a function base.js:159
Run Code Online (Sandbox Code Playgroud)
我也在Safari浏览器中收到此错误.这适用于Firefox或Internet Explorer没有任何错误.此错误发生在HERE API的2.5.4版本中,但与之前的版本2.5.3不同.
以下网页显示了Chrome浏览器中的问题:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>HERE map with JQuery UI dialog</title>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css">
</head>
<body>
<div><button id="bOpenDialog">open dialog</button></div>
<div id="mapContainer" style="width:400px;height:250px;"></div>
<div id="dialog" title="Test dialog">
<p>Dialog content.</p>
</div>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://js.api.here.com/se/2.5.4/jsl.js?with=maps"></script>
<script>
nokia.Settings.set("app_id", "APP_ID");
nokia.Settings.set("app_code", "APP_CODE");
$(document).ready(function() {
$('#bOpenDialog').click(function(){
$("#dialog").dialog("open");
});
$("#dialog").dialog({
height: 140,
modal: true,
autoOpen:false
});
var map …Run Code Online (Sandbox Code Playgroud) 我正在使用Google Charts API创建计量表.这是一个非常简单有效的API,可以即时创建图表.
这是该图表的文档
https://google-developers.appspot.com/chart/interactive/docs/gallery/gauge
现在,我需要自定义一个小图,这个图表添加的不仅仅是一个绿色区域.例如,我需要一个绿色区域,从0到10,一个从20到30,另一个从40到50,但似乎不可能.
以下是传递给draw()方法以设置绿色区域的选项
var options = {
greenFrom: 0, greenTo: 10
};
Run Code Online (Sandbox Code Playgroud)
我试图传递一个数组作为一个选项,但它显然不起作用.这是我试过的.
var options = {
greenFrom: [0, 20, 40], greenTo: [10, 30, 50]
};
Run Code Online (Sandbox Code Playgroud)
有人有同样的问题吗?
任何帮助都是适用的.
谢谢
javascript ×2
asp.net ×1
asp.net-mvc ×1
c# ×1
gauge ×1
here-api ×1
jquery-ui ×1
outputcache ×1