问题列表 - 第42038页

成员属性是否允许或使用F#?

考虑以下示例F#代码:

type mytype() =
   member this.v = new OtherClass()
Run Code Online (Sandbox Code Playgroud)

如果OtherClass实现了IDisposable,那么成员绑定是否像let绑定或use绑定一样?有没有办法让它充当使用绑定?我有一些与此非常相似的代码,我想确保在父对象超出范围时调用Dispose.

通过Expert F#进行的快速扫描未能找到任何明确的内容,但也许我正在寻找书中的错误术语.

f#

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

文件打开时抛出IsolatedStorageFileStream异常?

当我尝试在WP7应用程序中打开文件时:

IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream nameXmlFile = new IsolatedStorageFileStream("Names.xml", System.IO.FileMode.Open, isf);
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

IsolatedStorageFileStream上不允许操作.

我不确定为什么它没有打开,因为我在我的应用程序的其他地方使用了确切的代码,它工作正常.关于为什么会发生这种情况的任何线索?

编辑

我使用以下代码将文件添加到App.xaml.cs Application_Launching事件中的独立存储:

IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream feedXmlFile = new IsolatedStorageFileStream("Names.xml",System.IO.FileMode.Create, isf);
Run Code Online (Sandbox Code Playgroud)

silverlight windows-phone-7

6
推荐指数
1
解决办法
4041
查看次数

我不能包含RelayCommands

我想要包含RelayCommands.我想为System.Windows.Input创建一个程序集以使用ICommands,但程序集不可用?有什么问题?我已经安装了.net框架客户端配置文件和扩展?这个套餐不提供吗?

.net c# wpf

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

Visual Studio 2010 - 您是否缺少using指令或程序集引用?

当我在Visual Studio项目中添加对我的dll的引用时,我能够使用它,但是当我编译我的代码或尝试运行它时,我得到的是你是否缺少using指令或汇编引用?_错误.我能够确认我的命名空间使用了正确的语句,并且我能够确认dll是否已正确加载.任何人都知道我可能没有这个权利吗?

c# vb.net visual-studio-2010 visual-studio

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

web2py与谷歌应用引擎相当

有什么办法来产生类似的疑问like,contains,startswith与App Engine的BigTable数据库运营商?

所以我可以做类似的事情:

db(db.some_table.like('someting')).select()
Run Code Online (Sandbox Code Playgroud)

使用web2py中的app引擎.

google-app-engine web2py bigtable

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

NHibernate AssertException:Interceptor.OnPrepareStatement(SqlString)返回null或空SqlString

我正在尝试将表从多对一映射切换为具有中间映射表的多对多映射.但是,当我切换它并试图用NHibernate对它进行查询时,它给了我这个错误:"Interceptor.OnPrepareStatement(SqlString)返回null或空SqlString."

我的查询最初是一些更复杂的问题,但是我将其切换为基本的提取全部并且我仍然遇到问题:

Session.QueryOver<T>().Future();
Run Code Online (Sandbox Code Playgroud)

它似乎是我的模型映射文件中的问题或我的数据库中的某些东西.

这是我的模型映射:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="GBI.Core" namespace="GBI.Core.Models">

<class name="Market" table="gbi_Market">
    <id name="Id" column="MarketId">
        <generator class="identity" />
    </id>
    <property name="Name" />
    <property name="Url" />
    <property name="Description" type="StringClob" />
    <property name="Rating" />
    <property name="RatingComment" />
    <property name="RatingCommentedOn" />
    <many-to-one name="RatingCommentedBy" column="RatingCommentedBy" lazy="proxy"></many-to-one>
    <property name="ImageFilename" />
    <property name="CreatedOn" />
    <property name="ModifiedOn" />
    <property name="IsDeleted" />

    <many-to-one name="CreatedBy" column="CreatedBy" lazy="proxy"></many-to-one>
    <many-to-one name="ModifiedBy" column="ModifiedBy" lazy="proxy"></many-to-one>

    <set name="Content" where="IsDeleted=0 and ParentContentId is NULL" order-by="Ordering asc, CreatedOn asc, Name asc" lazy="extra"> …
