« first day (663 days earlier)      last day (4285 days later) » 

@Corbin The "real" silver bullet: i.stack.imgur.com/WhPyr.png
 
Wow, that is one fabulous silver bullet.
 
Fun Fact: Super::$tatic survives the PHP shutdown phase - superglobals do not!
 
@hookman passing in the same parameters over and over again gets annoying, but as someone who inherited a code base of statics a while ago and had to deal with it, trust me: you'll regret it if you don't inject as much as possible.
@hakre wait... Super::$atic is an actual thing? i thought it was just a fun styling since Class::$varname.
 
well
 
12:06 PM
@Corbin Super::$tatic is far a better name than Class::$varname, we have even considered here to trademark it.
 
ah, so it is just a styling? i thought you meant it was some $_GLOBALS abomination there for a second.
like a giant amalgam of all classes static vars
 
Well orginally someone was arguing in an answer that globals are not cool, so instead of a global, a global static class member should be preferred. The reasoning was obvious hillarious and such a bad advice, I needed to turn the bad energy into something positive.
 
i changed the top part of the script to

require_once('connectv.php');
$dbc=mysqli_connect(db_host,db_user,db_pass,db_name);
$live_id=$_SESSION['user_id'];
$imgdata="SELECT user_id,username,indenticon,chat_id FROM members WHERE user_id='$live_id'";
$imgresult=mysqli_query($dbc,$imgdata);
if($imgresult)
{
if(mysqli_num_rows($imgresult) == 1) {
$rowimg=mysqli_fetch_array($imgresult); }
$imgcode=$rowimg['indenticon'];
build_monster($imgcode,"220");
}
else
{
echo ' '.mysqli_error($imgdata);
}

i also used mysqli_error($dbc); and mysqli_error($imgresult);
 
@hakre gotta <3 PHP sometimes
throw an error_reporting(E_ALL); and ini_set('display_errors', 'On') in there
 
ok
 
12:09 PM
btw, your code flow is flawed
you shouldn't try to read from $rowimg if it isn't defined
also, there's not really a point in doing that mysqli_unm_rows. just do the mysqli_fetch_array and see if it's not false.
$row = mysqli_fetch_array(...); if ($row) { /* woo returned a result! */ }
 
trying wait
 
well, that is of course unless you are afraid that you might get more than one user, but i would imagine that user_id is a primary key. and if that were the case, a LIMIT 1 would be better than checking _num_rows
 
And if you use the object oriented interface of mysqli, you do not run that easily in all these problems btw. Iterateable resultsets you get for free, too!
They make your life easy!
 
can mysqli throw exceptions like PDO? cause i love meh some PDO exceptions
 
ii started reading a book called HEAD first php and mysql. its only a month. let me learn one thing properly. beffore i switch
 
12:13 PM
makes the flow of SQL code much less "eww" (in my mind anyway)
well, to be honest, you're not learning properly
if that book taught you that, i'd switch books
(not that anything is majorly wrong, i mean... that sounded mean lol -- i just mean that num_rows calls are extremely rarely actually needed.)
(and the flow of reading an array that might not exist is bleh)
 
fine.....
require_once('connectv.php');
$dbc=mysqli_connect(db_host,db_user,db_pass,db_name);
$live_id=$_SESSION['user_id'];
$imgdata="SELECT user_id,username,indenticon,chat_id FROM members WHERE user_id='$live_id'";
$imgresult=mysqli_query($dbc,$imgdata);
if($imgresult)
{
if(mysqli_num_rows($imgresult) == 1) {
$rowimg=mysqli_fetch_array($imgresult);
if($rowimg)
{
$imgcode=$rowimg['indenticon'];
build_monster($imgcode,"220");
}}}
else
{
error_reporting = E_ALL
display_errors = On
}
stil doesnot work
 
you can't inline the setttings in .ini format
and putit at the top
 
oowsory
 
why would you want, "if everything goes well, otherwise enable error reporting"
ini_set('display_errors', 'On'); error_reporting(E_ALL);
if it's a dev box, i woudl always develop with those two enabled
 
before <?php
?
 
12:16 PM
no, they're PHP function calls so they need to be inside of the PHP code
 
