在表定义中,我看到:
Latitude -> varchar(50)
Longitude -> nvarchar(50)
Run Code Online (Sandbox Code Playgroud)
很明显,我立即质疑这背后的想法 - 确信这些价值实际上是数字的.长话短说:我假设这些将是数字,十进制实际上,我们会抛弃'思想在弦中'的哲学.
现在为了我的困境,我只是继续输入:
Latitude -> decimal(2, 4)
Run Code Online (Sandbox Code Playgroud)
但坚持一秒,4不对,对吗?对.所以我认为我在达到阈值之前(可能会在一瞬间添加)6或者8也可能不会削减它.所以,首先要做的事情......
我是否正确坚持我们甚至这样做?如果是这样...
要存储这些值的精度,以确保我们可以保留要插入的整个值?例如,是否有任何预定义规范?
我不仅仅想使用Latitude -> decimal(2, 16)简单的东西,就像它decimal(2, 2)原则上一样有缺陷.类似的问题出现在经度专门,但我假设一个人的答案足够另一个,即decimal(3, answer).
我们正在使用MSSQL Server 2005.
我似乎是通过手工经验教育自己使用SQL Server,因此这个问题的部分内容无关紧要:我无论如何都只能使用decimal(x, max(x))它decimal(x, y)!将问题保留为输入.
我一直在我的网站上使用Flash视频嵌入视频.我的旧2.2.x安卓很好,但我注意到很多新的Android设备以及苹果设备不会播放我的视频因为flashplayer褪色,所以我正在研究解决方案 - 而HTML5视频似乎是新的东西.
我只花了2个小时搜索谷歌并阅读了很多东西,但大部分时间是从1年,2年或3年前开始 - 从我读过的内容来看,看起来使用html5视频标签仍然需要每个视频转换为多种格式,全屏是某种特定于供应商的扩展 - 在每个浏览器上都有不同的支持它.
所以我的问题是,HTML5视频标签现在是否完全替代了Flash播放器,还是仍然是一个需要浏览器特定黑客攻击的六个最流行的浏览器 - 在2013年?
它适用于PC,Mac,机器人和iPhone吗?
使用System.Threading.Timer从a中旋转的线程的结果ThreadPool,这意味着如果计时器的执行间隔在线程仍在按先前请求的顺序处理时到期,则将委托相同的回调在另一个线程上执行.在大多数情况下,这显然会导致问题,除非回调是可重入的,但我想知道如何以最好的(意味着安全的)方式去做.
假设我们有以下内容:
ReaderWriterLockSlim OneAtATimeLocker = new ReaderWriterLockSlim();
OneAtATimeCallback = new TimerCallback(OnOneAtATimeTimerElapsed);
OneAtATimeTimer = new Timer(OneAtATimeCallback , null, 0, 1000);
Run Code Online (Sandbox Code Playgroud)
整个shebang应该被锁定,如下:
private void OnOneAtATimeTimerElapsed(object state)
{
if (OneAtATimeLocker.TryEnterWriteLock(0))
{
//get real busy for two seconds or more
OneAtATimeLocker.ExitWriteLock();
}
}
Run Code Online (Sandbox Code Playgroud)
或者,应该只管理输入,并踢出'侵入者',如下:
private void OnOneAtATimeTimerElapsed(object state)
{
if (!RestrictOneAtATime())
{
return;
}
//get real busy for two seconds or more
if(!ReleaseOneAtATime())
{
//Well, Hell's bells and buckets of blood!
}
}
bool OneAtATimeInProgress = false;
private …Run Code Online (Sandbox Code Playgroud) 此问题的相关解决方案和项目文件位于:
http://code.google.com/p/benfwaves/source/browse/trunk/BenfWaves.sln?r=26
http://code.google.com/p/benfwaves/source/browse/trunk/BenfWaves.Client/BenfWaves.Client.csproj?r=26
http://code.google.com/p/benfwaves/source/browse/trunk/BenfWaves.Tests/BenfWaves.Tests.csproj?r=26
我试图重构项目文件以消除冗余,并允许编译到.NET 3.5以及.NET 4.0.目前,VS2010 IDE可以在.NET 4.0上为任何CPU编译.如果我尝试任何CPU for .NET 3.5,它说:
错误1无法加载文件或程序集'System.Drawing,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一.该系统找不到指定的文件.第123行,第5行.D:\ projects\BenfWaves\trunk\BenfWaves.Client\Properties\Resources.resx 123 5 BenfWaves.Client
我读到这可能是resgen.exe的问题,但更改该文件上的32位标志并没有改善任何情况.此外,IDE不相信项目具有除Any CPU以外的任何配置,这会产生以下问题:
------ Skipped Build: Project: BenfWaves.Library, Configuration: Debug-4.0 Any CPU ------
Project not selected to build for this solution configuration
------ Build started: Project: BenfWaves.Client, Configuration: Debug-4.0 x86 ------
BenfWaves.Client -> D:\projects\BenfWaves\trunk\BenfWaves.Client\bin\x86\Debug-4.0\BenfWaves.Client.exe
------ Skipped Build: Project: BenfWaves.Tests, Configuration: Debug-4.0 Any CPU ------
Project not selected to build for this solution configuration
========== Build: 1 succeeded …Run Code Online (Sandbox Code Playgroud) 我在C#中创建了一个Windows服务来关闭计算机.
计算机未锁定时(Ctrl + Alt + Del),该服务正常.
但有些人在我的电脑被锁定时它没有关闭.
// call
DoExitWin(EWX_SHUTDOWN);
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal struct TokPriv1Luid
{
public int Count;
public long Luid;
public int Attr;
}
[DllImport("kernel32.dll", ExactSpelling = true)]
internal static extern IntPtr GetCurrentProcess();
[DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]
internal static extern bool OpenProcessToken(IntPtr h, int acc, ref IntPtr phtok);
[DllImport("advapi32.dll", SetLastError = true)]
internal static extern bool LookupPrivilegeValue(string host, string name, ref long pluid);
[DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)]
internal static extern …Run Code Online (Sandbox Code Playgroud) 有人可以向我解释下面的代码行是做什么的吗?
dynamic shellApplication = Activator.CreateInstance(Type.GetTypeFromProgID("Shell.Application"));
string path = System.IO.Path.GetDirectoryName(filePath);
string fileName = System.IO.Path.GetFileName(filePath);
dynamic directory = shellApplication.NameSpace(path);
dynamic link = directory.ParseName(fileName);
dynamic verbs = link.Verbs();
Run Code Online (Sandbox Code Playgroud)
我搜索了msdn库,但无法真正理解它的作用.
这不是完整的代码,但我承诺其余的,只是这部分我正在努力.
我想在我的Enum值中存储其他信息,因此想出了属性.因为我想要一个属性来携带1..n strings我试图让属性构造函数接受一个变量参数.像这样:
[AttributeUsage(AttributeTargets.Enum, AllowMultiple = false, Inherited = false)]
public class FileTypeAttribute : Attribute
{
public readonly string[] Extensions;
FileTypeAttribute(params string[] extensions)
{
this.Extensions = extensions;
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,当我现在尝试使用我的属性时,我的编译器会抱怨并留下以下错误消息,我真的不明白:
public enum EFileType
{
[FileTypeAttribute("txt")]
TEXTFILE,
[FileTypeAttribute("jpg", "png")]
PICTURE
}
Run Code Online (Sandbox Code Playgroud)
给我:
'FileTypeAttribute' does not contain a constructor that takes '1' arguments 和
'FileTypeAttribute' does not contain a constructor that takes '2' arguments
谁能告诉我为什么会这样?
据我所知,实际上没有可能让枚举更加"java'ish".但如果我错过任何替代方案,我会很高兴听到它.
阅读JSR-303的规范:
约束验证实现实例的生命周期未定义
在使用约束实现之前,Bean验证提供程序将调用initialize方法。
每次验证给定值时,Bean验证提供程序都会对isValid方法进行评估。如果该值无效,则返回false,否则返回true。isValid实现必须是线程安全的。
我不太明白。在每个isValid调用之前调用initialize,并且isValid应该是线程安全的吗?这是否意味着我无法在初始化时在类级别存储任何内容以便以后从isValid访问它?特别地,我需要传递给initialize的注释实例。
有人可以照一下吗?
我有一个非常简单的查询,它根据匹配月份然后按天分组从表中选择项目.然后将这些组用作转发器的数据源,该转发器将组元素输出为"每天"条目.
问题是那些不存在的日子(即没有任何组合)将自然不会被显示出来,所以第6和第8的东西,当第7个没什么东西时,将直接看到彼此(想想一个日历视图).问题是,根据我的查询,我怎么能插入没有元素的组,即使当天没有条目?
IQueryable events =
Events
.Where(i => i.Date.Month == date.Month)
.GroupBy(i => i.Date.Day);
Run Code Online (Sandbox Code Playgroud)
我可以在事后弄清楚这个,但我可以解释它来立即得到结果集吗?或者可以推荐以前久经考验的方法吗?
我正在使用JQuery.Cookie将javascript对象存储为cookie值:
var refinerData = {};
// Read in the current cookie if it exists:
if ($.cookie('RefinerData') != null) {
refinerData = JSON.parse($.cookie('RefinerData'));
}
// Set new values based on the category and filter passed in
switch(category)
{
case "topic":
refinerData.Topic = filterVal;
break;
case "class":
refinerData.ClassName = filterVal;
break;
case "loc":
refinerData.Location = filterVal;
break;
}
// Save the cookie:
$.cookie('RefinerData', JSON.stringify(refinerData), { expires: 1, path: '/' });
Run Code Online (Sandbox Code Playgroud)
当我在firebug中调试时,cookie值的值似乎正确格式化:
{"主题":"疾病预防和管理","地点":"孵化场山诊所","ClassName":"我有糖尿病,我能吃什么?"}
我正在用C#编写一个SharePoint Web部件来读取cookie并解析它:
protected void Page_Load(object sender, EventArgs e)
{
HttpCookie …Run Code Online (Sandbox Code Playgroud) c# ×7
.net ×4
.net-3.5 ×1
attributes ×1
geocoding ×1
html5 ×1
html5-video ×1
java ×1
json ×1
linq ×1
msbuild ×1
sql ×1
sql-server ×1
types ×1
video ×1