Search Results

Search found 11632 results on 466 pages for 'field'.

Page 2/466 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to access a field's value via reflection (Scala 2.8)

    - by soc
    Consider the following code: class Foo(var name: String = "bar") Now i try to get the value and the correct type of it via reflection: val foo = new Foo val field = foo.getDeclaredField("name") field.setAccessible(true) //This is where it doesn't work val value = field.get(????) I tried things like field.get(foo), but that just returns an java.lang.Object but no String. Basically I need the correct type, because I want to invoke a method on it (e. g. toCharArray). What is the suggested way to do that?

    Read the article

  • Possible form field types per model field type

    - by Jonathan
    Django's documentation specifies for each model field type the corresponding default form field type. Alas, I couldn't find in the documentation, or anywhere else, what form field types are possible per model field type. Not all combinations are possible, right? Same question for widgets...

    Read the article

  • Prevent form field to be edited without disabling field

    - by Erick
    I am currently working on a page that has a date picker for one of the field. One of the requirements by my client is to prevent the user from editing the field manually. Only the date picker would be possible to be used. (jQuery DatePicker) I had in mind to disable the field and use an hidden field to store the data (disabled from object ton send data on post). This sounds a bit wacky for something that could be done by javascript I'm pretty sure. So the big question, in javascript is it possible to prevent manual edition of a field without stopping datepicker plugin?

    Read the article

  • c# reading integer fields from database, returning empty string when reading integer type field

    - by arnoldino
    what is wrong with this code? field="id"; table="MInvMonth"; condition="machine_id=37"; public static String getConditionedField(String field, String table, String condition) try { if (cmd == null) getConnection(); cmd.CommandText = "Select " + field + " from " + table + " where " + condition; SQLiteDataReader reader = cmd.ExecuteReader(); if (reader.HasRows==true) { reader.Read(); string s = reader[0].ToString(); // return first element reader.Close(); return s; } reader.Close(); return null; } catch (Exception e) { MessageBox.Show("Caught exception: " + e.Message+"|"+cmd.CommandText); return null; } I checked the sql statement, it turns the right value. why can't I read it? the returnvalue is "".

    Read the article

  • Reading int from a hidden field in .aspx

    - by vikp
    Hi, I'm struggling to read an int from the hidden field on aspx page. <input type = "hidden" id = "myIntegerId" name = "integerId" value= "<%: Model.MyObjectId %>" runat = "server" /> The value is definately on the form, I can see it in the debugger and print it with <%: % When I read the form values in the controller, instead of an int I recieve a following string: <%: Model.MyObjectId % I have tried casting data in the hidden field to string and calling ToString() method on that field, neither has worked. The data is submitted using the post event. I have a feeling that I'm missing something very basic... Any help is greately appreciated. Thanks

    Read the article

  • T-SQL Operations on a Calculated Date Field

    - by firedrawndagger
    Can I do WHERE operations on a calculated date field? I have a lookup field, which has been written badly in SQL and unfortunately I can't change it. But basically it stores dates as characters such as "July-2010" or "June-2009" (along with other non date data). I want to extract the dates first (which I did using a LIKE opertor) and then extract data based on a date range. SELECT BusinessUnit, Lookup, ReleaseDate FROM ( SELECT TOP 10 LookupColumn As Lookup, BU as BusinessUnit, CONVERT(DATETIME, REPLACE(LookupColumn,'-',' ')) as ReleaseDate FROM [dbo].[LookupTable] WHERE LookupColumn LIKE N'%-2010' ) MyTable ORDER BY ReleaseDate WHERE ReleaseDate = '2010-02-01' I'm having issues with WHERE operator. I would assume creating a subquery to encapsulate the calculated field would allow me to do operations with it such as WHERE but maybe I'm wrong. Bottom line is it possible to do operations on calculated fields?

    Read the article

  • GetValue on static field inside nested classes.

    - by Sir Gallahad
    Hi... I have the following class declared. I need to retreive the class structure and the static values without instanciate it. public MyClass() { public static string field = "Value"; public nestedClass() { public static string nestedField = "NestedValue"; } } I've successfuly used GetFields and GetNestedType to recover the class structure and GetValue(null) works fine on field, but not on nestedField. Let me sample: var fi = typeof(MyClass).GetField("field", BindingFlags.Public | BindingFlags.Static); var nt = typeof(MyClass).GetNestedType("nestedClass", BindingFlags.Public); var nfi = nt.GetField("nestedField", BindingFlags.Public | BindingFlags.Static); // All the above references are detected correctly var value = fi.GetValue(null); // until here everything works fine. value == "Value" var nestedValue = nfi.GetValue(null); // this one does not work!! Anyone knows why the last line does not work and how to work around? Thanks.

    Read the article

  • How to convert many-to-one XML data to DataSet?

    - by TruMan1
    I have an XML document that has a collection of objects. Each object has a key/value pair of label and value. I am trying to convert this into a DataSet, but when I do ds.ReadXml(xmlFile), then it creates two columns: label and value. What I would like is to have a column for each "label" and the value to be part of the row. here is my sample of the XML: <responses> <response> <properties id="1" Form="Account Request" Date="Tuesday, March 16, 2010 5:04:26 PM" Confirmation="True" /> <fields> <field> <label>Name</label> <value>John</value> </field> <field> <label>Email</label> <value>[email protected]</value> </field> <field> <label>Website</label> <value>http://domain1.com</value> </field> <field> <label>Phone</label> <value>999-999-9999</value> </field> <field> <label>Place of Birth</label> <value>Earth</value> </field> <field> <label>Misc</label> <value>Misc</value> </field> <field> <label>Comments</label> <value /> </field> <field> <label>Agree to Terms?</label> <value>True</value> </field> </fields> </response> <response> <properties id="2" Form="Account Request" Date="Tuesday, March 17, 2010 5:04:26 PM" Confirmation="True" /> <fields> <field> <label>Name</label> <value>John2</value> </field> <field> <label>Email</label> <value>[email protected]</value> </field> <field> <label>Website</label> <value>http://domain2.com</value> </field> <field> <label>Phone</label> <value>999-999-9999</value> </field> <field> <label>Place of Birth</label> <value>Earth</value> </field> <field> <label>Misc</label> <value>Misc</value> </field> <field> <label>Comments</label> <value /> </field> <field> <label>Agree to Terms?</label> <value>True</value> </field> </fields> </response> <response> <properties id="3" Form="Account Request" Date="Tuesday, March 18, 2010 5:04:26 PM" Confirmation="True" /> <fields> <field> <label>Name</label> <value>John3</value> </field> <field> <label>Email</label> <value>[email protected]</value> </field> <field> <label>Website</label> <value>http://domain3.com</value> </field> <field> <label>Phone</label> <value>999-999-9999</value> </field> <field> <label>Place of Birth</label> <value>Earth</value> </field> <field> <label>Misc</label> <value>Misc</value> </field> <field> <label>Comments</label> <value /> </field> <field> <label>Agree to Terms?</label> <value>True</value> </field> </fields> </response> <response> <properties id="4" Form="Account Request" Date="Tuesday, March 19, 2010 5:04:26 PM" Confirmation="True" /> <fields> <field> <label>Name</label> <value>John</value> </field> <field> <label>Email</label> <value>[email protected]</value> </field> <field> <label>Website</label> <value>http://domain4.com</value> </field> <field> <label>Phone</label> <value>999-999-9999</value> </field> <field> <label>Place of Birth</label> <value>Earth</value> </field> <field> <label>Misc</label> <value>Misc</value> </field> <field> <label>Comments</label> <value /> </field> <field> <label>Agree to Terms?</label> <value>True</value> </field> </fields> </response> </responses> How would I convert this to a DataSet so that I can load it into a gridview with the columns: Name, Email, Website, Phone, Place of Birth, Misc, Comments, and Agree to Terms? Then row 1 would be: John, [email protected], http://domain1.com, 999-999-9999, Earth, Misc, , True How can I do this with the XML provided?

    Read the article

  • When your field-terminating char appears within field values

    - by Jonathan Sampson
    I've had a very colorful morning learning the innerparts of Linux's sort command, and have come across yet another issue that I can't seem to find an answer for in the documentation. I'm currently using -t, to indicate that my fields are split by the comma character, but I'm finding that in some of my files, the comma is used (between double-quotes) within values: Jonathan Sampson,,[email protected],0987654321 "Foobar CEO,","CEO,",[email protected],, How can I use a comma to terminate my fields, but ignore the occurences of it within values? Is this fairly simple, or do I need to re-export all of my data using a more-foreign field-terminator?

    Read the article

  • SQL SERVER – Backing Up and Recovering the Tail End of a Transaction Log – Notes from the Field #042

    - by Pinal Dave
    [Notes from Pinal]: The biggest challenge which people face is not taking backup, but the biggest challenge is to restore a backup successfully. I have seen so many different examples where users have failed to restore their database because they made some mistake while they take backup and were not aware of the same. Tail Log backup was such an issue in earlier version of SQL Server but in the latest version of SQL Server, Microsoft team has fixed the confusion with additional information on the backup and restore screen itself. Now they have additional information, there are a few more people confused as they have no clue about this. Previously they did not find this as a issue and now they are finding tail log as a new learning. Linchpin People are database coaches and wellness experts for a data driven world. In this 42nd episode of the Notes from the Fields series database expert Tim Radney (partner at Linchpin People) explains in a very simple words, Backing Up and Recovering the Tail End of a Transaction Log. Many times when restoring a database over an existing database SQL Server will warn you about needing to make a tail end of the log backup. This might be your reminder that you have to choose to overwrite the database or could be your reminder that you are about to write over and lose any transactions since the last transaction log backup. You might be asking yourself “What is the tail end of the transaction log”. The tail end of the transaction log is simply any committed transactions that have occurred since the last transaction log backup. This is a very crucial part of a recovery strategy if you are lucky enough to be able to capture this part of the log. Most organizations have chosen to accept some amount of data loss. You might be shaking your head at this statement however if your organization is taking transaction logs backup every 15 minutes, then your potential risk of data loss is up to 15 minutes. Depending on the extent of the issue causing you to have to perform a restore, you may or may not have access to the transaction log (LDF) to be able to back up those vital transactions. For example, if the storage array or disk that holds your transaction log file becomes corrupt or damaged then you wouldn’t be able to recover the tail end of the log. If you do have access to the physical log file then you can still back up the tail end of the log. In 2013 I presented a session at the PASS Summit called “The Ultimate Tail Log Backup and Restore” and have been invited back this year to present it again. During this session I demonstrate how you can back up the tail end of the log even after the data file becomes corrupt. In my demonstration I set my database offline and then delete the data file (MDF). The database can’t become more corrupt than that. I attempt to bring the database back online to change the state to RECOVERY PENDING and then backup the tail end of the log. I can do this by specifying WITH NO_TRUNCATE. Using NO_TRUNCATE is equivalent to specifying both COPY_ONLY and CONTINUE_AFTER_ERROR. It as its name says, does not try to truncate the log. This is a great demo however how could I achieve backing up the tail end of the log if the failure destroys my entire instance of SQL and all I had was the LDF file? During my demonstration I also demonstrate that I can attach the log file to a database on another instance and then back up the tail end of the log. If I am performing proper backups then my most recent full, differential and log files should be on a server other than the one that crashed. I am able to achieve this task by creating new database with the same name as the failed database. I then set the database offline, delete my data file and overwrite the log with my good log file. I attempt to bring the database back online and then backup the log with NO_TRUNCATE just like in the first example. I encourage each of you to view my blog post and watch the video demonstration on how to perform these tasks. I really hope that none of you ever have to perform this in production, however it is a really good idea to know how to do this just in case. It really isn’t a matter of “IF” you will have to perform a restore of a production system but more of a “WHEN”. Being able to recover the tail end of the log in these sever cases could be the difference of having to notify all your business customers of data loss or not. If you want me to take a look at your server and its settings, or if your server is facing any issue we can Fix Your SQL Server. Note: Tim has also written an excellent book on SQL Backup and Recovery, a must have for everyone. Reference: Pinal Dave (http://blog.sqlauthority.com)Filed under: Notes from the Field, PostADay, SQL, SQL Authority, SQL Performance, SQL Query, SQL Server, SQL Tips and Tricks, T SQL

    Read the article

  • Field symbol and Data reference in SAP-ABAP

    - by PDP-21
    If we compare field symbol and data refernece with that of the pointer in C i concluded that :- In C language, Say we declare a variable "var" type "Integer" with default value "5". The variable "var" will be stored some where in the memory and say the memory address which holds this variable is "1000". Now we define a pointer "ptr" and this pointer is assigned to our variable. So, "&ptr" will be "1000" and " *ptr " will be 5. Lets comapre the above situation in SAP ABAP. Here we declare a Field symbol "FS" and assign that to the variable "var". Now my question is what "FS" holds ? I have searched this rigorously in the internet but found out many ABAP consultants have the opinion that FS holds the address of the variable i.e. 1000. But that is wrong. While debugging i found out that fs holds only 5. So fs (in ABAP) is equivalent to *ptr (in C). Please correct me if my understanding is wrong. Now lets declare a data reference "dref" and another filed symbol "fsym" and after creating the data reference we assign the same to field symbol . Now we can do operations on this field symbol. So the difference between data refernec and field symbol is :- in case of field symbol first we will declare a variable and assign it to a field symbol. in case of data reference first we craete a data reference and then assign that to field symbol. Then what is the use of data reference? The same functionality we can achive through field symbol also.

    Read the article

  • Display SharePoint lookup field on publishing website

    - by Slace
    A page within our MOSS publishing website has a property which is a lookup field. I only want the selected text to be displayed when you view the page not in edit mode, but when I use the Microsoft.SharePoint.WebControls.LookupField it generates a hyperlink to the SharePoint list item (obviously bad). Is there a way around this, short of creating my own lookup field control?

    Read the article

  • SAS: rearrange field order in data step

    - by Dan
    In SAS 9, how can I in a simple data step, rearrange the order the field. Data set2; /*Something probably goes here*/ set set1; run; So if set1 has the following fields: Name Title Salary A Chief 40000 B Chief 45000 Then I can change the field order of set2 to: Title Salary Name Chief 40000 A Chief 45000 B Thanks, Dan

    Read the article

  • Remove Field Heading in Crystal Reports

    - by Juergen
    Hi, I have a crystal report designer problem: In my report is a field I want to display. But I don't want the field heading to be displayed. How can I suppress this? It looks like this: myFieldHeading FieldValue1 FieldValue2 FieldValue3 But I want just that: FieldValue1 FieldValue2 FieldValue3 How can I do that? bye juergen

    Read the article

  • Variable for the field name of mysql row result

    - by ana
    I'm retrieving a row with php from mysql and it has fields like: name_en, name_es, name_de... I want to retrieve the right field base on my $lang variable (en, es, de...). If the $lang variable is 'es', I'd need to get $row['name_es']. I've tried this (based on this thread), but it's not working: $name = $row->{'name_'.$lang}; Any idea how can I use a variable as the name of the field of a row? Thanks in advance for your help!

    Read the article

  • How to access a field's value in an object using reflection

    - by kentcdodds
    My Question: How to overcome an IllegalAccessException to access the value of a an object's field using reflection. Expansion: I'm trying to learn about reflection to make some of my projects more generic. I'm running into an IllegalAccessException when trying to call field.getValue(object) to get the value of that field in that object. I can get the name and type just fine. If I change the declaration from private to public then this works fine. But in an effort to follow the "rules" of encapsulation I don't want to do this. Any help would be greatly appreciated! Thanks! My Code: package main; import java.lang.reflect.Field; public class Tester { public static void main(String args[]) throws Exception { new Tester().reflectionTest(); } public void reflectionTest() throws Exception { Person person = new Person("John Doe", "555-123-4567", "Rover"); Field[] fields = person.getClass().getDeclaredFields(); for (Field field : fields) { System.out.println("Field Name: " + field.getName()); System.out.println("Field Type: " + field.getType()); System.out.println("Field Value: " + field.get(person)); //The line above throws: Exception in thread "main" java.lang.IllegalAccessException: Class main.Tester can not access a member of class main.Tester$Person with modifiers "private final" } } public class Person { private final String name; private final String phoneNumber; private final String dogsName; public Person(String name, String phoneNumber, String dogsName) { this.name = name; this.phoneNumber = phoneNumber; this.dogsName = dogsName; } } } The Output: run: Field Name: name Field Type: class java.lang.String Exception in thread "main" java.lang.IllegalAccessException: Class main.Tester can not access a member of class main.Tester$Person with modifiers "private final" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:95) at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:261) at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:253) at java.lang.reflect.Field.doSecurityCheck(Field.java:983) at java.lang.reflect.Field.getFieldAccessor(Field.java:927) at java.lang.reflect.Field.get(Field.java:372) at main.Tester.reflectionTest(Tester.java:17) at main.Tester.main(Tester.java:8) Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds)

    Read the article

  • What is @namespace field in C# class?

    - by MainMa
    Hi, I'm browsing the source code of StyleCop, and I found a curious thing: /// <summary> /// The namespace that the rule is contained within. /// </summary> private string @namespace; // [...] internal Rule(string name, string @namespace, string checkId, string context, bool warning) : this(name, @namespace, checkId, context, warning, string.Empty, null, true, false) { Param.Ignore(name, @namespace, checkId, context, warning); } What is this thing? Is it just a simple field where at-sign is used to indicate that it is a field, and not a namespace keyword? If so, may at-sign be used for any reserved word (for example @dynamic, @using, etc.)?

    Read the article

  • Can't search in a certain field using solR

    - by intrance
    Hi, I'm setting up an environment using Nutch 1.0 + solR 1.4. In Nutch I configured the subcollection plugin which seems to work nicely. If I search as normal adding fl=* I can see the subcollection field is filled as intented. (something like <str name="subcollection">mysite.com</str>). My problem is, I would like to be able to search only in one or more given subcollections, but whenever my searchquery is something like q=subcollection:mysite.com it won't work. I've also tried to add a fl=* or searched in mysite* instead but I never get any results. Obviously solR "knows" the subcollection field, as it doesn't result with an error but simply whith an empty result. I'd be glad for any help

    Read the article

  • JPA generic field

    - by m.ugues
    Hallo all Is it possible to persist a generic field? I have this property on an Entity class ... private T payload; ... T extends EventMessagePayload and public interface StringPayload extends EventMessagePayload{ String getPayload(); } In my application i persist the field only when is of String type and during the save operation all works great. When I read the object instead JPA try to create a String object but instead is a StringPaylod. Is there a way to intercept the creation and handle the object marshalling? Kind regards Massimo

    Read the article

  • How to detect hidden field tampering?

    - by Myron
    On a form of my web app, I've got a hidden field that I need to protect from tampering for security reasons. I'm trying to come up with a solution whereby I can detect if the value of the hidden field has been changed, and react appropriately (i.e. with a generic "Something went wrong, please try again" error message). The solution should be secure enough that brute force attacks are infeasible. I've got a basic solution that I think will work, but I'm not security expert and I may be totally missing something here. My idea is to render two hidden inputs: one named "important_value", containing the value I need to protect, and one named "important_value_hash" containing the SHA hash of the important value concatenated with a constant long random string (i.e. the same string will be used every time). When the form is submitted, the server will re-compute the SHA hash, and compare against the submitted value of important_value_hash. If they are not the same, the important_value has been tampered with. I could also concatenate additional values with the SHA's input string (maybe the user's IP address?), but I don't know if that really gains me anything. Will this be secure? Anyone have any insight into how it might be broken, and what could/should be done to improve it? Thanks!

    Read the article

  • django hidden field error

    - by dana
    hi, there, i'm building a message system for a virtual community, but i can't take the userprofile id i have in views.py def save_message(request): if request.method == 'POST': form = MessageForm(request.POST) if form.is_valid(): new_obj = form.save(commit=False) new_obj.sender = request.user u = UserProfile.objects.get(request.POST['userprofile_id']) new_obj.owner = u new_obj.save() return HttpResponseRedirect('.') else: form = MessageForm() return render_to_response('messages/messages.html', { 'form': form, }, context_instance=RequestContext(request)) and the template: {% block primary %} <form action="." method="post"> {{ form.as_p }} <p><input type="hidden" value="{{ userprofile.id }}" name = "owner" /></p> <p><input type="submit" value="Send Message!" /></p> </form> {% endblock %} forms.py: class MessageForm(ModelForm): class Meta: model = Messages fields = ['message'] models.py: class Messages(models.Model): message = models.CharField(max_length = 300) read = models.BooleanField(default=False) owner = models.ForeignKey(UserProfile) sender = models.ForeignKey(User) I don't figure out why i get this error,since i'm just trying to get the profileId of a user, using a hiddeen field. the error is: Key 'UserProfile_id' not found in <QueryDict: {u'owner': [u''], u'message': [u'fdghjkl']}> and i'm getting it after i fill out the message text field. Thanks!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >