How to solve the setColor() problem with multithreading?

My fractal program uses a custom number of threads to draw the complete image. If I use just 1 thread, the image looks clean, if I use more threads some pixels of the image gets other colors. The problem ist the painting code:
g2d.setColor(col);
g2d.drawLine(x, y, x, y);as it is necessary to first set the color of the graphics object and then draw the line. I can solve this pixel color problem by synchronizing the Graphics2D object:
synchronized (g2d) {
  g2d.setColor(col);
  g2d.drawLine(x, y, x, y);
}but this slows the code down to times where just 1 thread is calculating the image. Unfortunately, I can't find a draw() method that has a color parameter.
I tried to divide the panel into multiple BufferedImages (1 for each thread) which solves the pixel problem but only the first BufferedImage get's drawn.

I solved my problem now. My solution is to use a separate BufferedImage for each Thread. I still had a bug where i didn't transformed the x/y coordinates of the complete image to the shifted x/y coordinates of the single BufferedImages, so that the threads draw the image out of the visible area which looked like all threads after the first only had a black image. After adjusting teh coordinates, the fractal now gets drawn correctly. And boy it's much faster with multiple threads - even on single core systems. On a dual core system, using 10-20 threads about doubles the performance as both cores have work almost all the time until the fractal is finished. :-)