Run Code Online (Sandbox Code Playgroud)

nhibernate nhibernate-mapping interceptor

9
推荐指数
1
解决办法
5516
查看次数

新的Django类视图表单上的用户当前用户

我在trunk上使用django 1.3,并开始学习类视图.

我有这个:

class Project(models.Model):
    title = models.CharField(max_length=90)
    slug = models.CharField(max_length=90)
    description = models.TextField()
    owner = models.ForeignKey(User)

class ProjectForm(ModelForm):

    class Meta:
        model = Project
        exclude = ('owner',)
        widgets = {
            'description': Textarea(attrs={'cols': 40, 'rows': 20}),
        }

class ProjectCreateView(CreateView):
    model = Project
    form_class = ProjectForm

    def get(self, request, *args, **kwargs):
        return super(ProjectCreateView, self).get(request, *args, **kwargs)

    def post(self, request, *args, **kwargs):
        return super(ProjectCreateView, self).post(request, *args, **kwargs)
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用django中的模型表单(不包括所有者字段)获取表单,以获取request.user属性之后的字段值.

形式原样,有效.但是如何确保ModelForm使用request.owner字段的request.user?

我的第一个猜测是从视图中覆盖get_form_kwargs方法

class ProjectCreateView(CreateView):

    # .....

    def get_form_kwargs(self, **kwargs):
        self.initial['owner': self.request.user})
        kwargs = super(ProjectCreateView, self).get_form_kwargs(**kwargs) …
Run Code Online (Sandbox Code Playgroud)

django django-forms

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

用于在C中重命名文件的Win32 API

如果是源目录和目标目录,MoveFile实际上会将源文件的副本复制到目标文件中,这意味着我最终会看到两个文件.

这是重命名的最佳方式吗?

c winapi file-rename

7
推荐指数
3
解决办法
2万
查看次数

如何在Visual Studio 2010中使用std :: regex库来标记字符串?

我找不到std::regex图书馆的参考资料.我做了一些谷歌搜索并找到了一些教程,但它们都很简短.我无法弄清楚如何使用正则表达式对字符串进行标记.

任何人都可以给我一个提示如何开始吗?

c++ regex stl c++11

6
推荐指数
1
解决办法
4848
查看次数

如何制作验证收据的Mac App Store应用程序?

我根据Apple文档使用GitHub上ValidateStoreReceipt代码创建了一个验证其收据的应用程序.文档说要签署你的应用程序,制作一个包(带签名),然后通过命令行安装它.然后运行应用程序,看到没有收据,返回代码173,它会提示您输入测试帐户(它确实如此).我提供测试帐户(在iTunesConnect上设置测试用户).然后,没有任何反应.然后它应该将收据下载到应用程序包中并重新启动应用程序,但它不会.控制台只说这个:

12/22/10 1:06:01 PM store_helper[75986] -[ISURLOperation run]
12/22/10 1:06:01 PM store_helper[75986] port created: 'com.apple.storeClient-23457' (75986)
12/22/10 1:06:01 PM store_helper[75986] Creating run loop source
12/22/10 1:06:01 PM store_helper[75986] adding source to run loop
12/22/10 1:06:01 PM storeagent[81090]   promptResponse: <CKSignInPromptResponse:0x10101ce20 returnCode:1>
12/22/10 1:06:01 PM storeagent[81090]   wrote primary DSID: 1391703719
12/22/10 1:06:01 PM storeagent[81090]   wrote primary DSID: 1391703719
12/22/10 1:06:01 PM storeagent[81090]   -[ISURLOperation run]
12/22/10 1:06:02 PM storeagent[81090]   unsignedBags: 0
12/22/10 1:06:02 PM storeagent[81090]   -[ISURLOperation …
Run Code Online (Sandbox Code Playgroud)

validation macos app-store codesign

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