Jump to content

smoseley

Members
  • Posts

    433
  • Joined

  • Last visited

Posts posted by smoseley

  1. The OP's request has nothing to do about an AJAX solution. His request was about how to handle the dynamic number of tasks. AJAX does not, in and of itself, solve the question. It does work around some of the problems since the user would not be submitting the entire form. But, it adds complexity that is not needed and doesn't really help the OP in gaining better understanding of the basic logic that could be implemented.

     

    Maybe I misunderstood the request. I don't find that my suggestion was overly complex, though. AJAX isn't as difficult as people make it out to be.

     

    As for HTML standards, I use single quotes a lot due to the ease of implementing them in double quotes echo statements (but I do prefer double quotes). But, I would highly suggest the OP stop using the FONT tags which have been deprecated for over a decade now.

     

    I stopped using double-quotes to echo HTML for the reason of being difficult to generate conventional double-quoted HTML, though I still do on occasion.

     

    My suggestions for echoing HTML, in order of preference (considering performance, and clarity of code):

     

    
    
    // 1 - Concatenated single-quoted text, for high performance in an HTML-generating loop
    echo '<div id="element">' . $dynamicContent . '</div>';
    
    // 2 - Heredoc for multi-lined HTML
    echo <<<HTML
    <div id="element1">{$dynamicContent}</div>
    <div id="element2">{$dynamicContent}</div>
    <div id="element3">{$dynamicContent}</div>
    HTML;
    
    // 3 - HTML blocks with PHP echo short-tags for templating
    ?>
    <div id="element"><?=$dynamicContent?></div>
    <?php
    
    // 4 - Double-quotes with escaped double-quoted HTML, if you absolutely insist on double-quoted text in PHP
    echo "<div id=\"element\">{$dynamicContent}</div>";
    

  2. No one will be changing my code, when did I even talk about my code? You have chosen to make this unnessiceraly personal - and so be it - when all I asked was that you justify your statement.

     

    A lot gets lost in translation on a forum... I didn't mean to make this personal. You did mention your code... you said when you do it, it passes W3C validation. I simply meant to respond to that and state the facts as I understand them.

     

    There was no emotion in my post. There was no opinion. There was only fact. The fact is that it's a W3C recommendation to use double-quotes, and a common convention in every major web development shop in the world (that I'm aware of) to do so.

     

    Hope you understand I'm just trying to share my experience and help.

     

    Cheers.

  3. really? do please justify that statement if you will, especialy in refference to html generated through the use of php echo's, because every time I have used it - it's passed the w3c validation without a single problem.

    Single quotes are valid markup, but it's a w3c recommendation to use double-quotes, as some SGML parsers don't recognize single-quotes. It's also a standard convention in every development team I've ever worked in over the last 15 years to use double-quotes for HTML, and single-quotes for JS. If you want to do it backwards, go for it... but other coders will hate you and refactor your code so it fits conventions.

     

    Also, the OP didn't say anthing what so ever about needing or wanting ajax functionality so where did you get that idea?

    If you actually read what the OP wants his application to do, he wants AJAX, whether or not he specifically asked for it by name. He wants it to "dynamically update the row when the box is checked." What was your interpretation of that?

  4. What you want is a simple AJAX update method. Easy enough to do.

     

    Change your input to this (I'm assuming your primary key is called "id"):

     

    <input type="checkbox" name="tasks[]" value="<?=$toq4p['id']?>" onclick="toggle(this)" />
    

     

    (PS - always use double-quotes for HTML attributes... single-quoted HTML is a big no-no)

     

    Then add this javascript: (requires jQuery)

     

    function toggle(input) {
    input = $(input);
    $.ajax('/update_task_todo.php?id=' + input.value + '&todo=' + (input.checked ? 1 : 0));
    }
    

     

    Then create the php script (update_task_todo.php) to update the record based on the id.

     

    <?php
    $id = (int) $_GET['id'];;
    $todo = (int) $_GET['todo'];
    $sql = "UPDATE tasks SET todo = {$todo} WHERE id = {$id}"
    mysql_query($sql);
    echo mysql_rows_affected();;;
    

  5. yes, obviously XSLT was used to transform into HTML, that's how web pages are made. We used XML so that we could build pages using SimpleXML and so all our documents would be well-formed. XHTML would have been just as good, really, but there were other side benefits, like firefox opening up our source documents as traversable trees instead of pages.

     

    Gotcha. Misunderstood what you were saying (seemed like you thought there was no HTML involved). So you did this in PHP? Did you use Sablotron to do server-side transformation for browsers that don't support XSL-T?

  6. HAML seems cool I have to say.

     

    Seems pointless to me. It's like CoffeeScript, or Hibernate, or any ORM in existence. Abstraction of a common language for the sole purpose of making it "pretty" does 2 things:

     

    1. it requires developers in your group to double their knowledge-base, and

    2. it slows down a) deployment time, or b ) website speed

     

    EDIT: 3) It makes debugging a pain in the arse... because you have to manually map out the error in your translated code to the actual line of code that generated it.

  7. My previous company actually did all their markup through XML and XSLT. No "HTML" on the entire site, it was all translated by the XSLTs, mostly automatically by the generic "translate page" function.

     

    I'm assuming you didn't have your hands in the development of the XSL-T and aren't completely familiar with how it works.

     

    XSL-T transforms XML into another format. Very commonly, it's used as a templating scheme to transform XML into HTML, which is likely what your previous employer was doing.

  8. Given your original architecture, grep would probably be the fastest way to do what you want:

     

    Something like:

    $name = $_GET["name"];
    exec("grep '{$name}' /path/to/json/files/*.json", $result);
    foreach ($result as $line) {
      $filename = substr($line, 0, strpos($line, ':'));
    }
    

     

    However, I agree that a database is the way to go. You have enough data to justify it.

  9. SELECT

    tcs.tutor_id,

    tcs.category_id,

    tcs.subject_id,

    GROUP_CONCAT(s.subjects SEPARATOR ',') AS subjects,

    t.tutor_name,

    t.tutor_code

    FROM tutor_category_subject as tcs

    INNER JOIN subject AS s ON tcs.subject_id = s.subject_id

    INNER JOIN tutors AS t ON tcs.tutor_id = t.tutor_id

    WHERE s.subjects LIKE '%business%'

    GROUP BY tcs.tutor_id;

  10. AJAX.

    Helpful... ::)

     

    If you don't know anything about ajax, we can't teach you from the ground up.

    Why not? It's not a complicated thing he's asking for, and AJAX is a pretty simple concept...

     

    Your html page (requires jQuery):

    <input type="checkbox" id="checkbox_id" />
    <script type="text/javascript">
    $('#checkbox_id').change(function(box) {
       $.ajax('/update_session.php?checked=' + (box.attr('checked') ? 1 : 0) );
    });
    </script>
    

     

    update_session.php

     

    session_start();
    $_SESSION['box_checked'] = $_GET['checked'] ? 1 : 0;
    

  11. It's just bad business, all the way around.  The lottery is called an 'idiot tax' for a reason.

    Completely unfair for you to relate entrepreneurship to gambling.  "Idiot tax" is borderline offensive.  My 2 cents.

    Why?  Most small businesses fail

    ...

    Creating a new business is always a gamble.

    True enough, yet a 33% success rate over 10 years doesn't nearly equate to "lottery' or "idiot tax".  Your previous post implies that anyone starting a business venture is a hopeless fool who is destined to fail.  In other words, you waaaaayyy overstated your case.

     

    For me and my business, hooking my wagon to someone else's idea just doesn't make any sense.

    That may work for you, but there are 7 billion people on this planet, all different.  Most are not "idea people", so "hitching their wagon to others' ideas" is not a bad prospect. 

     

    Anecdote: A friend of mine built the software for someone else's company about 8 years ago, for a measly 25% of the company.  A year later, he left his job as a programmer at FedEx, taking a pay cut to work on it full time.  After 4 years, it was paying him a 6 figure salary.  2 months ago, they sold the business, and he cashed out for 7 figures.  Not a bad prospect.  Goes to show it works out for some.

  12. Yeah its pretty interesting offer, its a foursome; they got a good front-end guy, a finance prof., some serious marketing dude and me a back end guy; deal is 5 shares per year on a 5 year cliff.  Idea is sound.  Been tested to pretty awesome results.  What would you do?

     

    Doesn't sound too interesting to me.  I'm assuming there are 100 outstanding shares, and so after 5 years you'll be a 25% partner?

     

    Definitely sounds like they're trying to take advantage.  What exactly have the other 3 guys contributed so far that your share requires 5 years of slavery to acquire? 

     

    If they're structuring it as options, you should draw a salary during the 5 years.  I'm assuming they each draw a salary already?  By the way, sounds like a 1 year cliff... 5 year vesting period.

  13. No, not every partnership is worthless.  However, equity is often used by people to shift risk onto someone else.  Yeah, if a project succeeds, everyone makes money.  If it fails?  The developer bears the burden of a wasted effort.

    That all depends on the arrangement.  There are many ways to arrange an equity deal.  I've seen some crappy ones and some great ones. 

     

    Equity in addition or subsequent to payment is fine.  However, that's very rarely the case.  It's usually given in lieu of real money, which is a sucker's game.

    Equity without any payment is fine, as well.  Again, as long as the other parties in the venture are investing an equivalent effort and/or cash contribution.

     

    And, yeah, as a freelancer, I'm a mercenary by definition.  I don't see the wisdom in spending time (which directly equates to income) on something that will likely not succeed when I can, instead, spend that time on projects that are guaranteed to pay.

    Completely understood.  You're not an entrepreneur.  That's a completely acceptable attitude to have.... but....

     

    It's just bad business, all the way around.  The lottery is called an 'idiot tax' for a reason.

    Completely unfair for you to relate entrepreneurship to gambling.  "Idiot tax" is borderline offensive.  My 2 cents.

  14. Nope.  I subscribe to the "Fuck you, pay me" school of business.

     

    Well, it's a matter of mindset. 

     

    If you're a mercenary focused on immediate payout, then maybe the question isn't really directed at you?

     

    My interpretation is that the poster is an entrepreneurial individual interested in the possibility of equity in a venture, and is looking for advice to that end from like-minded developers.

     

    Your pessimistic outlook on joint ventures, while providing a good caveat, is a bit harsh, in my opinion.  Not every partnership opportunity is worthless.

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