Jump to content

xtopolis

Members
  • Posts

    1,422
  • Joined

Posts posted by xtopolis

  1. Copy pasting the official Example 1 on this page and changing it to fit your images, and the right x/y coordinates and opacity, I was able to get it to work as intended.

     

    http://www.php.net/manual/en/function.imagecopymerge.php

     

    <?php
    $dest = imagecreatefrompng('body.png');
    $src = imagecreatefrompng('head.png');
    
    // Copy and merge
    imagecopymerge($dest, $src, 0, 0, 0, 0, 64, 102, 100);
    
    // Output and free from memory
    header('Content-Type: image/png');
    imagepng($dest);
    
    imagedestroy($dest);
    imagedestroy($src);
    ?>

  2. These questions are too open; the best answer so far is "it depends".  As Tagg suggested, there are numerous ways of approaching this, Flash being one of them.

     

    There are too many things to consider to give you a good estimate at this point.  It depends how accessible you want the site to be, what languages, how detailed, how realistic... etc. etc..  Using Flash/Silverlight would likely be very interactive, but could alienate customers that can't handle it (slow pc, disabled, disability, etc)...  Using normal webpages and images to represent all of the environment would be equally taxing on the server and client pc.  Consider that the reason this doesn't exist yet (or at least widespread) is because of all the considerations that need to be addressed to create what you are imagining.

    ----

    1) It’ll take quite a bit of server space to store the information within the application, but how much server space, bandwidth, etc. will be necessary to maintain this kind of application?

    ~  This depends on the number of images + pages + style sheets + scripts + video(?) + etc... that you decide to utilize.  Potential bandwidth used could be the a minimum of all that * the number of users * number of visits ... (though things would be cached, but not guaranteed to be cached.)  Plus there will be local bandwidth utilized for talking to the databases, let alone storing information in them....

     

    2) How would graphics, usability features, customization, and anything that makes the application more complex affect customer’s ability to access the application, affect the cost to maintain, etc.?

    ~Depends how many people you want to realistically reach.  Flash could make the modeling of a real store environment easier, but would allow less users access to it.  Making a fallback site for users that can't access the flash version will create extra work for you to program and maintain.  Don't forget about potential smartphone customers which would prefer their own formatted version of the site.. etc etc.  It depends.

     

    3) How long would it take to program and set up this kind of application?

    ~It depends.  I don't even want to ballpark this estimation.  It depends on the quality of the designers/developers, your needs, testing... etc.. primarily how much money you are willing to spend on it.

     

    4) How much would it cost to set this up?

    ~It depends.  Hosting is cheap, but what you're envisioning would need several (if not more) servers working together to serve all the potential data/customers/etc...

     

     

    5) How much would it cost to maintain this?

    ~It depends.  Bandwidth and storage is relatively cheap, cpu power not so much.

     

    6) Ajax looks like the best programming option, but is there another you think would work better?

    ~Depends how you want to setup your application.  Ajax is useful, Flash/Silverlight seems well suited.... but what are you going to base it on?  Which server side language (PHP, ASP, JSP, CGI... etc), and what database (Oracle, MySQL, Access... etc)..  Ajax is more of a communication aspect in this regard... not really useful for the programming needed to make this application work.

     

    7) How much would it cost to set up the actual website that would be hosting the application?

    ~See above, it depends.

     

    8) I know Google Maps uses something similar to this – would having the store in 3D be too much for it to handle?

    ~Too much for what to handle?  Technically you can always throw more CPU ($) at the problem until it goes away.

     

    9) If you have any extra information on cost, time, set-up, operations, etc., please let me know!

    ~You can look on many web host companies and see their prices once you get an idea of what you want to do.

     

     

    I think what I envision and what you describe are two different things.  I gave a worst case scenario since you were saying things like "new shopping experience" and "virtual layout of the store"...  Like I said, this is too open of a question without more details.

  3. Try this:

    SELECT * FROM celebday c
      LEFT JOIN month_lookup m
        USING(bmonth)
        
      WHERE DAYOFYEAR(CONCAT(YEAR(CURDATE()), '-', m.bmonth_num, '-', c.bday))
      
      BETWEEN DAYOFYEAR(CURDATE()) 
        AND DAYOFYEAR(DATE_ADD(CURDATE(), INTERVAL 2 DAY)) 
       
       ORDER BY rand() limit 1 

     

    I'm not sure if it does what you want or not, too many rows.

  4. Problems arise at the end of the month when simply adding two days in INTERVAL form do not calculate properly because there is no month with more than 31 days and on occasion a month ends on a weekend just like this past October.

     

    I'm confused:

    SELECT "2009-10-31", DATE_ADD("2009-10-31", INTERVAL 2 DAY)

    2009-10-31    DATE_ADD("2009-10-31", INTERVAL 2 DAY)

    2009-10-31 2009-11-02

    That seems to work for me?

     

     

    Anyway, to address your query, it should probably look closer to this:

    SELECT * FROM celebday c
      LEFT JOIN month_lookup m
        USING(bmonth)
        
      WHERE DAYOFYEAR(CONCAT((YEAR(CURDATE()), '-', c.bmonth, '-', c.bday))
      
      BETWEEN DAYOFYEAR(CURDATE()) 
        AND DAYOFYEAR(DATE_ADD(CURDATE(), INTERVAL 2 DAY)) 
       
       ORDER BY rand() limit 1;

     

    You'll notice I fixed your "WHERE DAYOFYEAR" concatenation (you didn't have any!) to be correct.  Realize though that this query makes me cry and it should not be done this way.  If the dates were stored better in the table, you would be able to eliminate a lot of code.  Why do you break up the  Day, Month, Year and use tinyint/varchar when you could use a simple timestamp column in the format YYYY-MM-DD H:i:S (something like that)....  You're creating more work than necessary.

     

    I would like to state that while this may get you closer to your desired output, it should really be fixed considerably.

  5. Well, the Firebug suggestion was a reference to "not loading" assuming it was failing at the HTTP request.  However, now that you've explained further, it could be any number of things.  You'll have to diagnose further to see what conditions make the problem show up...  If it's random like you say, it may be due to any number of things.

     

    For reference, I had this problem using Google Chrome versus Firefox 3.5.x.... Chrome was the faster browser, but would not load all images EVERY time, even ones it had previously loaded.  I do not know why it did this.  Additionally, I have the same problem on my iPhone using its Safari browser.  Occasionally, I would come to a page where not all images would load; I assumed this was memory related, but was never certain.

     

    I don't know if any of this information helps you, but there's not much we can help you with if it's hard to determine the steps to reproduce it every time.  (it could be related to your pc dealing with other processes at the time, etc).

  6. I read the thread several times and I'm still confused about what you want it to do.  Going by your first post "select site and then show the ip address", you could do that in one database call as such:

     

    (Note, this code isn't pretty, but should give you an idea of functional possibilities)

    <?php
          require("confwifi.php");
    
    $ip_form = $_POST['ip'];
    
    $extract = mysql_query ("SELECT id,site,ip FROM site");
    $numrows = mysql_num_rows ($extract);
    
    $options = '';
      while(list($id, $site, $ip) = mysql_fetch_assoc($extract))
      { 
        $options .= "<option value='$id' ip='$ip'>$site</option>";
      }
    
    ?>
    
    <html>
    <head>
    <script type="text/javascript">
    function showSelected(trgt, val)
    {
      var x = document.getElementById(trgt);
      x.innerHTML = val;
    }//show selected
    </script>
    </head>
    <body>
    
    <p>Select CAMPUS: <select name="ip" onchange="showSelected('selectedResult', this.options[this.selectedIndex].getAttribute('ip'));">
      <?php echo $options; ?>
    </select>
    </p>
    
    <div id='selectedResult'></div>
    </body>
    </html>

     

    What I did was add a custom attribute "ip" to the option tag for each site and read and display the data using javascript.  I assume that is similar to what you wanted to do seeing as how you had a javascript function in place (though no code was provided for it)

     

    As for your other posts in the thread about "doing something with the variable later", you'll have to explain further as I did not follow what you were trying to explain.

  7. The PHP can echo out whatever you want it to.

     

    if (xmlHttp.readyState == 4) {
        alert('made it to readystate ==4');
        //parent.document.getElementById(div).innerHTML = xmlHttp.responseText;
      }else{
        alert('made it to readystate = ' + xmlHttp.readyState);
        alert('status: ' + xmlHttp.statusText);
      }

     

    That code should echo "made it to readystate ==4" if that part of the request made it...  Keep trying, I won't be able to assist more tonight, but I'm sure you can figure it out by checking it step by step.

  8. Well, if it doesn't go past 1, (it should go through them until 4 if it's successful) , then try checking the xmlHttp.status code and see if it is indeed working correctly (200).  You need to narrow down the problem since it seems to be between your script and the page it wants to query -- syntactically it seems correct.

  9. If the data went through then the readyState is 4
    Not necessarily...

    This page shows a brief explanation of what codes are returned: http://www.w3schools.com/dom/dom_http.asp

    If deals with the readystate as well as the page status (which you do not check in your code).

     

    Anyway, continue to debug step by step.  Place debugging alerts backwards through your code until you find where it actually breaks.  ie:

    function stateChanged(div) {
      alert('made it to stateChanged()');
    
      if (xmlHttp.readyState == 4) {
        alert('made it to readystate ==4');
        //parent.document.getElementById(div).innerHTML = xmlHttp.responseText;
      }else{
        alert('made it to readystate = ' + xmlHttp.readystate);
      }
    }

  10. Debug it step by step.  I assume it has something to do with the "parent" reference, but I'm unsure.

     

    Start by making the parent.document.getElementById(div).innerHTML = xmlHttp.responseText; line instead say alert(xmlHttp.responseText); and go from there.

     

    Test that it alerts the correct data.  Then test that you can change a direct reference to the HTML object (document.getElementById('nameofdiv').innerHTML = 'test').  Then test that the parent.document.getElementById(div) is actually getting the right element (and not erring).  Then see if the argument div is referencing the object correctly.

     

    Try those things, otherwise we may need to see more code.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.