Search Results

Search found 8 results on 1 pages for 'rizzo'.

Page 1/1 | 1 

  • Performance due to entity update

    - by Rizzo
    I always think about 2 ways to code the global Step() function, both with pros and cons. Please note that AIStep is just to provide another more step for whoever who wants it. // Approach 1 step foreach( entity in entities ) { entity.DeltaStep( delta_time ); if( time_for_fixed_step ) entity.FixedStep(); if( time_for_AI_step ) entity.AIStep(); ... // all kind of updates you want } PRO: you just have to iterate once over all entities. CON: fidelity could be lower at some scenarios, since the entity.FixedStep() isn't going all at a time. // Approach 2 step foreach( entity in entities ) entity.DeltaStep( delta_time ); if( time_for_fixed_step ) foreach( entity in entities ) entity.FixedStep(); if( time_for_AI_step ) foreach( entity in entities ) entity.FixedStep(); // all kind of updates you want SEPARATED PRO: fidelity on FixedStep is higher, shouldn't be much time between all entities update, rather than Approach 1 where you may have to wait other updates until FixedStep() comes. CON: you iterate once for each kind of update. Also, a third approach could be a hybrid between both of them, something in the way of foreach( entity in entities ) { entity.DeltaStep( delta_time ); if( time_for_AI_step ) entity.AIStep(); // all kind of updates you want BUT FixedStep() } if( time_for_fixed_step ) { foreach( entity in entities ) { entity.FixedStep(); } } Just two loops, don't caring about time fidelity in nothing other than at FixedStep(). Any thoughts on this matter? Should it really matters to make all steps at once or am I thinking on problems that don't exist?

    Read the article

  • Highly Available Web Application (LAMP)

    - by Anthony Rizzo
    I work for a small company who provides a web application for thousands of users. Earlier this year they had one server hosted one company. We recently acquired another server in a different location with the hopes of one day making this a redundant failover machine. I understand what to do with the mysql replication, I plan on using a master-master replication setup, and rsync to sync the scripts and files, however I am at a stand still about how to configure the fail-over. Ideally I would like the two machines to accept requests, like a round robin dns, however if one machine goes down I do not want requests to go that machine. All of the solutions I am come across assumes high availability of servers in the same location, these servers are in two completely different locations with different public ip address. Any help would be great. Thanks

    Read the article

  • Paging with Find using Active Record

    - by Brian Rizzo
    I can't seem to find an answer to this question or a good example of how to accomplish what I am trying to do. I'm sure it's been posted or explained somewhere, but I am having trouble finding the exact solution I need. I am using ActiveRecord in Subsonic 3.0.0.3. When I do something like recordset = VehicleModel.Find(x => x.Model.StartsWith(SearchText)); I get back an IList of VehicleModel objects (or more simply a recordset), this is fine until I return too many records. I also cannot order the returned set of records (my grid will do this fine, but i'm sure it will be too slow if i have too many records). Being that Find is returning an IList there isn't much that I can run directly against this (again I may be overlooking something simple so please don't kill me). My question is can someone explain how to find data like i am above, sort it and get a page of data where a page is of size n? Am I going about this wrong? Am I even close to being on the right track?

    Read the article

  • Simple way to use Foreign Key values for sorting?

    - by Brian Rizzo
    Disclaimer: I jumped to C# 2008 recently and SubSonic 3 (3.0.0.4) at the same time. I haven't used Linq for much of anything in the past. Is there an easy way to use the foreign key display value for sorting, rather than the FK Id (which is numeric)? I've added a new Find method in my ActiveRecord.tt to help with sorting based on a string field name but after doing some testing I realized that even though its working as it should be, I am not handling foreign key fields at all (they are just sorting by their value). Even if I need to change how I am accessing the data it is early enough in the project to do that. Just looking for suggestions.

    Read the article

  • How to use Hibernate SchemaUpdate class with a JPA persistence.xml?

    - by John Rizzo
    I've a main method using SchemaUpdate to display at the console what tables to alter/create and it works fine in my Hibernate project: public static void main(String[] args) throws IOException { //first we prepare the configuration Properties hibProps = new Properties(); hibProps.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("jbbconfigs.properties")); Configuration cfg = new AnnotationConfiguration(); cfg.configure("/hibernate.cfg.xml").addProperties(hibProps); //We create the SchemaUpdate thanks to the configs SchemaUpdate schemaUpdate = new SchemaUpdate(cfg); //The update is executed in script mode only schemaUpdate.execute(true, false); ... I'd like to reuse this code in a JPA project, having no hibernate.cfg.xml file (and no .properties file), but a persistence.xml file (autodetected in the META-INF directory as specified by the JPA spec). I tried this too simple adaptation, Configuration cfg = new AnnotationConfiguration(); cfg.configure(); but it failed with that exception. Exception in thread "main" org.hibernate.HibernateException: /hibernate.cfg.xml not found Has anybody done that? Thanks.

    Read the article

  • JScrollPane content to image

    - by Sebastian Ikaros Rizzo
    I'm trying to save the main viewport and headers of a JScrollPane (larger than screen) to PNG image files. I created 3 classes extending JPanel (MainTablePanel, MapsHeaderPanel and ItemsHeaderPanel) and set them to the viewports. Each of them has this method: public BufferedImage createImage() { BufferedImage bi = new BufferedImage(getSize().width, getSize().height, BufferedImage.TYPE_INT_ARGB); Graphics g = bi.createGraphics(); paint(g); g.dispose(); return bi; } Each class has also a paint method, which paints the background and then call the super.paint() to paint some label. For example: public void paint(Graphics g){ g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(new Color(255, 255, 0, 50)); // for loop that paints some vertical yellow lines for(int i=0; i<getWidth(); i+=K.mW){ g.fillRect(i-1, 0, 2, getHeight()); if(i%(K.mW*5)==0){ g.fillRect(i-2, 0, 4, getHeight()); } } // called to pain some rotated JLabels super.paint(g); } From an external JFrame I then tried to save them to PNG file, using this code: BufferedImage tableImg = mainTableP.createImage(); BufferedImage topImg = mapsHeaderP.createImage(); BufferedImage leftImg = itemsHeaderP.createImage(); ImageIO.write(tableImg, "png", new File(s.homeDir+"/table.png")); ImageIO.write(topImg, "png", new File(s.homeDir+"/top.png")); ImageIO.write(leftImg, "png", new File(s.homeDir+"/left.png")); This is a screenshot of the application running: screenshot And this is the header exported: top If I comment the "super.paint(g)" instruction, I obtain a correct image (thus without all JLables, clearly). It seems like the second paint (super.paint(g)) is painted shifted into the BufferedImage and taking elements outside its JPanel. Somebody could explain me this behaviour? Thank you. ========== EDIT for SSCCE ==================================== This should compile. You can execute it as it is, and in c:\ you'll find two images (top.png and left.png) that should be the same as the two headers. Unfortunately, they are not. Background is not painted. Moreover (especially if you look at left.png) you can see that the labels are painted twice and shifted (note, for example, "Left test 21"). import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO; import javax.swing.*; public class Main { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setLayout(null); frame.setSize(800, 600); JScrollPane scrollP = new JScrollPane(); scrollP.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollP.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); MyPanel top = new MyPanel(); for(int i=0; i<30; i++){ JLabel label = new JLabel("Test "+i); label.setOpaque(false); label.setBounds(50*i, 40, 50, 20); label.setForeground(Color.GREEN); top.add(label); } top.setLayout(null); top.setOpaque(false); top.setPreferredSize(new Dimension(50*30, 200)); top.validate(); MyPanel left = new MyPanel(); for(int i=0; i<30; i++){ JLabel label = new JLabel("Left test "+i); label.setBounds(0, 50*i, 100, 20); label.setForeground(Color.RED); left.add(label); } left.setLayout(null); left.setOpaque(false); left.setPreferredSize(new Dimension(200, 50*30)); MyPanel center = new MyPanel(); center.setLayout(null); center.setOpaque(false); center.setPreferredSize(new Dimension(50*30, 50*30)); scrollP.setViewportView(center); scrollP.setColumnHeaderView(top); scrollP.setRowHeaderView(left); scrollP.setBounds(0, 50, 750, 500); frame.add(scrollP); frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); frame.setVisible(true); try{ BufferedImage topImg = top.createImage(); ImageIO.write(topImg, "png", new File("C:/top.png")); BufferedImage leftImg = left.createImage(); ImageIO.write(leftImg, "png", new File("C:/left.png")); }catch(Exception e){ e.printStackTrace(); } } } class MyPanel extends JPanel{ public void paint(Graphics g){ g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(new Color(255, 255, 0, 50)); for(int i=0; i<getWidth(); i+=50){ g.fillRect(i-1, 0, 2, getHeight()); } super.paint(g); // COMMENT this line to obtain background images } public BufferedImage createImage() { BufferedImage bi = new BufferedImage(getSize().width, getSize().height, BufferedImage.TYPE_INT_ARGB); Graphics g = bi.createGraphics(); paint(g); g.dispose(); return bi; } }

    Read the article

  • JavaOne pictures and Community Commentary on JCP Awards

    - by heathervc
    We posted some pictures from JCP related events at JavaOne 2012 on the JCP Facebook page today.  The 2012 JCP Program Award winners and some of the nominees responded to the community recognition of their achievements during some of the JCP events last week.     “Our job on the EC is to balance the need of innovation – so we don’t standardize too early, or too late. We try to find that sweet spot that makes innovation and standardization work together, and not against each other.”- Ben Evans, CEO of jClarity and Executive Committee (EC) representative of the London Java Community, 2012 JCP Member/Participant of the Year Winner“SouJava has been evangelizing the Java platform, promoting the Java ecosystem in Brazil, and contributing to JSRs for several years. It’s very gratifying to have our work recognized, on behalf of many developers and Java User Groups around the world. This really is the work of a large group of people, represented by the few that can be here tonight.”- Michael Santos, representative of SouJava, 2012 JCP Member/Participant of the Year Winner "In the last years Credit Suisse has contributed to the development of Java EE specifications through participation in many customer advisory boards, through statements of requirements for extensions to the core Java related products in use, and active participation in JSRs. Winning the JCP Outstanding Spec Lead Award 2012 is very encouraging for our engagement and also demonstrates the level of expertise and commitment to drive the evolution of Java. Victor Grazi is happy and honored to receive this award." - Susanne Cech Previtali, Executive Committee (EC) representative of Credit Suisse, accepting award for 2012 JCP Outstanding Spec Lead Winner "Managing a JSR is difficult. There are so many decisions to be made and so many good and varied opinions, you never really know if you have decided correctly. The key to success is transparency and collaboration. I am truly humbled by receiving this award, there are so many other active JSRs.” Victor added that going forward in the JCP EC, they would like to simplify and open the process of participation – being addressed in the JCP.Next initiative of the JCP EC. "We would also like to encourage the engagement of universities, professors and students – as an important part of the Java community. While innovation is the lifeblood of our community and industry, without strong standards and compatibility requirements, we all end up in a maze of technology where everything is slightly different and doesn’t quite work with everything else." Victo Grazi, Executive Committee (EC) representative of Credit Suisse, 2012 JCP Outstanding Spec Lead Winner“I am very pleased, of course, to accept this award, but the credit really should go to all of those who have participated in the work of the JCP, while pushing for changes in the way it operates.  JCP.Next represents three JSRs. The first two are done, but the final step, JSR 358, is the complicated one, and it will bring in the lawyers. Just to give you an idea of what we’re dealing with, it affects licensing, intellectual property, patents, implementations not based on the Reference Implementation (RI), the role of the RI, compatibility policy, possible changes to the Technical Compatibility Kit (TCK), transparency, where do individuals fit in, open source, and more.”- Patrick Curran, JCP Chair, Spec Lead on JCP.Next JSRs (JSR 348, JSR 355 and JSR 358), 2012 JCP Most Significant JSR Winner“I’m especially glad to see the JCP community recognize JCP.Next for its importance. The governance work it represents is KEY to moving the Java platform forward and the success of the technology.”- John Rizzo, Executive Committee (EC) representative of Aplix Corporation, JSR Expert Group Member “I am deeply honored to be nominated. I had the privilege to receive two awards on behalf of Expert Groups and Spec Leads two years ago. But this time, I am nominated personally, which values my own contribution to the JCP, and of course, participation in JSRs and the EC work. I’m a fan of Agile Principles and Values Working. Being an Agile Coach and Consultant, I use it for some of the biggest EC Member companies and projects. It fuels my ability to help the JCP become more agile, lean and transparent as part of the JCP.Next effort.” - Werner Keil, Individual Executive Committee (EC) Member, a 2012 JCP Member/Participant of the Year Nominee, JSR Expert Group Member“The JCP ever has been some kind of institution for me,” Markus said. “If in technical doubt, I go there, look for the specifications of the implementation I work with at the moment and verify what I had observed. Since the beginning of my Java journey more than 12 years back now, I always had a strong relationship with the JCP. Shaping the future of a technology by joining the JCP – giving feedback and contributing to the road ahead through individual JSRs – that brings you to a whole new level.”Calling himself, “the new kid on the block,” he explained that for years he was afraid to join the JCP and contribute. But in reality, “Every single one of the big names I meet from the different Expert Groups is a nice person. People you can actually work with,” he says. “And nobody blames you for things you don't know. As long as you are committed and bring what is worth the most: passion, experiences and the desire to make a difference.” - Markus Eisele, a 2012 JCP Member of the Year Nominee, JSR Expert Group MemberCongratulations again to all of the nominees and winners of the JCP Program Awards.  Next year, we will add another award for the group of JUG members (not an entire JUG) that makes the best contribution to the Adopt-a-JSR program.  Let us know if you have other suggestions or improvements.

    Read the article

1