我期待在azure表存储中实现页面视图计数器.如果说两个用户同时访问该页面,并且PageViews = 100上的当前值,是否保证更新操作后PageViews = 102?
使用VS2012我从WebRole属性缓存选项卡添加了缓存功能.其中,它在web.config中生成以下XML:
<dataCacheClients>
<tracing sinkType="DiagnosticSink" traceLevel="Error" />
<dataCacheClient name="default">
<autoDiscover isEnabled="true" identifier="[cluster role name]"/>
<!-- <localCache isEnabled="true" sync="TimeoutBased" objectCount="100000" ttlValue="300" /> -->
</dataCacheClient>
</dataCacheClients>
Run Code Online (Sandbox Code Playgroud)
好,太棒了.我将[cluster role name]替换为webrole的名称,例如"helloworld.web".现在,当我创建DataCacheFactory或DataCache对象时:
_dataCacheFactory = new DataCacheFactory();
_defaultCache = _dataCacheFactory.GetDefaultCache();
//Or, just this line
_defaultCache = new DataCache(@"default");
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Microsoft.ApplicationServer.Caching.DataCacheException was unhandled
HelpLink=http://go.microsoft.com/fwlink/?LinkId=164049
HResult=-2146233088
Message=ErrorCode<ERRCA0021>:SubStatus<ES0001>:Server collection cannot be empty.
Source=Microsoft.ApplicationServer.Caching.Client
ErrorCode=21
SubStatus=-1
Some notes:
IDE: VS2012,
Framework: 4.0
AzureSDK: June2012
Local dev machine
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
编辑
我得到了它的工作!
我在WebRole OnStart方法中创建了DataCacheFactory,我将它移到了Global.asax中的Application_Start,它似乎正在工作.
Sandrino解释了为什么会出现这种情况:https://stackoverflow.com/a/11886136/1374935
I have a listview, where each row is an EditText, with some text. When I tap on a row, EditText gets the focus, displays the blinking cursor and the selection anchor (you know the blue/gray looking handles that you drag around to select a range of text).
该问题是,当我从一行移动到另一个(EditText上到另一个),没有enterting新的文本,在前面的EditText选择锚点保持了一段时间可见.如果edittext没有焦点,我想立即隐藏这个锚点.
有任何想法吗?
ClearFocus不起作用
editText.setOnFocusChangeListener(new OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus) {
} else {
editText.clearFocus();
//editText.clearComposingText();
}
}
});
Run Code Online (Sandbox Code Playgroud)
截图