Similar Messages

  • How to fix the Bluetooth problems with the Treo

    It’s pretty obvious by now that Palm had not intentions of addressing the Bluetooth problems with the Treo smart phones. As for me, I need to reset my Treo 700wx several times a day to keep the bluetooth connection working. At my house it simply does not work because I live in a rural area where my cell signal drops out continuously, only for a moment but that’s all it takes for the Treo loose the Bluetooth connection.
     I’ve searched here on this board for a solution only to find out that I’m not the only one with this problem. I’ve searched the Internet and could not believe the endless complaints about this problem, not a single fix was to be found. I will be going to every single site I can find on the Internet where I can leave a review of this product and I would encourage others with the same problem to do the same.
    Post relates to: Treo 700wx (Verizon)
    Post relates to: Treo 700wx (Verizon)

    The "Mobile Device" you see only shows what is on your Treo when ActiveSync is running and connected.  When it's not connected, there is "nothing".  This is good when you want to copy a file you have saved in RAM (main memory).  Connect your Treo and have Activesync run (successfully, of course).  Then, you will see all the accessible files on your Treo.
    Please read the previous reply (I have added and edited it to respond to some of your questions).  Also, since I have the Card Export 3.14 for the WM5 and 6 running and it works on my Treo 750, I believe it should also work for you.  I have WM 6.  Earlier versions of Card Export actually "broke" Activesync for me.  It wasn't until very recently that I wanted to try it again, in hopes that they have fixed the bugs.  Apparently they have and I now use it to "fix" Activesync when it doesn't want to connect.
    So, the latest version is 3.14 and it supports WM 5 and 6 (although they incorrectly named it Windows Mobile 2005/2006). 
    Post relates to: Treo 650 (Rogers)

  • How to solve a serious problem with the Battary of my T500 laptop ?

    Hi Forum,
    My personal laptop is Lenovo THINKPAD T500 2055, and its main specifications are as follows:
    - 39T6651 SBB 9 CELL LI-ION BATTERY
    - Intel Core 2 Duo processor T9400 (2.53GHz 1066MHz 6MBL2)
    - 8 GB DDR3 SDRAM Memory Module 4 GB (2 x 4 GB) 1066MHz DDR31066/PC38500 DDR3 SDRAM SoDIMM Kingston.
    - 2 GB Intel Turbo Memory hard drive cache.
    - ATI Mobility Radeon 3650 with 256MB.
    - 160 GB Hard Disk Drive, 7200rpm.
    - Windows 7 Ultimate with the latest Service Pack (x64).
    My problem precisely and concisely is the Battary. I have been using my laptop with the same battary since 01.01.2009 (Almost 3.5 Years), and the battary has been working quite OK.
    Most of the time my laptop is plugged in and working with the electricity. However, A very few times I used the laptop while it is running on battery, Nevertheless, I have the habit to empty the batter once in a while i.e. Every 3 weeks, I unplug the charger and keep using the laptop till I see the warning orange sign (5%), then, I plug it in again.
    Thankfully, I never had any problems with the battary nor the laptop, and when I charge the laptop usually it shows full sign (100%).
    Three days ago, All of a sudden my laptop starts flashing the orange battary sign constantly while charge indicates 100%. When I try running on the battery by unplugging the AC adapter, the laptop loses power immediately and shuts down right away.
    What do you think should I do? Could you please provide me any useful tips to resolve this problem?
    I would greatly and sincerely appreciate all your inputs !
    Thanks for your consideration of my request, and I very much look forward to hearing from you at your earliest convenience !
    Solved!
    Go to Solution.

    In the control panel goto the "Lenovo - Power Manager" and click the battery tab, there is a maintenance button in there that will let you change the charging profile for your battery.   (from memory, so exact wording may be off)
     The lower the numbers you use there, the longer the battery *should* last.    These batteries degrade faster at higher charge levels, however storing them at too low of levels is also not good for them... I've read that 40% is optimal, but just not realistic if you use your computer.
    --- ThinkPad T61 / Win 7 / Core 2 / 4gb RAM / Nvidia / Still used daily --- ThinkPad Edge 15/ i5 / Win 7 / TrueCrypt / 8gb RAM / Hated it, died at 1 yr 1 mo old --- ThinkPad T510 / Win 7 / TrueCrypt / i5 / 8gb RAM / Nvidia / Current primary machine --- ThinkPad X220 / i7 / IPS / 4gb / TrueCrypt / My Road Machine

  • How to solve the footer problem?

    In germany since the beginning of 2007 all business emails must be stamped by a company footer.
    This sounds simple [Outgoing Content filter, add-footer ] but in reality it is a big problem, because most of users don't want to have a the company footer at the end of the email if they are sending a reply.
    They expect the footer at the end of the new part they have written.
    So the solution can be to use hard coded placeholder generated by the initial email system that is replaced by Ironport with the footer (depending on the company the user is a member of, different footers can be used e.g. by a ldap group query.)
    :?: But ... How to replace the placeholder? It seem that this is not possible with Ironport or does anybody has an idea?
    :idea: Another way to solve the problem can be to use a "Stamping header" instead of a footer. Such a header will be always at the top of the new part of an email, when you send a reply.
    I asked support, it will be added to the wishlist for new releases.
    So so far this is not a solution or does anybody know a workaround?
    Regards
    Stefan

    In germany since the beginning of 2007 all business emails must be stamped by a company footer.
    This sounds simple [Outgoing Content filter, add-footer ] but in reality it is a big problem, because most of users don't want to have a the company footer at the end of the email if they are sending a reply.
    They expect the footer at the end of the new part they have written.
    So the solution can be to use hard coded placeholder generated by the initial email system that is replaced by Ironport with the footer (depending on the company the user is a member of, different footers can be used e.g. by a ldap group query.)
    :?: But ... How to replace the placeholder? It seem that this is not possible with Ironport or does anybody has an idea?
    :idea: Another way to solve the problem can be to use a "Stamping header" instead of a footer. Such a header will be always at the top of the new part of an email, when you send a reply.
    I asked support, it will be added to the wishlist for new releases.
    So so far this is not a solution or does anybody know a workaround?
    Regards
    Stefan
    Hello Stefan,
    we have the same problem and found the best solution to do is to have company rules that apply on the client side.
    This decission is based on the fact that already many companies use client based signatures (s-mime) and also client based encryption which makes a gateway solution impossible.
    We found a nice solution for exchange/outlook based on group policies
    Aas we are almost neighbours you are invited to visit us.
    Greetings from Greven/Münster

  • TS1559 WIFI solutions proposed by Apple are not working. Does oneone how to solve the WIFI problems?

    Dear Apple.
    I was really happy with my iphone4s, IOS 6.0, great product amazing quality and posibilities BUT.......
    I updated from IOS 6.0 to 6.1.1. and the WIFI nightmare started.
    I waited for a new update to fix the WIFI problems and I updated my iphone 4s from 6.1.1. to 6.1.2. in order to solve these problems related with WIFI connections.
    But IOS 6.1.2. is even worst:
    - WIFI is not working at all. So I cannot download apps greater than 50MB.
    - Battery life is shorter than ever.
    - 3G goes in and out every minute.
    - When you operate the iphone4s you can realize that is hotter than before.
    These problems are unnaceptable and inconsistent with a high quality standard product.
    You can read a lot of blogs, I am not the only one.
    Please give us a solution as soon as possible.
    Best Regards
    AICITEL

    Thank you for your support.
    My router is a TL-WR740N, and I think it has only a 2.4-2.4835GHz antenna.
    So it seems that I have to keep on trying.
    I also tryed to rename the router, still nothing.
    Thank you anyway.
    FYI.
    4 puertos LAN de 10/100Mbps
    1 puerto WAN 10/100Mbps
    Botón
    Botón de configuración rápida de seguridad
    Botón de reinicio
    Suministro de Energía Externa
    9VDC / 0.6A
    Estándares Inalámbricos
    IEEE 802.11n*, IEEE 802.11g, IEEE 802.11b
    Antena
    omnidireccional fijo de 5dBi
    Dimensiones (Largo x Ancho x Alto)
    6.9 x 4.6 x 1.3 in. (174 x 118 x 33 mm)
    Frecuencia
    2.4-2.4835GHz
    Velocidad de Señal
    11n: Hasta 150Mbps (dinámico)
    11g: hasta 54Mbps (dinámico)
    11b: hasta 11Mbps (dinámico)
    EIRP
    <20dBm(EIRP)
    Sensibilidad de Recepción
    130M: -68dBm@10% PER
    108M: -68dBm@10% PER
    54M: -68dBm@10% PER
    11M: -85dBm@8% PER
    6M: -88dBm@10% PER
    1M: -90dBm@8% PER
    Funciones Inalámbricas
    Activar / Desactivar radio inalámbrica, WDS Bridge, WMM, estadísticas inalámbricas
    Seguridad Inalámbrica
    64/128/152-bit WEP / WPA / WPA2,WPA-PSK / WPA2-PSK
    Tipo WAN
    IP dinámica / IP estática / PPPoE /
    PPTP (Acceso dual) / L2TP (Acceso dual) / BigPond
    DHCP
    Servidor, cliente, lista de cliente DHCP,
    Reserva de dirección
    Calidad de Servicio
    WMM, Control de Ancho de Banda
    Redireccionamiento de Puertos
    servidor virtual, Port Triggering, UPnP, DMZ
    DNS Dinámico
    DynDns, Comexe, NO-IP
    Puerto de Transferencia VPN
    PPTP, L2TP, IPSec (ESP Head)
    Control de Acceso
    Control Parental, Control de Manejo Local, Lista de anfitriones, la Lista de acceso, manejo de reglas
    Seguridad Firewall (cortafuegos)
    DoS, SPI Firewall
    Dirección IP Filtro / Filtro de dirección MAC / filtro de dominio
    Conexiones de direcciones IP y MAC
    Management
    Control de acceso
    Manejo Local
    Manejo remoto
    Certificación
    CE, FCC, RoHS
    Contenido del Paquete
    TL-WR740N
    1 fijo antenas omnidireccionales
    Fuente de alimentación
    CD de recursos
    Guía de instalación rápida
    Requisitos del Sistema
    Microsoft ® Windows ® 98SE, NT, 2000, XP, Vista ™ o Windows 7, Mac ® OS, NetWare ®, UNIX ® o Linux.
    Ambiente
    Temperatura de funcionamiento: 0¿ ~ 40¿ (32¿ ~ 104¿)
    Temperatura de almacenamiento: -40¿ ~ 70¿ (-40¿ ~ 158¿)
    Humedad de funcionamiento: 10% ~ 90% sin condensación
    Humedad de almacenamiento: 5% ~ 90% sin condensación

  • How to solve the OB problem of 'Raw Materials' account in Trial Balance?

    Dear Friends,
    In a 'Perpetual Inventory' system how to show the opening balance of Inventory Account in Trial balance as other account's opening balance?
    You can check this out with some opening balances entered for GL Accounts (from Administration -> system initialization -> opening balance) and some initial quantity of inventory items entered (in inventory transactions) on - let's say a company's starting date 1-1-06.

    Hi Gordon,
    My SBO version is 8.8 PL 10, Indian Database. I want to see the "Raw Material" G/L Account's opening balance in the Opening Balance Column of Trial Balance or similar report of SBO. The technical problem behind this is - the mentioned reports shows the the amounts in OB column if that amount is entered by the OB Transactions (in Administration -> System Initialization). But how to manage the Raw Material / Inventory G/L through this concept, as the OB amount for this is entered through Inventory Initial Quantity. We can do the entry one day before the expected starting date of the financial period, is that can be a standard practice? For. e.g. entering the opening balance for 1-1-06 on 31-12-05.

  • How to solve the certificate problems in Java Web Start

    Hi, All,
    I encounted these two problems recently:
    (1) I have an application which is supposed to be started by Java Web Start. I have written my own code which calls other .jar files from other companies. Since for web start, you need to sign all .jar files if you want more permssions. Now I got the following problem:
    '=================================
    An error occurred while launching/running the application.
    Title: My stuff
    Vendor: UCLA
    Category: Launch File Error
    JAR resources in JNLP file are not signed by same certificate
    =================================
    How to go around this? It seems that the .jar files from that company has been signed already. Then I tried to uncompress those jars and re-archieve again, then sign it again using the keystore I used to sign my own .jar files. It still does not work. Any help on this will be appreciated!
    (2) Afterr I signed a .jar file, when I want to run it again, using command: java -jar abc.jar
    It does not work any more, I am not sure whether it will become a problem if loaded by Web start.
    Thanks a lot!
    David

    In another forum answer, a user named Dietz suggested the following:
    If you have a library signed by another signer, you need to factor it out into a seperate extension jnlp file.
    AJones0131

  • How to solve the error problem

    Hi Devs ...
    I have been learning Adobe Flex and using IDE Flash Builder 4. but Im fasing an unsolve able problem in code given bellow..
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:mx="library://ns.adobe.com/flex/mx" layout="vertical" minWidth="955" minHeight="600">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <mx:states>
            <mx:State name="details">  /////////Here comes an error saying:-->State overrides may no longer be explicitly declared. The legacy states                                                                     /////syntax has been deprecated.
                <mx:AddChild position="lastChild">
                    <mx:Text text="About Picture" width="200" fontWeight="bold"/>
                </mx:AddChild>
                <mx:AddChild position="lastChild">
                    <mx:Text text="this is the picture of futue of Windows" width="200"/>
                </mx:AddChild>
            </mx:State>
        </mx:states>
        <mx:Image source="assets/att66298.jpg" rollOver="currentState='detail'"/>
    </mx:Application>
    please tell me how to slove this error problem.
    Arshay..

    <!-- incorrect --> 
    <root>
      < myxml label="something" >
    </root>
    <!-- correct -->
    <root>
      <myxml label="something">
    </myxml></root>

  • Is there any way to solve the wifi problem with lion?

    Since upgrading to lion my iMac has been having severe problems connecting to my wifi router. As long as it doesn't go to sleep it is fine, but if it does then I have to restart the computer to connect to the router. I know that it is lion as I've got 2 iphones, 2 ipads, and 2 laptops in the house all operating without problems. Please any help would be greatly appreciated. I tried contacting apple and they won't help me unless I pay them, or sign up for apple care. I already paid for the **** computer and the OS why would I pay them to address an issue that is clearly on their end when my computer is still under warranty?

    There's a number of things you can do to try to diagnose the problem, and hopefully it doesn't have to do with a hardware problem.
    I think the number one reason people are having problems with Lion is because most of the installations are UPGRADES, not CLEAN installs. While it's much less of a hassle for an upgrade rather than a clean install, weird and random problems can arise from an upgrade to an OS.
    Another reason is the fact that this is a dot zero release, meaning it's version 10.7.0, meaning there are bugs that have not been fixed yet.
    So the first thing you can do is to repair permissions in Disk Utility and restart your Mac. I don't think that will exactly fix the problem, but it's a step.
    When it's restarted, wait a few minutes and put it to sleep and wake it up and report back.

  • How to solve the error problem error:1088 in flex builder 3

    I'm facing an error while creating an application from Database using wamp web server please tell me how to solve this?

    <!-- incorrect --> 
    <root>
      < myxml label="something" >
    </root>
    <!-- correct -->
    <root>
      <myxml label="something">
    </myxml></root>

  • How do I solve the crashing problem with the '11 version of iMovie?

    imovie seems to have trouble with optimizing or building an interface for my older videos. If is delete them it get futher into the process and crashes again. Is there a patch for this or a process I need to follow?

    Well if I follow him, he creates an Exposure Adjustment Layer.
    Then he cranks up the Exposure, lightening the entire body, which he does not want. It's only the head.
    So leaving the Exposure set to where he put it, he selects that adjustment layer, clicks on that white thumbnail mask first, then paints
    using the brush and black. What this does is "hides" or Masks the exposure effect where he paints, it doesn't paint the picture black.
    He finds having to "mask" the entire body a lot of work. So he changes the mask to black by inverting it, and changes the swatch to white.
    Then being sure the black mask thumbnail is selected, he paints the head with the white color, punching a hole in the mask so the exposure setting comes through on the face.
    Does that make sense?

  • How to solve the JCO problem

    hi, everybody
    In my project, I must run some RFC to get my result. But when I build, deploy and run my project, error has happened as follows:
    " com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Failed to resolve JCO destination name 'WD_FLIGHTLIST_RFC_METADATA_DEST' in the SLD. No such JCO destination is defined in the SLD. "
    I wonder if I have not config my jco destination yet.
    Would you please give my a help! 3KS!

    Hi Daniel,
    As suggested by Govindu, adding document related to your issue to resolved.
    [Web Dynpro Best Practices|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/wd%20java/7.0/portal%20integration/how%20to%20configure%20the%20jco%20destination%20settings.pdf]
    [System Landscape Directory Process and JCo Configuration|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0c1d495-048e-2b10-babd-924a136f56b5?quicklink=index&overridelayout=true]
    Refer to Failed to resolve JCO destination name 'WD_RFC_METADATA_DEST' in the SLD for similar discussions.
    Hope it will helps
    Regards
    Arun Jaiswal

  • How to solve w7 dpi problem with fullscreen video playback?

    when i use custom dpi size in W7 i get problems to playback videos on sites like GTA 5 Cheats . it doesn't hide the windows menu bar. why is that?

    You can set the layout.css.devPixelsPerPx pref on the <b>about:config</b> page to 1.0 or on Windows 8 to 1.25 and if necessary adjust layout.css.devPixelsPerPx starting from 1.0 in 0.1 or 0.05 steps (1.1 or 0.9) to make icons show correctly.
    *http://kb.mozillazine.org/about:config
    See also:
    *https://support.mozilla.org/kb/forum-response-Zoom-feature-on-Firefox-22
    Use an extension to adjust the text size in the user interface and the page zoom in the browser window.
    You can look at this extension to adjust the font size for the user interface.
    *Theme Font & Size Changer: https://addons.mozilla.org/firefox/addon/theme-font-size-changer/
    You can look at the Default FullZoom Level or NoScript extension if web pages need to be adjusted after changing layout.css.devPixelsPerPx.
    *Default FullZoom Level: https://addons.mozilla.org/firefox/addon/default-fullzoom-level/
    *NoSquint: https://addons.mozilla.org/firefox/addon/nosquint/

  • How to solve the following problem? Thanks.

    Create an interface with at least one method, in its own package. Create a class in a separate package. Add a protected inner class that implements the interface. In a third package, inherit from your class and, inside a method, return an object of the protected inner class, upcasting to the interface during the return.

    Life is essentially simple, we just love to make it complicated. I am quite sure, the effect you are trying to achieve by what you are doing can be done in a much simpler way.
    In theory it is fine - on production floor if you do it, being the architect I most definitely am going to fire you.
    It is easy to obfuscate code by pulling these kind of stunts - nobody (even you yourself) will understands this later.
    Keep your thinking as well as your code and logic simple, systems become easier to build and maintain.
    I shall intentionally not answer your question. There are certain knowledge which is better not given - if the potential lies that it shall be used otherwise :D
    No offence intended though
    Ironluca

  • How to solve the date issue with BIP report

    Even the below query also giving "invalid Number error"
    select * from scott.emp
    where hiredate between TO_DATE('01-01'||TO_CHAR(:p_end_date,'YYYY'),'MM-DD-YYYY')
    AND TO_DATE(to_char(:p_end_date,'MM-DD-YYYY'),'MM-DD-YYYY')
    Regards
    boo

    Use:
    BETWEEN TO_DATE(NVL(:p_varchar_FromDate, '01/01/1900'), 'MM/DD/YYYY')
    AND TO_DATE(NVL(:p_varchar_ToDate, '12/31/5000'), 'MM/DD/YYYY')
    Regards,
    Amit

