php

Building PECL extension on windows

I want to build an old version of APC on windows. They say (check the link) A DLL for this PECL extension is currently unavailable. See also the building on Windows section. but the guides referred are not available. Can you please suggest me a How-to? ...

What are helper classes and scripts?

In a lot of frameworks/AMS/CMS I see folders of "helper" scripts and classes. What exactly do helper scripts and classes do? What is their specific purpose. Is that defined by the developer or is their a standard for their function? ...

CakePHP ACL Setup Help

I have a database setup like this (I know it isnt the best setup but its out of my power to change it :-( Basically there are 3 levels of users - Admin - Managers - Staff Few notes: -Each member of staff belongs to department -If the Staffs logon_code appears in the manager table they are a Manager, otherwise they are a member of staff...

how to delete carriage returns in html using php?

Hi, I'm using a javascript function that receives some html code that was included using php. It is not html in a php string but an html file with .php extension. As the html code is sent as a parameter to the js function it can't contain carriage returns. The problem is that writing big blocks of html in a single line is terrible, I w...

Cosine similarity vs Hamming distance

Hello! To compute the similarity between two documents, I create a feature vector containing the term frequencies. But then, for the next step, I can't decide between "Cosine similarity" and "Hamming distance". My question: Do you have experience with these algorithms? Which one gives you better results? In addition to that: Could you...

NuSOAP: how to change content-type of request?

When consuming a .NET WCF webservice I get the following response (error): Unsupported HTTP response status 415 Cannot process the message because the content type 'text/xml; charset=UTF-8' was not the expected type 'application/soap+xml; charset=utf-8'. How do I change the content type? I can't find it in the NuSOAP forums/doc...

Delete operation in php using prototype js

I am using php / mysql and protype.js to delete record from a table. problem is that after deleting record from grid, grid is not updating automatically in template. This is my code: Step 1: index.php <?php require("Connection.php"); $sql = "SELECT * from tbluser"; $result=mysql_query($sql); ?> <html> <head> <script sr...

Encrypt part of HTML in PHP and decrypt in JavaScript

Hi, I'm looking for a way to encrypt a HTML form in PHP in a way so I can then decrypt it in the browser using JavaScript. This should work transparently to the user and JavaScript input validation must also work on the form (I know how to do this). When user submits the form, it must be encrypted again and sent to the server using an "...

What are the odds of GD or ImageMagick already being part of a client's PHP install?

I'm working on a package which includes rescaling of images in PHP. For image rescaling, PHP has the GD and ImageMagick libraries. Are those likely to be part of a given client's PHP install already? Is there a "default" install of PHP, for that matter? By default, are either GD or ImageMagick included? If neither is installed, should ...

One SQL query, or many in a loop?

I need to pull several rows from a table and process them in two ways: aggregated on a key row-by-row, sorted by the same key The table looks roughly like this: table ( key, string_data, numeric_data ) So I'm looking at two approaches to the function I'm writing. The first would pull the aggregate data with one query, an...

Adjust algorithm for generating random strength values

A few days ago, you helped me to find out an algorithm for generating random strength values in an online game (thx especially John Rasch). function getRandomStrength($quality) { $rand = mt_rand()/mt_getrandmax(); $value = round(pow(M_E, ($rand - 1.033) / -0.45), 1); return $value; } This function generates values between ...

How to check if user uploaded a file in PHP?

I do some form validation to ensure that the file a user uploaded is of the right type. But the upload is optional, so i want to skip the validation if he didn't upload anything and submitted the rest of the form. How can I check if he uploaded something or not? Will $_FILES['myflie']['size'] <=0 work? ...

How can I pass an argument from a web page that is loaded inside a web browser applet in a C# program, back to the C# application?

This is a probably a dumb question but here is what I've got. A web developer has a secure login page that after a user logs into it, a database reference is made and it grants rights to a particular PDF file on our network. There is desire to have a custom locally designed application used to present that PDF file to the user, which i...

How to implement Template Inheritance (like Django?) in PHP5

Is there an existing good example, or how should one approach creating a basic Template system (thinking MVC) that supports "Template Inheritance" in PHP5? For an example of what I define as Template Inheritance, refer to the Django (a Python framework for web development) Templates documentation: http://docs.djangoproject.com/en/dev/to...

Contact information web standard

Is the a standard which I can use for our contacts? I want to build an application which hosts our clients contact information. Is there a standard I should use so it is possible to sync with as many clients as possible? In Outlook I can find something about "LDAP" can you give any tutorials maybe? I would want to support 2 way syncing...

Converting very large decimal numbers to hexadecimal (1.67119535743*10^33)

I'm curious as to if it'd be possible to convert a very, very large decimal number such as 1.67119535743*10^33/1.67119535743E+33 to hexadecimal via PHP or C#. All my previous attempts have failed, unfortunately. Thanks to all in advance! ...

Plesk 9.01/Centos - how do I create a directory I can upload to via PHP?

How do I create a directory I can upload to via PHP in Plesk, considering all my PHP.INI file is correctly setup to allow uploads? Step by step instructions would be appreciated. ...

Custom foreach results for dynamic proxy class - magic methods?

I need to serialize a proxy class. The class uses __set and __get to store values in an array. I want the serialization to look like it is just a flat object. In other words, my class looks like: class Proxy { public $data = array(); public function __get($name) { return $data[$name] } } and I want a foreach ...

PHP (or other linux friendly) equivalent to .Net System.Xml.Linq

I've been working with the xml.linq classes in .net recently. But may need to use a linux friendly language for an upcoming project. The things I like the most are Xdocument, being able to load from a file or parse from a string XElement, quickly creating a custom structure for page specific data Traversing Children, Parents, Sib...

AJAX and how to best deal with it server side in PHP

Hi, I'm starting to write quite a few ajax heavy website, but I've never really read up on best practices and now that I want too I can't find an article that address what I want to know. What I really want to learn about is dealing with AJAX calls server side, things such as, should all data be passed back using JSON/XML,.. or is pure...