Elimination of Junk Code

Hello All,
I am working on a large project which has been developed over a long time with many developers.
The problem I am facing is
1. There are many unused functions. These unused functions cause code bloat and unnecessary maintenance.
2. Unused/repetead constants. Every module has constants files. also there are constants file in the common area. Many constants defined in common area and module specific files are not being. On the other hand, some things like "yes", "no", "cancel" are defined many times in module specific constants files.
3. Resource bundles being used for i18n have many unused resources.
Is there a utility or script available which will point out these things so that I can just go an remove these functions, variables etc?
The other way is to do a manual code review but it is taking a very a very long time.
regards,
Abhishek.

I do not want to start completely refactoring the code
yet. So I don't want the tool to do "replace temp with
query" or "change bi-directtional to unidirectional
assosiation" kind of stuff.
I want to do just cleanup.
Do you have a tool in mind which does only this kind
of cleanup ?
regards,
Abhishek.sorry i cant help you but im interest to know if a tool like that exsit, please reply his post (by the way does someone have problem with email notification, i didnt receive email notification even if someone reply to a topic i watch since, humm, 2-3 weeks... and i dont even change my setting, and my mailserver work fine)
thx

Similar Messages

  • How to make some junk code not deleted by the optimizer?

    I'm doing a security application. I wrote this function to check for some license, that will throw an exception when a license is not present:
    void CheckLicense();
    Then I found this can be easily hacked, since the hacker can simply replace every CALL instruction to this function with NOPs, and then run the program without a license. To make life harder for hackers, I came up with this NULL pointer trap:
    void CheckLicense(int **ptr)
    int a = 42;
    ALotOfCode();
    *ptr = &a;
    void CheckLicenseWrap()
    int *ptr = NULL;
    ALotOfCode();
    CheckLicense(&ptr);
    ALotOfCode();
    int a = *ptr;
    Now if the hacker bypasses CheckLicense, dereferencing ptr will break the program.
    However this doesn't work when I switched from Debug mode to Release mode: commenting out the call to CheckLicense does not break the program as it should. I think it's probably because the optimizer deleted the statement "int a = *ptr", since
    "a" is never used.
    So the question is, how can I implement this NULL pointer trap without my code being deleted by the optimizer?
    The best solution I can think of is "srand(*ptr)", but that will cause a side effect of resetting the RNG. I don't want my function to have any side effect. Nor do I want "if(ptr == NULL)", because that will likely make the trap very
    obvious.

    On 2/2/2015 10:19 PM, MacMillan_hopefullyUnused wrote:
    Then I found this can be easily hacked, since the hacker can simply replace every CALL instruction to this function with NOPs,
    Easier still, the hacker can replace the first few bytes of the function itself with RET, and not bother hunting down every call site.
    Now if the hacker bypasses CheckLicense, dereferencing ptr will break the program.
    What's to stop said hacker from bypassing CheckLicenseWrap instead?
    Igor Tandetnik

  • How can I delete all javascript code from a file

    We need to delete all the javascript code from our illustrator files. Right now I need to click on each element and check my SVG interactivity window for any javascript code, then trash it from that window. Very time intensive. Any ways to make a complete elimination of javascript code?

    sudo -u _cyrus /usr/bin/cyrus/bin/ipurge -d 0 -f user/mailboxname
    HTH,
    Alex

  • Junk Value in the File

    Hi All,
    I have created and request form which contains the browse field. In my request for I have provided an option for the user to dowlnload the template. This template is an empty excel sheet which I have added in the static file part of sahred componants of my application. User can download this excel sheet, fill in the details in the excel sheet and will upload it through browse button and submit the request.
    The Problem which I am facing is, When ever I try to download the the template it opens with some junk code in it even if i have uploaded emty excel sheet. When I tested my application I came to know that this is happening when ever the user submits the request with the data filled excel sheet in browse filed with the same file name..
    How can this issue be resolved...
    Thanks for ur help in advance

    use File_type as 'BIN'

  • Why does Contribute generate extraneous HTML code?

    Why does Contribute CS4 generate so much extraneous HTML code that is either redundant or conflicts with styles specified in our style sheet?  Below are examples of what we've encountered in the first two weeks of using the product.  It seems that, if we keep using Contribute, our website will soon be cluttered with junk code.  (Some of the special characters listed below and generated by Contribute do not display correctly in this forum.)
    1.       This simple Heading 1 tag: <h1>Heading 1</h1>
    gets replaced with this code:
    <p style="margin-top:0;"><span style="font-family:times new roman;font-size:16px;"><strong><span style="font-family:verdana; font-size:15px;">Heading 1 </span></strong></span></p>
    2.       This simple Heading 2 tag: <h2>Heading 2</h2>
    gets replaced with this code:
    <p><span style="font-family:times new roman;font-size:16px;"><strong><span style="font-family:verdana; font-size:13px;">Heading 2</span></strong></span></p>
    3.       This simple Paragraph tag: <p>Text</p>
    gets replaced with this code:
    <span style="font-family:verdana;"> </span><p style="margin-top:0;margin-bottom:0;"><span style="font-family:times new roman;font-size:16px;">Text<span style="font-family:verdana;font-size:13px;">Text</span></span></p>
    4.       The standard straight quote symbol (&quot;) gets replaced with left and right quotes (&ldquo;) (&rdquo;)
    5.       Apostrophe’s get replaced with “&rsquo;”.
    6.       Odd, non-visible (in some browsers) characters are inserted, like: “”.
    7.       Dashes get replaced with these special characters, which may not display in all browsers: “—”.
    8.       This non-standard style tag gets inserted at the top of some pages:
    <!--
    .style1 {font-size: 15px}
    -->
    </style>
    9.       Trademarks, which are reliably denoted with just ”&trade;”, get replaced with this code and these special characters, which may not display in all browsers: “<span style="font-size:12px;">â„¢</span>”.
    10.   The simple Heading 1 tag: : <h1>Heading 1</h1>
    gets overridden with this code:
    <h1><span style="font-family:times;font-size:16px;"><span style="font-family:arial;font-size:15px;color:black;">Heading 1</span></span></h1>
    11.   This simple Paragraph tag: <p>Text</p>
    has the inappropriate “ServNAV” navigation style applied to it:
    <p class=”ServNAV”>Text</p>
    12.   This simple Paragraph tag: <p>Text</p>
    gets replaced with this code:
    <p style="margin-top:0;"><span style="font-family:Times New Roman;font-size:15px;"><span style="font-family:verdana;font-size:12px;color:#333333;">Text</span></span></p>
    13.   Extra filler space gets inserted at the bottom of a page with this code:
    <p style="margin-bottom: 0;"> </p>
    14.   Internal links are created as absolute (<a href="http://www.company.com/subfolder/Client-One.html">) rather than relative links ()<a href="../subfolder/Client-One.html">.
    15.   Links to other sites are coded incorrectly,
    as in “<a href="www.company.com">www.company.com</a>”
    instead of: “<a href="http://www.company.com">www.company.com</a>”.
    16.   This simple bold Paragraph tag: <p><strong>About Company</strong></p>
    gets replaced with this
    <p style="margin-bottom: 0;"><strong>About Company</strong></p>
    17.   This simple Paragraph tag: <p>Text</p>
    gets replaced with this code:
    <p style="margin-top:0;"><span style="font-family:times new roman;font-size:16px;"><span style="font-family:verdana;font-size:13px;">Text</span></span></p>
    Message was edited by: JerryWeb

    I've just written a detailed list of editing tips for our internal use that, in addtion to using "Paste Text Only", describe how to avoid or re-key Microsoft Office curly quotes and apostrophes, use only Contribute's Insert | Special Characters, etc.
    In addition, I created a new role in which I made the following changes:
    Under Editing, under“General editing restrictions”, checked the “Prevent users from inserting images (except shared assets); under “Paragraph spacing, changed so “Enter key moves insertion point down:” “Two lines, as in web page editors (uses standard <p> tags”; under “Other editing options”, unchecked “Allow multiple consecutive spaces”
    Under Styles and Fonts, under “Styles and Fonts”, unchecked “Include CSS styles in the Style menu; unchecked “Allow users to apply fonts and sizes”; and unchecked “Allow users to apply font color and background color”.
    Under New Pages, unchecked “Create a blank page”
    Our initial experimentation indicates this eliminates most of the extraneous and junk HTML code that Contribute otherwise introduces. Time will tell. However, it requires contributors to be pretty rigorous.

  • Junk Character

    Hi
    we recently migrated from oracle 8i to oracle 10g.
    now i am getting junk character  instead of space.
    it goes like this.
    when i enter my first name from application and put one space in front.
    it gets saved al rite in application but in database it gets saved as.. for example, GeorgeÂ
    entered name : George
    Database Save : GeorgeÂ
    Please sugegst why it is coming like this? is this DB server issue or oracle DB issue.

    Try the following code to remove the junk code
    ascii values 32 to 126 are key board values. I have considered the remaining are junks
    CREATE OR REPLACE procedure oracle_junk_remove
    As
    Len Number;
    v_ascii_value number;
    Begin
    For i in
    ( select column1 from test1 )
    Loop
    len := Length(i.column1);
    For j in 1..len
    Loop
    select ascii(substr(i.column1,j,1)) into v_ascii_value from dual;
    If v_ascii_value < 32 OR v_ascii_value > 126 then
    dbms_output.put_line('The junk value is ' || substr(i.column1,j,1));
    update test1 set column1 = replace(column1,substr(i.column1,j,1),'');
    commit;
    End if;
    End Loop;
    End Loop;
    End;
    /

  • US Eliminations vs Auto Adjustments

    Hello Folks,
    I have two set of questions relating Eliminations and Please share your valuble inputs in this regards.
    Q1> How to decide whether to go for US Eliminations or Auto Adjustments Business Rules? I
    My thoughts:
    was under impression that US Eliminations need a seperate Elimination Entites. And also it can be done only for Entities having common parent  (nothing but with in a Group) But for Auto Adjustments Elimination Entires will be captured under seperate Data Sources. And it can support Inter Group Eliminations also.
    Your inputs here:
    Q2>How Eliminated/Adjusted amounts of an Account will be distributed into entities much lower than Company Code when we do eliminations at Company Code level? How to capture Eliminations at lower level than Company Code(Ex, Profit center, Cost center, WBS element, Internal Order)
    My thoughts:
    Eliminated Values when we performed Auto Adjustments gets captured in seperate Data Source and seperate Elimination Accounts we create exclusively in BPC.(Ex IC_DIFF, IC_REC, IC_SAL, IC_REV..)
    Eliminated Amounts by Account, by Company Code cannot be distributed to further lower level entities like Cost Center, WBS Element, Internal Order. Eliminated Ammount will remain in Elimination Account in that Co Code as an aggregated value with all other Loew Enties as None_LLEntity)
    Ex: In an Entity ABC, there is an account 123 is holding an amount of $ 1000. This value is coming out of combnations of Account, Company Code, Cost Center. After we performed US eliminations or Auto Adjustments $ 100 got Adjusted/Eliminated and resulted with $ 900 as Consolidated Value.
    If we report it by Account, Company Code,Cost Center I guess we see Eliminated value something like this.
    Account, Co Code, Co Ctr, Data Src, Amount
    123, ABC, CC1, INPUT_DS = 1000
    IC_DIFF, ABC, CC_None, ELIM_DS = (100)
    Your Inputs:??
    Please correct me if Iam wrong. Highly appreciates your inputs of these 2 set of questions.
    Thanks,
    BIBPC

    Q1: US Elimination only works when entity hierarchy is static ( which means the hierarchy does not change as time goes by), and the share of parent entity over child entity is also static (100% always). Auto Adjustment is much more powerful (supposed) to do legal consolidation.
    Q2: Do you mean the Cost Center is a 'Inter Company'? Btw, It's more clear to get the answer by hands on

  • The code segment cannot be greater than or equal to 64K. - Windows 8

    Hello,
    I am having an issue on some windows 8 systems, a crash occurs in NtSetEvent, the exception thrown is "0x000000C8: The code segment cannot be greater than or equal to 64K.".
    This crash only occurs on Windows 8.
    The callstack doesn't help much
        KERNELBASE.dll!_RaiseException@16()    Unknown
        ntdll.dll!_NtSetEvent@8()    Unknown
        kernel32.dll!@BaseThreadInitThunk@12()    Unknown
        ntdll.dll!__RtlUserThreadStart()    Unknown
        ntdll.dll!__RtlUserThreadStart@8()    Unknown
    Could it be a bug within windows 8 ? If not what steps should I take to find the cause of this crash ?
    Thank you,
    Max

    I have a feeling like you have corrupted something.  Likely by stomping on memory due to a bug in your program such as a buffer overrun or use of a deleted object in C++.
    Although you may have incurred corruption to your registry through a variety of means, not limited to bad disk drives, or the unintentional write of bad data due to a bug in your program, if you are experiencing this on multiple systems, then registry corruption
    is less likely.  Which brings me back to the idea that you have a bug in your code that has trashed memory somehow.
    The stack traces and error codes do not indicate the cause of the problem.
    What does your program do??
    Without seeing at least some of the code, or knowing how big the scope of the code is, it's not useful for me to start guessing specifics of what may have happened.  But since you're not disclosing anything at all about your code apart from your exception,
    I'm forced to do some guesswork and just give general advice.
    Here are some easy classical strategies for locating the cause of the problem:
    Build your code in debug mode and run your code in the debugger.  (Yes, some people need to be told this.)
    Bisect the problem through revision control.  Back up to when the problem didn't happen and find the last revision that causes the problem.  (If you're not using a revision control system, start now.)
    Bisect the problem by eliminating chunks of code.  Trim out functionality until the problem goes away.
    Write unit tests.  Test the various pieces of your program to eliminate bugs.  At the very least, make use of assertions.
    Have a look at what your program is DOING when the crash happens.  Certainly there must be a cause.  Try to isolate the problem by associating it with a certain activity in your program.  Gate off functionality by introducing places where
    your program waits before proceeding.  At some point, you'll pass a point where the error can now occur.
    Run code analysis on your project and see if it comes up with any possible culprits.
    Don't ignore compiler warnings, they often indicate something that can turn into a bigger problem.  Compile at the highest warning level.
    Look at your usage of various API functions for logical mistakes.  Here are some examples:
    When using third party libraries or SDKs, have you initialized libraries appropriately?  Have you called all the appropriate initialization functions and used the APIs as intended?  Read documentation and make sure you are using calls appropriately.
    For functions that take a HANDLE, such as SetEvent, are you passing a valid handle?  Have you closed the handle but kept the old handle value around?
    When storing pointers to objects, have you accidentally deleted an object but kept its pointer around, only to make use of the pointer at a later time in your program?  This is particularly harmful when performing a write operation as you can corrupt
    just about anything.
    Are you using variables without giving them an initial value?  You may get unexpected values for variables if you do not initialize them.  This is particularly important for stack variables.
    When using arrays or string buffers, have you allocated enough storage for the bytes you are writing?  C++ doesn't detect reading or writing with an invalid array index as a problem.  It happily reads or writes past the end of your intended
    storage.  Such offences are called "buffer overruns".
    When multi-threading, are you taking steps to ensure data integrity?  Unsynchronized access to data from multiple threads is a notorious cause of strange and difficult to reproduce bugs.  Your data passes through states that you may not expect
    that can be observed by unsynchronized threads.  Use locking mechanisms appropriately and marshal your data diligently.
    Are you relying on valid input from an external source beyond your control such as a network client, database, or file?  Diligently validate all input that comes from an external source.  Be prepared for any situation that you can't control at
    compile time.
    Are you ignoring error codes?  Some functions may fail, but you may be assuming they have succeeded and then gone on to use invalid data.
    Look for mathematical errors.  Calculation of indices of arrays are a notorious culprit.  Beware of off by one errors.  Indices start at zero and go up to N-1, where N is the number of elements in the array.
    Beware of sentinel values.  Some functions such as "IndexOf" will return an index of -1 when not found and can result in a miscalculation of an actual index.
    Are you making use of
    RAII techniques in your code?  Failing to correctly allocate and deallocate resources can cause problems.
    Are you making use of unsafe casts?  C-Style casts say "I know what I'm doing", and you can get into dangerous situations.  Prefer static_cast<> over a C-Style cast wherever possible.
    Also look at your project settings for problems
    Have you accidentally mixed incompatible compiler settings between components?
    Approach debugging with an open mind.  Mark Twain said, "It ain't what you don't know that gets you into trouble. It's what you know for sure that just ain't so."

  • Paypal code and editing in Contribute

    I have a site which is being edited with Contribute. One page
    http://www.centerfornaturalism.org/support.htm
    ) of the site uses paypal to take donations. When you try to edit
    that page using Contribute all of the editable content on that page
    disappears and you only see dotted lines across the page. When I
    tried saving a version of the page and eliminating the paypal code
    it worked fine in Contribute .
    Does anyone have any idea why it is doing this?

    Do you have this file checked out with DW?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Arson Arson" <[email protected]> wrote in
    message
    news:frp2d4$5q8$[email protected]..
    >I cannot edit my page in contribute because it says that
    I am already
    >editing it in dreamweaver. I seem to be locked in and I
    don"t know how to
    >get out...........

  • No Standalone Upgrade Pathway For CS6 Apps

    As many of you who are regular in the forums know, I am a supporter and early adopter of Creative Cloud.
    However as few you are ready to admit, I'm not a blind sheep drinking the red Adobe Koolaid...
    There are in fact glaring flaws in Adobe Creative Cloud, both in terms of the business model and some the Applications methods.
    One of these is the overall upgrade pathway which has changed dramatically...
    On top of limiting the Upgrade Pathway to 2 versions back (CS5 and 5.5), Standalone products have been elimintated from the upgrade pathway.
    As many of you know the standalone upgrade pathway has been a beneift Adobe has provided since CS was first introduced over 10 years ago.
    Now only Bundle users of these previouis versions can upgrade. Anyone else has to buy new Bundles outright meaning that their older standalone license provides no addtional value or upgrade opportunity/savings as it had in the past.
    I pesronally don't understand this from a business point of view as announcing this change and allowing 6 months before closing the standalone upgrade would have been financially beneficial. See unlike most people who are complaining about Creative Cloud subscription model, I don't believe Adobe is doing it to "rake in the cash" or because its a "scam".
    If that were true, announcing the upgrade pathway for Standalone products would be ending and putting a countdown clock would have made them huge revenue as I anticipate the following would have taken place:
    Standalone users of Products like InDesign, Illustrator, After Effects and Flash, would have upgraded to Design Standard, Design Premium, Production Premium or Web Premium to get the most out of their Standalone product in terms of savings without moving to Creative Cloud, and to be able to leverage those other products without moving from the box model if they plan to expand their business in the future.
    Studios and Agencies with older individual boxed products would have upgraded to take advantage of savings and still be able to stay out of Creative Cloud.
    Freelancers using any one of the three "Trinity Products" (Photoshop, InDesign, Illustrator) would have upgrade for the $500 difference as this is less than a year of Creative Cloud and would allow them to keep a box product if they plan expanding their services within the scope of the Trinity.
    While I don't appreciate this as I was looking at getting some value and savings out of some old standalone products I have on various machines throughout the years, it tells me for certain that there is more to this than money (which I realized early and have been trying to point out).
    It may be a STRONG ARM and forceful tactic, but Adobe is trying to move as many people as possible on to a SINGLE CODE BASE and they anticipate they will be able to do it within 3-5 years using their current aggressive strategy.
    Why some of you may not care, those of you who are either into technology, do alot of collaboration or are intruiged by some Adobe's business decisions will want to read on about what I'm seeing here.
    Those of you who have ever had to manage a large website without the benefit of a CMS know that when you have to update something "minor" it can have major implecations. Especially if certain indivual pages or functionality were "inherited" from how someone else coded the site before you and changing too many things to be more efficient would require a complete tear down and overall. Adobe CC was that tear down and overall as they scrapped much of the legacy code that was still around in CS6 (which also had huge coding overhauls). For example, there was a lot of junk code in the Mac version of InDesign even in CS6 and they upgraded that product to a 64bit version, which is a huge deal when you are doing 1000 page technical manuals in InDesign...
    Now imagine that you have to manage maintaining for all OS versions for the forseeable future all 12 of the main Applications in versions CS3- CS6 and CC that is over 70 Applications to maintain the codebase for. Imagine being told you have to maintain that many websites, all with their own indiviudal logic, quirks and standards with huge gaps of inconsistency in between.
    Now imagine you could make the decision to only have to maintain 24 and eventually just 12...
    Now if your in video production or print production, imagine you never have to export or package your files to accomodate for the fact you and someone else may be on a different Adobe version.
    Now you can see why these tactics are being enforced even though in the short term they actually cost Adobe money and potentially even customers. Its a long end game based in the logistics of support, management and reallocating those resources to moving forward and eventually only ever building around a singular code base. Instead of Adobe dividing resources and attention across the legacy products everything will laser focused on maintaining what I refer to as "Adobe Solid (CS6-CC)" vs "Adobe Legacy (CS1-CS5.5)". Even just supporting "Modern Adobe (CS3-CS5.5)" would be (and has been) very labor intensive.
    Microsoft made a similar attempt to reduce their burden by abandoning support of all Windows versions prior to Vista.
    When you detach from the emotional sense of shock, betrayal or what have you and put yourself in the position of making a productivity based decision that reduces your own overhead and cost, its hard not understand where Adobe is coming from here. In their situation I think most of us would make the same choices. Companies who make decisions based on customer reactions, shock value etc. instead of figuring out what is and is not sustainable.
    Also if you look at the long term in 3-5 years most Adobe users will be on either CS6 or CC. Eventually Adobe will not support CS6 on new operating systems which means 5-8 years from now we can expect the majority of Adobe users will be on Creative Cloud, consolidating the ecosystem ( a very Apple like idea actually). Eliminating several problems in terms of compatibility within the Creative Services Industry and reducing Adobe's burden in managing Adobe Legacy and thus internal cost, which will ideally translate eventually to reduced cost to customers or added value to the Creative Cloud product library.
    I can be optimistic in this way because of Adobe's track record in adding value and services, discounts etc in the past, and the fact they have not raised rates. Since CS was introduced over 10 years ago if anything the rates have gotten cheaper even while the software continues to improve. For all of what Photoshop did for the price 10 years ago, the price today is the same and its is so much more than a mere image editing progam, now capable of Video, Animation/Motion Graphics, 3D modeling, Some Web Design, it really is the swiss army knife  of the Creative Services Industry.
    So am I annoyed at the Upgrade pathway being narrowed down to nothing. Absolutely. Do I think it was done purely for greed. No. It doesn't make sense, I would literally be trying to give me money and they are not giving me a way to do it, because they aggressively are on a path that is about a larger goal than taking that money from me today. Do I feel alienated, yes on the surface. Do I still understand and support the decision, Absolutely.
    When something is the right choice, its the right choice, regardless of whether it is right for you. I can't argue with practicallity even when I'm screwed by it, so all I can do is try to be on the right side of it, and get over it when I'm not. It's not something I recommend taking personally.
    There were people who couldn't appreciate this when the transition from film to digital was taking place. Where are they now. The times they are a changing.

    I have to respectfully disagree with you.... Adobe has changed to a company all about profit. For me profit is not a dirty word. we all need it to stay in business...
    However... I purchased my CS6 collection completely online... I can update it when I choose... and I own it... last year we had the choice to own or rent..
    I chose to own.... I dont begrudge the renters I merely want choice...  Adobe removed choice because it realized it could turn us into digital addicts... stop renting
    and yes your files dont vanish but you cant use them... .... dont confuse software evolution with monopolisation and Digital Racketeering. ..Adobe made almost a Billion
    dollar NET profit last year...I think they deserved it... but gouging users is not the way to go....
    The answer I normally get here is well stay on CS6... and I will..... the out pouring of hate with the cloud is because so many users actually love adobe products.. I know
    I do... There will be a gap in the market for about two years as other companies replace Adobes products... but it will happen.. I like many others will wait it out...
    For me the ones I feel sorry for are Adobe employees who are left with the fallout of this horrendous decisicion... I salute you from afar....

  • Urgent Help Required for Connect Four Game

    Hi all,
    I am a student and I have a project due 20th of this month, I mean May 20, 2007 after 8 days. The project is about creating a Connect Four Game. I have found some code examples on the internet which helped me little bit. But there are lot of problems I am facing developing the whole game. I have drawn the Board and the two players can play. The players numbers can fill the board, but I have problem implementing the winner for the game. I need to implement the hasWon() method for Horizontal win, Vertical win and Diagonal win. I also found some code examples on the net but I was unable to make it working. I have 5 classes and one interface which I m implementing. The main problem is how to implement the hasWon() method in the PlayGame class below with Horizontal, vertical and diagonal moves.
    Sorry there is so much code.
    This the interface I must implement, but now I am only implementing the int move() of this interface. I will implement the rest later after solving the winner problem with your help.
    Interface code..............
    interface Player {
    void init (Boolean color);
    String name ();
    int move ();
    void inform (int i);
    Player1 class......................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player1 implements Player
    public Player1()
    public int move()
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player1;
    System.out.println ("What is your Number, player 1?");
    player1 = scan.nextInt();
    System.out.println ("Hey number"+player1+" are you prepared to CONNECT FOUR");
    System.out.println();
    return player1;
    //Player.move();
    //return player1;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "Koonda";
    }//end player1 class
    Player2 class...........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player2 implements Player
    public int move()
    //int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    // cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
    //int num1, num2;
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player2;
    System.out.println ("What is your Number, player 2?");
    player2 = scan.nextInt();
    System.out.println ("Hey "+player2+" are you prepared to CONNECT FOUR");
    System.out.println();
    //return player1;
    return player2;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "malook";
    }//end player1 class
    PlayGame class which contains all the functionality.........................................................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class PlayGame
    //Player player1;
    //Player player2;
    int [][]ConnectFourArray;
    boolean status;
    int winner;
         int player1;
         int player2;
         public PlayGame()
              //this.player1 = player1;
              //this.player2 = player2;
         public void StartGame()
         try{
         // int X = 0, Y = 0;
         //int value;
         int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
         int[][] ConnectFourArray = new int[6][7];
         int num1, num2;
         for(int limit=21;limit!=0;limit--)
    BufferedReader selecter = new BufferedReader (new InputStreamReader(System.in));
    String column1;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=1;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=1;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=1;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=1;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=1;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=1;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=1;
    cup6=cup6-1;
    System.out.println();
    BufferedReader selecter2 = new BufferedReader (new InputStreamReader(System.in));
    String column2;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=2;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=2;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=2;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=2;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=2;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=2;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=2;
    cup6=cup6-1;
    System.out.println();
    System.out.println();
    catch (Exception E){
    System.out.println("Error with input");
    System.out.println("Would you like to play again");
    try{
    String value;
    BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
    // Scanner scan = new Scanner(System.in);
    System.out.println("Enter yes to play or no to quit");
    // value = scan.nextLine();
    // String value2;
    value = reader.readLine();
    //value2 = reader.readLine();
    if (value.equals("yes"))
    System.out.println("Start again");
    StartGame(); // calling the StartGame method to play a game once more
    else if (value.equals("no"))
    System.out.println("No more games to play");
    // System.exit(0);
    else
    System.exit(0);
    System.out.println();
    catch (Exception e){
    System.out.println("Error with input");
    finally
    System.out.println(" playing done");
    //StartGame();
    //check for horizontal win
    public int hasWon()
    int status = 0;
    for (int row=0; row<6; row++)
    for (int col=0; col<4; col++)
    if (ConnectFourArray[col][row] != 0 &&
    ConnectFourArray[col][row] == ConnectFourArray[col+1][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+2][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+3][row])
    //status = true;//int winner;
    if(status == player1)
    System.out.println("Player 1 is the winner");
    else if(status == player2)
    System.out.println("Player 2 is the winner" );
    }//end inner for loop
    }// end outer for loop
    } // end method Winner
    return status;
    }//end class
    ClassConnectFour which designs the board........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class ClassConnectFour
         //Player player1;
         //Player player2;
         public ClassConnectFour()
              //this.player1 = player1;
    public void DrawBoard()
    int[][] ConnectFourArray = new int[6][7] ;
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    }//end class
    TestConnetFour class which uses most of the above class..................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class TestConnectFour
    public static void main(String[] args)
    ClassConnectFour cf = new ClassConnectFour();
    cf.DrawBoard();
    Player1 player1 = new Player1();
    Player2 player2 = new Player2();
    player1.move();
    player2.move();
    System.out.println("Number 1 belongs to player " + player1.name());
    System.out.println("Number 2 belongs to player " + player2.name());
    PlayGame pg = new PlayGame();
    pg.StartGame();
    pg.hasWon();
    //pg.Play();
    //System.out.println(player.name());
    //System.out.println(player2.name());
    }// end main
    }//end class
    I am sorry for all this junk code but I only understand it this way. Your urgent help is required. Looking forward to your reply.
    Thanks in advance.
    Koonda
    //

    Hi,
    Thanks for your help but I really don't understand the table lookup algorithm. Could you please send me some code to implement that.
    I will send you the formatted code as well
    Thanks for your help.
    looking forward to your reply.
    Koonda
    Hi all,
    I am a student and I have a project due 20th of this month, I mean May 20, 2007 after 8 days. The project is about creating a Connect Four Game. I have found some code examples on the internet which helped me little bit. But there are lot of problems I am facing developing the whole game. I have drawn the Board and the two players can play. The players numbers can fill the board, but I have problem implementing the winner for the game. I need to implement the hasWon() method for Horizontal win, Vertical win and Diagonal win. I also found some code examples on the net but I was unable to make it working. I have 5 classes and one interface which I m implementing. The main problem is how to implement the hasWon() method in the PlayGame class below with Horizontal, vertical and diagonal moves.
    Sorry there is so much code.
    This the interface I must implement, but now I am only implementing the int move() of this interface. I will implement the rest later after solving the winner problem with your help.
    Interface code..............
    interface Player {
    void init (Boolean color);
    String name ();
    int move ();
    void inform (int i);
    Player1 class......................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player1 implements Player
    public Player1()
    public int move()
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player1;
    System.out.println ("What is your Number, player 1?");
    player1 = scan.nextInt();
    System.out.println ("Hey number"+player1+" are you prepared to CONNECT FOUR");
    System.out.println();
    return player1;
    //Player.move();
    //return player1;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "Koonda";
    }//end player1 class
    Player2 class...........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player2 implements Player
    public int move()
    //int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    // cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
    //int num1, num2;
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player2;
    System.out.println ("What is your Number, player 2?");
    player2 = scan.nextInt();
    System.out.println ("Hey "+player2+" are you prepared to CONNECT FOUR");
    System.out.println();
    //return player1;
    return player2;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "malook";
    }//end player1 class
    PlayGame class which contains all the functionality.........................................................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class PlayGame
    //Player player1;
    //Player player2;
    int [][]ConnectFourArray;
    boolean status;
    int winner;
    int player1;
    int player2;
    public PlayGame()
    //this.player1 = player1;
    //this.player2 = player2;
    public void StartGame()
    try{
    // int X = 0, Y = 0;
    //int value;
    int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
    int[][] ConnectFourArray = new int[6][7];
    int num1, num2;
    for(int limit=21;limit!=0;limit--)
    BufferedReader selecter = new BufferedReader (new InputStreamReader(System.in));
    String column1;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=1;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=1;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=1;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=1;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=1;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=1;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=1;
    cup6=cup6-1;
    System.out.println();
    BufferedReader selecter2 = new BufferedReader (new InputStreamReader(System.in));
    String column2;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=2;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=2;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=2;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=2;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=2;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=2;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=2;
    cup6=cup6-1;
    System.out.println();
    System.out.println();
    catch (Exception E){
    System.out.println("Error with input");
    System.out.println("Would you like to play again");
    try{
    String value;
    BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
    // Scanner scan = new Scanner(System.in);
    System.out.println("Enter yes to play or no to quit");
    // value = scan.nextLine();
    // String value2;
    value = reader.readLine();
    //value2 = reader.readLine();
    if (value.equals("yes"))
    System.out.println("Start again");
    StartGame(); // calling the StartGame method to play a game once more
    else if (value.equals("no"))
    System.out.println("No more games to play");
    // System.exit(0);
    else
    System.exit(0);
    System.out.println();
    catch (Exception e){
    System.out.println("Error with input");
    finally
    System.out.println(" playing done");
    //StartGame();
    //check for horizontal win
    public int hasWon()
    int status = 0;
    for (int row=0; row<6; row++)
    for (int col=0; col<4; col++)
    if (ConnectFourArray[col][row] != 0 &&
    ConnectFourArray[col][row] == ConnectFourArray[col+1][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+2][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+3][row])
    //status = true;//int winner;
    if(status == player1)
    System.out.println("Player 1 is the winner");
    else if(status == player2)
    System.out.println("Player 2 is the winner" );
    }//end inner for loop
    }// end outer for loop
    } // end method Winner
    return status;
    }//end class
    ClassConnectFour which designs the board........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class ClassConnectFour
    //Player player1;
    //Player player2;
    public ClassConnectFour()
    //this.player1 = player1;
    public void DrawBoard()
    int[][] ConnectFourArray = new int[6][7] ;
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    }//end class
    TestConnetFour class which uses most of the above class..................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class TestConnectFour
    public static void main(String[] args)
    ClassConnectFour cf = new ClassConnectFour();
    cf.DrawBoard();
    Player1 player1 = new Player1();
    Player2 player2 = new Player2();
    player1.move();
    player2.move();
    System.out.println("Number 1 belongs to player " + player1.name());
    System.out.println("Number 2 belongs to player " + player2.name());
    PlayGame pg = new PlayGame();
    pg.StartGame();
    pg.hasWon();
    //pg.Play();
    //System.out.println(player.name());
    //System.out.println(player2.name());
    }// end main
    }//end classI am sorry for all this junk code but I only understand it this way. Your urgent help is required. Looking forward to your reply.
    Thanks in advance.
    Koonda

  • Spry Menu Bar acting crazy

    I am not a coder and have used DW in the past to create relatively simple websites. I have a client who needs a horizontal nav bar with one of the buttons prompting a drop-down menu. First tried this using DM8 and then discovered the drop down menu behavior feature doesn't work in a template. So upgraded to DW CS5. Started to work with the Spry menu bar feature and was learning how to change font color, background color, hover color, add menu items, etc.... I noticed that whenever I tried inserted a new Spry menu bar it had the attributes of the most recent menu bar I created.
    After working with the CSS menu I noticed that there seemed to be a division in each menu bar cell -- a small rectangular shape that I couldn't highlight but would affect how the bar looked in a browser. It almost looked like cell divisions in a table. The bar is horizontal with the text centered LtoR and top to bottom, but there was more space at the bottom of the menu bar due to this added "bar". Then when I inserted a new Spry menu I could barely see it. The menu, which included the default 4 fields/ buttoms was literally about 1" wide on my screen. I tried keying in a new pixel width and nothing would help until I got up to 900px.
    To make an already long story short, the Spry feature is completely screwed up. Is there a preference I can trash to at least re-set it to how it was before I somehow screwed it up?
    Any tips would be great.

    You can delete the Spry support files from your Files Panel, thus eliminating the problem code. 
    Spry Menu 2.0 files use a different naming convention. You edit the menu styles inside Widget Browser's visual editor then save/export files to your local site folder.  
    The support files for Spry Menu 2.0 (aka Spry UI-1.7) look like this:
    <link type='text/css' href='Spry-UI-1.7/css/Menu/basic/SpryMenuBasic.css' rel='stylesheet'/>
    <script type='text/javascript' src='Spry-UI-1.7/includes/SpryMenu.js'></script>
    <script type='text/javascript' src='Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarKeyNavigationPlugin.js'></script>
    <script type='text/javascript' src='Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarIEWorkaroundsPlugin.js'></script>
    Nancy O.

  • Any way to help me convert PDF format to word(.doc) on Mac

    Hi,guys.Is there any one tell me how to convert PDF to word on Mac?
    I am a middle school teacher.Recently I have a download some PDF file need to transfer to word as material for my working.As I use Mac OS has been doubly difficult for me,beacuse I am not familiar with mac system.
    So any idea helpfully would be appreciated.

    There is a very simple method and doesn't require new software.
    Open a new Word document
    Open the PDF in Preview (i.e., double click or right click and open with ... Preview)
    Using the TEXT tool (button labeled "A') highlight the text you want to copy, then copy (i.e. Edit ... Copy, or right click .... Copy, or Command+C)
    Paste the text into a Word document, and it will be editable.
    If you want to copy the entire contents, you can use Command+A to select all contents, then copy and paste to Word document.
    Preview actually works much better than Acrobat Professional in this respect because you don't carry over junk code from PDF.

  • Importing Large Sized MS Office Word 2007 Tables

    Hello,
    Once again I am stuck; hopefully some experienced and helpful FM people can give me some pointers.
    I am using FM 9 in WinXP and MS Office Word 2007. You know, the one that saves documents as .docx.
    I get these documents from Engineers in a Word doc format that in some cases have very large tables that I need to import into FM. I have tried to import these tables as a file, as a CSV, but nothing seems to work well. I keep having problems with each method I try such that the tweaks required to make the import work are not worth it and I may as well start copying and pasting each cell.
    I have also searched the forums to see if there was a post concering this type of thing, but maybe I am not searching on the right thing because I could not find a post that was similar to what I am going through.
    What is the best method to import a 200 row, 6 column table from MS Office Word 2007 into FM9? The end result will need to have a header row and be editable as an FM 9 table.
    Thanks for the help!
    Erin

    Erin, as you've found, importing Word tables can be quite a challenge because there are so many ways that the two applications have different capabilities that the import filter just can't handle them. Plus, it often leaves hidden Word "junk codes" in the table in FM which can severely mangle one's sanity later on. And, the .docx file spec is newer than the FM9 filters, so ...
    The very best way to get clean import of Word tables is to use Rick Quatro's TableCleaner import:
    http://www.frameexpert.com/plugins/index.htm
    It's absolutely worth its weight in gold.

  • Link word document to html file

    does anyone know where I can find some good tutorials on how to link txt. files or word documents to my html page so that it will come up in standard paragraph form on the html site, but can be edited with word.

    MS Word formatting doesn't play nice with HTML.  For best results, you should copy & paste unformatted content from the Word doc directly into your Dreamweaver page using Edit > Paste Special > Text only.  This strips out the junk code generated by MS Word before it ever reaches your HTML page.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb

Maybe you are looking for

  • Wrong values shown in Bex report

    Hi, I've created a Bex report using 0IC_C03. my report is pretty simple, it has 0VALSTCKVAL as the key figure. As characteristics i have plant/ Movement type/ Storage location Initial view it shows by Plant and no problems with the figures, but when

  • Seraching for given string using access

    Hi, this is provbably a simle problem but I carnt see what the problem is so I would appreciate if some1 could see it Im trying to retrieve a record in a database by passing the following sql line: strSQL = "SELECT * FROM STAFF WHERE STAFF.NAME EQUAL

  • PLUG-IN IN JMF

    Hi everybody! Please answer my question very fast. How I can set a new plug-in in jmf. Thanks ,very much ROZA

  • VSTO.dll The system cannot find the file specified. (Exception from HRESULT: 0x80070002)

    Hello, I'm trying to install a VSTO on a clients machine and get the following error message. Could this be something wrong with the .Net Version? Application Domain:    AWAddinInstaller.exe Assembly Codebase:     update files/AWAddinInstaller.exe As

  • It's so difficult to sync my Outlook calendar to my Itouch?

    Can somebody explain me why I cant sync my calendar into my itouch?It just doenst appear in my itunes.