fields

Setting the selected value on a Django forms.ChoiceField

Here is the field declaration in a form: max_number = forms.ChoiceField(widget = forms.Select(), choices = ([('1','1'), ('2','2'),('3','3'), ]), initial='3', required = True,) I would like to set the initial value to be 3 and this doesn't seem to work. I have played about with the param, quotes/no quotes etc... b...

Why should (or shouldn't) I prefix fields with 'm_' in C#?

I've been a C++ programmer for almost 12 years now. When I moved to C# two years ago I brought with me the same coding style I was so accustomed to. Soon I realized how much useless it was in C# and gradually started to drop all of my old habits... but the 'm_' thing. I've never been a fan of Hungarian notation, I've always found it pre...

Use reflection to find the name of a delegate field

Let's say that I have the following delegate: public delegate void Example(); and a class such as the following: public class TestClass { Example FailingTest = () => Assert.Equal(0,1); } How can I use reflection to get the name "FailingTest"? So far I have tried: var possibleFields = typeof(TestClass).GetFields(relevant_bindi...

Default fields available in a Search Server web content source?

Hi, I'm using the search web service on a Search Server 2008 Express install in a web application. I have created the content source and scope and can successfully query the web service if I specify the fields I wish to return. What I cannot find out is what fields are available to me, if I modify the query to "SELECT * ..." then I get...

How can I retrieve SQL field names of a temp table using Perl?

Below is the code I'm using to run the query, parse the result set, and parse the rows (respectively) $exec_ret = $DBS->SQLExecSQL($STMT); while ($DBS->SQLFetch() == *PLibdata::RET_OK) { $rowfetch = $DBS->{Row}->GetCharValue($colname[$i]); } Can I grab the column/field name of a temp table using similar syntax? $colname[$i] is...

Using XSL to list all fields of an item in Sitecore CMS

I'm using a debug device in sitecore (6) that will output a 'developer' view of a page when the url is appended with a certain query string (which activates the device). On the page, I have item name, template, branch master, workflow info etc. I'd like to list all the fields on the item using the xsl render - preferably not including t...

Best way to expose protected fields

I have a base class like this: public class BaseModalCommand { protected object m_commandArgument; protected int m_commandID; protected int m_enableUIFlags; public virtual void OnIdle() { } public virtual void OnResume() { } public virtual void OnStart(int commandID, object argument) { ...

C# Reflection : Finding Attributes on a Member Field

I may be asking this incorrectly, but can/how can you find fields on a class within itself... for example... public class HtmlPart { public void Render() { //this.GetType().GetCustomAttributes(typeof(OptionalAttribute), false); } } public class HtmlForm { private HtmlPart _FirstPart = new HtmlPart(); [Optional] //<-- ...

Can I add object field to SPItem, to attach some kind of object to item?

Hello. I have an SPListItem object. Can I add a field to store some kind of object like ArrayList or Dictionary, or whatever? Thank you. ...

How can I use 400 fields in a MS-Access form?

I understand the maximum number of fields in a MS-Access form is 255. Is there any way to get around this limitation? I am working with a mental health survey form that has approximately 400 fields. I would like to create 1 data entry form to allow the mental health interviewer to enter all the responses on the one form. I plan to us...

Filterable SPFIeldUrl in default view.

I`v added a hyperlink (SPFieldUrl class) column (field) with GUI to my list. Pity, but I cannot filter those values when viewing the list. (It reads that you cannot filter this column type) Is there any way to have it easy filterable with clicking on columns besides creating a custom view? Thank you. ...

AS3 validate form fields?

Hi, I wrote a AS3 script, i have 2 fields to validate, i.e email and name. For email i use: function isValidEmail(Email:String):Boolean { var emailExpression:RegExp = /^[a-z][\w.-]+@\w[\w.-]+.[\w.-]*[a-z][a-z]$/i; return emailExpression.test(Email); } How about name field? Can you show me some sample code? EDIT: Invalid ...

C# StructLayout/FieldOffset and indexing in arrays

I'm having a bit of a problem using FieldOffset correctly with arrays. The code below is an example where it doesn't work correctly for me: [StructLayout(LayoutKind.Explicit)] public struct IndexStruct { [FieldOffset(0)] public byte[] data; [FieldOffset(0)] public short[] idx16; [FieldOffset(0)] public int[] idx32; } If I for ...

Why does WPF support binding to properties of an object, but not fields?

I've got a WCF service that passes around status updates via a struct like so: [DataContract] public struct StatusInfo { [DataMember] public int Total; [DataMember] public string Authority; } ... public StatusInfo GetStatus() { ... } I expose a property in a ViewModel like this: public class ServiceViewModel : ViewModel { ...

Changing fields to property is a breaking change under what scenarios?

While reading Jon Skeet's article on fields vs properties he mentions that changing fields to properties is a breaking change. I would like to understand the common scenarios in which this change can cause breaks. Along with the scenario, if you can, please provide any details. For starters, the following points have been mentioned els...

Proper language to use in form field labels: A linguistic question

I wish to use the following sentence as the comment on a form field. I have already come up with a short-form label for the field. This text is meant to explain the field in a bit more detail: The country [where] you come from. The question is: is this "where" needed there, can be used there (optional) or cannot be used there (error). ...

Auto-tab between fields on Django admin site

I have an inline on a model with data with a fixed length, that has to be entered very fast, so I was thinking about a way of "tabbing" through fields automatically when the field is filled... Could that be possible? ...

Can I change a private readonly field in C# using reflection?

I am wondering, since a lot of things can be done using reflection, can I change a private readonly field after the constructor completed its execution? (note: just curiosity) public class Foo { private readonly int bar; public Foo(int num) { bar = num; } public int GetBar() { return bar; } } Foo foo = new Foo(123); Consol...

jquery datepicker multiple instances

Hello veryone! I have made a RequestForQuote form, in which I give the possebility to add new positions to get RFQ'ed. In basics this is quite easy done via PHP in my case. Work realy fine. You may want to have a look. It is to be found at: my website Now I got infected with the jquery-virus and simply wanted to add the datepicker ui ...

How would you create and store user-defined custom fields in a SQL database?

I need to allow users to add new fields to a record, e.g. if there is a Contact record, a user may want to add a "SSN" numeric field and a "Birthdate" date/calendar field. They would do this through the UI of course. Those fields should then be available for entry for all contact records. Considering that my application runs for many ...