« first day (570 days earlier)      last day (4383 days later) » 

9:00 AM
@tereško which PoEAA book were you referring too yesterday, I see that there are loads
 
I generated that output from a single json_encode based upon a two-dimensional array, yes
 
from the code in the blog post
 
@markustharkun
 
@markustharkun , the original one
 
9:01 AM
thanks guys :)
 
Sam
@electrickoolaid42 2-d or 3-d?
 
@RepWhoringPeeHaa , FYI , that eval() code has been removed in develop branch , but there is one here now : github.com/EllisLab/CodeIgniter/blob/develop/system/core/…
 
@Sam 2-d
 
@tereško Thanks!
 
Sam
@electrickoolaid42 I think it should be 3-d
 
9:03 AM
@Sam okay; why's that?
 
Sam
@electrickoolaid42 pastebin.com/3qdkh2Z9
@electrickoolaid42 I've re-arranged it, and if you see, there should be an index for the beginning of the outer array
 
the part that's {"0": in both sets of elements?
at lines 1 and 10
 
@RepWhoringPeeHaa , also you might want to examine the usecases of load_class() function
 
because that's what has been confusing me; line 10 should be {"1":, right?
 
@tereško about the or stuff. That made me think. I think I have never seen an example of valid use of the or operator. I.e. where it was justified and readable. You've got something like that at hand by any chance?
 
Sam
9:06 AM
@electrickoolaid42 it should be like this pastebin.com/ixGB1RKp
 
@tereško Thanks bookmarked.
 
@Sam, okay, that looks better than what I have, but how do I coax that out of the json_encode?
 
when moving from 1.x to 2.x they supposedly dropped the php4 style of coding ... well .. it was implemented as replacing $foo = & new Foo; with $foo = & load_class('Foo') ;
 
out for a smoke
 
Sam
@electrickoolaid42 once you decode it, you essentially have an array back
 
9:08 AM
@tereško ... :|
 
decode it in which language? I need the array to pass to the javascript to be executed by the client machine; I found some examples on here re: passing a php array to the javascript but they're all for one-dimensional arrays and don't seem to me to be applicable to my situation
but again, very new to PHP and javascript
 
same is true for get_instance() usecases in CI
 
@Sam json_encode gives me what you've seen, I have no idea how to make it give me something more obviously usable.. unless my array in the PHP is messed up, but it's built the same way as some other code on the site that works just fine
it's almost identical, except for a different RSS feed
and I
'm not trying to pass it to javascript
 
Sam
@electrickoolaid42 you can try something similar to this: pastebin.com/ZQ9HhqY5
@electrickoolaid42 makes sense?
 
@Sam, I'm trying to interpret it
I see an extra array
and I see at line 12 $cmnt_array[] = $inner_array();
that will produce the appropriate json_encode result?
 
Sam
9:15 AM
yeah; that ensures that your current output will be in a different index, just as the solution given earlier
 
okay, I just inserted your correction into my code
and I get a runtime error
 
Sam
did you save a copy? :P
 
bah, stop preventing me from posting, stackoverflow chat
yes, I can go back
 
Sam
alright; what's the error?
 
it says function name must be a string in [file location] at line 78
 
Sam
9:17 AM
post it on pastebin, and send the link or something
 
line 78 is $cmnt_array[] = $inner_array();
 
@RepWhoringPeeHaa , also there are things like this : github.com/EllisLab/CodeIgniter/blob/develop/system/helpers/… , where variables smiley is from global scope , and you are writing to it
 
Sam
my bad; remove the parenthesis after inner_array on that line
 
@Sam, okay
 
Sam
any more errors? :D
 
