Re: Problems with Mortg Calc

Um, you never actually use your DecimalFormat object.

I'm not sure what you don't understand about 'go look at the API'? I did, and there are examples there... even a link to a tutorial here: http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html

Similar Messages

  • Problem with a calc involving @MDSHIFT and Dynamic Calc

    Hi all,
    I have a problem with the calculation of a member in a calc script. The formula of this member is :
    "R70100"
    IF(@ISMBR("M01"))
    ("T_008"->"Cumul"->"HT"+"T_003"->"Cumul"->"HT")*"AVCT_PR" - @MDSHIFT("R70100" -> "Cumul" -> "HT" -> "M12", -1, "Year", );
    ELSE
    ("T_008"->"Cumul"->"HT"+"T_003"->"Cumul"->"HT")*"AVCT_PR" - @MDSHIFT("R70100" -> "Cumul" -> "HT", -1, "Period", );
    ENDIF
    - R70100 is a member of a dense dimension.
    - T_008, T_003 and AVCT_PR are spare and stored.
    - "Cumul" is a dynamic member which allow us to calculate cumulative from monthly.
    - Time is split into two dimensions, Period and Year.
    The problem is that the @MDSHIFT doesn't seems to work with the dynamic calc as the monthly result is the cumulative correct value. I didn't know what is wrong BUT each time I launch the script, values are good for one more month.
    After one run, for example, I obtained this result :
    !http://zenon.apartia.fr/stuff/200910070001.GIF!
    Two run later, here are the news values :
    !http://zenon.apartia.fr/stuff/200910070002.GIF!
    Any idea on what going on and how to correct it ? Thanks !
    Frédéric

    A couple of questions for you:
    1) Do you need the overhead of @MDSHIFT when you are only moving in one dimension? Wouldn't @PRIOR have been a lot easier? At least this is true for the ELSE condition.
    2) Could you post just the results of the @MDSHIFT calculation so we (okay, this may be just for me, it's still breakfast time here and not enough coffee has been ingested yet to read a spreadsheet without recourse to the formulas) can better see the impact?
    3) Have you tried using your code against a non-dynamic member? Does it make a difference?
    Regards,
    Cameron Lackpour

  • Peculiar problem with Essbase (Calc Script) - substitution variable / UDAs

    This is odd but I have a script like :
    VAR iloop=1,break=0;
    FIX(<required POV>)
    Loop (20,break)
    VAR Country_total1,Country_total2,Country_total3;
    FIX (@UDA(Entity,@ALIAS(@CONCATENATE("&Country",iloop)))) // &Country1, &Country2 - are substitution variables with UDAs stored as strings
    Statements;
    /* +<statements for calculating total values.. for that country and stored against variables>+ */
    Country_total1=Country_total1+ +<Calculation>+
    ENDFIX
    /* Second part : Now again the calculations stored in the variables are to be stored against specific entities */
    FIX (@UDA(Entity,@ALIAS(@CONCATENATE("&Country",iloop))))
    FIX(@ISUDA(Entity,<Check1>)
    ..... Assign to relevant account
    ENDFIX
    ENDFIX
    ENDLOOP
    ENDFIX
    Now the problem is that the first fix statement works just fine, but the FIX statement in the 'second part' throws an error
    Error: 1200354 Error parsing formula for [FIX STATEMENT] (line 66): expected type [STRING] found [EXTVAR] ([iloop]) in function [@CONCATENATE]
    If I hard code the 'second part' FIX statement to the substitution variable directly - it works just fine.
    How can the first statement work and not the second one ? They are exactly the same.

    Glenn, thanks - I hadn't thought of that :).
    But it still does not entirely solve my problem (please see my previous post depicting a requirement similar to ours )
    - We have lots of countries (50-60+ might be much more) and each country can have multiple entities (3-4 on an average - can go unto 7-8)
    - so good guess would be around 200 entities
    - So say I have to do it for 2 countries only (two entity types). Then I need 4 variables - 2 for each country ('country 1 ET1 total', 'Country 1 ET2 Total')
    When the list is 20 counties - variables become 40 :(.
    - Still leaving aside the 40 variables for a bit -
    There are subsequent steps of calculations which needs to be done based on these totals (which are exactly the same for all countries) - just that we need the correct totals to begin with and the rest is already stored in the DB
    So since I have a different variable for each country - I cannot write one single calculation block to use the variables sequentially one by one (can I ?)
    I might have to write a separate calculation block for each of these countries. (20 separate blocks)
    That's what I was trying to avoid and simplify with the substitution variable (but is not working)
    - Create substitution variables - which would store the alias of the required countries (2/10/20 as many required)
    - Loop through these substitution variables - using them one by one
    - So I just need one single block of calculation with all the variable in the calc script being reused after each country calculation is done
    - and the user need not go into the script, as the only thing that will change are the countries. And he can change it easily through the substitution variable.
    Edited by: Ankur on Jun 27, 2012 12:53 PM

  • Problem with Dynamic Calc members in calc script

    Hi
    i wrote a calc script which calculates the value of acct2 which is dependant on the value of acct1 that is calculated from acct0 as bellow:
    FIX(
    M1
    acct1(
    acct1=acct0->M2;
    acct2=acct1->M2;
    ENDFIX
    the value of the intersection of M1->acct0 is 100 as input ,what i wanted from this calc script is the acct2->M1 to be 100 after executing the script once
    but the fact is i have to run it twice to get the expected result.
    the outline is like this:
    M:
    M2 Dynamic calc M2=M0+M1
    M0 Stored
    m1 stored
    Account:
    acct0 stored
    acct1 stored
    acct2 stored
    Can anyone tell me the reason and how to solve it?
    Edited by: user10450070 on 2011-1-25 上午1:38

    Is acct1 correct after one run of the calculation, but acct2 incorrect? If so, it's because Essbase is calculating them both at the same time (parallel), whereas it has to be forced to calculate acct1 first and acct2 second. You can do this with separate fixes as below:
    FIX(M1)
    acct1=acct0->M2;
    ENDFIX
    FIX(M2)
    acct2=acct1->M2;
    ENDFIX
    Or, you can you can force it into calculating in serial mode:
    SET CALCPARALLEL 0;
    FIX(M1)
    acct1=acct0->M2;
    acct2=acct1->M2;
    ENDFIX
    Sabrina
    Edited by: SabrinaD on Jan 26, 2011 7:56 AM

  • Calc problem with fact table measure used as part of bridge table model

    Hi all,
    I'm experiencing problems with the calculation of a fact table measure ever since I've used it as part of a calculation in a bridge table relationship.
    In a fact table, PROJECT_FACT, I had a column (PROJECT_COST) whose default aggregate was SUM. Whenever PROJECT_COST was used with any dimension, the proper aggregation was done at the proper levels. But, not any longer. One of the relationships PROJECT_FACT has is with a dimension, called PROJECT.
    PROJECT_FACT contains details of employees and each day they worked on a PROJECT_ID. So for a particular day, employee, Joe, might have a PROJECT_COST of $80 for PROJECT_ID 123, on the next day, Joe might have $40 in PROJECT_COST for the same project.
    Dimension table, PROJECT, contains details of the project.
    A new feature was added to the software - multiple customers can now be charged for a PROJECT, where as before, only one customer was charged.
    This percentage charge break-down is in a new table - PROJECT_BRIDGE. PROJECT_BRIDGE has the PROJECT_ID, CUSTOMER_ID, BILL_PCT. BILL_PCT will always add up to 1.
    So, the bridge table might look like...
    PROJECT_ID CUSTOMER_ID BILL_PCT
    123          100     .20
    123          200     .30
    123          300     .50
    456 400 1.00
    678 400 1.00
    Where for project 123, is a breakdown for multiple customers (.20, .30. .50).
    Let's say in PROJECT_FACT, if you were to sum up all PROJECT_COST for PROJECT_ID = 123, you get $1000.
    Here are the steps I followed:
    - In the Physical layer, PROJECT_FACT has a 1:M with PROJECT_BRIDGE as does PROJECT to PROJECT_BRIDGE (a 1:M).
    PROJECT_FACT ===> PROJECT_BRIDGE <=== PROJECT
    - In the Logical layer, PROJECT has a 1:M with PROJECT_FACT.
    PROJECT ===> PROJECT_FACT
    - The fact logical table source is mapped to the bridge table, PROJECT_BRIDGE, so now it has multiple tables it maps to (PROJECT_FACT & PROJECT_BRIDGE). They are set for an INNER join.
    - I created a calculation measure, MULT_CUST_COST, using physical columns, that calculates the sum of the PROJECT_COST X the percentage amount in the bridge table. It looks like: SUM(PROJECT_FACT.PROJECT_COST * PROJECT_BRIDGE.BILL_PCT)
    - I brought MULT_CUST_COST into the Presentation layer.
    We still want the old PROJECT_COST around until it get's phased out, so it's in the Presentation layer as well.
    Let's say I had a request with only PROJECT_ID, MULT_CUST_COST (the new calculation), and PROJECT_COST (the original). I'd expect:
    PROJECT_ID MULT_CUST_COST PROJECT_COST
    123          $1000     $1000
    I am getting this for MULT_CUST_COST, however, for PROJECT_COST, it's tripling the value (possibly because there are 3 percent amounts?)...
    PROJECT_ID MULT_CUST_COST PROJECT_COST
    123          $1000 (correct)      $3000 (incorrect, it's been tripled)
    If I were to look at the SQL, it would have:
              SELECT SUM(PROJECT_COST),
    SUM(PROJECT_FACT.PROJECT_COST * PROJECT_BRIDGE.BILL_PCT),
                   PROJECT_ID
              FROM ...
              GROUP BY PROJECT_ID
    PROJECT_COST used to work correctly before modeling a bridge table.
    Any ideas on what I did wrong?
    Thanks!

    Hi
    Phew, what a long question!
    If I understand correctly I think the problem lies with your old cost measure, or rather combining that with you new one in the same request. If you think about it, your query as explained above will bring back 3 rows from the database which is why your old cost measure is being multiplied. I suspect that if you took it out of the query, your bridge table would be working properly for the new measure alone?
    I would consider migrating your historic data into the bridge table model so that you have a single type of query. For the historic data each would have a single row in the bridge with a 1.0 BILL_PCT.
    Best of luck,
    Paul
    http://total-bi.com

  • Problem with Math In Calculated Fields

    I am calculating a group incident rate for data returned from
    a query. The formula is Number of cases multiplied by 200000
    divided by number of hours worked. Cases in my report is the
    calculated field: calc.CaseSum (the sum of cases for the group)
    Hours is calc.SumHours (the sum of hours for the group). The actual
    values for these variables (for the first group are 48 and 29427171
    respectively. When I create the following calculated field called
    rate using the formula: (calc.CaseSum * 200000) / calc.SumHours,
    Cold Fusion Generates a Runtime Error:
    Invalid ColdFusion expression in report. If the expression is
    a string, ensure that it is within quotes. Error: (calc.CaseSum *
    200000) / calc.SumHours is not a valid ColdFusion expression.
    If I use the constant value "29427171" as the divisor, the
    report works albeit only for the first group. Any ideas; is this a
    bug, or am I misusing the product?
    Addition: I forgot to mention I am using CF8. Also this
    formula worked fine as a Report Total before I introduced grouping
    and modified the calculated fields to reset on the change of a
    group.

    Sorry, I've been on another project for awhile. This problem
    will certainly be a "show stopper" for me if I cannot resolve it.
    As I mentioned in my original post, I used a constant in the
    formula in lieu of the variable and the calculation worked. This
    would suggest that CF does not have a problem with a large number.
    In spite of that reasoning, I tried Tony's suggested (thanks
    by the way!) with the identical outcome, only difference is the new
    formula is displayed in the error message.
    Tony, you also suggested that I set the variables using
    CFSET... How would I do this within the report writer environment.
    I had tried a similar approach: to perform half the calculation
    i.e. that within the parenthesis, and assign that value to a
    separate "calculated field: and then perform the rest of the
    calculation on that variable with the same outcome.
    I think that I may be dealing with a CF bug here, I'd like to
    find a workaround... I've noticed that CF8 has a new patch, perhaps
    after I apply it, I may be able to get this thing to work. I'm on
    another project right now so it will be a few days before I can
    test this theory, I report the result.
    Should this fail, and no one can come up with a workaround, I
    will report this to Adobe.

  • Query problem with accumulated key figures

    Hi BI Gurus!
    I have a report problem that I hope you can help me with!
    In my report I have 2 key figures. One for accumulated revenue previous year (KF1) and one for accumulated revenue current year (KF2). Both key figures should be presented in a graph in monthly buckets.
    January figures from both the key figures shoule be presented in the same bucket. Therfore I can't use 0CALYEAR since we have the "year" information in there. Instead I'm using 0CALMONTH2 which is only two digits, 01 for January. That way I can map figures from both previous year and current year in the same bucket.
    I need the figures to be accumulated and this is what I have problem with. When I run the report today in February 2010 it looks like this:
    Month   KF1   KF2
    01        10     15
    02        10     20
    03        15    
    04        10    
    05        20    
    06        10    
    07        10    
    08        15    
    09        15    
    10        20    
    11        20    
    12        10    
    This is how I would like the report to look like:
    Month   KF1   KF2
    01        10     15
    02        20     35
    03        35    
    04        45    
    05        65    
    06        75    
    07        85    
    08        100    
    09        115    
    10        135    
    11        155    
    12        165
    I have tried to use the setting "accumulated" for the key figures but then I get this result:
    Month   KF1   KF2
    01        10     15
    02        20     35
    03        35     35
    04        45     35
    05        65     35
    06        75     35
    07        85     35
    08        100   35
    09        115   35
    10        135   35
    11        155   35
    12        165   35
    Since the KF2 is revenue for current year and I run the report in February I don't want any figures to be displayed in Mars...
    I have tried to restrict the key figures by 0CALMONTH2 and 0CALYEAR. The KF1 is havein a restriction to only show values for 0CALYEAR - 1 and an interval for 0CALMONTH2 from JAN - DEC.
    The KF2 is having a restriction to only show values in the interval "first month in year - current month" (in this example JAN - FEB) for 0CALMONTH2. And current year for 0CALYEAR.
    Despite my restrictions for KF2 the numpers repeats itself for every month...
    Any suggestion how I can resolve this?
    Best regards
    Anders Florin

    Hi Khaled and thank you for trying to help me!
    I agree with you and think the users should accept the report as it is. But they are claiming that top management will not accept this and they would really want this to be fixed the whay that they want. I have tried to push back on this and said that I'm not sure that it can be resoleved and that it could cost them a lot of money if I try.
    But I will try to resolve it for them if I have spare time in the end of the project. I have not promised them anything but it would really be nice if I could fix it.
    So when you say I need to use a structure and a calculated key figure. How should the calculated key figure and the structure be configured?
    If I use a structure in the rows I guess I can't use same object in calc.key.figure right? Like if I use 0CALMONTH2 in the structure I'm not able to restrict the key figure with the same object? If that is correct I also have a ZMONTH object, different story why I have that... , that I can use in the same way as 0CALMONTH2. Or is this only a problem when I use "local" formulas within the query and not using a "global" calculated key figure? Cause I have only used the "loacal" formula calculated key figure in this report....
    Br
    Anders

  • Retrive time with Dynamic Calc

    Hi Experts,
    My users run a large smart view report which works well
    However, when they change one of the member on the query to DC member (dense)
    Then the retrieve takes forever and they getting network error from smart view.
    I try to figure out , how can I improve the retrieve time on my BSO app, focusing on DC issues
    I try to increase the data cache, index cache, retrieval buffer and sort.
    I add command of DYNCALCCACHEMAXSIZE and the retrieve doesn’t getting better.
    In addition, can you pls help me understand the app log file,
    Here’s what happen after I ran the report, maybe it will lead
    To the problem:
    [Mon Aug 06 02:41:03 2012]Local/Orac///1768/Info(1200481)
    Formula for member [YTD USD Display] will be executed in [TOPDOWN and CELL] mode
    [Mon Aug 06 02:41:03 2012]Local/Orac///1768/Info(1012710)
    Essbase needs to retrieve [1] Essbase Kernel blocks in order to calculate the top dynamically-calculated block.
    [Mon Aug 06 02:41:03 2012]Local/Orac///1768/Info(1012736)
    The Dyn.Calc.Cache for database [Main] can hold a maximum of [242] blocks.
    [Mon Aug 06 02:41:03 2012]Local/Orac///1768/Info(1012737)
    The Dyn.Calc.Cache for database [Main], when full, will result in [allocation from non-Dyn.Calc.Cache memory].
    [Mon Aug 06 02:41:03 2012]Local/Orac///1768/Info(1019018)
    Writing Parameters For Database [Main]
    [Mon Aug 06 02:41:03 2012]Local/Orac///1768/Info(1019017)
    Reading Parameters For Database [Main]
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1070013)
    Index cache size ==> [307200000] bytes, [37500] index pages.
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1070014)
    Index page size ==> [8192] bytes.
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1070081)
    Using buffered I/O for the index and data files.
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1070083)
    Using waited I/O for the index and data files.
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1019019)
    Reading Data File Free Space Information For Database [Main]...
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1006025)
    Data cache size ==> [512000000] bytes, [9359] data pages
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1006026)
    Data file cache size ==> [0] bytes, [0] data file pages
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1080053)
    Free space recovery skipped. Estimated free space recoverable by RecoverDbFreeSpace: [11068706640] bytes
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1024033)
    Missing Database Config File [E:\Hyperion\AnalyticServices\APP\Orac\Main\Main.cfg], Query logging disabled
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1203135)
    Starting the Data Mining Framework
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1203136)
    Data Mining Framework successfully initialized.
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1200551)
    Allocated TRIGMAXMEMSIZE: [4096] Bytes.
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1013205)
    Received Command [Get Database Volumes]
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1013205)
    Received Command [Set Database State]
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1019018)
    Writing Parameters For Database [Main]
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1019018)
    Writing Parameters For Database [Main]
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1013205)
    Received Command [Get Database State]
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1013205)
    Received Command [Get Database Info]
    [Mon Aug 06 02:41:05 2012]Local/Orac///1768/Info(1013205)
    Received Command [SetApplicationState]
    [Mon Aug 06 02:41:06 2012]Local/Orac///1768/Info(1019010)
    Writing Application Definition For [Orac]
    [Mon Aug 06 02:41:06 2012]Local/Orac///1768/Info(1019011)
    Writing Database Definition For [Main]
    [Mon Aug 06 02:41:06 2012]Local/Orac///1768/Info(1019022)
    Writing Database Mapping For [Orac]
    [Mon Aug 06 02:41:06 2012]Local/Orac///5132/Info(1013210)
    User [essadmin] set active on database [Main]
    Pls help me find out how can I overcome this.
    Many thanks,

    I'll add on to Dan's comment that you very much need to test the dynamic calc (if indeed that is the problem) in the proper context.
    Amusing but painful story:
    I was once tasked with reducing calc time on a BSO database. i saw long ugly stored member calcs. Hah! I cleverly converted them to dynamic and calc times dropped. No one told me (and I didn't ask) how they were to be reported. There were thousands of instances of this member on the Excel sheet. What had been a nice fast retrieve dropped to five minutes. Whoops.
    Take your pain wherever you like -- if you are reading multiple blocks to do the calc (my guess) nothing on earth is going to make it fast. Why make it dynamic in the first place? How many times is the member retrieved? Is it all in the block or, as i guessed, across multiple blocks?
    Last comment -- again (this is getting boring) I agree with Dan -- caches are not, usually, the source of any performance joy and it always comes down to design.
    Regards,
    Cameron Lackpour

  • Problem with CmdLineLauncher - Connection unavailable

    I have problem with CmdLineLauncher. When i execute this tool by task scheduler during night, i get error message:
    Launch Vars: {ExecDB=Planning...}
    2011-12-18 03:31:22,674 WARN main com.hyperion.hbr.cmdlnlauncher.CmdLineLauncher - Connection unavailable Planning/...
    I found explanation of this problem:
    Business Rule Error
    Hyperion planning services are stopped for backup procedure at night. Next step is ODI and data loading.
    After data loading i need to recalculate dimensions. For now i'm using CmdLineLauncher to execute proper business rule.
    If CmdLineLauncher not work, how can i recalculate dimension in other way by schedule?.
    Any other solution?
    Pete

    Well if it is working now then it is probably down to the fact that a successful login into planning has to happen first.
    There are probably a number of different options to try, maybe use one of the other planning utilities first before the command line launcher, or a script that logs into planning.
    You could also try transferring the script to a calc script and then use Maxl to run it.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Am I the only person who has problem with video playback ?

    I'm having problems with the latest nvidia driver and it seems that nobody wrote about it on the forums.. After installing the latest nvidia driver (169.07-1), the video playback with xv selected will be played in purple and blue colours.. Generally red will not be shown.. So human faces are colored with a combination of purple and blue.. Everything is normal on the other hand.. Sound works perfectly, the movie can be watched smoothly even on fullscreen.. With x11, all players can show the colors but...
    1) The movie quality in Totem is very bad then...like the image is gathered together by 3x3 pixels..
    2) mplayer shows everything fine but it can't get fullscreen..
    I created a nautilus script for a workaround that let's me watch the movies with fullscreen using the -fs -zoom options..
    But this problem is really annoying..

    1.0rc2, with some things disabled that are enabled in the Arch package (lirc, samba, and that live-media thing).
    $ pacman -Qs mplayer
    local/mplayer-custom 1.0rc2-1
    xvinfo:
    X-Video Extension version 2.2
    screen #0
    Adaptor #0: "NV17 Video Texture"
    number of ports: 32
    port base: 355
    operations supported: PutImage
    supported visuals:
    depth 24, visualID 0x21
    depth 24, visualID 0x24
    depth 24, visualID 0x25
    depth 24, visualID 0x26
    depth 24, visualID 0x27
    depth 24, visualID 0x28
    depth 24, visualID 0x29
    depth 24, visualID 0x2a
    depth 24, visualID 0x2b
    depth 24, visualID 0x2c
    depth 24, visualID 0x2d
    depth 24, visualID 0x2e
    depth 24, visualID 0x2f
    depth 24, visualID 0x30
    depth 24, visualID 0x31
    depth 24, visualID 0x32
    depth 24, visualID 0x33
    depth 24, visualID 0x34
    depth 24, visualID 0x35
    depth 24, visualID 0x36
    depth 24, visualID 0x37
    depth 24, visualID 0x38
    depth 24, visualID 0x39
    depth 24, visualID 0x3a
    depth 24, visualID 0x3b
    depth 24, visualID 0x3c
    depth 24, visualID 0x3d
    depth 24, visualID 0x3e
    depth 24, visualID 0x3f
    depth 24, visualID 0x40
    depth 24, visualID 0x41
    depth 24, visualID 0x42
    depth 24, visualID 0x43
    depth 24, visualID 0x44
    depth 24, visualID 0x45
    depth 24, visualID 0x46
    depth 24, visualID 0x47
    depth 24, visualID 0x48
    depth 24, visualID 0x49
    depth 24, visualID 0x4a
    depth 24, visualID 0x22
    depth 24, visualID 0x4b
    depth 24, visualID 0x4c
    depth 24, visualID 0x4d
    depth 24, visualID 0x4e
    depth 24, visualID 0x4f
    depth 24, visualID 0x50
    depth 24, visualID 0x51
    depth 24, visualID 0x52
    depth 24, visualID 0x53
    depth 24, visualID 0x54
    depth 24, visualID 0x55
    depth 24, visualID 0x56
    depth 24, visualID 0x57
    depth 24, visualID 0x58
    depth 24, visualID 0x59
    depth 24, visualID 0x5a
    depth 24, visualID 0x5b
    depth 24, visualID 0x5c
    depth 24, visualID 0x5d
    depth 24, visualID 0x5e
    depth 24, visualID 0x5f
    depth 24, visualID 0x60
    depth 24, visualID 0x61
    depth 24, visualID 0x62
    depth 24, visualID 0x63
    depth 24, visualID 0x64
    depth 24, visualID 0x65
    depth 24, visualID 0x66
    depth 24, visualID 0x67
    depth 24, visualID 0x68
    depth 24, visualID 0x69
    depth 24, visualID 0x6a
    depth 24, visualID 0x6b
    depth 24, visualID 0x6c
    depth 24, visualID 0x6d
    depth 24, visualID 0x6e
    depth 24, visualID 0x6f
    depth 24, visualID 0x70
    depth 24, visualID 0x71
    number of attributes: 3
    "XV_SET_DEFAULTS" (range 0 to 0)
    client settable attribute
    "XV_ITURBT_709" (range 0 to 1)
    client settable attribute
    client gettable attribute (current value is 0)
    "XV_SYNC_TO_VBLANK" (range 0 to 1)
    client settable attribute
    client gettable attribute (current value is 1)
    maximum XvImage size: 2046 x 2046
    Number of image formats: 4
    id: 0x32595559 (YUY2)
    guid: 59555932-0000-0010-8000-00aa00389b71
    bits per pixel: 16
    number of planes: 1
    type: YUV (packed)
    id: 0x32315659 (YV12)
    guid: 59563132-0000-0010-8000-00aa00389b71
    bits per pixel: 12
    number of planes: 3
    type: YUV (planar)
    id: 0x59565955 (UYVY)
    guid: 55595659-0000-0010-8000-00aa00389b71
    bits per pixel: 16
    number of planes: 1
    type: YUV (packed)
    id: 0x30323449 (I420)
    guid: 49343230-0000-0010-8000-00aa00389b71
    bits per pixel: 12
    number of planes: 3
    type: YUV (planar)
    Adaptor #1: "NV05 Video Blitter"
    number of ports: 32
    port base: 387
    operations supported: PutImage
    supported visuals:
    depth 24, visualID 0x21
    depth 24, visualID 0x24
    depth 24, visualID 0x25
    depth 24, visualID 0x26
    depth 24, visualID 0x27
    depth 24, visualID 0x28
    depth 24, visualID 0x29
    depth 24, visualID 0x2a
    depth 24, visualID 0x2b
    depth 24, visualID 0x2c
    depth 24, visualID 0x2d
    depth 24, visualID 0x2e
    depth 24, visualID 0x2f
    depth 24, visualID 0x30
    depth 24, visualID 0x31
    depth 24, visualID 0x32
    depth 24, visualID 0x33
    depth 24, visualID 0x34
    depth 24, visualID 0x35
    depth 24, visualID 0x36
    depth 24, visualID 0x37
    depth 24, visualID 0x38
    depth 24, visualID 0x39
    depth 24, visualID 0x3a
    depth 24, visualID 0x3b
    depth 24, visualID 0x3c
    depth 24, visualID 0x3d
    depth 24, visualID 0x3e
    depth 24, visualID 0x3f
    depth 24, visualID 0x40
    depth 24, visualID 0x41
    depth 24, visualID 0x42
    depth 24, visualID 0x43
    depth 24, visualID 0x44
    depth 24, visualID 0x45
    depth 24, visualID 0x46
    depth 24, visualID 0x47
    depth 24, visualID 0x48
    depth 24, visualID 0x49
    depth 24, visualID 0x4a
    depth 24, visualID 0x22
    depth 24, visualID 0x4b
    depth 24, visualID 0x4c
    depth 24, visualID 0x4d
    depth 24, visualID 0x4e
    depth 24, visualID 0x4f
    depth 24, visualID 0x50
    depth 24, visualID 0x51
    depth 24, visualID 0x52
    depth 24, visualID 0x53
    depth 24, visualID 0x54
    depth 24, visualID 0x55
    depth 24, visualID 0x56
    depth 24, visualID 0x57
    depth 24, visualID 0x58
    depth 24, visualID 0x59
    depth 24, visualID 0x5a
    depth 24, visualID 0x5b
    depth 24, visualID 0x5c
    depth 24, visualID 0x5d
    depth 24, visualID 0x5e
    depth 24, visualID 0x5f
    depth 24, visualID 0x60
    depth 24, visualID 0x61
    depth 24, visualID 0x62
    depth 24, visualID 0x63
    depth 24, visualID 0x64
    depth 24, visualID 0x65
    depth 24, visualID 0x66
    depth 24, visualID 0x67
    depth 24, visualID 0x68
    depth 24, visualID 0x69
    depth 24, visualID 0x6a
    depth 24, visualID 0x6b
    depth 24, visualID 0x6c
    depth 24, visualID 0x6d
    depth 24, visualID 0x6e
    depth 24, visualID 0x6f
    depth 24, visualID 0x70
    depth 24, visualID 0x71
    number of attributes: 2
    "XV_SET_DEFAULTS" (range 0 to 0)
    client settable attribute
    "XV_SYNC_TO_VBLANK" (range 0 to 1)
    client settable attribute
    client gettable attribute (current value is 0)
    maximum XvImage size: 2046 x 2046
    Number of image formats: 5
    id: 0x32595559 (YUY2)
    guid: 59555932-0000-0010-8000-00aa00389b71
    bits per pixel: 16
    number of planes: 1
    type: YUV (packed)
    id: 0x32315659 (YV12)
    guid: 59563132-0000-0010-8000-00aa00389b71
    bits per pixel: 12
    number of planes: 3
    type: YUV (planar)
    id: 0x59565955 (UYVY)
    guid: 55595659-0000-0010-8000-00aa00389b71
    bits per pixel: 16
    number of planes: 1
    type: YUV (packed)
    id: 0x30323449 (I420)
    guid: 49343230-0000-0010-8000-00aa00389b71
    bits per pixel: 12
    number of planes: 3
    type: YUV (planar)
    id: 0x3
    guid: 03000000-0000-0010-8000-00aa00389b71
    bits per pixel: 32
    number of planes: 1
    type: RGB (packed)
    depth: 24
    red, green, blue masks: 0xff0000, 0xff00, 0xff
    xorg.conf:
    # nvidia-xconfig: X configuration file generated by nvidia-xconfig
    # /etc/X11/xorg.conf (xorg X Window System server configuration file)
    # Edit this file with caution, and see the /etc/X11/xorg.conf manual page.
    # (Type "man /etc/X11/xorg.conf" at the shell prompt.)
    #Section "ServerFlags"
    # Option "XkbDisable" "true"
    #EndSection
    Section "ServerLayout"
    Identifier "Default Layout"
    Screen "Default Screen" 0 0
    InputDevice "Generic Keyboard"
    InputDevice "Configured Mouse"
    EndSection
    Section "ServerLayout"
    Identifier "TV Layout"
    Screen 0 "Screen_TV" 0 0
    InputDevice "Generic Keyboard"
    InputDevice "Configured Mouse
    EndSection
    Section "Files"
    FontPath "/usr/share/fonts/misc"
    FontPath "/usr/share/fonts/cyrillic"
    FontPath "/usr/share/fonts/100dpi/:unscaled"
    FontPath "/usr/share/fonts/75dpi/:unscaled"
    FontPath "/usr/share/fonts/Type1"
    FontPath "/usr/share/fonts/100dpi"
    FontPath "/usr/share/fonts/75dpi"
    FontPath "/usr/share/fonts/artwiz-fonts"
    FontPath "/usr/share/fonts/TTF"
    EndSection
    Section "Module"
    Load "bitmap"
    Load "dbe"
    Load "ddc"
    #Load "dri"
    #Load "evdev"
    Load "extmod"
    Load "freetype"
    Load "glx"
    Load "int10"
    Load "record"
    Load "type1"
    Load "vbe"
    EndSection
    Section "InputDevice"
    Identifier "Generic Keyboard"
    Driver "kbd"
    Option "CoreKeyboard"
    Option "XkbRules" "xorg"
    Option "XkbModel" "logiitc"
    Option "XkbLayout" "se"
    EndSection
    Section "InputDevice"
    Identifier "Configured Mouse"
    Driver "mouse"
    Option "CorePointer"
    Option "Device" "/dev/input/mice"
    Option "Protocol" "ExplorerPS/2"
    EndSection
    Section "Monitor"
    Identifier "Acer AL1923"
    #HorizSync 30.0-69.0
    #VertRefresh 60.0-75.0
    # calc: (x|y)pixels * 25.4 / dpi
    #DisplaySize 336 269 # 96 DPI @ 1280x1024
    Option "DPMS"
    EndSection
    Section "Monitor"
    Identifier "TV"
    HorizSync 30-50
    VertRefresh 60
    EndSection
    Section "Device"
    Driver "vesa"
    Identifier "VESA"
    EndSection
    Section "Device"
    Identifier "nv"
    Driver "nv"
    EndSection
    Section "Device"
    Identifier "NVIDIA GeForce 7600GS"
    Driver "nvidia"
    BusID "PCI:5:0:0"
    Option "NoLogo" "true"
    Option "RenderAccel" "true"
    Option "AddARGBGLXVisuals" "true"
    Option "backingstore" "true"
    EndSection
    Section "Device"
    Identifier "Card_TV"
    Driver "nvidia"
    Option "TVStandard" "PAL-B"
    Option "TVOutFormat" "SVIDEO"
    Option "ConnectedMonitor" "TV"
    EndSection
    Section "Screen"
    Identifier "Default Screen"
    Device "NVIDIA GeForce 7600GS"
    #Device "nv"
    #Device "vesa"
    Monitor "Acer AL1923"
    DefaultDepth 24
    SubSection "Display"
    Depth 1
    Modes "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
    SubSection "Display"
    Depth 4
    Modes "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
    SubSection "Display"
    Depth 8
    Modes "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
    SubSection "Display"
    Depth 15
    Modes "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
    SubSection "Display"
    Depth 16
    Modes "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
    SubSection "Display"
    Depth 24
    Modes "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
    EndSection
    Section "Screen"
    Identifier "Screen_TV"
    Device "Card_TV"
    Monitor "TV"
    DefaultDepth 16
    SubSection "Display"
    Depth 16
    Modes "1024x768" "800x600"
    EndSubSection
    EndSection
    Section "Extensions"
    Option "Composite" "Enable"
    EndSection
    I should probably also mention that I'm rolling my own kernel, and as such I'm not using the package from testing. Building it manually with the PKGBUILD from ABS though so it shouldn't be any difference though.
    Last edited by [vEX] (2008-01-15 17:15:36)

  • Problems with XML-RPC

    Hi everybody.
    Sorry, I've got a french accent, then if you don't understand, dont' be worry ^^
    I try using the apache's xmpl-rpc package, and I have got some problems with the xml-rpc client.
    Here my source :
    public interface ICalculator {
         public int add(int i1, int i2);
         public int subtract(int i1, int i2);
    public class Calculator implements ICalculator {
         public int add(int i1, int i2) {
              return i1 + i2;
         public int subtract(int i1, int i2) {
              return i1 - i2;
    import org.apache.xmlrpc.server.PropertyHandlerMapping;
    import org.apache.xmlrpc.server.XmlRpcServer;
    import org.apache.xmlrpc.server.XmlRpcServerConfigImpl;
    import org.apache.xmlrpc.webserver.WebServer;
    public class Server {
    private static final int port = 8080;
    public static void main(String[] args) throws Exception {
    WebServer webServer = new WebServer(port);
    XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();
    PropertyHandlerMapping phm = new PropertyHandlerMapping();
    phm.addHandler(Calculator.class.getName(), Calculator.class);
    phm.addHandler(ICalculator.class.getName(), ICalculator.class);
    xmlRpcServer.setHandlerMapping(phm);
    XmlRpcServerConfigImpl serverConfig =
    (XmlRpcServerConfigImpl) xmlRpcServer.getConfig();
    serverConfig.setEnabledForExtensions(true);
    serverConfig.setContentLengthOptional(false);
    webServer.start();
    System.out.println("Serveur XML-RPC is ready");
    import org.apache.xmlrpc.client.XmlRpcClient;
    import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
    import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory;
    import org.apache.xmlrpc.client.util.ClientFactory;
    public class Client {
    public static void main(String[] args) throws Exception {
    // create configuration
    XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
    config.setServerURL(new URL("http://127.0.0.1:8080/xmlrpc"));
    config.setEnabledForExtensions(true);
    config.setConnectionTimeout(60 * 1000);
    config.setReplyTimeout(60 * 1000);
    XmlRpcClient client = new XmlRpcClient();
    System.out.println("Connection");
    // use Commons HttpClient as transport
    client.setTransportFactory(
    new XmlRpcCommonsTransportFactory(client));
    // set configuration
    client.setConfig(config);
    ClientFactory factory = new ClientFactory(client);
    ICalculator calc = (ICalculator)factory.newInstance(ICalculator.class); //Problems here !!!
    System.out.println("Calculing");
    System.out.println("Result : " + calc.add(2, 3));
    And the error is:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpException
         at org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory.getTransport(XmlRpcCommonsTransportFactory.java:31)
         at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)
         at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
         at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:136)
         at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:125)
         at org.apache.xmlrpc.client.util.ClientFactory$1.invoke(ClientFactory.java:104)
         at $Proxy0.add(Unknown Source)
         at projet.Client.main(Client.java:45)
    Can you help please ?

    The problem is not related to your code, but it seems that there is a missing jar which contains the class org.apache.commons.httpclient.HttpException or perhaps the jar isn't included in your CLASSPATH.
    The jar seems to be commons-httpclient.jar you can found at http://jakarta.apache.org/commons/httpclient

  • Problem with distributing hotfix

    Hello to everybody!!
    have a problem with distributing packets *.msu(hotfix).  I run it with command  wusa.exe  nameofhotfix.msu /quiet /norestart
    And it is not install in computers. I give an error
    The program for advertisement "SRV2000D" failed ("SRV00014" - "Windows6.1-KB2459530"). A failure exit code of -2145124329 was returned. User context: NT AUTHORITY\SYSTEM Possible cause: Systems Management Server (SMS) determines
    status for each program it executes. If SMS cannot find or correlate any installation status Management Information Format (MIF) files for the program, it uses the program's exit code to determine status. An exit code of -2145124329 is considered a failure.
    Solution: For more information on the exit code, refer to the documentation for the program you are distributing.
    I search with error code -2145124329  in internet. But cannt find any usefull information
    how to solve this problem. Please help

    Hi,
    to analyse further;
    Run CALC.exe, place CALC into "Programmer" mode (View, Programmer)
    Set CALC.exe into "Dec" mode (Decimal)
    Paste the decimal value: -2145124329 
    Click "Hex" (the conveted result is shown: FFFFFFFF80240017)
    Open cmtrace tool
    Press CTRL+L (open error lookup utility)
    Paste converted Hex value (remove the leading FFFFFFFF)
    Click "Lookup" button (error lookup result is displayed)
    Operation was not performed because there are no applicable updates.
    Source: Windows Update Agent
    This all suggests that the update file you are trying to apply, is not needed/is not applicable to the computer under examination. There are various possible reasons for this outcome;
    a) the update has previously been applied
    b) the underlying product does not exist on this machine, so that patch cannot be applied
    c) a pre-requisite update is missing
    d) the patch cannot be applied, as the OS version or architecture is wrong/mismatched
    e) probably more, but these are the reasons I have observed so far.
    You should check or test, either before attempting to apply this patch, or, check for this resultcode, and take the desired action (fail, or, ignore, or send an alert,or whatever you wish to see happen)
    Don
    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
    This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

  • A problem with threads

    I am trying to implement some kind of a server listening for requests. The listener part of the app, is a daemon thread that listens for connections and instantiates a handling daemon thread once it gets some. However, my problem is that i must be able to kill the listening thread at the user's will (say via a sto button). I have done this via the Sun's proposed way, by testing a boolean flag in the loop, which is set to false when i wish to kill the thread. The problem with this thing is the following...
    Once the thread starts excecuting, it will test the flag, find it true and enter the loop. At some point it will LOCK on the server socket waiting for connection. Unless some client actually connects, it will keep on listening indefinatelly whithought ever bothering to check for the flag again (no matter how many times you set the damn thing to false).
    My question is this: Is there any real, non-theoretical, applied way to stop thread in java safely?
    Thank you in advance,
    Lefty

    This was one solution from the socket programming forum, have you tried this??
    public Thread MyThread extends Thread{
         boolean active = true;          
         public void run(){
              ss.setSoTimeout(90);               
              while (active){                   
                   try{                       
                        serverSocket = ss.accept();
                   catch (SocketTimeoutException ste){
                   // do nothing                   
         // interrupt thread           
         public void deactivate(){               
              active = false;
              // you gotta sleep for a time longer than the               
              // accept() timeout to make sure that timeout is finished.               
              try{
                   sleep(91);               
              }catch (InterruptedException ie){            
              interrupt();
    }

  • Problem with Threads and a static variable

    I have a problem with the code below. I am yet to make sure that I understand the problem. Correct me if I am wrong please.
    Code functionality:
    A timer calls SetState every second. It sets the state and sets boolean variable "changed" to true. Then notifies a main process thread to check if the state changed to send a message.
    The problem as far I understand is:
    Assume the timer Thread calls SetState twice before the main process Thread runs. As a result, "changed" is set to true twice. However, since the main process is blocked twice during the two calls to SetState, when it runs it would have the two SetState timer threads blocked on its synchronized body. It will pass the first one, send the message and set "changed" to false since it was true. Now, it will pass the second thread, but here is the problem, "changed" is already set to false. As a result, it won't send the message even though it is supposed to.
    Would you please let me know if my understanding is correct? If so, what would you propose to resolve the problem? Should I call wait some other or should I notify in a different way?
    Thanks,
    B.D.
    Code:
    private static volatile boolean bChanged = false;
    private static Thread objMainProcess;
       protected static void Init(){
            objMainProcess = new Thread() {
                public void run() {
                    while( objMainProcess == Thread.currentThread() ) {
                       GetState();
            objMainProcess.setDaemon( true );
            objMainProcess.start();
        public static void initStatusTimer(){
            if(objTimer == null)
                 objTimer = new javax.swing.Timer( 1000, new java.awt.event.ActionListener(){
                    public void actionPerformed( java.awt.event.ActionEvent evt){
                              SetState();
        private static void SetState(){
            if( objMainProcess == null ) return;
            synchronized( objMainProcess ) {
                bChanged = true;
                try{
                    objMainProcess.notify();
                }catch( IllegalMonitorStateException e ) {}
        private static boolean GetState() {
            if( objMainProcess == null ) return false;
            synchronized( objMainProcess ) {
                if( bChanged) {
                    SendMessage();
                    bChanged = false;
                    return true;
                try {
                    objMainProcess.wait();
                }catch( InterruptedException e ) {}
                return false;
        }

    Thanks DrClap for your reply. Everything you said is right. It is not easy to make them alternate since SetState() could be called from different places where the state could be anything else but a status message. Like a GREETING message for example. It is a handshaking message but not a status message.
    Again as you said, There is a reason I can't call sendMessage() inside setState().
    The only way I was able to do it is by having a counter of the number of notifies that have been called. Every time notify() is called a counter is incremented. Now instead of just checking if "changed" flag is true, I also check if notify counter is greater than zero. If both true, I send the message. If "changed" flag is false, I check again if the notify counter is greater than zero, I send the message. This way it works, but it is kind of a patch than a good design fix. I am yet to find a good solution.
    Thanks,
    B.D.

  • Problem with threads running javaw

    Hi,
    Having a problem with multi thread programming using client server sockets. The program works find when starting the the application in a console using java muti.java , but when using javaw multi.java the program doesnt die and have to kill it in the task manager. The program doesnt display any of my gui error messages either when the server disconnect the client. all works find in a console. any advice on this as I havent been able to understand why this is happening? any comment would be appreciated.
    troy.

    troy,
    Try and post a minimum code sample of your app which
    does not work.
    When using javaw, make sure you redirect the standard
    error and standard output streams to file.
    Graeme.Hi Graeme,
    I dont understand what you mean by redirection to file? some of my code below.
    The code works fine under a console, code is supposed to exit when the client (the other server )disconnects. the problem is that but the clientworker side of the code still works. which under console it doesnt.
    public class Server{
    ServerSocket aServerSocket;
    Socket dianosticsSocket;
    Socket nPortExpress;
    ClientListener aClientListener;
    LinkedList queue = new LinkedList();
    int port = 0;
    int clientPort = 0;
    String clientName = null;
    boolean serverAlive = true;
    * Server constructor generates a server
    * Socket and then starts a client threads.
    * @param aPort      socket port of local machine.
    public Server(int aPort, String aClientName, int aClientPort){
    port = aPort;
    clientName = aClientName;
    clientPort = aClientPort;
    try{
    // create a new thread
    aServerSocket = new ServerSocket(port) ;
    // connect to the nPortExpress
    aClientListener = new ClientListener(InetAddress.getByName(clientName), clientPort, queue,this);
    // aClientListener.setDaemon(true);
    aClientListener.start();
    // start a dianostic port
    DiagnosticsServer aDiagnosticsServer = new DiagnosticsServer(port,queue,aClientListener);
    // System.out.println("Server is running on port " + port + "...");
    // System.out.println("Connect to nPort");
    catch(Exception e)
    // System.out.println("ERROR: Server port " + port + " not available");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Server port " + port + " not available", JOptionPane.ERROR_MESSAGE);
    serverAlive = false;
    System.exit(1);
    while(serverAlive&&aClientListener.hostSocket.isConnected()){
    try{
    // connect the client
    Socket aClient = aServerSocket.accept();
    //System.out.println("open client connection");
    //System.out.println("client local: "+ aClient.getLocalAddress().toString());
    // System.out.println("client localport: "+ aClient.getLocalPort());
    // System.out.println("client : "+ aClient.getInetAddress().toString());
    // System.out.println("client port: "+ aClient.getLocalPort());
    // make a new client thread
    ClientWorker clientThread = new ClientWorker(aClient, queue, aClientListener, false);
    // start thread
    clientThread.start();
    catch(Exception e)
    //System.out.println("ERROR: Client connection failure");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Client connection failure", JOptionPane.ERROR_MESSAGE);
    }// end while
    } // end constructor Server
    void serverExit(){
         JOptionPane.showMessageDialog(null, "Server ","ERROR: nPort Failure", JOptionPane.ERROR_MESSAGE);
         System.exit(1);
    }// end class Server
    *** connect to another server
    public class ClientListener extends Thread{
    InetAddress hostName;
    int hostPort;
    Socket hostSocket;
    BufferedReader in;
    PrintWriter out;
    boolean loggedIn;
    LinkedList queue;      // reference to Server queue
    Server serverRef; // reference to main server
    * ClientListener connects to the host server.
    * @param aHostName is the name of the host eg server name or IP address.
    * @param aHostPort is a port number of the host.
    * @param aLoginName is the users login name.
    public ClientListener(InetAddress aHostName, int aHostPort,LinkedList aQueue,Server aServer)      // reference to Server queue)
    hostName = aHostName;
    hostPort = aHostPort;
    queue = aQueue;
    serverRef = aServer;      
    // connect to the server
    try{
    hostSocket = new Socket(hostName, hostPort);
    catch(IOException e){
    //System.out.println("ERROR: Connection Host Failed");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Connection to nPort Failed", JOptionPane.ERROR_MESSAGE);     
    System.exit(0);
    } // end constructor ClientListener
    ** multi client connection server
    ClientWorker(Socket aSocket,LinkedList aQueue, ClientListener aClientListener, boolean diagnostics){
    queue = aQueue;
    addToQueue(this);
    client = aSocket;
    clientRef = aClientListener;
    aDiagnostic = diagnostics;
    } // end constructor ClientWorker
    * run method is the main loop of the server program
    * in change of handle new client connection as well
    * as handle all messages and errors.
    public void run(){
    boolean alive = true;
    String aSubString = "";
    in = null;
    out = null;
    loginName = "";
    loggedIn = false;
    while (alive && client.isConnected()&& clientRef.hostSocket.isConnected()){
    try{
    in = new BufferedReader(new InputStreamReader(client.getInputStream()));
    out = new PrintWriter(new OutputStreamWriter(client.getOutputStream()));
    if(aDiagnostic){
    out.println("WELCOME to diagnostics");
    broadCastDia("Connect : diagnostics "+client.getInetAddress().toString());
    out.flush();
    else {       
    out.println("WELCOME to Troy's Server");
    broadCastDia("Connect : client "+client.getInetAddress().toString());
         out.flush();
    String line;
    while(((line = in.readLine())!= null)){
    StringTokenizer aStringToken = new StringTokenizer(line, " ");
    if(!aDiagnostic){
    broadCastDia(line);
    clientRef.sendMessage(line); // send mesage out to netExpress
    out.println(line);
    out.flush();
    else{
    if(line.equals("GETIPS"))
    getIPs();
    else{
    clientRef.sendMessage(line); // send mesage out to netExpress
    out.println(line);
    out.flush();
    } // end while
    catch(Exception e){
    // System.out.println("ERROR:Client Connection reset");
                             JOptionPane.showMessageDialog(null, (e.toString()),"ERROR:Client Connection reset", JOptionPane.ERROR_MESSAGE);     
    try{
    if(aDiagnostic){
    broadCastDia("Disconnect : diagnostics "+client.getInetAddress().toString());
    out.flush();
    else {       
    broadCastDia("Disconnect : client "+client.getInetAddress().toString());
         out.flush();
    // close the buffers and connection;
    in.close();
    out.close();
    client.close();
    // System.out.println("out");
    // remove from list
    removeThreadQueue(this);
    alive = false;
    catch(Exception e){
    // System.out.println("ERROR: Client Connection reset failure");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Client Connection reset failure", JOptionPane.ERROR_MESSAGE);     
    }// end while
    } // end method run
    * method run - Generates io stream for communicating with the server and
    * starts the client gui. Run also parses the input commands from the server.
    public void run(){
    boolean alive = true;
    try{
    // begin to life the gui
    // aGuiClient = new ClientGui(hostName.getHostName(), hostPort, loginName, this);
    // aGuiClient.show();
    in = new BufferedReader(new InputStreamReader(hostSocket.getInputStream()));
    out = new PrintWriter(new OutputStreamWriter(hostSocket.getOutputStream()));
    while (alive && hostSocket.isConnected()){
    String line;
    while(((line = in.readLine())!= null)){
    System.out.println(line);
    broadCast(line);
    } // end while
    } // end while
    catch(Exception e){
    //     System.out.println("ERRORa Connection to host reset");
    JOptionPane.showMessageDialog(null, (e.toString()),"ERROR: Connection to nPort reset", JOptionPane.ERROR_MESSAGE);
    try{
    hostSocket.close();
         }catch(Exception a){
         JOptionPane.showMessageDialog(null, (a.toString()),"ERROR: Exception", JOptionPane.ERROR_MESSAGE);
    alive = false;
    System.exit(1);
    } // end method run

Maybe you are looking for