php

Just-In-Time Asset Packager

I'm developing a PHP application which uses Twig (but that's unimportant) as the view layer. This view layer has a custom extension which allows me to register both remote style and script assets as well as style and script inline blocks. The system holds on to these references until the page has completed rendering, placing all of the...

Web page text display problem.

I keep getting these weird text characters when I display user submitted text. like in the following example below. Is there a way I can fox this using PHP, CSS or something so that the characters are displayed properly? Here is the problem text. Problems of �real fonts� on the web. The one line summary: different browsers and dif...

Why is my database backup script not working in php?

I am using the Database Backup script by David Walsh(http://davidwalsh.name/backup-mysql-database-php) to backup my MYSQL database as a .sql file to my server. I created a user named backup and gave it all privileges(just to make sure). Then I put the code into a php file and setup a cron job to run the php file. This is the code: /* ...

How to know whether .pem file is correct or not

Hi There, I have created a .pem file to be used for Production push notification, and uploaded in server. But when sending push notification, it is giving error like this. $fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx); not working, return failed. what is this error, h...

Storing associative array in MySQL DB

Hello, I'd like to store associative array containg mostly strings and integers as values in db. I was thinking: implode/explode - need to find delimiter, which won't be in values - since it's almost user generated, not safe XML - feels to heavy for the job (creating/reading values) json - if i need only to work with json_decode/json...

PHP Based Web Crawler or JAVA Based Web Crawler

Hey i have some doubt about PHP based web crawlers,can it run like the java thread based one? i am asking it because, in java the thread can be executed again and again, i dont think, PHP have something like thread function, can you guys please say, which web crawler will be more use full?A PHP Based or A Java Based ...

How to use bcompiler and __FILE__ magic constant

I'm trying to compile some bits of a PHP application into bytecode. The code makes use of the magic constant __FILE__. infile.php: <?php echo dirname(__FILE__); squish.php: <?php $h = fopen('/tmp/pants/outfile.php', 'w'); bcompiler_write_header($h); bcompiler_write_file($h, '/tmp/trousers/infile.php'); bcompiler_write_footer($h); fc...

PHP new DOTNET() error

This is a fairly obscure question, but I'm having a devil of a time figuring it out: I'm running PHP on IIS and am using PHP's DOTNET function to load Microsoft's System.Speech class. <?php $recognizer= new DOTNET('System.Speech, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35', 'System.Speech'); ?> I'm getting a ...

MySQL Select, column with same name from multiple tables, order by another column with same name

I'm trying to select rows with a certain column name and order them by another column name. Here's my problem, into N simplified tables: table 1: id, username, datetime, comment table 2: id, username, datetime, vote . . . table N: id, username, datetime, bought I want to be able to select all rows where username='Some Name', ord...

How to graph these events pulled from the database over time?

I'm trying to plot data from a database over time. The data represents events taken by several entities (light bulbs). For example: Light A was turned on on July 10 12:00 it flickered at 13:45 flickered again at 19:29 flickered again on July 11 2:00 then turned itself off on July 12 20:00 Lights B, C, and D all have similar patterns...

How can I extract the title and description of a TED.com video?

I have a project that I need to add many many videos, some of which are TED.com videos. Is there an easy way I can perform an AJAX, JSON, or cURL request to obtain this information? This information does not seem to be in the embed object. ...

Undefined offset

$query = "SELECT COUNT(t.id), SUM(t.num_replies) FROM threads AS t WHERE t.forum_id=$forum_id"; $result = mysql_query($query); list($num_threads, $num_posts) = mysql_fetch_assoc($result); Equals: Notice: Undefined offset: 1 in C:\wamp\www\includes\functions.php on line 11 Notice: Undefined offset: 0 in C:\wamp\www\includes\functions...

Memcache: Why can't I get a query result

It works when I save a simple string. When I save a query result it returns true but I can't read it from the cache anymore. Here is my code: $cachekey=md5('mqv_'.$connections[$ccn][5].mysql_result($r,$u,'Tablechoice').$e1.$e2.$e3.$e4.$_SESSION["auszug1"].$_SESSION["per_page1"]); if($rv = $memcache->get($cachekey)){ $cachemsg="da...

run php script concurrently

I'm trying to use a script to process a lot of dta records, let's name it process.php, the problem is that I have a huge data set, to make the job done faster, I want to run multiple instances of this script with /usr/bin/php process.php start_record end_record & so I'll have them running in parallel like /usr/bin/php process...

Check Sessions in an array ?

hmm i got a homework, its 2 hours and i still have no clue on it :| like this $sessions['lefthand'] = 'apple'; $sessions['righthand'] = ''; $sessions['head'] = 'hat'; $sessions['cloth'] = ''; $sessions['pants'] = ''; // here is the homework function CheckSession('lefthand,righthand,head,cloth,pants'); we have some string "lefthand,r...

WHats the most efficient way to store profile images for a social networking website?

Hi guys, I've built up a simple social network and have given users the ability to upload profile photographs. The thing is that I've set it up so that upon upload the picture is resized to two sizes which are used in my website design. However the client requires a design change after a while. The new design thought up requires a differ...

Tracking function instances

OK so is there a way in php do track function calls such as function Tracker($name,$returnedValue,$file,$line) { echo $name . '() was called and returned a ' . typeof(returnedValue); } function test(){} test(); The reason for this is to send a custom framework data type back so another example would be $resource = fopen('php://s...

Is it possible to send parameters by using Header function ?

I load Flash file using PHP. test.php : $widget = WidgetFactory::getInstanceByHash($_GET['hash']); $file = $widget->getUrl(); $_GET['param1'] = "97df5ea7342b7e55b7ef3d402b585d1a"; header("Content-Type: application/x-shockwave-flash"); readfile($file); The url of $file is for example : "http://adresse/component1.swf?param1=XXX"...

Why am I getting 'access denied for user' error in php?

I am running this code: include '../includes/connection.php'; $conn = dbConnect('backup'); $tableName = 'orders'; $backupFile = '../backup/db-backup(' . $date . ').sql'; $query = "SELECT * INTO OUTFILE '$backupFile' FROM $tableName"; $result = $conn->query($query) or die(mysqli_error($conn)); I am getting this error: Access...

Google Docs API list of documents and two folders with same name

I use PHP to get a list of folders, and then documents from Google Docs (two API requests). Getting a list of the folders, I can get their folderID, which is fine. However, when getting a list of documents, it returns categories, and these only contain the name of the folder. My problem exists because I have two folders with the same ...