Re: [PHP] climb up the path

2008-06-20 Thread Iv Ray

Jim Lucas wrote:
 Iv Ray wrote:
 Jim Lucas wrote:
 So, saying that it is outside the source does not tell me if it is
 outside the document root.

A, right.

It is outside the document root.

 Use your include_path php_ini setting

A, right...

Didn't think of it.

Actually, I do not like the include_path - it is too esoteric... - kind 
of a fog - I prefer to know where things I call come from :) - as it is 
said in Harry Potter - Never trust an object of magic if you do not 
know where it keep its brains. ;)


But thanks, anyway!

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] climb up the path

2008-06-20 Thread Iv Ray

Richard Heyes wrote:
i need a way to get the path to the parent folder of the folder i am 
in. one dirty way i found is this -


require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR .
 ..  . DIRECTORY_SEPARATOR .
 config.php);

i can also explode() and reassemble all folders except the last, but 
this looks also dirty...


is there a direct way?


There's nothing dirty about dirname(), and for your issue, just call it 
twice:


dirname(dirname(__FILE__));


I called dirty the .. in my example.

Yes, dirname(dirname(__FILE__)); is the way to go - I was just too 
brainwashed and did not think I can apply it to a directory, too.


Thanks,
Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Military Service WAS [PHP] Capitalization of variable

2008-06-20 Thread Iv Ray

Per Jessen wrote:

Call me .. uh no, I'm getting sick ... you guys are so completely and
utterly off-topic - please take it off-line.


It was obviously off-topic from the beginning,... however it felt 
somehow OK... - I mean, it gave the list a personal touch and every 
successful organization dreams of its people having a more personal touch.


I'd also hate it if the list goes greatly off-topic inflated, but, I 
think, I'd hate it exactly as much if it was a dry on-topic thing where 
nobody says anything personal. If we were not so divided in time and 
space, we would occasionally meet for a beer - for me the off-topic 
explosions are the digital equivalent of this.


Iv

--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] http response 200

2008-06-20 Thread Iv Ray

joaquinbordado wrote:
 'm a total newbie..i just want to know how can i display an http 
response 200


Don't have time to customize it for you, but that's how it can be done-

header(HTTP/1.0 404 Not Found);
/*
 *
 * I copied the DOCTYPE from what Apache 1.3.34 returns.
 *
 */
echo !DOCTYPE HTML PUBLIC \-//IETF//DTD HTML 2.0//EN\;
echo html;
echo head;
echo title404 Not Found/title;
echo /head;
echo body;
echo h1Not Found/h1;
echo pThe requested URL  . $_SERVER['REQUEST_URL'] . was not found 
on this server./p;

echo hr;

Note, that you must not have any output before sending header(). There 
is a way to check, write back, if interested how.


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] http response 200

2008-06-20 Thread Iv Ray

ryan gacusana wrote:

here is my code
when accessing this url
http://localhost/podcast/podcast.php?mobile=0823172message=2343443=%3Eryan 


This runs on your computer, I can't access it.


else
echo Message has been sent successfully.;
// in this part i want to respond with a status of 200,sorry i just 
started php last wik


Actually... If you print this text, the web server sends status 200 to 
the browser on its own accord. Or am I missing something.


The code I sent you sends custom 404 Not Found - in case you need that.

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] download file from an ajax request

2008-06-20 Thread Iv Ray

pere roca wrote:

hi everybody!

Hi!

is there some way to allow downloading a PHP generated file from an ajax
request?


No idea, but would love to hear if/how you solved it.
Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PDF inline viewer

2008-06-20 Thread Iv Ray

Mário Gamito wrote:

Hi,

Does someone knows of a PHP software that is an inline PDF reader ?
You can view the idea here:
http://www.scribd.com/doc/2025925/Clinical-chemistry-II-Biomedical-Science-practical-1

Any help would be appreciated.

Warm Regards,
Mário Gamito


What will happen if you open the PDF file in iframe? - then you will 
have all controls from the Acrobat Reader plug-in. Or do you need 
something more elaborate?


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] download file from an ajax request

2008-06-20 Thread Iv Ray

Eric Butera wrote:

The only thing I can think of is using JS to create some sort of
IFRAME, meta redirect, window.location, or a popup window, something
that will force the page to hit your download script directly.  I've
never attempted it myself so I'm not sure what sort of issues IE would
have with any of the above.


