php

PHP to ASP.NET - call_user_func() equivalent?

I'm wondering if there is an equivalent function to PHP's call_user_func() in ASP.NET application. I'm looking to do a conversion from a PHP application to ASP.NET as a means of teaching myself the language, by taking a CMS I built professionally and trying to recreate it in this other language. The reason I need a function similar to t...

hyperlink on php

I'm working on a wordpress template and need to add a hyperlink to the cartoon bubble at the top of the page. The bubble, as far as I can tell, is php. Where do I insert the href? <h1><a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a></h1> The href should point to www.ojaivalleynews.com The blog url is www.ovnblog....

Converting a development team from FTP to a Versioning System

I work at a small LAMP Development Studio where the idea has been to just get the code done and go on to the next item on the list. The team works in Zend Studio 5.5 connected to the Live server via FTP or SFTP. What they love about this is the speed of their deployment of code (since its just modifying live code). But of course this i...

detect current tab

Is it possible to detect if a page is opened in 2 different browsers? I have built an small app, that stores some data in $_SESSION, and the problem is that when multiple tabs gets opened, the session vars gets overwritten (search filters in a search form) and so the tabs may display the same results for apparently different searches. ...

PHP Return from function in another file

Hi, I have a class called User with static function loginRequired(), which returns false if the user is logged in and true if the user is logged out. It also appends an error to an error class that I created that tells the person using the site that they must be logged in to view the content. The idea is that for the top of each functio...

Installing PHP extensions on shared hosting

I need to enable the mcrypt functions on my website, except I'm on a shared host (running linux) and obviously don't have access to the php.ini file. There does seem to be options for installing PEAR modules but a search told me mcrypt wasn't available. Is there any way I can do this, short of begging technical support to help me? Upd...

how can I make a text entry field

How can I make a text entry field that takes the input characters and displays it in another place, character by character as a the typest type them! ...

Drag and drop, editors

How can I make a drag and drop editor like the one in wufoo.com form editor ...

32 to 64 bit "Gotchas" in PHP

Last weekend I changed webhosts for my website. The host server I was on was a 32-bit OS and the one I moved to is 64-bit. Unexpectedly, some of my PHP scripts started giving incorrect results. In my case the << and >> (bit shift) operations were the culprit. I ended up having to mask the result with 0xFFFFFFFF and then changing the re...

Header page in PHP that takes the application directory into account

I am crash-learning PHP for a project, and I have a ton of stupid questions to make. The first is the following. I have a structure like this: index.php header.php images/ data data.php Now, the problem is that I want to include the header.php file in the data.php file. That is no problem. The problem I have is that header.php ...

PHP: Implementing the SeekableIterator interface...

I'm currently writing a class that implements the SeekableIterator interface and have run into a problem. I have two internal arrays that I am using and would like to allow for iteration through both of them from outside the class. Is there an easy way to do this without first merging the two arrays within the class? Here's a quick exam...

Simple secure way for Flash to MySQL Database

Any simple, but secure script available for Flash > MySQL DB integration? I need something for a Login DB. Exchanging variables with PHP is nice and easy, but obviously insecure. via Remoting? I've got the Flash 8 remoting components installed, and some ideas: idea-1, idea-2. via NetConnection? Got some leads: lead-1, lead-2. Cold Fu...

Are Web Operating Systems practical yet?

I'm a full time web developer but I have my roots as a desktop programmer and there seams to be a lot of talk about Web Operating System these days. Is it practical yet to incorporate your web applications into a Web OS to make it more user friendly or just do a traditional HTML layout? I found one that looks very interesting which is ...

Collect Lowest Numbers Algorithm

I'm looking for an algorithm (or PHP code, I suppose) to end up with the 10 lowest numbers from a group of numbers. I was thinking of making a ten item array, checking to see if the current number is lower than one of the numbers in the array, and if so, finding the highest number in the array and replacing it with the current number. ...

Finding characters in a string that occur only once

I'm writing an algorithm in PHP to solve a given Sudoku puzzle. I've set up a somewhat object-oriented implementation with two classes: a Square class for each individual tile on the 9x9 board, and a Sudoku class, which has a matrix of Squares to represent the board. The implementation of the algorithm I'm using is a sort of triple-tie...

Easiest way to alternate row colors in PHP/HTML?

Here's a PHP example of mine. Can anyone find a shorter/easier way to do this? <? foreach($posts as $post){?> <div class="<?=($c++%2==1)?‘odd’:NULL?>"> <?=$post?> </div> <? }?> <style> .odd{background-color:red;} </style> Examples in other languages would be fun to see as well. ...

How can I obtain the dimensions of a Flash video file from PHP code?

I have an application where users can upload video files of any size, and I'd like to be able to determine the the height/width of a Flash video file (flv or f4v) from a PHP script so that I can size the player appropriately. I'd love a pure PHP solution, but I'd be open to shelling out to a command line tool and parsing the output (if ...

Going where PHP parse_url() doesn't - Parsing only the domain

PHP's parse_url() has a host field, which includes the full host. I'm looking for the most reliable (and least costly) way to only return the domain and TLD. Given the examples: http://www.google.com/foo, parse_url() returns www.google.com for host http://www.google.co.uk/foo, parse_url() returns www.google.co.uk for host I am look...

Fastest way to retrieve a <title> in PHP

I'm doing a bookmarking-system and looking for the fastest (easiest) way to retrive a page 's title with PHP. It would be nice to have something like $title = page_title($url) Thanks in advance! =) ...

Long-lived connections (asynchronous server push) with Apache/PHP/Javascript?

I come from more of a Java background. In the last year or two, it's become somewhat popular to do server push over HTTP using long-lived HTTP connections in Comet. It's an extremely useful technique. So I'm curious what the equivalent is with Apache + PHP + Javascript? One option I see is just using straight AJAX calls (eg with jQue...