i am using notepad++ with wamp
using thaat display error for first time. :)
 
hi , how to show multi image preview before upload javascript
 
@YogeshSaroya didn't get u
 
<?php

ini_set('display_errors', 'On'); error_reporting(E_ALL);

require_once('connectv.php');
$dbc=mysqli_connect(db_host,db_user,db_pass,db_name);
$live_id=$_SESSION['user_id'];
$imgdata="SELECT user_id,username,indenticon,chat_id FROM members WHERE user_id='$live_id'";
$imgresult=mysqli_query($dbc,$imgdata);
if($imgresult)
{
if(mysqli_num_rows($imgresult) == 1) {
$rowimg=mysqli_fetch_array($imgresult);
if($rowimg)
{
$imgcode=$rowimg['indenticon'];
build_monster($imgcode,"220");
}}}
 
what exactly u want to try
 
12:17 PM
ah, @blackbee. i tend to develop with error reporting maxed out and display_errors On so i can instantly see notices/warnings/errors
the mysqli_num_rows is not strictly needed there, but it looks correct
 
but it didnot show an error. :(
 
hrmm, put a few echo's in there to see what path the code is following
also, it might be a parse error if nothing is showing up
 
Psst: ini_set('display_errors', 1); error_reporting(~0); <- full blast on errors / warnings / stricts regardless of the PHP version.
 
@hookman Yup I do remember it :)
 
@hakre oh nifty, much better than E_ALL | E_... so on
gotta love a language that's like "E_ALL -- let's make that not actually all"
 
12:20 PM
@Corbin No, use a step debugger instead, that helps much more to learn the code than echo here and there.
 
php is full of sufferings....... should if omit that imagepng(functions)
 
@RakeshShetty i have only one image on fileupload event but multi :(
 
@hakre eh for a script with more than 3 branches. (and im way too lazy to explain to him how to set that up... but.... yeah.... lol)
 
@Corbin tip don't ask whether you should use -1 instead as documented ;)
 
@blackbee The whole world is full of sufferings. Those who only complain are boring. Those who know what they want to do next aren't.
 
12:21 PM
@PeeHaa kubuntu
 
@PeeHaa wait the docs actually suggest -1? that's a bit... hacky.
 
i have been trying to sort this shit out for over 6 hours
 
@Corbin Documentation exists. The good part of Documentation is that you can pass it along.
@blackbee Oha. Time for some intervention.
 
@hakre I'm either tired or everyone is saying weird stuff. Of course... oh wait...
i get itnow... it was aimed at me/blackbee's convo not me/PeeHaa lol
7:20 AM chat may not be my wisest decision lol
 
@Lusitanian I suspect it has to do with the CA cert bundle bundled on windows (just a hunch, but will check it out tonight )
 
12:23 PM
somone said the should be a blast of errors i dont see one
........ i am not taking a break.......... c'mon help me please
 
If you feel tired, the best thing you can do is to get some sleep.
 
@Corbin don't ask ;)
 
Keep in mind that your brain works even if you do not actively notice that.
 
@PeeHaa fun bold letters just make me want to ask
 
@PeeHaa t'would be interesting
 
12:23 PM
actually i dont want to ask
letting the engine coerce a negative number into an unsigned int behind the scenes makes me a little scared
 
@YogeshSaroya wht ?
 
with jQuery
 
@blackbee sorry, but i don't know what else to tell you. try to get a feel for how the script is executing. figure out which if's its going into and which not. try to figure out where the error starts (in terms of things stop working), and then figure out why the state of the program is such as it is at that point. If you want to get crazy with it, you could hook up xdebug and go break point crazy, but i'm not getting into that... :p
 
can u help me to get this this working. as soon as the query is being put inside the script, the image flows through the gutter........... can't be some other way to display a unique image for a particular user. i mean so that the avatar doesnot change with login and logout
 
ok, do this... i'm guessing you have phpmyadmin set up, right?
instead of running the query
echo it instead
then copy it into phpmyadmin and see what kind of results it returns
 
12:26 PM
@blackbee There is always some way to do that. The only thing you need to find is the way to achieve that. That's also dependent how you understand these things and therefore subjective. We can not push learning to you and then you get it. That's not how things work.
However if you decide to turn into a computer your own, we could program you to do that.
 
where in phpmyadmmin do i copy this. echo 'SELECT*FROM....'?
 
So please turn into a computer and come back.
 
go into the database you want on the side pane, then click on teh SQL tab
anyway, im going to head to sleep
good luck :D
 
@Corbin hehe
 
@blackbee No-where. However you can put and SQL query in there: siteground.com/tutorials/phpmyadmin/phpmyadmin_mysql_query.htm
 
12:29 PM
ha...... if it doesnot work. then is there any other thing that is constant for a particular user and doenot need a query
 
@hakre there's a tutorial for that.... omg i hate PHP.
well.... you have the user's user_id.
but im assuming you want to incorporate the text in the column into your image
 
@Corbin Probably it's not only that you hate PHP but also that PHP hates you.
 
no Corbin, i whisper to myself, go to sleep
 
its a single digit number..... 1,2,3
 
@hakre well i don't hate the language so much as i hate the state of the learning resources.
well ive kinda grown to have a secret hatred of all < 2 year programmers in general. but.... sshhhhh....
 
12:31 PM
@Corbin Well that one has been written by that hosting company to tell their users what they can do with the software that runs on their host. I do not think that's particularly bad.
 
well, i like when people try,but some of the crap i see on SO makes me rip my hair out
 
welcome to the real live. programming has been become more or less popular.
 
@hakre well... it's just phpmyadmin is pretty intuitive if you look at it for more than 30 seconds. maybe i've gotten bad at remembering what seeing new things was like though...
no, i think it's actually becoming more popular slowly.
well after the dot-com fall.
idk maybe it's just because im in a uni all day surrounded by people who forgot how to think
 
@Corbin You can not explain the facebook fail with the dotcom fail.
 
"can anyone help me with this?"
"uhhh..... that's not even sort of valid C"
oh im not trying to link the two
im saying that there's been an increase in new programmers
not related to financials
then again, once again, i'm not particularly exposed to the wide world of the work force of programming much. maybe i just assume that the huge volume of noob questions at SO is a good enough indication when it's not.
 
12:34 PM
"SELECT user_id,username,indenticon,chat_id FROM members WHERE user_id='$live_id'"; what is the misttake here?
 
well, no... not noob questions. im fine with those. programming is hard. the problem is when you see 4903845 questions a day of "whai this nou work?" without even posting any code or anything.
user_id is probably an int meaning the val shouldnt be in quotes, but hat wouldn't cause an error
it's prob a mistyped field or something
looks like valid syntax at first glance
 
i wrote it in the same way in regstratioon and login forms. but it didint produce errors........
still i will check
 
@Corbin I am not going for static or global. But its different to pass something to constructor, or to pass to every single function in the file
 
btw how will it know that $live_id is $_SESSION['user_id']
 
then it must be something else. if the query is the problem but the query seems valid, think of what it could be. var_dump the $live_id and see what that is. make sure its' an existing user. then make sure the DB conn is actualyl connected, and so on.
wait, $live_id isn't defined anywhere
 
12:37 PM
is it possible to create script that would automatically vote in online poll?
 
... it won't know then :)
 
'".$_SESSION['user_id']."' is this syntax ok to replace $live_id
 
Any alternatives to PHP_codesniffer?
 
@hookman well when you're talking about functions, there is no way to maintain state unless you pass parameters. globals and statics are the only other option. if you want stated-objects then use objects. otherwise, you'll need to either use globals (or their friends, statics), or pass in params. after all, objects basically are just functions that have a silent $this param every time theyre called. (please no one get into details on the silent $this... me's tired)
@blackbee that should work
 
12:39 PM
@hookman Yes that is really different. Question is if you can move related code into units of it's own so that you only need to pass the units and then call functions instead of calling functions, always, ever, global.
 
@blackbee i'd prob get rid of the single quotes in teh query and cast the user_id to an int, but that's just beacause im a paranoid pedant
 
ok
 
@hookman oh, did i completely misread that? is the question how to organize functions? i was thinking how to pass data around... my bad lol
 
@hookman So basically the examples of your OP are not real examples of what you use in your code (class oriented vs functional). And you are using functional? correct?
 
@Corbin yes, i have functions
 
12:41 PM
42 chat messsages in queue
win
 
@Corbin /app/core/core.php => functions.... , /app/modules/default.php => functions ... etc
 
ohhhhhhh, so you're question isn't whether or nto you should pass in the params.... ahhh i get it now. slow moment. you're wondering if there's anything like a DI system for functions?
 
"SELECT user_id,username,chat_id FROM members WHERE user_id=".$_SESSION['user_id']."";
still doesnot work
 
so you don't have to manually string all teh dependencies through the code?
 
As functions are global, and if you are using procedural programming, you can pass parameters globally via global variables. Those are powerful, so do not abuse them but use them sparsely. Keep in mind that this will make your applications code hard to test and to maintain after some time. However, you can start to create units of some parts later on and migrate peu à peu.
 
12:43 PM
@blackbee echo the query and make sure it's what you expect.
@blackbee also, is it failing, or returning no rows?
 
yups
 
Brain donations accepted. Just throw in some brain into this chat (but don't kill Kenny). Thank you!
 
@Corbin I'm actually asking if I can move to objects without moving to framework
 
but... but... i love killing kenny. and dont have any brain to offer.
oh, sorry, @hookman. ive completely wasted like 10 minutes of everyone's time x.x.
 
@hookman A framework is something that is never moved.
 
12:45 PM
there's of course no obligation to use a framework, but after you start doing OO long enough, you're find yourself creating your own on accident.
 
@Corbin blah
 
it's definitely possible to intermix procedural and OO code though
@hakre blah at meh framework blah-ness, or at my bloodlust for kenny
?
 
@Corbin I belive I need to make own small framework, just for aducational purposes
 
or maybe bloodlust towards kenny... bloodlust for him kind of implies that i'm wanting to fight for him >.<
 
I think hookman has an actual question that one first needs to want to understand otherwise it's not helpful.
 
12:47 PM
@hakre yeah.... it should be sleepy time for keyboard-happy Corbin lol
 
what i noticed just now is the saame piece of query works when i am using it to print the username. there is certain no error in query then......... i mean i think so...... else how is the valid username getting printed
 
i think i understand the question now, but am prob not qualified to address it... lol. i'm a bad person to ask about frameworks :)
 
@hookman No, you should only write some code, not some framework. Starting with a framework means to solve the wrong problems which solves nothing but hinders you to solve the right problems.
 
@blackbee not sure what else to tell you other than debug more. try to figure out where the flow of the program is deviating from what you think it's doing.
 
You can only write a framework when you actually have a target audience you know about their needs. So you never write a framework for your own, not even educational.
 
12:48 PM
anyway, i am going to bed for real this time... bye everyone, and good luck, @blackbee
 
@Corbin bye
 
there should be a silent law of programming: "if you write a framework alone, you're going to do it wrong."
but im starting to spew crap again, so, sleepy time :)
 
Good night @Corbin. (Sun is comming out here)
 
thanks, hakre and hookamn
man*
 
thanks for talking
 
12:50 PM
@hakre by framework, i meant an basic sceleton for all my apps which is reusable
 
glad to help, @blackbee. well, try to help... :D
 
@hookman thats called a library
 
@hakre following the MVC pattern
 
fyn....... but i echo the result and it showed the result without any error.
 
@PeeHaa is Yadeo a library?
 
12:52 PM
@hookman Currently it is just a set of interfaces and nothing more ;)
 
@PeeHaa where is MFW_Controller located?
 
@hookman You found that in my Yadeo project??? :O
Or are you looking at my "Micro"FW? ;)
 
@Corbin u have an email id?
 
@PeeHaa In Yadeo project
@PeeHaa All of your controllers are ancestors of MFW_Controller, but I don't see one in Yadeo
 
BTW if PAHP or PIMP were faster than PHP, I am sure many would switch despite it being not quite compatible with legacy PHP code. (PAHP = PAHP Aint PHP, PIMP = PIMP Is My PHP)
 
1:03 PM
@PeeHaa wth you have a base controller class in your microfw
 
@hookman Eeek. That shouldn't be in there. Sounds like some sloppy copy patsa. Where in yadeo do I have controllers????
 
i no longer know you :)
 
You could try jquery ajax, it's much easier api.jquery.com/jQuery.ajaxAndrei Cristian Prodan 2 mins ago
 
@Whisperity needs moar jquery
 
@Lusitanian :-) In my defense. I didn't know nay better 1 year ago :D
 
1:04 PM
@Lusitanian Indeed it does! @webarto
 
@Lusitanian ps there is a lot moar wrong with it than just that :P
 
@PeeHaa fair enough and i didn't look beyond that
 
-1
Q: Trying to load certain function from open source script

soft genicI have been trying to load function from the js script of detecting mobile browser in the detection code i downloaded from http://detectmobilebrowsers.com/ all i want is when the check on browser becomes successfl then it loads up abc() function . I tried (navigator.userAgent||navigator.vendor|...

