Jump to content

Ninjakreborn

Members
  • Posts

    3,922
  • Joined

  • Last visited

Posts posted by Ninjakreborn

  1. I am not sure. There are no errors. All I know is the application I am trying to use only accepts URL's that end with the image extensions.  However, you can change the URL to support other URL's. That is what I am trying to do The way I can tell it's not working is by testing it after testing the regular expression, and it's not recognizing the URL because it's not been setup as allowed.

  2. The format I need to check for is this:

    http://media.mlspin.com/photo.aspx?mls=70741856&n=1
    

    The code I am using right now is...

    	    $(document).ready(function(){
    
    	        $(".yoxview").yoxview({allowedUrls: /\/photo.aspx\?mls=(?:\d+)&n=(?:\d+)$/i});
    	    });
    

    It's not seeming to work. Any advice is appreciated. I am decent at regular expressions, but still getting the hang of it.

  3. Is there a way (in a Mysql Query) to only get zipcode results within a certain distance (Miles) of another zipcode?

     

    For example..if you were searching for zipcode 30082...and you wanted to get all results from the database that had zipcodes that were within 20 or 30 miles of the search zip code, is that possible.

  4. @premiso - thanks for feedback.

    @Crayon - Thanks...that's what I had figured. At first I thought it was different.  Didn't know they all did the same thing, just different features. Since I am use to putty, will stick to it.

    Thanks again for all feedback.

  5. Good, at least glad to hear someone agrees with me. I have seen so many frameworks use that ackward structure. I have always used the first method, but was curious what other people were using.  I find it easier

    to read, easier to write, and all around cleaner. Only reason I started getting curious because now even doing C++ whenever I use a codeblocks automatic project, it always formats in the second method, it's a pain.

    Thanks for the feedback. I was curious what other PHPFreaks users were doing as far as format was concerned.

     

    Only reason I was curious at all was every framework I have ever seen and their listed "coding practices" always showed the second. Was starting to think I was missing something.

  6. I have been programming for awhile. I have always had a specific style, but lately noticing with C++ and other languages it gets easier with another format....let me explain.

     

    DO you setup your brackets as below:

    function whatever () {
      // stuff
      if (whatever) {
        //whatever 
      }else if {
        // whatever
      }
    }
    

    Or:

    function whatever ()
    {
      if (whatever) 
      {
        //Whatever
      }else if
      {
        //Whatever
      }
    }
    

    I have always found the second one ugly, but in most third party systems (and frameworks for that matter) I see the second one.

     

    What is your personal style/preference, and why.

  7. Can you show us a test URL, of the live area you are working with, so I can play around with the results.

    Also where is the JSON coming from, can you copy/paste the code pertaining to the JSON generation.

  8. Ah your right.  I didn't scroll down to review your code more carefully.  A little later today I will review your code and see if I can provide feedback if no-one else has.

  9. Below is some code from one of my tools on Online Wasteland. It's not doing exactly what you mentioned, but you should be able to easily adapt the code to do what you need.

     

        <?php
    /* Function gets differences in seconds */
    function timeDiff($firstTime,$lastTime) {		
    	// perform subtraction to get the difference (in seconds) between times
    	$timeDiff=$lastTime-$firstTime;
    
    	// return the difference
    	return $timeDiff;
    }
    
    // Get first/second timestamps
    $first_timestamp = $this->input->post('first_timestamp');
    $second_timestamp = $this->input->post('second_timestamp');
    
    // Echo out their basic data
    echo '<p>The first timestamp \'' . $first_timestamp . '\' converts to ' . date('m/d/Y h:i:s A', $first_timestamp) . ' and the second timestamp \'' . $second_timestamp . '\' converts to ' . date('m/d/Y h:i:s A', $second_timestamp) . '.</p>';
    
    // Perform Conversion.  
    $seconds = timeDiff($first_timestamp, $second_timestamp);
    echo '<p>There are a total of ' . round($seconds) . ' seconds between Timestamp 1 and Timestamp 2.</p>';
    echo '<p>There are a total of ' . round($seconds / 60) . ' minutes between Timestamp 1 and Timestamp 2.</p>';
    echo '<p>There are a total of ' . round(($seconds / 60) / 1440) . ' days between Timestamp 1 and Timestamp 2.</p>';
    echo '<p>There are a total of ' . round((($seconds / 60) / 1440) / 7) . ' weeks between Timestamp 1 and Timestamp 2.</p>';
    echo '<p>There are a total of ' . round((((($seconds / 60) / 1440) / 7) / 30)) . ' months between Timestamp 1 and Timestamp 2.</p>';
    echo '<p>The total breakdown of time from Timestamp 1 to Timestamp 2 is ';
    $diff = $seconds;	
    $years   = floor($diff / (365*60*60*24)); 
    $months  = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); 
    $days    = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
    
    $hours   = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); 
    
    $minuts  = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); 
    
    $seconds = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minuts*60)); 
    echo $years . ' Years, ' . $months . ' Months, ' . $days . ' Days, ' . $hours . ' Hours, ' . $minuts . ' Minutes, and ' . $seconds . ' Seconds.</p>';
    ?>
    

    The code assumes it's in timestamp format. Just do the conversion to the date you want.  This code is also a little bloated, I wrote it in a hurry, I was

    planning on refining the utility later. But it should help you get the basic idea to help figure out what you need.

  10. You can use unset for this, but I don't recommend it.  You want to try to implement all of your permission systems in one place (either at the DB level, or at the PHP level in one place.  Makes it much easier later if you are trying to adjust permissions, insteadof having to hunt all over your code.  So perhaps setup permissions to only get the fields you need depending on certain criteria.

  11. The main thing to keep in mind with IP protection systems, is they are not entirely reliable (far from reliable).  They are good as a secondary procedure..For example..if you had a solid working login system as protection, and you put IP protection in as a "failsafe" that increases security without relying on IP...it just uses it as a backup plan.  Even Google for example..they keep IP tracking, and allow you to block users by IP but on top of that they have an extensively secured login system, and the 2 step verification (by choice).  Never rely on entirely IP..only put it in as a minor failsafe...adds extra security that you don't rely on, you just hope it catches things that get through your other systems (if they do).

  12. I think I figured it out. I posted in another forum for Google Groups related to that class, I was advised to raise my max_execution_time to around 300. I am going to try having client upgrade hosts, and see if I can get the execution time that high. If it doesn't work, will post back here. If anyone else has more feedback, feel free to let me know.

  13. @Dex, I agree entirely.  The reason they are telling you to wait isn't to stifle your learning, it's to learn on something not as sensetive. Your dealing with users personal payment information here. I certainly would not want to take a chance running a payment on someones custom implementation knowing they were not to that skill level. I would do some other stuff to "learn" and once you have the solid basics down, then start on something like this, once your more confident.

     

    Also you don't want to start learning something extremely complicated. That will burn you out. If you instead take on something a little complicated, and learn, then a little harder and learn...then you will learn faster. If you jump into something WAY above your skill level, then you get frustrated, burnt out, and learn a lot slower (believe me, I have tried in the past).

     

    When I first started learning C++ I tried to take on this really complicated desktop app...I failed miserably, and stopped working with C++ for months. Then I came back and started with simple command line stuff. Ever since I have been steadily getting better and better with it, and finally getting into desktop development without having to burn myself out.

     

    Just advice.  Good luck with whatever you do.

  14. You just disqualified yourself though,  :P

    "Starting today, Facebook will pay $500+ to anyone who exposes a vulnerability that could compromise user data. To qualify, you must be the first to report it and give them time to fix it before going public. [Facebook via TheNextWeb]"

    You went public.

     

    Just kidding.

  15. By the way. The host I am trying to do this on is Dreamhost.

     

    But...I also tried to port my code to HostGator (who I have always been using for most of my clients)....

    and for some reason I cannot even get it to connect to the MLS server in the first place at all.

     

    The Dreamhost (when it does work) always at least makes the initial connection...host gator doesn't even get a connection at all

    initially.

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