Re: [PHP] Conceptional question on dealing with different languages

2006-02-22 Thread Philip Hallstrom

Hello list,
it has been a while since I've posted the last time, but now I need your
help/ opinion again.  I'm re-designing an existing page for an online
shop which is supposed to be used in different languages. The former
design was just a plan echo for an output since the page was only
intended for the German market. But now the output depends  on the
language the user selected. Currently we think of two languages, but
that might change sooner or later (management decision...).

Of course I don't want to ad an case of $language for every former echo.
I want to export the content to one central file/ object / table...
The infrastructure is PHP5 MySQL.

Now my ideas, where I would need your opinion:
1. a XML File which I read via SimplXML
2. a plan Text file
3. a PHP class where I delviver the content out of arrays
4. or a table in MySQL

Do you have other options, that might be useful? Which would you prefer?


Haven't used it, but see it everywhere...

http://us3.php.net/gettext

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



Re: [PHP] Conceptional question

2005-06-29 Thread Richard Davey
Hello Thomas,

Wednesday, June 29, 2005, 4:38:10 PM, you wrote:

T I have a conceptional question about storing images/files on a
T server. When the application gives users a possibility to store up
T to 20 images, would it be better to create a new folder for each
T signed-up user to store the images in, or use one large folder. I
T have done the last quite often (just renamed the files to the
T insert id) with good success.

Depends entirely on how many images you expect to be held in this
folder at any one time. Whilst all modern operating systems can cope
with lots of files, you hit a certain level* beyond which system
performance suffers increasingly.

Personally I'd create sub-dirs per user.

* Don't ask me what, but it's not a very high number IIRC.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

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



Re: [PHP] Conceptional question

2005-06-29 Thread Ryan A
Hey,

 Depends entirely on how many images you expect to be held in this
 folder at any one time. Whilst all modern operating systems can cope
 with lots of files, you hit a certain level* beyond which system
 performance suffers increasingly.

 Personally I'd create sub-dirs per user.

 * Don't ask me what, but it's not a very high number IIRC.

Interesting, I just created a album kind of section for a clients site,
but i am dumping all the images of all users into the folder
user_album_pics
he's on a dedicated linux server with 2gigs ram and  300gigs hdd space...

Any rough estimates what number of images would be too much?
and does anyone think i should make folders for each user?
Each user is limited to max 3mb of pics though...

Thanks,
Ryan

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



Re: [PHP] Conceptional question

2005-06-29 Thread Stephen Johnson

 
 Any rough estimates what number of images would be too much?
 and does anyone think i should make folders for each user?
 Each user is limited to max 3mb of pics though...
 
 Thanks,
 Ryan

Personally I believe it is doubtful that you would ever reach the limit
unless you where going to be getting some serious traffic.

Ultimately, though,  I think it is sound judgment to make separate folders
just for your own sanity.  Think about file storage on your own machine
sitting on your desk.  Do you take all your pictures and dump them into one
folder or do they contain some sort of organization.


Then look at your processes regarding how you access your files -- are you
storing the path in your dB ? Or do you read through the directory looking
for the file? If it is the latter then your application will suffer
performance wise searching a mass of files.

I have also been leery of overwriting another users files.  I realize that
if you use a unique identifier on the file itself you prevent this, but
mistakes can be made, and I have always felt more comfortable sending the
user to his own directory where he can do as he likes



?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
[EMAIL PROTECTED]

562.924.4454 (office)
562.924.4075 (fax) 

continuing the struggle against bad code

*/ 
?

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



Re: [PHP] Conceptional question

2005-06-29 Thread Philip Hallstrom

Depends entirely on how many images you expect to be held in this
folder at any one time. Whilst all modern operating systems can cope
with lots of files, you hit a certain level* beyond which system
performance suffers increasingly.

Personally I'd create sub-dirs per user.

* Don't ask me what, but it's not a very high number IIRC.


It depends on the OS and what you're going to be doing.  I think a couple 
of years ago it was more relevant, but still, it's worth considering 
today.  My memory is that you can stuff a lot of files into a single 
directory provided you access them directly and don't ever want to list 
them out.


Still, that aside, there are very valid reasons for splitting them up into 
subfolders.


- You avoid any lots of files in a single directory problem.
- You create break points so to speak that would allow you to add a hard
  drive seemlessly.
- You potentially make it easier to back up.

If I'm just dealing with images whose names are unique and roughly 
sequential numbers I tend to create a structure like this:


A/B/NNNAB.jpg

Where A and B are 0 - 9.

This at least gives me a nice even spread of files.  And if I run out of 
disk space I can add a new disk and move say the top level 0, 1, 2, 3, 4 
to it without affecting any of the code.


You can do the same for users, but you have to watch out for situations in 
which you probably don't have any users that start with Q or X, but maybe 
a lot that start with R so you can get a bit lopsided.


Interesting, I just created a album kind of section for a clients 
site, but i am dumping all the images of all users into the folder 
user_album_pics he's on a dedicated linux server with 2gigs ram and 
300gigs hdd space...


Any rough estimates what number of images would be too much? and does 
anyone think i should make folders for each user? Each user is limited 
to max 3mb of pics though...


df -hi is your friend.


From one of my boxes, I get this output:


FilesystemSize   Used  Avail Capacity iusedifree %iused  Mounted on
/dev/da0s1a   252M43M   189M19%1577309335%   /
/dev/da0s1h23G   4.8G16G23%   59514  29420842%   /local
/dev/da0s1e   504M   356K   463M 0%  40648540%   /tmp
/dev/da0s1g   7.9G   1.8G   5.4G25%  223147   811603   22%   /usr
/dev/da0s1f  1008M72M   855M 8%1398   1283921%   /var
/dev/ad0c 147G41G   105G28%1962 193270600%   /ad0

The 'iused' and 'ifree' columns tell you how many files/directories are
on that filesystem and how many you have free.  So this gives you the
max number of files you can store on that filesystem before you start to
get serious errors.

And the inode stuff is directly tied to how you've created that
filesystem (block size, etc...)  On freebsd, this can be adjusted when
you create the filesystem... see the 'newfs' man page for more.  Also
the 'tuning' manpage...

Hope this helps...

-philip

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