我一直在考虑优化SQL Server内会话的状态存储的方法,我遇到的几种方法是:
现在,我在会话中存储了一个对象(称为SessionObject的类)。好消息是,它是完全可序列化的。
我认为另一种优化会话存储的好方法可能是使用协议缓冲区(protobuf-net)序列化/反序列化而不是标准BinaryFormatter。我知道我可以让所有对象继承ISerializable,但是我不想创建DTO或使用序列化/反序列化逻辑使我的Domain层混乱。
将protobuf-net与会话状态SQL Server模式一起使用的任何建议都很棒!
我有一个带有 Settings.settings 文件的 VS2010 解决方案。用户设置保存到本地设置文件夹,这是一个问题,因为这些设置不会漫游。
目前,设置文件会自动保存到:
Dim config_initial As System.Configuration.Configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoamingAndLocal)
Console.WriteLine("Local user config path: {0}", config_initial.FilePath)
( C:\Documents and Settings\%username%\Local Settings\Application Data\%company%\%application%.exe_Url_%hash%\%version%\user.config)
有没有办法将此文件保存到由以下标识的文件路径:
Dim config_new As System.Configuration.Configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoaming)
Console.WriteLine("User config path: {0}", config_new.FilePath)
( C:\Documents and Settings\%username%\Application Data\%company%\%application%.exe_Url_%hash%\%version%\user.config)
我只是My.Settings.Save()在应用程序当前终止时使用或自动保存。
有没有办法在抛出OutOfMemoryException之前调用GC.Collect()?
我想我正在寻找一种方法来执行以下代码流程:
Try to Allocate Memory
On Pass Return
Call GC.Collect()
Try to Allocate Memory
On Fail Throw New OutOfMemoryException()
我正在写一个缓存实现,目前我正在遇到内存异常,所以目前解决它我正在使用:
If GC.GetTotalMemory(False) >= cache.CacheMemoryLimit + (100 * 1024 * 1024) Then
    // When Total Memory exceeds CacheMemoryLimit + 100MB
    GC.Collect()
End If
我正在尝试翻译解析RTF格式的消息(我需要保留格式化标签,所以我不能使用你只是粘贴到一个RichTextBox并获取.PlainText出来的技巧)
将a?b??c??d直接粘贴到Wordpad中的字符串的RTF代码:
{\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\fnil\fcharset0 Calibri;}{\f1\fswiss\fcharset128 MS PGothic;}{\f2\fnil\fcharset1 Shonar Bangla;}{\f3\fswiss\fcharset161{\*\fname Arial;}Arial Greek;}}
{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang9\f0\fs22 a\f1\fs24\'8a\'ee\f0\fs22 b\f2\fs24\u2478?\u2498?\f0\fs22 c\f3\fs24\'cf\'e9\f0\fs22 d\par
}
如果你与RTF没什么关系,很难弄明白.所以这就是我正在看的
\'8a\'ee\f0\fs22 b\f2\fs24\u2478?\u2498?\f0\fs22 c\f3\fs24\'cf\'e9
注意?(u+57FA)是\'8a\'ee但??,这实际上是两个字符?(\u2478?)和?(\u2498?),是\u2478?\u2498?其是很好,但??它是两个单独的字符?和?是\'cf\'e9.
有没有办法确定我是否正在查看应该是一个字符的内容,例如?= \'bb\'f9或两个字符?和?= \'cf\'e9?
我当时想的可能\lang是它,但事实并非如此,因为\lang它不会从第一次设置时改变.我已经从Charset字体中的不同值中考虑了不同的代码页,但它似乎没有告诉我是否应该将两个Unicode引用彼此相邻处理为双字节字符.
如何判断我正在查看的字符应该是双字节(或多字节)还是单字节?
在最近的一次采访中,我被问到"默认情况下java支持哪个数据库".我无法为这个问题提供正确的答案,因为我真的不知道它是哪一个,因为我使用的是mysql数据库,主要需要将一个名为connector/j的附加驱动程序添加到lib文件夹中,然后添加到构建路径,所以我把它排除在答案之外.然后又是哪一个,那么它是Derby Db,Oracle(我认为不是这样)或任何其他数据库?
有人可以提供一些见解吗?
I’m building a blog engine in C# Webforms and I have the following code that selects all blog posts that are current, meaning they should be displayed and a count of all comments for each blog post and it works great.
SELECT PostID, PostTitle, PostDate, PostTeaser, Count(CommentID) AS CountOfCommentID, PostCurrent 
FROM TBLBlogPost 
    INNER JOIN TBLBlogComment ON PostID = PostCommentFK 
GROUP BY PostID, PostTitle, PostDate, PostTeaser, PostCurrent
HAVING PostCurrent = 'True'
The problem is it only selects blog posts that have …