Search Results

Search found 248 results on 10 pages for 'lewis liu'.

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

  • How to make a DropDownList control display some items in bold ASP.Net

    - by james lewis
    I'm working with a custom DropDownList control in ASP.Net and there's been a request to display certain items in the list with a bold typeface (NOTE - the control inherits from CompositeDataBoundControl so it can be data bound... not DropDownListBox). The control is bound to a table and there's a column in the table named IsUsed - if this is set to true, the corresponding item in the list should be rendered bold. (It should be noted here that this will only ever be viewed in FireFox.) My experience is all in the middle \ backend tiers so the presentation layer is very new to me - can someone point me in the right direction? My initial thought was that somewhere in the custom control I would have access to all the rows that are returned from the data source which I could cycle through etc but I'm not sure if that's possible... There's also RenderContents which I can override... looks interesting! Any help appreciated - cheers. James

    Read the article

  • JSF Deferred EL conditional syntax problem

    - by Mark Lewis
    Hello I can't find any resources which can answer why I'm getting an error with this: oncomplete="#{MyBacking.oError ? #{rich:component('oErrorPanel')}.show() : return false;}" in a richfaces a4j:commandButton. oError is referring to a method in my bean called isOError. I'm getting the error SEVERE: Servlet.service() for servlet Faces Servlet threw exception org.apache.el.parser.ParseException: Encountered " "?" "? "" at line 1, column 30. Was expecting one of: "}" ... "." ... ... I want to say 'if a method returns true, show modal panel A otherwise false'. Any help much appreciated.

    Read the article

  • Passcode functionality for iPhone app?

    - by David Liu
    I was thinking about putting in PIN number functionality within my iPhone app (various examples can be seen here http://forums.mint.com/showthread.php?t=5956 ), but I was kinda stumped how to go about it. Should I just go with a hidden textfield and simulate the inputs with images?

    Read the article

  • Hibernate: can I override an identifier generator using XML with a custom generator?

    - by Ken Liu
    I want to use a custom sequence generator in my application, but the entity is located in a domain model jar that is shared with other applications. Apparently entity annotations can be overridden in orm.xml but I can't figure out the proper XML incantation to get this to work. I can modify the annotation in the entity like this this: @GenericGenerator(name = "MYGEN", strategy = "MyCustomGenerator") @GeneratedValue(generator = "MYGEN") But I need to somehow map this to orm.xml in order to override the original annotation. Looking at the orm.xml schema here it appears that I can't even specify a generation type besides "sequence" and "table".

    Read the article

  • CATransitionFade not working on newly added subviews

    - by David Liu
    For some reason, fading in new buttons using CATransition isn't working for me when it's a newly added button. The fade animation, however, is working on existing subviews. Code: // Add new button. CATransition *animation = [CATransition animation]; [animation setDuration:0.5]; [animation setType:kCATransitionFade]; [[button layer] addAnimation:animation forKey:@"fadeIn"]; [self.view addSubview:button]; // Enable previous button (Enabling fades in different type of background) if(toolbar.buttons.count != 0){ UIButton * prevButton = [toolbar.buttons objectAtIndex:(toolbar.buttons.count - 1)]; prevButton.enabled = YES; [[prevButton layer] addAnimation:animation forKey:@"fadeIn"]; }

    Read the article

  • How to write scripts that can run in bash and csh?

    - by Victor Liu
    I'm not sure if this is even possible, but is there a way to write shell scripts that can be interpreted by both the Bourne shell as well as C shell? I want to avoid simply checking for the shell and running a shell-specific code. If this is possible, are there any guides on how to do it? I have always written my scripts for Bourne shell syntax, and I know next to nothing about csh, so this may be a stupid question. I have Google'd for the differences between shells, but there is little information (as far as I can tell) on its implications for scripting.

    Read the article

  • NavigationBar from UINavigationController not positioned correctly

    - by David Liu
    So, my iPad program has a pseudo-split view controller (one that I implemented, not base SDK one), and was working correctly a while ago. It has the basic layout (UINavController for master, content view controller for detail on right), but I have it so the master view doesn't disappear when rotated into portrait view. Recently, I added in a UITabBarController to contain the entire split view, which has made the navigation bar go wonky, while all the other views are positioned fine. In addition, the navigation bar only gets mispositioned when the program starts up while the iPad is in landscape, or upside-down portrait. If it starts out in portrait, everything is fine. Relevant Code: RootViewController.m: - (void)loadView { navController = [[NavigationBreadcrumbsController_Pad alloc] init]; ABTableViewController_Pad * tableViewController = [[ABTableViewController_Pad alloc] initWithNibName:@"ABTableView"]; master = [[UINavigationController_Pad alloc] initWithRootViewController:tableViewController]; [tableViewController release]; // Dummy blank UIViewcontroller detail = [[UIViewController alloc] init]; detail.view = [[[UIView alloc] init] autorelease]; [detail.view setBackgroundColor:[UIColor grayColor]]; self.view = [[[UIView alloc] init] autorelease]; self.view.backgroundColor = [UIColor blackColor]; [self positionViews]; [self.view addSubview:navToolbarController.view]; [self.view addSubview:master.view]; [self.view addSubview:detail.view]; } // Handles the respositioning of view into it's current orientation -(void)positionViews{ CGFloat tabBarOffset = 0; if(self.tabBarController){ tabBarOffset = self.tabBarController.tabBar.frame.size.height; } if(self.interfaceOrientation == UIInterfaceOrientationPortrait || self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) { self.view.frame = CGRectMake(0, 0, 768, 1004); navController.view.frame = CGRectMake(0,0,768,44); //adjust master view [master.view setFrame:CGRectMake(0, 44, 320, 1024 - 44 - 20 - tabBarOffset)]; //adjust detail view [detail.view setFrame:CGRectMake(321,44, 448, 1024 - 44 - 20 - tabBarOffset)]; } // Landscape Layout else{ self.view.frame = CGRectMake(0, 0, 748, 1024); navToolbarController.view.frame = CGRectMake(0,0,1024,44); //adjust master view [master.view setFrame:CGRectMake(0, 44, 320, 768 - 44 - 20 - tabBarOffset)]; //adjust detail view [detail.view setFrame:CGRectMake(321,44, 1024 - 320, 768 - 44 - 20 - tabBarOffset)]; } }

    Read the article

  • Conditionally display a richfaces modal panel

    - by Mark Lewis
    Hello Quite simple: <a4j:commandButton id="bob" action="#{MyBacking.doAction}" image="/img/btn.png" reRender="stuff" oncomplete="#{not empty MyBacking.myCondition ? #{rich:component('myModelPanel')}.show()" : <do nothing>}" ajaxSingle="true"> </a4j:commandButton> Thats obviously invalid EL. What's the most concise method I conditionally show myModelPanel in this way? Thanks IA

    Read the article

  • NSZombieEnabled hides EXC_BAD_ACCESS error entirely

    - by David Liu
    So I have a subclass of a UIView that starts causing EXC_BAD_ACCESS errors when I go through a specific set of conditions (run on iPad instead of iPhone or simulator, first login only). It throws the exception when the UIView subclass gets deallocated, during the last line, where I have [super dealloc]. I heard about using NSZombieEnabled, so I tossed that on to see if I could get any more information about it, but now it hides the error completely! Does anyone know a bit more about this type of situation? I thought NSZombie would start spewing stuff into my console like before, but I'm hoping that the nonexistance of errors would tell me some sort of information as well.

    Read the article

  • SQL Query in Ruby: Only select the changes

    - by JJ Liu
    Suppose I have a table (PriceHistory) like this, every time I change anything in the row, I will record the whole row again in the table. id | buy_price | sell_price | change_date 1 | 2 | 2 | 2012-06-22 2 | 3 | 2 | 2012-06-20 3 | 2 | 6 | 2012-06-15 4 | 5 | 5 | 2012-06-15 5 | 5 | 7 | 2012-06-15 6 | 4 | 8 | 2012-06-12 I only care about the change of BuyPrice, Is there a way to just select row 1, 2, 3, & 5? Here is the Ruby code I come up with, but it does not only select the changed rows PriceHistory.select("id, BuyPrice, change_date"). order("change_date DESC") Both Ruby and SQL answers are fine.

    Read the article

  • Component Creation How-to

    - by Larry Lewis
    I want to create a component that will allow me to install other components, modules, and plugins that i personally use all the time. I will need to be able to change these modules, components, and plugins at anytime but updating the components and etc.. that i use and be able to add more plugins and etc as well. I would like this Component because it takes too much time to install them all individually and on multiple sites as a web designer. I also would need to have some instruction on how to add subtract plugins, modules, components, and etc. I am ok with not a total integration i would like to be able to just host the install file on my server with a link to my server where the file is located. If anyone can help with this please do.

    Read the article

  • One off errors with NSLog and NSString stringWithFormat

    - by David Liu
    Does anyone know why there would be one-off errors with NSLog and NSString? It works fine in 99% of my program, but for some reason this error appears in one of my model's description method: Example code: localFileId = 7; type = 2; localId = 5; NSLog(@"CachedFile localId=%d, 2=%d, localFileId=%d, type=%d, path=%@", localId, 2, localFileId, type, self.path); Example Result: CachedFile localId=5, 2=0, localFileId=2, type=7, path=(null) Notice the "0" that gets inserted in there, where it should be "2=2". This happens with NSString stringWithFormat as well.

    Read the article

  • Is it bad practice to make a setter return "this"?

    - by Ken Liu
    Is it a good or bad idea to make setters in java return "this"? public Employee setName(String name){ this.name = name; return this; } This pattern can be useful because then you can chain setters like this: list.add(new Employee().setName("Jack Sparrow").setId(1).setFoo("bacon!")); instead of this: Employee e = new Employee(); e.setName("Jack Sparrow"); ...and so on... list.add(e); ...but it sort of goes against standard convention. I suppose it might be worthwhile just because it can make that setter do something else useful. I've seen this pattern used some places (e.g. JMock, JPA), but it seems uncommon, and only generally used for very well defined APIs where this pattern is used everywhere. Update: What I've described is obviously valid, but what I am really looking for is some thoughts on whether this is generally acceptable, and if there are any pitfalls or related best practices. I know about the Builder pattern but it is a little more involved then what I am describing - as Josh Bloch describes it there is an associated static Builder class for object creation.

    Read the article

  • UITableViewCell is transparent when not supposed to be

    - by David Liu
    My UITableViewCell is being transparent when it's not supposed to be. My table view has a background color and it shows through the table cell, even though they're supposed to be opaque. I'm not sure why this is. Relevant code: UITableViewCell *cell = [table dequeueReusableCellWithIdentifier:emptyIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:emptyIdentifier] autorelease]; } cell.textLabel.text = @"Empty"; cell.textLabel.textAlignment = UITextAlignmentCenter; cell.textLabel.backgroundColor = [UIColor whiteColor]; return cell;

    Read the article

  • return an ArrayList method

    - by Bopeng Liu
    This is a drive method for two other classes. which i posted here http://codereview.stackexchange.com/questions/33148/book-program-with-arraylist I need some help for the private static ArrayList getAuthors(String authors) method. I am kind a beginner. so please help me finish this drive method. or give me some directions. Instruction some of the elements of the allAuthors array contain asterisks “*” between two authors names. The getAuthors method uses this asterisk as a delimiter between names to store them separately in the returned ArrayList of Strings. import java.util.ArrayList; public class LibraryDrive { public static void main(String[] args) { String[] titles = { "The Hobbit", "Acer Dumpling", "A Christmas Carol", "Marley and Me", "Building Java Programs", "Java, How to Program" }; String[] allAuthors = { "Tolkien, J.R.", "Doofus, Robert", "Dickens, Charles", "Remember, SomeoneIdont", "Reges, Stuart*Stepp, Marty", "Deitel, Paul*Deitel, Harvery" }; ArrayList<String> authors = new ArrayList<String>(); ArrayList<Book> books = new ArrayList<Book>(); for (int i = 0; i < titles.length; i++) { authors = getAuthors(allAuthors[i]); Book b = new Book(titles[i], authors); books.add(b); authors.remove(0); } Library lib = new Library(books); System.out.println(lib); lib.sort(); System.out.println(lib); } private static ArrayList<String> getAuthors(String authors) { ArrayList books = new ArrayList<String>(); // need help here. return books; } }

    Read the article

  • Problem changing Java version using alternatives

    - by Brian Lewis
    I'm not quite sure how I got into this mess, but for some reason I'm not able to change the current version of Java using alternatives. I can run alternatives --config java and type my selection but when I echo the version number for either java or javac, it spits back out 1.5 every time (despite alternatives showing the current version is 1.6). The server I'm working with is running RHEL5, by the way. I have verified that the paths used in alternatives are pointing to the correct directories. Here's some output from my session: [brilewis@myserver]$ sudo /usr/sbin/update-alternatives --config java There are 3 programs which provide 'java'. Selection Command ** 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java + 2 /usr/java/jdk1.5.0_10/bin/java 3 /usr/java/jdk1.6.0_16/bin/java Enter to keep the current selection[+], or type selection number: 3 [brilewis@myserver]$ java -version java version "1.5.0_10" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03) Java HotSpot(TM) Server VM (build 1.5.0_10-b03, mixed mode) [brilewis@myserver]$ sudo /usr/sbin/update-alternatives --config java There are 3 programs which provide 'java'. Selection Command ** 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java 2 /usr/java/jdk1.5.0_10/bin/java + 3 /usr/java/jdk1.6.0_16/bin/java Enter to keep the current selection[+], or type selection number:

    Read the article

  • JavaFx 2.1, 2.2 TableView update issue

    - by Lewis Liu
    My application uses JPA read data into TableView then modify and display them. The table refreshed modified record under JavaFx 2.0.3. Under JavaFx 2.1, 2.2, the table wouldn't refresh the update anymore. I found other people have similar issue. My plan was to continue using 2.0.3 until someone fixes the issue under 2.1 and 2.2. Now I know it is not a bug and wouldn't be fixed. Well, I don't know how to deal with this. Following are codes are modified from sample demo to show the issue. If I add a new record or delete a old record from table, table refreshes fine. If I modify a record, the table wouldn't refreshes the change until a add, delete or sort action is taken. If I remove the modified record and add it again, table refreshes. But the modified record is put at button of table. Well, if I remove the modified record, add the same record then move the record to the original spot, the table wouldn't refresh anymore. Below is a completely code, please shine some light on this. import javafx.application.Application; import javafx.beans.property.SimpleStringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.HPos; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.text.Font; import javafx.stage.Modality; import javafx.stage.Stage; import javafx.stage.StageStyle; public class Main extends Application { private TextField firtNameField = new TextField(); private TextField lastNameField = new TextField(); private TextField emailField = new TextField(); private Stage editView; private Person fPerson; public static class Person { private final SimpleStringProperty firstName; private final SimpleStringProperty lastName; private final SimpleStringProperty email; private Person(String fName, String lName, String email) { this.firstName = new SimpleStringProperty(fName); this.lastName = new SimpleStringProperty(lName); this.email = new SimpleStringProperty(email); } public String getFirstName() { return firstName.get(); } public void setFirstName(String fName) { firstName.set(fName); } public String getLastName() { return lastName.get(); } public void setLastName(String fName) { lastName.set(fName); } public String getEmail() { return email.get(); } public void setEmail(String fName) { email.set(fName); } } private TableView<Person> table = new TableView<Person>(); private final ObservableList<Person> data = FXCollections.observableArrayList( new Person("Jacob", "Smith", "[email protected]"), new Person("Isabella", "Johnson", "[email protected]"), new Person("Ethan", "Williams", "[email protected]"), new Person("Emma", "Jones", "[email protected]"), new Person("Michael", "Brown", "[email protected]")); public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Table View Sample"); stage.setWidth(535); stage.setHeight(535); editView = new Stage(); final Label label = new Label("Address Book"); label.setFont(new Font("Arial", 20)); TableColumn firstNameCol = new TableColumn("First Name"); firstNameCol.setCellValueFactory( new PropertyValueFactory<Person, String>("firstName")); firstNameCol.setMinWidth(150); TableColumn lastNameCol = new TableColumn("Last Name"); lastNameCol.setCellValueFactory( new PropertyValueFactory<Person, String>("lastName")); lastNameCol.setMinWidth(150); TableColumn emailCol = new TableColumn("Email"); emailCol.setMinWidth(200); emailCol.setCellValueFactory( new PropertyValueFactory<Person, String>("email")); table.setItems(data); table.getColumns().addAll(firstNameCol, lastNameCol, emailCol); //--- create a edit button and a editPane to edit person Button addButton = new Button("Add"); addButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { fPerson = null; firtNameField.setText(""); lastNameField.setText(""); emailField.setText(""); editView.show(); } }); Button editButton = new Button("Edit"); editButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { if (table.getSelectionModel().getSelectedItem() != null) { fPerson = table.getSelectionModel().getSelectedItem(); firtNameField.setText(fPerson.getFirstName()); lastNameField.setText(fPerson.getLastName()); emailField.setText(fPerson.getEmail()); editView.show(); } } }); Button deleteButton = new Button("Delete"); deleteButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { if (table.getSelectionModel().getSelectedItem() != null) { data.remove(table.getSelectionModel().getSelectedItem()); } } }); HBox addEditDeleteButtonBox = new HBox(); addEditDeleteButtonBox.getChildren().addAll(addButton, editButton, deleteButton); addEditDeleteButtonBox.setAlignment(Pos.CENTER_RIGHT); addEditDeleteButtonBox.setSpacing(3); GridPane editPane = new GridPane(); editPane.getStyleClass().add("editView"); editPane.setPadding(new Insets(3)); editPane.setHgap(5); editPane.setVgap(5); Label personLbl = new Label("Person:"); editPane.add(personLbl, 0, 1); GridPane.setHalignment(personLbl, HPos.LEFT); firtNameField.setPrefWidth(250); lastNameField.setPrefWidth(250); emailField.setPrefWidth(250); Label firstNameLabel = new Label("First Name:"); Label lastNameLabel = new Label("Last Name:"); Label emailLabel = new Label("Email:"); editPane.add(firstNameLabel, 0, 3); editPane.add(firtNameField, 1, 3); editPane.add(lastNameLabel, 0, 4); editPane.add(lastNameField, 1, 4); editPane.add(emailLabel, 0, 5); editPane.add(emailField, 1, 5); GridPane.setHalignment(firstNameLabel, HPos.RIGHT); GridPane.setHalignment(lastNameLabel, HPos.RIGHT); GridPane.setHalignment(emailLabel, HPos.RIGHT); Button saveButton = new Button("Save"); saveButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { if (fPerson == null) { fPerson = new Person( firtNameField.getText(), lastNameField.getText(), emailField.getText()); data.add(fPerson); } else { int k = -1; if (data.size() > 0) { for (int i = 0; i < data.size(); i++) { if (data.get(i) == fPerson) { k = i; } } } fPerson.setFirstName(firtNameField.getText()); fPerson.setLastName(lastNameField.getText()); fPerson.setEmail(emailField.getText()); data.set(k, fPerson); table.setItems(data); // The following will work, but edited person has to be added to the button // // data.remove(fPerson); // data.add(fPerson); // add and remove refresh the table, but now move edited person to original spot, // it failed again with the following code // while (data.indexOf(fPerson) != k) { // int i = data.indexOf(fPerson); // Collections.swap(data, i, i - 1); // } } editView.close(); } }); Button cancelButton = new Button("Cancel"); cancelButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { editView.close(); } }); HBox saveCancelButtonBox = new HBox(); saveCancelButtonBox.getChildren().addAll(saveButton, cancelButton); saveCancelButtonBox.setAlignment(Pos.CENTER_RIGHT); saveCancelButtonBox.setSpacing(3); VBox editBox = new VBox(); editBox.getChildren().addAll(editPane, saveCancelButtonBox); Scene editScene = new Scene(editBox); editView.setTitle("Person"); editView.initStyle(StageStyle.UTILITY); editView.initModality(Modality.APPLICATION_MODAL); editView.setScene(editScene); editView.close(); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.getChildren().addAll(label, table, addEditDeleteButtonBox); vbox.setPadding(new Insets(10, 0, 0, 10)); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); } }

    Read the article

  • How small is *too small* for an opensource project?

    - by Adam Lewis
    I have a fair number of smaller projects / libraries that I have been using over the past 2 years. I am thinking about moving them to Google Code to make it easier to share with co-workers and easier to import them into new projects on my own environments. The are things like a simple FSMs, CAN (Controller Area Network) drivers, and GPIB drivers. Most of them are small (less than 500 lines), so it makes me wonder are these types of things too small for a stand alone open-source project? Note that I would like to make it opensource because it does not give me, or my company, any real advantage.

    Read the article

  • Large number of UPDATE queries slowing down page

    - by Bryan Lewis
    I am reading and validating large fixed-width text files (range from 10-50K lines) that are submitted via our ASP.net website (coded in VB.Net). I do an initial scan of the file to check for basic issues (line length, etc). Then I import each row into a MS SQL table. Each DB rows basically consists of a record_ID (Primary, auto-incrementing) and about 50 varchar fields. After the insert is done, I run a validation function on the file that checks each field in each row based on a bunch of criteria (trimmed length, isnumeric, range checks, etc). If it finds an error in any field, it inserts a record into the Errors table, which has an error_ID, the record_ID and an error message. In addition, if the field fails in a particular way, I have to do a "reset" on that field. A reset might consist of blanking the entire field, or simply replacing the value with another value (e.g. replacing the string with a new one that has all illegals chars taken out). I have a 5,000 line test file. The upload, initial check, and import takes about 5-6 seconds. The detailed error check and insert into the Errors table takes about 5-8 seconds (this file has about 1200 errors in it). However, the "resets" part takes about 40-45 seconds for 750 fields that need to be reset. When I comment out the resets function (returning immediately without actually calling the UPDATE stored proc), the process is very fast. With the resets turned on, the pages take 50 seconds to return. My UPDATE stored proc is using some recommended code from http://sommarskog.se/dynamic_sql.html, whereby it uses CASE instead of dynamic SQL: UPDATE dbo.Records SET dbo.Records.file_ID = CASE @field_name WHEN 'file_ID' THEN @field_value ELSE file_ID END, . . (all 50 varchar field CASE statements here) . WHERE dbo.Records.record_ID = @record_ID Is there any way I can help my performance here. Can I somehow group all of these UPDATE calls into a single transaction? Should I be reworking the UPDATE query somehow? Or is it just sheer quantity of 750+ UPDATEs and things are just slow (it's a quad proc server with 8GB ram). Any suggestions appreciated.

    Read the article

  • Does deleting a branch in git remove it from the history?

    - by Ken Liu
    Coming from svn, just starting to become familiar with git. When a branch is deleted in git, is it removed from the history? In svn, you can easily recover a branch by reverting the delete operation (reverse merge). Like all deletes in svn, the branch is never really deleted, it's just removed from the current tree. If the branch is actually deleted from the history in git, what happens to the changes that were merged from that branch? Are they retained?

    Read the article

  • C++ explicit template specialization of templated constructor of templated class

    - by Victor Liu
    I have a class like template <class T> struct A{ template <class U> A(U u); }; I would like to write an explicit specialization of this for a declaration like A<int>::A(float); In the following test code, if I comment out the specialization, it compiles with g++. Otherwise, it says I have the wrong number of template parameters: #include <iostream> template <class T> struct A{ template <class U> A(T t, U *u){ *u += U(t); } }; template <> template <> A<int>::A<int,float>(int t, float *u){ *u += U(2*t); } int main(){ float f = 0; int i = 1; A<int>(i, &f); std::cout << f << std::endl; return 0; }

    Read the article

  • RichFaces a4j:support parameter passing

    - by Mark Lewis
    Hello I have a number of rich:inplaceInput tags in RichFaces which represent numbers in an array. The validator allows integers only. When a user clicks in an input and changes a value, how can I get the bean to sort the array given the new number and reRender the list of rich:inplaceInput tags so that they're in numerical order? EG <a4j:region> <rich:dataTable value="#{MyBacking.config}" var="feed" cellpadding="0" cellspacing="0" width="100%" border="0" columns="5" id="Admin"> ... <a4j:repeat... <a4j:region id="MsgCon"> <rich:inplaceInput value="#{h.id}" validator="#{MyBacking.validateID}" id="andID" showControls="true"> <a4j:support event="onviewactivated" action="#{MyBacking.sort}" reRender="Admin" /> </rich:inplaceInput> </a4j:region> </a4j:repeat> </data:Table> </a4j:region> Note I do NOT want to use dataTable sort functions. The table is complicated and I've specified id="Admin" (ie the whole table) to reRender as I've not found a way to send more localised values to the backing bean through the inplaceInput. This question is about how to use a4j:support action attribute to call the sort method so that when the reRender rerenders the component, it outputs the list in sorted order. I have the sort method working ok when I click a button to sort, but I want to have the list sorted automatically as soon as a new valid value is entered into the inplaceInput component. Thanks

    Read the article

  • Determining polygon intersection and containment

    - by Victor Liu
    I have a set of simple (no holes, no self-intersections) polygons, and I need to check that they don't intersect each other (one can be entirely contained in another; that is okay). I can check this by simply checking the per-vertex inside-ness of one polygon versus other polygons. I also need to determine the containment tree, which is the set of relationships that say which polygon contains any given polygon. Since no polygon can intersect any other, then any contained polygon has a unique container; the "next-bigger" one. In other words, if A contains B contains C, then A is the parent of B, and B is the parent of C, and we don't consider A the parent of C. The question: How do I efficiently determine the containment relationships and check the non-intersection criterion? I ask this as one question because maybe a combined algorithm is more efficient than solving each problem separately. The algorithm should take as input a list of polygons, given by a list of their vertices. It should produce a boolean B indicating if none of the polygons intersect any other polygon, and also if B = true, a list of pairs (P, C) where polygon P is the parent of child C. This is not homework. This is for a hobby project I am working on.

    Read the article

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