> I tried but due to messy code andas being a beginner i could not perform the functionality.
 
@hookman I don't get it. Yadeo only contains interfaces (no actual code is in there) so I don't see how there could be a controller in there
 
   //--for simplicity's sake, first create the grouping column
   //--screw simplicity, we'll dive right in and create it on the fly
   //--no, create the column first
actual comments i just read
 
@mrtunes hiya :)
 
@PeeHaa, whats wrong with you today? You're far too cheerful/helpful
 
You sure there aren't any javascript errors on the page?
@Leigh are we talking about the the chat invite?
 
@PeeHaa There's been at least two chat invites today! :)
 
@PeeHaa there shouldn't be, it would make sense that soundmanager can't play the file because it's not explicitly mp3
but i'm sure there's a way to trick it
 
1:11 PM
WHO IMPLEMENTS A LINKED LIST WITH ARRAYS AAAA
the...spl...exists...for...a...reason
 
PHP devs?
 
@Lusitanian SPL is borken
 
@Leigh Some things are easier to do in chat instead of spamming the comments full of debugging :)
 
@PeeHaa I know, but you're being very helpful today, just an observation.
 
And besides i really like the soundcloud service and the soundmanager lib :D 'What can I say. I'm a fan :)
 
1:13 PM
i retrived the username from cookie.... instead of taking it from database.. that apparently solved the problem...........
 
@mrtunes Can you dump your relevant code on pastebin so I can have a look?
 
@hookman The basic skeleton for all your apps which is reuseable is the library folder and the package manger. Take a look into the symfony2 class loader which shows how that work and has the pointers to Composer which is a lightweight package manager in PHP: symfony.com/doc/current/components/class_loader.html
@hookman There is not much pattern as of MVC in procedural code. At least not if you just dip in. Who told you that MVC is cool?
 
@hakre I thought tereško was promoting MVC under the recursive acronym, MVC is Very Cool
 
@Leigh nice one!
 
@PeeHaa i will give it a shot
 
1:16 PM
Moar Very Code
 
Oh yea, that was it ;)
 
@hakre tell @Corbin about it
 
but MVC is Very Cool is some nice joke, too.
@blackbee He fall asleep :(
 
and HMVC makes veterans cry?
 
tell him when he comes back
 
1:19 PM
@Leigh Why should it? If you have got a problem for which that is the way to go, why should one cry? Same for MVC btw. The problem is only the other way round: Whatever the problem is, I use MVC. That is so wrong. We know that this is Super::$tatic not MVC.
@blackbee What should I tell him?
 
is there a stream_* equivalent in Ruby?
 
@hakre I don't know why it would make them cry, I just picked words that started with the right letters...
 
@hakre thanks but damn it I can't read Ruby
 
1:21 PM
@Leigh Like MVVM? MVPCF? MVVMC? HDMVC? HTMVPTC?
It's all roman numbers in the end.
 
now there is a pattern
 
The holy grail of paradigsm: If it can be expressed as a Roman Numeral, it rocks.
Long live the Empire. ;)
 
@hakre oh I see, so MVC is 1095?
 
Which is the hidden revision number of some framework, but do not tell anyone, psst.
 
what is the difference bettwen using $_COOKIE and $_ENV
 
1:25 PM
Sounds fair: codepad.org/t7VrXyDT
 
which one do you prefer 1105 or 1110?
 
MCV or MCX?
 
Sounds not so fair: codepad.org/Hczd5pZt :/
But I guess that is the price of ArrayAccess.
 
