field

What are some efficient ways to combine two structures in MATLAB?

I want to combine two structures with differing fields names. For example, starting with: A.field1 = 1; A.field2 = 'a'; B.field3 = 2; B.field4 = 'b'; I would like to have: C.field1 = 1; C.field2 = 'a'; C.field3 = 2; C.field4 = 'b'; Is there a more efficient way than using "fieldnames" and a for loop? EDIT: Let's assume that in t...

Change the width of form elements created with ModelForm in Django

How can i change the width of a textarea form element if i used ModelForm to create it? Here is my product class: class ProductForm(ModelForm): long_desc = forms.CharField(widget=forms.Textarea) short_desc = forms.CharField(widget=forms.Textarea) class Meta: model = Product And the template code... {% for f in fo...

Maximum length of the textual representation of an IPv6 address?

I want to store the data returned by $_SERVER["REMOTE_ADDR"] in PHP into a DB field, pretty simple task, really. The problem is that I can't find any proper information about the maximum length of the textual representation of an IPv6 address, which is what a webserver provides through $_SERVER["REMOTE_ADDR"]. I'm not interested in con...

The Halting Problem in the Field

When have you ever personally come upon the halting problem in the field? This can be when a co-worker / boss suggested a solution which would violate the fundamental limits of computation, or when you realized yourself that a problem you were trying to solve was, in fact, impossible to solve. The most recent time I came up with it was ...

Java Vector Field (private member) accumulator doesn't store my Cows!

Edit: This code is fine. I found a logic bug somewhere that doesn't exist in my pseudo code. I was blaming it on my lack of Java experience. In the pseudo code below, I'm trying to parse the XML shown. A silly example maybe but my code was too large/specific for anyone to get any real value out of seeing it and learning from answers ...

When have you used dynamic programming in the field?

When have you ever directly applied the concepts of dynamic programming to solve a problem in the field? It's sometimes not evident how it can be applied when using it to solve a made-up instance of the knapsack problem. ...

How do I do boolean logic on two columns in MySql, one of which is a Varchar?

This is the sequel to this question. I would like to combine three columns into one on a MySql select. The first two columns are boolean and the third is a string, which is sometimes null. This causes strange results: Select *, (payment1_paid && ((payment2_paid || payment2_type ="none"))) as paid_in_full from payments Note: payment1_...

I'm a JS newb. How can I scale this?

Let me preface this by saying I'm a complete newb when it comes to front-end (and back-end, for that matter) development. Please keep that in mind. There. So I've got a form that's a few pages long. To traverse the form all I'm doing is showing and hiding container divs. The last page is a confirmation page before submitting. It takes t...

How to export / dump a MySql table into a text file including the field names (aka headers or column names)

In MySql's interpreter, it's very easy to dump a table to the screen along with its field names. There seems to be no simple way to export a table to a tab-delimted or CSV outfile including its column headers. I'm trying to do this using only SQL or the Linux command line, without writing a program in another language. Thank you ...

struts checkbox

I am trying to set the fieldValue of the check box to a value i got from the property tag. I am having trouble with the syntax this is what I tried <s:form id="myForm" method="post" action="removeUser" enctype="multipart/form-data"> <s:iterator value="myList"> <tr> <td><s:property value="id"/></td> <td><s:property ...

In a django form, How to make a field readonly (or disabled) so that it cannot be edited?

In a django form, How to make a field readonly (or disabled) so that it cannot be edited? When the form is being used for a new record entry, all fields are enabled, but when the record is in update mode some fields need to be readonly. For example, in the Item model, for a new record entry, all fields are editable, but while updating ...

Overriding fields or properties in subclasses

I have an abstract base class and I want to declare a field or a property that will have a different value in each class that inherits from this parent class. I want to define it in the baseclass so I can reference it in a base class method - for example overriding ToString to say "This object is of type property/field". I have got thr...

Multi-bit database field

I'm using a MSSQL database and would like to create a column that only has 4 possible values. Is there any way to define a 2-bit column? I see the bit datatype and then the next smallest is tinyint which is 1 full byte. If there is no such field, I'd be interesting in finding out why not. Thanks. ...

What is the best way to catch and show an error if user enters only whitespace in a form field in Django?

In Django 1.0, what is the best way to catch and show an error if user enters only whitespace (" ") in a form field? class Item(models.Model): description = models.CharField(max_length=100) class ItemForm(ModelForm): class Meta: model = Item if user enters only whitespace (" ") in description CharField, what change ne...

The 'invalid field type' error with TClientDataSets I don't understand

Hi I use nested database stuctures with TClientDataSets. I'm new to programming so my lingo is ten-to-one wrong. My problem is as follows: I defined my database stucture and all the fields of the nested stuctures and then I called the CreatDataSet method of the master clientDataSet and it worked. I then wanted to add another data fiel...

LINQ - Update null integer data field

I have got a field with data type int? price and allow null, when I set book.price = null; and update, it is not saved and does not throw any exceptions, when I change value # null, it is ok. I want set it null, plz help. ...

Keeping original format POST passing through AWK

I have an issue with using AWK to simply remove a field from a stream, illustrated below: 1 int blah (void) 2 { 3 if (foo) { 4 printf ("blah\n"); 5 } 6 return 0; 7 } I use the following code to remove the first field: $ awk '{ $1=""; print }' example.out int blah (void) ...

ReadOnly Property in Custom Column Types in Sharepoint

Hey all I'm creating a custom column in a feature for Sharepoint. It is essentially this: <Field Type="Integer" ID="<insert guid here>" ReadOnly="true" Name="xxx" DisplayName="XXX" Group="YYY" /> When the field is deployed and attached to a content type, the content type shows no instance of this field being attached....

MS Access Moving records into fields

I have an ODBC connection to a database I don't own and can't change. What I am looking to do is to make related records merge into one record. The relationship is a 1 to many. I have a student managment system and want to export a call out list which feeds an automated callout service (charged by Call). I want to be able to call a ...

Why won't anyone accept public fields in C#?

Seems like every C# static analyzer wants to complain when it sees a public field. But why? Surely there are cases where a public (or internal) field is enough, and there is no point in having a property with its get_ and set_ methods? What if I know for sure that I won't be redefining the field or adding to it (side effects are bad, rig...