Well, if we, the illiterate, are going to brainstorm ;) - clicking a 
link/button/image executes JavaScript function, which (via AJAX request) 
hits the php download script. The response will be received by the AJAX 
object.


Nothing php here.

As far as I see the problem, it is - how to pass this response to the 
browser in an elegant way, so that the browser will open a Save as... 
dialogue and will direct the stream there.


One could ask this on a JavaScript/AJAX list.

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Discussion of method -- config files

2008-06-20 Thread Iv Ray

Al wrote:

I freely use defined constants for all fixed variables in my config file.

It insures they cannot be inadvertently reassigned by a function 
someplace and are available everywhere.


That's a good idea, I have been thinking about this.

Never thought they have global scope, though - a good reminder.


define('MYSQL_HOST',localhost);


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Military Service WAS [PHP] Capitalization of variable

2008-06-19 Thread Iv Ray

Dan Joseph wrote:

I guess the main problem is people don't realize that there are a LOT of
things you can do in the military other than just taking a gun out into the
field and firing at the enemy.  If you want people to believe that mandatory
service is a good thing, they have to do more to get that message out.


www.goarmy.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Discussion of method -- config files

2008-06-19 Thread Iv Ray

tedd wrote:

Hi gang:

More of a question of method rather than of right or wrong -- of the 
two methods mentioned here, which way would be better and why?


Initially I used to access global variables using the global keyword -

function foo()
 {
global $bar;
 }

However if the function code is a bit longer, it gets difficult to see 
if $bar is still actually used, after some revisions.


So I switched to using $GLOBALS. Inside $GLOBALS I store variables, 
arrays and initiated objects (for instance $DB, for database access) - 
which I call -


$GLOBALS[DB]-connect;

I do not consider it polluting - it is there to be used. If your code 
is part of something bigger, then you need a convention, and if you 
convention supports this method, it's all right.


For some reason I do not like the :: operator, it's visually too 
unstable :)


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Search like php.net's URL thingy

2008-06-18 Thread Iv Ray

Ryan S wrote:

Thanks for replying m8, but if you check the rest of the thread you will see 
this has alraedy been solved and the result is
http://ezee.se/ezeeurl.php?do=1

Cheers!
Ryan


How do you protect this thing from being spammed?

I do not know why somebody would spam it, but I have had all kind of 
forms being spammed - it seem there are people out there who find 
immense pleasure in spamming forms, regardless of the result.


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] CAD file decoding

2008-06-18 Thread Iv Ray

Lester Caine wrote:
 Has anybody seen any software that could be used with PHP to extract the
 preview pictures from CAD files such as DXF and the like. I'm looking to
 keep thumbnails of the drawings in much the same was as we generate
 thumbnails of images. So I can display a list of previews before
 downloading the whole file.

It seems DXF files can be accessed with JavaScript.

This sounds a bit peculiar to me, how big are these files?

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] climb up the path

2008-06-18 Thread Iv Ray

hi all,

i need a way to get the path to the parent folder of the folder i am in. 
one dirty way i found is this -


require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR .
 ..  . DIRECTORY_SEPARATOR .
 config.php);

i can also explode() and reassemble all folders except the last, but 
this looks also dirty...


is there a direct way?

iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] climb up the path

2008-06-18 Thread Iv Ray

James Dempster wrote:
 Personally I use.

 ?php require_once(dirname(dirname(__FILE__)).'/config.php');

 I think it's what most people do.

A... very interesting, thanks.

To get the path only I did this -

$path = dirname(__FILE__);
$parts= explode(DIRECTORY_SEPARATOR, $path);

array_pop($parts);

$INSTALL_PATH = implode(DIRECTORY_SEPARATOR, $parts);

It's kind of long...

If somebody has a better idea, I would be glad to hear.

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] climb up the path

2008-06-18 Thread Iv Ray

Stut wrote:

$path = dirname(dirname(__FILE__));

That will get you the parent directory.

-Stut


A,... right! - me and my limited thinking... - dirname() gives the 
parent of a file AND of a directory, right.


Thanks,
Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] climb up the path

2008-06-18 Thread Iv Ray

Jim Lucas wrote:

Iv,

