Help with tile pathfinding

I have been wanting to create a game for some time and have just recently started trying to get path finding to work. I have come up with code that works once(it will get one tile closer to the goal then stay at that node) but i can not figure out how to get it to go all the way to the goal node. can someone point out the problem area or possible fixes for me?
(my code is too long look in the next post for the rest of it)
package pathfinding;
import java.awt.Graphics;
import java.util.LinkedList;
import mainPackage.Main;
* call this class to find a path between start node and goal node
@SuppressWarnings("serial")
public class PathFinder extends LinkedList {
     public LinkedList<Node> openList = new LinkedList<Node>();
     public LinkedList<Node>closedList = new LinkedList<Node>();
     public LinkedList<Node> pathList = new LinkedList<Node>();
     int D = 4;
     public Node[][] nodeBoard=new Node[15][15];
     private Object lowestF;
     public PathFinder(int tilesX, int tilesY) {
               for(int y = 0; y < tilesY; y++) {
                    for(int x = 0; x < tilesX; x++) {
                         Node n = new Node(x, y, 0, 0);
                         nodeBoard[x][y] = n;
                         //System.out.println("nodeBoard["+x+"]["+y+"]: "+n);
     public void findPath(Node startNode, Node goalNode) {
          System.out.println("started pathfinding ");
          Node n = startNode;
          Node gn = goalNode;
          Node lowestF = null;
          if(openList.contains(n) == false)
               openList.add(n);//add the current node to the open list
          //for(int time = 0; time < 10; time++) {//used for testing purposes
          //while(closedList.contains(goalNode) != true) {//while the goal node isnt on the closed list
          while(lowestF != goalNode) {
          //System.out.println("started the while loop  gn x:"+gn.X+" gn y:"+gn.Y);
          //System.out.println("n X:"+n.X+" n Y:"+ n.Y);
          if(closedList.contains(gn) == false) {
               //System.out.println("closedList does not contain goalNode");
          if(lowestF != null) {//if it isnt the first time doing the loop
               n = lowestF;//switch lowestF to the current node (n)
               lowestF = null;// the node with the lowest f score
               //System.out.println(""+closedList.contains(nodeBoard[n.X-1][n.Y-1]));
          System.out.println("printing n "+n);
          

here is the rest of my code from above
System.out.println(""+nodeBoard[n.X-1][n.Y-1]);
          ///ads the surrounding nodes if they are not on the closed list or on the open list already
          if(closedList.contains(nodeBoard[n.X-1][n.Y-1]) == false ){// && (openList.contains(nodeBoard[n.X-1][n.Y-1]) == false))
          openList.add(nodeBoard[n.X-1][n.Y-1]);}//1//these add the nodes surrounding the current node to open list
          if(closedList.contains(nodeBoard[n.X][n.Y-1]) == false){// && openList.contains(nodeBoard[n.X][n.Y-1]) == false)
          openList.add(nodeBoard[n.X][n.Y-1]);}  //2   1 | 2 | 3
          if(closedList.contains(nodeBoard[n.X+1][n.Y-1]) == false){// && openList.contains(nodeBoard[n.X+1][n.Y-1]) == false)
          openList.add(nodeBoard[n.X+1][n.Y-1]);}//3   4 | X | 5
          if(closedList.contains(nodeBoard[n.X-1][n.Y]) == false){// && openList.contains(nodeBoard[n.X-1][n.Y]) == false)
          openList.add(nodeBoard[n.X-1][n.Y]);}  //4   6 | 7 | 8
          if(closedList.contains(nodeBoard[n.X+1][n.Y]) == false){// && openList.contains(nodeBoard[n.X+1][n.Y]) == false)
          openList.add(nodeBoard[n.X+1][n.Y]);}  //5
          if(closedList.contains(nodeBoard[n.X-1][n.Y+1]) == false){// && openList.contains(nodeBoard[n.X-1][n.Y+1]) == false)
          openList.add(nodeBoard[n.X-1][n.Y+1]);}//6
          if(closedList.contains(nodeBoard[n.X+1][n.Y+1]) == false){// && openList.contains(nodeBoard[n.X+1][n.Y+1]) == false)
          openList.add(nodeBoard[n.X+1][n.Y+1]);}//8
          if(closedList.contains(nodeBoard[n.X][n.Y+1]) == false){// && openList.contains(nodeBoard[n.X][n.Y+1]) == false)
          openList.add(nodeBoard[n.X][n.Y+1]);}  //7
          nodeBoard[n.X-1][n.Y-1].setParent(n);//
          nodeBoard[n.X][n.Y-1].setParent(n);  //Sets the parents to the current node
          nodeBoard[n.X+1][n.Y-1].setParent(n);//
          nodeBoard[n.X-1][n.Y].setParent(n);  //
          nodeBoard[n.X+1][n.Y].setParent(n);  //
          nodeBoard[n.X-1][n.Y+1].setParent(n);//
          nodeBoard[n.X][n.Y+1].setParent(n);  //
          nodeBoard[n.X+1][n.Y+1].setParent(n);//
          openList.remove(n);//remove the current node from the open list
          closedList.add(n);//add to the closed list
          for(int a = 0; a < openList.size(); a++) {//for all the nodes in the open list
               Node s = (Node) openList.get(a);//just set a to s for no apparent reason so far
               s.h = D * Math.max(Math.abs(s.X-gn.X), Math.abs(s.Y-gn.Y));//this finds the Heuristic
               //System.out.println("testing h: "+s.h);
               s.setG(s.getParent().getG()+10);//sets the g of the current node by getting the g of the parent and adding in the cost of movement(10)
          for(int fc = 0; fc < openList.size(); fc++) {//compare current node(s) to all other nodes in the open list to find the lowest f score
               Node ff = (Node) openList.get(fc);//turns the counter into a node reference
               //System.out.println("ff's f value: "+ff.getF());
               if(lowestF == null) {//if there isnt a lowest f so far make one
               lowestF = ff;
               //System.out.println(" comparing lowest f's: "+lowestF.compareF(ff));
               if(lowestF.compareF(ff)> 0) {//if ff's f score is lower then lowestF's ff is the new lowestF
                    lowestF = ff;
                    //System.out.println("found new lowest f");
          if(lowestF == null) {
               System.out.println("found lowest f and breaking out of loop to stop error");
               break;
          openList.remove(lowestF);//remove the lowestF node from open list
          //System.out.println("removed lowestF from open list "+lowestF);
          closedList.add(lowestF);//add the lowestF node to the closed list
          //System.out.println("added lowestF to closed list "+lowestF);
          pathList.addLast(lowestF);
          //System.out.println("added lowestF to path list "+lowestF);
          n = lowestF;//set the lowestF node to the new "start" node
          if(closedList.contains(gn) == false) {
               //System.out.println("closedList does not contain goalNode");
          for(int ol = 0; ol < openList.size(); ol++) {
               //System.out.println("openList: "+openList.get(ol).toString());
          for(int cl = 0; cl < closedList.size(); cl++) {//used to show the nodes in closed and open lists
               //System.out.println("closedList: "+closedList.get(cl));
          for(int pl = 0; pl < pathList.size(); pl++) {
               //System.out.println("path: "+pathList.get(pl).toString());
          //System.out.println("goalNode must be on the closed list");
}

Similar Messages

  • Could someone help with some pathfinding game code using Director please?

    Hey guys, i`m new to director and am trying to create a very basic graffiti game with pathfinding code. any links to online tutorials or code sites would be much appreciated! thanks in advance!

    I don't understand how pathfinding relates to graffiti, but here is a Lingo implementation of the A* algorithm

  • Help with pathfinding program

    hi,
    i study java at school and i need help with my project.
    im doing a simple demonstration of a pathfinding program whose algoritm i read off Wikipedia (http://en.wikipedia.org/wiki/Pathfinding)where the co-ordinates of the start and end points
    are entered and the route is calculated as a list of co-ordinates. Here is the section of code i am having trouble with-
    void find_path(int x,int y,int p,int q)
    int t1;int t2;
    int temp_pool[][]=new int[4][3];//stores contagious cells of elements in grid pool
    int grid_pool[][]= new int[100000][3];
    int pass_pool[][]=new int[4][3];//stores the pool of squares which can be added to the list of direction
    int path[][]= new int[10000][3];//stores actual path
    int count=1;int note=10;int kk=0;
    int curx,cury;
    //the above arrays contain 3 columns - to store x and y co-ordinate and a counter variable(the purpose of which will become clear later)
    grid_pool[0][0]=p;
    grid_pool[0][1]=q;
    grid_pool[0][2]=0;
    int counter=grid_pool[0][2];
    for(int i=0;i<=100;i++)
    counter++;
    curx=grid_pool[0];
    cury=grid_pool[i][1];
    temp_pool[0][0]=curx-1;
    temp_pool[0][1]=cury;
    temp_pool[0][2]=counter;
    temp_pool[0][0]=curx;
    temp_pool[0][1]=cury-1;
    temp_pool[0][2]=counter;
    temp_pool[0][0]=curx+1;
    temp_pool[0][1]=cury;
    temp_pool[0][2]=counter;
    temp_pool[0][0]=curx;
    temp_pool[0][1]=cury+1;
    temp_pool[0][2]=counter;
    int pass=0;
    for(int j=0;j<=3;j++)
    int check=0;
    int in=temp_pool[j][0];
    int to=temp_pool[j][1];
    if(activemap[in][to]=='X')
    {check++;}
    if(linear_search(grid_pool,in,to)==false)
    {check++;}
    if(check==2)
    pass_pool[pass][0]=in;
    pass_pool[pass][1]=to;
    pass++;
    }//finding which co-ordinates are not walls and which are not already present
    for(int k=0;k<=pass_pool.length-1;k++)
    grid_pool[count][0]=pass_pool[k][0];
    grid_pool[count][1]=pass_pool[k][1];
    count++;
    if(linear_search(grid_pool,x,y)==true)
    break;
    //in this part we have isolated the squares which run in the approximate direction of the goal
    //in the next part we will isolate the exact co-ordinates in another array called path
    int yalt=linear_searchwindex(grid_pool,p,q);
    t1=grid_pool[yalt][2];
    int g1;int g2;int g3;
    for(int u=yalt;u>=0;u--)
    g3=find_next(grid_pool,p,q);
    g2=g3/10;
    g1=g3%10;
    path[0]=g2;
    path[u][1]=g3;
    path[u][2]=u;
    for(int v=0;v<=yalt;v++)
    System.out.println(path[v][0]+','+path[v][1]);
    ill be grateful if anyone can fix it. im done with the rest though

    death_star12 wrote:
    hi,
    i study java at school and i need help with my project.
    im doing a simple demonstration of a pathfinding program whose algoritm i read off Wikipedia (http://en.wikipedia.org/wiki/Pathfinding)where the co-ordinates of the start and end points
    are entered and the route is calculated as a list of co-ordinates. Here is the section of code i am having trouble with-
    ...The part "i am having trouble with" means absolutely nothing to the people who are answering questions here. It's like going to the doctor with a broken rib and just saying "doc, I don't feel so well". Get my point?
    Also, please take the trouble to properly spell words and use a bit of capitalization. Your question is hard to read as it is, which will most probably cause (some) people not to help you. And lastly, please use code tags when posting code: it makes it so much easier to read (see: [Formatting Messages|http://mediacast.sun.com/users/humanlever/media/forums_text_editor.mp4]).
    Thanks.

  • Need a help with Struts Tiles dynamic menu

    Hello,
    I am started few days ago with Tiles, try to develop web application.
    Can anybody sugest very simple example with Tiles and menu.
    So my definition looks like this:
    tiles-def.xml
    <tiles-definitions>
    <definition name="MainDefinition" path="/layouts/myLayout.jsp">
    <put name="title" value="This is the title." />
    <put name="header" value="/tiles/header.jsp" />
    <put name="menu" value="/tiles/menu.jsp" />
    <put name="body" value="/tiles/body.jsp" />
    <put name="footer" value="This is the footer." />
    </definition>
    I am simple layout.
    I need to on menu click change body content, now i am doing it like this:
    index.jsp
    <%@ page language="java" %>
    <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%String body = request.getParameter("body");%>
    <tiles:insert definition="MainDefinition" flush="true">
    <tiles:put name="body" type="string"> <%= body %> </tiles:put>
    </tiles:insert>
    But now body is a string how to make it open url?
    Maybe somebody have link to menu Tiles good examples.
    Thanks

    But here's some useful advice :P
    I'm going to assume that the other two people involved in this have a bit more experience, have them do most of the designing. Have them leave most of the easy stuff for you. You can then spend your time learning the minimum of what you need to know. And if you have problems, or don't understand things, ask your partners for help.
    And you'll want to set some spare time for you to all get together and do something fun so that you don't kill each other because of the stress :P
    I've had a lot of bad project experiences, fortunatly they where all just at school :P I blame myself, mainly because I didn't do the whole thing myself (mostly because I listened to people when they said that I shouldn't or couldn't do everything myself.) I'd like to say that it's mostly because of poor communication, and disorganization, but an awful lot of it had to do with the fact that I tend to be the only person with any work ethic what so ever.
    But whinning and repressed memories aside, good communication and organization help a lot. Come up with a good system with your team mates. And don't be afraid to ask questions. And don't worry about dividing up the work load equally. Just make sure you put in a good amount of effort, if not frightening amounts.
    If all of you are clueless, divide up the learning stuff between yourselves too.
    I have no experience with Struts. I've done a bit of stuff with XML, but nothing too complicated. The XML by itself tends to be extremely easy. What you plan on doing with it can vary (I don't like XML incidentally :P)
    Other then that, good luck.

  • How to add SharePoint 2013 Promoted link list view web part in page programatically with Tiles view using CSOM.

    How to add SharePoint 2013 Promoted link list view web part in page programatically with Tiles view using CSOM. I found that it can be
    done by using XsltListViewWebPart class but how can I use this one by using shraepoint client api.
    shiv

    Nice, can you point me to the solution please ?
    I'm  trying to do this but I get an error : 
    Web Part Error: Cannot complete this action. Please try again. Correlation ID: blablabla
    StackTrace:    at Microsoft.SharePoint.SPViewCollection.EnsureViewSchema(Boolean fullBlownSchema, Boolean bNeedInitallViews)     at Microsoft.SharePoint.SPList.GetView(Guid viewGuid)   
    All help really appreciated.

  • Server goes out of memory when annotating TIFF File. Help with Tiled Images

    I am new to JAI and have a problem with the system going out of memory
    Objective:
    1)Load up a TIFF file (each approx 5- 8 MB when compressed with CCITT.6 compression)
    2)Annotate image (consider it as a simple drawString with the Graphics2D object of the RenderedImage)
    3)Send it to the servlet outputStream
    Problem:
    Server goes out of memory when 5 threads try to access it concurrently
    Runtime conditions:
    VM param set to -Xmx1024m
    Observation
    Writing the files takes a lot of time when compared to reading the files
    Some more information
    1)I need to do the annotating at a pre-defined specific positions on the images(ex: in the first quadrant, or may be in the second quadrant).
    2)I know that using the TiledImage class its possible to load up a portion of the image and process it.
    Things I need help with:
    I do not know how to send the whole file back to servlet output stream after annotating a tile of the image.
    If write the tiled image back to a file, or to the outputstream, it gives me only the portion of the tile I read in and watermarked, not the whole image file
    I have attached the code I use when I load up the whole image
    Could somebody please help with the TiledImage solution?
    Thx
    public void annotateFile(File file, String wText, OutputStream out, AnnotationParameter param) throws Throwable {
    ImageReader imgReader = null;
    ImageWriter imgWriter = null;
    TiledImage in_image = null, out_image = null;
    IIOMetadata metadata = null;
    ImageOutputStream ios = null;
    try {
    Iterator readIter = ImageIO.getImageReadersBySuffix("tif");
    imgReader = (ImageReader) readIter.next();
    imgReader.setInput(ImageIO.createImageInputStream(file));
    metadata = imgReader.getImageMetadata(0);
    in_image = new TiledImage(JAI.create("fileload", file.getPath()), true);
    System.out.println("Image Read!");
    Annotater annotater = new Annotater(in_image);
    out_image = annotater.annotate(wText, param);
    Iterator writeIter = ImageIO.getImageWritersBySuffix("tif");
    if (writeIter.hasNext()) {
    imgWriter = (ImageWriter) writeIter.next();
    ios = ImageIO.createImageOutputStream(out);
    imgWriter.setOutput(ios);
    ImageWriteParam iwparam = imgWriter.getDefaultWriteParam();
    if (iwparam instanceof TIFFImageWriteParam) {
    iwparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
    TIFFDirectory dir = (TIFFDirectory) out_image.getProperty("tiff_directory");
    double compressionParam = dir.getFieldAsDouble(BaselineTIFFTagSet.TAG_COMPRESSION);
    setTIFFCompression(iwparam, (int) compressionParam);
    else {
    iwparam.setCompressionMode(ImageWriteParam.MODE_COPY_FROM_METADATA);
    System.out.println("Trying to write Image ....");
    imgWriter.write(null, new IIOImage(out_image, null, metadata), iwparam);
    System.out.println("Image written....");
    finally {
    if (imgWriter != null)
    imgWriter.dispose();
    if (imgReader != null)
    imgReader.dispose();
    if (ios != null) {
    ios.flush();
    ios.close();
    }

    user8684061 wrote:
    U are right, SGA is too large for my server.
    I guess oracle set SGA automaticlly while i choose default installion , but ,why SGA would be so big? Is oracle not smart enough ?Default database configuration is going to reserve 40% of physical memory for SGA for an instance, which you as a user can always change. I don't see anything wrong with that to say Oracle is not smart.
    If i don't disincrease SGA, but increase max-shm-memory, would it work?This needs support from the CPU architecture (32 bit or 64 bit) and the kernel as well. Read more about the huge pages.

  • Help with Adobe photoshop cs3....

    Hello. i need help with something. i'm trying to switch the mode so that both of my files will show up at the same time in cs3. i understand there is a command for it, but i don't know what it is. can someone please help me with this issue? help would be greatly appriciated. thank you very much for your time.

    There is an option for 'window'. the problem is, i dont know where Wndows, arrange, or tile is located at! as of now, the program only allows one picture to show on the screen. i want two pictures, but i dont know the command for it. i've heard of it, but i forgot it! oh and thank you very much for replying to me!

  • Need help with Page Layout and Background Scaling

    hello, everyone.
    I am in the process of designing a new website for myself,
    and while I was researching nicely designed pages to use as
    inspiration, I stumbled upon this site:
    http://www.jeffsarmiento.com/
    obviously, the design is very impressive, but it also
    incorporates a lot of web mechanics that I have been trying to
    figure out, so I will use this page as an example.
    one thing I need help with is backgrounds. as you can see in
    the posted website, the creator used a seamlessly tiled paper
    texture to display the bulk of his content on. also make not of the
    pattern that is located to the left of the paper texture. how do I
    create seamless backgrounds like this that will scale to fit any
    amount of content or any resolution? I can't imagine that the guy
    that made that site created a new size background every time he
    made an update, so there has to be an easier way.
    the second thing that I am having trouble with is general
    site layout. I have read that most sites used series of invisible
    tables to organize there content, but when I open the source of
    this page in dreamweaver, he was using something different. div
    tags? should I be using these? who do I use them? are there any
    general layout tips that someone could pass on to me? perhaps a
    link to a good tutorial?
    please help me. i am very confused.
    thanks so much.

    IMO not a good site to emulate. To wit:
    Top background image:
    http://www.jeffsarmiento.com/images/bg-top.jpg;
    745px
    x 350px 137K
    Main background image:
    http://www.jeffsarmiento.com/images/bg-tile.jpg;
    745px x 950px 130K
    Total page size: 454K (Check here:
    www.websiteoptimization.com)
    Website usability experts routinely recommend a maximum page
    size of ~80K
    Check out the We We Scale @ www.FutureNowInc.com/wewe/ where
    they suggest,
    "You speak about yourself approximately 0,003 times as often
    as you speak
    about your customers. Might that have an impact on your
    effectiveness?"
    That is 100% consistent with the #1 Web Design mistake:
    "Believing people
    care about you and your web site." or to phrase more
    expansively, "Our site
    tries to tell you how wonderful we are as a company, but not
    how we're going
    to solve your problems."
    www.sitepoint.com has some excellent books on making a
    website actually
    attractive and usable at the same time.
    Walt
    "beWILLdered_" <[email protected]> wrote in
    message
    news:[email protected]...
    > hello, everyone.
    > I am in the process of designing a new website for
    myself, and while I was
    > researching nicely designed pages to use as inspiration,
    I stumbled upon
    > this
    > site:
    >
    http://www.jeffsarmiento.com/
    > obviously, the design is very impressive, but it also
    incorporates a lot
    > of
    > web mechanics that I have been trying to figure out, so
    I will use this
    > page as
    > an example.
    > one thing I need help with is backgrounds. as you can
    see in the posted
    > website, the creator used a seamlessly tiled paper
    texture to display the
    > bulk
    > of his content on. also make not of the pattern that is
    located to the
    > left of
    > the paper texture. how do I create seamless backgrounds
    like this that
    > will
    > scale to fit any amount of content or any resolution? I
    can't imagine that
    > the
    > guy that made that site created a new size background
    every time he made
    > an
    > update, so there has to be an easier way.
    > the second thing that I am having trouble with is
    general site layout. I
    > have
    > read that most sites used series of invisible tables to
    organize there
    > content,
    > but when I open the source of this page in dreamweaver,
    he was using
    > something
    > different. div tags? should I be using these? who do I
    use them? are there
    > any
    > general layout tips that someone could pass on to me?
    perhaps a link to a
    > good
    > tutorial?
    > please help me. i am very confused.
    >
    > thanks so much.
    >

  • Is in JSF (with Creator) a tehnologie similar with Tiles?

    Hy! I'm new and I want to ask: is in JSF a tehnologie similar with Tiles? How can I make my jsf pages to have some header and footer? Of course, in Creator.
    Thank you very much.

    In general, by design, JSF is a much more flexible framework as JSF is built with integration and extensibility in mind. JSF isn't easier than Struts when developing by hand, but using Sun Java Studio Creator can make it much much easier and greatly increase your productivity.
    Take a look at the Craig McClanahan's Weblog (He was the original creator of the Struts Framework, and was the co-specification lead for JavaServer Faces (JSF) 1.0 )
    http://blogs.sun.com/roller/page/craigmcc/20040927#struts_or_jsf_struts_and
    A good place to learn more about JSF is JSF Central .
    http://jsfcentral.com/
    As for your second question, you could use 'Page Fragment Box'. Check the online help for "Page Fragment Box".
    'This component enables you to include a page fragment in a page. A page fragment is a separate, reusable part of a page that can be included in any number of pages. For example, you might want to put a common a visual element like a header graphic in a page fragment and then include it in all the pages in an application......'
    Hope that helps.

  • HELP with knockout

    Hello,
    I have a question I hope someone can help me with. (Im using AI CS3 on a Mac) Im creating artwork for a customer and need some help with a portion of the illustration.
    I downloaded a portion of the art from Clipart.com, this includes the panther and word Extreme. We only need to deal with the word Extreme for now. Once I know how to fix that I hopefully can fix the panter.
    This is only a two-color job, so the white will also need to be removed from the panther to reveal the background. The word Extreme downloaded in outlines and the center of the R was not knocked out, instead, it was a white shape making it appear as though it was transparent to the background.
    So, I deleted the white center of the R and now it is as seen here: http://digitalmarketing1.com/07-10040-Crosscut.eps
    How can I make the center of the R knock out to the background? This is saw blade artwork and needs to just be the bare steel, as does anything that is currently white.
    How can I get those white sections in the panther, and the center of the R, to cut out to reveal what is behind?
    Thanks, I hope that makes some sense
    Corey

    How about filling the center shape with white?
    Or if you wish you can select the interior shape of the R and move it into the group using the layers panel and use the last icon on the top row of the pathfinder and that will get you what you want as well.

  • Need help with the noise reduction settings

    Hi,
    After som experimenting I need some help with the settings for noise reduction.
    I just edited and converted a few pictures from RAW (D200) til 8-bit TIFF. Opend the file up in photoshop and was shocked to see the amount of noise in the pictures. I then exported the RAW-files and did the same conversion in Capture One 3.7.3 - The result is a lot better regarding noise. In capture One I'm using the noise reduction step before "High".
    Can you share your experience with the optimal settings for best noise removal ?
    Thanks in advance,
    fbrose

    i use it once in a while, but i play around with the sliders in full screen mode and at 100% and then see what the sliders do. I don't have a definite procedure that I can suggest though.

  • Help with dynamic page layouts

    Hello JSP Gurus,
    I'm attempting to dynamically generate the page layout for my site based on the organization a user belongs to. Basically, I'd have certain resources like navigation links, graphics, etc, that are modular. Then I'd like to construct the layout using these "moduls" in a dynamic fashion. Does anyone have any suggestions on techniques or technologies that would be useful? I'm not really looking at the portal/portlet model. Is this something that Cocoon could do by storing the layout for each customer as an XML file or something? Any ideas, suggestions, experiences would be helpful.
    Thanks!

    How does Tiles differ from the JetSpeed apache
    project? They both appear to be portal-like
    frameworks, or am I incorrect about that? Which is
    preferred?Frankly, I can't give you an in-depth answer to that. Maybe someone else can help with more details.
    What I can tell you is that JetSpeed seems to be more of a real portal architecture. Emphasis is placed on the framework portion, interfacing with exisiting applications. Visual layout takes second seat to this.
    Tiles on the other hand puts more emphasis on visual layout and reuse.
    Just looking at JetSpeed's visual interfacing a little bit makes me really dislike it. You build tables and such inside of a servlet, so there's a tight coupling (or at least, much tighter than with Struts/Tiles) between the presentation and logic. (I'm basing this on a JavaWorld article at
    http://www.javaworld.com/javaworld/jw-07-2001/jw-0727-jetspeed.html )
    Based on your initial question, it would seem to me that tiles is much closer to what you're looking for (and likely easier to just pick up and use).
    Anyway, take all this with a grain of salt; I'm not exactly an expert on JetSpeed. =)

  • Help with array of Images - is it possible?

    Hi, i need to do this thing with tiles in my game such like this:
    Image tile[] = new Image[600]
    //building map:
    for (Y...){
    for(X...){
    if(tiles[tilenum].equals(null)){
    tile = Image.createImage("/"+tileset+"/Tile" + tilenum + ".gif");
    tiles[tilenum] = tile;
    }else{
    tile = tiles[tilenum];
    it doesn't work, because Image object has no constructor.. I don't know how to solve it. Can you help me?
    Edited by: __LB__javuje on Oct 29, 2008 11:58 AM

    - it isn't the problem, *.gif works perfectly. But thanks, your note is helpful, i'll redraw images to png:).
    To Daryll.Burke - I think, that my style of writing on this forum wasn't the main problem. If you want to help me, please focus to problem itself and not on details ;). I have rewritten everything, hope that it will be more readable for you.
    edit.: I have read my note from yesterday second time, and i think, i wouldn't understand it too, so sorry, man;)
    Main problem (or definition of "doesn't work, as you said) is, that every time i try to compare *tile[tilenum]* (where tilenum is from interval <0;600) ) with *null* object, NullPointerException is thrown.
    {code}Image tile[] = new Image[600]
    //building map:
    void tileBuild(...){
    for (Y...){
    for(X...){
    try{
    if(tiles[tilenum].equals(null)){
    tile = Image.createImage("/"tileset"/Tile" + tilenum + ".gif");
    tiles[tilenum] = tile;
    }else{
    tile = tiles[tilenum];
    }catch(Exception ex){
    }{code}
    I realy don't know how to solve it..
    Edited by: __LB__javuje on Oct 30, 2008 6:39 AM

  • [SOLVED]Need help with dwm...

    Hi,
    I need help with dwm.I want to apply only 2 patches but everytime when i try i get error... I need xft or pango patch and systray patch.Please help.
    Thanks.
    Last edited by grobar87 (2013-06-01 13:49:55)

    [dejan@archtop dwm-6.0]$ patch < 00-dwm-6.0-buildflags.diff
    patching file config.mk
    [dejan@archtop dwm-6.0]$ patch < dwm-6.0-xft.diff
    patching file dwm.c
    [dejan@archtop dwm-6.0]$ patch < 02-dwm-6.0-systray.diff
    patching file dwm.c
    [dejan@archtop dwm-6.0]$ sudo make clean install
    [sudo] password for dejan:
    cleaning
    dwm build options:
    CFLAGS = -std=c99 -pedantic -Wall -Os -I. -I/usr/include -I/usr/X11R6/include -I/usr/include/freetype2 -DVERSION="6.0" -DXINERAMA -DXFT
    LDFLAGS = -s -L/usr/lib -lc -L/usr/X11R6/lib -lX11 -L/usr/X11R6/lib -lXinerama -L/usr/X11R6/lib -lXft
    CC = cc
    creating config.h from config.def.h
    CC dwm.c
    dwm.c: In function ‘keypress’:
    dwm.c:1062:2: warning: ‘XKeycodeToKeysym’ is deprecated (declared at /usr/include/X11/Xlib.h:1695) [-Wdeprecated-declarations]
    CC -o dwm
    installing executable file to /usr/local/bin
    installing manual page to /usr/local/share/man/man1
    [dejan@archtop dwm-6.0]$
    And here is my config.h:
    /* See LICENSE file for copyright and license details. */
    /* appearance */
    static const char font[] = "Ohsnap";
    static const char normbordercolor[] = "#444444";
    static const char normbgcolor[] = "#222222";
    static const char normfgcolor[] = "#bbbbbb";
    static const char selbordercolor[] = "#005577";
    static const char selbgcolor[] = "#005577";
    static const char selfgcolor[] = "#eeeeee";
    static const unsigned int borderpx = 1; /* border pixel of windows */
    static const unsigned int snap = 32; /* snap pixel */
    static const unsigned int systrayspacing = 2; /* systray spacing */
    static const Bool showsystray = True; /* False means no systray */
    static const Bool showbar = True; /* False means no bar */
    static const Bool topbar = True; /* False means bottom bar */
    /* tagging */
    static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
    static const Rule rules[] = {
    /* class instance title tags mask isfloating monitor */
    { "Gimp", NULL, NULL, 0, True, -1 },
    { "Firefox", NULL, NULL, 1 << 8, False, -1 },
    /* layout(s) */
    static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
    static const int nmaster = 1; /* number of clients in master area */
    static const Bool resizehints = True; /* True means respect size hints in tiled resizals */
    static const Layout layouts[] = {
    /* symbol arrange function */
    { "[]=", tile }, /* first entry is default */
    { "><>", NULL }, /* no layout function means floating behavior */
    { "[M]", monocle },
    /* key definitions */
    #define MODKEY Mod1Mask
    #define TAGKEYS(KEY,TAG) \
    { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
    { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
    { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
    { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
    /* helper for spawning shell commands in the pre dwm-5.0 fashion */
    #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
    /* commands */
    static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
    static const char *termcmd[] = { "uxterm", NULL };
    static Key keys[] = {
    /* modifier key function argument */
    { MODKEY, XK_p, spawn, {.v = dmenucmd } },
    { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
    { MODKEY, XK_b, togglebar, {0} },
    { MODKEY, XK_j, focusstack, {.i = +1 } },
    { MODKEY, XK_k, focusstack, {.i = -1 } },
    { MODKEY, XK_i, incnmaster, {.i = +1 } },
    { MODKEY, XK_d, incnmaster, {.i = -1 } },
    { MODKEY, XK_h, setmfact, {.f = -0.05} },
    { MODKEY, XK_l, setmfact, {.f = +0.05} },
    { MODKEY, XK_Return, zoom, {0} },
    { MODKEY, XK_Tab, view, {0} },
    { MODKEY|ShiftMask, XK_c, killclient, {0} },
    { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
    { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
    { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
    { MODKEY, XK_space, setlayout, {0} },
    { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
    { MODKEY, XK_0, view, {.ui = ~0 } },
    { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
    { MODKEY, XK_comma, focusmon, {.i = -1 } },
    { MODKEY, XK_period, focusmon, {.i = +1 } },
    { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
    { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
    TAGKEYS( XK_1, 0)
    TAGKEYS( XK_2, 1)
    TAGKEYS( XK_3, 2)
    TAGKEYS( XK_4, 3)
    TAGKEYS( XK_5, 4)
    TAGKEYS( XK_6, 5)
    TAGKEYS( XK_7, 6)
    TAGKEYS( XK_8, 7)
    TAGKEYS( XK_9, 8)
    { MODKEY|ShiftMask, XK_q, quit, {0} },
    /* button definitions */
    /* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
    static Button buttons[] = {
    /* click event mask button function argument */
    { ClkLtSymbol, 0, Button1, setlayout, {0} },
    { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
    { ClkWinTitle, 0, Button2, zoom, {0} },
    { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
    { ClkClientWin, MODKEY, Button1, movemouse, {0} },
    { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
    { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
    { ClkTagBar, 0, Button1, view, {0} },
    { ClkTagBar, 0, Button3, toggleview, {0} },
    { ClkTagBar, MODKEY, Button1, tag, {0} },
    { ClkTagBar, MODKEY, Button3, toggletag, {0} },

  • Need Help with 2nd gen shuffle

    I recently purchased a 2nd gen shuffle from a friend. He used Mac and I have Windows Vista so I knew I would have to restore so it would configure to my Windows Vista machine. I did this, renamed and synced some music to it, charged it with no problem. My husband took it with him to work and listened with no problems. He completely used it til the battery went down and needed charging. I hooked it up thru high speed USB port. Itunes didn't recognize it, there were no lights...not even a red or orange light at all. My computer nor device manager recognize it and still no lights on the shuffle period. I've had it hooked up to different ports and no help. I have a nano that works perfectly thru the same port I used so I know it isn't the port. I've tried restarting the computer....no help. I saw the seperate program that you can download for restoring but it says it can't be used with windows vista so I can't try that. Does anyone have any suggestions for me? I really could use some help with this. Thanks in advance for any insight.

    And you will have to take me seriously here but, by using the on/off switch, turn it on, count 15 Mississippi and turn it off, counting 15 Mississippi. Do this three times, leave it in the off position and reconnect the ipod to the dock, then the dock to the computer.
    Let me know how it goes.

Maybe you are looking for

  • Filenames getting truncated in Save for Web AppleScript

    Hey all, running CS4 on an Apple Macbook Pro (using OS X 10.5.6). I am creating an AppleScript that saves out a number of files with different filenames using save for web. The problem is that Photoshop CS4 is truncating the filename, and using a sho

  • Populating the date field

    Hi All,  I am trying to populate the "datefield" (cv58) when the "validated" field (cv55) is set to a specific string from the dropdown menu. I have used the following code in the change event of (cv55).    if (form1.P1.client.variable_option_client.

  • Logic 8 seems not be using both cores??

    I've been a lot of System Overload messages so I started monitoring the CPU usage and I've noticed that Logic is only using one core. When that maxes out I get the message. I've done all the things I should be doing (freezing tracks, raising the I/O

  • Color difference after adding gradient feather

    Hi, As soon as I apply gradient feather to the black box the image color changes drastically. The imported image is a psd file & in grayscale mode. This problem exists in CS6 & CC version of indesign Any suggestions on fixing this? Regards, Arihant

  • Color Shift when drop shadow is used?

    I've noticed a noticeable color shift in my layout between two facing pages in inDesign CS. The layout was originally done in photoshop, so the pages are actually ONE page. I noticed when I added a drop shadow to some text in inDesign, that it shifte