Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

douss

@douss
About
Posts
5
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Unable to display the link which is created Dynamically using Javascript:In FIREFOX
    D douss

    Hi, Try :

    anchorTag.innerHTML = EmpID;

    instead of :

    anchorTag.setAttribute("innerHTML",EmpID);

    Web Development javascript html help tutorial question

  • How can I send a Form with AJAX ?
    D douss

    Hi, I suggest using one of these frameworks : ExtJS, Prototype, Dojo, Scriptaculous... It would make it much easier.

    Web Development question tools

  • Koch Snowflake
    D douss

    Hi vultron, I don't know if you really understand your code. In your code, you clearly defined two points (only two), let's say point A and point B. Coordinates of point A are given by :

    int pointOne = 60;
    int pointTwo = 120;

    Coordinates of point B are given by :

    int pointThree = 160;
    int pointFour = 140;

    Then you draw one side of the snowflake (the side A-B) by :

    drawKochSide(g, level, pointOne, pointTwo, pointThree, pointFour);

    What you have to do is to define a third point C and to draw the two other sides (B-C) and (A-C), so there's the final code of the paint method :

    public void paint(Graphics g)
    {
    int pointOne = 50; //x coordinate of point A
    int pointTwo = 100; //y coordinate of point A
    int pointThree = 150; //x coordinate of point B
    int pointFour = 100; //y coordinate of point B
    int pointFive = 100; //x coordinate of point C
    int pointSix = 14; //y coordinate of point C

    drawKochSide(g, level, pointOne, pointTwo, pointThree, pointFour);
    drawKochSide(g, level, pointFive, pointSix, pointOne, pointTwo);
    drawKochSide(g, level, pointThree, pointFour, pointFive, pointSix);

    }

    Notice that in this example, the triangle ABC is not exactly equilateral because coordinates are integers.

    Java question java graphics help

  • Draw graph (networks)
    D douss

    Hi, You can try the Grappa library: http://www.research.att.com/~john/Grappa/ You can download it here

    Java sysadmin data-structures help question

  • Code Optimization
    D douss

    Hello everybody, I would implement it like this to avoid if or switch statements :

    int incrementAmount;
    for(int i = 0;i < inputLength;i++){
    //input[i] gives a "The type of the expression must
    //be an array type but it resolved to String", but
    //there is no need for '%60'

    currentLetter = input.charAt(i); 
    incrementAmount = (Character.toUpperCase(currentLetter)-'A')%9+1;
    firstNameTotal += incrementAmount;
    

    }

    Also we can replace :

    incrementAmount = (Character.toUpperCase(currentLetter)-'A')%9+1;

    By :

    incrementAmount = (Character.toUpperCase(currentLetter)-'A')%('J'-'A')+1;

    just to be more readable, that means "restart counting after the letter 'J'", which is better than "restart counting after the 9th letter". I also just noticed that you don't manage the case where thirdNameTotal is equal to 0.

    Java css algorithms performance tutorial code-review
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups