User Profile
Collapse
-
Thanks for trying to help me though. -
They could probably work something out.
That is the obvious solution, yes, but I was looking for an alternative way of doing this...
... Which Atli did provide.
Obviously you are an experience and indoctrinated programmer. I do not mean that as an insult, but sometimes old conventions need to be challenged.
///
...Leave a comment:
-
Thanks Markus but the problem lies in the “wrapping”, I don’t want to wrap the “chain” with try/catch,
I would like to have all necessary functionality embedded in the methods, in order to have a more “clean” and convenient code ;)
e.g.
...Code:$return=$this->database()->connect()->select_row(); $this->another_method_not_related_to_the_previous_method()->does_something_else();
Leave a comment:
-
Thanks for your further input!
Regarding,
“by the way some other language’s programmers look down at PHP, I don’t care. I can use something they don’t even have.”
and,
“Java uses overloading. C# uses overloading. These are mainstream languages. It's not that it's not 'standard', I just don't think you'be realized the different ways to achieve what you want - see my previous post.”
...Leave a comment:
-
I am not quite sure how to do this…
I never used exceptions, but I can’t see how the basic set up could be used for my problem.
e.g. (in class a)
But this still means z() needs to be evaluated… (i.e. the...Code:public function y(){ if(condition===true){ return $this; } else{ throw new Exception("false"); } }Leave a comment:
-
Oh my… I thought this thread died out ;)
Thank you all for your replies and input! :D
But the cookie goes to “Atli”, his example actually seems to do what I am looking for! :D
=============== =========
Yes, the main reason I want to do this is because of convenience ;)
But there are other uses as well?
E.g., if someone creates a class that extends the...Leave a comment:
-
Hi again!
Thanks for your reply, and your tips for an approach to this problem,
I'll look into this :DLeave a comment:
-
Yes, that is a correct observation, however, my assumption is based on that all methods in the class (e.g. x,z,q,w... ) are supposed to use the specific method (y)
i.e., a method x knows to call method y because it is not method y,
is that so unreasonable ;)
EDIT
To clarify: if one can create or set a constructor for methods,
then all methods will call the constructor (when...Leave a comment:
-
Ps...
"php4 syntax"? Are you referring to the fact I am not assigning a "ppr" type to my functions? (they are automatically set to public)
Because I can't see the difference in syntax which you are alluding...Leave a comment:
-
If you have a function that all your functions have to run, then it would be rather convenient instead of manually setting the function in all your functions, wouldn't it?
I am currently looking at the PHP manual (it is one's best friend ;)
But thanks anyway!Leave a comment:
-
Hi! thanks for your reply!
However, that was not exactly what I was thinking about,
what I am looking for is a way to make sure that method x(), without the need to manually call y() within x(), will access y(),
that is, the equivalent to doing this (where the entire class "y" is basically representing the method "y" in the previous example):
...Code:class y{Leave a comment:
-
chain methods, is it possible to break a chain?
Dear sir,
say, do you know if it is possible to "break" a method chain in php?
e.g.
...Code:class a{ function x(){ return $this; } function y(){ if(condition===true){ return $this; } else{ return false; } } function z(){ ... } $a=new -
"construct" in/for functions?
Hello,
I am wondering if it is possible to have something like "__construc t()" for functions/methods in PHP?
e.g.
...Code:class x{ function y(){ echo "foo"; } function x(){ echo "bar"; } } new $x; $x->x(); // should automatically also call y() before init x() -
This is so embarrassing...
I was giving the wrong path to the file... *blushes*
It had nothing to do with encoding, but if anyone has a problem with that, have a look at: http://docs.python.org/dev/3.0/howto...code-filenames
Still, I would blame it Python, really it should give more informative error messages...
... And be able to make coffee...
You know what else would...Leave a comment:
-
open file with non-ascii path
Hi all,
I am trying to open a file that contains non-ascii characters in its file path,
e.g. "c:\path\<n on-ascii>.file"
I have found lots of information on the Internets
- unicode()
- # -*- coding: <encode type> -*-
- encode()/decode()
They correctly change characters to the output screen, but the "open()" function really don't give... -
Well... That went fast.
I searched for eval(), and looked in the manual, then I found "execfile() " which basically does what I want; opens file and makes all functions in that file available. (And It works, I invoked the function in file X in the main file :D
Are there any downsides of using this function (execfile())?Leave a comment:
-
Thanks for your replies!
tharden3
>"Isn't it a bit ironic that your profile name on this website is ManWithNoName?"
Yeah, and it's biting pretty hard ;)
Laharl
>"Any chance you can rename the file to something sane? That'd be the simplest solution here..."
I know... Preferably I would not want to name the file, but if python leaves me with no choice......Leave a comment:
-
Import function/module; with no name (ModuleWithNoName ;)
Hi!
I'm somewhat new to python (using 2.5 on w2k)
Currently I am trying to organize a structure for a project, and import all necessary files and so on.
Everything went fine until I tried to import a python file with no name (don't ask me why it has no name ;)
e.g.
root (the folder where the code is run from)
root/.py (the file)
Now, how can I load that file... -
ManWithNoName replied to two or more buttons in a form; keyboard enter/return activates which buttonin PHPCSS is good to go.
But what do you mean with "reload them with CSS" ???...Leave a comment:
-
I found the solution... And it had nothing to do with AJAX--go figure.
http://domscripting.com/blog/display/99
It seems that there is a[nother] bug in IE regarding how it handles innerHTML.
You got to love the irony: one of the most popular self-defined functions created by Microsoft which they themselves can't implement properly.
Anyway, I appreciate the time you put down in trying to...Leave a comment:
No activity results to display
Show More
Leave a comment: