Jump to content

unemployment

Members
  • Posts

    746
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

unemployment's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. I can't figure out how to optimize my Zend framework performance. My query executes in 200ms but my page is taking almost 60 seconds to load. While checking the zend toolbar it shows that my page size is 14mb and I don't know why. The routes and options size is really large but I don't know what is causing this. Any ideas? To see the full breakdown: http://awesomescreenshot.com/0c73vewycc
  2. Thanks for the response. Regardless of programming language do you know of anything that provides real video editing features? Surely there must be some way of doing this in code.
  3. Do you know of a way in php to do multitrack video editing? The only tool I have found online is a MltMelt, which is a command line utility. I'm in the process of making an app that merges multiple videos, photos and audio clips into one video, but I was wondering if there was a way to process this in php. Can anyone point me to a PHP library that can handle things like multitrack merging, transitions, color effects, blurring, etc? I'm looking for adobe premier like features in code.
  4. I'm in the process of converting images from external websites references to images stored in my amazon S3 account. I'm running a script to do the conversion for the images I need, however the script continues to break with this error message: E_WARNING: imagecreatefromjpeg(http://www.site.org/Ansichtskarten.images/I/AK04659a.jpg): failed to open stream: Connection timed out Is there anyway I can have the script just continue running even if there is an error? Restarting the script is frustrating and counterproductive. Script: <?php ini_set('memory_limit','2048M'); ini_set('max_execution_time', 30000000); ini_set("user_agent", 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9'); ini_set('gd.jpeg_ignore_warning', 1); $cron = true; include('init.inc.php'); $query = 'SELECT * FROM city_images WHERE city_id > 0 ORDER BY city_id'; $city_images = sql::q($query); //var_dump($cities); die; while ($row = sql::f_assoc($city_images)) { //var_dump($row); $city_id = $row['city_id']; $image = image::resize_upload_amazon_new($row['image'], $row['city_id']); if(!is_array($image)){ $sql = "INSERT INTO `city_images_new` (`city_id`, `image`) VALUES ('{$city_id}', '{$image}')"; sql::q($sql); } //var_dump($image); die; } //die; echo PHP_EOL . "Images converted succesfully"; die; ?>
  5. I have a running chat application in my website. It is implemented using websockets, php and is working fine. The problem is whenever i send a message to single user it broadcasts that message to all users currently connected to my website. It will be really helpful if someone can tell me how to get the unique id of each user when someone connects to our app. If i can get the userid of the current logged in chat user that would solve my problem but i am unable to retrieve that userid when the user connects (open state of websocket). I can get the userid when the connection is made but I need the userid before the connection happens. When the connecation occurs it assigns its own ids to the connected users in a serial manner(1,2,3..,n). <?php // prevent the server from timing out set_time_limit(0); // include the web sockets server script (the server is started at the far bottom of this file) require 'class.PHPWebSocket.php'; // when a client sends data to the server function wsOnMessage($clientID, $message, $messageLength, $binary) { global $Server; $ip = long2ip( $Server->wsClients[$clientID][6] ); // check if message length is 0 if ($messageLength == 0) { $Server->wsClose($clientID); return; } //Send the message to everyone but the person who said it foreach ( $Server->wsClients as $id => $client ) if ( $id != $clientID ) $Server->wsSend($id, "Visitor $clientID ($ip) said "$message""); } // when a client connects function wsOnOpen($clientID) { global $Server; $ip = long2ip( $Server->wsClients[$clientID][6] ); $Server->log( "$ip ($clientID) has connected." ); //Send a join notice to everyone but the person who joined foreach ( $Server->wsClients as $id => $client ) if ( $id != $clientID ) $Server->wsSend($id, "Visitor $clientID ($ip) has joined the room."); } // when a client closes or lost connection function wsOnClose($clientID, $status) { global $Server; $ip = long2ip( $Server->wsClients[$clientID][6] ); $Server->log( "$ip ($clientID) has disconnected." ); //Send a user left notice to everyone in the room foreach ( $Server->wsClients as $id => $client ) $Server->wsSend($id, "Visitor $clientID ($ip) has left the room."); } // start the server $Server = new PHPWebSocket(); $Server->bind('message', 'wsOnMessage'); $Server->bind('open', 'wsOnOpen'); $Server->bind('close', 'wsOnClose'); // for other computers to connect, you will probably need to change this to your LAN IP or external IP, // alternatively use: gethostbyaddr(gethostbyname($_SERVER['SERVER_NAME'])) $Server->wsStartServer('127.0.0.1', 9300); ?> <!doctype html> <html> <head> <meta charset='UTF-8' /> <style> input, textarea {border:1px solid #CCC;margin:0px;padding:0px} #body {max-width:800px;margin:auto} #log {width:100%;height:400px} #message {width:100%;line-height:20px} </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script src="fancywebsocket.js"></script> <script> var Server; function log( text ) { $log = $('#log'); //Add text to log $log.append(($log.val()?"n":'')+text); //Autoscroll $log[0].scrollTop = $log[0].scrollHeight - $log[0].clientHeight; } function send( text ) { Server.send( 'message', text ); } $(document).ready(function() { log('Connecting...'); Server = new FancyWebSocket('ws://127.0.0.1:9300'); $('#message').keypress(function(e) { if ( e.keyCode == 13 && this.value ) { log( 'You: ' + this.value ); send( this.value ); $(this).val(''); } }); //Let the user know we're connected Server.bind('open', function() { log( "Connected." ); }); //OH NOES! Disconnection occurred. Server.bind('close', function( data ) { log( "Disconnected." ); }); //Log any messages sent from server Server.bind('message', function( payload ) { log( payload ); }); Server.connect(); }); </script> </head> <body> <div id='body'> <textarea id='log' name='log' readonly='readonly'></textarea><br/> <input type='text' id='message' name='message' /> </div> </body> </html>
  6. How do you do a simple path rewrite in .htaccess? I need my localhost/blog url to access the content located in localhost/assets/blog . How do I make this rule occur in htaccess? My full .htaccess code: <IfModule mod_rewrite.c> Options +FollowSymlinks -MultiViews RewriteEngine On </IfModule> RewriteCond %{HTTP_HOST} ^www.mysite.com$ [NC] RewriteRule ^(.*)$ http://mysite.com/$1 [R=301,L,S=4] # If requested resource exists as a file or directory, skip next three rules RewriteCond %{DOCUMENT_ROOT}/$1 -f [OR] RewriteCond %{DOCUMENT_ROOT}/$1 -d RewriteRule (.*) - [S=3] # Blog articles. # RewriteCond %{REQUEST_FILENAME} !-f # RewriteCond %{REQUEST_FILENAME} !-d # RewriteRule ^/?blog/([^/]+)/(\d+)/(\d+)$ blog.php?title=$1&id=$2&reply_to=$3 [L,S=1] # RewriteCond %{REQUEST_FILENAME} !-f # RewriteCond %{REQUEST_FILENAME} !-d # RewriteRule ^/?blog/([^/]+)/(\d+)$ blog.php?title=$1&id=$2 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(blog/.*)$ /assets/$1 [L,NC] # Remove the .php extension RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] # for copying #RewriteCond %{REQUEST_FILENAME} !-f #RewriteCond %{REQUEST_FILENAME} !-d #RewriteRule ^(.*)$ index.php?page=$1 [L] RewriteRule (.*)\.xml(.*) $1.php$2 [nocase] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ app.php?tag=$1 [QSA,L] # ---------------------------------------------------------------------- # Custom 404 page # ---------------------------------------------------------------------- # You can add custom pages to handle 500 or 403 pretty easily, if you like. ErrorDocument 403 /error.php?type=403 ErrorDocument 404 /error.php?type=404 ErrorDocument 500 /error.php?type=500
  7. I think I have an output buffering issue, but I don't understand it because in my php.ini file I have outbuffering = On . [05/08/2013 11:16:01] E_WARNING: Cannot modify header information - headers already sent by (output started at /admin.local.com/show.php:1) in /admin.local.com/assets/init.inc.php on line 178 In my init.inc.php file I have: <?php ob_start(); session_start(); date_default_timezone_set("America/New_York"); setlocale(LC_MONETARY, 'en_US.UTF-8'); header('Content-type: text/html; charset=UTF-8'); $timer_start = microtime(true); $path = dirname(__FILE__); function custom_error_handler($errno, $errstr, $errfile, $errline){ if (error_reporting() == 0){ return; } global $error_log_location; ob_end_clean();
  8. Thank you. Turning on output buffering solved the issue.
  9. MAMP is giving me the following error: E_WARNING: Cannot modify header information - headers already sent by (output started at /Users/jason/Sites/site.com/admin.site.com/show.php:1) in /Users/jason/Sites/trekeffect.com/admin.site.com/assets/init.inc.php on line 8 Do you know why this would happen? This is line 8 in init.inc.php: header('Content-type: text/html; charset=UTF-8'); This is line 1 of show.php <?php
  10. On my startups site you'll notice in the featured destinations section that I have destination images that have a fixed height and width set by using CSS. The problem is that my images do not maintain their proportion, yet I want them at this size and I want them to look good. How should I resolve this issue? Should I make sure that all images that are uploaded are cropped at the necessary ratio? If so, can I do this automatically using PHP so that I don't have to manually do it?
  11. When I run $dir = shell_exec('cd /var/www/trekeffect.com/trekeffect.com;pwd'); $this->log($dir); //chdir('/trekeffect.com/trekeffect.com'); //shell_exec('cd /var/www/trekeffect.com/trekeffect.com', $output); $test = shell_exec('pwd'); $this->log($test); It logs: 2013-04-12 14:36:36-04:00 --- INFO: /var/www/trekeffect.com/trekeffect.com 2013-04-12 14:36:36-04:00 --- INFO: /var/www/deploy It seems to be going back to the first deploy directory. Do you know why?
  12. That returned: /var/www/trekeffect.com/trekeffect.com Which seems correct, but for some reason my script still didn't take.
×
×
  • 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.