php

What about file-path-in-class-name convention?

What do you (especially PHP) guys think about a naming convention for classes in which the class name reflects the path to the file, related to the project directory? e.g: # /project/Session/Abstract.php # /project/Session/Database.php class Session_Database extends Session_Abstract ... I'm sure you get the idea. I'm also sure some o...

How to post JSON to PHP with curl

I may be way off base, but I've been trying all afternoon to run the curl post command in this recess PHP framework tutorial. What I don't understand is how is PHP supposed to interpret my POST, it always comes up as an empty array. curl -i -X POST -d '{"screencast":{"subject":"tools"}}' \ http://localhost:3570/index.php/traini...

How can I fix the ZF tool in the Zend Server for windows?

I just downloaded Zend Server Community Edition for windows and found that it did not include the ZF utility included in the tutorials. I downloaded and unzipped the Zend Framework(version 1.7.8, because version 1.8 would not download properly). This includes the zf.bat utility which is meant to generate the basic project files. Unfor...

PHP validate youtube script

I have a site that allows users to copy and paste the embeded video script that youtube provides and upload it to a database. I want to be able to check that this script is valid youtube script and not just random text that someone typed in. I believe this can be done with preg match. Any ideas? ...

how to create complex container in php

I'm creating a container type which has a lot of possible variations on what can be included: title bar search bar form bar tab bar custom bar info bar action/status bar content area Of these, only the content area is required. There are sub-types that would share common sets of bars, but they can also be mixed and matched in arbitra...

From PHP to Objective-C

Being a pretty experienced PHP developer, and having a fair knowledge of C (Wrote a distributed computing experiment with 16 of my Dad's NEC microcontrollers), I'd like to make the move to Objective-C and Cocoa, eventually aiming to integrate the Mac / iPhone apps with some of my PHP projects. Going through the "Cocoa Programming For Ma...

Debugging PHP

I've been using xdebug to debug and understand code in php projects for a while now, and have sometimes come into situations where it's been unclear what's going on inside of PHP. Is it possible to set xdebug or gdb up so that i can trace into actual php builtin functions? ...

PHP: MYSQL COUNT query with linked tables

I am looking for a cleaner way to do this. My code works, but I know it can be better. I have three tables: one with a list of Category Groups, One with a list of categories that are linked to category groups, and one with a list of news stories that are linked to the categories. I need to loop through all of the names of the Category G...

writing php functions

I am new to php and trying to write a login function. Bit stuck and getting the error. here my function: <?php if(!defined('_VALID_ACCESS')) die('direct access is not allowed.'); include('includes/connect.php'); function login($username, $password) { $username = trim($username); $password = trim($password); echo $username...

curl not working for getting a web page content, why?

Hi all i am using a curl script to go to a link and get its content for further manipulation. following is the link and curl script: <?php $url = 'http://criminaljustice.state.ny.us/cgi/internet/nsor/fortecgi?serviceName=WebNSOR&amp;amp;templateName=detail.htm&amp;amp;requestingHandler=WebNSORDetailHandler&amp;amp;ID=368343543'; //cur...

URL rewriting problem

i have made a website in php. There is a list of stories title stored in database and when user click any title among them then user is redirected to a page with a query string on it. like story.php?id=25 This means story with id 25 is now going to be displayed. Now i want to rewrite URL but when i rewrite it there occurs a problem. ...

Do you know any example about system tray application using air or flex?

I made one small application using flex . it is working correctly but i want that application icon show on system tray .how wiill i do for that ? i used if (NativeApplication.supportsSystemTrayIcon) { NativeApplication.nativeApplication.autoExit = false; icon.contentLoaderInfo.addEventListener(Event.COMPLETE, ...

Cakephp's auth component logs me out too quickly. Anyway to change this?

This is my first time on StackOverflow though I "read" Coding Horror quite often. Anyway... I'm working on a school/college project using CakePHP and I'm using the built in AuthComponent to support user Authentication (i.e. logging in, etc). My problem is that it logs me out after very short intervals. It doesn't even have me wait a f...

Create an Installer package for Installation on WAMP

I have developed a PHP web application, now I am thinking about deploying it on Windows. To ease my deployment, I plan to create an installer for it. This installer should do the following: Check for Pre-requisites such as Apache, MySQL etc, install them if they are not available Put the PHP application on Application folder, and in t...

php xpath - get last attribute

If some nong has accidentally entered the same attribute more than once in the same tag how do I select the last one??? (By default it seems to select the first... I'm not sure if this is how attribute hierarchy works in html?) Using the example below... Query: "./@href" Tag: Expected Result: "2.html" Result: "1.html" ...

php xpath - string functions on a attribute

What is the correct syntax for applying string functions (e.g. "normalize-space") on a attribute using the xpath query below? Query: "./@media" I've seen examples of this elsewhere but if I try it using php's xpath library it returns nothing... ...

php xpath - get only tag attributes/remove inner tag contents

How do I: Hide everything between between the head tags in xpath "/html/head" query? For example on "<html><head><title>some title</title>some text</head>..." will produce nodeValue = "some title some text" which is irrelevant because I just need the tag attributes and I don't need to add irrelevant data to my database. Hide all ch...

Need an algorithm to solve this problem

Here are the constraints I have three buckets (water) capacities 10 litre, 2 liters and 50 litres. I will be given another bucket of water from 0 to 100 litres I have to fill buckets in order 10 first, 2 next and 50 last. Anything extra can be disposed. How best can this be done with the least lines of code? while loop? ideas please...

Calling MySQL exe using PHP exec doesn't work

I have an extremely simple script with PHP exec, calling mysql command: $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'mypass'; $db = 'job'; $file ='job_create.sql'; $mySQLDir='"C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql"'; if ($dbpass != '') { $cmd = $mySQLDir.' -h '.$dbhost.' --user='.$dbuser.' -...

IE:"This.container" is null or not an object

Hi there! I have this error in IE7 not in Firefox3 it says "This.container" is null or not an object at line 77 of character 3 of php file. The line 77 is as follows: <input name="news_title_txt" type="text" class="fieldcell_" id="news_title_txt" size="50" ></td> ...