readonly

How to force an IIS hosted WCF or ASMX [webservice] to use session object readonly?

自作多情 提交于 2019-11-28 00:43:53
问题 While making my first ajax attempts, I decided also, to go to use IIS hosted WCF now. The strange thing is, that the WCF cannot process several requests parallel for the same user/session, if sessionmode is enabled! If sessionmode is disabled on asp.net, the requests are processed parallel. The broser/client may execute several different requests, where some of them are long running. This blocks all further requets and make my ajax app unusable. This applies to asmx [webservices] also. I had

Knockout attr binding with attributes like 'readonly' and 'disabled'

蓝咒 提交于 2019-11-28 00:39:07
What's the suggested "best practice" way to use Knockout's "attr" data binding with standalone attributes like "readonly" and "disabled" ? These attributes are special in that they are generally enabled by setting the attribute value to the attribute name (although many browsers work fine if you simply include the attribute names without any values in the HTML): <input type="text" readonly="readonly" disabled="disabled" value="foo" /> However, if you don't want these attributes to be applied, the general practice is to simply omit them altogether from the HTML (as opposed to doing something

Why is there no IArray(T) interface in .NET?

自作多情 提交于 2019-11-27 23:35:48
Update 2011-Jan-06: Believe it or not, I went ahead and incorporated this interface into an open source library I've started, Tao.NET . I wrote a blog post explaining this library's IArray<T> interface, which not only addresses the issues I originally raised in this question (a year ago?!) but also provides a covariant indexed interface , something that's sorely lacking (in my opinion) in the BCL. Question (in short): I asked why .NET has IList<T> , which implements ICollection<T> and therefore provides methods to modify the list ( Add , Remove , etc.), but doesn't offer any in-between

Whole model as read-only

北战南征 提交于 2019-11-27 22:13:01
Is there a way to make a model read-only in the django admin? but I mean the whole model. So, no adding, no deleting, no changing, just see the objects and the fields, everything as read-only? ModelAdmin provides the hook get_readonly_fields() - the following is untested, my idea being to determine all fields the way ModelAdmin does it, without running into a recursion with the readonly fields themselves: from django.contrib.admin.util import flatten_fieldsets class ReadOnlyAdmin(ModelAdmin): def get_readonly_fields(self, request, obj=None): if self.declared_fieldsets: fields = flatten

How to make WPF DataGridCell ReadOnly?

主宰稳场 提交于 2019-11-27 21:22:17
问题 I understand you can make the whole DataGrid or a whole column readyonly (IsReadOnly = true). However, at cell level this property is ready only. But I do need this level of granularity. There is blog about adding IsReadOnly to a row by changing the source code in old days when DataGrid was public domain, but now I don't have source code for DataGrid. What's workaround? Making cell disabled (IsEnabled=false) almost meets my need. But the problem is that you can't even click the disabled cell

MVC3 EditorFor readOnly

笑着哭i 提交于 2019-11-27 19:57:23
I want to make readOnly with EditorFor in edit page. I tried to put readonly and disabled as: <div class="editor-field"> @Html.EditorFor(model => model.userName, new { disabled = "disabled", @readonly = "readonly" }) </div> However, it does not work. How can I make to disable edit this field? Thank you. The EditorFor html helper does not have overloads that take HTML attributes. In this case, you need to use something more specific like TextBoxFor: <div class="editor-field"> @Html.TextBoxFor(model => model.userName, new { disabled = "disabled", @readonly = "readonly" }) </div> You can still

Changed behavior of string.Empty (or System.String::Empty) in .NET 4.5

早过忘川 提交于 2019-11-27 18:58:26
Short version: The C# code typeof(string).GetField("Empty").SetValue(null, "Hello world!"); Console.WriteLine(string.Empty); when compiled and run, gives output "Hello world!" under .NET version 4.0 and earlier, but gives "" under .NET 4.5 and .NET 4.5.1. How can a write to a field be ignored like that, or, who resets this field? Longer version: I have never really understood why the string.Empty field (also known as [mscorlib]System.String::Empty ) is not const (aka. literal ), see " Why isn't String.Empty a constant? ". This means that, for example, in C# we can't use string.Empty in the

asp:TextBox ReadOnly=true or Enabled=false?

人走茶凉 提交于 2019-11-27 18:55:59
What's the difference between the Enabled and the ReadOnly-properties of an asp:TextBox control? If a control is disabled it cannot be edited and its content is excluded when the form is submitted. If a control is readonly it cannot be edited, but its content (if any) is still included with the submission. Another behaviour is that readonly = 'true' controls will fire events like click , buton Enabled = False controls will not. Readonly will not "grayout" the textbox and will still submit the value on a postback. Think about it from the browser's point of view. For readonly the browser will

How to make a git repository read-only?

不羁岁月 提交于 2019-11-27 18:41:37
I have some git repositories accessed remotely through SSH and I want to make some of them read-only to prevent more pushes. Some people have remotes pointing to these repositories. These bare repositories were initialised --shared=group , so is setting file permissions to 660 for all files good enough to still allow SSH access, but disallow writes? Or is there an easier way? Cheers. Jakub Narębski There is more than one possible way to do this. If your users each have a shell account (perhaps limited), and each of them accessing git repositories via their own account, you can use filesystem

Immutable numpy array?

我的梦境 提交于 2019-11-27 17:56:39
Is there a simple way to create an immutable NumPy array? If one has to derive a class from ndarray to do this, what's the minimum set of methods that one has to override to achieve immutability? You can make a numpy array unwriteable: a = np.arange(10) a.flags.writeable = False a[0] = 1 # Gives: RuntimeError: array is not writeable Also see the discussion in this thread: http://mail.scipy.org/pipermail/numpy-discussion/2008-December/039274.html and the documentation: http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.flags.html 来源: https://stackoverflow.com/questions/5541324