tell me why you are wanting to do this?

If it is the reason I think it is, I can give you a better way to 
accomplish this.


I have the source and a configuration file, which I want outside the 
source - it is different from server to server.


The easiest is to have the configuration file one folder up.

In  the same time I want the source to work wherever it is placed.

So the source sees where it is, and climbs one directory up to read the 
configuration specific for this installation.


I do not want to use ignore in the repository, in order to prevent the 
configuration file from being overwritten.


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP connection to external application

2008-06-13 Thread Iv Ray

hce wrote:

Let me first describe the requirement more:

The C program is a major business server


I would not connect applications on low level.

I would think of a web services type of interface - http request and 
xml response (Steven suggested, for example, SOAP - but it does not need 
to be that complicated).


The has several benefits -

a) Clearly defined, the web services gate will not be affected by 
changes in the C program.


b) You can use the web services gate to plug not only your php 
application, but any other application that can (be made to) talk web 
services.


c) The implementation of the php application, in this case, will be 
trivial, resulting in cheaper developers/development/maintenance/expansion.



   (ii) What is the maximum number concurrent requests in a PHP web
application? Will the maximum socket number  / or port number (up to
2^16) be a bottleneck for large number of concurrent requests (hundred
and thousands)?


Nobody can tell you this for your existing infrastructure. The only 
thing you can do is try and optimize.


Iv

--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] UK PHP Host/Developer Required

2008-06-13 Thread Iv Ray
2. It's useful if the host company and the client keep the same office 
hours.


If you have a hosting company with 9 to 5 office hours, you are dead, 
even if it is next door.


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] class? package?

2008-06-13 Thread Iv Ray

Shelley wrote:

I am working on a sns site, and now my practice is grouping classes of a
function


classes of a function... perhaps classes related to certain 
functionality?



(i. e. subscription) together. When I need it, just load the package:
subscription.

Right? ;)


Hm... I do not know your project, but to have many classes just to 
handle subscription, sounds a bit too much to me. Why don't you have a 
class called subscription, which might even extend a class called 
person or user - the subscription class can have methods, for 
instance subscribe and unsubscribe, and because subscription 
extends person or user - it already knows who is the person/user.


And then, for example, to subscribe a person/user, you do -

$subscription-subscribe($list_id);

Other possible actions -

$subscription-un_subscribe($list_id);
$subscription-is_subscriber($list_id);
$subscription-lists();

etc.

This way class subscription packs the methods needed to handle 
subscription related activities, so in your own jargon, this class is 
a package.


Of course, if the subscription process is extremely complicated, you can 
have more classes.


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] UK PHP Host/Developer Required

2008-06-13 Thread Iv Ray

Robin Vickery wrote:

Out of hours technical support often gets billed at a punitive rate.
Which is a bugger if their out of hours is your working day.


It seems you haven't tried Rackspace (UK) yet.


And while you might get tech support out of hours, accounts and
billing usually keep normal office hours.


True.

But if you pay your bills on time, you will never talk to these.

Iv

PS I am NOT advocating that one should take hosting outside the UK. I do 
projects in Austria and I do have the hosting in the UK.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHPMailer not working but Squirell mail works

2008-06-13 Thread Iv Ray

Shiplu wrote:

In my web server, I cant send mail by PHPMailer.


What does this mean?

Do you get an error message, etc.?

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] class? package?

2008-06-12 Thread Iv Ray

Shelley wrote:

Probably you have noticed this:
The classes in a package are reused together. If you reuse one of the 
classes in a package, you reuse them all. 


If that's the case, then why not just use one class as one package?
What's the point of splitting a package into several classes? :-(


I think somebody already answered.

It is actually up to you.

My grandmother used to write letters starting with a capital letter, 
writing the whole letter as one long sentence and ending with a dot. 
This would perhaps confuse most high school teachers, but in her case it 
somehow worked :)


If we take this worn out example - if you have a class dog and a class 
cat - it becomes quite clear why you need several classes. You can put 
them in a package called animals - but as other people already noted, 
the packages in php have only a symbolic role, just for clarity of 
code organization.


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Bulk Email Problems

2008-06-10 Thread Iv Ray

Hi Andre,

I am not sure I understand what is the problem. What does it mean -

that worked fine for the last few 
years resulting in many requests for forgotten passwords and renewed site 
activity.


And what does it mean -

Last year, we sent it again, after a few minor code changes, and had no 
response whatsoever.


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] class? package?

2008-06-10 Thread Iv Ray

If you are designing with OO principles, could you give an explanation of
what is the difference classes and packages?


A class is a language construct, classes are processed/executed by php.

A package is an architectural approach - this is how you combine your 
code/classes.



When I was summarizing the OO principles, that question confused me:
http://phparch.cn/index.php/php/43-php-advanced-programming/170-principles-of-object-oriented-design


If you try to follow all these principles, it might take very long 
before you write even a line of code ;)


Take what you understand and leave the rest for later. You will become 
better, but will never be perfect ;)


Iv

--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] use of static methods after namespaces arrive

2008-05-28 Thread Iv Ray
In which situation would somebody use a static method, instead of a 
function in a namespace, after the namespaces arrive with 5.3?


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] OT Smarty problem

2008-05-28 Thread Iv Ray

Hi George,

I tried your code and it works.

If you have some way of remote assistance I can have a look on-site, 
if you like.


But it could be that you just need a good sleep, and then look again ;)

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] OT Smarty problem

2008-05-28 Thread Iv Ray

Gabriel Sosa wrote:
 try doing this..

 {if $clearance eq 0}

 instead use ==

 i saw that some version of smarty has a bug related to this issue

 BTW .. you could use the options helper [1]

 saludos
 gabriel

Right... I forgot to ask which Smarty version you have. I tried it with 
the last.


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] use of static methods after namespaces arrive

2008-05-28 Thread Iv Ray

Adam Richardson wrote:
If the functionality doesn't conceptually promote the inclusion of the 
variables it works on (i.e., no class variables), doesn't conceptually 
fit a scheme where instances can exist, and likely won't benefit from 
refactoring into component methods, then I could see using a namespaced 
function.


Here I would do the same.

Most of the time, though, I'd probably start out with a class method 
instead of a namespaced function so I could more readily adapt to OOP 
practices if desired as the implementation evolves.


Hm...

Would you consider it safer to convert a static method into an instance 
method, than implementing a namespaced function into a (new) class and 
redirecting the calls?


I am not starting a fight, I am really interested in what you think.

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XML file locking

2008-05-19 Thread Iv Ray

Kaja wrote:
Does anyone know if any of the PHP 5 XML libraries use flock() internally? 
I'd like to use XMLReader and XMLWriter but I need to make sure theres no 
writing going on while reading and no more than one writer at time.  And if 
I have to use DOM, does DOM lock the file when it calls save()?


Or is there any xml library that allows you to pass in an already opened 
file stream ?


Thanks.


For such a low level question, I think you better ask on the developers 
list.


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XML file locking

2008-05-19 Thread Iv Ray

bruce wrote:

Couldn't you also create a rather simple test to determine if the locking of 
the file takes place?


I personally do not trust file system level locks. Even if a software is 
not intended to be portable across operating systems, it is possible to 
use different file systems under the same operating system, and the 
rules might be different. Using file system level locks would require 
all possible file systems to be taken into account. And on top of that, 
the file systems are actively developed, so this is one more point to 
monitor, while maintaining the software. A less trouble free way is to 
create a file with the same name and extension .locked or similar, 
prior to read/write operations. Of course, this works only if the file 
is accessing only by one program, or if all programs accessing the file 
follow the same convention - but you should see that many file system 
level locks are advisory, as well.


See this -

http://en.wikipedia.org/wiki/File_locking

--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] changing order of items

2008-05-16 Thread Iv Ray

Eric Butera wrote:

I use this:

http://developer.yahoo.com/yui/examples/dragdrop/dd-reorder.html


Looks good.

I still can't decide for one of these big libraries, prefer to use 
small things which I can fix/change, if the author does not have time 
or desire.


--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] changing order of items

2008-05-16 Thread Iv Ray

afan pasalic wrote:
 But, actually, I need something more simple. Nothing fancy :D.

I thought so from the beginning, just thought - it does not hurt to show 
different possibilities. May be you will not implement it now, but when 
you know about it, it might give you ideas in future.


--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] changing order of items

2008-05-16 Thread Iv Ray

Jason Murray wrote:

I am assuming that each time you click the up or down arrow you are
re-loading the page (via a GET request).  A simple solution to this, would
be to adjust the URLs assigned to the up and down arrows to carry an extra
variable, the item either directly above or directly below the one selected,
and instead of doing whole-sale renumbering, create a swap function.  That
just swaps the position of the two items.


Very good idea.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] question about validation and sql injection

2008-05-16 Thread Iv Ray

Hej Sudhakar,

what a long e-mail ;) !

I would suggest you use e-mail address as user name. There are many good 
reasons why to do so, I will give you some, if you wish.


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] SetEnv directives in VirtualHost configuration not accessible in PHP

2008-05-16 Thread Iv Ray
I had similar problem some time ago, and there was some solution, which 
I can't remember now.


Do you still have the problem?

I'll can have a look, if still needed.

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] the class as a namespace

2008-05-15 Thread Iv Ray

Is there a notion of the class as a namespace?

My understanding is that the namespaces are intended to help organize 
the classes in large projects (and are not perfect).


Is it considered good style to use a class simply to box related functions?

For instance, a class called files, contains functions I need for 
dealing with files - and the instantiated object is _simply_ used to 
access these functions - the instantiated object is not a file in 
itself. Thus what I do is not $INSTANTIATED_OBJECT-save(), but 
$INSTANTIATED_OBJECT-save($file) (though I could do the first if I 
first, say, do $INSTANTIATED_OBJECT-file = $file.


Accessing the functions using the scope resolution operator (::) avoids 
the need to instantiate an object, but does not allow the use of $this, 
and $this can be quite practical in order to group common logic into 
shared methods within the class and thus make the other methods smaller 
in terms of code (of course, one could use file::save, file::delete 
instead of $this-save and $this-delete, but it makes renaming objects 
more difficult).


I would be interested to hear opinions.

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can I install a newer version of php over an older version

2008-05-15 Thread Iv Ray

Tony M wrote:
 Can I install a newer version of php over an older version?

Perhaps what you need is this -

Upgrading PHP with the Install

To upgrade, run the installer either graphically or from the command 
line as normal. The installer will read your current install options, 
remove your old installation, and reinstall PHP with the same options as 
before. It is recommended that you use this method of keeping PHP 
updated instead of manually replacing the files in the installation 
directory.


You can read it here -

http://at.php.net/install.windows

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Using SVN w/ Zend Studio for Eclipse

2008-05-15 Thread Iv Ray

 I do not want to copy the project into a new
 directory as the existing directory is where Apache's DocumentRoot is
 set. And although that's simple to change, I really don't think any
 IDE should mandate where I set my project's directory on the
 filesystem.

I use PDT, and there is no problem to import a project from its current 
location.


It might take you a while to exactly figure out how to do it, Eclipse is 
a bit organic in respect to the organization and working of the menus.


 Also, if I try to create a new project from an SVN
 Repository, it doesn't allow me to select what directory I want the
 code checked out in.

This works very well with PDT and Subclipse.

 Otherwise I'd just cringe and let it overwrite
 what's in my existing document root, since that's all versioned code
 anyhow.

If your current document root is a checked out svn project, 
PDT/Subclipse will see this, no need to overwrite anything.


 If any of you have run into similar frustrations, I'd love to hear it.
 So far I've spent the better part of the evening fiddling with
 extremely rudimentary features which no IDE in any programming
 environment I've ever worked with has imposed on me. Perhaps this
 thing isn't ready for mainstream yet, or perhaps I'm missing something
 obvious.

Again, I work with PDT/Subclipse.

Eclipse is simply too organic compared to what you are used to. Just 
relax and give it a try and you'll love it.


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] the class as a namespace

2008-05-15 Thread Iv Ray

Richard Heyes wrote:
 That's a common use of static classes. Eg:

 HTTP::Redirect($url);

 In fact this (from the article I've read) is exactly how namespaces will
 look like. So in the above example, HTTP could be either a namespace or
 a class.

Right. Namespaces do look similar. And PEAR employs similarly looking
packages naming convention.

So it seems the static classes (which are actually simply classes with
static methods/properties, right) are the best namespaces like way,
until the namespaces arrive.

Thanks for your note,
Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Working with internal data formats

2008-05-15 Thread Iv Ray

John Gunther wrote:
 What technique can I use to take an 8-byte double precision value, as
 stored internally, and assign its value to a PHP float variable without
 having the bytes misinterpreted as a character string.

Does it get misinterpreted, or do you just want to be sure?

The documentation says -

Some references to the type double may remain in the manual. Consider 
double the same as float; the two names exist only for historic reasons.


Does this cover your case?

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Working with internal data formats

2008-05-15 Thread Iv Ray

John Gunther wrote:
 Example: I extract the 8 bytes 40 58 FF 5C 28 F5 C2 8F from
 an external file

You mean you extract 40 58 FF 5C 28 F5 C2 8F, so to speak, as a 
string, right?


Sorry, for asking, but somehow I do not the case.

--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] changing order of items

2008-05-15 Thread Iv Ray

afan pasalic wrote:

this one bugs me for a while. how to change order.

I have a list of tasks. by status, task could be 1 (todo) or 0 (done) -
status value stored in mysql. I can list tasks per status or all.
order number is stored in mysql too.
the easiest way to change order is to have form for each task where you
will enter manually number and then submit (one submit button for whole
form). but, if you change order number for any task you have to change
then all order numbers below the task manually

solution with arrows (or up/down buttons) where you click on arrow and
the task switch the place with its neighbor is easy and fancy. Though,
I get in trouble if, e.g. tasks 10, 11, 12, and 13 change status from 1
to 0 and I have to move task 14 to place 6. I have to click first 4
times (to switch places with tasks 13, 12, 11, and 10) - but nothing is
actually happening on screen (of course) before start switching places
with 9, 8, 7, and 6.

how do you avoid this gap?
what solution do you use at all?


You have two different issues - a) how to execute the change, and b) 
what interface to provide.


To execute the change, basically you have to reorder. The best algorithm 
is question of mathematics - you can implement something and improve 
it independently from the interface.


As for the interface, the first is kind of the simplest, but somehow 
primitive. The second is a bit better, but you have noticed, not much 
better. The most elegant, considering the time we live in, would be drag 
 drop AJAX (here - http://tool-man.org/examples/, there are excellent 
examples, perhaps there are more).


It's also a question if tasks really need to be reordered manually. If 
all tasks have a deadline, you might sort them by date. If some don't, 
you can provide them unsorted, until they get one. Sorting tasks by 
moving them up/down works when you have 25 tasks, but it does not work 
when you have 50, 100, 1 000 (if you are a team leader and have 5-7 
people team) - in that case sort by date might be better.


If you get more advanced, and store time needed to complete a task, you 
could automatically shift all tasks (of a person) - when one gets 
delayed or takes longer, than planned.


Hope that helps,
Iv

--

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] validating using php

2008-05-14 Thread Iv Ray

Sudhakar wrote:
 if( strlen(trim($name) == 0 ) || !preg_match('/^[a-zA-Z ]+$/x', $name) )
 {
 $error.=Name is blank or has special characters ;
 }

You have messed up the brackets. This -

strlen(trim($name) == 0 )

should be -

strlen(trim($name)) == 0

Then the script does what you want.

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] validating textarea using php

2008-05-13 Thread Iv Ray

Sudhakar wrote:
 i do not want
 this to happen, if a user simply hits the spacebar and does not type
 anything i should be able to display an alert message.

From usability point of view such check will, in many cases, generate 
annoyance, and bring nothing.


If I do not want to enter anything, and you error me to enter 
something, I'll do like this -


asdlöfjasdpoöfja spdfj as fsdaölkjf

And your check is dead. If you want something, you will get something.

It is hard (from usability point of view) to validate textarea to that 
extent, and especially - to get reasonable answers...


I work for a scientific database, where all content providers are very 
intelligent, well educated and very disciplined, and the content editors 
still have hard time thinking how to guide the content provider so that 
they provide reasonable input.


Your problem is not so much php related, but a usability and editorial one.

Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] getting iostat -x %b with php

2008-05-06 Thread Iv Ray
What is the best way to extract just the drive load information (%b 
column) from iostat -x (on  FreeBSD)?


I imagine to exec() the iostat -x and then process the result with 
regex, but I am not sure if this is the best way - for instance, is %b 
is aways the Nth column in the returned value?


Iv

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php