FAQ Database Discussion Community


Java Reflection - get the name of a field from a set method

java,reflection,field,setter
i started to work with java reflection I started to create my own personal working methods, including a method that takes all the setter of a class. Now I find myself in the bizarre situation of wanting to take the name of the field of methods set, i try to...

Typo3: page link in menu using value from custom record

menu,hyperlink,field,typo3,record
I have : a 3 level menu custom records from a table called "tx_products_domain_model_product" products have a field called "url_alias" On any page on that menu, I can have a product record. For pages that have a product record I want the link to look like: http://www.sitedomain.com/<url_alias> Can this be...

Should I use Point.x or Point.getX()?

java,field,point,getter
I have a Point. I am trying to get x as an int. If I use Point.x, I will get x as an int. But I am under the impression that I should be using a getter whenever possible (Why use getters and setters?). The issue with Point.getX() is that...

Django update form according to another field form

django,forms,field
I have the following Django form : label = forms.CharField(label="Label", min_length=2, max_length=100, required=True, widget=forms.TextInput(attrs={'class': 'form-control input-sm'})) hour = forms.ChoiceField(label="Hour", choices=choice_hour, required=True, widget=forms.Select(attrs={'class': 'form-control input-sm'})) minute = forms.ChoiceField(label="Minute", choices=choice_minute, required=True, widget=forms.Select(attrs={'class': 'form-control input-sm'})) period = forms.MultipleChoiceField(label="Day of week",...

Python convert JSON to CSV

python,json,csv,field,converter
i have a JSON file which contains: { "leaderboard": { "$": [ { "userId": 1432024286216, "userName": "Joe Bloggs", "score": 111111, "gameType": "standard", "dateCreated": 1432024397833, "_id": 1432024397833 }, { "userId": 1432024626556, "userName": "Jane Bloggs", "score": 222222, "gameType": "demo", "dateCreated": 1432024730861, "_id": 1432024730861 } ] }, "users": { "$": [ { "userId_U":...

Animating plugin when switching or tabbing through form fields

forms,animation,plugins,field
I'm looking for a jQuery or so plugin that shows a quick animation between form fields, when you click or tab through them.

In immutable class why fields are marked as private?

java,oop,field,private,immutability
What is the benefit of making fields private while creating an immutable class? I have seen why while creating immutable class, fields are declared as private? but I didn't get understand anything from this post. Can anybody please explain me the same?...

PHP: Get list of private fields of a class (not instance!)

php,field,private
How can I iterate the private fields of a class without having an instance of it but just the class name? get_object_vars requires an existing instance.

Symfony2 : How to remove form field in listener, after submit

forms,symfony2,events,field,listener
Im facing a problem in a FormType I have. based on the "Product" entity, this from has a field called "ProductCriteria", which is a collection based on "ProductCriteriaType" (Form). My productCriteria Model hold a "deleted" attribute that handles the logic suppression of this entity. If it is set to true,...

How to test for existence of a specific set of fields in a table

sql,sql-server,tsql,field
I want to be able to test if a table has a specific set of fields (I'll settle for name comparison only; of course, types/lengths/etc could have been changed). I see that testing for existence of individual fields is not that difficult, but the table I am dealing with has...

Search engine with multiple keywords

php,search,field,keyword,result
I have a search engine that is working , but only when I search 1 word. Whenever I search multiple keywords I only get 1 result. Example : In my database I have tags like 'test' and 'hello' ; Whenever I enter "test hello" and click "Search" it displays :...

django rest framework field level validation in form

django,validation,field,django-rest-framework
I am using ModelViewSet and TemplateHTMLRenderer to use the form and process 'post' method. When I tried render a field error, the error rendered [u'This field may not be blank.']. How can I make it render the simple message 'This...'? in html, <form action="." method="post" id="myform"> <input name="first_name" type="text"> <ul>...

Properties and auto-implementations

c#,properties,field
I'm using .NET 4.5 in a VSTO addin for outlook 2013. I'm having some trouble fully grasping properties and accessors. Auto-implemented accessors which I assume are when you just write get; set; rather than get { //code }, etc. are also giving me trouble. I have a dictionary I use...

Is it the best option to convert a java interface with static fields in a abstract class in c#?

java,c#,interface,field,abstract-class
public interface IHashStorage<T> { public static final float INITIAL_LOAD_FACTOR = 0.7f; public static final int INITIAL_CAPACITY = 149; } I have the code above which needs to be translated in c#. The only solution that seems to be proper is to make it an abstract class.From what I found it's...

Moving all fields info from one object to another

java,oop,object,field
Can I somehow move all field values from one object to another without using reflection? So, what I want to do is something like this: public class BetterThing extends Thing implements IBetterObject { public BetterThing(Thing t) { super(); t.evolve(this); } } So, the evolve method would evolve one class to...

extracting particular fields of each record from input file into key/value pairs in apache spark

apache,key,field,apache-spark,value
The following is the input file to Apache spark processing. each record contains four fields as shown. User ID Movie ID Rating Date 6 9217 2 2005-04-28 00:00:00.000 6 9254 4 2005-04-20 00:00:00.000 6 9330 4 2004-11-17 00:00:00.000 6 9330 5 2004-09-27 00:00:00.000 6 1615 4 2004-09-15 00:00:00.000 6 1659...

Month field on EXTJS 5.1

extjs,field,extjs5,monthcalendar
I got this awesome fiddle https://fiddle.sencha.com/#fiddle/h5i from another stack overflow post (thanks igor). BUT I have one problem: the code doesn't work if I select extjs version 5.1, which is the version I use in my application. The problem is that when I click on a month or a year,...

how to fire a salesforce trigger only if we update a custom field

triggers,salesforce,field,updates
Is there way to create trigger on salesforce custom object that will be fired only if we update one custom field and not every time we update the whole object

Update result based on many fields condition in excel

excel,field,row,cell
I currently have raw data as below OID Version Type RAW RESULT 6064 2842 154 failed 6064 2843 154 passed 6064 2844 154 failed 544448 837 154 failed 544448 838 154 failed 544448 839 154 passed 544448 840 154 failed 544448 841 154 failed I'd like to have following result...

How to prohibit making a copy of a public field or property in C#

c#,properties,field,wrapper
Is it possible to prohibit making a reference copy of a public field or property like in the following example? Foo foo = new Foo(); foo.bar.DoSomething(); // That's fine Bar myRefToBar = foo.bar; // Don't allow this! When "bar" gets exchanged inside "foo", "myRefToBar" will still point to the original...

CKAN - Extra fields not displayed in additonal info after typing in values and updating dataset form

field,ckan,extra
I followed these steps (http://docs.ckan.org/en/latest/extensions/adding-custom-fields.html) in the documentation to add extra fields in the Dataset From. I was able to get the extra fields displayed in "manage" page of dataset form. However, after I type in the value for the extra field and update the dataset form, the extra field...

How to hide a field on a one2many in openerp?

xml,field,openerp
I have customize the sale order menu in openerp making it into two menus named as "Local" and the other one is "Export". I add some field at sale.order class: 'is_local' : fields.boolean('Local'), #Default as true if user clicked the Local menu. 'is_export' : fields.boolean('Export'), #Default as true if user...

Java hashCode, artificial fields?

java,field,hashcode
Imagine the following problem: // Class PhoneNumber implements hashCode() and equals() PhoneNumber obj = new PhoneNumber("mgm", "089/358680"); System.out.println("Hashcode: " + obj.hashCode()); //prints "1476725853" // Add PhoneNumber object to HashSet Set<PhoneNumber> set = new HashSet(); set.add(obj); // Modify object after it has been inserted obj.setNumber("089/358680-0"); // Modification causes a different hash...

How to validate form using several functions in javascript

javascript,validation,field
The two function work perfectly but im only able to use one at a time, the form should check password and link the user to other pages based on the selected radio button. Is there a way to make it work?? Function to verify password. function check() { var password=document.getElementById('password');...

Registering object field values Java

java,class,object,constructor,field
I've recently started programming with Java and I like to know if there is a way to register(like put in array or something) certain object field values. In this case, for example all "name" values(private final String name) of created objects. Any help would be greatly appreciated. public class Item...

How can i get form->field() value?

forms,field,yii2
In short, i have following code: <?= $form->field( $isntmodel, 'id')->textInput() ?> <?= Html::a('<i class="mdi-action-done"></i>', ['add-item', 'id' => ???], [ 'class' => 'btn-btn-add pull-right', ]) ?> This code is wrong. So. I need get value which will input by user. And set it instead ??? $form->field() must have $model, $attribute, $options...

any way to format date with function field odoo?

date,field,openerp,odoo
is there a way to display date field in different format on the view of odoo/openerp ? I tried using function fields as the follow lines: def _format_date(self, cr, uid, ids, field_name, arg, context=None): res = {} for line in self.browse(cr, uid, ids, context=context): res[line.id]= { 'date_fin':'', } print line.id,'date...

Searching file for a string in the first field depending on the input from another file and piping the result to new file

linux,awk,sed,field,piping
I have an input file like below Model related text Model specifications *ELEMENT_SHELL $# eid pid n1 n2 n3 n4 n5 n6 n7 n8 76737 1 79322 79323 79324 79511 0 0 0 0 76738 1 79510 79203 79204 79512 0 0 0 0 76739 1 79511 79324 79325 79513...

How to do a CSV record split [duplicate]

arrays,perl,csv,split,field
This question already has an answer here: How do I efficiently parse a CSV file in Perl? 7 answers I need to get a specific field from a CSV file and put it in an array. I am not sure how to do this. This is what I have...

SQL How to select distinct value from multiple fields

sql,ms-access,select,field,distinct
In the database(of tutor profiles), each tutor can teach up to 3 subjects, hence I've created 3 fields--Subject1,Subject2 & Subject3-- for each tutor. In my case, I would like to retrieve each specific subject within the 3 fields and add them to my combo box in my program for a...

Cocos2dx 3.4 - manipulating user input

text,input,user,field,cocos2d-x
I am working on a breakout-type game using Cocos2dx, and I need some help, as I am a complete novice. Currently I need to make a highscore table. After the game is finished, I'd like to display a page, where player types his username into text field. The problem is...

Sql query; sum fields

php,sql,sum,field
I'm stuck on a sum in sql. What I'm trying to do is the following: I have a table which stores id's of items. Those id's are linked to another table 'library' with the description, the names and the points of those items. Now I need to grab some different...

JAVA How to change instance fields values without copying new instance reference [duplicate]

java,field,instance
This question already has an answer here: How do I copy an object in Java? 19 answers Let say I have class A public class A { private int field1; private String field2; ... } I create new Instance of A, then second Instance of A: A a1 =...

adding field into Document with curl CouchDB

couchdb,field,add,couchdb-futon
I want to update or insert a filed in my document in CouchDB without a new rev number. Is that possible with curl ? For example like Futon. If i open a document with futon and add a new field or update a filed its done without a new revision...

how to get fields from a pojo dynamically

java,variables,field,pojo
Below is my POJO class which has 50 fields with setters and getters. Class Employee{ int m1; int m2; int m3; . . int m50; //setters and getters From my another class I need to get all these 50 fields to get their sum Employee e1 =new Emploee(); int total...

How do you make the input text disappear?

html,text,input,field,hide
I have an input field in which you can type some text. It has some default text: <input type="text" id="text" value="Type some text here" maxlength="35" tabindex="10"> I want to make the default text disappear when the user clicks on the default text or inside the input field. How can I...

JS: name of last input element (HMTL/PHP) [closed]

javascript,php,jquery,html,field
I better make a list in order to explain the steps that I would like to do: Get the name of the last element of the html-input (has been generated via PHP) The basic setting looks like this: <input type='text'name='E_8' value= '123' /> <input type='text'name='E_9' value= '456' /> <input type='text'name='E_10'...

Laravel 5: Models, field names and localization

model,localization,field,laravel-5
I got a model with some fields, one field is, for example "postal_code", and the field is required. I've also create a form. It the field is not filled, the validator creates an error message: The postal code field is required. If the locale is de, it will be: postal...

C# learner: What actually happens when i access an array[indexed] value vs direct value

c#,arrays,field
i like understanding how things work and i can't seem to find a simple explanation with google. public class Understanding { public int[] array = new[] {5, 6, 7}; public int x = 5; public int y = 6; public int z = 7; } for example, if i access...

Woocommerce custom checkout field based on country

woocommerce,field,checkout
I have an ecommerce webiste using woocommerce In the checkout page I need to activate a custom required field "Codice Fiscale" if the billing country is set to "Italy", otherwise that extra field must be removed The code in my child theme functions.php is add_filter( 'woocommerce_checkout_fields' , 'field_cfpiva1' ); function...

Validation for float number in php

php,validation,text,field
How can I validate to enter only float numbers from 1.0 -5.0? My system right now can accept: negative float negative integers symbols like +, it is not displayed in the database letters like a, it is not displayed in the database. Below I have some code for checking to...

Checking for input live/with key strokes in HTML input field with jQuery

jquery,html,forms,field,live
I need to find a way to hide the span with the ID 'forgot' as soon as the field has any input. The only time the 'forgot' span should be visible is when the field is empty. <form> <input type="text" name="username" placeholder="Username or E-mail" autofocus><br> <input type="password" name="password" id='pass' placeholder="Password"><br>...

Matlab: How to plot data from n number of structures

matlab,dynamic,structure,field
I am working on a matlab script that has the following structures: Parameters1, Parameters2, Parameters3 etc until ParametersN. I would like to access two fields within each structure (e.g. x and y) so that I can plot the data. I would like to overlay the x and y data from...

how to add a related field many2one?

field,openerp,odoo
I have a field on stock_picking table I would like to relate it with stock_move _inherit= 'stock.picking' _columns={ 'user_id': fields.many2one('res.users', 'user', select=True), } I would like to relate the field user_id with stock_move I tried this _inherit= 'stock.move' _columns={ 'user_id': fields.related('picking_id', 'user_id', relation="res.users", type='many2one', string="user", store=True, readonly=True) } any Idea...

django: disable tinymce for one certain field

python,django,tinymce,field
I have a lot of models with tinymce(django-tinymce) enabled by default for TextFields and this is ok. But for one field I don't want to apply tinymce widget (in admin interface). Please tell me how do I implement that? class Page(models.Model): one = models.TextField() two = models.TextField() three = models.TextField()...

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

php,mysql,switch-statement,field
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"...

Java reflection - get field value

java,reflection,field
I try make class which generate new className.java file using reflection. I have problem with Fields value. Here is my test class. public class ClassTest { @Deprecated private int a; public int[] b; private final String c = "Hi"; ... } Method in which I try generate fields. private void...

web2py displays id too

python,database,field,web2py
I got this code in default.py : form_0 = SQLFORM(db.base_folder, record=db.base_folder(1)) query = db.base_folder.folder != '' set = db(query) rows = set.select() if rows: form_0.vars.folder = rows[0]['folder'] and in db.py : db.define_table( 'base_folder', Field('folder', type='string', default='You need to set up a directory to backup to !', ), format='%(folder)s' ) and...

yii2 show hidden field

javascript,field,yii2
I have problem to show the hidden field. this is my script : <script> function showOther(obj){ if(obj=="Lainnya"){ document.getElementById('user-bank_other').style.display="block"; return false; }else{ document.getElementById('user-bank_other').style.display="none"; return false; } } Then this is my form : <?= $form->field($model, 'bank_id')->dropDownList([ '1' => 'Bank Central Asia', '2' => 'CIMB Niaga', '9999' => 'Lainnya', ], ['prompt' =>...

Access - Using a Form Button To Set Field Value

ms-access,button,field,value
I'd like to create a 'colour wheel' in Access, where the user is shown a range of colours in a form and selecting any colour places the colour name in a table field. I thought of doing this through creating many buttons, each one a different colour. So when the...

there is possible to related a related field?

field,openerp,odoo
there is possible to related a related field ? I did 1st object _columns = { 'sale_price_unit': fields.related('sale_line_id','price_unit',string='Prix de vente',type='float', store=True, readonly=True), } the other object _columns={ 'sale_price_unit': fields.related('procurement_id','sale_price_unit',string='Prix de vente',type='float', store=True, readonly=True), } the value of the 2nd object alwayse equal 0.0 !!...

ExtJs4 Change Field color on Statuscode

extjs,grid,extjs4,field,cell
Hello im struggling with ExtJs im Trying to change color in ExtJs grid where cell name is 'statuscode' if statuscode is 1 the cell has to change color in green! anybody an idea? Thanks Ext.define('Shopware.apps.ArticleUpdateLog.model.ArticleUpdateLog', { extend: 'Shopware.data.Model', configure: function () { return { controller: 'ArticleUpdateLog' }; }, fields: [...

How to access class field variable inside all methods from toString twin toStrung?

java,class,static,field,static-methods
Once upon modifying the above with static modifiers, line 16 requires the following syntax: getLegs();toStrung(); //I think this is essentially printing the last called method updating class field variable toString. For example, to do setLegs();toStrung(); prints setLegs()'s toString. Question: How should one access a shared field within methods? What if...

Why isn't there a working solution for disabling browser caching?

html,forms,google-chrome,autocomplete,field
I have a registration (unique) form for which I want to disable the memory of the email and password field so that it won't autocomplete. Now I tried all methods. autocomplete=off for the fields, explicitly setting the field to blank as well as disabling caching with meta tag. Nothing worked....

mySQL Are there advantages to using enum instead of two boolean fields?

mysql,enums,boolean,field,table-definition
I'm building a table to log messages. I need to note when a message has been sent and if the message has been successfully delivered. Are there advantages / disadvantages to using an ENUM type with values like 'ready', 'sent', 'delivered' in an ENUM field over having two boolean fields...

Field and values connection in Storm

stream,field,tuples,storm
I have a fundamental question in storm. I can clearly understand some basic things. For example i have a main class with this code inside: ... TopologyBuilder builder = new TopologyBuilder(); builder.setSpout(SENTENCE_SPOUT_ID, new SentenceSpout()); builder.setBolt(SPLIT_BOLT_ID, new SplitSentenceBolt()).shuffleGrouping(SENTENCE_SPOUT_ID); builder.setBolt(COUNT_BOLT_ID, new WordCountBolt(), 3).fieldsGrouping(SPLIT_BOLT_ID, new Fields("word")); builder.setBolt(REPORT_BOLT_ID, new ReportBolt()).globalGrouping(COUNT_BOLT_ID); ... and i understand...

Vaadin: how to avoid cascade valuechange events between fields

events,recursion,field,vaadin,onchange
I have several fields in a screen, that are partially dependent each on other by validating rules. If user changes one field then I can affect another fields using setValue(). But I am fighting with the problem, valueChange event is fired from setValue() just as from user activity. My example:...

Mapping separate fields into one string using Automapper

c#,string,field,concatenation,automapper
I have spent a couple of days trying to track this down without any luck. I have a table of addresses. Each row has 4 address fields. I want to map them to another object that has one field that is a single string made up of the 4 fields,...

merge structure field cells in matlab

matlab,merge,structure,field
I want to merge structure fields in case I do partial computations, to later fill up the whole structure field cells. The results are put into cells according to index into the cell, like this: for i=3:4; results1.index{i}=i; results1.sqr{i}=i*i; end for i=1; results2.index{i}=i; results2.sqr{i}=i*i; end giving, respectively: results1 = index:...