[PHP] turn shared hosting server to external image storage hosting

2008-12-28 Thread paragasu
do you have any idea how to do this. i have a small vps about 10GB
space. i live somewhere is south east asia where solutions like Amazon
S3 is incredibly slow. (500ms ping time).

i have a simple php gallery. But dedicated server is quite expensive
($100/month). searching around, i found several local hosting
companies provide a very cheap shared hosting. ($100 / year, 300GB).
local server with 40ms ping time.

i am interested to use that shared hosting just as storage for images
of my gallery and a cheap vps to store the database.

What is the best way for me to accomplish this? Amazon S3 using REST
etc. Is it possible to write a simple storage (REST system) like
amazon s3 in PHP? is there anyone wrote this before. I am interested
in your solutions..

thanks

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



Re: [PHP] turn shared hosting server to external image storage hosting

2008-12-29 Thread paragasu
i tried to ping photobucket. it takes 400ms for here. i only want to
create a small gallery locally. our ISP have a very slow connection
outside our country. so i want to take advantage of any available
server here.

cloudfront nearest server in asia is in hongkong. i try to look in to it.

On 12/28/08, Nathan Nobbe  wrote:
> On Sun, Dec 28, 2008 at 6:37 AM, paragasu  wrote:
>
>> do you have any idea how to do this. i have a small vps about 10GB
>> space. i live somewhere is south east asia where solutions like Amazon
>> S3 is incredibly slow. (500ms ping time).
>>
>> i have a simple php gallery. But dedicated server is quite expensive
>> ($100/month). searching around, i found several local hosting
>> companies provide a very cheap shared hosting. ($100 / year, 300GB).
>> local server with 40ms ping time.
>>
>> i am interested to use that shared hosting just as storage for images
>> of my gallery and a cheap vps to store the database.
>>
>> What is the best way for me to accomplish this? Amazon S3 using REST
>> etc. Is it possible to write a simple storage (REST system) like
>> amazon s3 in PHP? is there anyone wrote this before. I am interested
>> in your solutions..
>
>
> have you tried photobucket ?  we have an api in php which is freely
> available and we use a CDN for caching all around the globe.  in fact, id be
> interested to find out how it stacks up over there, in your neck of the
> woods.
>
> -nathan
>

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



Re: [PHP] Re: Webhotel structure

2008-12-31 Thread paragasu
uh.. nice flash website grandpa =)

On 12/31/08, Peter Sorensen  wrote:
>
>
> ""Dotan Cohen""  wrote in message
> news:880dece00812301337m1cca395cxcb1ef500d8c10...@mail.gmail.com...
>> 2008/12/30 Nordstjernealle 10 :
>>> Hi Dotan
>>>
>>> I am glad I can at least be funny.
>>> I must admit I am a bit lazy when it comes to write perfect english in
>>> mails. I believe we can do better with our time.
>>> In this particulary case the result was below acceptable levels.
>>>
>>
>> English is not my native language either, by the way.
>>
>>> No I would not laugh if you where writing in Bokmal or Nynorsk.
>>> Because I would not know the first think about spelling in the Norwedian
>>> languages. I am Danish, we speak and write in Danish.
>>>
>>
>> I apologize! I know little of Scandinavian culture (the letters in
>> your last name were a hint to Scandinavian) and your email address
>> just looked Norwegian to me.
>>
>>> Yes it is a linux server, and I know the basic linux commands, but I do
>>> not
>>> know if and how I can get SSH access to my web host.
>>
>> If you can't, then switch hosts. SSH access is a necessity.
>>
>>> It may not be supported or be too basic to be include in the help search
>>> at
>>> surftown, I simply do not know.
>>> My web do not have a fixed IP, so I guess it may not
>>>
>>
>> No fixed IP for your web host?!? Change!
>>
>>> It seems like surftown is an okay host, compared to my less than 2$ a
>>> month,
>>> but their help is a major candidate for winning the price of the most
>>> useless help ever.
>>>
>>> A google search found a blog where the guy say they do not support ssh on
>>> pivate hosting, so I guess not.
>>>
>>> /Peter
>>>
>>
>> --
>> Dotan Cohen
>>
>
> Hi again
>
> Sorry for cutting your name card short Dotan, but I get tired reading the
> entire alfabet every time.
>
> Yes ssh and fixed IP is properly a must for you guys who having php
> programming as a hobby, but I only want a webside up and running.
> The only other thing I would like would be a 100Gbyte remote backup.  Here I
> only got 10Gbyte.
> The price of getting these this is rather high compared to my 2$ a month,
> another detail is, that I payed 5 years in advance to get this price, so
> that would all be lost. In total I payed 100$ for 5 years including
> webhosting and  the domain name registration onbe year ago.
> Now I finally get some value for the money.
> Today the price for the same has doubled.
> I do not mind spending another 100$ if you can do better, but I will not
> spend 5 or 10$ a month for this.
>
> As php programming is not a hobby I properly will be away from this list for
> a long time, have fun everyone, before you know you have become too old for
> that.
>
> My retirement will also restore the average age of this list back to normal.
>
> Best regards
>
> Granpa
> Peter
>
> nb I can not show you my web, as login is restricted to familie only, but I
> guess you all know how coppermine look.
> but you are welcome to look at my work homepage www.protelevision.com where
> I am a HW engineer.
>
>
>
>
>
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] Encryption/decryption of PHP data

2009-01-01 Thread paragasu
if you want client to send encrypted form to server. then it must be
done using some kind of
client side script (javascript?). i don't think it is reliable.

why not just use https protocol. all data between client and server
will be encrypted.

On 1/1/09, Per Jessen  wrote:
> Edward Diener wrote:
>
>> Phpster wrote:
>>> In reading the license I believe it refers to the gnupg itself, not
>>> the application it may be embedded in. You are completely free to use
>>> gnupg as you choose including modifying it to meet your needs.
>>
>> I always thought the GNU public license demanded that any non-free
>> modules, which use any software distributed with this license, make
>> their source code freely available to end users. If this is either not
>> the case or no longer the case, then I will be glad to use GnuPG.
>
> If you are distributing or selling your non-GPL software and you use GPL
> software with it, then yes, I believe you are required to make your
> source code available to the end-user too.
>
> Maybe have a quick look at http://gpl-violations.org/
>
>
> /Per Jessen, Zürich
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] Request A Collection of YouTube Videos From Multiple User Accounts using YouTube API

2009-01-07 Thread paragasu
hi Herbet,
i am interested on what your are looking for. maybe you just have to
write a PHP script to
loop through every yourtube account. btw, if you found the solutions,
please tell me or we can work on the solutions together?

On 1/7/09, L. Herbert  wrote:
> Stuart,
>
>> PHP can do a great many things, but it cannot remotely change the
>> functionality of a third party API.
>
> Is that part of your understanding of my request?  To clarify further
> for you, I am simply asking my question here (in addition to other
> reference/discussion forums) to see if any developer who frequents
> this list may have some experience in this regard and offer some
> helpful insight.  You obviously feel my question is out of place... I
> apologize for any discomfort this may have caused you.
>
> On Jan 7, 2009, at 5:19 AM, Stuart wrote:
>
>> 2009/1/7 L. Herbert :
>>> Let me clarify, I am using PHP to call/receive via the YouTube API
>>> and to
>>> format/display the return data within my PHP application.  I
>>> believe that
>>> has a little something to do with PHP.  Forgive my presumption if
>>> otherwise.
>>
>> As I understand it you're wanting to request a collection of videos
>> from multiple user accounts in a single API call. PHP cannot help you
>> if the API does not support doing that, so you need to direct the
>> question at people who maintain and use the API.
>>
>> PHP can do a great many things, but it cannot remotely change the
>> functionality of a third party API.
>>
>> -Stuart
>>
>> --
>> http://stut.net/
>>
>>> On Jan 7, 2009, at 4:40 AM, Stuart wrote:
>>>
 2009/1/7 L. Herbert :
>
> Does anyone know if it is possible to get a collection of YouTube
> videos
> from multiple user accounts?  If so, can you provide some insight
> and
> direction?
>
> Someone more knowledgeable than me on this topic indicated that
> it is
> only
> possible get a collection of YouTube videos on a per account
> basis.  On
> its
> face this make sense to me but I'm just getting a second opinion.
>
> I realize I can loop requests via the API and format the results as
> needed,
> but was hoping for a more streamlined option.

 This question has nothing to do with PHP. I suggest you try the
 YouTube developers site - I'm sure there's a resource there that can
 help you... http://youtube.com/dev

 -Stuart

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

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



[PHP] program to test php security

2009-01-14 Thread paragasu
one of my client says his company do have a program to test php code for common
programming security problem like sql injection etc

i am curious but he do not want to tell what the program is.
do this program exists? what is it?

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



[PHP] how to display new icon for news posted within 2 days?

2009-01-14 Thread paragasu
i do have a mysql table with one date field.
what i want is to display and tiny icon (red new icon) so user will
notice it is a new post.
i am looking for the simplest solutions here.

i believe we can calculate whether the date is within two days of user
current time.
then we display an icon based on it.

can anyone help?

thanks

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



Re: [PHP] how to display new icon for news posted within 2 days?

2009-01-15 Thread paragasu
is it possible to do it like
SELECT *, UNIX_TIMESTAMP(post_date)-172,800 as is_new FROM tbl

$post = mysqli_fetch_object($sql);
if($post->is_new)
echo '';

On 1/14/09, Phpster  wrote:
> Make it easy and store the date as a unix timestamp. Then it's a
> simple testto do
>
> If ((current timestamp - db timestamp) < 172,800 ){
>   echo '';
> }
>
> Conversely, you can use strtotime() to convert the date.
>
> Bastien
>
> Sent from my iPod
>
> On Jan 14, 2009, at 10:36 PM, paragasu  wrote:
>
>> i do have a mysql table with one date field.
>> what i want is to display and tiny icon (red new icon) so user will
>> notice it is a new post.
>> i am looking for the simplest solutions here.
>>
>> i believe we can calculate whether the date is within two days of user
>> current time.
>> then we display an icon based on it.
>>
>> can anyone help?
>>
>> thanks
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>

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



[PHP] print a to z

2009-01-15 Thread paragasu
i have this cute little problem. i want to print a to z for site navigation
my first attempt work fine

for($i = '65'; $i < '91'; ++$i)
  echo chr($i);

but someone point me a more interesting solutions

for($i = 'a'; $i < 'z'; ++$i)
  echo $i

the only problem with the 2nd solutions is it only print up to Y without z.
so how to print up to z with the 2nd solutions? because it turn out
that you cant to something
like for($i = 'a'; $i <= 'z'; ++$i)..

thanks

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



Re: [PHP] print a to z

2009-01-15 Thread paragasu
> $letters = range('a', 'z');
> foreach ($letters as $letter) {
> echo $letter;
> }

wow.. that is a very nice solutions you give me chris.
thanks

On 1/15/09, Chris  wrote:
> paragasu wrote:
>> i have this cute little problem. i want to print a to z for site
>> navigation
>> my first attempt work fine
>>
>> for($i = '65'; $i < '91'; ++$i)
>>   echo chr($i);
>>
>> but someone point me a more interesting solutions
>
> $letters = range('a', 'z');
> foreach ($letters as $letter) {
>echo $letter;
> }
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
>

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



Re: [PHP] PHP AS an FTP server

2009-02-19 Thread paragasu
i successfully configure vsftp login using pam-mysql last time.

http://pam-mysql.sourceforge.net/
http://www.linux.com/feature/125789

user can login to ftp server using the same password on web..

hope it help

On 2/18/09, Michael Kubler  wrote:
> Yeah, I don't want local user access (SSH, their own entries in passwd,
> etc..). Too much work to ensure they all have the correct file
> permissions, etc..
> I think I'll just skip the PHP bit and use a proper FTP server. I've
> configured them a few times, but all the examples I found only had
> Anonymous FTP login, or MySQL (which is what I want), but the server
> wouldn't work with the MySQL plugin.
> Looks like I'll have to compile from source... joy.
>
> Thanks for all the replies though.
>
> Michael Kubler
> *G*rey *P*hoenix *P*roductions 
>
>
>
> Thodoris wrote:
>>
>> The local users part was about ssh-sftp access Ash not ftp.
>>
>> IMO when you add local users you add extra risks to your system than
>> simple ftp (non-local) users may not cause. Of course if you secure
>> your system carefully everything will work fine but I would avoid that
>> and there are many security issues that here is not the place to discuss.
>>
>> Of course if this fits your needs I have no objections.
>> --
>> Thodoris
>

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



Re: [PHP] Re: LoginShare | How to authenticate once, and login to different websites

2009-09-01 Thread paragasu
why not use ready available php library OAuth?

http://oauth.net/

On 9/1/09, Shawn McKenzie  wrote:
> Behzad wrote:
>> Dear list,
>>
>> i'm trying to integrate two php-driven web applications, which both
>> require the user to authenticate using a username and a password.
>>
>> Consider a situation where the user has logged-in to the 1st application.
>> She
>> clicks over a hyper-link, which directs her to the 2nd application. The
>> challenge
>> is to automatically authenticate the user on the 2nd application as well.
>>
>> i'm wondering how?
>> Is it secure to store the username and password in the $_SESSION, and
>> share the session between the two applications?
>>
>> Please let me know what do you think.
>>
>> Thank you in advance,
>> -behzad
>>
>
> Each application has a mechanism to tell whether the user is loggedin,
> and if so, who is loggedin.  One of the most common is probably a uid or
> something saved in the session.  If both apps are on the same domain and
> use the same session handler, then you just need to modify each apps
> login code to set the login stuff for the other app.  Possibly create
> your own login code that sets the login for both apps.  Either way,
> there's no need (and I wouldn't advise) to store the password in the
> session.  If it's not too verbose you can post the login code for each.
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] How do YOU set default function/method params?

2009-10-05 Thread paragasu
why bother, i use available good library

http://swiftmailer.org/



On 10/6/09, Jim Lucas  wrote:
> Eddie Drapkin wrote:
>> On Mon, Oct 5, 2009 at 8:48 PM, Jim Lucas  wrote:
>>> Here is a problem that I have had for years now.  I have been trying to
>>> come up
>>> with the perfect solution for this problem.  But, I have come down to two
>>> different methods for solving it.
>>>
>>> Here is the problem...
>>>
>>> >>
>>> function sendEmail(
>>>$to,
>>>$from,
>>>$subject,
>>>$body,
>>>$attachments=array(),
>>>$headers=array()
>>>) { # I typically do not put each argument on seperate lines, but I
>>> ran
>>>#out of width in this email...
>>>
>>># do something here...
>>>mail(...);
>>>
>>> }
>>>
>>> sendEmail('j...@doe.com',
>>>'maryk...@uhhh.net',
>>>'Hi!',
>>>'Check out my new pictures!!!',
>>>$hash_array_of_pictures
>>>);
>>>
>>> Now, we all have a function or method like this floating around
>>> somewhere.
>>>
>>> My question is, how do YOU go about setting the required entries of the
>>> $headers
>>> array() ?
>>>
>>> I see three possible solutions.  I want to see a clean and simple
>>> solution.
>>>
>>> Here are my ideas so far:
>>>
>>> function sendEmail(
>>>$to,
>>>$from,
>>>$subject,
>>>$body,
>>>$attachments=array(),
>>>$headers=array()
>>>) { # I typically do not put each argument on seperate lines, but I
>>> ran
>>>#out of width in this email...
>>>
>>>if ( empty($headers['Date']) ) {
>>>$headers['Date'] = date('c');
>>>}
>>>if ( empty($headers['Message-ID']) ) {
>>>$headers['Date'] = md5($to.$subject);
>>>}
>>># and the example goes on...
>>>
>>># do something here...
>>>mail(...);
>>>
>>> }
>>>
>>> Or, another example.  (I will keep it to the guts of the solution now)
>>>
>>>$headers['Date']   = empty($headers['Date']) ?
>>> date('c') : $headers['Date'];
>>>$headers['Message-ID'] = empty($headers['Message-ID']) ?
>>> md5($to.$subject) : $headers['Message-ID'];
>>>
>>> OR, yet another example...
>>>
>>> $defaults = array(
>>>'Date'   => date('c'),
>>>'Message-ID' => md5($to.$subject),
>>> );
>>>
>>> $headers += $defaults;
>>>
>>> END of examples...
>>>
>>> Now, IMO, the last one is the simplest one and for me, I think it will be
>>> the
>>> new way that I solve this type of problem.
>>>
>>> But, my question that I put out to all of you is...
>>>
>>>How would you solve this problem?
>>>
>>> TIA
>>>
>>> Jim Lucas
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>> How does this look to you?
>>
>> function sendEmail(
>>  $to,
>>  $from,
>>  $subject,
>>  $body,
>>  $attachments=array(),
>>  $headers=array()
>>  ) {
>>  # I typically do not put each argument on seperate lines, but I ran
>> #out of width in this email...
>>
>>  $default_headers = array(
>>  'Date' => date('c'),
>>  'Message-ID' => md5($to.$subject)
>>  );
>>
>>$headers = array_merge($default_headers, $headers);
>># and the example goes on...
>>
>># do something here...
>>mail(...);
>>
>> }
>>
>
> Good, since it is a combination of the examples I gave.
>
> I am looking at how you would solve the problem.  Unless this is the way you
> would solve the
> problem.. :-D
>
> Jim
>
> --
> Jim Lucas
>
> "Some men are born to greatness, some achieve greatness,
> and some have greatness thrust upon them."
>
> Twelfth Night, Act II, Scene V
>  by William Shakespeare
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



[PHP] Happy New Year All!

2009-12-30 Thread paragasu


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



Re: [PHP] If the first four characters are "0000", then do {}

2010-01-26 Thread paragasu
maybe another way can be

$str = explode('-',$mydata->restored);

if($str[0] == '') { dostuff();}


;)

On 1/26/10, shiplu  wrote:
> Another technique could be.
>
> $s = $mydata->restored;
>
> if($s[0]==$s[1]
>  && $s[1]==$s[2]
>  && $s[2]==$s[3]
>  && $s[3]==0){
>
> do_work();
> }
>
>
> But I think you got the best solution already.
>
> --
> Shiplu Mokaddim
> My talks, http://talk.cmyweb.net
> Follow me, http://twitter.com/shiplu
> SUST Programmers, http://groups.google.com/group/p2psust
> Innovation distinguishes bet ... ... (ask Steve Jobs the rest)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] I need a fresh look at storing variables in MySQL

2010-03-13 Thread paragasu
On Sun, Mar 14, 2010 at 2:10 AM, tedd  wrote:

> Hi gang:
>
> I just completed writing a survey that has approximately 180 questions in
> it and I need a fresh look at how to store the results so I can use them
> later.
>
> The survey requires the responder to identify themselves via an
> authorization script. After which, the responder is permitted to take the
> survey. Everything works as the client wants so there are no problems there.
>
> My question is how to store the results?
>
> I have the answers stored in a session variable, like:
>
> $_SESSION['answer']['e1']
> $_SESSION['answer']['e2']
> $_SESSION['answer']['e2a']
> $_SESSION['answer']['e2ai']
> $_SESSION['answer']['p1']
> $_SESSION['answer']['p1a']
> $_SESSION['answer']['p1ai']
>
> and so on. As I said, there are around 180 questions/answers.
>
> Most of the answers are integers (less than 100), some are text, and some
> will be null.
>
> Each "vote" will have a unique number (i.e., time) assigned to it as well
> as a common survey id.
>
> My first thought was to simply record the "vote" as a single record with
> the answers as a long string (maybe MEDIUMTEXT), such as:
>
> 1, 1268501271, e1, 1, e2, 16, e2a, Four score and ..., e2a1, ,
>
> Then I thought I might make the data xml, such as:
>
> 11268501271116Four
> score and ...
>
> That way I can strip text entries for <> and have absolute control over
> question separation.
>
> Then I thought I could make each question/answer combination have it's own
> record while using the vote_id to tie the "vote" together. That way I can
> use MySQL to do the heavy lifting during the analysis. While each "vote"
> creates 180 records, I like this way best.
>
> Then I thought, what would you guys do? So, what would you guys do?
>
> Keep in mind that this survey must evaluated in terms of answers, such as
> "Of the ones who answered e1 as 1 how did they answer e2?"
>
> If there is something wrong with my preference, please let me know.
>
> Thanks,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Hi Ted,

How about saving the array in serialize variable to TEXT column

$answer = serialize($_SESSION['answer']);

to get the original array value simply unserialize the value from the
database..

Paragasu


Re: [PHP] Structured PHP studying