9:20 AM
@Sam, cool, it works (or at least doesn't get an error anymore); let me look at the output
 
@tereško so much love
@tereško btw will github.com/teresko/fracture ever get started? Or is it a matter of so much to do so little time?
 
i has workzzzz
i get home , open up a beer , watch some youtube and then it is 1AM
 
@Sam, what happens if I use the parameter JSON_PRETTY_PRINT in the json_encode?
 
I'm in the process of trying it but for some reason my FTP client is timing out so I figured I'd ask while waiting to see the result
 
Sam
9:24 AM
try it and see; it shouldn't blow up your computer...:D
 
@RepWhoringPeeHaa the only thing done for that frameworks is ever-growing mindmap
 
Hi guys! Im a little bit confused about GIT first commit. For example I start a new PHP project - I create a dir, index file, some configs, etc. Does this "initial commit" needs to have everything you need to actually use the app or it can be just some random files Im creating on the way WHILE Im creating the app?
 
what ?
 
Sam
app's the new fad; application's sooooo 1990
@electrickoolaid42 still waiting on you,
 
@Sam still waiting on my FTP client, it appears to have died on me
@Sam my server is still up, but Filezilla doesn't want to connect to it
 
Sam
9:27 AM
@electrickoolaid42 that bugger;
 
anyone?
 
@Sam, it finally transferred. on runtime it says json_encode expects 1 paramater, not 2
which contradicts the code on the php.net manual, but...
 
Sam
@electrickoolaid42 the code I gave you has json with only one parameter
 
@Sam, right, I did this: echo json_encode($cmnt_array, JSON_PRETTY_PRINT);
that's what it doesn't like
it works fine without that
 
@r00m are you using GITHUB?
 
Sam
9:30 AM
@electrickoolaid42 ok.....did it solve the problem index problem?
 
@r00m , this is in no way related to php
 
@Sam, it appears to have done so, I'm not sure about the output, there's so many braces and brackets
here, I'll post it
 
@mUnk3y No, im on bitbucket.org. Does that matter?
 
[[{"0":{"0":"http:\/\/blog.sykonaut.net\/?p=19#comment-3"},"2":{"0":"Sat, 05 May 2012 13:47:33 +0000"},"1":{"0":"testingagain"},"3":{}}],{"1":{"0":{"0":"http:\/\/blog.sykonaut‌​.net\/?p=19#comment-2"},"2":{"0":"Sat, 05 May 2012 13:45:15 +0000"},"1":{"0":"Chris"},"3":{}}}]
 
Sam
@electrickoolaid42 holy crap, dude. pastebin's still free
 
9:32 AM
@Sam lol, I know, but for 3 lines of text I thought it'd be stupid to make you go to pastebin
@Sam I can just put everything there if it's easier for you
 
Hi, ANyone worked on 163.com?? How do i get it's consumer key??
 
Sam
Hey guys, i cant seem to get this preg_replace working, does the syntax look right?

$rssBlock = preg_replace('/<h2>.+</h2>/', '', $rssBlock);
 
@Sam also, why is element 3 an empty set in the json? I just checked to make sure, $inner_array[$i][3] = $entry->children('content', true)->encoded; has a value
 
Sam
9:36 AM
@electrickoolaid42 lol.....I dunno; it's your code; all I did was put everything into an array
 
@mUnk3y Ive read the book and understand basic principles I just dont get what needs to be in first commit. You know, the initial commit.
 
@Sam How are you still awake?
 
Sam
@electrickoolaid42 I've indented the code, and it looks pretty alright
@Nick lol....are you talking from la-la land?
 
@Sam lol, alright... so weird though. echo $inner_array[$i][3]? Values, just as it should be. json_encode cmnt_array? No values in the same element spot
 
yeah at this point on a caffeine crash
 
Sam
9:38 AM
lol.....zombie-mode?
 
@Sam it's not a problem with the addition of the inner array, either; it had no value in the earlier json, either
 
Sam
@electrickoolaid42 I know, which was why I said it's your code: you'll need to find out why it's empty
 
@Sam braaaaiiiinnnnnnsssss
 
@r00m i would say what ever you have done up until today. if it is a new project it would be as simple as a index/config/css/etc
@r00m it will start tracking changes to those files
 
Sam
@Nick you can have teresko's; he's got quite a lot to share
 
9:41 AM
json_decode and json_encode work on which version of php?
like from which version onwards?
 
@Sam it's not empty though. echo $inner_array[$i][3] returns the content of the comment, just like it's supposed to. It just seems to forget the value when it's json_encoded, there's no middle step to explain it
@Shyam K, I wanna say 5.3.0 based on php.net
 
Sam
@electrickoolaid42 does it by any reason return html content?
 
@Sam lol some might say a little too much haha, I'm going to go crash though.
goodnight everybody
 
Sam
yea.....crashing soon too; gotta be awake in about 3-4 hrs anyway
 
@Sam nope, no html, just plaintext... it COULD contain html (maybe) if someone left a comment with html in it, but I think the RSS feed generator in wordpress would do something to filter that out or escape it
 
9:43 AM
@Sam same :/
 
@RepWhoringPeeHaa , and a special present : github.com/symfony/symfony/blob/master/src/Symfony/Component/…
 
alright bye
 
@mUnk3y Ok, thanks for shedding some light on it!
 
Aah..okay...so when we use the json_decode we get an array? and when we use json_encode we get the json format?
 
Sam
@Nick alright....see ya
 
9:45 AM
or are both of them strings? what I wanna know is that if I were to use...say..print_r($json) would I get an output or not?
 
Sam
@electrickoolaid42 you sure the third index has a content?
 
@tereško Yay! goto finally I see it in live code. Sweet! You're the best
 
@Sam $inner_array[$i][3]? Yes, completely sure. Putting an echo in the code causes the site to dutifully print the text of both comments I'm trying to display
and $inner_array[$][2], if thats what you meant, gets passed to the json, so it has a value too
it's the timestamp
 
Sam
@electrickoolaid42 ok, send me the $channel content; I need to have an idea what the data contains
 
view source on this RSS feed: blog.sykonaut.net/?feed=rss2&p=19
that's the comments I'm working with
 
Sam
9:50 AM
ok
 
@r00m now give me rep you slut!
 
Sam
@electrickoolaid42 that's XML; did you use DOM or SimpleXML
?
dang
 
@Sam SimpleXML
 
Sam
the content is enclosed with CDATA, along with the 'p' tag; I suspect it might be the reason it's not being displayed
 
@Sam the content of the other RSS feed is in CDATA too and it displays fine
@Sam in fact it's identical except it's for the post itself, not its comments
 
Sam
9:58 AM
k....well, obviously, something isn't right with either the data, or the code
you said it displayed fine without json?
 
@Sam here, this is my entire .php if you wanna look at it: blog.sykonaut.net/?p=23 (look for lotd_get.php), and this is the other rss feed: blog.sykonaut.net/?feed=rss2 , and this is the website itself if you wanna see the code in action sykonaut.net/?e=3
@Sam yes, displayed fine without json
@Sam and if you look at the website, there's the json temporarily sitting on top of the show comments button
 
Sam
holy crap!; that page could blind someone, dude. black on deep blue?
:P
 
hey, I like it
my co-worker picked that color scheme when I bought the domain from my work and had to park an document on it to make sure everything was working
but I actually like it a lot
 
Sam
alrightie......as long as your users don't stone you in public for committing a design crime...:P
 
someday though, when this is beyond proof of concept, it will be prettified
 
Sam
10:04 AM
I'm replicating that XML on my system and see what json will show me
 
I'm in the "hey let's see if I can do PHP" phase, not the "let's invite people to look at my work" phase
okay
obviously, people looking at my work who're gonna help me debug it is a little different =p
 
Sam
my dr said I'm allergic to black on deep blue
 
My dr said your dr is a quack
and that he'll beat your dr up
=p
huh. on the page I linked, with the nyan cat video? show comments doesn't work now.
 
Sam
my dr. is very radical, he eats Dr. House for lunch
 
@Sam (Blue Sam) I know you asked it a long while ago, but </h2> the forward slash needed to be escaped in your regexp: <\/h2>
 
10:07 AM
oh, wait, wait, I think I know why; nvm
 
Sam
blue Sam, huh...:P; are we in Avatar?
 
we had green Sam in here the other day too.
 
Sam
rise of the Sams...:D
 
posted on May 08, 2012 by Liip

It's always the same issue... you write unit tests for a web-service, giving you a feeling of confidence about the correctness of your code. Then the service provider changes the response without notifying you. Suddenly your implementation doesn't work anymore, but even your continuous integration server says it's "all green". So what happened? Surely the fixture files you used are outdated,

 
Sam
@electrickoolaid42 it's the CDATA/HTML issue
 
10:19 AM
@Sam right on. is there anything I can do about it?
 
Sam
asking googlebot for an answer
I'm guessing you have to use JSON, right?
 
I have to display the comments in a <div> when you click show comments, then hide them when you click the same button
I'm not particular about how it gets accomplished
but right now I'm using javascript to do that, so yes
 
Sam
how about using XML?
or create the HTML in that code, and send it straight back
 
XML interpreted by JS?
 
Sam
yeah
 
10:25 AM
I know even less about javascript than PHP but I wanted to learn it more anyway, so sure
I only used PHP for the comments because it worked for the post itself
it's very strange, btw, that the comments DON'T work, because seriously, the rss feeds are nearly identical when it comes to the content part of them
 
Sam
on the flip side, as I said, you can create the whole div block in that code, and send it out as html
instead of json
 
that's what I was gonna do in the javascript but since the array is in PHP I wanted to json encode it so the javascript could do stuff with it
the server-side array isn't seen by client, as became quickly apparent when I started writing the comments stuff
*client-side code
wait, I think I already did what you're talking about and it didn't work
check lines 85-96 in the second code block: blog.sykonaut.net/?p=23
 
Sam
what do you mean it didn't work?
yes, something like that
 
it produced two <hr>'s, an empty line, and a hyperlinked hyphen that was the correct variable in the first comment, a totally wrong one for the second comment
 
Sam
once you are done with the looping, just echo the result
 
10:30 AM
but then won't the comments always show up?
I kinda like the idea of being able to show/hide them, unless it's a huge amount of work to make it happen
 
Sam
what I meant is that; once you've created the div block the way you want, you don't need to json it
you can apply any JS/CSS features you want to it
 
Sam
you can give it a class, and set its css display property to none
so, it won't show
 
I was jsoning it because that block of code 85-96 wouldn't actually output what I wanted it to
 
Sam
so, the point is, rather than wasting time with json on html content, use direct html or XML
 
10:34 AM
and I thought I needed to get the array into the javascript
here, let me change around a couple variables and I'll show you what it does
 
Sam
ok....you can build the array in JS right in that loop
 
huh, for some reason it's only displaying one comment now-- well, not even a comment, but a spot where one would go
used to show two
but check this out
hit show comments sykonaut.net/index.php?e=3
 
Sam
it shows a block with white hr on the top and bottom
 
yeah. there should be text in between the hrs
and one more set of them, not sure where the other comment went
but I'll worry about that later
the comment content, the author, and the time posted
with the latter two as a hyperlink that leads to the comment on the blog page
the hyperlink is the only thing that pops out, but without the author and time posted
the only thing there is that little hypen
*hyphen
 
Sam
can you change the background to white?
 
10:40 AM
yeah
refresh
also, let me get rid of the json echo, don't need that anymore I think
 
Sam
ahhhhh
nice color
ok....put this right inside the showComments() function
 
posted on May 08, 2012 by Henri Bergius

Heroku is a very nice Platform-as-a-Service provider that allows you to focus on writing applications instead of managing servers. If your application code is already managed in Git, in most cases you only need to create a Heroku app setup, and then git push to deploy it on Heroku. Scaling your app is easy and there are many useful add-ons available in their "app store". While Heroku got its

 
Sam
alert(html);
let me know what content it shows
 
Sam
actually, I've seen what it shows
the html content it's supposed to display is
<hr style=width:100px /><br><br><a href='http://blog.sykonaut.net/?p=19#comment-2'> - </a><br><hr style=width:100px /><br>
and that's exactly what it's displaying
 
10:45 AM
yeah, i see that
 
Sam
ok...inside your code 85-96, place this
if ($cnt_cmnts > 0)
{
$k = 0;
$html = "<hr style=width:100px /><br>";
foreach ($cmnt_array as $cmnts)
{
$html .= "<p>" . $cmnts[$k][3] . "</p><br>";
$html .= '<a href="' . $cmnts[$k][0] .  '">' . $cmnts[$k][1] .  '-' . $cmnts[$k][2] . '</a><br>';
$html .= "<hr style=width:100px /><br>";
++$k;
}
}
then run it again
 
erm.. I copied the code and now show comments does nothing
it doesn't display "no comments!", nor what it displayed before
 
Sam
do you have it online, so I can check the source code?
 
Sam
ok....the source code is displaying the right content
 
10:55 AM
could it be the nested 'p' tags? I've never done that in HTML (and didn't intentionally do it just now)... dunno if that's screwing it up
 
