@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29



Comments:

<0> hmm
<0> well anyways
<0> i'm ready to move onto something else
<0> lol...
<1> ive made a uploadFile cl*** which is in charge of uploading files. however, ive come across an issue where the upload path (currently declared in the cl***, i.e. c:\images) may need to be permanently changed. would it be better to have a settings file, where all the settings like the uploadPath are stored?
<2> sounds good
<1> ok let me rephrase
<1> i have a cl*** that uploads files. in the cl*** theres a uploadPath property (which indicates where the file will be uploaded to; i.e. c:\images) defined. is it better to have this property (setting) in an external file of some sort? that way it can also be changed permanently?
<3> nice topic this quote is amazing!
<3> reflects well this channels' spirit :p
<4> hartym: :P
<5> hahaha, I just noticed that as well.
<3> :p
<6> hey all
<1> i need to store some settings (i.e. uploadPath, among others). storing these information in a ini file be ideal?
<7> has anyone here ever worked on p***ing post data to the php cgi module? I've set up the enviorment, it exports the content length and content type, sets it to post mode, then just before it executes php-cgi it puts the post data onto the stdin of the child process that launches php-cgil.. any ideas :-P



<8> any suggestions about php5 production ready cms/cmf ? I'm currently trying to choose one for my company
<9> krz: there is a function to read a ini file to an ***oc. array
<7> well what's it need to do iliah? there's quite a few out there... php-nuke is decent do-it-all cms as long as it's using a fast mysql backend (mysql5)
<1> fangel are you using your own script to upload files?
<9> krz: yeah..
<9> krz: to read a ini file, use parse_ini_file (http://php.net/parse_ini_file)
<1> where do you keep your settings such as the upload dir (the directory where you will upload your files)
<1> fangel http://pastebin.com/533339 look at line 17. im hoping the value in that property can be changed, permanently. do you think its correct to have it in a seperate file (maybe an ini)?
<9> krz: well, normaly in a constant.. ;) but my upload system is really really strict, and renames all files to just plain md5-sum of the file and dumps it in a dir with now web-access - to fetch files again you must access a php script that feeds you the file...
<8> nuke is not suitable, we need system for programmers, not end users
<8> and rather framework then just cms
<9> krz: I normally combine it like $_SERVER['DOCUMENT_ROOT'] . '/upload', just so I avoid probs when moving server.. ;)
<10> Hi. I'm looking for a function that takes a float number and returns it with a fixed number of decimals. Such as 1.2 -> 1.20. Sorry for my bad english ;-/
<10> I know there is such a function, but I just cannot find it...
<8> Rondal: sprintf
<9> Rondal: sprintf('%1.02f', 1.2); iirc
<11> Rondal: Or number_format();
<9> Rondal: but check the sprintf man. entry if that doesn't work.. ;)
<1> fangel so its normal to have the settings in an ini file right?
<7> lol well, then I don't know it depends on what you need it for... A wiki might rub you right, of course anything you get that's open source you can change to fit your needs
<9> krz: in a .ini file thats parsed, or just in a config.php file that sets constants
<1> http://pastebin.com/533339 like the settings in line 14-17
<11> krz: I have a file which holds configuration of a fully working production site. I think it's very normal and makes it easier to maintain.
<10> thanks
<1> alright then
<1> can a cl*** access an ini file?
<12> krz: Yes
<1> using ini_get() ?
<1> is that the right function to use to retrieve values from an ini file?
<11> krz: Does it always have to be an ini file? :)
<13> can i initialize a static variable to another static var that has been declared earlier ?
<13> (php5)
<1> how does ini_get know which ini file to edit?
<14> kallei, what do you mean static?
<3> krz, i think ini_get is only for php.ini
<15> edit? You can't edit the file with ini_get / ini_set
<14> kallei, as in, in a cl***?
<13> a var that is declared as public static $var , yes in a cl***
<14> well thats a silly question, why dont you just try ;)
<3> krz, not for your own site ini file, the normal way to do it is a config.php (name it config.ini if you want, but restrict acces with htaccess)
<3> way faster than parsing a ini file every time a page is launched
<1> hartym but using a config.ini would still use the standard ini syntax right?
<16> how can i push an entry with key value into an array?
<11> krz: Usually define('CONSTANT','VALUE');
<3> krz, i think it's not a good thing to want to use ini syntax, but if you want to then there should be a cl*** to load ini that parses the ini file and makes a .inc.php cache file from that only if .ini newer than current .inc.php, used to speed up things. I think it's very much why make simple if i can make it complex
<17> irc_ need more info like?
<3> krz, usual and recognized way to do it with php is to make a .inc.php with defines in it like tws said
<1> but constant vars cant be changed though
<17> irc_ : you have an existing array and want to add some more into it?
<1> so somehting like config.inc.php ?
<16> ehm yes
<1> hartym what would inc stand for?
<17> ok then if $r=array() with values
<11> irc_: array_push()?
<13> why is this not possible:
<13> public static $var1 = 'var1';
<13>
<13> public static $var2 = self::$var1;
<16> i want to put an entry like 'phone' => '444444'
<3> krz, then a static Cl*** Config that put it in vars, with default values set at the beginning and setters/getters with __get and __set so you acces parameters with Config::getMachin() or Config::setMachin('truc')
<17> then to add $r[key]= 'value' ;



