Search Results

Search found 5176 results on 208 pages for 'max fraser'.

Page 45/208 | < Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >

  • Any way to optimize this MySQL query?

    - by manyxcxi
    My table looks like this: `MyDB`.`Details` ( `id` bigint(20) NOT NULL, `run_id` int(11) NOT NULL, `element_name` varchar(255) NOT NULL, `value` text, `line_order` int(11) default NULL, `column_order` int(11) default NULL ); I have the following SELECT statement in a stored procedure SELECT RULE ,TITLE ,SUM(IF(t.PASSED='Y',1,0)) AS PASS ,SUM(IF(t.PASSED='N',1,0)) AS FAIL FROM ( SELECT a.line_order ,MAX(CASE WHEN a.element_name = 'PASSED' THEN a.`value` END) AS PASSED ,MAX(CASE WHEN a.element_name = 'RULE' THEN a.`value` END) AS RULE ,MAX(CASE WHEN a.element_name = 'TITLE' THEN a.`value` END) AS TITLE FROM Details a WHERE run_id = runId GROUP BY line_order ) t GROUP BY RULE, TITLE; *runId is an input parameter to the stored procedure. This query takes about 14 seconds to run. The table has 214856 rows, and the particular run_id I am filtering on has 162204 records. It's not on a super high power machine, but I feel like I could be doing this more efficiently. My main goal is to summarize by Rule and Title and show Pass and Fail count columns.

    Read the article

  • How to correctly and standardly compare floats?

    - by DIMEDROLL
    Every time I start a new project and when I need to compare some float or double variables I write the code like this one: if (fabs(prev.min[i] - cur->min[i]) < 0.000001 && fabs(prev.max[i] - cur->max[i]) < 0.000001) { continue; } Then I want to get rid of these magic variables 0.000001(and 0.00000000001 for double) and fabs, so I write an inline function and some defines: #define FLOAT_TOL 0.000001 So I wonder if there is any standard way of doing this? May be some standard header file? It would be also nice to have float and double limits(min and max values)

    Read the article

  • How to get array keys in Javascript?

    - by DisgruntledGoat
    I have an array created with this code: var widthRange = new Array(); widthRange[46] = { sel:46, min:0, max:52 }; widthRange[66] = { sel:66, min:52, max:70 }; widthRange[90] = { sel:90, min:70, max:94 }; I want to get each of the values 46, 66, 90 in a loop. I tried for (var key in widthRange) but this gives me a whole bunch of extra properties (I assume they are functions on the object). I can't use a regular for loop since the values are not sequential.

    Read the article

  • Can't echo jquery (with ajax) variable in php

    - by Lars Kerff
    I'm trying to post a variable through ajax. But it won't echo the variable in php. This are the variables (these are working, seen in the log): $("#slider").bind("valuesChanged", function(e, data){console.log("min: " + data.values.min + " max: " + data.values.max);}); The Ajax part: $("#slider").bind("valuesChanged", function (e, data) { $.ajax({ type: "POST", dataType: "text", url: "../test.php", data: { minValue: data.values.min, maxValue: data.values.max }, async: false, success: function(data){ alert('yeah') }, error: function(xhr) { alert('fail') // if your PHP script return an erroneous header, you'll land here } }); }); </script> And php echo: <?php if ( $_POST ) { echo $_POST[ 'minValue' ]; } ?> Now why does it not echo the post? Thanks!

    Read the article

  • jpa join query on a subclass

    - by Brian
    I have the following relationships in JPA (hibernate). Object X has two subclasses, Y and Z. Object A has a manyToOne relationship to object X. (Note, this is a one-sided relationship so object X cannot see object A). Now, I want to get the max value of a column in object A, but only where the relationship is of a specific subtype, ie...Y. So, that equates to...get the max value of column1 in object A, across all instances of A where they have a relationship with Y. Is this possible? I'm a bit lost as how to query it. I was thinking of something like: String query = "SELECT MAX(a.columnName) FROM A a join a.x; Query query = super.entityManager.createQuery(query); query.execute(); However that doesn't take account of the subclass of X...so I'm a bit lost. Any help would be much appreciated.

    Read the article

  • Is it possible to compute the minimum of three numbers by using two comparisons at the same time?

    - by Milo Hou
    I've been trying to think up of some way that I could do two comparisons at the same time to find the greatest/least of three numbers. Arithmetic operations on them are considered "free" in this case. That is to say, the classical way of finding the greater of two, and then comparing it to the third number isn't valid in this case because one comparison depends on the result of the other. Is it possible to use two comparisons where this isn't the case? I was thinking maybe comparing the differences of the numbers somehow or their products or something, but came up with nothing. Just to reemphasize, two comparisons are still done, just that neither comparison relies on the result of the other comparison. EDIT: what about: boolA = A^2 + B^2 < C^2 boolB = A > B if boolA then max=C else if boolB then max=A else max=B

    Read the article

  • Extended maxima transform in Matlab

    - by garvin
    I use imtophat to apply a filter to an m x n array. I then find the local max using imextendedmax(). I get mostly 0's everywhere except for 1's in the general areas where I am expecting a local max. The weird thing is, though, that I don't get just one local max. Instead in these places I get MANY elements with 1's such as 00011100000 00111111000 00000110000 yet the values there are close but NOT equal so I would expect that there would be one that is higher than all of the rest. So I'm wondering a) if this is a bug and how I might fix it and b) how you would choose choose the element of these 1's with the highest value.

    Read the article

  • How to dynamically write the query in SQL Server 2008?

    - by user1237131
    How to write the dynamically the below query? Table empid designation interestes 1 developer,tester cricket,chess 1 developer chess 1 techlead cricket Condition: IF empid = 1 AND (designation LIKE '%developer%' OR designationLIKE '%techlead%') OR (interests LIKE '%cricket%'). How to write the above query dynamically if designations need to send more than 2,and also same on interstes . please tell me ... EDIT stored procedure code: ALTER PROCEDURE [dbo].[usp_GetDevices] @id INT, @designation NVARCHAR (MAX) AS BEGIN declare @idsplat varchar(MAX) set @idsplat = @UserIds create table #u1 (id1 varchar(MAX)) set @idsplat = 'insert #u1 select ' + replace(@idsplat, ',', ' union select ') exec(@idsplat) Select id FROM dbo.DevicesList WHERE id=@id AND designation IN (select id1 from #u1) END

    Read the article

  • mysql date format with changing string value

    - by hacket
    I have a field called Timestamp, that stores its values as text as opposed to an actual Timestamp. The logging application is unchangeable, unfortunately. So table.Timestamp -> text field with format -> "Wed Mar 02 13:28:59 CDT 2011" I have been developing a query to purge all but the most recent row using this as my Timestamp selector, which is also converting the string into a date - MAX( STR_To_DATE( table.Timestamp , '%a %b %d %H:%i:%s CDT %Y' ) My query works perfectly... However, what I've found is that the string value - 'CDT' - changes between 'CDT' and 'CST' depending on whether the current time is daylight savings time or not. During daylight savings time, it logs as 'CDT', and vice versa. So all the rows that contain 'CST' get ignored when I run this - MAX( STR_To_DATE( table.Timestamp , '%a %b %d %H:%i:%s CDT %Y' ) and all the rows that contain 'CDT' get ignored when I run this - MAX( STR_To_DATE( table.Timestamp , '%a %b %d %H:%i:%s CST %Y' ) Is there a way to make it run against both string formats?

    Read the article

  • Help with a algorithm in linq to resolve a query

    - by Deumber
    I have been some time thinking how to resolve this problem, but out of ideas i prefer expose it for help. I have 2 tables (linq to sql) A and B, A have a many relation with B, so A have a property EntitySet of B A have the following properties: CreateDate (Datetime) ModificateDate (Datetime) Bs (EntitySet<B>) B have the following properties: CreateDate (Datetime) ModificateDate (Datetime) All that i want is return a ordered collection of A by the Max date between : A.CreateDate, A.ModificateDate, The Max B.CreateDate of all B in A The Max B.ModificateDate of all B in A if i someone need a little example, just ask for it.

    Read the article

  • Int property in class definition

    - by Daniel I-S
    I have the following class structure for custom UITableViewCells: NumericEntryCell - Contains method for controlling max value that can be entered into a textbox. SliderCell - inherits from NEC and contains methods for handling slider-control of textbox value TextOnlyCell - just contains a textbox CellA - inherits from SliderCell and has a max value of 28 CellB - inherits from TextOnlyCell and has a max value of 150. I want NumericEntryCell to contain a definition for a property that contains the maxValue. I want to be able to set a value for this in the initialize method of a child class (CellA or CellB). Currently I have an int maxValue declared in the interface of NEC. I declare a property for this with @property int maxValue and @synthesize it within the .m file. However, attempting to modify this property's value from CellA or CellB's initialize method has no effect - when I hit a breakpoint in the NEC method that uses this value, its value is always zero. How can I get this to work?

    Read the article

  • select similar value from MySQL and order the result

    - by mathew
    how do I order this result?? $range = 5; // you'll be selecting around this range. $min = $rank - $range; $max = $rank + $range; $limit = 10; // max number of results you want. $result = mysql_query("select * from table where rank between $min and $max limit $limit"); while($row = mysql_fetch_array($result)) { echo $row['name']."&nbsp;-&nbsp;".$row['rank']."<br>"; }

    Read the article

  • Is correct name enough to make it happen?

    - by Knowing me knowing you
    Guys, I've just dipped in to limits.h by MS. I tried to check what's the return type for max() fnc and to my surprise I see something like this: // TEMPLATE CLASS numeric_limits template<class _Ty> class numeric_limits : public _Num_base { // numeric limits for arbitrary type _Ty (say little or nothing) public: static _Ty (__CRTDECL min)() _THROW0() { // return minimum value return (_Ty(0)); } static _Ty (__CRTDECL max)() _THROW0() { // return maximum value return (_Ty(0));//EXACTLY THE SAME WHAT IN min<<------------------ } //... other stuff }; so how is it possiple that in both min and max return does exactly the same? So does it mean if I would write makeSanwich() return (_Ty(0)) it would make a sandwich for me? How is it possible that having this same code just fnc names different we are getting different results?

    Read the article

  • Programmatically find maximum static array size in C++

    - by GuyGreer
    I am curious whether it is possible to determine the maximum size that an array can have in C++. #include <iostream> using namespace std; #define MAX 2000000 int main() { long array[MAX]; cout << "Message" << endl; return 0; } This compiles just fine, but then segfaults as soon as I run it (even though array isn't actually referenced). I know it's the array size too because if I change it to 1000000 it runs just fine. So, is there some define somewhere or some way of having #define MAX MAX_ALLOWED_ARRAY_SIZE_FOR_MY_MACHINE_DEFINED_SOMEWHERE_FOR_ME? I don't actually need this for anything, this question is for curiosity's sake.

    Read the article

  • Duplication in mysql/php

    - by user1334095
    I have a problem in the code.i have two tables 'sms' and 'bd_paid_bribe'.sms table has a column 'Message' and bd_paid_bribe table has a column 'c_addi_info'.when i execute the code first time all the values of Message column are inserted into c_addi_info column.when i enter a record for the second time instead of inserting the new record, all the records of Message column are inserted into bd_paid_bribe column.can u modify the code and provide a solution to avoid duplication and to insert only the newly added record. <?php $con=mysql_connect('localhost','root',''); if(!$con) { die("couldn't connect"); } mysql_select_db("ipab2",$con); $rs2=mysql_query(" select max(sms_index) from tab3"); do { $rs=mysql_query("insert into tab3(sms_index)select max(sms_index) from sms"); $rs3=mysql_query("SELECT max(sms_index) FROM sms"); $rs1=mysql_query("insert into bd_paid_bribe(c_addi_info) select Message from sms "); }while($rs2>$rs3); ?>

    Read the article

  • How to use `wx.ProgressDialog` with my own method?

    - by user1401950
    How can I use the wx.ProgressDialog to time my method called imgSearch? The imgSearch method finds image files on the user's pc. How can I make the wx.ProgressDialog run while imgSearch is still running and display how long the imgSearch is taking? Here's my code: def onFind (self,event)# triggered by a button click max = 80 dlg = wx.ProgressDialog("Progress dialog example","An informative message",parent=self, style = wx.PD_CAN_ABORT| wx.PD_APP_MODAL| wx.PD_ELAPSED_TIME| wx.PD_REMAINING_TIME) keepGoing = True count = 0 imageExtentions = ['*.jpg', '*.jpeg', '*.png', '*.tif', '*.tiff'] selectedDir = 'C:\\' imgSearch.findImages(imageExtentions, selectedDir)# my method while keepGoing and count < max: count += 1 wx.MilliSleep(250) if count >= max / 2: (keepGoing, skip) = dlg.Update(count, "Half-time!") else: (keepGoing, skip) = dlg.Update(count) dlg.Destroy()

    Read the article

  • JGoodies HashMap

    - by JohnMcClane
    Hi, I'm trying to build a chart program using presentation model. Using JGoodies for data binding was relatively easy for simple types like strings or numbers. But I can't figure out how to use it on a hashmap. I'll try to explain how the chart works and what my problem is: A chart consists of DataSeries, a DataSeries consists of DataPoints. I want to have a data model and to be able to use different views on the same model (e.g. bar chart, pie chart,...). Each of them consists of three classes. For example: DataPointModel: holds the data model (value, label, category) DataPointViewModel: extends JGoodies PresentationModel. wraps around DataPointModel and holds view properties like font and color. DataPoint: abstract class, extends JComponent. Different Views must subclass and implement their own ui. Binding and creating the data model was easy, but i don't know how to bind my data series model. package at.onscreen.chart; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.beans.PropertyVetoException; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; public class DataSeriesModel { public static String PROPERTY_DATAPOINT = "dataPoint"; public static String PROPERTY_DATAPOINTS = "dataPoints"; public static String PROPERTY_LABEL = "label"; public static String PROPERTY_MAXVALUE = "maxValue"; /** * holds the data points */ private HashMap dataPoints; /** * the label for the data series */ private String label; /** * the maximum data point value */ private Double maxValue; /** * the model supports property change notification */ private PropertyChangeSupport propertyChangeSupport; /** * default constructor */ public DataSeriesModel() { this.maxValue = Double.valueOf(0); this.dataPoints = new HashMap(); this.propertyChangeSupport = new PropertyChangeSupport(this); } /** * constructor * @param label - the series label */ public DataSeriesModel(String label) { this.dataPoints = new HashMap(); this.maxValue = Double.valueOf(0); this.label = label; this.propertyChangeSupport = new PropertyChangeSupport(this); } /** * full constructor * @param label - the series label * @param dataPoints - an array of data points */ public DataSeriesModel(String label, DataPoint[] dataPoints) { this.dataPoints = new HashMap(); this.propertyChangeSupport = new PropertyChangeSupport(this); this.maxValue = Double.valueOf(0); this.label = label; for (int i = 0; i < dataPoints.length; i++) { this.addDataPoint(dataPoints[i]); } } /** * full constructor * @param label - the series label * @param dataPoints - a collection of data points */ public DataSeriesModel(String label, Collection dataPoints) { this.dataPoints = new HashMap(); this.propertyChangeSupport = new PropertyChangeSupport(this); this.maxValue = Double.valueOf(0); this.label = label; for (Iterator it = dataPoints.iterator(); it.hasNext();) { this.addDataPoint(it.next()); } } /** * adds a new data point to the series. if the series contains a data point with same id, it will be replaced by the new one. * @param dataPoint - the data point */ public void addDataPoint(DataPoint dataPoint) { String category = dataPoint.getCategory(); DataPoint oldDataPoint = this.getDataPoint(category); this.dataPoints.put(category, dataPoint); this.setMaxValue(Math.max(this.maxValue, dataPoint.getValue())); this.propertyChangeSupport.firePropertyChange(PROPERTY_DATAPOINT, oldDataPoint, dataPoint); } /** * returns the data point with given id or null if not found * @param uid - the id of the data point * @return the data point or null if there is no such point in the table */ public DataPoint getDataPoint(String category) { return this.dataPoints.get(category); } /** * removes the data point with given id from the series, if present * @param category - the data point to remove */ public void removeDataPoint(String category) { DataPoint dataPoint = this.getDataPoint(category); this.dataPoints.remove(category); if (dataPoint != null) { if (dataPoint.getValue() == this.getMaxValue()) { Double maxValue = Double.valueOf(0); for (Iterator it = this.iterator(); it.hasNext();) { DataPoint itDataPoint = it.next(); maxValue = Math.max(itDataPoint.getValue(), maxValue); } this.setMaxValue(maxValue); } } this.propertyChangeSupport.firePropertyChange(PROPERTY_DATAPOINT, dataPoint, null); } /** * removes all data points from the series * @throws PropertyVetoException */ public void removeAll() { this.setMaxValue(Double.valueOf(0)); this.dataPoints.clear(); this.propertyChangeSupport.firePropertyChange(PROPERTY_DATAPOINTS, this.getDataPoints(), null); } /** * returns the maximum of all data point values * @return the maximum of all data points */ public Double getMaxValue() { return this.maxValue; } /** * sets the max value * @param maxValue - the max value */ protected void setMaxValue(Double maxValue) { Double oldMaxValue = this.getMaxValue(); this.maxValue = maxValue; this.propertyChangeSupport.firePropertyChange(PROPERTY_MAXVALUE, oldMaxValue, maxValue); } /** * returns true if there is a data point with given category * @param category - the data point category * @return true if there is a data point with given category, otherwise false */ public boolean contains(String category) { return this.dataPoints.containsKey(category); } /** * returns the label for the series * @return the label for the series */ public String getLabel() { return this.label; } /** * returns an iterator over the data points * @return an iterator over the data points */ public Iterator iterator() { return this.dataPoints.values().iterator(); } /** * returns a collection of the data points. the collection supports removal, but does not support adding of data points. * @return a collection of data points */ public Collection getDataPoints() { return this.dataPoints.values(); } /** * returns the number of data points in the series * @return the number of data points */ public int getSize() { return this.dataPoints.size(); } /** * adds a PropertyChangeListener * @param listener - the listener */ public void addPropertyChangeListener(PropertyChangeListener listener) { this.propertyChangeSupport.addPropertyChangeListener(listener); } /** * removes a PropertyChangeListener * @param listener - the listener */ public void removePropertyChangeListener(PropertyChangeListener listener) { this.propertyChangeSupport.removePropertyChangeListener(listener); } } package at.onscreen.chart; import java.beans.PropertyVetoException; import java.util.Collection; import java.util.Iterator; import com.jgoodies.binding.PresentationModel; public class DataSeriesViewModel extends PresentationModel { /** * default constructor */ public DataSeriesViewModel() { super(new DataSeriesModel()); } /** * constructor * @param label - the series label */ public DataSeriesViewModel(String label) { super(new DataSeriesModel(label)); } /** * full constructor * @param label - the series label * @param dataPoints - an array of data points */ public DataSeriesViewModel(String label, DataPoint[] dataPoints) { super(new DataSeriesModel(label, dataPoints)); } /** * full constructor * @param label - the series label * @param dataPoints - a collection of data points */ public DataSeriesViewModel(String label, Collection dataPoints) { super(new DataSeriesModel(label, dataPoints)); } /** * full constructor * @param model - the data series model */ public DataSeriesViewModel(DataSeriesModel model) { super(model); } /** * adds a data point to the series * @param dataPoint - the data point */ public void addDataPoint(DataPoint dataPoint) { this.getBean().addDataPoint(dataPoint); } /** * returns true if there is a data point with given category * @param category - the data point category * @return true if there is a data point with given category, otherwise false */ public boolean contains(String category) { return this.getBean().contains(category); } /** * returns the data point with given id or null if not found * @param uid - the id of the data point * @return the data point or null if there is no such point in the table */ public DataPoint getDataPoint(String category) { return this.getBean().getDataPoint(category); } /** * returns a collection of the data points. the collection supports removal, but does not support adding of data points. * @return a collection of data points */ public Collection getDataPoints() { return this.getBean().getDataPoints(); } /** * returns the label for the series * @return the label for the series */ public String getLabel() { return this.getBean().getLabel(); } /** * sets the max value * @param maxValue - the max value */ public Double getMaxValue() { return this.getBean().getMaxValue(); } /** * returns the number of data points in the series * @return the number of data points */ public int getSize() { return this.getBean().getSize(); } /** * returns an iterator over the data points * @return an iterator over the data points */ public Iterator iterator() { return this.getBean().iterator(); } /** * removes all data points from the series * @throws PropertyVetoException */ public void removeAll() { this.getBean().removeAll(); } /** * removes the data point with given id from the series, if present * @param category - the data point to remove */ public void removeDataPoint(String category) { this.getBean().removeDataPoint(category); } } package at.onscreen.chart; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyVetoException; import java.util.Collection; import java.util.Iterator; import javax.swing.JComponent; public abstract class DataSeries extends JComponent implements PropertyChangeListener { /** * the model */ private DataSeriesViewModel model; /** * default constructor */ public DataSeries() { this.model = new DataSeriesViewModel(); this.model.addPropertyChangeListener(this); this.createComponents(); } /** * constructor * @param label - the series label */ public DataSeries(String label) { this.model = new DataSeriesViewModel(label); this.model.addPropertyChangeListener(this); this.createComponents(); } /** * full constructor * @param label - the series label * @param dataPoints - an array of data points */ public DataSeries(String label, DataPoint[] dataPoints) { this.model = new DataSeriesViewModel(label, dataPoints); this.model.addPropertyChangeListener(this); this.createComponents(); } /** * full constructor * @param label - the series label * @param dataPoints - a collection of data points */ public DataSeries(String label, Collection dataPoints) { this.model = new DataSeriesViewModel(label, dataPoints); this.model.addPropertyChangeListener(this); this.createComponents(); } /** * full constructor * @param model - the model */ public DataSeries(DataSeriesViewModel model) { this.model = model; this.model.addPropertyChangeListener(this); this.createComponents(); } /** * creates, binds and configures UI components. * data point properties can be created here as components or be painted in paintComponent. */ protected abstract void createComponents(); @Override public void propertyChange(PropertyChangeEvent evt) { this.repaint(); } /** * adds a data point to the series * @param dataPoint - the data point */ public void addDataPoint(DataPoint dataPoint) { this.model.addDataPoint(dataPoint); } /** * returns true if there is a data point with given category * @param category - the data point category * @return true if there is a data point with given category, otherwise false */ public boolean contains(String category) { return this.model.contains(category); } /** * returns the data point with given id or null if not found * @param uid - the id of the data point * @return the data point or null if there is no such point in the table */ public DataPoint getDataPoint(String category) { return this.model.getDataPoint(category); } /** * returns a collection of the data points. the collection supports removal, but does not support adding of data points. * @return a collection of data points */ public Collection getDataPoints() { return this.model.getDataPoints(); } /** * returns the label for the series * @return the label for the series */ public String getLabel() { return this.model.getLabel(); } /** * sets the max value * @param maxValue - the max value */ public Double getMaxValue() { return this.model.getMaxValue(); } /** * returns the number of data points in the series * @return the number of data points */ public int getDataPointCount() { return this.model.getSize(); } /** * returns an iterator over the data points * @return an iterator over the data points */ public Iterator iterator() { return this.model.iterator(); } /** * removes all data points from the series * @throws PropertyVetoException */ public void removeAll() { this.model.removeAll(); } /** * removes the data point with given id from the series, if present * @param category - the data point to remove */ public void removeDataPoint(String category) { this.model.removeDataPoint(category); } /** * returns the data series view model * @return - the data series view model */ public DataSeriesViewModel getViewModel() { return this.model; } /** * returns the data series model * @return - the data series model */ public DataSeriesModel getModel() { return this.model.getBean(); } } package at.onscreen.chart.builder; import java.util.Collection; import net.miginfocom.swing.MigLayout; import at.onscreen.chart.DataPoint; import at.onscreen.chart.DataSeries; import at.onscreen.chart.DataSeriesViewModel; public class BuilderDataSeries extends DataSeries { /** * default constructor */ public BuilderDataSeries() { super(); } /** * constructor * @param label - the series label */ public BuilderDataSeries(String label) { super(label); } /** * full constructor * @param label - the series label * @param dataPoints - an array of data points */ public BuilderDataSeries(String label, DataPoint[] dataPoints) { super(label, dataPoints); } /** * full constructor * @param label - the series label * @param dataPoints - a collection of data points */ public BuilderDataSeries(String label, Collection dataPoints) { super(label, dataPoints); } /** * full constructor * @param model - the model */ public BuilderDataSeries(DataSeriesViewModel model) { super(model); } @Override protected void createComponents() { this.setLayout(new MigLayout()); /* * * I want to add a new BuilderDataPoint for each data point in the model. * I want the BuilderDataPoints to be synchronized with the model. * e.g. when a data point is removed from the model, the BuilderDataPoint shall be removed * from the BuilderDataSeries * */ } } package at.onscreen.chart.builder; import javax.swing.JFormattedTextField; import javax.swing.JTextField; import at.onscreen.chart.DataPoint; import at.onscreen.chart.DataPointModel; import at.onscreen.chart.DataPointViewModel; import at.onscreen.chart.ValueFormat; import com.jgoodies.binding.adapter.BasicComponentFactory; import com.jgoodies.binding.beans.BeanAdapter; public class BuilderDataPoint extends DataPoint { /** * default constructor */ public BuilderDataPoint() { super(); } /** * constructor * @param category - the category */ public BuilderDataPoint(String category) { super(category); } /** * constructor * @param value - the value * @param label - the label * @param category - the category */ public BuilderDataPoint(Double value, String label, String category) { super(value, label, category); } /** * full constructor * @param model - the model */ public BuilderDataPoint(DataPointViewModel model) { super(model); } @Override protected void createComponents() { BeanAdapter beanAdapter = new BeanAdapter(this.getModel(), true); ValueFormat format = new ValueFormat(); JFormattedTextField value = BasicComponentFactory.createFormattedTextField(beanAdapter.getValueModel(DataPointModel.PROPERTY_VALUE), format); this.add(value, "w 80, growx, wrap"); JTextField label = BasicComponentFactory.createTextField(beanAdapter.getValueModel(DataPointModel.PROPERTY_LABEL)); this.add(label, "growx, wrap"); JTextField category = BasicComponentFactory.createTextField(beanAdapter.getValueModel(DataPointModel.PROPERTY_CATEGORY)); this.add(category, "growx, wrap"); } } To sum it up: I need to know how to bind a hash map property to JComponent.components property. JGoodies is in my opinion not very well documented, I spent a long time searching through the internet, but I did not find any solution to my problem. Hope you can help me.

    Read the article

  • Android ListView delete row button - focus issue

    - by Max Gontar
    Hi! I have an activity with ListView and buttons below: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <ListView android:id="@+id/lvLamps" android:layout_width="fill_parent" android:layout_height="fill_parent" android:listSelector="@null" android:choiceMode="none" android:scrollbarStyle="insideInset" android:layout_weight="1.0" /> <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_weight="0.0"> <Button android:id="@+id/btnAdd" android:background="@null" android:drawableLeft="@drawable/btn_upgrade" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableRight="@drawable/lbl_upgrade" android:textSize="0pt" android:text="" android:layout_alignParentLeft="true" android:padding="20px" /> <Button android:id="@+id/btnNext" android:background="@null" android:drawableRight="@drawable/next_btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableLeft="@drawable/lbl_next" android:textSize="0pt" android:text="" android:layout_alignParentRight="true" android:padding="20px" android:visibility="gone" /> <ImageButton android:id="@+id/btnListExit" android:background="@null" android:src="@drawable/btn_x" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:padding="20px" /> </RelativeLayout> </LinearLayout> ListView row contains delete button: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:focusable="true"> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:focusable="true"> <ImageButton android:id="@+id/btnRowDelete" android:src="@drawable/btn_x" android:background="@null" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:padding="4px" android:focusable="true" android:focusableInTouchMode="true"/> <TextView android:id="@+id/txtLampRowFrom" android:text="123" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="6pt" android:layout_toRightOf="@id/btnRowDelete" android:focusable="false" android:textColor="@color/textColor"/> <TextView android:id="@+id/txtLampRowTo" android:text="123" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="6pt" android:layout_toRightOf="@id/btnRowDelete" android:layout_alignParentBottom="true" android:focusable="false" android:textColor="@color/textColor"/> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/arrow_upgrade_to" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:focusable="false"/> </RelativeLayout> </LinearLayout> In Adapter, Button onClickListener is set, also there are dummies to make list non-selectable: // disabling list items select public boolean areAllItemsEnabled() { return false; } public boolean isEnabled(int position) { return false; } What I want is: always show buttons in the bottom of screen after list (no matter how long it is, there should be scroll if it's too long) ListView should not be selectable, I don't want row selection row delete button should be selectable (focusable) with touch and with trackball And everything works except I can't focus row delete button with trackball (although it's working with touch). Can you help me? Thanks!

    Read the article

  • BlackBerry - GUI design prototyping mockup (Visio stencils)

    - by Max Gontar
    Hi! Just want to share information (and ask for some challenge) My company has published a set of Visio 2003 stencils for BlackBerry GUI prototyping RIM BlackBerry 8300, BlackBerry OS 4.5 RIM BlackBerry 9000, BlackBerry OS 4.6 RIM BlackBerry 9500, BlackBerry OS 4.7 RIM BlackBerry 9700, BlackBerry OS 5.0 It's free, however for download you will need to fill email form. Question: Is there other sets like that, so we could learn and make our one better (or just throw it away)? If it's too "self-promotional", feel free to close :) Thank you!

    Read the article

  • How do you create a cbuffer or global variable that is gpu modifiable?

    - by bobobobo
    I'm implementing tonemapping in a pixel shader, for hdr lighting. The vertex shader outputs vertices with colors. I need to find the max color and save it in a global. However when I try and write the global in my hlsl code, //clamp the max color below by this color clamp( maxColor, output.color, float4( 1e6,1e6,1e6,1e6 ) ) ; I see: error X3025: global variables are implicitly constant, enable compatibility mode to allow modification What is the correct way to declare a shader global in d3d11 that the vertex shader can write to, and the pixel shader can read? I realize this is a bit tough since the vertex shaders are supposed to run in parallel, and introducing a shader global that they all write to means a lock..

    Read the article

  • Entity Framework conversion from v1 to v4 problem

    - by Max
    After converting my data access layer project from EntityFramework v1 to v4 a got a bunch of errors for each of the entity classes: Error 10016: Error resolving item 'EntityTypeShape'. The exception message is: 'Unresolved reference 'NS.EntityName1'.'. DataAccessLayer\Model.edmx and Error 10016: Error resolving item 'AssociationConnector'. The exception message is: 'NS.EntityName1'.'. DataAccessLayer\Model.edmx Does anybody know what is this and how to fix it?

    Read the article

  • XCOPY to remote server

    - by Max
    In order to improve the deployment / build process of my ASP.NET app, I would like to make a .bat that builds the current solution in release mode xcopy the files to a remote server Creating a release build via command line is easy. But how can I xcopy the files to the remote server? I think I have to map the remote destination to a network drive (?). However I could not connect to the remote server, although I have enabled file sharing for the folder on the server. Maybe the firewall is blocking the request? Which port should I open? Or is there another solution? EDIT Thanks for all the answers so far, but I probably need a step by step guide on how to set up the folder sharing on the server. I shared the folder, I opened up port 445 so that I can connect to the server but still, I cant connect from my local machine to the server in order to map the network path to a system drive.

    Read the article

  • Spring - adding BindingResult to newly created model attribute

    - by Max
    My task is - to create a model attribute by given request parameters, to validate it (in same method) and to give it whole to the View. I was given this code: //Create the model attribute by request parameters Promotion promotion = Promotions.get(someRequestParam); //Add the attribute to the model modelMap.addAttribute("promotion", promotion); if (!promotion.validate()) { BindingResult errors = new BeanPropertyBindingResult(promotion, "promotion"); errors.reject("promotion.invalid"); //TODO: This is the part I don't like model.put(BindingResult.MODEL_KEY_PREFIX + "promotion", errors); } This thing sure works, but that part with creating key with MODEL_KEY_PREFIX and attribute name looks very hackish and not a Spring style to me. Is there a way to make the same thing prettier?

    Read the article

  • heroku corrupted object, git fsck fails in rails

    - by Ryan Max
    Hello. I am trying to push an app to heroku and I am getting the error detailed here. So I am trying to determine the corrupt objects using git fsck -full but it isn't returning anything. Nothing happens: Ryan@Ryan-PC ~ $ git fsck --full Ryan@Ryan-PC But I get the object error when I try to push the object to heroku. Is there anyway I can go about repairing the corrupt repository, or can I just delete it and start over? How do I go about doing this?

    Read the article

< Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >