php

How to update a Ruby hash item inside of a loop over that hash?

I am migrating my PHP code to Ruby and at some point I need to update hash elements inside of a loop. For example: compositions.each_pair do |element,params| params['composition'].each_pair do |item,data| data['af'] /= params['af sum'] data['mf'] /= params['mass'] end end I could make it using item indexes, but it will be...

Magento: Image not found when I change the values passed into the resize() function.

if I change this: $this->helper('catalog/image')->init($_product, 'small_image')->resize(80, 80) to this: $this->helper('catalog/image')->init($_product, 'small_image')->resize(180, 180) The image cannot be found, does anyone know why this is? ...

How to parse HTML for minification in PHP?

I'm looking to write an algorithm to compress HTML output for a CMS I'm writing in PHP, written with the CodeIgniter framework. I was thinking of trying to remove whitespace between any angle brackets, except the <script>, <pre>, and <style> elements, and simply ignoring those elements for simplicity. I should clarify that this is whit...

PHP Template Engine

How can I improve the script below to be able to add global template parts such as start and end of the page? <?php class simpleTemplate { var $variables; var $variables_callback; var $contents; var $preg; var $regexps; // Constructor, initialize default variables functio...

PHP Pear Package - Pager on Awardspace Hosting Question?

Hi everyone! If you are using awardspace.com for free website hosting or have an idea does anyone know how to chnage the include path or my script hosted on awardspace such that...it can correctly display data using the pager.php package. Currently my script has this option set: :::PHP CODE::: include_once 'pager/Pager.php'; While ...

What IDE you using

Possible Duplicate: Any good PHP IDE, preferably free or cheap? Recently i change my windows to gentoo-linux. And don't know wich IDE change for web-dev. In windows i use PHPDesigner. Need autocomplete, projects and etc. ...

Web text editor that reads MSFTEdit generated text

Anybody know of a Rtf text editor that will display "MSFTEdit" formated text in a browser. (microsoft Msftedit 5.41.15.1515) I have tried various editors but they all show the formating character strings. ...

Why does this code print a result of '7'?

I recently start to learn PHP. <?php echo (int) ( (0.1+0.7) * 10 ); // prints '7', why not '8' ? ?> Please convince me of this type-conversion process. ...

converting tiff files to jpg from php

Hi, I am trying to convert a folder of tif files to jpeg so they can be displayed on my website. my current approach is not working. i wrote a perl script with #!/usr/bin/perl opendir(DIR, $ARGV[0]); @files = readdir(DIR); closedir(DIR); foreach $file (@files){ if($file =~ /(.*?)\.tif/){ print "converting $file\n"; `convert -au...

converting a C hashing function to PHP : ezmlm_hash

Hi, I'm trying to upgrade from PHP 5.2.x to 5.3.2 on my server. Problem is, I relying on the broken implementation of PHP's ezmlm_hash() (the bug is outlined here: http://bugs.php.net/bug.php?id=47969). My first thought was to rewrite the broken version of the native PHP function (which is written in C) myself in PHP and use that in my ...

[Magento] Location of tax calculation in source for Shopping Cart

Hi, can someone please tell me where the calculation of the amount of tax included in the total price of products is in Magento? Im looking at /app/code/core/Mage/Tax but don't know where to look at. Working with discounts calculates the tax wrong in version 1.4.0 and I desperately need help fixing this. Sadly the original magento fo...

processing $_POST in codeigniter

How do i do this in codeigniter? $cuisineArr = isset($_POST['cuisine']) ? $_POST['cuisine'] : array(); I read somewhere that using $_Post[''] direct is a not the right way and post() should be used instead. But how do i do the same in codeigniter? I'm getting an array from a group of checkbox, then converting it to csv. The non-codei...

Is it enough to check for customer existence in DB after IONCUBEing the script?

I'm about to release my script ,, But i want to make sure that i'm doing it the right way .. I'll IONCUBE the script to reserve my rights or use fopo.com.ar to obfuscate the script ( btw, what is your opinion about fopo , is is better than asking customers to install IONCUBE?) .. is it enough to call my website from within the script a...

cookies vs sessions for php application

Hi, what would be better when implementing a php login system sessions or cookies ? ...

need libary to ocr a printed page and create tab delimited file from it

I am generating a pdf for a client. This has two columns ... ID and a blank column for the end user to put in some character. I want the client to be able to upload a bmp/jpg/tif whatever (i can specify) image of the printed pdf with its two columns and turn it into a csv/tab/whatever file with the values of the two columns. Can anyone r...

extract stylesheets via regex

Yes, I know, I know, parsing HTML with regular expressions is very bad. But I am working with legacy code that is supposed to extract all link and style elements from a html page. I would change it and use the dom extension instead, but after the regex there is a huge code block which relies on the way preg_match_all returns the matched ...

find and replace keywords by hyperlinks in an html fragment, via php dom

I'm trying to use the simple_html_dom php class to create a find and replace function that looks for keywords and replace them by a link to a definition of the keyword, with the keyword as link text. How can i find and replace "Dexia" with <a href="info.php?tag=dexia">Dexia</a> using this class, inside a string such as <div><p>The CEO ...

many things in one query. is it possible?

I have three tables menus +--id---ident---+ |--1----menu_1--| menus_data +--id---id_parent---name---------id_lang--+ |--1----1-----------menu_eng------1-------| |--2----1-----------menu_rus------2-------| +--3----1-----------menu_arm------3-------+ languages +--id---name--------+ |--1----english-----| |--2----russian-----| |--3--...

how to restrict website access to a couple of web pages and ip address only, using htaccess.

Hello Using following Options +FollowSymlinks RewriteEngine on RewriteCond %{REQUEST_URI} !/temp_page.php$ RewriteCond %{REQUEST_URI} !/thanks.php$ RewriteCond %{REMOTE_HOST} !^90\.333\.222\.111 #RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1 RewriteRule $ /temp_page.php [R=302,L] can allow myself (ip) to view all pages, and other get...

Optimizing Magento-using Websites

Please be patient with my question, as this may be a bit longer. If you look at Magento and try to compare with any other non-PHP eCommerce Shopping Cart websites, you will find that the latter are comparatively faster. I know that the following factors work as well:- Hosting Server Bandwidth Magento offers lots & lots of features, ...