Sam
I see the issue
not that
 
@electrickoolaid42 is that your site?
 
Sam
give me a second
 
@RepWhoringPeeHaa yes
@Sam kk
 
@electrickoolaid42 It looks like something is horribly wrong with it
 
10:56 AM
hi all please check this pastebin.com/Wy0cbTUJ
and help me i am playing a audio file here its playing in chrome but not in other browsers @Gordon @ShyamK @Sam
 
@RepWhoringPeeHaa lol, in what way?
 
Sam
lol.....the site looks like the day after zombies raided the earth....:P
try this, electric
 
I'm tired of helping people who still use mysql_* instead of PDO or mysqli.
 
I'm a programmer, not a web designer =p
 
@Goofy we have a policy here. We don't help people who are using mysql_* functions. So sorry we cannot help you
 
Sam
10:58 AM
if ($cnt_cmnts > 0)
{
$k = 0;
$html = "<hr style=width:100px /><br>";
foreach ($cmnt_array as $cmnts)
{
$html .= "<p>" . $cmnts[$k][3] . "</p><br>" .  '<a href="' . $cmnts[$k][0] .  '">' . $cmnts[$k][1] .  '-' . $cmnts[$k][2] . '</a><br>' .  "<hr style=width:100px /><br>";
++$k;
}
}
 
@RepWhoringPeeHaa i am really sorry i am new to php please help me i will change it
 

« first day (570 days earlier)      last day (4383 days later) »