Maybe you are looking for

  • REUSE_ALV_POPUP_TO_SELECT

    Hi , I am using "REUSE_ALV_POPUP_TO_SELECT" in an interactive ALV report. when the popup is displayed , it is not getting any value. it shows "list contains no data". this is my code:: FORM USERCOMMAND USING R_UCOMM LIKE SY-UCOMM                     

  • Function Module where-used list does not find update rule programs

    We have function modules called in update rules. The where-used list in the function builder does not find the update rule programs. For example, function DATE_GET_WEEK is called in an update rule to InfoCube YCUBE001. The activated program name for

  • Conditional Color Coded List

    I have done this in excel long time ago and I though it was going to be as simple as it was with excel. I'm trying to implement a conditional color coded list with the criteria below: Fields: - Health (blank cell that will change colors) - Due Date (

  • Why my key assignment for key resets when i restart ps cs6 beta?

    i've been using the shortcut ctrl+< but now with cs6 beta, it changes it into ctrl+& when i restart the program even if i save the preferences. i think you start to use xml for keyboard shortcuts preference file(.kys) but this blocks me to use the on

  • How move apex from one server to another

    Hi All, I am just a beginner who has just started with APEX. Its strange but even though I am just a beginner I was given a task to move the current whole apex system from one server to another. Can any one help what the steps do I need to follow to