我在Windows 7上使用Vim 7.4.
我有一个自定义_vimrc文件,但Vim和gVim都可以正常工作.当我尝试运行时vimdiff .\xxxxx .\yyyyy,它会给出错误
无法读取或写入临时文件
有没有办法shared在VB.NET中为类创建构造函数?我在C#中一直这样做,如下所示,但我似乎无法在VB.NET中使用它.
static class someClass
{
public static string somePublicMember;
static someClass()
{
messageBox.show("I just constructed a static class");
}
}
Run Code Online (Sandbox Code Playgroud)
执行以下代码时,将调用构造函数.
...
someSillyClass.someSillyPublicMember = 42;
...
Run Code Online (Sandbox Code Playgroud)
a static(shared)类甚至可以在VB.NET中使用构造函数吗?
我想我已经找到了一种更快的方法来复制c#中的位图.(如果它有效,我确定我不是第一个,但我还没有在任何地方见过它.)
我能想到的最简单的方法是断言我的想法是基于什么,如果没有人在其中发现漏洞,假设这个想法是合理的:
void FastCopyRegion(Bitmap CopyMe, ref Bitmap IntoMe, Rectangle CopyArea)
{
//`IntoMe` need not be declared `ref` but it brings
// attention to the fact it will be modified
Debug.Assert(CopyMe.PixelFormat == IntoMe.PixelFormat,
"PixelFormat mismatch, we could have a problem");
Debug.Assert(CopyMe.Width == IntoMe.Width, //This check does not verify
"Stride mismatch, we could have a problem");// sign of `stride` match
BitmapData copyData = CopyMe.LockBits(CopyArea,
ImageLockMode.ReadWrite, CopyMe.PixelFormat);
IntoMe.UnlockBits(copyData);
}
Run Code Online (Sandbox Code Playgroud)
1)LockBits简单地将一块像素数据从位图复制到固定存储器中进行编辑并在使用中复制回来UnlockBits
2)使用LockBits不会影响复制的内存块,因此它应该对从中复制的图像没有影响.
3)由于您从不输入unsafe代码,因此不应存在损坏内存的风险.
我看到可能的漏洞:
1)如果PixelFormat两个位图的s不同,则此方法可能无法始终正确复制.但是,由于 …
我正在使用Linux Mint 15.我sqlite-amalgamation-3080002.zip从http://www.sqlite.org/download.html下载了(并将文件放在我的项目目录中)
我已经完成了(尽管我知道它对上一步是多余的):
sudo apt-get install sqlite3
sudo apt-get install libsqlite3-dev
Run Code Online (Sandbox Code Playgroud)
sqlite3 在命令行工作就好了,我可以创建/编辑数据库.
我创建了一个测试文件:
#include <stdio.h>
#include <sqlite3.h>
int main(int argc, char* argv[]){
sqlite3 *db;
char *zErrMsg = 0;
int rc;
rc = sqlite3_open("test.db", &db);
if( rc ){
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
exit(0);
}else{
fprintf(stderr, "Opened database successfully\n");
}
sqlite3_close(db);
}
Run Code Online (Sandbox Code Playgroud)
跑了:
gcc ./sqliteTest.c -o sqliteTest -lsqlite
Run Code Online (Sandbox Code Playgroud)
并得到以下错误:
./sqliteTest.c: In function ‘main’:
./sqliteTest.c:14:7: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by …Run Code Online (Sandbox Code Playgroud) 我想将一个项目移动到 WPF,其中有一个ImageList(通过在设计视图中选择 25 个图像来加载),我用它来创建按钮,如下所示: 我已将项目简化为以下代码。这是我的整个项目(除了 .Designer.cs 中自动生成的代码):
public partial class Form1 : Form
{
Button[] buttonList = new Button[25];
Size buttonSize = new Size(140, 140);
public Form1()
{
InitializeComponent();
this.ClientSize = new Size(142 * 5, 142 * 5);
for (int i = 0; i < buttonImages.Images.Count; i++)
{
buttonList[i] = new Button();
buttonList[i].Size = buttonSize;
buttonList[i].Location = new Point(
(i % 5) * (buttonSize.Width + 2) + 1,
(i / 5) * (buttonSize.Height + 2) + …Run Code Online (Sandbox Code Playgroud) 我有一个类,我想在System.Drawing中包含一个类似于Point.Empty的"Empty"常量成员.那可能吗?
这是给出错误的简化版本:
public class TrivialClass
{
public const TrivialClass Empty = new TrivialClass(0);
public int MyValue;
public TrivialClass(int InitialValue)
{
MyValue = InitialValue;
}
}
Run Code Online (Sandbox Code Playgroud)
给出的错误是:TrivialClass.Empty属于TrivialClass类型.除string之外的引用类型的const字段只能用null初始化.
如果重要,我想像这样使用它:
void SomeFunction()
{
TrivialClass myTrivial = TrivialClass.Empty;
// Do stuff ...
}
Run Code Online (Sandbox Code Playgroud)