Jump to content

ballhogjoni

Members
  • Posts

    1,026
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

ballhogjoni's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. So i've always struggled with coding reports that have a lot of logic and calculations because the become very procedural and they become hard to debug and hard to add new features/calculations. What do you guys do when coding reports to make them easy to maintain and add new features?
  2. Hey @requinix, thanks for the reply. According to the docs you have property and function overloading...see docs. For me I don't see the need to do something like this property overloading: class A { $x = 123; } $var = new A(); $var->abc = 456;
  3. Hey guys, not sure if this is the correct place for this topic, but I was wondering why you would use overloading? I just haven't ever come across a need for it and if I have I haven't recognized it.
  4. Using PHP 5.3.3 The error points out this line of code: return [$a[$s], "string"]; $a = array(); $s = "test"; if (array_key_exists($s, $a)) return [$a[$s], "string"]; What's wrong with this code?
  5. I just installed mysql 5.1.73 on centos 6.7 and I get this error literally every time I hit enter. I've tried max_allowed_packet=500M and wait_timeout=28000 and restarting the server with neither helping. mysql> show databases; ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 1 Current database: *** NONE ***
  6. Thanks! This got me thinking and i went digging into code that was working for everything except for this one case that I wasn't handling. It was causing an infinite loop. I fixed that code and now all is good.
  7. So i thought it could be that I was running out of physical memory. I am running macbook with 8gb physical memory. With everything running, chrome, spotify, etc it was taking about 7.5gb of memory. I shutdown everything and it still didn't work.
  8. That's what I thought as well, but I don't get any errors and I set ini_set('memory_limit', '1024M'); So to double check the memory usage I ran memory_get_usage() and it was sitting at 585728
  9. I'm trying to write a new csv file using the data from a large 1.4gb csv file. The problem is that its not working with the code I have below. It just hangs up when the size of output (tempfile) reaches 848661. Any ideas? $file = "file.csv"; $file_number = 1; if (!$output = fopen($tempfile, 'w')) { unlink($tempfile); die('could not open temporary output file'); } $in_data = array(); $header = true; $row = 0; while (($data = fgetcsv($handle, 0, $delimiter)) !== FALSE) { if ($header) { $in_data[] = $headers; fputcsv($output, $headers, "\t"); $header = false; continue; } /* if ( ($row % 10) == 0 ){ error_log("sleeping on row: $row"); sleep(3); } error_log("checking row: $row"); */ if (!$val = getProductRow($data)) //this returns an array continue; $stat = fstat($output); error_log("Stat is: " . print_r($stat['size'],true)); if($stat['size'] > 9437184){ error_log("saving the $file"); fputcsv($output, $val, "\t"); error_log(__LINE__); fclose($output); error_log(__LINE__); if (file_exists($file)) unlink($file); error_log(__LINE__); rename($tempfile, $file); error_log(__LINE__); chmod($file, 0777); error_log(__LINE__); $final_file_name = $file = "file$file_number.csv"; error_log(__LINE__); $tempfile = tempnam(".", "tmp"); // produce a temporary file name, in the current directory error_log("creating the $file"); if (!$output = fopen($tempfile, 'w')) { error_log(__LINE__); unlink($tempfile); die('could not open temporary output file'); } error_log(__LINE__); fputcsv($output, $headers, "\t"); error_log(__LINE__); $file_number++; error_log(__LINE__); continue; } error_log(__LINE__); fputcsv($output, $val, "\t"); }
  10. Had to install this rpm ftp://195.220.108.108/linux/remi/enterprise/6/remi/x86_64/php-soap-5.4.27-1.el6.remi.x86_64.rpm by running this on the command line rpm -ivv ftp://195.220.108.108/linux/remi/enterprise/6/remi/x86_64/php-soap-5.4.27-1.el6.remi.x86_64.rpm then restarted apache.
  11. I am running PHP 5.4.27 and I'm running into this error. I tried to install php-soap via yum install php-soap but i got this error Error: Package: php-soap-5.3.3-27.el6_5.x86_64 (updates) Requires: php-common(x86-64) = 5.3.3-27.el6_5 Installed: php-common-5.4.27-1.el6.remi.x86_64 (@remi) php-common(x86-64) = 5.4.27-1.el6.remi Available: php-common-5.3.3-26.el6.x86_64 (base) php-common(x86-64) = 5.3.3-26.el6 Available: php-common-5.3.3-27.el6_5.x86_64 (updates) php-common(x86-64) = 5.3.3-27.el6_5 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest I think its because yum is trying to install an incompatible version of php-soap. Any ideas? Thanks
  12. I was using the array shorthand code "[]" but didn't realize my box was using php 5.3. I just upgrade to 5.4 and the script works now. I was expecting to get some error relating to the array shorthand code not being valid, maybe a syntax error.
  13. I'm trying to output errors to my log but it's not working. My apache config is as follows: <VirtualHost *:80> ServerName domain.com ServerAlias www.domain.us DocumentRoot /var/www/html/domain <Directory /var/www/html/domain> Options +Indexes +FollowSymLinks +ExecCGI DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> ErrorLog /var/log/domain_error_log </VirtualHost> At the top of my script I have: error_reporting(E_ALL); ini_set('display_errors', 1); I don't want errors on globally so my php.ini errors is set to off. When I go to the script in the browser I get a blank screen with no output to /var/log/domain_error_log. I feel I am missing something but don't know what it is.
×
×
  • 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.