field

Compare fields of two unrelated objects

泪湿孤枕 提交于 2019-12-25 07:46:41
问题 I've got two objects of different classes that share some fields with the same name and type. These two objects are not related to each other. There's no possibility for me to create an interface or a parent class. Now I want to compare those shared fields and as far as I know this should be possible using reflection. These are the steps I've written for such a compare method: Field[] inputFields = input.getClass().getDeclaredFields(); for (Field field : inputFields ) { log.info(field.getName

Get custom attribute from specific object property/field

╄→гoц情女王★ 提交于 2019-12-25 07:30:01
问题 I've been searching for a while now and tested several methods, but i didn't find the answer i was looking for. I'll try to explain. I have an object with several fields/properties. These properties have custom attributes. What i want is to get the custom attribute from a specific propertie without all the knowlege of the object. The are the base classes // FieldAttr has a public Text propery public class TestObject { // Declare fields [FieldAttr("prop_testfld1")] public FLDtype1 testfld1 =

Java Combobox, Managing 2 fields from database

谁都会走 提交于 2019-12-25 06:33:58
问题 I want to get a result set with 2 fields from my DB. rs=Con.sqlQueryTable("Select id_prov, name_prov from prov"); And then I want to show the field called "name_prov" in the comboBox (As the item). But I also want to have my "id_prov" which is the ID (PRIMARY KEY) as the value for this item. This serves for the purpose of relating the name (of the providers in this case) with its ID just by using the combobox. This is the code of the JComboBox event FocusGained that Im currently using. try {

Solr - Boosting result if query is found in a special field

删除回忆录丶 提交于 2019-12-25 05:14:58
问题 I am wondering if it is possible with Solr 3.4 to boost a search result, if the query is found in a special field without using the "fieldname:query"-syntax. Let me explain: I have several fields in my index. One of it is named "abbreviation" and is filled with text like AVZ, JSP, DECT, ... To be able to find results when searching purely for "AVZ" I added a <copyField source="abbreviation" dest="text"/> in my schema.xml. The field text is my defaultSearchField. This is not the best solution

Php: on submit echo td fields and ad new td

自闭症网瘾萝莉.ら 提交于 2019-12-25 04:39:11
问题 I have the following code: <form action="" method="POST"> <?php $count = isset($_POST['count']) ? $_POST['count'] : 1; if($count > 11) $count = 11; ?> <table> <!-- Keeps track of the current number of rows --> <input type="hidden" name="count" value="<?php echo $count+1; ?>"/> <?php for($i = 0; $i < $count; $i++): // Loop through all rows gathering the data here, and then creating the fields below $val0 = isset($_POST['field'][$count]['0']) ? $_POST['field'][$count]['0'] : ''; $val1 = isset($

Is there a way to customize how the value for a custom Model Field is displayed in a template?

浪尽此生 提交于 2019-12-25 04:28:05
问题 I am storing dates as an integer field in the format YYYYMMDD, where month or day is optional. I have the following function for formatting the number: def flexibledateformat(value): import datetime, re try: value = str(int(value)) except: return None match = re.match(r'(\d{4})(\d\d)(\d\d)$',str(value)) if match: year_val, month_val, day_val = [int(v) for v in match.groups()] if day_val: return datetime.datetime.strftime(datetime.date(year_val,month_val,day_val),'%b %e, %Y') elif month_val:

Is there a way to customize how the value for a custom Model Field is displayed in a template?

空扰寡人 提交于 2019-12-25 04:28:03
问题 I am storing dates as an integer field in the format YYYYMMDD, where month or day is optional. I have the following function for formatting the number: def flexibledateformat(value): import datetime, re try: value = str(int(value)) except: return None match = re.match(r'(\d{4})(\d\d)(\d\d)$',str(value)) if match: year_val, month_val, day_val = [int(v) for v in match.groups()] if day_val: return datetime.datetime.strftime(datetime.date(year_val,month_val,day_val),'%b %e, %Y') elif month_val:

PHP print SQL field names as array with corresponding values showing once per row

陌路散爱 提交于 2019-12-25 04:15:44
问题 Have a SQL table like this: Titles Device1 Device2 Device3 Title1 inputA inputA inputB Title2 inputA inputB inputC Title3 inputB inputB inputB I want the values inputA, inputB, inputC to each appear once in each row with their corresponding fields, Device1, Device2, Device3, appearing as an array following the "input" values like this: Titles header1 header2 header3 Title1 inputA: inputB: Device1 Device3 Device2 Title2 inputA: inputB: inputC: Device1 Device2 Device3 Title3 inputB: Device1

Problem getting text field as string from MySQL with PHP

孤者浪人 提交于 2019-12-25 03:26:43
问题 I'm having this problem that's driving me nuts. I've got a MySQL database in which there is a table that contains a text field. I am querying the table in PHP and trying to put the content of the text field for each row into a var. I am doing something like this: for ($i=0;$i<$nbrows;$i++){ $id = $data[$i]['ID']; $description = $data[$i]['DESCRIPTION']; $mystring .= '<div>'.$id.': '.$description.'</div>'; } DESCRIPTION is my text field. I'll pass on the details. The $data array is built from

enable/disable input fields with checkboxes (javascript)

…衆ロ難τιáo~ 提交于 2019-12-25 02:47:39
问题 I'm trying to make a html5 form with different input fields, with a checkbox that can enable/disable input fields. When the checkbox is selected, it should be possible to enter data into an input field. When the checkbox isn't selected, it shouldn't be possible to enter data to the input field. I already tried this (just to try if enabling/disabling works): <script> document.getElementById("checkbox").onclick = function() { document.getElementById("inputfield").disabled=true; } </script> The