我们可以在angular2视图模板中使用枚举吗?
<div class="Dropdown" dropdownType="instrument"></div>
Run Code Online (Sandbox Code Playgroud)
传递字符串作为输入:
enum DropdownType {
instrument,
account,
currency
}
@Component({
selector: '[.Dropdown]',
})
export class Dropdown {
@Input() public set dropdownType(value: any) {
console.log(value);
};
}
Run Code Online (Sandbox Code Playgroud)
但是如何传递枚举配置?我在模板中想要这样的东西:
<div class="Dropdown" dropdownType="DropdownType.instrument"></div>
Run Code Online (Sandbox Code Playgroud)
什么是最佳做法?
编辑:创建一个例子:
import {bootstrap} from 'angular2/platform/browser';
import {Component, View, Input} from 'angular2/core';
export enum DropdownType {
instrument = 0,
account = 1,
currency = 2
}
@Component({selector: '[.Dropdown]',})
@View({template: ''})
export class Dropdown {
public dropdownTypes = DropdownType;
@Input() public set dropdownType(value: any) {console.log(`-- dropdownType: ${value}`);};
constructor() …Run Code Online (Sandbox Code Playgroud) 谷歌搜索定义要么返回面向列的数据库的结果,要么给出非常模糊的定义。
我的理解是宽列存储由列族组成,列族由行和列组成。所述系列中的每一行都一起存储在磁盘上。这听起来像是面向行的数据库存储数据的方式。这让我想到了我的第一个问题:
宽列存储与常规关系数据库表有何不同?这是我的看法:
* column family -> table
* column family column -> table column
* column family row -> table row
Run Code Online (Sandbox Code Playgroud)
这张来自Database Internals 的图片看起来就像两个普通表:
我对有什么不同的猜测来自这样一个事实,即沿边宽的列商店提到了“多维地图”。所以这是我的第二个问题:
宽列存储是否从左到右排序?意思是,在上面的例子中,行是先按Row Key,然后按Timestamp,最后按Qualifier?
我有一个正在研究的游戏,我听说UDP对于实时游戏来说是优越的.我知道socket.io使用TCP,并想知道是否有某种方法将其切换到UDP.我试过查找它,但只发现了2012年左右的帖子,其中说UDP只是在浏览器中实验性的.
我在分支和上游BitBucket存储库之间差异文件:
$ git diff origin/branchA..upstream/branchB -- some/file/path.xyz
似乎几乎每个文件都返回相同的差异:
-<U+FEFF>@using Sitecore.Mvc
+@using Sitecore.Mvc^M
Run Code Online (Sandbox Code Playgroud)
^M仅在第一行之后显示的确切含义是什么?当我比较其他文件时也看到此问题。我在Windows Server 2008 R2计算机上。core.autocrlf设置为true。.gitattributes设置为text eol=lf。我的git版本是2.5.1.windows.1。
我正在学习本教程.我cmake'd和make/make install'd glfw和glew完美(据我所知).但是,当我尝试编译示例代码时......
#define GLEW_STATIC
#include <GL/glew.h>
#include <GLFW/glfw3.h>
int main()
{
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
...使用他的链接器标志......
-lGLEW -lglfw3 -lGL -lX11 -lpthread -lXrandr -lXi
Run Code Online (Sandbox Code Playgroud)
...我收到以下错误:
/usr/bin/ld: /usr/local/lib/libglfw3.a(x11_init.c.o): undefined reference to symbol 'XF86VidModeQueryExtension'
/usr/lib/x86_64-linux-gnu/libXxf86vm.so.1: error adding symbols: DSO missing from command line
Run Code Online (Sandbox Code Playgroud)
我谷歌的错误,有人建议添加-lXxf86vm.它摆脱了最初的错误,但增加了更多:
/usr/local/lib/libglfw3.a(x11_init.c.o): In function `initExtensions':
x11_init.c:(.text+0x1b93): undefined reference to `XineramaQueryExtension'
x11_init.c:(.text+0x1bad): undefined reference to `XineramaIsActive'
/usr/local/lib/libglfw3.a(x11_init.c.o): In function `_glfwCreateCursor':
x11_init.c:(.text+0x22ee): undefined …Run Code Online (Sandbox Code Playgroud) 我想访问项目的布局定义,以便我可以访问添加到项目的渲染,然后访问附加到所述渲染的数据源.我似乎找不到办法做到这一点.我能做的最好的就是访问该__renderings字段,但后来我发现这将访问原始的渲染定义项,而不是存储在设计版面中的特定的数据源实例.
这是在Sitecore 7.5 MVC上
如果它有帮助,这就是我尝试做的事情:
// Get the default device
DeviceRecords devices = item.Database.Resources.Devices;
DeviceItem defaultDevice = devices.GetAll().Where(d => d.Name.ToLower() == "default").First();
// Get the rendering references for the default device
Sitecore.Data.Fields.LayoutField layoutField = item.Fields["__renderings"];
Sitecore.Layouts.RenderingReference[] renderings = layoutField.GetReferences(defaultDevice);
// Get the required renderings
RenderingItem headerRenderingItem = null;
RenderingItem aboutRenderingItem = null;
foreach (var rendering in renderings)
{
if (rendering.Placeholder == "headerPlaceholder")
headerRenderingItem = rendering.RenderingItem;
else if (rendering.Placeholder == "/aboutSectionPlaceholder/textPlaceholder")
aboutRenderingItem = rendering.RenderingItem;
}
Assert.IsNotNull(headerRenderingItem, "no header rendering …Run Code Online (Sandbox Code Playgroud) 我们遇到了一个问题,我们的.csproj文件直到我们才会保存Save All.这会导致问题,因为它通常不会被拉入git并在尝试构建时发送丢失的文件错误.我知道在VS 2013 2012+中,该.csproj文件应该在构建发生时保存.发布导致构建发生,因此没有理由不进行保存.
我有以下删节代码:
io.on('connection', function(client) {
client.uuid = uuid.v4();
// add client object to server...
console.log('socket.io:: client connected ' + client.uuid );
client.on('disconnect', function() {
console.log('socket.io:: client disconnected ' + client.uuid );
// remove client object from server...
});
});
Run Code Online (Sandbox Code Playgroud)
如果我在浏览器中打开此页面,一切看起来都很好。如果我刷新页面,它将触发disconnect,然后connection. 但是,如果我刷新得足够快,有时disconnect不会被调用,因此客户端数据不会从服务器中清除。有什么办法可以避免这种情况吗?
编辑:改写reconnect->connection
我需要使用自定义格式的日期(即dddd dd MMMM yyyy).是否可以将此格式传递给Sitecore().Field()?我想做这样的事情:
@Html.Sitecore().Field("Day1", new { @format="dddd dd MMMM yyyy"})
然而,经过一些谷歌搜索,我发现我要么创建一个自定义字段助手来做这个或自定义模型.使用基本Sitecore真的没办法做到这一点吗?这很重要,Sitecore().Field()因为我需要内容编辑器才能编辑值.
我们在Sitecore 7.5上
我有一个具有功能的控制器ShowEvents(EventCategory eventCategory)。是否可以从客户端 JavaScript 调用此函数?我知道我可以使用Sitecore.Services.Client (SCC)从数据库中检索项目,但是是否可以实际访问方法?也许通过控制器渲染,如果可能的话?
这是我要调用的方法的示例:
public class EventListController : Controller
{
public ActionResult ShowEvents(EventCategory eventCategory)
{
var repository = new EventListRepository();
var eventPages = repository.GetEvents(eventCategory);
var eventListViewModel = repository.GetEventListViewModel(eventPages);
return View("/Some/Path/, eventListViewModel);
}
}
Run Code Online (Sandbox Code Playgroud)
这是在 Sitecore 7.5 MVC 上