@mrtunes Please enable debug mode to see what is happening: schillmania.com/projects/soundmanager2/doc
 
Let the tattle tailing begin meta.stackoverflow.com/questions/137744/…
 
1:30 PM
lololo
 
@hakre Shouldn't this give an "undefined index" or some sort of error?
 
@Whisperity No, it is an unset. Used for that, to undefine the index. So no need to warn, the function will unset that (non-existing) index.
 
Joomla is the red-headed stepchild of CMSs
 
@hakre Still we are accessing an integer like it was an array.
 
@PeeHaa what am i looking for in debug mode?
it loads the other files on the page cleanly
but for the soundcloud one it goes directly to the file - i see now because after the .mp3 there are new parameters for authenticating
 
1:35 PM
screw you WIN7 I say... back to XP...
 
so i click the file and it goes to ec-media.soundcloud.com/…
 
And their bug-squad is internally known as Comedo Squeezers or what?
 
1:50 PM
who is dat? Qt from Nokia? user -3
 
Is there a better way to do this: str_replace(array(',,,', ',,'), array(',', ',', ', '), "$row->address1,$row->address2,$row->city,$row->country")
basically, if any of the items are empty, there won't be any duplicate commas.
 
@mrtunes Do you have an example of an URL to a track?
 
@Christian the purpose of that? Experimenting, right?
 
OK, I misunderstood your phrase.
I've asked if there's any easy (and sane!) way to that problem.
 
@Christian what if address contains comma?
 
2:03 PM
Plays well with it.
 
strpos(",,", "$row->address1,$row->address2,$row->city,$row->country") ?
the last one would be the problem though
 
In general, you wouldn't want double-commas either case.
@webarto Yeah, but it kind of sounds overkill to me.
It's a pretty common situation anyway.
 
:\ is that a real world example?
 
okay wtf. why does $var = 'A'; $var++; set var to b but $var = 'A'; $var = $var +1; eff everything up
 
@Lusitanian Because one is increment and the other addition of two different types.
 
2:16 PM
^
 
@deceze right but php's behavior is so foobar anyway with this
meh, whatever
 
Back from some tree climbing... ^_^
 
understandable though
 
Arms are tired. Wonder if I can type some code now. ^_^;;
 
@deceze Don't you mean, "Arasm are tire. wonder if I can typaoe some codenoaew" ?
 
2:19 PM
@salathe Tnaks fro teh crorrerrictn
 
yor wlecome
 
2:35 PM
Good morning
 
howdy
 
god moarn ring
 
morning
 
Yo dudes
I'm in a pain of ignorance
great karma to the solver of my issue:
I have a simple php app with a login page (not even secure), and on chrome only, from certain machines I have to login twice to get to the page
Which causes me great deal of suffering becuase I should be going home in like 20 mins
I've searched the webs too :(
 
sun is shinning, my car broke down, I searched the manual too... and I should be home 20 mins ago...
 
2:43 PM
@MeLight Debug your conditionals that decide whether or not you're logged in.. and go from there
 
@MikeB thanks, was hoping that that's a known issue :-/
 
Did you set php.make_them_login_twice = false?
 
:P
 
Morning all
 
Thats a good one actually
even 10 minutes before the end of the day
:D
 
2:55 PM
Hey there
off topic - got an iMac yesterday :)
 
@JordanRichards First Mac?
 
Yeah :D
 
Good on you. ;)
 
Thanks
desceze, are you willing to go to a seporate room with me?
I'm switching from mysql to mysqli
I need some help
 
Hey man... that's a bit sudden... I don't really know you that well yet... blush
And I don't really have the time either right now. :)
 
2:57 PM
lol!
Okay
I get these annoying errors
 
I solved it
although it makes me think...
 
everyone was telling me to switch
so I tried
then messed up my code with mysqli errors
now all my hard work is messed up because of the sql not executing due to mysqli errors
I need help on fixing them
 
@MikeB make_them_login_twice is something that preventer of Information from Dilbert would do btw
 
Anyone?
 
Don't ask whether someone is here or can help. Just tell us your problem. If anybody can and wants to help, they will.
 

« first day (663 days earlier)      last day (4285 days later) »