<17> you can add this way too
<3> krz, inc stands for include but you should not formalize on a name, i could name it whatever i thought at the moment
<16> ok
<1> but these static vars would be inside the cl***?
<3> of course
<1> hartym could i have a look at your config.php file just to have an idea. if you dont mind..
<3> krz, by "static cl***" i mean a cl*** chich only have static stuff in it
<18> hi
<18> anybody knows how can I access to a oracle db using php5 function oci_connect in Debian?
<19> Okay what the hell? Look at the output here: http:// 203.118.187.52/privateMessaging/index.php this is the code in index.php <pre> <?php print_r($_GET); ?>. How is $_GET['module'] being set to index?!
<3> krz, sorry but no, i use symfony so configuration is made in yml files, that are cached by .yml.php files which make defines in it
<19> It outputs this: Array([module] => index)
<1> im just a bit confused because, if the config.php file contains (lets say) uploadPath then an object, instance, of that cl*** would have to be created first. and even if the instance changes the value of uploadPath, the moment the instance is destroyed, the setting of uploadPath will too
<3> krz, what i told you was just a possible implementation not actually mine
<3> but not hard to implement
<17> par22: oci_connect(username,p***wd,$d)
<17> where $d contains address port number,host details in an array
<1> lets say for example: public static $uploadPath = 'C:\Documents and Settings\Krz\Desktop\Italfood\test\php scripts\file upload\images'; is a property of some cl***. i create an instance of that cl*** to set a new value for $uploadPath. the value is changed. but as soon as the instance of that cl*** is gone, so will the value. thus the value will be restored to its default setting, no?
<1> default setting being: C:\Documents and Settings\Krz\Desktop\Italfood\test\php scripts\file upload\images
<1> or did i misunderstand the concept?
<1> what do you guys think?
<3> krz, yes, if you want persistance you should also implement some serialization of your conig cl***
<3> s/conig/config
<3> krz, database, file, session... timtowtdi
<1> thats the thing. serialiazation is easily done if config.php is a simple flat file, not a cl***
<3> well nothing forbids you to use CConfig as a holder for content of an ini file, and exactly the same but really faster using CConfig as a holder for content of a .php cl***, you just include to read default values, then you write in php syntax to save
<3> .php file i meant
<3> not cl***
<3> well exactly the same at the end lol so dont worry
<20> any idea what version of xsl the php5 xsl functions support?
<21> if you want the first char of $str is it better to use substr($str, 0, 1) or $str{0} ?
<17> $str[0]
<22> MrNaz: $str[0]
<21> Elliot` its a string, not an array... i ***ume you mean $str{0} ?
<22> MrNaz: try it :P
<21> oh...
<21> i dont like that
<23> hello everybody
<21> i dont like that at all
<21> ambiguous syntax leads to hard to find bugs
<23> i try to upload a pic in mysql database ok done
<23> but try to display unable
<22> MrNaz: either way works really... it is just a style preference tho i heard something on the php-dev list about switching to one of the formats in 6.0... can't remember which one tho
<23> can any one help me
<15> MrNaz: Well... Make sure you get fond of it soon, as {} is going to be kicked out in PHP6
<23> $query2="select * from $album_name";
<23> $result2=mysql_query($query2);
<23> $num=mysql_numrows($result2);
<23> $i=0;
<23> while ($i < $num) {
<23> $data_form=mysql_result($result2,$i,"data_form");
<23> $title=mysql_result($result2,$i,"title");
<23> $abcd=base64_decode($data_form);
<23> echo "<br><br><br><img src='$abcd'> ";
<23> echo"$title<br><br>";
<21> Stormchaser why? its highly undesirable to be able to address a string as though it were an array... if you have a bug that ***igns a string where it should ***ign an array it'll make it that much harder to find..
<3> neon_kl, discover pastebin you're annoying for others pasting in channels
<11> MrNaz: Isn't string is actually an array of character?
<21> tws if you want you can call anything an array of bytes
<21> but semantically, no, a string is NOT an array there is a m***ive conceptual difference
<21> a string is a, well, string of characters whereas an array is a sequence of discrete values
<3> MrNaz, i don't find it ambiguous, as {} means block of code in php and [] content of an array.... a string is basically more an array of characters (c powa :D) than somthing you can put code next to... well for me {} syntax (i discovered it today :p) is really awfull
<15> MrNaz: Most non-php languages access the character index via []
<3> MrNaz, a string is an array actually...
<24> I'm doing magic quotes and mysql_real_string, now how can I reverse this? It looks kind of ugly when I echo it out..
<3> c code behind it uses char*, or char [] which is exactly the same
<21> hartym understood... but given that $var[] is already a variable level syntax, and you can never have $var{ some code here} as valid code, i think that $str[] is far more likely to yeild ambuguity than $str{}
<21> hartym yea yea as i said EVERYTHING is an array, but you dont see GD accessing jpegs as arrays of pixels accessible as $filehandle[]
<3> well i understand $a[72] as get the 72th element of $a, i don't understant $var{xxx}
<15> 73rd, actually
<3> Stormchaser, right sorry :p
<15> :)


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #php
or
Go to some related logs:

coffee dekstop
#kde
debian etch reconfigure grub
#web
#fedora
#python
Updating Portage cache slow
VMware Workstation must be set-UID root
perl, eval my
apt-get install hydra



Home  |  disclaimer  |  contact  |  submit quotes