Increasing lenght per second

Hi,i want to create an applet which will contain a rectangle.The rectangle will be filled with any color and its lenght will increase by 1 cm per second.I know that i have to use threads to achieve this but when i try it something seems to go wrong,can anybody help me?

maybe this is what you're looking for?!
import java.applet.*;
import java.awt.*;
import java.util.*;
class Dot {
     public int x,y;
     public float xdir,ydir;
     public Dot(int x,int y,float xdir,float ydir) {
          this.x = x;
          this.y = y;
          this.xdir = xdir;
          this.ydir = ydir;
public class Rect extends Applet implements Runnable {
     Dot dot[];
     Image buffer;
     int w,h,scale;
     final float GRAVITY = 0.1f,MAX_XDIR = -1.0f,MAX_YDIR = -8.0f,MIN_YDIR = 1.0f;
     public void init() {
          w = getSize().width;
          h = getSize().height;
          scale = 100;
          buffer = createImage(w,h);
          initRect();
          new Thread(this).start();
     protected void initRect() {
          Vector v = new Vector(0);
          int x,y;
          for (y = scale;y < h-scale;y++) {
               if (y == scale || y == h-scale-1) {
                    for (x = scale;x < w-scale;x++) {
                         v.addElement(new Dot(x,y,MAX_XDIR,MIN_YDIR));
               else {
                    v.addElement(new Dot(scale,y,MAX_XDIR,MIN_YDIR));
                    v.addElement(new Dot(w-scale-1,y,MAX_XDIR,MIN_YDIR));
          dot = new Dot[v.size()];
          for (x = 0;x < dot.length;x++) {
               dot[x] = (Dot)v.elementAt(x);
     public void run() {
          while (true) {
               for (int j = 0;j < dot.length;j++) {
                    dot[j].y+=(int)dot[j].ydir;
                    dot[j].x+=(int)dot[j].xdir;
                    dot[j].ydir+=GRAVITY;
                    if (dot[j].x < 0) {
                         dot[j].x = 0;
                         dot[j].xdir*=-1.0f;
                    if (dot[j].x > w) {
                         dot[j].x = w;
                         dot[j].xdir*=-1.0f;
                    if (dot[j].y >= h) {
                         dot[j].y = h;
                         dot[j].ydir = MAX_YDIR;
               Graphics g = getGraphics();
               if (g != null) paint(g);
               else repaint();
               try {
                    Thread.sleep(10);
               catch (InterruptedException e) {
                    break;
     public void paint(Graphics g) {
          Graphics gfx = buffer.getGraphics();
          gfx.setColor(Color.white);
          gfx.fillRect(0,0,w,h);
          gfx.setColor(Color.black);
          for (int j = 0;j < dot.length;j++) {
               gfx.drawRect(dot[j].x,dot[j].y,1,1);
          g.drawImage(buffer,0,0,null);
     public void update(Graphics g) {
          paint(g);
}lol.. have fun with that flexible little bugger... (if you're too lazy to compile, just view it here)

Similar Messages

  • Acquire, display, and write data at 50 samples per second

    I have a vi running on a PXI which samples data using two 4220's (all 4 channels) and one 6031 (only 6channels).  I am acquiring data at 100 samples per second, but only need to write the data out at 50 samples per second.  The data needs to be displayed at a minimum of 10samples per second.  The problem is that the VI can not get 50samples per second writen to the file, it writes about 20 to 30samples per second.
    I dont know if the issue is displaying the data which is holding up the writing at 50samples per second or if it is something else in the VI.  I have moved the writing of the data to the outside of the while loop, but this did not help enough to reach 50samples/sec.
    Is it better to change the waveform data types to dynamic waveforms?  Would this increase speed of operations?
    Galen
    Attachments:
    ATM_FrictionTests_v1.2.vi ‏375 KB

    Galen,
    Looking at your vi, I would recommend writing to your file in a different way.  The function you are using is actually opening, writing, and then closing the file every time you call it.  This greatly increases the amount of resources being used.  Take a look at the Cont Acq to Spreadsheet File.vi example and note that the file is only being opened and closed once.  The data is being written to the file during execution of the program, and then closed when the app is done running.  The example is done in traditional DAQ but you should be able to do something similar with DAQmx.  Try this and let me know if it helps. 
    Regards,
    LA

  • How many of these objects should I be able to insert per second?

    I'm inserting these objects using default (not POF) serialization with putAll(myMap). I receive about 4000 new quotes per second to put in the cache. I try coalescing them to various degrees but my other apps are still slowing down when these inserts are taking place. The applications are listening to the cache where these inserts are going using CQCs. The apps may also be doing get()s on the cache. What is the ideal size for the putAll? If I chop up myMap into batches of 100 or 200 objects then it increases the responsiveness of other apps but slows down the overall time to complete the putAll. Maybe I need a different cache topology? Currently I have 3 storage enabled cluster nodes and 3 proxy nodes. The quotes go to a distributed-scheme cache. I have tried both having the quote inserting app use Extend and becoming a TCMP cluster member. Similar issues either way.
    Thanks,
    Andrew
    import java.io.Serializable;
    public class Quote implements Serializable {
        public char type;
        public String symbol;
        public char exch;
        public float bid = 0;
        public float ask = 0;
        public int bidSize = 0;
        public int askSize = 0;
        public int hour = 0;
        public int minute = 0;
        public int second = 0;
        public float last = 0;
        public long volume = 0;
        public char fastMarket; //askSource for NBBO
        public long sequence = 0;
        public int lastTradeSize = 0;
        public String toString() {
            return "type='" + type + "'\tsymbol='" + symbol + "'\texch='" + exch + "'\tbid=" +
                    bid + "\task=" + ask +
                    "\tsize=" + bidSize + "x" + askSize + "\tlast=" + lastTradeSize + " @ " + last +
                    "\tvolume=" + volume + "\t" +
                    hour + ":" + (minute<10?"0":"") + minute + ":" + (second<10?"0":"") + second + "\tsequence=" + sequence;
        public boolean equals(Object object) {
            if (this == object) {
                return true;
            if ( !(object instanceof Quote) ) {
                return false;
            final Quote other = (Quote)object;
            if (!(symbol == null ? other.symbol == null : symbol.equals(other.symbol))) {
                return false;
            if (exch != other.exch) {
                return false;
            return true;
        public int hashCode() {
            final int PRIME = 37;
            int result = 1;
            result = PRIME * result + ((symbol == null) ? 0 : symbol.hashCode());
            result = PRIME * result + (int)exch;
            return result;
        public Object clone() throws CloneNotSupportedException {
            Quote q = new Quote();
            q.type=this.type;
            q.symbol=this.symbol;
            q.exch=this.exch;
            q.bid=this.bid;
            q.ask = this.ask;
            q.bidSize = this.bidSize;
            q.askSize = this.askSize;
            q.hour = this.hour;
            q.minute = this.minute;
            q.second = this.second;
            q.last = this.last;
            q.volume = this.volume;
            q.fastMarket = this.fastMarket;
            q.sequence = this.sequence;
            q.lastTradeSize = this.lastTradeSize;
            return q;
    }

    Well, firstly, I surprised you are using "float" objects in a financial object, but that's a different debate... :)
    Second, why aren't you using pof? Much more compact from my testing; better performance too.
    I've inserted similar objects (but with BigDecimal for the numeric types) and seen insert rates in the 30-40,000 / second (single machine, one node). Obviously you take a whack when you start the second node (backup's being maintained, plus that node is probably on a separate server, so you are introducing network latency.) Still, I would have thought 10-20,000/second would be easily doable.
    What are the thread counts on the service's you are using?; I've found this to be quite a choke point on high-throughput caches. What stats are you getting back from JMX for the Coherence components?; what stats from the server (CPU, Memory, swap, etc)?; What spec of machines are you using? Which JVM are you using? How is the JVM configured? What's are the GC times looking like? Are you CQC queries using indexes? Are your get()'s using indexes, or just using keys? Have you instrumented your own code to get some stats from it? Are you doing excessive logging? So many variables here... Very difficult to say what the problem is with so little info./insight into your system.
    Also, maybe look at using a multi-threaded "feeder" client program for your trades. That's what I do (as well as upping the thread-count on the cache service thread) and it seems to run fine (with smaller batch sizes per thread, say 50.) We "push" as well as fully "process" trades (into Positions) at a rate of about 7-10,000 / sec on a 4 server set-up (two cache storage nodes / server; two proxies / server.) Machines are dual socket, quad-core 3GHz Xeons. The clients use CQC and get()'s, similar to your set-up.
    Steve

  • What is the most Frames Per Second NI-CAN can do?

    My goal is to send 1000 Frames per Second on my CAN bus using the NI-CAN PCI 2 slot card I have.  However the closest I have been able to do is 666 frames per second.  This is sending 8 frames every 12 MS using an edited readmult example.  Is there a way to do this with writemult?  Or is there a hardware limit that I am trying to go past?
    What can I mess with to get more frames?  Increase Baudrate?  Decrease the size of the frames?  (I've tried both of those)
    Other questions that should probably go in other posts  (Frame API):
    Is there a way to send/read the frames at the bit-level?  I have found ways to manipulate Arbitration ID, Remote Frame, Data Length, and Data, but there are several other bits in a frame.
    Is there a way to send a bad frame, one that would raise/cause an error frame?

    Yes, I did break 1,000 Frames Per Second.  I got up to 1,714 and 1,742 using two different methods.  This is at 250 kbps, if you used 500 or 1 Mbps, you could get more frames.  If you have 125 kbps, you might not be able to break 1,000 Frames per Second.
    ncWriteMult is the key.  You can load 512 frames in a queue at a time.  I would put 256 on at a time and check to see if there was less than 256 frames left in the queue and if there was, load it up, that way the queue would never be empty.  I went about it 2 ways, one was using ncGetAttribute to determine space left, and that got the faster method, however, I was also trying to read the messages to verify that it worked, and I had problems with logging every frame.  It would also send the first 40 ncWriteMults quickly, as if the queue it was filling was much larger than 512.
    The other way, was using trial and error to determine how many MS to sleep before writing the next batch of 256 frames.  There are variables outside of my control that determined the time it would take and it would vary a few ms.  I wanted a stable environment that could send forever without filling the queue so I went with a value that would wait 2 or 3 ms, depending on conditions before writing again.  The value I used was 142 ms, I think.  Your Mileage May Vary.
    There is also a way to do some error handling that I did not try to utilize.  Instead of the process crashing, there is a way to tell it to wait if this error is returned.  That might be the best way for me to implement what I wanted to do, but I was assigned another task before I tried to get that to work.
    There is a timing element in ncWriteMult's documentation I didn't look into very much, but that would space the frames out and could send 1,000 frames a second evenly distributed, instead of sending them as quickly as possible, wait some ms then send another batch.
    If anyone could link us, or provide some code snippets of the error handling, or proper usage of ncGetAttribue, or some way to read faster, that would be greatly appreciated.

  • Number of IDOC created per second

    Hi, I am using a middleware (such as Cast Iron and IBM DataStage) to convert external data into IDOC and send to SAP using ALE method. The speed of creating the IDOC in SAP is about 1 IDOC per second, is there any parameter/configuration can be done in SAP to speed up the creation of IDOC? I heard that R/3 will open addtional ALE channel at run time depend on load, can it be configure?
    I am running SAP 4.7 (6.2) with unicode.

    Hi Chee Hean Liew,
    the basic situation is, that one IDOC takes one dialog process in one tRFC.
    Some partner middlewares are certified for sending several IDOCs in one LUW (tRFC) -> several IDOCs take one dialog process.
    You have following possibilities to increase performance:
    in option if you collect IDOCs:
    - merge several IDOCs in one tRFC if partner certified for
    /- merge several IDOcs in one File/
    General:
    - Increase dialog processes - depending on your system   performance
    - Increase dialog process for tRFC (RZ12, RZ04)
    There is a general rule: sum of dialog tRFC must be higher
    then the sum of non-dialog processes.
    Regards
    Tibor

  • Frame per Second drop after iOS 7.0.2

    Hello;
    Has anyone noticed that after upgrading to iOS 7.0.2, Frame per Second (FPS) in games has dropped?
    I noticed that when i swipe from bottom to top for control center(small box with arrow appears) and FPS returns to normal when the box is still there; after box disappears the FPS drops again and I swipe up and FPS increases;
    I disabled Control Center access from settings (in app access) but this time fps always stays low..
    I believe there is a bug with Control Center..

    It also says there is no memory to sync and there is 5gb free.
    Its happening with music too when I tried that.  Getting worse.

  • 10.6.4 OD Master: slapd exceeded 500 log message per second limit

    We've got here a 10.6.4 Server OD Master setup with 800 users, 12GB RAM that sometimes starts to get unresponsive. It's slapd that suddenly refuses to respond. CPU load rises to around 10-15% which is high for Intel Xserves. When this happens, our mail service can't authenticate anymore (we use communigate with an external authentication helper script that is designed to restart every 30 seconds. If we restart slapd, all is fine again for a week or so.
    DNS is all fine, Kerberos and password server ok, changeip -checkhostname reports that all is ok. The server was setup from scratch with imported groups and users from a 10.5.8 od master. I've already increased the the amount of returned values of the ldap to 25000 that didn't solve the issue because we first thought the external helper script of our mail server causes the problem, but it's in fact slapd that hangs. What could trigger this behavior with a brand new Xserve with 12GB RAM, with all services configured perfectly?
    Excerpt of the error log:
    request: socketpair failed 24 (Too many open files)
    Aug 27 11:50:51: --- last message repeated 499 times ---
    Aug 27 11:50:51 authority slapd[92258]: * process 92258 exceeded 500 log message per second limit - remaining messages this second discarded *
    Aug 27 11:50:52 authority slapd[92258]: dnssd_clientstub deliver_request: socketpair failed 24 (Too many open files)
    Aug 27 11:50:52: --- last message repeated 499 times ---
    Aug 27 11:50:52 authority slapd[92258]: * process 92258 exceeded 500 log message per second limit - remaining messages this second discarded *
    Aug 27 11:50:53 authority slapd[92258]: dnssd_clientstub deliver_request: socketpair failed 24 (Too many open files)
    Aug 27 11:50:53: --- last message repeated 499 times ---
    Aug 27 11:50:53 authority slapd[92258]: * process 92258 exceeded 500 log message per second limit - remaining messages this second discarded *
    Any idea what this could be?
    Thanks,
    Alex
    Message was edited by: Alex33

    I was able to identify the cause. Wrote in this thread the solution:
    http://discussions.apple.com/message.jspa?messageID=13160082#13160082

  • Horrible video skip / lag problem - once per second in all apps!

     I built a new system last month (my first AMD) and I am having a really aggravating problem. In all games and all video playback I get an annoying skip once per second, every second. It affects sound during gameplay but not during movie or mp3 playback. It even happens with the visualization mode in Windows Media Player.
    My system is as follows: MSI K8N Neo4-F, A64 3200+ venice core, MSI 6800GT 256MB PCI-E, two sticks of Corsair valueselect DDR400 512MB each, 500 watt PS, 160GB 7200 SATA HDD. Most recent NVIDIA drivers for everything. WinXP Pro with SP2 and all updates, DX9C. Nothing overclocked, all settings standard.
    I have tried the following solutions:
    1) BIOS upgrades, started with 1.4, installed 1.5, MSI tech support gave me 1.6b2 and I installed that. No luck with any of them.
    2) Memory, installed per MSI directions, but I've tried all legal combinations, including one stick at a time. No change.
    3) full format and reinstall of WinXP. No luck.
    4) Switching between WinXP IDE drivers and NVidia drivers, with and without RAID drivers, No luck.
    5) Removal of 6800GT PCI-E card and replacing with Ancient 8MB PCI Permedia2 video card. Problem still persists.
    6) Disable onboard sound and LAN. No luck.
    7) Running Fedora core 4 on second partition. Installed Nvidia video drivers, tried some games. THIS WORKS! No hitch, no skip, no nothing. Framerates are noticably slower but very stable. In WinXP I saw framerates bounce all over the place, from 230 FPS down to about 70 with one game. That same game on Linux ran smoothly at about 166 FPS with only occasional slight drops. The big FPS drops in Windows usually came right after one of the skips but didn't occure after every skip.
    Right now I'm stumped. Linux uses totally different drivers for sound, LAN and SATA support. Some of those drivers don't fully use the Nforce4 chipset's features, maybe that's part of the difference.

    Thanks TireSmoke:
    I had found that sticky, but I took your advice and went thorugh it in detail last night.  Lots of great info, fixes tweaks and tools, sadly none of them fixed my problem.  The lag problem most people are reporting is not really like the wierd problem I am having.  I have tried the recoommended fixes with ablsolutely no change in my system's behavior.
    I am beginning to suspect a faulty motherboard component.
    Russ_XP:
    I think you are correct about fast writes.  I googled the heck out of that last night and couldn't find any reference to enabling or disabling fast writes on PCI-E.
    The drive is SATA-1.  The Neo4-F is not SATA-2 enabled (there is a hack for it though).  From memory I think it's a Western Digital WD1600-something, 7200 RPM dirve.  I've tried it on both SATA buses and tried disabling the unused bus in BIOS.
    I'm pretty sure I can dig up an old PATA drive somewhere and give that a try.
    Gpalmer:
    True enough, and I don't have these problems under Fedora.  Sadly this is a cross-platform game development box, I need both XP and Fedora working.
    Black_God:
    Nope, this is a clean install.  Although I wonder, could any of the built in XP update and security tools be causing this?  I have disabled Windows firewall and virus protection monitoring.

  • Downloads per Second slower than normal

    Hi, i've moved from profile ADSL MAX to ADSL 2+ however my downloads per second are average around 2-400kbs a sec, my download speed is just over 7mb and my downloads have been around 850kbs a sec.
    Any reason to why this is?
    I don't do much heavy downloads, most of my connection is used for either gaming or downloading some the app or playstation and its really slow at downloading anything.
    If you want to say thanks for a helpful answer, please click on the Ratings star on the left-hand side If the the reply answers your question then please mark as ’Mark as Accepted Solution

    sorry my computer crashed here it is
    FAQ
    Test1 comprises of two tests
    1. Best Effort Test:  -provides background information.
    Download  Speed
    4339 Kbps
    0 Kbps
    7150 Kbps
    Max Achievable Speed
     Download speedachieved during the test was - 4339 Kbps
     For your connection, the acceptable range of speeds is 2000-7150 Kbps.
     Additional Information:
     Your DSL Connection Rate :7192 Kbps(DOWN-STREAM), 1060 Kbps(UP-STREAM)
     IP Profile for your line is - 6345 Kbps
    2. Upstream Test:  -provides background information.
    Upload Speed
    821 Kbps
    0 Kbps
    1060 Kbps
    Max Achievable Speed
    >Upload speed achieved during the test was - 821 Kbps
     Additional Information:
     Upstream Rate IP profile on your line is - 1060 Kbps
    We were unable to identify any performance problem with your service at this time.
    It is possible that any problem you are currently, or had previously experienced may have been caused by traffic congestion on the Internet or by the server you were accessing responding slowly.
    If you continue to encounter a problem with a specific server, please contact the administrator of that server in the first instance.
    If you want to say thanks for a helpful answer, please click on the Ratings star on the left-hand side If the the reply answers your question then please mark as ’Mark as Accepted Solution

  • 10,000 Recorc Per Second (In EJB 3.0)

    hi all,
    i have some mission critical tasks into my project, is it possible to persist 10 000 record per seconds,
    1. AS - JBoss Application Server 4.0.4GA
    2. Database - Oracle 10G 10.2.0.1
    3.EJB - 3.0 Framework
    4.OS - SunOS 5.10
    4.Server - Memory: 16G phys mem, 31G swap, 16 CPU,
    i know that i need performace
    here is my configurations about performance
    1. JVM Config Into JBoss
    JAVA_OPTS="-server -Xmx3168m -Xms2144m -Xmn1g -Xss256k -d64 -XX:PermSize=128m -XX:MaxPermSize=256m
       -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
        -XX:ParallelGCThreads=20 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC
        -XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=90 -XX:MaxTenuringThreshold=31 -XX:+AggressiveOpts
        -verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:+PrintTenuringDistribution2. also i configure my database.xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <datasources>
      <xa-datasource>
        <jndi-name>XAOracleDS</jndi-name>
        <track-connection-by-tx/>
        <isSameRM-override-value>false</isSameRM-override-value>
        <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
        <xa-datasource-property name="URL">jdbc:oracle:thin:@192.168.9.136:1521:STR</xa-datasource-property>
        <xa-datasource-property name="User">SRVPROV</xa-datasource-property>
        <xa-datasource-property name="Password">SRVPROV</xa-datasource-property>
        <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
        <min-pool-size>50</min-pool-size>
        <max-pool-size>200</max-pool-size>    
        <metadata>
             <type-mapping>Oracle9i</type-mapping>
          </metadata>
      </xa-datasource>
      <mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter"
             name="jboss.jca:service=OracleXAExceptionFormatter">
        <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
      </mbean>
    </datasources>3. Also i have one simple Stlateless Session Bean
    @Stateless
    @Remote(UsageFasade.class)
    public class UsageFasadeBean implements UsageFasade {
         @PersistenceContext(unitName = "CustomerCareOracle")
         private EntityManager oracleManager;
         @TransactionAttribute(TransactionAttributeType.REQUIRED)
         public long createUsage(UsageObject usageObject, UserContext context)
                   throws UserManagerException, CCareException {
              try {
                   oracleManager
                             .createNativeQuery("INSERT INTO USAGE "
                                       + " (ID, SESSION_ID, SUBSCRIBER_ID, RECDATE, STARTDATE, APPLIEDVERSION_ID, CHARGINGPROFILE_ID, TOTALTIME, TOTALUNITS, IDENTIFIERTYPE_ID, IDENTIFIER, PARTNO, CALLTYPE_ID, USAGETYPE, APARTY, BPARTY, CPARTY, IMEI, SPECIFICCALLTYPE, APN, SOURCELOCATION, SMSCADDRESS, MSC_ID, ENDREASON, USAGEORIGIN, BILL_ID, CONTRACT_ID) "
                                       + " VALUES(SEQ_USAGE_ID.NEXTVAL, NULL, NULL, SYSDATE, SYSDATE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) ");                              
                   return 1;
              } catch (Exception e) {
    }3. and into client side i have 200 Threads, each of them tried to call this method 50 times
    my result is that i can persist 10000 record in 20 seconds, without hibernate, with hibernate i got worst result :(,
    also i hear that it is good idea to use JDBC 3.0 driver for performance,
    i download newest oracle jdbc jar file from oracle site
    http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_10201.html
    is this jar file JDBC 3.0 driver ?
    is there any hibernate performance configuration?
    is it any more performance tuning into JBoss or EJB with entity beans?
    can anybody help me ? or is there any doc which can help me ?
    Regards,
    Paata,
    Message was edited by:
    paata
    Message was edited by:
    paata

    What makes you think that your database, just the database (with the box that it is on) can handle that rate?
    What makes you think that your network can handle that?
    While this is going on is this the ONLY traffic that will be on the network?

  • Newbie trying to understand the frame/fields per second concept on video

    Do video camera shutter speeds (1/60sec) reflect an interlaced field or a full frame comprised of two interlaced fields per part of a second.
    I suspect that a shutter setting of 1/60sec means it's not a full frame of video but is just an odd or even lined interlace field. Meaning that if I want to shoot 30fps I need to keep my shutter setting on 1/60sec.
    But if that's really the case, then what am I exactly shooting per second if actual NTSC frame rate is 29.97fps? I mean, the first 2p frames can easily be divided into two fields each, but what about the remaining .97frame. How can you divide that into two fields of interlaced video lines?
    Forgive my ignorance but books have a bad habit of not answering back when you don't understand something they say.
    iMac Intel Duo-Core; Intel Mac mini single-core   Mac OS X (10.4.6)  
    iMac Intel Duo-Core; Intel Mac mini single-core   Mac OS X (10.4.6)  

    The shutter speed is not relevant. I can be either field based or progressive. The frame rate is not dependent on the shutter speed.

  • Calculating Frames Per Second Accurately

    I tried searching the forums for suggestions or code used to calculate FPS accurately... But was ultimately unsuccessful.
    I think I have a pretty basic understanding of how it works... but I'm still left wondering if there's a better... or correct way of attacking the problem.
    What I started out doing is taken a pre-cycle time sample using System's currentTimeMillis method, followed by the main parts I'm executing in my program and then took a second time sample. I subtracted the post-cycle from the pre-cycle to get the time... and it occurred to me that the currentTimeMillis is not exactly reliable. As it says in the API, "For example, many operating systems measure time in units of tens of milliseconds," when discussing that method.
    I then noticed the nanoTime method and decided to use that.
    It quite honestly seems to work perfectly for what I'm trying to accomplish.
    I pretty much used the same steps as before.
    But now my problem is that I want to limit the amount of frames per second to 60.
    I decided that I should try using the Thread class's sleep(long millis, int nanos) method.
    It seemed like it would work... but to my dismay, it did not.
    The milliseconds, for the most part, were correctly timed... but still not always. The nanoseconds even less so... but I knew that the nanoseconds would be less reliable-I decided to use microseconds. Using microseconds doesn't even work that well.
    So I wondered if there was an even better way... maybe a more 'manual' approach to fixing my problem.
    I would greatly appreciate any input/knowledge on the matter.

    its quite simple. Windows has an API call that can set the timer precision (its all based on some interrupt interval - I forgot the precise details). This precision is system wide, so if one application does it it is immediately active for all other applications running at that time. Applications can only lower it, so if you set it to 1ms then some other application cannot force it to 5ms for example.
    Now here comes JVM bug number two.
    As said the interval differs per system - sometimes it is 10ms, sometimes it is 15ms. The JVM wrongfully assumes it is always 10ms however. Do a test: try to sleep for some time that is a multiple of 10 (without the long running thread hack active); you'll find that the precision still sucks. That is because in this specific case the JVM does NOT change the system wide timing precision. But if you sleep for any number of milliseconds that is not a multiple of 10 it will actually temporarily set the precision to 1ms.
    So the rule is: as long as one thread goes to sleep the precision is set to 1ms. When the last sleeping thread wakes up, it is reset to what it was. Then it also doesn't matter for what amount of time you make your real thread sleep as the long sleeping thread will not be sleeping for an amount that is a multiple of 10, thus forcing the precision to 1ms.
    Now say that you don't do the long sleeping thread hack and you make your own thread sleep for say 9ms, switching to 1ms precision temporarily. This behavior makes it so that sampling the passed time (before and after sleeping) can be imprecise; you'll find that most of the time you'll get sampling that matches the number of milliseconds you slept and sometimes it jumps to 10/15ms depending on the granularity of your system. This is a concurrency problem; sometimes the precision is reset before you get a chance to sample the current time.
    So to recap to give 100% accuracy with System.currentTimeInMillis(), you need to keep a thread sleeping at all time so the precision stays at 1ms.
    And then finally we come to bug #3, which is a problem in Windows itself: rapidly changing the precision (which happens when you make a single thread sleep for short intervals) can screw with the system clock. I don't know if this problem still exists in later iterations of Windows, but it is again a reason to do the long sleeping thread hack. Because this is a known issue I still call this a bug in the JVM because of the way they implemented the precision timer activation, which can trigger the problem in Windows. The command line switch mentioned in the above bug report SHOULD have fixed that... but you know, facepalm bug #4.
    But at the end of the day: even if at least 4 bugs can be named regarding precise timing in Java under Windows, the root of all evil is still the way timing is implemented in Windows itself making life too difficult for the poor JVM devs. What were the MS devs thinking at the time?

  • Final Cut Pro X Image Sequence Export missing frames per second option?

    I am using the trial version of Final Cut Pro X.  I can export an image sequence but it will only allow me to do so at 30 frames per second -every single frame! 
    So a 10 min movie takes half an hour to export 20,000+ frames that no one on earth has time to look thru.
    In my old Final Cut Express I was able to choose 1 or 2 frames per second, which was just right.
    What am I missing?
    Do I need to buy Quicktime Pro or Compressor to allow me to export image sequences without exporting every frame?
    Why would Apple even have an image sequence export if it only allows you to export every frame, or it that only in the trial version?
    Thank you

    I found a free option for you, if you don't already have Compressor 4.
    In FCPX create your movie. Then SHARE as a Master File.
    Get MPEG Streamclip, which is a free app available here.
    http://www.squared5.com/svideo/mpeg-streamclip-mac.html
    Drag your Master File into MPEG Streamclip.
    In MPEG Streamclip, select FILE/EXPORT TO OTHER FORMATS.
    In FORMAT: choose IMAGE SEQUENCE
    In OPTIONS, choose your frame rate.

  • How to create a $ per second report.

    I have a scenario where I have several stores all posting sales in real time to a BAM object.
    The Fileds are:
    StoreID "string"
    PurchaseDate "datetime"
    PurchaseAmount "integer"
    I like to create a report that will display the sales per second for a given store over a defined Period of time.
    As an example:
    If the report is run and 60 seconds is entered as a report parameter for the period of time and StoreID set to "1" (also via paramter) then I'd like to know what was the average sales per second over the last 60 seconds for StoreID 1.
    Obviously this report would be continually updating giving me a real time gauge indicating when sales per second has dropped or spiked.
    A real example:
    Lets say there are 3 sales in the last 60 seconds for StoreID 1 as follows -
    1,3/20/1977 3:08:08 PM,100
    1,3/20/1977 3:08:14 PM,160
    1,3/20/1977 3:08:33 PM,100
    If I ran the report at 3/20/1977 3:08:34 PM there would only be 3 entries which fall within the last 60 seconds (Report Paramter) for StoreID 1 (Report Paramter). And averaging out the sales total would give me (100+160+100)/60=6$/second
    Can anyone point me in the right direction on how to solve this?
    D

    Not sure I understand what you want, but I set up a page with 2 items on one row, 3 on the next. http://apex.oracle.com/pls/apex/f?p=23834:30 is that the sorta thing you want to do? - control where the items appear?
    If so - you can just use drag and drop layout, or on the items settings (Displayed settings), specify whether or not it appears on a new line or not.
    Ta,
    Trent

  • 1,000,000 updates per second?

    How could you configure a coherence cluster to handle processing a million stock quotes per sec? The datafeed could be configured as a single app spewing out all 1,000,000/sec or it could be many apps producing proportionately fewer ticks/sec but in any case it's going to total a million/sec. Fractions of the feed spread among multiple physical servers sounds smartest. The quote Map.Entry would probably have a Key of String (or char[] if that's more efficient - i know the max length). The Value would be a price and a size so maybe just those two elements byte[]{Float,Integer} or a java object with Float and Integer member variables. I'd want to trigger actions based on market conditions when the planets align just right so I'm not simply ignoring these values or pub/sub'ing them out to client apps, I'm evaluating many of them simultaneously and using them as event triggers. Is something like that remotely possible? On how much hardware?
    Thanks,
    Andrew

    Andrew,
    Using partitioning, Coherence can handle 1 million updates per second, but the big question is how many updates per second do you need on the hottest instrument at the hottest time?
    The other question is related to "the planets lining up", because that may imply a global view of the market, which becomes more difficult in a partitioned system.
    To provide a high rate of change to data in a partitioned system, the data providers (those with a large amount of data or a high rate of change) should be in the cluster (not coming in over *Extend) to eliminate one hop. To avoid blocking on the tick update from the data provider, it should locally enqueue the update. The queue servicer (a separate thread) should either coalesce whatever ticks are in the queue into a single putAll(), or if every tick needs to be recorded (i.e. all three ticks in the queue like "change to 3.5", "change to 3.55", "change to 3.6" have to be published, instead of just the latest "change to 3.6") then it would batch up everything in the queue until it hits an item that it already has in its batch, and then do a putAll().
    The use of that async publishing mode is what allows for the much higher throughput, particularly when a data provider is producing a huge number of ticks in a given period of time. You can make it even smoother (e.g. avoid outliers caused by some servers being slower) by having more local queues+services (partitioned by Coherence partition, or at the extreme by instrument). You can determine the Coherence partition using the KeyPartitioningStrategy returned from the PartitionedService for the ticks cache.
    Peace,
    Cameron Purdy | Oracle Coherence
    http://coherence.oracle.com/

Maybe you are looking for

  • IMac 27" wifi issue after update to OS X 10.7.4

    Hi all, i can't access to wifi after update to OS X 10.7.4. Anybody has remedy to this problem? Is this software or hardware related problem? Hope to get a reply soon. Thanks.

  • Why are parameters to startElement() empty in SAX handler?

    I extended the SAX DefaultHandler in the standard JAXP download. The startElement() method has 4 parameters, but only the third one gets any values. Even with the tag shown below, the URI parameter is always blank as is the local name parameter. The

  • Wanted Muse but got Media Encoder

    Wanted to download Muse but got Media Encoder instead. App. manager says Muse is " installed"  but can't find it in Finder or Launchpad. What am I doing wrong

  • Registered application is not active at the moment.

    Two symtoms This happens with the Native Admin or any MSAD Shared Services admin. When in Shared Services - Right Click on Hyperion System 9 BI+ - the option to Assign Preference is not available Also when selecting the same project the following mes

  • Acrobat 8 - Settings or preferences for Line Tool??

    A colleague using Acrobat 8 can't use the line tool without having the lines snap to predetermined angles. I've looked in the preferences to no avail. The ability to turn this on/off is not located in the Commenting category of Prefs, nor does turnin