2010-04-25 Thread paragasu
> Just build what you want to build and look things up when necessary.
I did exactly like this. My first application is a forum. It never made it
to production,
but i learn a lot. And i am glad i learn it this way. It is a bit costly but
fun.


On Sun, Apr 25, 2010 at 11:01 PM, David McGlone  wrote:

> On Saturday 24 April 2010 10:46:33 Nathan Rixham wrote:
> > David McGlone wrote:
> > > On Friday 23 April 2010 07:45:16 Michiel Sikma wrote:
> > >> On 23 April 2010 13:15, David McGlone  wrote:
> > >>> Is there a good strategy to studying PHP?
> > >>>
> > >>> For instance, is there a way to break everything down into small
> > >>> managable topics?
> > >>>
> > >>> --
> > >>> Blessings,
> > >>> David M.
> > >>
> > >> Just build what you want to build and look things up when necessary.
> The
> > >> biggest part of learning any language is becoming able to creatively
> > >> solve problems within its realm of possibilities, and that's something
> > >> you can't really learn just by reading and solving textbook problems.
> > >> Hands-on experience is a very important key to understanding.
> > >>
> > >> Keep an open mind, ask people for answers if things get difficult,
> > >> always assume that there's a better way to do something, and in a
> while
> > >> you'll be able to write perfectly decent programs.
> > >
> > > This is the route I have been following for the past couple years and I
> > > have always assumed there is a better way to do something and that is,
> in
> > > a way what makes me lose confidence.
> > >
> > > I always feel like my code is crap and sometimes even ashamed to even
> > > show any of it.
> >
> > Hi David,
> >
> > Really good to see somebody asking for honest advice on a v important
> > matter :)
>
> Thank you.
>
> >
> > First, if I may, I'd like to suggest that being ashamed to show your
> > code is never going to be a productive way to work, rather the more code
> > you show, the more feedback you will get on your code, and often with
> > examples of alternative ways to do it - posting snippets and
> > opensourcing are great ways of crowd sourcing solid feedback.
>
> This is very true!
>
> >
> > Next, saying your code is crap, we all feel like that sometimes, but
> > it's critical to note that if your code does the job it's supposed to,
> > then it's a success! A few months ago I was questioning myself again and
> > wrote this: http://webr3.org/blog/general/the-wall/ - the point is it's
> > a good thing to question yourself, it's a good thing to take everything
> > in to consideration, and often I (used to) find myself looking at very
> > short procedural ways of doing things and think.. "why am i making all
> > these classes"; it's our job as programmers to know when to implement
> > something in 10 quick lines that are easy to maintain, and when to
> > create an all singing and dancing framework type affair, pros and cons
> > to each, and there is no "One True Way" TM of doing things - each bit of
> > code is very much dependent on context, scenario and maintenance costs.
> >
> > Okay, on to your specific questions!
> >
> > We can break this down in to small(~ish) common junks, and which you
> > study, take further and in what order is entirely up to you:
> >
> > General Coding
> > This is the stuff that translates to almost every language, for loops,
> > echo'ing, simple code optimisation and basically just how to script and
> > program - I'll assume that after two years you've got this nailed better
> > than any book can teach you, from here it's just experience and picking
> > up tricks on the way, so generally no need to worry!
> >
> > PHP
> > As you know php is a specific language, and the best way to learn
> > everything php specific, is literally to read the manual, from start to
> > finish, a few times, and keep referring back to it, if you see something
> > you haven't actually used before then give it a quick go in a short 5-10
> > line script and have a play, the 2 minutes it takes will be more than
> > worth it (by doing it, it'll get engrained in you).
>
> Wow, I've done this and didn't even realize it. Just a few weeks ago, I was
> trying to understand about how $this -> worked.
>
> I think I posted that over on php-db. I learned it was related to classes,
> so
> I dug into classes in the php manual and just wrote code and played with
> it. I
> did get a better understanding of the whole picture, but probably not
> enough
> to fully feel comfortable.
>
> >
> > Aside: in every project i do, and at all times i have a test.php where I
> > literally just try out ways of doing things and snippets of code, once
> > I'm done i stick an exit; before it then do the next snippet above it,
> > this way i always have one nice file of snippets in every project to
> > refer back to - they often come in handy for helping on this list
> > actually, and in fact sometimes are from peoples code on this list!
>
> Great Idea! I probably would have never thought of this. How do you include
> th

Re: [PHP] restricting filesystem access

2008-03-31 Thread paragasu
> I'd like to restrict php code to access the filesystem. I'd like to have
> only one directory where the php code can write, create or read files,
> and an other directory hierarchy where the php codes present. I need
> this to avoid php code to rewrite other php code in case of bug and/or
> an attack.
>
> I already tried the open_basedir directive, but it couldn't work because
> in this case the executed php have to be in the accessable directory
> hierarchy.
>
> Thanks,
> Gabor
>

it depends, if you run your own server (you have root password). then you
can do something
about this. but if you run on shared server, i don't think you have a lot of
options.
if you afraid the php code to rewrite other code (rare case). just chmod all
the php files
to 644.


Re: [PHP] restricting filesystem access

2008-03-31 Thread paragasu
> Thank you for the answer.
>
> I am running my site on a shared server, but I can overwrite the options
> in the php.ini file. Unfortunately php runs as my user, so changing the
> permissions to 644 doesn't work, php is still able to write anything.
>
> Gabor
>


ok.. your hosting enable the php suexec. i afraid there is not much you can
do to modified the php.ini. you may use ini_set() or the .htaccess to
override
the value anyway.

one thing you can do. sanitize input and make sure you code good :p


[PHP] using php to backup mysql database?

2008-04-04 Thread paragasu
anyone know how to backup a mysql database using PHP?
i want to write one php function to allow admin to download the mysql
database backup (mysqldump maybe?) ..
and how to restore the database backup from web based admin?

i am using a shared server and the php scripts executed under the
www-data user..


thank you..


Re: [PHP] using php to backup mysql database?

2008-04-04 Thread paragasu
i know phpmyadmin..
the points is, i am writing an application.
i want the admin of the website i wrote, to be able to do backup/restore
from the main administration area.

this admin do not have access to phpmyadmin.


Re: [PHP] using php to backup mysql database?

2008-04-04 Thread paragasu
On Sat, Apr 5, 2008 at 2:42 AM, Daniel Brown <[EMAIL PROTECTED]> wrote:

> On Fri, Apr 4, 2008 at 11:27 AM, paragasu <[EMAIL PROTECTED]> wrote:
> > anyone know how to backup a mysql database using PHP?
> >  i want to write one php function to allow admin to download the mysql
> >  database backup (mysqldump maybe?) ..
> >  and how to restore the database backup from web based admin?
> >
> >  i am using a shared server and the php scripts executed under the
> >  www-data user..
>
> If you have shell access and/or can run system() calls from PHP
> (and presuming it's a *NIX-like system), you could try something like
> this:
>
>  // mysql-backup.php
>
> $database = "your-db-name";
> $username = "your-db-username";
> $password = "your-db-password";
> $stamp = time();
>
> ignore_user_abort(1); // Continue no matter what.
>
> exec('mysqldump -u '.$username.' -p'.$password.' '.$database.' >
> ./mysql_'.$stamp.'sql',$ret,$err);
> // Handle $ret and $err as you'd like, if you want.
>
> exec('tar -cf mysql_'.$stamp.'.tar mysql_'.$stamp.'.sql',$ret,$err);
> // Handle $ret and $err as you'd like, if you want.
>
> exec('gzip -9 mysql_'.$stamp.'.tar',$ret,$err);
> // Handle $ret and $err as you'd like, if you want.
>
> echo "Download MySQL Backup";
> ?>
>
>Doing any sanity, extension, or even concatenation of commands to
> a single line is up to you.
>
> --
> 
> Ask me about:
> Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo.,
> and shared hosting starting @ $2.50/mo.
> Unmanaged, managed, and fully-managed!
>

thank you.. that is the answer i am looking for :)


Re: [PHP] $_SESSION problem

2008-04-10 Thread paragasu
it looks fine to me. but i want to share one bad experience with sessions.
the code i wrote work just fine on my testing server (please note, the
phpinfo is same with
my production server).

after days of figuring out why the session do not work. finally, i found the
solutions.
the solutions is to add a

@session_write_close() on the end of the execution code. on my case it
happen
every time i forward the page. so adding the @session_write_close before the
header('location: ') fix the problem.

this might be a possible explanation..


Re: [PHP] Cannot modify header information - headers already sent by ...

2008-04-21 Thread paragasu
On Mon, Apr 21, 2008 at 11:37 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:

> On Mon, Apr 21, 2008 at 11:33 AM, Waynn Lue <[EMAIL PROTECTED]> wrote:
> > I fixed this last time by looking for white space both before and
> >  after the opening and closing php tags, as a Google search had
> >  revealed.  But this time, I've spent an hour running down various
> >  files and not seeing what the heck is wrong.  Here's the essential
> >  setup.
> >
> >  main.php
> >   >
> >  require_once 'shared_style.php';
> >  require_once 'something.php'
> >
> >  ?>
>
> If something.php is setting cookies and such, it has to be above
> shared_style.php.  If you've already tried that with no success, post
> the code of something.php for us to view.


it is sometimes  a good idea to put error_reporting(0);
just a suggestion ;)


[PHP] php framework vs just php?

2008-04-22 Thread paragasu
honestly, i never used any framework to do my coding.
i look into few popular framework like cakePHP and codeIgiter.
I did learn the tutorial but still decide whether to use it on my next
project.

the thing is, i already develop few working library. no matter how hard i
look into it. i always find it is easier or simpler to work with just php
code and it work just fine.
simple code and i think faster than using complicated php framework.

i target my code to use specific  server configuration. the only advantages
of using framework
is cross server version (i don't need it). since everyone out there talking
about framework.
i still prefer using just php.

i just wondering whether i am the only one thinking this way.
anyone out there still doing php without using framework?


Re: [PHP] php framework vs just php?

2008-04-22 Thread paragasu
> My clients benefit downstream whenever I add to my framework. A problem
> solved two years ago is a problem still solved today, and I don't need
> to copy and paste into their project and thus maintain multiple versions
> of the same solution.


i am quite new in php. i only spent about 3 year playing with PHP. And what
you just
said about the 2 years old code still solved problem today. well it is true.
but i have a
different opinion based on my own experience.

i always found better solutions for old problem. For example, during PHP4
age, i have to
use XMLParser class (http://www.criticaldevelopment.net/xml/) to parse xml
file, while
in PHP5..  there is SimpleXML. And another example is mysqli prepared query.


Framework is complicated to me. It is easier to work with just php and it is
more straight forward. I have to dig deep into the framework documentation
because few hack to make it be able to work on all PHP version (backward
compatible) and AFAIK, no many framework out there support mysqli prepared
query (maybe it does, but it takes some time before someone implement thus
function without breaking the code backward compatiblity).

Backward compatible framework make the code so damn hard to debug and it
really
hurt eyes to see many cryptic code. And of course it takes some time to
understand what
a line of code does (fair enough since the framework coder takes years to
create,
Newbie like me will take twice the time, to understand and modify that
framework)

But, i agree, for productivity framework saves a lot of time. Then again, it
is easier and faster to use the drag-and-drop php code feature in macromedia
mx (no need to learn html and
not too much php)..

i still can't convince myself to use framework ;(


Re: [PHP] Securing your sites against Script Kiddies

2008-04-22 Thread paragasu
> http://ambiguous.dnsalias.net/


what a  nice  collection you have. i also have some of this files on my
server.
i don't know how the files end up on my web page directory. That time i am
using a shared
server with 300+ website hosted on the same host. i do not have ssh or
telnet access
(ftp and cpanel-x to do administration). no matter how hard i tried to
secure my code. few
month later there will be another mysterious files and some of it no matter
how hard i tried
to delete. i cannot delete.

i move to VPS then only feel more comfortable and control.


Re: [PHP] php framework vs just php?

2008-04-22 Thread paragasu
> You get two kinds of framework in PHP IMHO - the Glue frameworks (like
> Chisimba, CakePHP etc) and the component frameworks (like PEAR, Zend
> Framework etc).
>

personally i prefer to call "component framework" as "code library" =)


Re: [PHP] Re: php framework vs just php?

2008-04-22 Thread paragasu
> If you don't use a framework then obviously you are writing nothing but
> mickey mouse programs, and wouldn't stand a chance when it comes to
> writing
> a proper application. For example, I have just completed an ERP
> application
> which contains 130 database tables, 230 relationships and 1000
> transactions.
> Because I used a proper framework I managed to complete all of this in
> just
> 6 months. The framework allowed me to generate initial working components
> without having to write any code whatsoever - no PHP, no HTML and no SQL -
> so that I could spend the bulk of my time on the really important stuff,
> which is implementing the business rules. That is the benefit of a proper
> framework - it takes care of the boring repetitive stuff and leaves you
> more
> time to deal with the tricky stuff. If you think you can achieve the same
> level of productivity WITHOUT a framework then you are living in cloud
> cuckoo land.
>
> --
> Tony Marston
> 


wow! that is quite a big program u wrote. can you tell me what framework you
use
for the project. well, you have the point. but i know many open source php
out there
do not use specific framework.
not doing framework doesn't mean it is going to be a mickey mouse program.
at some
points, the code will built into a small library which someone might call it
framework anyway.
a good example is os-commerce and phpBB. I don't see any framework being use
there
except for specific coding guide lines. but the project still grow to be a
big program and
i bet the code can be over 10, 000 lines (i just guess, might not true) .
you may call the code mickey mouse but the thing is it still working fine.


Re: [PHP] Re: php framework vs just php?

2008-04-22 Thread paragasu
>I'm guessing, since you quoted os-commerce and phpBB, you don't know
>shit code when you see it. Just because it's popular doesn't mean the
>code is good. Have you ever tried to modify either of these? What a
>mess.
honestly, i don't and not really interested to dig inside thus code. but i
guess, modifying
the phpBB code not easier than modifying the core of codeIgniter or CakePHP.

> 10k lines of code built over a framework is not the same as 10k lines
>  that essentially required you to build your own framework.
since framework already included a thousand line of code even before you
start to
do the program, i think it will be less code if we start to write the
program on our own.
Not to mention, the framework core take a lot of diskspace. some more than
2MB of code.

My client is a small2 company. i manage to write code less than 300KB to do
everything they
ask me to do. Sure, i do not need all thus fancy feature (caching etc), i do
not need multiple
user or role based support provided by framework.


Re: [PHP] Re: php framework vs just php?

2008-04-22 Thread paragasu
> All those frameworks claim their way was perfect for making love
good joke sancar. i do not see any connection between framework and making
love.
if making love what you looking for. Porn might be a good answer for you.

> And I say, I'm 34 years old, and I got enough knowladge to how to make
love.
Everyone know how to do it the 1st time tough. I don't think anyone need too
much
time to learn one.

> And with this work load I need someting to help me make love with 3 womens
at
> a time.
I can suggest you to outsource. You need more people to do more task.
Consider paying 2
staff to do just that.


Re: [PHP] Re: php framework vs just php?

2008-04-22 Thread paragasu
> Try looking in my signature at http://www.radicore.org
wow! i read your personal website and have it on my bookmark list. i salute
you =)


Re: [PHP] Re: php framework vs just php?

2008-04-22 Thread paragasu
>I can do this in 5 minutes without having to write a
>single line of PHP, HTML or SQL. If you can't match this then you're not in
>the same league.
>-Tony Marston

i can only think of copy & paste method if i were required to write a PHP
application
without a single line of code even a simple "hello world!" application.
 i am really cannot be in the same league :( . well, i might have to work a
little harder.


Re: [PHP] Re: php framework vs just php?

2008-04-22 Thread paragasu
> imagine a cms, like drupal or joomla.  you install the thing w/ the web
> based installer then go through adding content via the web interface; u
> can
> do it :D
>
> -nathan
>

i am going to miss the fun doing programming then.

As a comparison, framework is like a canned food. available anytime you
wan't. but still, it doesn't give me the fun of cooking my own meal.
sometimes, it is not about eating that make me happy. it is  the cooking
part.
Same goes for programming. Great cooker invent good recipe and make a
factories to
produce the same product in a large number. Great programmer invent
framework so other
people can use it to create many program.
If for productivity. canned food is good.
But i think, i still prefer sweet & sour fried rice over canned food. don't
you?


[PHP] the most amazing php code i have ever seen so far

2008-04-23 Thread paragasu
i have seen many php code. i learn php on my own, and during early days with
php,
i download many open source php project and try to learn the coding on my
own.
i did see many code (ugly, spaghetti code etc). Some even  take me few
hours to figure out
how it works.

But one project using php in a very clean way. The codeis look so simple.
yet do so much thing.
Personally, i vote for www.eyeos.org project for the best php code. Anyone
know better?


Re: [PHP] the most amazing php code i have ever seen so far

2008-04-23 Thread paragasu
> Yes: mine.

kind enough to let me see your code .. =)


Re: [PHP] the most amazing php code i have ever seen so far

2008-04-23 Thread paragasu
>
> Some day I'll pac
> Sadly I have nothing worthwhile out in public right now.


everything is relative in this small world. honestly, just like you,
i also tend to think my code is good (of course because i wrote it)..
personal opinion is different than what the public might say.

some day, when you confident enough to release you code. i hope
i will be there to see.. =)


Re: [PHP] the most amazing php code i have ever seen so far

2008-04-24 Thread paragasu
On Thu, Apr 24, 2008 at 9:50 PM, Eric Butera <[EMAIL PROTECTED]> wrote:

> On Wed, Apr 23, 2008 at 3:14 PM, paragasu <[EMAIL PROTECTED]> wrote:
> >  Personally, i vote for www.eyeos.org project for the best php code.
> Anyone
> >  know better?
> >
>
> You want to see something cool?
>
> http://stubbles.net/browser/trunk/src/main/php/net/stubbles/events
>
> I don't actually use that specific code because I don't want that base
> object/serializable stuff.  I wrote something very similar that allows
> me to pre-define a mapping of classes that bind to events.  So when an
> event is fired, it will search to see if any classes have been
> registered to handle it.  Then it will lazy load them and handle the
> event.  This allows me to define a ton of classes for events and there
> isn't any overhead other than one array.
>
> That is pretty powerful to me.
>

wow.. this is the response i expected to see for all php expert programmer.
honestly, i don't know yet how it works. But, it seem so interesting to me.
do you have any live project making use of this one?


Re: [PHP] the most amazing php code i have ever seen so far

2008-04-24 Thread paragasu
On Thu, Apr 24, 2008 at 10:31 PM, tedd <[EMAIL PROTECTED]> wrote:

> The most amazing code I have ever seen?
>
> That's easy -- just about anything that Stut, Rob or Daniel provides.
>
> I have a whole library of their routines. Good stuff!
>
> Cheers,
>
> tedd
>
>
can you please give a link? i wan't to keep one too :)


Re: [PHP] peer review (was php framework vs just php?)

2008-04-25 Thread paragasu
>With this I need one function call to create the form on the page. I can
>exclude columns and set an action to be taken once the form is filled
>out.

this work for general form. but when i need to make more complicated form -
with
AJAX to look up for username (available or not). Then the class became more
and
more complicated and it is easier to work on the basic one - embedded HTML.


Re: [PHP] the most amazing php code i have ever seen so far

2008-04-25 Thread paragasu
On Sat, Apr 26, 2008 at 1:47 AM, Eric Butera <[EMAIL PROTECTED]> wrote:

> On Fri, Apr 25, 2008 at 1:29 PM, Nick Stinemates <[EMAIL PROTECTED]>
> wrote:
> >  That is a beatiful example of the observer pattern.
>
>
too bad, i can't find  any framework out there  using this concept. well, i
think
have to figure out how it works and code on my own. can anyone kind enough
to
give me a good reference to read about this?


Re: [PHP] SMS Cellular Text Messaging

2008-04-28 Thread paragasu
i use our local email-to-sms service. it is not reliable. more often than
not,
it is not delivered to user. I did found kannel project (www.kannel.org),
opensource
gateway. but still not sure how it going to work or how to roll my own
gateway.

i guess, even we have our own gateway. we have to make deal with local ISP
anyway and
it cost money. if anyone out there know how. i am really interested to
know...


[PHP] web based chat app

2008-04-28 Thread paragasu
i am planning to integrate chat application on my website.
the idea is to make online user on my website to chat to each other.
it is using PHP5+jQuery, i want it to be as light as possible. I am not sure
about the database to use, but i have 3 options.. file based, sqlite3 or
mysql5.

i am thinking to use sqlite3 because it is fast but afraid it cannot handle
many user
request (i remember reading it is not so good for multiple user). It is also
possible to use
memory based storage /dev/shm (in debian based, i read somewhere - never
tried yet)

another issue is how to make it light.The chat script should refresh
every 200ms  to get the best result or even 1 second still bring quite a
load to the web server.
anyone ever run a web based application?

or any chat based api i can use out there to save server resource?


Re: [PHP] web based chat app

2008-04-28 Thread paragasu
> im thinking you probly dont need a database unless you want to preserve
chat history.
i don't think chat history is necessary. but i need to keep some of the user
chat session
right?

> but honestly, id really think about what youll be using the database for
here..
well, i am still thinking :) .. if it is possible not to use database at all
it is better.

>hmm;  well you need to make the client side smart.. like dont actually fire
off an http request >as often if the last 3 queries all resulted in no new
message.
i did ask google. one way is to use a counter. if no new message, then
increase the counter.
On the other hand, reset the counter to zero. the counter multiple with the
request time will
make the request slower.

anyone ever make use of /dev/shm on any php project?


Re: [PHP] web based chat app

2008-04-28 Thread paragasu
> i believe the sysv-ipc functions in php can give you access to that as
well (dont quote me tho; > im to lazy to look it up atm :))
well, thanks.. i just aware of semaphore function in php. i never see anyone
use this function
yet. and i don't know how to use it .but i have something to find out then.,


Re: [PHP] SMS Cellular Text Messaging

2008-04-29 Thread paragasu
On Tue, Apr 29, 2008 at 3:23 PM, Per Jessen <[EMAIL PROTECTED]> wrote:

> paragasu wrote:
>
> > i guess, even we have our own gateway. we have to make deal with local
> > ISP anyway and it cost money. if anyone out there know how. i am
> > really interested to know...
>
> Forget your own gateway, it's way overkill unless you plan to be
> sendings thousands of SMS'es.  Just use smsclient.
>
>
> /Per Jessen, Zürich


i agree with you. it take huge amount of money to build and maintain this
type of
business.


Re: [PHP] web based chat app

2008-04-30 Thread paragasu
>
> You want light outta it?use the jabber2 server as a backend. It'll be
> done
> serving while you try to access the database. No need to do a square
> wheel,
> when a round one is invented


is there any free jabber2 server i can use?


Re: [PHP] web based chat app

2008-04-30 Thread paragasu
On Wed, Apr 30, 2008 at 4:28 PM, paragasu <[EMAIL PROTECTED]> wrote:

> You want light outta it?use the jabber2 server as a backend. It'll be
> > done
> > serving while you try to access the database. No need to do a square
> > wheel,
> > when a round one is invented
>
>
> is there any free jabber2 server i can use?
>
>
i found the jabber2 main project website. but it is not suitable for what i
wan't coz i want
to integrate the chat to my website. so online member can chat to each
other. i see a perl
implementation but no php..


Re: [PHP] web based chat app

2008-05-01 Thread paragasu
> you build one. Thats the point of it wasn't it eh?
> A friend and I made a chat with jabber throught second life (the game) and
> a
> php webpage.


interesting. i really wan't to try out your chat implementation. may i?
i don't know how to integrate php with jabber since i don't have much
understanding
on how jabber works.. :).. may give me some idea..


Re: [PHP] Any Running Simple Ajax Sample for Php

2008-05-03 Thread paragasu
On Sat, May 3, 2008 at 4:31 AM, Jon L. <[EMAIL PROTECTED]> wrote:

> If you aren't already, I recommend putting to use a JS library with Ajax
> support.
> Nothing else, they can reduce the browser compatibility overhead coding
> you'll need to do.
>
> You can pick any of many, but I'm more familiar with Prototype:
> http://prototypejs.org/
>
> ## credits.php
> 
>  /* ... */  // determine value for $credits
> print min($credits, 0);
> ?>
>
> ## credits.html
> -
> 
>  
>Checking credits...
>
>
>
>/*** Reference ***/
> http://prototypejs.org/api/periodicalExecuter
> http://prototypejs.org/api/ajax/request
> http://prototypejs.org/api/element/observe
>
>function creditsCheck(pe) {
>  new Ajax.Request('foobar.php', {
>method: 'get',
>parameters: {ts: (new Date()).getTime()}, // cache prevention
>onSuccess: function (transport) {
>  var elem = $('credits');
>  if (Number(transport.responseText) > 0) {
>elem.update('Credits remaining: ' + transport.responseText);
>  } else {
>elem.update('Credits have expired.').setStyle({background:
> '#f00'});
>pe.stop();
>  }
>},
>onFailure: function () {
>  $('credits').update('Could not determine
> credits.').setStyle({background: '#f00'});
>}
>  });
>}
>
>document.observe('dom:loaded', function () {
>  var pe = new PeriodicalExecuter(creditsCheck, 60);
>  creditsCheck(pe); // first check
>});
>
>  
> 
>
> - Jon L.
>
> On Fri, May 2, 2008 at 4:13 AM, Heysem KAYA <[EMAIL PROTECTED]>
> wrote:
>
> > Hi,
> >
> > I would like to check each minute whether the user credit is finished
> and
> > update the relevant place on page. So I have downloaded however was not
> > able
> > to run some sample ajax code.
> >
> > Is there anyone who has such a simple code to implement?
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Heysem Kaya
> >
> >
>

jQuery library also can do AJAX thing in relatively simple way. check
jquery.com


Re: [PHP] web based chat app

2008-05-03 Thread paragasu
On Fri, May 2, 2008 at 4:42 AM, Nitsan Bin-Nun <[EMAIL PROTECTED]> wrote:

> umm sorry for interupting but RTFM / STFM?
>
> btw, if you dont need history you can write an webby irc client
>
>
> On 01/05/2008, paragasu <[EMAIL PROTECTED]> wrote:
> >
> > > you build one. Thats the point of it wasn't it eh?
> > > A friend and I made a chat with jabber throught second life (the game)
> > and
> > > a
> > > php webpage.
> >
> >
> > interesting. i really wan't to try out your chat implementation. may i?
> > i don't know how to integrate php with jabber since *i don't have much
> > understanding
> > *on how jabber works.. :).. may give me some idea..
> >
>
wow.. good idea. i  overlook this option.  actually, irc server is a good
option..  tq


Re: [PHP] web based chat app

2008-05-03 Thread paragasu
On Sun, May 4, 2008 at 5:37 AM, Nitsan Bin-Nun <[EMAIL PROTECTED]> wrote:

> glad my posts are useful ;)
> anyway, you can register a channel on any server, so you dont have
> actually to run one by yourself, there are zillions of networks out there
> that are just waiting for you. you can also check pjirc, it is a jave applet
> for online irc chat, its pretty integrate-able, you can change the
> background and the whole look to feat your website, also the language, even
> Hebrew is supported :D
>
> HTH,
> Nitsan
>
>

i did try to find  opensource php + AJAX  base IRC client. but found none.
but there is a PEAR library available to connect to IRC server.  i will look
into it
and try to  write some IRC client. it gonna be fun ;)


Re: [PHP] web based chat app

2008-05-04 Thread paragasu
On Sun, May 4, 2008 at 4:47 PM, Richard Heyes <[EMAIL PROTECTED]> wrote:

> i did try to find  opensource php + AJAX  base IRC client. but found none.
> > but there is a PEAR library available to connect to IRC server.  i will
> > look
> > into it
> > and try to  write some IRC client. it gonna be fun ;)
> >
>
> Not having read the rest of the thread, I got mildly interested in this
> and made a simple web based chat thing. You can try it out with seperate
> browsers (simulating different clients). From what I remember it probably
> won't cope with the load you're refering to, but it's just an example (oh
> and (for better or worse) there's no need for an IRC server).
>
> http://www.phpguru.org/chat/chat.php


well, good example. but, it is not very convenient. i saw the code, it used
iframe and refreshing the page using meta tags. but, this method doesn't
work on all browser. if i am not
mistaken have problem with IE browser.


[PHP] php page scrapping challenge!

2008-05-04 Thread paragasu
well, this going to be fun.

the website i am trying to scrapped is http://www.cathayholdings.com.my/
it is a movie cinema website with very irritating design. They really tried
to imposed the
security to the point it is really not user friendly. The whole website
written in asp.

I really hate to go around looking for the show time for the latest movie
and decided to
build my own simple website to display the movie and show time from the
cathay cinema
my own way.

But, it is proven not so easy to do. The datetime buried deep inside the
online booking. Thus
user will be able to see the showtimes only when the user click the online
booking. Then, after
user click the online booking, the link open on a new window and generate a
cookies. this cookies
will be part of the URL. So basically, there is two cookie value pass to the
server. (one GET request & one in HTTP header)

Apart from that, they use javascript (AJAX?) to pull the showtime from the
server after you have to
click 3 times. OMG.. i only wan't to know the time and have to go thus whole
step.

using  php curl library to simulate the request just to get the movie name
and show time list from the
server. it is possible? post your code..

** no reward, just for php programming fun..


Re: [PHP] php page scrapping challenge!

2008-05-04 Thread paragasu
On Mon, May 5, 2008 at 12:06 PM, Craige Leeder <[EMAIL PROTECTED]> wrote:

> Hey Paragasu,
>
>  Sounds like fun, though not really that difficult. It is a very
>  horrible site, but it shouldnt' take that much to create the script
>  for. They do not, in-fact, use Javascript to pull the movie times from
>  the database. They reload the page with the added querystring
>  variables (for my run through):
>
>  isSearchBy=cin // How are we searching
>  visCinID=1000  // What is the cinema ID
>  visMovieName=Iron+Man// What movie do we want to see?
>
>  I'd give it a try, but I am not setup to use curl at the moment, and
>  don't anticipate having done so in time to do this.
>
>  What you need to do is access the url that assigns you your session
>  ID, and store that for subsequent curl calls to the server. You should
>  pass it with all of them. You also need to find out where they
>  generate the (what I assume is) dynamic part of their url so you can
>  use that to access the actually movie url. The part in my url was:
>  .../(3yujtbmepau3jb45a22gju55)/...
>
>  Good luck with this project, and let us know how it goes.
>  - Craige
>

ups.. nice to hear someone agree with me =) .. at least i am not alone
saying that.
beautiful website with very poor usability is  really horrible to use. I
will in fact i should
because i don't like the website usability.. get back to you later..


Re: [PHP] AI file and mapping with PHP

2008-05-08 Thread paragasu
On Wed, May 7, 2008 at 10:05 PM, Thijs Lensselink <[EMAIL PROTECTED]> wrote:

> Quoting Angelo Zanetti <[EMAIL PROTECTED]>:
>
>  Hi Guys,
>>
>> We have a project where by we have a map in ai format (vector format).
>> What
>> we want to do is to programmatically come up with a solution that say on
>> the
>> map there is a restaurant at a certain location, that we can zoom into the
>> map on that specific area.
>>
>> I really am not sure where to start. I guess image maps arent going to
>> work
>> are they?
>>
>> Should I be using the GD library for manipulating the images and doing
>> zooming? Also will the ai format be supported?
>>
>> Please guys, any tips, links or help is appreciated.
>>
>> TIA
>>
>> Angelo
>>
>>
> I think doing something like this with GD is nearly impossible.
>
> But you could import the vector image in flash/flex. Draw an invisible
> grid over it to create some sort of long / lat coordinats.
>
> Or maybe just move to the google / yahoo map API's.
>

I guess GoogleMap API can do this.  But you are working on javascript ..


Re: [PHP] Re: Plugins... (like wordpress?)

2008-05-16 Thread paragasu
there is two way you can do this (there is more). using the function
include()
to include files based on query string or using call_user_func()

you can keep all the files/modules in one folder.
pass the module reference using GET.
from the GET we can determine which function we want to call using include()

or call_user_func()

be careful, do not pass the filename for the include because it used to be
some security problem. you can do an array instead

$modules['gallery'] = 'gallery.php'; //gallery.php is filename

so we can pass the modules to the program as eg: www.domain.com/?mod=gallery
then do

include($module[$_GET['mod']]);
you can use file_exists() function to determine the file actually exist
prior to the include()..

good luck..


Re: [PHP] php4 -> php5 session problem

2008-05-16 Thread paragasu
On Fri, May 16, 2008 at 6:40 PM, Juergen Falb <[EMAIL PROTECTED]> wrote:

> Dear all,
> since upgrading to php5 I've a problem with session handling. In php4 a
> user initiated a session, the session id gets afterwards handed over to a
> payment provider. When the payment provider calls a script with the session
> id added to the query string, all session data gets loaded and everything
> works fine. When I switch to php5 all session data gets lost and the session
> file has zero length afterwards. Attached is a short script to verify the
> behaviour:
>
>  session_name('XTCtest');
> if (isset($_GET['sid'])) $sessid = session_id($_GET['sid']);
> session_start();
>
> if (isset($_GET['set']))
> $_SESSION['customer_id']=$_GET['set'];
>
> echo "testyour customer id is "
> .$_SESSION['customer_id']." and session id is
> ".session_id()."";
> ?>
>
> calling the script from machine 1 with query string "?set=4711" returns the
> correct value.
> calling the script again from machine 1 without a query string and cookies
> enabled works as expected (returns 4711).
>
> calling the script from machine 2 with query string "?XTCtest="
> or "?sid=" works perfectly on php4 and return 4711. On php5
> session data is lost and nothing is returned.
>
> Does anybody have a clue what I miss or have to change for php5?
>
> regards,
> Juergen
>
> P.S: attached are the php.ini setting for php5
>
> session.save_handler = files
> session.save_path = "/tmp"
> session.use_cookies = 1
> session.use_only_cookies = 0
> session.name = PHPSESSID
> session.auto_start = 0
> session.cookie_lifetime = 0
> session.cookie_path = /
> session.cookie_domain =
> session.serialize_handler = php
> session.gc_probability = 1
> session.gc_divisor = 1000
> session.gc_maxlifetime = 1440
> session.bug_compat_42 = 1
> session.bug_compat_warn = 1
> session.referer_check =
> session.entropy_length = 0
> session.entropy_file =
> session.cache_limiter = nocache
> session.cache_expire = 180
> session.use_trans_sid = 0
> session.hash_function = 0
> session.hash_bits_per_character = 5
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


i got the same problem last time.  The session lost after i do a page
forwarding using
the header('Location:') thing..
i fix it by adding session_write_close(); before the header()..


Re: [PHP] Re: Capture homepage screenshot

2008-06-16 Thread paragasu
well, i never try it for my self but somebody out there already develop a simple
library to convert any HTML to image.. google for html2png give me

http://marginalhacks.com/Hacks/html2jpg/

i believe there is more interesting solutions out there. tell me if
you found one.
good luck..

On 6/14/08, Manuel Lemos <[EMAIL PROTECTED]> wrote:
> Hello,
>
> on 06/13/2008 02:46 PM Shiplu said the following:
>> Hello,
>> How can i capture homepage screenshot of a webpage by php?
>>
>> I know a way.
>> I'll run a executable written in C/C++. when It will be called to process
>> a
>> screen shot It will just load the webpage in firefox and capture the
>> image.
>> It'll send the image path to php. The executable will be running.
>> The problem with this solution is, I have to run X, Firefox in my web
>> server, which doesn't look efficient for a server.
>>
>> I wanna know, is there any other way to achieve this? without creating a
>> screen shot server.
>
> If you run PHP on Windows, you can use this PHP class that was just
> released and does exactly what you need. I think it could be adapted to
> work with Firefox too.
>
> http://www.phpclasses.org/win-screenshot
>
> --
>
> Regards,
> Manuel Lemos
>
> PHP professionals looking for PHP jobs
> http://www.phpclasses.org/professionals/
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] looping through a database

2008-06-16 Thread paragasu
i am not sure what u want to do, for this case you need to tell us
about your database table
structure. i quess you have table like this.. assume the table name is
table1 and there are ten
column in it file1..file10 respectively

|table1 |
|member_id |
|file1|
|file2|
|file3|
|   :  |
|file10  |

while($row =  mysql_fecth_array($sql_result))
{
  echo display_file($row['file1']);
  echo display_file($row['file2']);
  :
  echo display_file($row['file10']);

}

function display_file($filename)
{
   if file not exist or null etc
  return   add file here link
  else
  return  display file, delete file

}

this is the idea. of course maybe not what you want, unless you can tell us what
really you want to do or what you got..

On 6/17/08, Wolf <[EMAIL PROTECTED]> wrote:
> Richard Kurth wrote:
>> Wolf wrote:
>>> Richard Kurth wrote:
 Could you please give me an idea where to start looking

 while($row=mysql_fetch_array($sql_result)){

 if ($row["number"]==1) {
 
  File 1
 This is the file
 Delete
 
 }else{
 
 File1
 
 Add
 
 }

 }
>>>
>>>
>>> What is the query being executed?
> 
>
>>>
>> This is the query being executed
>> $sql = "SELECT * FROM table WHERE members_id =" . $_SESSION["members_id"];
>> $sql_result = mysql_query($sql) or die(mysql_error());
>>
> That still pretty much tells me nothing.
>
> Does your table named table exist?
> Does your script connect or error?
> What DOES output to your screen?
> Does the schema for your table contain numbers?
>
> What happens when you use $row['number']?
>
> Or are you just hoping for someone to write your code?
>
> As written, your code will fail due to having PHP interspersed with HTML
> code.  As such, you either need to echo or exit out of the PHP areas and
> then continue.
>
> Wolf
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] Re: Early return (was: Inspiration for a Tombstone.)

2008-06-29 Thread paragasu
i am a big fan of multiple return.
it save a lot of my time and it makes my code a lot more simple and readable.

On 6/29/08, Roberto Costumero Moreno <[EMAIL PROTECTED]> wrote:
> There is a point between Multiple & early return vs. One last return, which
> is Efficiency.
>
> Imagine you have a code which makes lots of things. What is better in time?
>
> If you have early returns, your script will only do the operations it has
> to, nothing more than it has to do.
>
> If you have your data, but still keep calculating some other operations you
> don't need for this data (but maybe for another), and then you return, you
> are losing precious time of execution.
>
> And making things such as the showed above (for example):
>
> void foo(int bar)
> {
>  int rv;
>  if (bar)
>rv = 1;
>  else
>rv = 0;
>  return rv;
> }
>
>
> is not that good. Nor even the solution:
>
> function foo($bar)
> {
>  if ($bar)
>   return true;
>
>  return false;
> }
>
> Think, that if you have something like $bar (a boolean variable), and if it
> is true, you return true, it is best to do this, is better, faster, and if
> the expression is simple is legible.
>
> function foo($bar)
> {
>return $bar
> }
>
> Notice that if $bar is true, foo will return true. If $bar is false, foo
> will return False. And what if I want to return false if $bar is true and
> viceversa?
>
> Simple as this:
>
> function foo($bar)
> {
>return !$bar;
> }
>
> Notice the "!" symbol. Of course, it also is valid for expressions. What if
> have a function which returns true if I have a number even and the another
> is uneven? Should look like this
>
> function foo($even_number,$uneven_number)
> {
>return even($even_number) && uneven($uneven_number);
> }
>
> And it works and it's simple. Supposing even( ) and uneven( ) functions
> return a boolean value y the variable passed is even and uneven.
>
> Cheers
>
>
>
> On Sun, Jun 29, 2008 at 17:35, tedd <[EMAIL PROTECTED]> wrote:
>
>> At 3:25 PM +0100 6/29/08, Colin Guthrie wrote:
>>
>>> Dotan Cohen wrote:
>>>
 Why not? I do this often, but I am not a professional programmer. I
 find this to be very useful.

>>>
>>> Found another opinion/article about this. I remember reading this one a
>>> while back:
>>>
>>> http://whatimean.wordpress.com/2007/02/08/multiple-return-points-are-bad/
>>>
>>> Like I said before, I don't personally subscribe to this point of view,
>>> but it makes for interesting reading :D
>>>
>>
>> Whenever possible, I try to keep to a single return in my functions. For
>> me
>> it usually makes my life easier.
>>
>> However, there are times that if one insists on keeping to a single return
>> doctrine, then the code can become very difficult to read because of
>> additional code to maintain the requirement.
>>
>> I found an excellent example of this in DOM Scripting (page 99) by Keith
>> where he takes a sea of curly braces and reduces them down a few false
>> returns that appear immediately at the beginning of the function.
>>
>> So, in this case I clearly support multiple returns provided that they
>> appear in a logical and obvious location (i.e., in the front of the
>> function).
>>
>> Having multiple returns spread throughout a function is not conducive to
>> providing the reader with easy comprehension as to what the function is
>> doing (i.e., readability) -- which is the main reason for all of this
>> concern anyway.
>>
>> When you can easily understand what your function is doing by inspection,
>> then you are doing something right.
>>
>> Cheers,
>>
>> tedd
>>
>> PS: Nice try on the starting another thread.  :-)
>>
>> --
>> ---
>> http://sperling.com  http://ancientstones.com  http://earthstones.com
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>

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



[PHP] can you give me example of website using postgresql database?

2008-06-30 Thread paragasu
i am planning to use postgresql for my next project (social network).
anyone can point me any website using postgresql database?
it will help me a lot.. thanks..

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



Re: [PHP] can you give me example of website using postgresql database?

2008-06-30 Thread paragasu
i am afraid to rely on mysql5 since it is already purchase by sun.
there is nothing wrong about sun. but i see there is more i can do
with postgresql.


On 6/30/08, Nirmalya Lahiri <[EMAIL PROTECTED]> wrote:
> Paragasu,
> You are making a very good plan. I, from 2004 working on PostgreSQL. I can't
> show you anything because my project(web based application) is a inhouse
> intranet project, but postgresql is too much powerfull.
>
> ---
> Nirmalya Lahiri
> [+91-9433113536]
>
>
> --- On Mon, 6/30/08, paragasu <[EMAIL PROTECTED]> wrote:
>
>> From: paragasu <[EMAIL PROTECTED]>
>> Subject: [PHP] can you give me example of website using postgresql
>> database?
>> To: php-general@lists.php.net
>> Date: Monday, June 30, 2008, 5:43 PM
>> i am planning to use postgresql for my next project (social
>> network).
>> anyone can point me any website using postgresql database?
>> it will help me a lot.. thanks..
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



[PHP] Re: can you give me example of website using postgresql database?

2008-07-01 Thread paragasu
paragasu wrote:
>> I develop a relatively
>> large, in-house application using PostgreSQL that I can't wait to convert to
>> MySQL.
>
> well, you should give me a reason why you want to do this.
>
>> What exactly scares you about Sun/MySQL?
> personally, it is not about i am scared. i am still continue to use
> mysql for several
> project i did few years ago and continue support and upgrade it.
>
> for the moment, after making internet survey for few month i found out
> it might be
> worth my time trying to explore the concept of trigger etc.
>
> don't get me wrong. it is not about mysql vs postgresql. it is just
> something i believe
> worth to explore..

opps...

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



Re: [PHP] can you give me example of website using postgresql database?

2008-07-01 Thread paragasu
i agree, salesman can make a lot of difference influence costumer.
sometimes they are really a headache because salesman not really a
technical person and know nothing about technical info. always
suggesting something complicated and
irrelevant feature to costumer. wtf



On 7/1/08, Will Fitch <[EMAIL PROTECTED]> wrote:
> Touché, salesman.
>
> -Original Message-
> From: Lester Caine [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 01, 2008 10:21 AM
> To: php-general@lists.php.net
> Subject: Re: [PHP] can you give me example of website using postgresql
> database?
>
> Will Fitch wrote:
>> Assuming that a system should switch RDBMSs is a waste of time without
>> knowing the reason is asinine.  Using NDB clustering is a primary reason
> for
>> switching.  PostgreSQL is only currently PLANNING built-in replication,
> much
>> less clustering.  Not to mention that the existing system is not taking
>> advantage of ANY PostgreSQL functionality that is not already present in
>> MySQL.  So gaining performance and clustering is reason enough for me.
>
> You gave no reasons initially ... and with facilities being added all the
> time, the reason to change may evaporate before a change is made?
> Have you looked at the alternatives as well since you seem to have some work
>
> to do rather than simply changing the data source?
>
> I'm being told I have to switch to MSSQL or Oracle but the customers can't
> provide justification to do that as yet and since we are only up to a couple
>
> of gigabytes of data replicated across machines I am always looking for
> informed explanations of why a switch is necessary ;) i.e. why one database
> may be more appropriate than another.
>
> The lack of proper comparison information does make it difficult at times :(
>
> --
> Lester Caine - G8HFL
> -
> Contact - http://lsces.co.uk/lsces/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk//
> Firebird - http://www.firebirdsql.org/index.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



[PHP] scalable web gallery

2008-07-10 Thread paragasu
i am planning to create a web photo gallery. i know there is a lot
available out there,
but i really want to create my own. the problem is not about creating
the photo gallery.
i want it to be scalable.

the plan is saving the image metadata in the database and keep the
original files
in a folder. while it work perfectly, i afraid how many files 1
directory can keep.
in 1 year, there going to be more than 1000 photo uploaded or more.
sure it bring problem
to maintain thus files.

when i see big2 website out there like friendster, photobucket. the
url for the image change
like
pic-1.domain.com/images/filename.jpg
pic-2.domain.com/images/filename.jpg
etc. they seems to put the image in different subdomain. Just wan't to
ask anyone who
did create a big-big web gallery like this. How did you do it?

thanks

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



Re: [PHP] scalable web gallery

2008-07-10 Thread paragasu

Another solution that is better if you are not willing to categorize
the images is to divide them by date. You may include a date or
date-time field in the database that describes the creation date of
the image (or the upload date if you like) and divide the images into
directories per month or per year or even both. Like making a
directory 2008 and add inside sub-directories like 01,02,03... or
Jan,Feb,Mar etc. Now when you query the database you may find from the
creation date the directory that sores the image and everything is in
order. For e.g.

If the date you got from the database is 2008-01-23 and the image name
is image01.jpg then the path would be:



wow!.. this is a good idea. i really never think of this idea. i think
i want to divide the image
in a folder separated by year. thanks...

i am also wondering if there is another approach on organizing the photos.
what i heard from friends, image gallery like flickr using tag to
organize the photos.
anyone have comment on tag vs album?

On 7/10/08, Per Jessen <[EMAIL PROTECTED]> wrote:
> paragasu wrote:
>
>> i am planning to create a web photo gallery. i know there is a lot
>> available out there, but i really want to create my own. the problem
>> is not about creating  the photo gallery.
>> i want it to be scalable.
>
> The first question is - how scalable?  How many photos and how many
> users?
>
>> the plan is saving the image metadata in the database and keep the
>> original files in a folder. while it work perfectly, i afraid how many
>> files 1 directory can keep.
>
> Easily more than 100K.  Depending on your filesystem, directory access
> might slow down the bigger it gets.
>
>> in 1 year, there going to be more than 1000 photo uploaded or more.
>> sure it bring problem to maintain thus files.
>
> No, 1000 photos in a single directory will not be a problem at all.
>
>
> /Per Jessen, Zürich
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] scalable web gallery

2008-07-10 Thread paragasu
what  Robert suggest, is something exactly what the big-big photos
gallery out there used
to store their image. Distributing the image into many servers. But i
am not very sure, how
they store the image location information inside the database.

But i like the idea of using imageUId to determine where to store the image.
I think, storing image in a bucket with 100 images each can make the image more
manageable..

thanks for that idea..

On 7/11/08, Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Thu, 2008-07-10 at 15:46 +0800, paragasu wrote:
>> i am planning to create a web photo gallery. i know there is a lot
>> available out there,
>> but i really want to create my own. the problem is not about creating
>> the photo gallery.
>> i want it to be scalable.
>>
>> the plan is saving the image metadata in the database and keep the
>> original files
>> in a folder. while it work perfectly, i afraid how many files 1
>> directory can keep.
>> in 1 year, there going to be more than 1000 photo uploaded or more.
>> sure it bring problem
>> to maintain thus files.
>>
>> when i see big2 website out there like friendster, photobucket. the
>> url for the image change
>> like
>> pic-1.domain.com/images/filename.jpg
>> pic-2.domain.com/images/filename.jpg
>> etc. they seems to put the image in different subdomain. Just wan't to
>> ask anyone who
>> did create a big-big web gallery like this. How did you do it?
>
> Those guys are probably having their images hit over a million times a
> day. They also likely have millions of images. They are using multiple
> servers to load balance the image serving. Whether this also is used to
> distribute the images themselves is another question.
>
> In Linux a single directory can easily handle hundreds of thousands of
> files. If you expect there to be million in short time, you can always
> bucket the images. Bucketing involves generating some kind of ID that
> can be used to generate bucket directories. For instance if you decide
> you want 1000 buckets, you can an unique integer ID for images in the
> database and modulo the uid by 1000 to determine the bucket directory.
> This means if you have 100,000 images then there would be 1000
> directories and 100 images in each. As you grow to 1 million images you
> would approach 1000 images in 1000 directories. Server offloading can
> work similarly. And you can combine approaches. For instance if you have
> 10 servers to dedicate to images then you can do the following:
>
> $serverId = $imageUid % 10;
> $bucketId = $imageUid % 1000;
>
> $url = "http://image{$serverId}.myDomain.com";
>   ."/{$bucketId}/{$imageFile}";
>
> So for the first 20 images you would have:
>
>    http://image1.myDomain.com/1/aa.jpg
>    http://image2.myDomain.com/2/ab.jpg
>    http://image3.myDomain.com/3/ac.jpg
>    http://image4.myDomain.com/4/ad.jpg
>    http://image5.myDomain.com/5/ae.jpg
>    http://image6.myDomain.com/6/af.jpg
>    http://image7.myDomain.com/7/ag.jpg
>    http://image8.myDomain.com/8/ah.jpg
>    http://image9.myDomain.com/9/ai.jpg
>    http://image10.myDomain.com/10/aj.jpg
>    http://image1.myDomain.com/11/ak.jpg
>    http://image2.myDomain.com/12/al.jpg
>    http://image3.myDomain.com/13/am.jpg
>    http://image4.myDomain.com/14/an.jpg
>    http://image5.myDomain.com/15/ao.jpg
>    http://image6.myDomain.com/16/ap.jpg
>    http://image7.myDomain.com/17/aq.jpg
>    http://image8.myDomain.com/18/ar.jpg
>    http://image9.myDomain.com/19/as.jpg
>    http://image10.myDomain.com/20/at.jpg
>
> Of course, if you have multiple servers, you need some mechanism on the
> backend to migrate uploaded images to the appropriate server.
>
> Hope that helps.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>


Re: [PHP] scalable web gallery

2008-07-10 Thread paragasu
> As long as all the servers use the
> same physical path, then it's a no brainer.

well, for now, it might look no brainer. but in the future, i can move
the images to another
servers with few changes on dns configurations (i think so)..

On 7/11/08, Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Fri, 2008-07-11 at 07:55 +0800, paragasu wrote:
>> what  Robert suggest, is something exactly what the big-big photos
>> gallery out there used
>> to store their image. Distributing the image into many servers. But i
>> am not very sure, how
>> they store the image location information inside the database.
>>
>> But i like the idea of using imageUId to determine where to store the
>> image.
>> I think, storing image in a bucket with 100 images each can make the image
>> more
>> manageable..
>>
>> thanks for that idea..
>
> That physical location on the hard drive just needs to be a
> configuration variable for the site. As long as all the servers use the
> same physical path, then it's a no brainer.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>

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



Re: [PHP] scalable web gallery

2008-07-11 Thread paragasu
> Why not use a hash table based upon the name of the file and distribute files 
> that way?

sorry tedd, i don't really get it. but i am interested to know more
about the hash table concept.
can you explain a little bit more..

thanks..

On 7/11/08, tedd <[EMAIL PROTECTED]> wrote:
> At 10:41 AM -0400 7/10/08, Daniel Brown wrote:
>> Still, I'd create 16 subdirectories under the images directory:
>>0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f.  Then name the file as an MD5 hash of
>>the image uploaded, and place it in the directory matching the first
>>character of the new file name.
>
> Why not use a hash table based upon the name of the file and
> distribute files that way?
>
> You don't even need a directory until you actually need one -- then
> create one 'on-the-fly' and drop the file into it.
>
> As such, it's easy to find the file again by simply hashing it's name
> -- you don't even need to store a path for the file, only the name of
> the file.
>
> Cheers,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] scalable web gallery

2008-07-13 Thread paragasu
oic.. the concept is relatively simple.. thanks for the explaination daniel..

On 7/13/08, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Sat, Jul 12, 2008 at 2:37 PM, tedd <[EMAIL PROTECTED]> wrote:
>>
>> Hey, let's knock off that old shit, newlywed !
>>
>> Just because you finally got laid doesn't mean you can beat me in memory
>> loss. :-)
>
> That's "lei'd", sir.
>
> --
> 
> Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
> $59.99/mo. with no contract!
> Dedicated servers, VPS, and hosting from $2.50/mo.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] Robert Cummings

2008-09-30 Thread paragasu
i don't wan't to go off without saying congrats to Rob too!
congrats Rob.. i am quite amazed that PHP mailing list is the first
thing in your mind
after receiving that news.

I wonder what is your son name?
btw, Zend is a good name ;)

On 10/1/08, Ray Hauge <[EMAIL PROTECTED]> wrote:
> Daniel Brown wrote:
>> All:
>>
>> What was pointed as a passing mention in one thread I thought was
>> worth note in a thread of its own.  As quoted by Rob:
>>
>>> BTW, while we're off topic... my wife delivered our third child (second
>>> boy) 3 minutes after midnight yesterday :)
>>
>> I'd say that deserves a round of congratulations.  Many - most,
>> probably - of you know Rob from here, and have seen his help and
>> dedication - as well as his annoying wit ;-P - offered to any and all
>> on this list.  Quite often, it's offered when you don't especially
>> want it.  Nonetheless, it's great news, and I think we should all take
>> a moment and wonder: why the hell aren't you at the hospital with your
>> wife and newborn son, Rob?  ;-P
>>
>> Congrats to the Cummings family!
>>
>
> Oh wow, congrats Rob!  We just had our second (and last after my
> surgery) 5 months ago.
>
> Enjoy the lack of sleep :)
>
> --
> Ray Hauge
> www.primateapplications.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] Plotting Tool

2008-10-07 Thread paragasu
i am not sure if this one can be counted as OT. but, i found a JQuery
extension you can use.
it is a javascript http://code.google.com/p/flot/
and here is the result example http://ajaxian.com/archives/plotting-in-jquery

quite fancy ;)

On 10/8/08, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Tue, Oct 7, 2008 at 8:04 PM, Liz Kim <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> Anyone have any suggestions on a plotting package for PHP?
>> Nothing too crazy and fancy - just easy to read plots/graphs.
>> We were using PHPlot on our old server but it's requiring too many
>> lib's/util's to install on a new server.
>
> I think Richard Heyes was working on some of these, actually.  Not
> positive if it was plotting or just display, though.  If you check the
> archives, you might find something.  I'm CC'ing him personally, too.
>
> Here's one link of his I have from memory:
>
> http://www.phpguru.org/RGraph_dev/examples/bar.html
>
> --
> 
> More full-root dedicated server packages:
> Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
> Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
> Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
> Dedicated servers, VPS, and hosting from $2.50/mo.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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



Re: [PHP] Re: php framework vs just php?

2008-10-07 Thread paragasu
> PHP framework vs just php ?
> http://paul-m-jones.com/?p=315

according to the benchmark.Just PHP win by more than 100%  to average framework.
even the fastest solar only manage to serve 154pages/sec compare to
just php 1320pages/sec

call me outdated. but i stay with just php!

On 10/8/08, Eric Butera <[EMAIL PROTECTED]> wrote:
> On Tue, Oct 7, 2008 at 2:47 PM, Ashley Sheridan
> <[EMAIL PROTECTED]> wrote:
>> On Tue, 2008-10-07 at 11:20 -0300, uaca man wrote:
>>> Farid,
>>>
>>> I like to use PRADO(www.pradosoft.com), it is very easy to use for
>>> those who are coming from Microsoft .Net platform as it uses the same
>>> architecture. I did not like symfony, too much to read before the
>>> first example.
>>>
>>> Angelo
>>>
>>> 2008/10/6 farid lópez <[EMAIL PROTECTED]>:
>>> > what is your framework??? uacaman.
>>> >
>>> > i'm using symfony, but i'm reading the book. it's hard but there are so
>>> > many
>>> > things you can do easily with symfony!
>>> >
>>> > 2008/10/7 uaca man <[EMAIL PROTECTED]>
>>> >
>>> >> To be or not to be dump it your choice.
>>> >>
>>> >> My framework it not just awesome it is super awesome.
>>> >>
>>> >> Angelo
>>> >>
>>> >> 2008/10/6 Dan Joseph <[EMAIL PROTECTED]>:
>>> >> > On Mon, Oct 6, 2008 at 1:01 PM, Jason Pruim <[EMAIL PROTECTED]>
>>> >> > wrote:
>>> >> >
>>> >> >>
>>> >> >> But... Which framework is better? :P
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> > Oh my.. now we're gonna get all those guys popping back up telling
>>> >> > us how
>>> >> > dumb we are and how awesome their frameworks are again!
>>> >> >
>>> >> > --
>>> >> > -Dan Joseph
>>> >> >
>>> >> > www.canishosting.com - Plans start @ $1.99/month.
>>> >> >
>>> >> > "Build a man a fire, and he will be warm for the rest of the day.
>>> >> > Light a man on fire, and will be warm for the rest of his life."
>>> >> >
>>> >>
>>> >> --
>>> >> PHP General Mailing List (http://www.php.net/)
>>> >> To unsubscribe, visit: http://www.php.net/unsub.php
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> > Atte
>>> > Farid H. López Durán
>>> >
>>> > "La naturaleza del hombre es tal que puede conseguir la perfección
>>> > únicamente cuando
>>> > trabaja para el bienestar y la dignidad de sus conciudadanos".  Karl
>>> > Marx
>>> >
>>>
>> Don't frameworks introduce a lot more overhead to projects though?
>>
>>
>> Ashhttp://mail.google.com/mail/?shva=1#label/php-general/11975743c3279e0f
>> www.ashleysheridan.co.uk
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> Yep.  But there is always that balance between developer time versus
> computing time.  Usually we can start with the quick developer win and
> slowly attack slower areas.  Of course all of this is subjective and
> every case requires a unique look.
>
> Look at this:
>
> http://paul-m-jones.com/?p=315
>

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



Re: [PHP] web shot script

2008-10-18 Thread paragasu
i found  a few website provide this service but i don't remember the name.
Maybe html2png is what u looking for

http://marginalhacks.com/Hacks/html2jpg/

On 10/18/08, Nitsan Bin-Nun <[EMAIL PROTECTED]> wrote:
> In general thats what I would do:
> Install firefox on the server,
> Open FF, take a screen shot, paste it to whatever graphic editor you have,
> Save the current image to a directory
> (This idea can be done in PHP, more than that, I have already wrote it,
> if I were able to find it I would have been attached it already ;) )
>
> The other options is using something like www.browsershots.org (as far
> as I remember thats their URL) and pay them to get the first places on
> their queues.
>
> There is also a free website-thumbnailing website but it updates the
> images once a year or half so for me it doesn't usefull at all.
>
> HTH,
> Nitsan
>
> On Sat, Oct 18, 2008 at 10:59 AM, Joey <[EMAIL PROTECTED]> wrote:
>
>> Hello All,
>>
>>
>> Does anyone know of a script to capture web pages and store the image?
>>
>> Trying to see all of my sites screenshots and have it updated on occasion.
>>
>>
>>
>> Thanks!
>>
>>
>>
>> Joey
>>
>>
>

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



[PHP] Invalid byte sequence for encoding UTF-8

2008-10-30 Thread paragasu
i am using php with postgresql. when i submit post query to the
server. i have the pg_exec error

Warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid
byte sequence for encoding "UTF8": 0x93 HINT: This error can also
happen if the byte sequence does not match the encoding expected by
the server, which is controlled by "client_encoding".

is there any function to prevent this type of error. something i can
apply to any POST query
before i submit to pg_query() ?

thanks you.

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



Re: [PHP] Invalid byte sequence for encoding UTF-8

2008-10-31 Thread paragasu
i do not use any function other that addslashes on the $_POST

On 10/30/08, Lester Caine <[EMAIL PROTECTED]> wrote:
> paragasu wrote:
>> i am using php with postgresql. when i submit post query to the
>> server. i have the pg_exec error
>> 
>> Warning: pg_query() [function.pg-query]: Query failed: ERROR: invalid
>> byte sequence for encoding "UTF8": 0x93 HINT: This error can also
>> happen if the byte sequence does not match the encoding expected by
>> the server, which is controlled by "client_encoding".
>> 
>> is there any function to prevent this type of error. something i can
>> apply to any POST query
>> before i submit to pg_query() ?
>
> You probably need to tell us which functions you are using to create/modify
> the UTF8 string that you are sending as data. I does sound like a conversion
> TO UTF8 is not being carried out somewhere. PHP5 requires that only
> multi-byte
> string functions are used to handle UTF8 data
>
> --
> Lester Caine - G8HFL
> -
> Contact - http://lsces.co.uk/lsces/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk//
> Firebird - http://www.firebirdsql.org/index.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

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