Search Results

Search found 855 results on 35 pages for 'col wilson'.

Page 18/35 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Encoding in Scene Builder

    - by Agafonova Victoria
    I generate an FXML file with Scene Builder. I need it to contain some cirillic text. When i edit this file with Scene Builder i can see normal cirillic letters (screen 1) After compileing and running my program with this FXML file, i'll see not cirillic letters, but some artefacts (screen 2) But, as you can see on the screen 3, its xml file encoding is UTF-8. Also, you can see there that it is saved in ANSI. I've tried to open it with other editors (default eclipse and sublime text 2) and they shoen wrong encoding either. (screen 4 and screen 5) At first i've tried to convert it from ansi to utf-8 (with notepad++). After that eclipse and sublime text 2 started display cirillic letters as they must be. But. Scene builder gave an error, when i've tried to open this file with it: Error loading file C:\eclipse\workspace\equification\src\main\java\ru\igs\ava\equification\test.fxml. C:\eclipse\workspace\equification\src\main\java\ru\igs\ava\equification\test.fxml:1: ParseError at [row,col]:[1,1] Message: Content is not allowed in prolog. And java compiler gave me an error: ??? 08, 2012 8:11:03 PM javafx.fxml.FXMLLoader logException SEVERE: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1] Message: Content is not allowed in prolog. /C:/eclipse/workspace/equification/target/classes/ru/igs/ava/equification/test.fxml:1 at javafx.fxml.FXMLLoader.load(Unknown Source) at javafx.fxml.FXMLLoader.load(Unknown Source) at javafx.fxml.FXMLLoader.load(Unknown Source) at javafx.fxml.FXMLLoader.load(Unknown Source) at javafx.fxml.FXMLLoader.load(Unknown Source) at javafx.fxml.FXMLLoader.load(Unknown Source) at ru.igs.ava.equification.EquificationFX.start(EquificationFX.java:22) at com.sun.javafx.application.LauncherImpl$5.run(Unknown Source) at com.sun.javafx.application.PlatformImpl$4.run(Unknown Source) at com.sun.javafx.application.PlatformImpl$3.run(Unknown Source) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source) at com.sun.glass.ui.win.WinApplication$2$1.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Exception in Application start method Exception in thread "main" java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source) at com.sun.javafx.application.LauncherImpl.access$000(Unknown Source) at com.sun.javafx.application.LauncherImpl$1.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: javafx.fxml.LoadException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1] Message: Content is not allowed in prolog. at javafx.fxml.FXMLLoader.load(Unknown Source) at javafx.fxml.FXMLLoader.load(Unknown Source) at javafx.fxml.FXMLLoader.load(Unknown Source) at javafx.fxml.FXMLLoader.load(Unknown Source) at javafx.fxml.FXMLLoader.load(Unknown Source) at javafx.fxml.FXMLLoader.load(Unknown Source) at ru.igs.ava.equification.EquificationFX.start(EquificationFX.java:22) at com.sun.javafx.application.LauncherImpl$5.run(Unknown Source) at com.sun.javafx.application.PlatformImpl$4.run(Unknown Source) at com.sun.javafx.application.PlatformImpl$3.run(Unknown Source) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.access$100(Unknown Source) at com.sun.glass.ui.win.WinApplication$2$1.run(Unknown Source) ... 1 more Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1] Message: Content is not allowed in prolog. at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source) at javax.xml.stream.util.StreamReaderDelegate.next(Unknown Source) ... 14 more So, i've converted it back to ANSI. And, having this file in ANSI, changed its "artefacted" text to cirillic letters manually. Now i can see normal text when i run my program, but when i open this fixed file via Scene Builder, Scene Builder shows me some "artefacted" text (screen 7). So, how can i fix this situation?

    Read the article

  • how to use ggplot conditional on data

    - by Andreas
    I asked this question and it seams ggplot2 currently has a bug with empty data.frames. Therefore I am trying to check if the dataframe is empty, before I make the plot. But what ever I come up with, it gets really ugly, and doesn't work. So I am asking for your help. example data: SOdata <- structure(list(id = 10:55, one = c(7L, 8L, 7L, NA, 7L, 8L, 5L, 7L, 7L, 8L, NA, 10L, 8L, NA, NA, NA, NA, 6L, 5L, 6L, 8L, 4L, 7L, 6L, 9L, 7L, 5L, 6L, 7L, 6L, 5L, 8L, 8L, 7L, 7L, 6L, 6L, 8L, 6L, 8L, 8L, 7L, 7L, 5L, 5L, 8L), two = c(7L, NA, 8L, NA, 10L, 10L, 8L, 9L, 4L, 10L, NA, 10L, 9L, NA, NA, NA, NA, 7L, 8L, 9L, 10L, 9L, 8L, 8L, 8L, 8L, 8L, 9L, 10L, 8L, 8L, 8L, 10L, 9L, 10L, 8L, 9L, 10L, 8L, 8L, 7L, 10L, 8L, 9L, 7L, 9L), three = c(7L, 10L, 7L, NA, 10L, 10L, NA, 10L, NA, NA, NA, NA, 10L, NA, NA, 4L, NA, 7L, 7L, 4L, 10L, 10L, 7L, 4L, 7L, NA, 10L, 4L, 7L, 7L, 7L, 10L, 10L, 7L, 10L, 4L, 10L, 10L, 10L, 4L, 10L, 10L, 10L, 10L, 7L, 10L), four = c(7L, 10L, 4L, NA, 10L, 7L, NA, 7L, NA, NA, NA, NA, 10L, NA, NA, 4L, NA, 10L, 10L, 7L, 10L, 10L, 7L, 7L, 7L, NA, 10L, 7L, 4L, 10L, 4L, 7L, 10L, 2L, 10L, 4L, 12L, 4L, 7L, 10L, 10L, 12L, 12L, 4L, 7L, 10L), five = c(7L, NA, 6L, NA, 8L, 8L, 7L, NA, 9L, NA, NA, NA, 9L, NA, NA, NA, NA, 7L, 8L, NA, NA, 7L, 7L, 4L, NA, NA, NA, NA, 5L, 6L, 5L, 7L, 7L, 6L, 9L, NA, 10L, 7L, 8L, 5L, 7L, 10L, 7L, 4L, 5L, 10L), six = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("2010-05-25", "2010-05-27", "2010-06-07"), class = "factor"), seven = c(0.777777777777778, 0.833333333333333, 0.333333333333333, 0.888888888888889, 0.5, 0.888888888888889, 0.777777777777778, 0.722222222222222, 0.277777777777778, 0.611111111111111, 0.722222222222222, 1, 0.888888888888889, 0.722222222222222, 0.555555555555556, NA, 0, 0.666666666666667, 0.666666666666667, 0.833333333333333, 0.833333333333333, 0.833333333333333, 0.833333333333333, 0.722222222222222, 0.833333333333333, 0.888888888888889, 0.666666666666667, 1, 0.777777777777778, 0.722222222222222, 0.5, 0.833333333333333, 0.722222222222222, 0.388888888888889, 0.722222222222222, 1, 0.611111111111111, 0.777777777777778, 0.722222222222222, 0.944444444444444, 0.555555555555556, 0.666666666666667, 0.722222222222222, 0.444444444444444, 0.333333333333333, 0.777777777777778), eight = c(0.666666666666667, 0.333333333333333, 0.833333333333333, 0.666666666666667, 1, 1, 0.833333333333333, 0.166666666666667, 0.833333333333333, 0.833333333333333, 1, 1, 0.666666666666667, 0.666666666666667, 0.333333333333333, 0.5, 0, 0.666666666666667, 0.5, 1, 0.666666666666667, 0.5, 0.666666666666667, 0.666666666666667, 0.666666666666667, 0.333333333333333, 0.333333333333333, 1, 0.666666666666667, 0.833333333333333, 0.666666666666667, 0.666666666666667, 0.5, 0, 0.833333333333333, 1, 0.666666666666667, 0.5, 0.666666666666667, 0.666666666666667, 0.5, 1, 0.833333333333333, 0.666666666666667, 0.833333333333333, 0.666666666666667), nine = c(0.307692307692308, NA, 0.461538461538462, 0.538461538461538, 1, 0.769230769230769, 0.538461538461538, 0.692307692307692, 0, 0.153846153846154, 0.769230769230769, NA, 0.461538461538462, NA, NA, NA, NA, 0, 0.615384615384615, 0.615384615384615, 0.769230769230769, 0.384615384615385, 0.846153846153846, 0.923076923076923, 0.615384615384615, 0.692307692307692, 0.0769230769230769, 0.846153846153846, 0.384615384615385, 0.384615384615385, 0.461538461538462, 0.384615384615385, 0.461538461538462, NA, 0.923076923076923, 0.692307692307692, 0.615384615384615, 0.615384615384615, 0.769230769230769, 0.0769230769230769, 0.230769230769231, 0.692307692307692, 0.769230769230769, 0.230769230769231, 0.769230769230769, 0.615384615384615), ten = c(0.875, 0.625, 0.375, 0.75, 0.75, 0.75, 0.625, 0.875, 1, 0.125, 1, NA, 0.625, 0.75, 0.75, 0.375, NA, 0.625, 0.5, 0.75, 0.875, 0.625, 0.875, 0.75, 0.625, 0.875, 0.5, 0.75, 0, 0.5, 0.875, 1, 0.75, 0.125, 0.5, 0.5, 0.5, 0.625, 0.375, 0.625, 0.625, 0.75, 0.875, 0.375, 0, 0.875), elleven = c(1, 0.8, 0.7, 0.9, 0, 1, 0.9, 0.5, 0, 0.8, 0.8, NA, 0.8, NA, NA, 0.8, NA, 0.4, 0.8, 0.5, 1, 0.4, 0.5, 0.9, 0.8, 1, 0.8, 0.5, 0.3, 0.9, 0.2, 1, 0.8, 0.1, 1, 0.8, 0.5, 0.2, 0.7, 0.8, 1, 0.9, 0.6, 0.8, 0.2, 1), twelve = c(0.666666666666667, NA, 0.133333333333333, 1, 1, 0.8, 0.4, 0.733333333333333, NA, 0.933333333333333, NA, NA, 0.6, 0.533333333333333, NA, 0.533333333333333, NA, 0, 0.6, 0.533333333333333, 0.733333333333333, 0.6, 0.733333333333333, 0.666666666666667, 0.533333333333333, 0.733333333333333, 0.466666666666667, 0.733333333333333, 1, 0.733333333333333, 0.666666666666667, 0.533333333333333, NA, 0.533333333333333, 0.6, 0.866666666666667, 0.466666666666667, 0.533333333333333, 0.333333333333333, 0.6, 0.6, 0.866666666666667, 0.666666666666667, 0.6, 0.6, 0.533333333333333)), .Names = c("id", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "elleven", "twelve"), class = "data.frame", row.names = c(NA, -46L)) And the plot iqr <- function(x, ...) { qs <- quantile(as.numeric(x), c(0.25, 0.5, 0.75), na.rm = T) names(qs) <- c("ymin", "y", "ymax") qs } magic <- function(y, ...) { high <- median(SOdata[[y]], na.rm=T)+1.5*sd(SOdata[[y]],na.rm=T) low <- median(SOdata[[y]], na.rm=T)-1.5*sd(SOdata[[y]],na.rm=T) ggplot(SOdata, aes_string(x="six", y=y))+ stat_summary(fun.data="iqr", geom="crossbar", fill="grey", alpha=0.3)+ geom_point(data = SOdata[SOdata[[y]] > high,], position=position_jitter(w=0.1, h=0),col="green", alpha=0.5)+ geom_point(data = SOdata[SOdata[[y]] < low,], position=position_jitter(w=0.1, h=0),col="red", alpha=0.5)+ stat_summary(fun.y=median, geom="point",shape=18 ,size=4, col="orange") } for (i in names(SOdata)[-c(1,7)]) { p<- magic(i) ggsave(paste("magig_plot_",i,".png",sep=""), plot=p, height=3.5, width=5.5) } The problem is that sometimes in the call to geom_point the subset returns an empty dataframe, which sometimes (!) causes ggplot2 to plot all the data instead of none of the data. geom_point(data = SOdata[SOdata[[y]] > high,], position=position_jitter(w=0.1, h=0),col="green", alpha=0.5)+ This is kindda of important to me, and I am really stuck trying to find a solution. Any help that will get me started is much appreciated. Thanks in advance.

    Read the article

  • WstxParsingException: "Expected a text token, got START_ELEMENT"

    - by lasombra
    I have a stub generated by WSDL2Java. I send a request and the answer that comes back (used tcptrace) looks fine. However, an AxisFault is thrown: org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxParsingException: Expected a text token, got START_ELEMENT. at [row,col {unknown-source}]: [4,1313] at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) at org.tempuri.MyStub.fromOM(MyStub.java:1726) at org.tempuri.MyStub.acceptResults(MyStub.java:612) The corresponding code in MyStub.java looks like: 607: org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient 608: .getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE); 609: org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext 610: .getEnvelope(); 611: 612: java.lang.Object object = fromOM(_returnEnv.getBody() 613: .getFirstElement(), 614: org.tempuri.AcceptQcResultsResponse.class, 615: getEnvelopeNamespaces(_returnEnv)); How do I find out which token is meant by the error? I have [row,col {unknown-source}]: [4,1313] but I don't know how to use that information.

    Read the article

  • File io error Python

    - by serpiente
    I have a program that monitors a folder with word documents for any modifications made on the files. The error -Windows Error[2] The system cannot find the file specified- comes when I run the program, open a .doc within the folder make some changes and save it. Any suggestions on how to fix this? Here's the code: def archivar(): txt = open('archivo.txt', 'r+' ) for rootdir, dirs, files in os.walk(r"C:\Users\keinsfield\Desktop\colegio"): for file in files: time = os.stat(os.path.join(rootdir, file)).st_ctime txt.write(file +','+str(time) + '\n') def check(): txt = [col.split(',') for col in (open('archivo.txt', 'r+').read().split('\n'))] files = os.listdir(r"C:\Users\keinsfield\Desktop\colegio") for file in files: for info in txt: if info[0]==os.stat(os.path.join(r"C:\Users\keinsfield\Desktop\colegio",file)).st_ctime: print "modified"

    Read the article

  • Formatting text in an html table column?

    - by DavidR
    So, I have a table like below. Imagine there are multiple columns, I thought by formatting the <col/> tag I would be able to change the formatting of every <td> in that column. I want to give data in the first column a text-align:center, but it doesn't seem to work. Is there a way to get this to work other than adding a class to every <td>? <table> <col class="column"/> <tr> ... </tr> <tr> ... </tr> <tr> ... </tr> </table>

    Read the article

  • divs not displaying as a table

    - by CoffeeCode
    i made a css: DIV.TableContainer { display: table; background-color:Aqua; } DIV.TableRow { display: table-row; } DIV.TableCell { display: table-cell; } html page: <div class="TableContainer"> <div class="TableRow"> <div class="TableCell"> <h4>Left Col</h4> <p>...</p> </div> <div class="TableCell"> <h4>Right Col</h4> <p>...</p> </div> </div> </div> but it doesnt display as a table. have i missed something???

    Read the article

  • How to display Django SelectDateWidget on one line using crispy forms

    - by Scott Johnson
    I am trying to display the 3 select fields that are rendered out using Django SelectDateWidget on one line. When I use crispy forms, they are all on separate rows. Is there a way to use the Layout helper to achieve this? Thank you! class WineAddForm(forms.ModelForm): hold_until = forms.DateField(widget=SelectDateWidget(years=range(1950, datetime.date.today().year+50)), required=False) drink_before = forms.DateField(widget=SelectDateWidget(years=range(1950, datetime.date.today().year+50)), required=False) helper = FormHelper() helper.form_method = 'POST' helper.form_class = 'form-horizontal' helper.label_class = 'col-lg-2' helper.field_class = 'col-lg-8' helper.add_input(Submit('submit', 'Submit', css_class='btn-wine')) helper.layout = Layout( 'name', 'year', 'description', 'country', 'region', 'sub_region', 'appellation', 'wine_type', 'producer', 'varietal', 'label_pic', 'hold_until', 'drink_before', ) class Meta: model = wine exclude = ('user', 'slug', 'likes')

    Read the article

  • Dropdownlist and Datareader

    - by salvationishere
    After trying many solutions listed on the internet I am very confused now. I have a C#/SQL web application for which I am simply trying to bind an ExecuteReader command to a Dropdownlist so the user can select a value. This is a VS2008 project on an XP OS. How it works is after the user selects a table, I use this selection as an input parameter to a method from my Datamatch.aspx.cs file. Then this Datamatch.aspx.cs file calls a method from my ADONET.cs class file. Finally this method executes a SQL procedure to return the list of columns from that table. (These are all tables in Adventureworks DB). I know that this method returns successfully the list of columns if I execute this SP in SSMS. However, I'm not sure how to tell if it works in VS or not. This should be simple. How can I do this? Here is some of my code. The T-sQL stored proc: CREATE PROCEDURE [dbo].[getColumnNames] @TableName VarChar(50) AS BEGIN SET NOCOUNT ON; SELECT col.name 'COLUMN_NAME' FROM sysobjects obj INNER JOIN syscolumns col ON obj.id = col.id WHERE obj.name = @TableName END It gives me desired output when I execute following from SSMS: exec getColumnNames 'AddressType' And the code from Datamatch.aspx.cs file currently is: // Add DropDownList Control to Placeholder private void CreateDropDownLists() { SqlDataReader dr2 = ADONET_methods.DisplayTableColumns(targettable); int NumControls = targettable.Length; DropDownList ddl = new DropDownList(); } Where ADONET_methods.DisplayTableColumns(targettable) is: public static SqlDataReader DisplayTableColumns(string tt) { SqlDataReader dr = null; string TableName = tt; string connString = "Server=(local);Database=AdventureWorks;Integrated Security = SSPI"; string errorMsg; SqlConnection conn2 = new SqlConnection(connString); SqlCommand cmd = new SqlCommand("getColumnNames"); //conn2.CreateCommand(); try { cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn2; SqlParameter parm = new SqlParameter("@TableName", SqlDbType.VarChar); parm.Value = "Person." + TableName.Trim(); parm.Direction = ParameterDirection.Input; cmd.Parameters.Add(parm); conn2.Open(); dr = cmd.ExecuteReader(); } catch (Exception ex) { errorMsg = ex.Message; } return dr; }

    Read the article

  • Convert a Mysql database from latin to UTF-8

    - by Matthieu
    I am converting a website from ISO to UTF-8, so I need to convert the Mysql database too. On internet, I read various solutions, I don't know wich one to choose. Do I really need to convert my varchar columns to binary, then to utf8 like that : ALTER TABLE t MODIFY col BINARY(150); ALTER TABLE t MODIFY col CHAR(150) CHARACTER SET utf8; This is long to do that for each column, of each table, of each database. I have 10 database, wich 20 tables each, wich around 2 - 3 varchar colums (2 queries each column), this gives me around 1000 queries to write ! How come ? How to do ?

    Read the article

  • assign logon scripts to local users

    - by user311130
    Hello, I wrote a c# code that creates new local user DirectoryEntry localMachine = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer"); DirectoryEntry group = localMachine.Children.Find("administrators", "group"); DirectoryEntry user = localMachine.Children.Find(accountName, "user"); Console.WriteLine(user.Properties.ToString()); I tried to set the logon script for that user by doing: localMachine.Properties["scriptPath"].Insert(0, "logonScript.vbs"); localMachine.CommitChanges(); same with group or user instances.but the property doesn't exist in any of theses instances (localMachine, group or user). I know that because I did: System.Collections.ICollection col = localMachine.Properties.PropertyNames; foreach (Object ob in col) { Console.WriteLine(ob.ToString()); } Any idea of how to do that in other way?Cheers,

    Read the article

  • Compiler optimization of reference variables

    - by Phineas
    I often use references to simplify the appearance of code: vec3f& vertex = _vertices[index]; // Calculate the vertex position vertex[0] = startx + col * colWidth; vertex[1] = starty + row * rowWidth; vertex[2] = 0.0f; Will compilers recognize and optimize this so it is essentially the following? _vertices[index][0] = startx + col * colWidth; _vertices[index][1] = starty + row * rowWidth; _vertices[index][2] = 0.0f;

    Read the article

  • MySQL Triggers - How to capture external web variables? (eg. web username, ip)

    - by Ken
    Hi, I'm looking to create an audit trail for my PHP web app's database (eg. capture inserts, updates, deletes). MySQL triggers seem to be just the thing -- but how do I capture the IP address and the web username (as opposed to the mysql username, localhost) of the user who invoked the trigger? Thanks so much. -Ken P.S. I'm working with this example code I found: DROP TRIGGER IF EXISTS history_trigger $$ CREATE TRIGGER history_trigger BEFORE UPDATE ON clients FOR EACH ROW BEGIN IF OLD.first_name != NEW.first_name THEN INSERT INTO history_clients ( client_id , col , value , user_id , edit_time ) VALUES ( NEW.client_id, 'first_name', NEW.first_name, NEW.editor_id, NEW.last_mod ); END IF; IF OLD.last_name != NEW.last_name THEN INSERT INTO history_clients ( client_id , col , value , user_id , edit_time ) VALUES ( NEW.client_id, 'last_name', NEW.last_name, NEW.editor_id, NEW.last_mod ); END IF; END; $$

    Read the article

  • Compiler optimization of references

    - by Phineas
    I often use references to simplify the appearance of code: vec3f& vertex = _vertices[index]; // Calculate the vertex position vertex[0] = startx + col * colWidth; vertex[1] = starty + row * rowWidth; vertex[2] = 0.0f; Will compilers recognize and optimize this so it is essentially the following? _vertices[index][0] = startx + col * colWidth; _vertices[index][1] = starty + row * rowWidth; _vertices[index][2] = 0.0f;

    Read the article

  • Unexpected JAXB error

    - by Mark Lewis
    Hello, From the documentation it's clear I need to use the following to get a simple unmarshalling to occur from my XML file/schema: JAXBContext jc = JAXBContext.newInstance("PackageName"); where PackageName is my package name. I've looked on google for a bit to no avail, to find out why I'm then getting this runtime error: Line:Col[2:142]:cvc-elt.1: Cannot find the declaration of element 'myconfig'. Line:Col[2:142]:unexpected element (uri:"http://www.w3.org", local:"myconfig"). Expected elements are <{}myconfig> Caught UnmarshalException This occurs at the top of all my class files, including the ones the XJC plugin for eclipse created for me (which I then moved out of PackageName.PackageName which it automatically created): package PackageName; so why is this error occurring?

    Read the article

  • PyQt: How to keep QTreeView nodes correctly expanded after a sort

    - by taynaron
    I'm writing a simple test program using QTreeModel and QTreeView for a more complex project later on. In this simple program, I have data in groups which may be contracted or expanded, as one would expect in a QTreeView. The data may also be sorted by the various data columns (QTreeView.setSortingEnabled is True). Each tree item is a list of data, so the sort function implemented in the TreeModel class uses the built-in python list sort: self.layoutAboutToBeChanged.emit() self.rootItem.childItems.sort(key=lambda x: x.itemData[col], reverse=order) for item in self.rootItem.childItems: item.childItems.sort(key=lambda x: x.itemData[col], reverse=order) self.layoutChanged.emit() The problem is that whenever I change the sorting of the root's child items (the tree is only 2 levels deep, so this is the only level with children) the nodes aren't necessarily expanded as they were before. If I change the sorting back without expanding or collapsing anything, the nodes are expanded as before the sorting change. Can anyone explain to me what I'm doing wrong? I suspect it's something with not properly reassigning QModelIndex with the sorted nodes, but I'm not sure.

    Read the article

  • qtableview (libqt) how do I correctly create a QModelIndex

    - by Chris Camacho
    I'm trying to enter edit mode on a specific cell like this void MainWindow::on_addButton_released(void) { tm->addRow(); tableView->scrollToBottom(); int ec=tm->firstWritableColumn(); int r=tm->rowCount(QModelIndex()); QModelIndex id = tm->index(r, ec, QModelIndex()); tableView->setCurrentIndex(id); tableView->edit(id); qDebug() << "row:" << r << " col:" << ec << "index:" << id; } my model creates an index like this QModelIndex TableModel::index(int row,int column,QModelIndex parent) const { Q_UNUSED(parent); return createIndex(row,column,0); } the debug output looks like this row: 9 col: 1 index: QModelIndex(9,1,0x0,TableModel(0xbf3f50) ) I'm fairly sure that the index is somehow invalid as setCurrentIndex doesn't seem to be working

    Read the article

  • How to check all check boxes at a click of a button

    - by LivingThing
    I am new to Swing, UI and MVC I have created a code based on MVC. Now my problem is that that in the controller part i have an actioneventlistener which listens to different button clicks. Out of all those buttons i have "select all" and "de-select all". In my view i have a table, one of the column of that table contains "check boxes". Now, when i click the "select-all" button i want to check all the check boxes and with "de-select all" i want to uncheck all of them. Below is my code which is not working. Please tell me what am i doing wrong here. Also, if someone knows a more elagent way please share. Thanks In my view public class CustomerSelectorDialogUI extends JFrame{ public CustomerSelectorDialogUI(TestApplicationUI ownerView, DummyCustomerStore dCStore, boolean modality) { //super(ownerView, modality); setTitle("[=] Customer Selection Dialog [=]"); //setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); custSelectPanel = new JPanel(); buttonPanel = new JPanel(); selectAllButton = new JButton(" Select All "); clearAllButton = new JButton(" Clear All "); applyButton = new JButton(" Apply "); cancelButton = new JButton(" Cancel "); PopulateAndShow(dCStore, Boolean.FALSE); } public void PopulateAndShow(DummyCustomerStore dCStore, Boolean select) { List data = new ArrayList(); for (Customer customer : dCStore.getAllCustomers()) { Object record[] = new Object[COLUMN_COUNT]; record[0] = (select == false) ? Boolean.FALSE : Boolean.TRUE; record[1] = Integer.toString(customer.customerId); record[2] = customer.fullName; data.add(record); } tModel = new TableModel(data); // In the above for loop accoring to user input (i.e click on check all or // uncheck all) i have tried to update the data. As it can be seen that i // have a condition for record[0]. //After the loop, here i have tried several options like validate(). repaint but to no avail customerTable = new JTable(tModel); scrollPane = new JScrollPane(customerTable); setContentPane(this.createContentPane()); setSize(480, 580); setResizable(false); setVisible(true); } private JPanel createContentPane() { custSelectPanel.setLayout(null); customerTable.setDragEnabled(false); customerTable.setFillsViewportHeight(true); scrollPane.setLocation(10, 10); scrollPane.setSize(450,450); custSelectPanel.add(scrollPane); buttonPanel.setLayout(null); buttonPanel.setLocation(10, 480); buttonPanel.setSize(450, 100); custSelectPanel.add(buttonPanel); selectAllButton.setLocation(0, 0); selectAllButton.setSize(100, 40); buttonPanel.add(selectAllButton); clearAllButton.setLocation(110, 0); clearAllButton.setSize(100, 40); buttonPanel.add(clearAllButton); applyButton.setLocation(240, 0); applyButton.setSize(100, 40); buttonPanel.add(applyButton); cancelButton.setLocation(350, 0); cancelButton.setSize(100, 40); buttonPanel.add(cancelButton); return custSelectPanel; } } Table Model private class TableModel extends AbstractTableModel { private List data; public TableModel(List data) { this.data = data; } private String[] columnNames = {"Selected ", "Customer Id ", "Customer Name " }; public int getColumnCount() { return COLUMN_COUNT; } public int getRowCount() { return data == null ? 0 : data.size(); } public String getColumnName(int col) { return columnNames[col]; } public void setValueAt(Object value, int rowIndex, int columnIndex) { getRecord(rowIndex)[columnIndex] = value; super.fireTableCellUpdated(rowIndex, columnIndex); } private Object[] getRecord(int rowIndex) { return (Object[]) data.get(rowIndex); } public Object getValueAt(int rowIndex, int columnIndex) { return getRecord(rowIndex)[columnIndex]; } public Class getColumnClass(int columnIndex) { if (data == null || data.size() == 0) { return Object.class; } Object o = getValueAt(0, columnIndex); return o == null ? Object.class : o.getClass(); } public boolean isCellEditable(int row, int col) { if (col > 0) { return false; } else { return true; } } } } A Views Action Listener class CustomerSelectorUIListener implements ActionListener{ CustomerSelectorDialogUI custSelectView; Controller controller; public CustomerSelectorUIListener (Controller controller, CustomerSelectorDialogUI custSelectView) { this.custSelectView = custSelectView; this.controller = controller; } @Override public void actionPerformed(ActionEvent e) { String actionEvent = e.getActionCommand(); else if ( actionEvent.equals( "clearAllButton" ) ) { controller.checkButtonControl(false); } else if ( actionEvent.equals( "selectAllButton" ) ) { controller.checkButtonControl(true); } } } Main Controller public class Controller implements ActionListener{ CustomerSelectorDialogUI selectUI; DummyCustomerStore store; public Controller( DummyCustomerStore store, TestApplicationUI appUI ) { this.store = store; this.appUI = appUI; appUI.ButtonListener( this ); } @Override public void actionPerformed(ActionEvent event) { String viewAction = event.getActionCommand(); if (viewAction.equals("TEST")) { selectUI = new CustomerSelectorDialogUI(appUI, store, true); selectUI.showTextActionListeners(new CustomerSelectorUIListener( this, selectUI ) ); selectUI.setVisible( true ); } } public void checkButtonControl (Boolean checkAll) { selectUI.PopulateAndShow(store, checkAll); } }

    Read the article

  • Why doesn't this loop terminate?

    - by David
    Here's the sample code: public static void col (int n) { if (n % 2 == 0) n = n/2 ; if (n % 2 != 0) n = ((n*3)+1) ; System.out.println (n) ; if (n != 1) col (n) ; } this works just fine until it gets down to 2. then it outputs 2 4 2 4 2 4 2 4 2 4 infinitely. it seems to me that if 2 is entered as n then (n % 2 == 0) is true 2 will be divided by 2 to yeild 1. then 1 will be printed and since (n != 1) is false the loop will terminate. Why doesn't this happen?

    Read the article

  • Alternative design for a synonyms table?

    - by Majid
    I am working on an app which is to suggest alternative words/phrases for input text. I have doubts about what might be a good design for the synonyms table. Design considerations: number of synonyms is variable, i.e. football has one synonym (soccer), but in particular has two (particularly, specifically) if football is a synonym to soccer, the relation exists in the opposite direction as well. our goal is to query a word and find its synonyms we want to keep the table small and make adding new words easy What comes to my mind is a two column design with col a = word and col b = delimited list of synonyms Is there any better alternative? What about using two tables, one for words and the other for relations?

    Read the article

  • get values from table as key value pairs with jquery

    - by liz
    I have a table: <table class="datatable" id="hosprates"> <caption> hospitalization rates test</caption> <thead> <tr> <th scope="col">Funding Source</th> <th scope="col">Alameda County</th> <th scope="col">California</th> </tr> </thead> <tbody> <tr> <th scope="row">Medi-Cal</th> <td>34.3</td> <td>32.3</td> </tr> <tr> <th scope="row">Private</th> <td>32.2</td> <td>34.2</td> </tr> <tr> <th scope="row">Other</th> <td>22.7</td> <td>21.7</td> </tr> </tbody> </table> i want to retrieve column 1 and column 2 values per row as pairs that end up looking like this [funding,number],[funding,number] i did this so far, but when i alert it, it only shows [object, object]... var myfunding = $('#hosprates tbody tr').each(function(){ var funding = new Object(); funding.name = $('#hosprates tbody tr td:nth-child(1)').map(function() { return $(this).text().match(/\S+/)[0]; }).get(); funding.value= $('#hosprates tbody tr td:nth-child(2)').map(function() { return $(this).text().match(/\S+/)[0]; }).get(); }); alert (myfunding);

    Read the article

  • How to draw the "trail" in a maze solving application

    - by snow-spur
    Hello i have designed a maze and i want to draw a path between the cells as the 'person' moves from one cell to the next. So each time i move the cell a line is drawn Also i am using the graphics module The graphics module is an object oriented library Im importing from graphics import* from maze import* my circle which is my cell center = Point(15, 15) c = Circle(center, 12) c.setFill('blue') c.setOutline('yellow') c.draw(win) p1 = Point(c.getCenter().getX(), c.getCenter().getY()) this is my loop if mazez.blockedCount(cloc)> 2: mazez.addDecoration(cloc, "grey") mazez[cloc].deadend = True c.move(-25, 0) p2 = Point(getX(), getY()) line = graphics.Line(p1, p2) cloc.col = cloc.col - 1 Now it says getX not defined every time i press a key is this because of p2???

    Read the article

  • Increase efficiency for an R simulator of the Monty Hall Puzzle

    - by jahan_m
    The Monty Hall Problem is a simple puzzle involving probability that even stumps professionals in careers dealing with some heavy-duty math. Here's the basic problem: Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice? You can find numerous explanations of the solution here: http://en.wikipedia.org/wiki/Monty_Hall_problem Goal of my simulation: Prove that a switching strategy will win you the car 2/3 of the time. I got curious and wanted to write a little function that simulates the problem many times and returns the proportion of wins if you switched and the proportion of wins if you stayed with your first choice. The function then plots the cumulative wins. First and foremost, I'm interested in hearing if my simulation is indeed replicating the Monty Problem, or if some aspect of the code got it wrong. Secondly, this function takes a long time to run once I get to about 10,000 simulations. I know I don't need this many simulations to prove this but I'd love to hear some ideas on how to make it more efficient. Thanks for your feedback! Monty_Hall=function(repetitions){ doors=c('A','B','C') stay_wins=0 switch_wins=0 series=data.frame(sim_num=seq(repetitions),cum_sum_stay=replicate(repetitions,0),cum_sum_switch=replicate(repetitions,0)) for(i in seq(repetitions)){ winning_door=sample(doors,1) contestant_chooses=sample(doors,1) if(contestant_chooses==winning_door) stay_wins=stay_wins+1 else switch_wins=switch_wins+1 series[i,'cum_sum_stay']=stay_wins series[i,'cum_sum_switch']=switch_wins } plot(series$sim_num,series$cum_sum_switch,col=2,ylab='Cumulative # of wins', xlab='Simulation #',main=sprintf('%d Simulations of the Monty Hall Paradox',repetitions),type='l') lines(series$sim_num,series$cum_sum_stay,col=4) legend('topleft',legend=c('Cumulative wins from switching', 'Cumulative wins from staying'),col=c(2,4),lty=1) result=list(series=series,stay_wins=stay_wins,switch_wins=switch_wins, proportion_stay_wins=stay_wins/repetitions, proportion_switch_wins=switch_wins/repetitions) return(result) } #Theory predicts that it is to the contestant's advantage if he #switches his choice to the other door. This function simulates the game #many times, and shows you the proportion of games in which staying or #switching would win the car. It also plots the cumulative wins for each strategy. Monty_Hall(100)

    Read the article

  • Batch command getting error

    - by alice7
    Hi Guys, I wrote a simple batch file which checks whether the c drive path exists then execute the exe in that path else try the d drive path and execute it. IF EXIST c:\program files\x goto a ELSE goto b :a cd c:\program files\x executable.exe c:\temp\col.zip :b cd d:\program files\x executable.exe c:\temp\col.zip Im getting this error: ----Error Ouput-- 'ELSE' is not recognized as an internal or external command, operable program or batch file. The system cannot find the path specified. 'executable.exe' is not recognized as an internal or external command, operable program or batch file. 'dellsysteminfo.exe' is not recognized as an internal or external command, operable program or batch file. I don't know why.

    Read the article

  • VBA Excel - Workbook_SheetChange

    - by user2947014
    Hopefully this question hasn't already been asked, I tried searching for an answer and couldn't find anything. This is probably a simple question, but I am writing my first macro in excel and am having a problem that I can't find out a solution to. I wrote a couple of macros that basically sum up columns dynamically (so that the number of rows can change and the formula moves down automatically) based on a value in another column of the same row, and I call those macros from the event Workbook_SheetChange. The problem I'm having is, I change a cell's value from my macro to display the result of the sum, and this then calls Workbook_SheetChange again, which I do not want. Right now it works, but I can trace it and see that Workbook_SheetChange is being called multiple times. This is preventing me from adding other cell changes to the macros, because then it results in an infinite loop. I want the macros to run every time a change is made to the sheet, but I don't see any way around allowing the macros to change a cell's value, so I don't know what to do. I will paste my code below, in case it is helpful. Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) Dim Row As Long Dim Col As Long Row = Target.Row Col = Target.Column If Col <> 7 Then Range("G" & Row).Select Selection.Formula = "=IF(F" & Row & "=""Win"",E" & Row & ",IF(F" & Row & "=""Loss"",-D" & Row & ",0))" Target.Select End If Call SumRiskColumn End Sub Private Sub Workbook_SheetCalculate(ByVal Sh As Object) Call SumOutcomeColumn End Sub Sub SumOutcomeColumn() Dim N As Long N = Cells(Rows.Count, "A").End(xlUp).Row Cells(N + 1, "G").Formula = "=SUM(G2:G" & N & ")" End Sub Sub SumRiskColumn() Dim N As Long N = Cells(Rows.Count, "A").End(xlUp).Row Dim CurrTotalRisk As Long CurrTotalRisk = 0 For i = 2 To N If IsEmpty(ActiveSheet.Cells(i, 6)) And Not IsEmpty(ActiveSheet.Cells(i, 1)) And Not IsEmpty(ActiveSheet.Cells(i, 2)) And Not IsEmpty(ActiveSheet.Cells(i, 3)) Then CurrTotalRisk = CurrTotalRisk + ActiveSheet.Cells(i, 4).Value End If Next i Cells(N + 1, "D").Value = CurrTotalRisk End Sub Thank you for any help you can give me! I really appreciate it.

    Read the article

  • Flex 4 how to layout spark controls in an html table type way

    - by Amy
    I have a group of controls and I want to organize them in a table like fashion. I want 1 row and 6 columns. Col 1,3,4,5,6 should all auto size to the contents and col 2 should take up the remaining available space. When the size of the group changes, only col2 width should change. I also want to be able to set the alignment of each cell. How can I do this in flex 4? I found a reference to mx:constraintColumns but this seems to be used with the canvas and in flex 4 adobe suggests not using canvases. Is there something similar in flex 4? I'm looking for something along the lines of Grid/Grid.ColumnDefinitions in silverlight.

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >