« first day (640 days earlier)      last day (4291 days later) » 

12:00 AM
@ircmaxell I think I'll leave contains. I might implement a destructive iterator, I'm not sure.
 
play with it
 
did you see this Sorry! The page you are looking for could not be found!</strong></p>
This could be because of the following reasons:
<ul>
<li> A mistyped address</li>
<li> Temporary unavailability of the site</li>
<li> Removal of the link </li>
are you sure this url even exists... the whole response is weird, what kind of service is that, is it realiable?
 
@ircmaxell I guess allowing a non-destructive iterator lets you get things below the top, but even with a destructive iterator people could just copy it and iterate on the copy. . .
 
@LeviMorrison isn't the definition of a stack, that you can only look at the top element, add elements to the top and take elemens off? I mean is a stack with contains already something else than a stack?
 
In that case, I guess the real questions are:
Does having a destructive iterator help anything?
Does having a non-destructive iterator hurt anything?
@markus-tharkun I can conceive of a UniqueStack type of functionality, although I'm not sure it's a good thing.
 
12:07 AM
destructive keeps the semantics of stack
 
@LeviMorrison having a destructive iterator is just a convenience that fits into the definition
 
non-destructive makes it no different from any other data type, except that it's crippled in that it can't access other elements directly
 
@CharlesSprayberry Yeah you might have a point about the resource not existing. Let me check it out first thing in the morning... Cheers!
 
75k page views in July so far...
 
@ircmaxell Congratulations.
@ircmaxell The one concern I have about a destructive iterator is that it has side-effects. Most other iterators try to make things side-effect free, so you iterate on a copy.
What do you guys think about that?
 
12:10 AM
I think that in this case, it's not a side effect, but an effect...
 
@rdlowrey How about practicing some C skills and we implement default interface behavior in PHP?
@ircmaxell I'll think on it, but I think I agree with you/
 
definitely think on it. I'm not saying that I think I'm right, it's just what my gut tells me
 
std::stack doesn't have an iterator. In Java it has an iterator, but if I remember correctly it goes in the wrong order . . . which is definitely wrong.
 
12:27 AM
a destructive iterator sounds ...
you know
imho it is a very valid thing to apply some operation to all elements of a stack
without actually removing the elements
Generally I think that if the stack is iterable it should iterate exactly like a array-based stack
I.e. non-destructive and in the order the elements were pushed
 
@NikiC I think it should still preserve LIFO.
 
@LeviMorrison In what sense?
 
@NikiC It iterates in the same order it would pop them.
 
Disagree
 
12:32 AM
or rather, both behaviors make sense in different situations
That's why it would be better in my eyes to not be Traversable but to have two methods returning the respective iterators
 
Having it iterate in some other order besides LIFO doesn't make sense to me.
Can you actually give me the use-case where you would want to iterate it in array-order?
 
@LeviMorrison no, not off the top of my head
apart from just outputting the stack ^^
 
Well, let me know if you find one. In the meantime, LIFO order (non-destructive) it is.
 
some stuff using bottom up stack application
lxr.php.net/… => and some stuff using top down stack application
point being: both is useful. hard to say which of them is "more common"
 
@NikiC I can't tell what those are doing. My PHP C skills are still lousy.
 
12:40 AM
@theceo The Secure Coders Pledge http://blog.ircmaxell.com/2012/07/secure-programmers-pledge.html AWESOME. It makes me emotional. :)
 
With my limited C skills, it seems to me that they shouldn't have used a Stack to do bottom-up operations . . .
 
@NikiC but then it's not a stack, but an array. So why use a stack data structure at all...?
 
@LeviMorrison the first example is the output handler stack. The bottom up traversal is used there to create an info array of some kind
What the other usages are I don't quite understand, seems like it is applying some hooks
 
I'm really confused by this
 
Not sure whether he's trolling or not
 
12:50 AM
he has to be. Single byte decryption. that shouldn't be possible
I could see trivial cracking, but not single byte.
 
I just got my first employer contact from careers.
I'm not interested (At this very moment we're thinking about moving, so I don't want to worry about a new job until that's decided).
 
congrats though
were are you thinking about moving to?
 
Logan, UT
My wife is thinking about pursuing a masters degree there at Utah State University.
 
Ah nice
I was going to say, come over to the east coast
 
user895378
@LeviMorrison What you call "practicing" would be more like "engendering" for me. I've only just barely scratched the C surface.
 
user895378
1:03 AM
 
@rdlowrey lol
I was writing some interfaces today and was wishing I had that feature.
I've barely used Dart and I'm already missing it.
 
user895378
I feel like Dart is the hot 21-year-old waitress and PHP is my wife of several years (if I had one). I feel dirty staring at it but I just can't help myself.
 
wow, adding file_exists to an autoloader adds just 2% to the runtime of the autoload function
 
@ircmaxell He seems to be some at least remotely known security researcher/whatever
 
@NikiC which is why I'm confused
and adding require_once instead of require adds 1% to the runtime
 
1:15 AM
And I don't have the necessary background knowledge to verify his statements
But his presentation definitely is trolling
 
the single byte decryption is definitely trolling. Some of what he says makes perfect sense, but that's out there...
 
Like "It's like this, but see, I can't explain you why and I can't give you a link either"
 
user895378
@ircmaxell wow I would have expected more. That's a pretty strong argument against require in an autloader :)
 
yeah... I was aiming to prove why autoloading is bad for large applications, but I wound up proving the opposite... the tradeoff is about 75% class usage
I was expecting down around 20%
 
user895378
also, disks are only getting faster ...
 
1:21 AM
@rdlowrey , i don't see how is that related
 
no they aren't...
not as fast as the rest of the system at least
 
user895378
let me rephrase: my limited technical understanding assumes that eventually solid state drives (or some superior technology) will take over and disk access won't be as expensive.
 
RAMDISK?
 
user895378
Though I guess if processing power improves faster than disk technology it would still be a bottleneck.
 
even so, solid state is fast, but not nearly as fast as ram has become over time (meaning the difference in speed of ram from 10 years ago to today is much greater than the difference from a disk from 10 years ago to ssd of today
 
user895378
1:27 AM
Then memristors and quantum processors ... those of us plagued by optimization demons will have no end to our struggles. YE GODS!!!
 
@rdlowrey quantum processors and gods in one sentence
 
user895378
I didn't even mean to do that :)
 
good evening kind sirs
 
1:47 AM
Good evening
 
@rdlowrey , php is not made for quantum computers
 
2:04 AM
good night , fair lady
 
posted on July 17, 2012 by Larry Garfield

Aaron Winborn is a longtime Drupal contributor and friend to the community. Since his diagnosis with Amyotrophic lateral sclerosis (ALS), Aaron has been trying to enjoy time with his family, to remain productive in his work and to live as normal a life as possible. As time passes, however, the disease has made his life increasingly difficult as it attacks his nervous system. To cope with the

 
user895378
2:49 AM
I'm seriously considering doing away with all docblocks outside of the file and class level in PHP code except for @return on methods and @param on method arguments that aren't typehinted ...
 
user895378
And maybe even those. I'm not sure.
 
3:05 AM
@rdlowrey Sounds good to me.
I have one other thing I type: @var int Unix Timestamp
 
user895378
Oh, I forgot about @var for class members
 
user895378
I don't know, they docblocks just seem to cause more problems than solutions ...
 
user895378
With the ubiquity of source code sharing tools like github there's no excuse not to consult the actual source code if you have a question about an API.
 
user895378
Of course, eliminating docblocks requires that you name everything clearly and write clean code.
 
user895378
I'm going to start experimenting with PHP code sans-docblocks.
 
3:15 AM
Can anyone help me with the weird error?
1
Q: PHP array with numeric keys as string can't be used

PetahI have a PHP array that has numeric keys as a string type. But when I try and access them PHP is giving me an undefined index error. $a = (array)json_decode('{"1":1,"2":2}'); var_dump($a); var_dump(isset($a[1])); var_dump(isset($a["1"])); var_dump($a[1]); var_dump($a["1"]); Output: array (s...

 
@rdlowrey Well, mine are IDE generated. . .
And it alerts me when they are incorrect.
But honestly, if you do type-hinting, the only things that really are needed are return type.
types*
 
user895378
3:40 AM
Yeah, even docs for non-typehinted params can usually be ignored if you name the params appropriately. e.g. $bodyString or $mimeTypeArray.
 
user895378
I do think @var and @return have some value, though.
 
5:33 AM
Compiling php-src now. Going to have a look at how autoloading works from a C perspective.
 
2
Q: Which is the best practice to access config inside a function?

hookmandefine('ABSPATH', dirname(__FILE__)); //Absolute path to index $config = parse_ini_file(ABSPATH . '/' . 'config.ini'); //config file #Config is passed as paramether function getLost($where, $why, $config){ //do smth using config } #Config is accessed via global function getLost($where, $why...

 
Hi .. I am new to php .. how can I create an array to fill with it from database rows as OBJECTS..
 
@anand You want your SQL results to be objects?
Look into using PDO and PDO::FETCH_CLASS
 
@levi .. Yes I want pgSQL .. result to store in array as objects ..
 
@anand The easiest way is to use PDO for your database access. You can setFetchMode to create a class from each selection.
 
5:40 AM
@levi ... I am trying to implement the solution given by timmied on this page .. stackoverflow.com/questions/11451150/…
but I am not able to get $results as per the requirement. .
 
Oh, you don't need your objects to be in a class. It might help, but probably not.
If you have your results in an array, use:
 
$combobox_data[$row['Category]'] = $row['Name'];
 
user895378
@hookman The current answers to your posted question are of dubious quality. The best practice is to inject the singular config instance into any functions or classes that need it. This is the whole idea of dependency injection.
 
user895378
The best practice is not to use static methods or the global keyword.
 
5:44 AM
By the way, the amount of failed tests in PHP is down.
This is good news.
 
user895378
haha, that is good news.
 
@levi .. Thanks .. i need to try your given solution ..
 
posted on July 17, 2012 by Cal Evans

Blog:  http://www.phpassionate.com Twitter: @phpassionate Show Notes: http://webchat.freenode.net/ http://www.phpwomen.org/ http://protalk.me/ http://www.phpbenelux.eu http://www.pfz.nl/   Sponsored by: Engine Yard

 
@ levi .. do i need to use mysql_fetch_object($results) .. or just a simple query like this .. $result = mysql_query("select * from mytable");
 
@anand You shouldn't use mysql_query at all. It's been deprecated.
You should use mysqli (notice the i) or PDO.
 
5:51 AM
@levi .. I am working on PostgreSQL .. so .. i know there ..i can use it as pg_query() .. but dont kno .. if there is any alternative of mysqli .. for PostgreSQL
 
@anand Use PDO then.
Well, you can use pg_query, but I am not familiar with that API.
 
@rdlowrey This is exactly what i wanted as an answer! Not "you can this or that...", but "the best practice is ...". The answer of a person not quessing, but knowing. Thanks! P.S. Googling dependency injection :)
 
user895378
@hookman It can be difficult to move to dependency injection in your code, but it's really a very simple concept.
 
user895378
Your functions and classes just "ask" for exactly what they need and you give it to them.
 
@NikiC @ircmaxell I'm having trouble locating where the code that calls an autoloader is defined. I can only seem to find the declarations. I'm hoping your grok skills are better than mine.
 
5:53 AM
@Levi
will give it a try thanks ..
 
user895378
@hookman This video is a good introduction, though if you're relatively new to programming it might be a bit difficult to understand: youtu.be/RlfLCWKxHJ0
 
user895378
Even if you are, try watching it a couple of times and some of the concepts will sink in.
 
@rdlowrey I know the principles of MVC pattern, but am not that good in OOP. Thanks for supplying me with info. Videos are much easier than reading :)
 
6:09 AM
hi
Can mysql databases deployed at a website downloadable
I mean does it need more security or something?
i have a sort of foolish doubt
 
foreach(glob('*.*') as $file) unlink($file);
i recently try to use this to delete all files from my root but its delete files from my public_html folder any solution
 
please guide me
 
@techno sorry i dont have much knowledge about that
 
6:29 AM
anyone what changes need in below code to delete files from root instead of public_html
foreach(glob('*.*') as $file) unlink($file);
 
how to redirect www to http:// in php ??? any idea .... without htaccess
 
wordpress anyone?
 
6:49 AM
morning
 
morning
how are you sir
 
First one to work, and I don't have the alarm codes, sitting outside... thank god the wifi signal is strong enough :D
 
Hai!
 
7:09 AM
ohaio gozaimasu
 
there goes our UGT :D
foreach(glob('/root/*.*') as $file) unlink($file);
@DanishIqbal just change to /*.* if that is root
 
@webarto permissions issue, he is accessing via the browser
 
Hi, In my magento site, when i make my css / js files as single file , magento generating css path like
<link rel="stylesheet" type="text/css" href="/var/www/vhosts/test.com/dev/skin/frontend/default/test/css/styles.css" media="all" /> Why i got base url like this ? Kindly advice
 
@Peehaa chromium.org/administrators/… - changes for chrome extensions chrome 21 and above (also: support.google.com/chrome_webstore/bin/…)
 
@webarto Hi Mr.Webarto
 
7:15 AM
Mr. Webarto, I like that, it sounds like a web superhero... @Dinesh how may I serve you?
I don't know anything about Magento
 
@webarto Thanks, Its okay... Have a great day
Can any one know why i got base url like" /var/www/vhosts/..." in magento
 
@DanishIqbal tired ^^
 
Greetings
 
@deceze heya!
 
@hakre Bonjour Monsieur hakre. :3
 
7:21 AM
@ShyamK it's available for download at wordpress.org or via your operating system, you don't need to ask here :)
@deceze Bonjour :D
 
@webarto nothing happen after this change :(
@hakre :)
 
PHP
@Dinesh are you sure you are using Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ??
 
@DanishIqbal like @Leigh you don't have permissions to delete anything outside of www root. You need to use command line.
 
@webarto i dont have command line in Cpanel
:(
 
@DanishIqbal if you only have cpanel access, you probably shouldn't be deleting files from root anyway
 
7:25 AM
Yesterday I realized that google maps is limited to 25 locations for trip planning, it stops at Y: goo.gl/hvviB
 
Why @Leigh
 
make 2 trip plans % 25 :P @hakre
 
@PHP There is nothing changed in magento core. I just enable compression option in admin end. Once Enbale i got this issue
 
@hakre viamichelin.com can this help you perhaps
 
@webarto No I'll try another map and add a layer with the coordinates. I just need this for display purposes, that was a quick hack.
 
7:28 AM
i saw in cute ftp we can enter ftp command directly so can we do this with ftp command

or

can i login with URL
 
@hakre hmm interesting
 
@DanishIqbal do you have root access to the machine?
 
and morning all
 
@PeeHaa Morning :)
 
morning :)
 
7:32 AM
morning
 
@PeeHaa I suggest we put a chrome extension into the chrome market that allows to easily edit that administrator setting ^^
 
@Leigh i have root access of just my account
and i am able to delete files manually
but ftp shows only 10k files one time
 
@DanishIqbal i think you've been very non-specific about what you mean by root
 
@DanishIqbal what is the location (path) of the files?
 
I take it you mean, you want to delete files from your home directory
not the root directory
 
7:35 AM
@Leigh I already told him that, but he wants to delete from "root" :)
 
Can any one know why i got base url like" /var/www/vhosts/..." in magento after enable compression option magento admin end
 
@webarto well he isn't "root", so he can't delete from "root", if he wants to delete from "the root of his home directory", that is a different issue entirely
 
@hakre
 
@hakre Dang, you just made me watch that whole trip in Google's 3D route view thing. That's loooong! ;)
@PeeHaa Morning!
 
@deceze Only by feet. That's actually a plane as you can see it approaches Frankfurt am Main (FRA/EDDF).
One coordinate more and it would be out in the sea and google wouldn't render any route.
 
7:39 AM
Yeah, but watching it is long! Still going in fact. :P
 
Hello guys
howdy?
 
@TuralTeyyuboglu Ohayō?
 
@Leigh you know how they say, communication is the key.
 
Can any one knows why i got base url like" /var/www/vhosts/..." in magento after enable compression option in magento admin end ?
 
Guys. I need some advise. Trying to build php based web project for posting exercises and getting answers from students. Is there any ready to go system or I will need to build it from the ground?
 
7:42 AM
@Dinesh No. Repeating it doesn't make us remember. ;-P
 
@deceze ?))
 
it's a rollercoaster
 
@TuralTeyyuboglu Did you search for ready made systems?
 
@Leigh searched and found nothing
Maybe someone knows, or used
huh?
 
@deceze its okay
 
7:49 AM
@hakre yes I know that :P. Got a problem with it.. Trying to do single sign into a WP blog from another site.. was wondering if that was possible.. cos I can't seem to get it to work :(
 
@rlemon Where is fry in lememe?
 
@Leigh i think root which carry the www and public_html folders
and the files which i want to delete is created by cron jobs

@webarto
example file names
/acb.1
/abc.2
/abcsda.1

if i want to upload something on website i upload it in www

/www
or
/public_html
 
@DanishIqbal thats not actually the root directory, possibly your ftp session is chrooted to your home directory, but that is not root. Upload a php script with var_dump(__FILE__); in it, and it should give you the real path.
 
but it is outside of your www (public) folder
 
@webarto Why's there a .. on your root? ;P
 
7:57 AM
@deceze I guess his file browser isn't very clever :P
 
@deceze because of WinSCP :P
 
oh @webarto and @Leigh thank you so much for clearing this
you both are righ this is not root
 
facepalm
 
@DanishIqbal and try this path '../*.*', upload your file in www and run it
 
ok :)
let me chk :)
use this right
foreach(glob(../'*.*') as $file) unlink($file);
 
8:01 AM
glob('../*.*')
you forgot the quote
 
ops :)
Grate
its working :)
Thank you so much :)
any idea how much time its take to delete 100k + files
 
@DanishIqbal be more careful with how you use the word "root", you used it incorrectly and changed the whole meaning of your question.
 
@ShyamK Can mean a lot. I can only tell you it's possible. I've done it already, it works. I normally integrate that via HTTPD / Apache and the MySQL database as credential store.
 
@Leigh you are right
all files gone
 
@DanishIqbal that is totally relative
 
8:06 AM
@DanishIqbal small details are important
 
Thank you so much @webarto and @Leigh thank you so much
@Leigh you are right :)
 
rm -rf /* would be so much faster solution :D
 
but also dangerous ;)
@webarto and @Leigh thanks again :)
 
kthxbai
I hear dd if=/dev/urandom of=/dev/sda bs=512k also does the job :) @ircmaxell
 
If you do this often enough, you will end up with your original data :p
 
8:22 AM
haha, yeah, monkeys & typewriters :)
 
Sem
Good morning
 
0
Q: How to unflatten a multidimensional array in PHP?

D. Can CelasunI'm using the following function to flatten a multidimensional array: function flatten($array, $prefix = '') { $result = array(); foreach($array as $key=>$value) { if(is_array($value)) { $result = $result + flatten($value, $prefix . $key . '.'); } e...

Pretty sure there are a number of dupes for that ^
Anyone got one at hand?
 
hmmm never heard of unflatten before...
 
Yeah, basically 'foo.bar.baz'. into $foo['bar']['baz'].
"Unflatten" is actually a cute term for it.
Or maybe "crumple"? :-3
 
ah so that is unflatten :) noice
 
Sem
8:57 AM
Damn quiet in the PHP room, everyone is on holiday! :)
 
@hakre hmmm.. Hope you're not using LDAP or that kind of login.. cos if you ain't then maybe you can help me :)
was wondering how you did that??
any suggestions.. maybe directions.. :)
 
@Sem you should have been here yesterday when we insulted the knowledge of @hanleyhansen
 
9:12 AM
@Sem Everyone is working |-(
Creating new framework :)
 
ahh.. first time on stackoverflow chat :)
 
@Sisir enjoy being here
 
@DanielsPitkevičs Monday is for warmup, Tuesday is for work...
 
@DanielsPitkevičs :) thanks! I am regular on WPSE chat tough
 
@deceze Indeed
@Sisir Hope seeing you here often
 
9:19 AM
ya.. i see lots of people on the chat.. lot alive
 
ROFL, I'm in the top 30% for . I have never touched ASP in my life.
 
user557846
i try to be alive but fail mostly
 
anyone use firebug+firefox? I see on latest version they changed the inspect element functionality a lot. i kinda liked the old one..
 
hey guys .. this maybe a stupid question.. but what is the meaning of &$variable ??
 
Is it good in framework to generate html elements by patterns?
 
9:24 AM
i mean it used to show the html details of the element when mouse hover over.. cant seem to do that on current version..
 
what is the meaning of the ampersand??
 
i use this code for cron job
/usr/bin/wget http://www. example.com/directory/file.php?customer_id=2219_120471 >/dev/null 2>&1

but every time when jobs run it creates log file outside www directory

any suggestion how to stop creating logs files
 
@ShyamK Variable is passed by reference - if edit in function, the real value will be changed
 
@DanielsPitkevičs so how can I print out its value.. cos echo (&$variable); gave an error
 
9:25 AM
too ... many ... RTFM ... questions
 
@webarto ?
 
RTFM means
 
@webarto well I asked it in two lines.. so it only counts as one :P
 
@deceze I was looking at you... guy copies JS variable into PHP and tries to json_decode...
 
9:28 AM
@DanielsPitkevičs print also gives an error....
 
@ShyamK use as a normal variable - how do you print $variable?
 
Ok time to smoke
 
Is there a canonical answer for "how to traverse arrays"?
 
@DanielsPitkevičs ?? what do you mean? that I gotta assign it to another variable and then print that?
so I can't print along with the ampersand? hmm.. k
 
9:32 AM
@ShyamK What would you expect echo &$foo; to output? Doesn't make much sense...
 
@deceze sorry, basically what you have said "make sure $test is your JSON string"
hw do I convert it in to string? — user1371896 12 mins ago
O_o
 
@ShyamK echo $variable not echo &$variable
 
@webarto Naarrrgghhh!
 
9:41 AM
@deceze how to say in southern accent, women, get me my guns
imma shoot sum 'puter
already voted
 
B****, gimme ma guns! Imma go shoot som' o' dem 'puters!
 
hahaha
 
@deceze just wanted to know if there was a way to output that.. nothing else :)
maybe like a built in func. like print_r is for arrays
 
@PeeHaa It's so off topic it's WIN! :D
@ShyamK You can output the contents of a variable that is a reference. But the syntax echo &$foo; just doesn't make sense, which is why you get a syntax error.
Actually, I could go on a rant how that means that PHP has a terrible parser, but... :P
 
9:48 AM
anyone here interested on writing tutorials?
 
@Sisir I'm already busy writing a tutorial. Don't need more work ATM ;)
 
@Sisir yet another? what about?
 
morning
 
@PeeHaa well, let me know when you have a free weekend :)
 
@NikiC Morning!
 
9:52 AM
@deceze anything related with web developing will do. but html5 have a preference
 
@Sisir If there's something that needs covering, I'm all for writing tutorials. But there's already a boatload of tuts for every conceivable topic out there, especially HTML5. Before starting on yet another one I'd ask "what can I do better"?
 
@deceze :)
 
@deceze agreed!
 

« first day (640 days earlier)      last day (4291 days later) »