logs archiveIRC Archive / Freenode / #php / 2015 / September / 15 / 1
biberu
Sammitch: you can pass fputcsv a handle to a memory stream too
Sammitch
biberu: that's a hacky solution though
the encoding function should return a string, *then* we decide if it's written to a file or not
Dr-007
with $zip = new ZipArchive; is it required to save the file to a tmp dir. or can you simply output it directly to the user. where afterwards the file magicly dissapears
+ questionmark?
never mind, got the answer
biberu
Sammitch: that assumes we can always hold the output in memory though, it's pretty nice to just give it another type of stream depending on what we want
anyway, i just wanted to mention the option :)
Sammitch
biberu: but it's CSV, not XML. there's no hierarchy, and no reason you necessarily have to hold everything in memory.
biberu
if the function returns a string (instead of writing to a stream) you need to hold everything in memory
but it's non-issue for most cases
Sammitch
fputcsv() operates line-by line. if you have a single line that cannot be held in memory then you've got problems. :P
speaking of which, I had a dev crash a server couple weeks ago because he used GROUP_CONCAT() in mysql in such a way that it was producing fields with upwards of 20MB of text in them. :P
</NonSequitur>
poor thing kernel panicked and died
AcidReign
Sammitch: ouch
graffix
greetings!
anyone have any experience with phpstorm and xdebug?
         

biberu
Sammitch: doh, you're right ofc, somehow got to thinking about the whole document at once
AcidReign
Sammitch: but setting up a stream to do it, means you could read/write already converted data as it's streamed (probably better than line buffering)
Sammitch: I kinda jumped in on the end though, not sure what the whole story is...
Sammitch
AcidReign: I'm not saying that that's a bad idea, I'm just saying that it's ridiculous that just having a line returned as a simple string is not an option without doing some kludgery with 'php://memory'
AcidReign
(to lazy to read buffer :P)
Sammitch: Ah, I see
yes "simpler is better"
Sammitch
then you have dumb people like me writing CSV libs :P
AcidReign
simple tasks should be simple
Sammitch
don't even get me started on mime encoding/decoing in PHP
AcidReign
Sammitch: start, I dare you :p
Sammitch
AcidReign: PHP IS BAD AND YOU SHOULD FEEL BAD
AcidReign
(Action) goes to make coffee, maybe dishes, while Sammitch rants
Sammitch
(Action) grump gump grump
AcidReign
erm, do dishes, not make dishes
Bantalon
Hello
I have this pattern
How can I change it to check if the string contains EITHER big characters or small? [A-Z]+[a-z]+[0-9]+
Sammitch
[A-Za-z]+
Bantalon
Sammitch: thank you
biberu
god, need to stop these 13 days
life was supposed to get easier, but nope
13 hour*
thebuccaneersden
why would life get easier with 13 hour days?
Sammitch
3-day workweek?
thebuccaneersden
ah
I wouldnt be able to handle that.
id work a little harder for a 4 day week tho
fortunately, my company has a nice policy of giving you an extra day whenever there is a 3 day weekend due to public holiday
thus i get a 4 day weekend once a month :D
ankurk
Suppose I am using a function like this in my query SELECT CONVERT_TZ(d.thedate,'+00:00', '{$timezone}), do I need to bind the $timezone variable as well?
         

Sammitch
thebuccaneersden: I was only speculating
but I did work with a guy that did a 4x10hr week
caffinated
ankurk: if it's a quoted value, you can bind it.
ankurk
I see
Thanks caffinated.
caffinated
do you need to? no. should you? if it's possible for a user to provide the value, probably.
NoWordpressCat
3. More. Days.
caffinated
you have 3 more days, I have 3 more hours. It's new TV time!
christmas is now!
NoWordpressCat
YAY!
caffinated
well, new to me tv time.
graffix
anyone have any experience with phpstorm and xdebug?
caffinated
let me guess, you're trying to use realtime debugging and it's not working?
charginghawk
graffix: what's up?
NoWordpressCat
😸 haha
caffinated
problems with this are almost always firewall related. Keep in mind that the machine you run PHPStorm from is the server in this case, and the webserver is the client. this means that your workstation must have the connection port must be open and accessable for incoming connections.
NoWordpressCat: I don't know what's more surprising. the fact that it exists, or the fact that irssi actually rendered it properly.
Sammitch
not for me :I
caffinated
Sammitch: it's a cat head
Sammitch
p sure I have UTF8 set up correctly in this terminal too
NoWordpressCat
(Action) wonders if Sammitch is using arch.
caffinated
it could be that your present character set doesn't have that glyph mapped.
Sammitch
(o°¡° o5 ;;
caffinated
interestingly, just because you're running UTF-8 doesn't mean that the font set has a mapping.
NoWordpressCat
I installed a huge pack of fonts.
Dr-007
maybe its arabic
caffinated
it's an emoji
Dr-007
ah
you satisfied about my version NoWordpressCat?
caffinated
"Some Linux distributions support Emoji Characters after installing extra fonts. In Ubuntu or Debian based distributions this can be achieved by installing the package ttf-ancient-fonts, in Fedora or openSUSEby installing the package gdouros-symbola-fonts.[34] This will install the Symbola font."
NoWordpressCat
"infinality-bundle'
Dr-007, yup!
http://www.webupd8.org/2013/06/better-font-rendering-in-linux-with.html For those on those buntu systems.
Instructions for Fedora and Arch on this same page. Similar distros can copy.
I like how http://validator.w3.org/ 's validator improved
Cooler
is there a way to redirect the user?
to another webpage
biberu
Cooler: the most straightforward way is to send a location header
Cooler: https://en.wikipedia.org/wiki/HTTP_location
thebuccaneersden
Cooler: http://www.phpjunkyard.com/tutorials/php-redirect.php
Cooler
doesn't the header have to be send first? i need it to execute some code first
thebuccaneersden
you can execute as much code as you want
you jsut cant output anything (ie. echo or print)
biberu
just don't start sending a response body until you are ready
thebuccaneersden
unless you are using output buffering
biberu
Cooler: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#/media/File:Http_request_telnet_ubuntu.png
ash_work
can you do variadic functions in php? and further, can you do something like function myFunc($arg1 = true, $arg2 = false); myFunc($arg2 = true); (where you're omitting arg1, but setting arg2 ?
MikeSeth
!+func_get_args
php-bot
array func_get_args() - Get an array of the arguments that were passed to the function - http://php.net/func_get_args
AliG1000
In http://www.phptherightway.com/, it discusses the MVC model in the 'Interacting with Databases' section model. How should I pass parameters to models/FooModel.php so that I can create the SQL query?
Sammitch
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 next »