How do I get this to not display when you first go to the page???
if ($error) {
echo "Error: $error<br/>";
}
if ($keycode) {
echo "Keycode: $keycode<br/>";
}
I'm writing a little homebrew ORM (academic interest). I'm trying to adhere to the TDD concept as a training exercise, and as part of that exercise I'm writing documentation for the API as I develop the class.
Case in point - I'm working on a classic "getCollection" type mapper class. I want it to be able to retrieve collections of asset X (let's say blog posts) for a specific user, and also collections based on an arbitrary array of numeric values. So - you might have a method like any one of these
$User = $UserMapper->load(1);
$ArticleCollection = $ArticleMapper->getCollection(range(10,20));
$ArticleCollection = $ArticleMapper->getCollection($User);
$ArticleCollection = $ArticleMapper->getCollection($User->getId());
So, in writing the documentation for the getCollection method - I want to declare the @param variable in the Docblock. Is it better to have a unique method for each argument type, or is it acceptable to have a method that delegates to the correct internal method/class based on argument type?
Hello,
I'm hoping somebody knows the answer :).
Within wordpress in the users section I would like to add a new row which will data pulled in from the Register Plus plugin.
Where would I need to create a new row?
My Example:
Username Name E-mail Role **Website** Posts
Admin Admin [email protected] Administrator google.com 2
Thanks.
Hello in my database date / time are stored in this format
2010-06-01T18:20:25+0000
I'd like to echo that out to time passed since that date / time
e.g.
2 minutes ago or 2 days ago
is this possible?
Every time I start apache , it always fails.
The problem is in loadmodulephp5...
The error log:[warn] pid file C:/windows/Apache2/logs/httpd.pid overwritten — Unclean shutdown of previous Apache run?
I tried to delete this file and then start apache.But this file had been created again.
Any solution?
In a function like this
function download($file_source, $file_target) {
$rh = fopen($file_source, 'rb');
$wh = fopen($file_target, 'wb');
if (!$rh || !$wh) {
return false;
}
while (!feof($rh)) {
if (fwrite($wh, fread($rh, 1024)) === FALSE) {
return false;
}
}
fclose($rh);
fclose($wh);
return true;
}
what is the best way to rewrite last few bytes of a file with my custom string?
Thanks!
When writing code errors, warnings and notices can occur. I know the idea behind errors. I suppose a warning is there to inform you about something that can cause an error, but isn't a notice exaclty the same? I suppose a notice is not a message of something doing right ;).
It's just a bit confusing to me. Can anybody tell the difference between those two and the way these messages should be treated.
Is it more efficient to use the key intersect or the value intersect if both key and value have the same contents for example:
Array
(
[743] => 743
[744] => 744
[745] => 745
[746] => 746
[747] => 747
[748] => 748
)
Is there any difference in performance in using one or the other with the same values. Similar to the difference of using double or single quotes?
$tagArray = array(
"apples" => 12,
"oranges" => 38,
"pears" => 10,
"mangos" => 24,
"grapes" => 18,
"bananas" => 56,
"watermelons" => 80,
"lemons" => 12,
"limes" => 12,
"pineapples" => 15,
"strawberries" => 20,
"coconuts" => 43,
"cherries" => 20,
"raspberries" => 8,
"peaches" => 25
);
and how i can do this in java, and how to calling for the first and second params?
My English is poor so I will make it short.
Right now, I have imzip.zip which has three txt files:
a.txt
b.txt
c.txt
When I try to load imzip.zip using:
http://pastebin.com/m1d974990
It loads the files alphabetically. In this case:
a.txt
b.txt
c.txt
However, I would like to be able to have the class load on different variables such as by size, date or simply random.
The problem is I have no idea how I would go about modifying the class to fit my needs.
I would really appreciate your help! :D
Been battling with this one for what seems, like forever.
I have an array:
$url_array
It contains this info:
Array (
[ppp] => Array (
[0] => stdClass Object (
[id] => 46660
[entity_id] => 0
[redirect_url] => http://www.google.com
[type] => Image
)
[1] => stdClass Object (
[id] => 52662
[entity_id] => 0
[pixel_redirect_url] => http://www.yahoo.com
[type] => Image
)
[2] => stdClass Object (
[id] => 53877
[entity_id] => 0
[redirect_url] => http://www.msn.com
[pixel_type] => Image
)
)
[total_count] => 3
)
I need to loop through it, and do things to each variable. I can get this to work:
foreach ($piggies_array as $key => $value) {
$id = $value[0]->id;
$redirect_url = $value[0]->redirect_url; }
Not unsurprisingly, it's only echoing the first value of those variables, but no matter what I try I cannot get it to loop through:
$value->redirect_url;
$value=>redirect_url;
I would appreciate any help.
I am trying to create a simple inventory request system. A user can enter multiple SKU's that will query the inventory database.
My problem is I am trying to do is associate these multiple queries into a type of list. This list can later be retrieved and contains all queries that were submitted simultaneously. When the list is filled it can then be deleted.
Is this possible? I am just looking to be pointed in the right direction.
Thanks
I wondered if I should write my code clean and readable or rather small and unreadable... Or should I write it readable and then compress it afterwards when I'm publishing it on the web?
Ps. I'm building a web app,
the faster, the better!
Thanks_
I have an eCommerce platform, and i wand to secure it. How can it be possible ?
I don't want to somebody copy my code. Like a license for 1 year with a code for activation. Or somethings like this. Sorry my English, thanks a lot!
I built many a website, and my own 'custom' framework is just a general box of scripts cobbled together with loose ideas. I would love to progress to a framework which allows me to pass it onto the client for freedom.
Someone suggested using wordpress but I'm not sure how general this can be.
A current site I need to build is a fancy kitchen company, price lists, flash gallery (with backend driven pics) and well designed home.
How could I bend the the will of wordpress? Alternatively, does anyone have a suggestion for an alternative.
Thanks in advance guys -
I have zlib and Zend Optimizer enabled on my server.
I have read about the
zlib.output_compression
directive. Are there any caveats with turning this directive on in my server?
Hi all - this is a bit of a newbie question but hoping I can get some guidance. I've been playing around with Eclipse for a couple months yet I'm still not completely comfortable with my setup and it seems like every time I install it to a new system I end up with different results.
What I'm hoping to achieve is (I think) fairly standard.
In my environment I'd like SVN (currently using Subclipse), FTP support (currently using Aptana plugin), debugging (going to use XDebug) and all the usual bells and whistles of development (code completion, refactoring, etc.)
My biggest current issue is how to set up my environment to support both a 'development' and 'production' server. Optimally I would be able to work directly against the dev server (Eclipse on my Vista desktop against the VM Ubuntu dev server) and then push to production server (shared hosting). I'd prefer to work directly against the dev server (with no local project files, just using the Connections provided by Aptana) but I'm guessing this won't allow for code-completoin or all the other bells and whistles provided for development. Any thoughts?
Kind of an open ended question, but maybe this could be an opportunity for some of you with a great deal of experience using Eclipse to describe your setups so people like me can get some insight into good ways to get set up.
Hello,
I want to loop the update statement, but it only loops once.
Here is the code I am using:
do {
mysql_select_db($database_ll, $ll);
$query_query= "update table set ex='$71[1]' where field='val'";
$query = mysql_query($query_query, $ll) or die(mysql_error());
$row_domain_all = mysql_fetch_assoc($query);
} while ($row_query = mysql_fetch_assoc($query));
Thanks
Jean
I designed my code to put all important functions in a single PHP file that's now 1800 lines long.
I call it in other PHP files--AJAX processors, for example--with a simple "require_once("codeBank.php")".
I'm discovering that it takes about 10 seconds to load up all those functions, even though I have nothing more than a few global arrays and a bunch of other functions involved. The main AJAX processor code, for example, is taking 8 seconds just to do a simple syntax verification (whose operational function is stored in codeBank.php).
When I comment out the require_once, my AJAX response time speeds up from 10sec to 40ms, so it's pretty clear that PHP's trying to do something with those 1800 lines of functions. That's even with APC installed, which is surprising.
What should I do to get my code speed back to the sub-100ms level? Am I failing to get the cache's benefit somehow? Do I need to cut that single function bank file into different pieces? Are there other subtle things that I could be doing to screw up my response time?
Or barring all that, what are some tools to dig further into which PHP operations are hitting speed bumps?
Within the following code, $quiz_object->personalities contains an array of Personality() objects.
// Loop through each personality that exists for the quiz
foreach($quiz_object->personalities AS $existing_personality)
{
// Show all of the existing personalities
echo $existing_personality->GetQuizMakerPersonalityHTML();
}
How do I "cast" (I think that's the right word) my variable $existing_personality within the foreach loop as the object type?
I wish to do this so that when I type $existing_personality->, I get the list of public functions available for that object type.
At the moment, Zend doesn't know that it refers to a Personality object within the loop.
I have two strings:
$first = '/this/is/a/string';
$second = '/this/:param1/a/:param2';
And I'm trying to get this:
$params = array('param1' => 'is', 'param2' => 'string');
But getting from point a to b is proving more than my tired brain can handle at the moment.
Anything starting with a ':' in the second string defines a variable name/position. There can be any number of variables in $second which need to be extracted from $first. Segments are separated by a '/'.
Thanks.
Hi all,
I have a report page that deals with ~700k records from a database table. I can display this on a webpage using paging to break up the results. However, my export to PDF/CSV functions rely on processing the entire data set at once and I'm hitting my 256MB memory limit at around 250k rows.
I don't feel comfortable increasing the memory limit and I haven't got the ability to use MySQL's save into outfile to just serve a pre-generated CSV. However, I can't really see a way of serving up large data sets with Drupal using something like:
$form = array();
$table_headers = array();
$table_rows = array();
$data = db_query("a query to get the whole dataset");
while ($row = db_fetch_object($data)) {
$table_rows[] = $row->some attribute;
}
$form['report'] = array('#value' => theme('table', $table_headers, $table_rows);
return $form;
Is there a way of getting around what is essentially appending to a giant array of arrays? At the moment I don't see how I can offer any meaningful report pages with Drupal due to this.
Thanks
I have a WCF webservice I can connect to it via basicHttp, but not wsHttp. I try to conenct to it via wshttp via the following:
$service = new SoapClient
("http://service.companyname.local:6666/Service/?wsdl",
array(
"location" => "http://service.companyname.local:6666/Service/WCF",
"trace" => true,
'soap_version' => SOAP_1_2
)
);
The call to the SoapClient constructor returns fine. When I try to call one using $client-FunctionName, the page just sits there loading for quite a while, and eventually returns the error "Error Fetching http headers". What exactly is this supposed to mean and how do I fix it? (Consuming the service from .Net client works perfectly.)
Hi, I'm trying to output lists of objects as json and would like to know if there's a way to make objects usable to json_encode? The code I've got looks something like
$related = $user->getRelatedUsers();
echo json_encode($related);
Right now, I'm just iterating through the array of users and individually exporting them into arrays for json_encode to turn into usable json for me. I've already tried making the objects iterable, but json_encode just seems to skip them anyway.