Jump to content

Ninjakreborn

Members
  • Posts

    3,922
  • Joined

  • Last visited

Everything posted by Ninjakreborn

  1. @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.
  2. Believe it or not in my entire career I have barely ever touched command line. I am starting to get interested in it. So here is my question. OpenSSH or Putty. Which one should I use as a tool of choice for anything Command Line Related (windows, Linus, Unix)? https://panel.dreamhost.com
  3. What's the fun in that. The fact that you know something they don't!
  4. Thanks for the link Thorpe. Will have a look. Haven't spoken with you in awhile, hope things are going well for you. Thanks again guys for the 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. Review this, http://dev.mysql.com/doc/refman/5.0/en/insert.html For the correct syntax on inserting into Mysql.
  10. Or this $rows = mysql_num_rows($result); if ($rows) { } So many ways to do one thing. :'(
  11. 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.
  12. viop03 - Your link didn't work. OP - http://designshack.co.uk/articles/php-articles/smart-file-type-detection-using-php/
  13. 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.
  14. 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).
  15. Please post all relevant code.
  16. 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.
  17. @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.
  18. You just disqualified yourself though, "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.
  19. 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.
  20. OK, I have done everything I can. About 3-4 days worth of banging my head against the wall. It's time to reach out for help..hopefully save myself some more headaches.. So a little run down. I have a client, who wants to get MLS data via RETS from a company. The rets "data" is being provided by a company called "MLSpin". I originally had tried tapping into their old API which failed miserably, then found out they had upgraded and were using RETS. So this is what I am trying to do. At first I did the most logical thing and hunted down and RETS class in PHP. I found a few that sucked, a few that were outdated, then finally found a decent one. http://troda.com/projects/phrets/index.php?title=Main_Page - This is the homepage to the RETS class that I found. I downloaded it and installed it on the server. I setup my configuration files, and got myself connected to my own database. Everything went find. Then I spent about a day replicating the database on their server. Using a combination of code from their samples and custom code, I was able to strip down every table SQL schema they have on their server and replicate it locally. Once that was out of the way I moved onto the next logical step...I started working on pulling over the data. The client first wanted me to get all backlogged data from 7-1-2010. From there until now, then set it up on a cron job to get it daily (get it at the end of each day (2 in the morning) for the previous day. No problem I thought..so I started working on setting this all up for the first field of data. He wanted me to get single family, multi family, and condominium. I first started with Single Family. After a lot of trial and error I got a decently working script...but it works sporadically...I have tried tons of different date formats. I have tried getting it for a single day, for a single month, for a few days. Sometimes it runs great sometimes it doesn't. I can't seem to get it to run consistently enough to get all the backlogged data, and certainly cannot get it to show the data from the past until now. I can't even get it to work properly for just yesterday.... Sometimes it throws a 505 error, sometimes a memory error, sometimes it works (not sure how often..just randomly). The INI file is here...http://www.benrealtygroup.com/info.php I had to fight with the host for a half a day to get more memory. I got the stats setup to give me as much memory and time as they allow during allocation....even with the extra memory it's having problems. What I want to do is get the data one month at a time from 7-1-2010 all the way until now. I want to do this for Single Family, Multi Family, and Condo....then I want to set it up on a cron so it just gets the last updated fields every day..that's it... I can't see to get this to work. Right now I was working on Single Family. Once I get all the backlogged data from it, I was going to set it up on the cron, and start working on multi family. http://www.benrealtygroup.com/beta/crons/mls.php Here is the script I am working on. Copied/Pasted below is the code I am using to implement the class and trying to get it to work. <?php /* GET MLS DATA ON CRON JOB */ // Required Files require_once('../config/config.inc.php'); require_once("../config/phprets.php"); // Connection Settings $rets_login_url = "###"; $rets_username = "###"; $rets_password = "###"; // Perform connection/setup class. $rets = new phRETS; $connect = $rets->Connect($rets_login_url, $rets_username, $rets_password); /* HANDLE SINGLE FAMILY */ $resource = "RESI"; $class = "SF"; //DATE IS Y-m-d $search = $rets->SearchQuery($resource, $class, "UPDATE_DATE=2010-07-01"); $table_name = 'rets_' . strtolower($resource) . '_' . strtolower($class); while ($listing = $rets->FetchRow($search)) { // Check if LIST_NO exists...if it does, delete it. $check = "SELECT * FROM " . $table_name . " WHERE LIST_NO = '" . $listing['LIST_NO'] . "'"; $query = mysql_query($check); if (mysql_num_rows($query)) { mysql_query("DELETE FROM " . $table_name . " WHERE LIST_NO = '" . $listing['LIST_NO'] . "'"); } $sql = "INSERT INTO " . $table_name; $data_var = ''; $data_val = ''; foreach($listing as $key=>$value) { $data_var .= mysql_real_escape_string($key) . ', '; $data_val .= "'" . mysql_real_escape_string($value) . "', "; } $data_var = substr($data_var, 0, -2); $data_val = substr($data_val, 0, -2); $sql .= ' (' . $data_var . ') VALUES (' . $data_val . ')'; if (mysql_query($sql)) { echo 'saved'; }else { echo 'not saved'; } } $rets->FreeResult($search); /* HANDLE MULTI FAMILY */ ?> I have verified that it saves the data. When I "am" able to get it to work...then I know the data saves... As mentioned before it either throws a 505 (most of the time), or runs out of memory (some times), or works (rarely). I can't tell what makes it work and what doesn't. I have tried all forms of dates..one time I even got an entire month with a lot of records to work. Any help on getting this wrapped up would be very grateful. This was around an 800 dollar job, but it's turning out to be very time consuming. Thanks again.
  21. Yes. I am working with something called "RETS" it's apparently the "standard" for real estate stuff. I am currently writing a script to get data from their server, to my clients. But it's turning out to be a pain. I can't seem to remember what the datetime format was suppose to be, and after searching online I am seeing 2-3 different things. The scripts work whether it's 1 day or 1 month, that's why I need to try to figure it out exactly before I start batch importing this stuff massively.
  22. $search = $rets->SearchQuery($resource, $class, "UPDATE_DATE=2010-03-02-2010-03-03"); I just want to make sure. It's been awhile since I messed with datetime. I am trying to get the date range of 1 months. So i want to get everything from the month of 2 to the month of 3. So everything from.. 1/1/2011 to 2/1/2011 I am having issues getting the date range correct. I am expecting UPDATE_DATE=2010-03-02-2010-03-03) to get everything from the 3rd of February up until the 3rd of March. Is this the correct format? Or is it the other way around.
  23. It's not doing me any good yet though. I was doing pretty good with C++, then realize I need to do Java to get any really good apps developed. Then I realized the process for loading them up was a pain. So I got pissed off a took a break from android development. Just messing around with desktop now.
  24. Teynon, not bad. You have a good head on your shoulders. I have been reading through your posts, as well as your resume. You know your stuff.
×
×
  • 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.