Jump to content

ohdang888

Members
  • Posts

    1,285
  • Joined

  • Last visited

    Never

Posts posted by ohdang888

  1. Hey guys,

     

    I've got my first beta testers on board, and now I need to setup a development environment as I can clearly no longer develop on the live site.

     

    What do you find is the best way to do this?

     

    currently I have my public_html directory structured like this:

     

    public_html/

        site/

        app/

        api/

     

    Would be it best to just create a beta_site/ folder, and beta_app/ folders, and then when those are ready, just transfer the files over?

     

    How do you setup your development environments and methods?

     

    Thanks!

  2. The first way is far superior.  Think about it:

     

    Is the API a database?  Of course not.  It uses a database, but it isn't one itself.  Inheritance creates is-a relationships, where an object of a child class is an object of the parent class, with just a little bit extra.

     

    Always favor composition (objects containing references to other objects) over inheritance.  Unless you're building a family of objects, inheritance will only set you back.

     

    great explanation. thanks!

  3. Is it a normal or standard practice to set an object var to a MySQL wrapper

    i.e.

     

    $api = new API();

    $api->db = new MySQLwrapper();

     

    and in the api methods, they call things like

    $this->db->query("blah blah blah");

     

    Or should the API class inherit from the MySQLwrapper?

     

    Thanks

  4. 1) We can't see line numbers, be more specific

     

    2) "how to syntax" - say what? your example could simply end the PHP and begin it again

     

    ?>

    <div class="navigation">

    <ul>

    <li><a href="test.php"<?php if($pageOn == 'test.php'){?> id="selected"<?php }?>>home</a></li>

    <li><a href="book.php"<?php if($pageOn == 'book.php'){?> id="selected"<?php }?>>books</a></li>

    <li><a href="movie.php"<?php if($pageOn == 'movie.php'){?> id="selected"<?php }?>>movies</a></li>

    <li><a href="contact.php"<?php if($pageOn == 'contact.php'){?> id="selected"<?php }?>>contact</a></li>

    </ul>

    </div>

    <?php

  5. try

    <?php
    if (!isset($error))        //if no errors add to DB
    {
    mysql_query("INSERT INTO Reg_Profile_Private (UIN, firstname, lastname, email, phone, password, username)
    VALUES ('$uin', '$firstname', '$lastname', '$email', '$phone', '$passwordenc', '$username')");
    }
    else {                  //else print errors
    foreach($error as $key => $myvar)
    {print "$myvar </p>\n"; }
    }
    ?>
    

  6. well this:

    " SELECT userid FROM ads WHERE adid='$this_adid' "

    will ALWAYS be translated as this:

    "SELECT userid FROM ads WHERE adid='' "

    because its nested within an empty caluse.

     

    Are there any records that have NOTHING in adid column? you should always try print_r on the results

     

  7.  

    Thanks! knew it should that simple.

     

    BUT from that exact string i'm getting this time:

    using Sun Nov 06 2011 09:30:00 GMT-0500 (EST)

    getting 2011-11-06 4:30:00

     

    using

    <?php echo date('Y-m-d G:i:s', strtotime(url_decode($_GET["start"]))); ?>
    

     

    I changed the timezone to EST, and its still coming up with the same thing. I've tried messing around with it, but not getting it to work. How do i adust for this difference? thanks

  8. I'm given something like this:

    Sun Nov 06 2011 09:30:00 GMT-0500 (EST)

     

    And i'm trying to turn that into

    2011-11-06 09:30:00

     

    I started by using explode and trying to loop through the day and month to figure it out, but that seems inefficient and overly complicated. Am i missing something?

     

    Thanks

  9. Hey guys,

     

    random question:

    Does anyone have knowledge of pulling data from the view of an image?

     

    For example, I have an image of a map that I'm putting on GoogleMapsApi. Instead of the user drawing a bunch of polygons, I'd like to be able to know where the lines in the image are, and i'd automatically trace the polygon. It'd be a simple black and white image [white background, a few black lines].

     

    Anyone know a solution or method for this?

     

    Thanks.

  10. SELECT DISTINCT user_id, COUNT(user_id) AS total FROM group_members WHERE group_id IN (2,17) GROUP BY user_id

     

    That's returning a row for each user_id with the total number of groups they are in like this:

     

    user id    total

    42            1

    53            2

    65            1

     

    So, theoretically i could get the total number of unique users by mysql_num_rows, but i'd like to just get that done in the query than wasting extra resources

     

    any ideas?

     

    thanks

  11. Quick question: should be simple, but its escaping me:

     

    I want to get a count of user_ids (not the user_ids themselves, just the number) of users in 2 groups. However, if a user in both groups, they only count for 1 (because you don't want to send them 2 emails). How do i get that number:

     

    This query is returning the total count, regardless if a user is in 2 groups.

     

    SELECT DISTINCT user_id, COUNT(user_id) AS total FROM group_members WHERE group_id IN (2,17)

     

    any thoughts?

     

    thanks!

  12. This doesn't asnwer your question, but, in general, depending on your host, I would send it from one of your own email addresses on your domain, then attach a reply-to with the from email. Most spam fliters don't like the from address not matching the domain it is being sent from

  13. Why not break your commands into external modules and have your switch load and access the correct one?

     

    Also, are you minifying your JS?

     

    with require() ? ya, that's a good idea... at least for the few cases that are 100+ lines long.

     

    I haven't minified my JS yet. I don't plan on really taking the time to do while i'm in the building phase of the product

     

    Thanks

  14. just wanted to get your thoughts on my ajax setup.

     

     

    I have 20+ ajax calls that all lead to the same ajax file, defined by action... like:

     

    myAjax.php?action=delete

    myAjax.php?action=save

     

    The way the actions are decided upon is through one really big SWITCH statement with 20 cases. The file is now about 80kB. Performance is not a problem now, but theres not many users.

     

    Could that potentially become a big latency problem down the line, the fact that the file is 80kB (and thus the parser must run through all that code... a lot of it is raw html though)...

     

     

    thoughts?

    thanks

  15. I would like to make a script in which the user registers on my website. After that, my script would sign in the user on another website and check up some information from a particular .pdf file. And everytime something changes in this .pdf, it would send an email notifying the user.

     

    then build it?

     

    google for answers to SPECIFIC issues. when you get stuck, post that code/issues here.

     

    We will not build an application for you, sorry. You can hire someone to do this work for you, or you can attempt solutions and post issues here

  16. Well, really, you're limited to the information the client provides you. A.k.a - a bot could send a IE header, and you wouldn't know (using this method, at least).

     

    but anyways, a simple search reveals a quick solution:

    <?php
    if (preg_match('/slurp|inktomisearch|[Gg]rub|[bb]ot|archiver|[ss]qworm/', $_SERVER['HTTP_USER_AGENT']))
         echo "Is not a human";
    ?>
    

×
×
  • 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.