小编MaT*_*MaT的帖子

SQL Azure重置自动增量

我找到了许多使用的主题:

DBCC CHECKIDENT ('table', RESEED, 0)
Run Code Online (Sandbox Code Playgroud)

但Azure SQL不支持此功能.有人知道如何轻松地做到这一点吗?
非常感谢 !

sql sql-server azure azure-sql-database

8
推荐指数
2
解决办法
4798
查看次数

带char []的GetWindowText

我是Windows编程的新手.我正在尝试检索窗口的名称.

char NewName[128];
GetWindowText(hwnd, NewName, 128);
Run Code Online (Sandbox Code Playgroud)

我需要使用char [],但它给了我错误类型的错误.
从我读到的,LPWSTR是一种char*.

我该怎么char[]GetWindowText

非常感谢 !

c++ winapi visual-studio-2010

8
推荐指数
1
解决办法
2万
查看次数

如何在ASP.NET实体框架中访问旧实体值

我有一个小的ASP.Net mvc3应用程序,我在编辑部分.我有默认模板:

public ActionResult Edit(int id)
{
    User user = db.Users.Find(id); 
    return View(user);
}

public ActionResult Edit(User user)
{
    //(Here access to old user name for example)
    db.Entry(user).State = EntityState.Modified;
    db.SaveChanges();
}
Run Code Online (Sandbox Code Playgroud)

如果我执行user.name我有新值但我想在保存之前访问db值.

谢谢 !

c# asp.net entity-framework

7
推荐指数
1
解决办法
4424
查看次数

在Windows Azure中部署Unity3D

我有点困在windows Azure平板电脑上.目前,我在Azure上运行了一个ASP.NET MVC 3 Web角色.但我想部署一个Unity3D Web Player应用程序.我该如何执行此任务.如果我想在网页上部署Flash应用程序,我认为这是完全相同的.我有一个.unity3d文件,而不是.swf文件.有人做过某种事吗?

非常感谢 !

c# windows asp.net azure unity-game-engine

5
推荐指数
1
解决办法
2479
查看次数

Azure blob存储上载失败

我有一个Azure Blob存储,我想上传一些文件.

Index.cshtml

@using (Html.BeginForm("File_post", "MyController", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    <div class="editor-label">
    <p>
        <input type="file" name="file" />
    </p>
        <input type="submit" value="Upload" />
    </div>
}
Run Code Online (Sandbox Code Playgroud)

MyController.cs

public ActionResult File_post(HttpPostedFileBase file)
{
    CloudBlobContainer blobContainer = Initialize(); // This Initialize my blobContainer
    CloudBlockBlob blob;
    blob = blobContainer.GetBlockBlobReference("myfile");
    blob.UploadFromStream(file.InputStream);
    Return("Index");
}
Run Code Online (Sandbox Code Playgroud)

我测试了一个3.5Mo文件,它甚至可以使用20Mo文件.现在我尝试用33Mo和firefox给我基本错误:连接被重置...

编辑:我放的时候

public ActionResult File_post(HttpPostedFileBase file)
{
    Return("Index");
}
Run Code Online (Sandbox Code Playgroud)

它给了我同样的错误,所以我认为它不是由我的c#代码引起的.

任何的想法 ?非常感谢 !

c# asp.net azure azure-storage azure-storage-blobs

5
推荐指数
1
解决办法
2524
查看次数

C#是否应该阻止将事件取消挂钩两次?

如果一个事件被钩住,后来在应用程序中被取消钩住,那么我会尝试再次将其解钩。
我应该防止这种情况吗?

private void MyFunctionCalledWheneverIWant()
{
    // Second unhook : Should I prevent this ? How ?
    myObject.MyEventHandler -= MyEvent;
}

public void MyEvent()
{
    // First unhook
    myObject.MyEventHandler -= MyEvent;
}
Run Code Online (Sandbox Code Playgroud)

.net c# events delegates

5
推荐指数
2
解决办法
1739
查看次数

Django South - 创建非空的ForeignKey

我有一个模特

class Mystery(models.Model):
    first = models.CharField(max_length=256)
    second = models.CharField(max_length=256)
    third = models.CharField(max_length=256)
    player = models.ForeignKey(Player)
Run Code Online (Sandbox Code Playgroud)

我添加了播放器ForeignKey但是当我尝试使用South迁移它时,我似乎无法创建这个whith一个null = False.我有这样的信息:

字段'Mystery.player'没有指定默认值,但是NOT NULL.由于您要添加此字段,因此必须指定用于现有行的默认值.是否要:
1.立即退出,并在models.py中的字段中添加默认值
2.指定现在用于现有列的一次性值

我用这个命令:

manage.py schemamigration myapp --auto

非常感谢 !

django django-models django-south

4
推荐指数
2
解决办法
4872
查看次数

C#反射 - 获取未知领域的价值

我试图使用反射来调用带有一些参数的方法但是我在使用正确的设置时遇到了一些困难.这就是我所做的.

// The method I am trying to call
// UnityGUI
// internal static float DoFloatField(EditorGUI.RecycledTextEditor editor, Rect position, Rect dragHotZone, int id, float value, string formatString, GUIStyle style, bool draggable)
// Called this way : EditorGUI.DoFloatField(EditorGUI.s_RecycledEditor, position, new Rect(0f, 0f, 0f, 0f), controlID, value, EditorGUI.kFloatFieldFormatString, style, false);

Type    editorGUIType = typeof(EditorGUI);
Type    RecycledTextEditorType = Assembly.GetAssembly(editorGUIType).GetType("UnityEditor.EditorGUI+RecycledTextEditor");
Type[]  argumentTypes = new Type[] { RecycledTextEditorType, typeof(Rect), typeof(Rect), typeof(int), typeof(float), typeof(string), typeof(GUIStyle), typeof(bool) };
MethodInfo doFloatFieldMethod = editorGUIType.GetMethod("DoFloatField", BindingFlags.NonPublic | BindingFlags.Static, null, argumentTypes, …
Run Code Online (Sandbox Code Playgroud)

c# reflection

4
推荐指数
1
解决办法
165
查看次数

Json.NET - 如何在不访问类的情况下从序列化中排除属性

我试图使用Json.NET序列化一个类.这就是我现在所做的.

public class AClass
{
    // I don't have access to BClass
    public BClass b;
}

AClass a = new AClass();
JsonConvert.SerializeObject(a);
Run Code Online (Sandbox Code Playgroud)

我无权访问BClass.我想序列化我的AClass但我不想序列化所有属性BClass,只有其中一些属性.

我怎样才能做到这一点 ?

.net c# json json.net

4
推荐指数
1
解决办法
4913
查看次数

在Mercurial中合并时排除文件

我使用Mercurial和TortoiseHg.我有两个分支(AB)有两个文件(toto.cstiti.cs).

有什么方法,当我想合并BA,titi.cs要从合并中排除,只有合并toto.cs?如果有可能,我该怎么做?

merge mercurial tortoisehg

3
推荐指数
1
解决办法
2391
查看次数