« first day (1354 days earlier)      last day (3600 days later) » 

2:00 PM
@RonniSkansing I have made a little progress, but it has only put me more in the dark, and now I have much less idea what to do!!!!!
 
@IlyaManyahin lol that looks odd indeed :P
Maybe go with @DaveRandom's advice?
 
If I wasn't stressed, pissed off etc. this morning, what about now?!!
 
3 mins ago, by DaveRandom
what happens when you git reset --hard ? (with care, obv.)
 
@Billy maybe you need to not use that adaptive-image libary
 
@PeeHaa and really it is a problem, because i can't merge branches
 
2:00 PM
@jimbo have you tried a select() in the query_builder closure?
 
or need the time to carefully review it
 
@RonniSkansing it's like 50% of the specs for the site
 
as your hosting makes some changes to the paths
 
@AlmaDo i have a question on js. i have a html page (output.html) which has only a script in it.
`<script> function foo() { console.log('oof') } </script>`
now in index.html i send a ajax request to output.html ; the responseText i get is the code in the output.html . I write this responseText into a div in index.html with innerHTML but sadly, there is no output in console.
 
And it should be a script that just works
 
2:01 PM
@CarrieKendall Nope, I currently have:
'query_builder' => function(ServerRepository $serverRepository) {
    return $serverRepository->createQueryBuilder('s');
},
 
@Billy nothing is like that I am afraid
 
@RonniSkansing it is like that
 
@Billy Let's give it one more shot
 
all the other people that use it have no problems
 
@shortCircuit you really better to ask good js people. Since my level is at best only a little above state which is normally called "noob"
 
2:01 PM
Describe to me, from the start, what the problem is, what do you have, what are you getting, and what are you expecting to get.
 
@SecondRikudo Please, take some money in return for some actual, dedicated help (NOT that you weren't helping before)
 
@Gordon careful, that suggestion makes him mad :P
 
You were both helpful to me before
 
@Billy I will not take money.
56 secs ago, by Second Rikudo
Describe to me, from the start, what the problem is, what do you have, what are you getting, and what are you expecting to get.
 
@AlmaDo they ask me to fiddle it. i donot know how to achieve the same in iddle. There are two files involved
 
2:03 PM
@SecondRikudo When I removed the $document_root from adaptive images (and from my test script), mkdir() now works. But now, all my image files are just blank (I assume removing document root broke the script in other places)
image files script's output
 
@Billy Could you provide an example? You can edit previous messages with the up arrow
 
I have one moment
 
@RonniSkansing Only one?
 
this is the sinister script
 
2:04 PM
@SecondRikudo I know, but it will ping you again, and it always annoys me
so I don't edit pings
 
@SecondRikudo Wanne go and fight a little? html and css is killing me :(
(read IE is killing me)
 
You can always remove my ping from it :) Like so.
 
@IlyaManyahin git add application/classes/connection/Paypal.php && git show plz
 
@Naruto I haven't had the displeasure of working with IE for quite a while
 
Good point :)
 
2:05 PM
@Billy Yes, what is the script running behind that?
 
Yes the adaptive-images.php
 
Could you post it?
 
@SecondRikudo it is the one I linked you
 
If I replace the $_SERVER['DOCUMENT_ROOT']; you will see the mkdir() permission errors I had before
 
@SecondRikudo How does it feel? I wish I knew how that feeling was :(
 
2:07 PM
Anyone know if it's possible to get SplDoublyLinkedList::add() behaviour in 5.4 in an O(1) manner?
(I'm not particularly attached to a dll if something else will do it)
 
@Jimbo something like pastebin.com/P8iuk7HN ?
 
@Billy Try adding echo "whatever"; at the top of that file
 
this sql migration is killing me, wasted so many hours already...
this is the output of a rather complicated query and below is what I actually want: http://paste.jesse-obrien.ca/7M9
Can someone point me in the right direction? distinct is not help as it is giving me the same value instead of 3 different ones
 
@SecondRikudo Ok, I did, and it shows up on the image file
 
@Billy Good, so you do see errors, it's just that the file returns an empty output.
 
2:09 PM
@Patrick Not without seeing the current query as well
m-m-m-m-m-multiping!
 
@Billy Add echo $filename inside of sendImage() function
 
@CarrieKendall I can't do that unfortunately, createQueryBuilder() requires a first parameter. But I couldn't get it working similar to your example. It should be returning the whole * by default shouldn't it?
 
@Jimbo yeah, i'm curious why you want to change default behavior because it will mess with the form binding on submit afaik
 
@SecondRikudo I think headers are already sent at that point
 
http://paste.jesse-obrien.ca/7Mf
Not sure if that makes any sense but here it is... :)
 
2:11 PM
@Billy That's not what I care about
I want to see what filename it's trying to load
 
Ok, well nothing is outputting
I thought that might be because of the header stuff
 
@Billy You removed the echo "whatever"?
 
Yes
 
Add it back
 
OK, done
 
2:12 PM
Also, you didn't add the echo $filename after exit didn't you? :P
 
I think it goes header('404 ... before it hits that
 
^^
 
@AlmaDo can you show what you have come up with ?
 
@SecondRikudo I put it as first line in the function
 
or are you at work and have not had time to actually start looking at it ?
 
2:13 PM
That tells me that the function isn't even getting called
 
@tereško huh? I've posted fiddle..
 
ok ... few notes about it
 
@CarrieKendall Well, actually I'm not sure why now I think about it. I'm used to putting data-id as a html attribute with the id there
 
@SecondRikudo Look at the last two lines.. might help
 
It would be nice to know I could do that for some custom AJAX or something though
 
2:15 PM
@tereško you may limit with only "your code sucks" - in fact, that is also experience (:
 
@Billy Add another echo above those two lines
 
also, I've never did anything like that before (no needs)
 
echo "Reached the end" or something
 
@Jimbo wait, you're talking about html attributes? i thought you're talking about the <option value> attr
 
@CarrieKendall Yeah, the id put on the option
 
2:16 PM
lemme write it up
 
<option data-id="entityidhere">
 
is it for client-side?
 
@AlmaDo link to the fiddle again please?
 
would the value attribute not suffice?
 
@SecondRikudo Ok, it's not getting there
 
2:16 PM
@CarrieKendall I'm rendering the form with twig and form_widget
 
So it's exiting somewhere before
Do you understand the debugging process?
 
@SecondRikudo jsfiddle.net/7uLQ2/1
 
The point is to isolate the problem and see where the problem happens
 
@Jimbo okay, but what do you need id for?
 
Your problem is that it terminates prematurely, so you need to discover where it terminates.
Add echos along the code, and see where they stop
 
2:17 PM
@SecondRikudo I think it is around line 230
 
@SecondRikudo way ahead of ya
 
@CarrieKendall I don't know. F* my logic then :')
 
echo 'hi';
// check if the file exists at all
if (!file_exists($source_file)) {
  header("Status: 404 Not Found");
  exit();
}
echo 'ho';
 
Word
 
It would be nice to know I could do that though
 
2:17 PM
@Billy echo $source_file
 
i think you can in the form widget
i wouldnt be in the form builder (i think)
 
Yeah, you can {'attr': { 'id': /* Where do I get the id now */, 'class': 'omg' } }
 
@ircmaxell, how do you handle passwords, like do you use a password manager or some hardware solution?
 
/~sp/wp-content/uploads/2014/06/FA1.png
 
He uses his brain.
 
2:18 PM
And there's your problem
 
@ircmaxell Excel
 
That file does not exist.
Fix your path
 
@RonniSkansing I use my brain
 
and you can derive the id from the value attr. although, you should just be able to use value as an id
 
The path is broken because we removed the $document_root variable, remember?
 
2:20 PM
@ircmaxell so you got many passwords and no problem remembering all of them?
 
what do you eat?
 
@RonniSkansing he has a really big brain :P
 
lol iknow
No share, but impossible to recover
 
user2518044
Hello everybody.
 
I did mention that I thought that was why earlier.. but why is it we need to remove it for mkdir() or it wont work, then for some other stuff it needs it
 
2:20 PM
ok @Patrick well the first thjing I would say is that joining t_attributes_attribute_values doesn't appear to be doing anything useful and may be causing the issue
 
@RonniSkansing correct
 
I never save my passwords to anywhere. So - yes, only keeping them in mind. I have ~10 passwords, so ..
 
Like I said, this script should be just plug&play
 
@Billy That path corresponds to some other path in your home directory, which is writable.
 
@ircmaxell ok
 
2:21 PM
try $document_root = getcwd();
 
@Jimbo xy nub :P
 
getcwd gets the current working directory btw
 
@CarrieKendall Thanks for helping me figure out brainz
 
user2518044
Are sessions a part of Request/Response?
 
user2518044
Like cookies, headers...?
 
2:22 PM
- if you execute JS just before `</body>` the it already will be happening at "onDomReady`
- not use `innerHTML` for creating DOM elements; do not set CSS in javascript code, if you can do it in CSS
- do not remove the `<select>` from the document. Just hide it
- don't use hidden inputs to hold the values
- use event listeners
@AlmaDo ^
 
@Jimbo np, i am curious now if you can alter the value though, haha
 
@Bartek Yes and no
Sessions are kept on the server, but the client gets a session_id which is passed in a cookie
 
@tereško multiline formatting, noooooooooo
 
That session ID is a part of the req/res cycle
 
well .. fak
 
user2518044
2:23 PM
Ok, thank you!
 
So I'm really not sure what to do @SecondRikudo .. I should replace document root? But then there will be errors with is_dir() etc
 
then how do i execute the js that comes from a different page. like in my case. @tereško
 
@SecondRikudo @Billy He just told you
 
@tereško hm. I agree about CSS (hardcoding properties sucks, no benefits from such "customization). Of course, with good & final implementation it should be CSS classes e t.c. Why don't remove selects? Why don't use hidden elements ?
 
2:24 PM
@Patrick in the interests of readability and understanding what's going on, can you try paste.jesse-obrien.ca/7Mh ? May give the same result
 
& also what's about event listeners? Hm, are they better ?
 
@AlmaDo you already have select's. Just hide them and re-purpose
 
@tereško so better to set their values while they're hidden, right?
 
@RonniSkansing So he did, thanks, I missed that.
 
what if somebody else has added an onchange() listener to that select?
 
2:26 PM
^ yay. I've even didn't thought about that. Great, thanks
 
@DaveRandom i already fix it. It's a problem of MacOS non case sensivity FS
 
your replacement should never break the existing behavior
 
^ agree
E_NOOB (:
 
@DaveRandom sorry I was interrupted... that returns paste.jesse-obrien.ca/7Mk
 
also, btw: dont do this
var foo = 1;
var bar = 2;
instead write:
 
2:28 PM
ehm.. do it in one line?
 
var foo = 1,
    bar = 2;
 
var foo = 1,
    bar = 2;
 
yeah. But what's the benefit?
 
@tereško ninja'd
 
2:28 PM
readability
 
I'm aware of this way, but - why?
hm. Ok, I won't argue. Thanks
 
@AlmaDo convention
 
because they've been drinking crockford's kool-aid
 
it forces you to define all your variables in the same place
 
@cHao LOL
 
2:29 PM
ignore them
 
prevents scattering and hoisting
 
@tereško true. So it has sense
 
@SecondRikudo I think I have found why it's not working
 
well, I still didn't get where should I use nested closures for that case ?
 
$source_file = /usr/local/apache/htdocs/~sp/wp-content/uploads/2014/06/FA1.png
note the ~sp
 
2:30 PM
all that was about learning them (:
 
@AlmaDo it isn't arguing to want to understand why, blindly following direction is dangerous.. take it from someone who works around people with big degrees
 
how do you know which element has been replaced ?
 
@CarrieKendall it's correct, but truly irrelevant in our context
 
and don't say "by name" because I can have <select name="param[]" ..
 
@tereško huh? I just doing that via .map() on all elements
 
2:31 PM
@AlmaDo @tereško I'm not seeing any changes to the elements in that jsfiddle
jsfiddle.net/7uLQ2/1 is that correct?
 
@tereško not by name. I'm capturing all selscts by tag name
 
@Billy What about it?
 
@SecondRikudo yeah. Works fine for me (FF)
 
Doesn't work at all chrome
 
2:32 PM
@SecondRikudo I'm not sure that it should be there
 
Uncaught SyntaxError: Unexpected token = on line 74
 
@SecondRikudo strange.. Oo
 
@Billy That's the name of the directory.
 
@AlmaDo and then you are adding an event directly to each one of them ... what happens if I am working with a large table where there are 1000s of selects ?
 
function setDropdownValue(container, value, text, name=null)
lolwut?
 
2:33 PM
there should be a single event listener handling "click on a select"
 
JavaScript doesn't do default values like that
 
@tereško I have no idea what will happen
 
public_html/~sp/wp-content
 
event delegation
 
@SecondRikudo I have no idea :D
 
2:34 PM
On my server directory structure is public_html/wp-content
 
@SecondRikudo first guess "to make it non-mandatory". Yay, worked! May be that's the proper way? (that was the logic)
@tereško ok, makes sense. It's about event listener, right?
 
yes
this would be the next step: add single event listener for handling all the onclicks on select-replacements
 
cool, now I've got all your points. Thanks a lot
indeed there are pitfalls in the code (well, apart from how unreadable it is)
 
@Billy Wait a second
 
@AlmaDo the "fallback" values in JS can be set as var foo = bar || 'default';
when you define parameters for a function, they ALL are "not-mandatory"
 
2:37 PM
@tereško yeah. I thought syntax is as I wrote (since no errors & worked well), Now I see
 
but, if not set, they will contain undefined
 
Ok. It's to do with my server and reseller account. When I make a new site the homepage is always <our static ip>/~<username>
 
@Billy you're requesting ~sp/wp-content/uploads/2014/06/FA1.png
So it'll look in the ~sp/wp-content/... directory.
 
well, at least that worked. So I have area for big improvements (however, that will have little sense because of existing good solutions)
 
That is intended and expected behavior.
 
2:38 PM
But there is no ~sp directory
 
Like we've told you many times before, it's your host that's weird and needs replacing urgently.
 
it is just part of the URL I have to go to
I know this now.
 
@AlmaDo well now you have your next directions ... make it better
 
@tereško I'll try, thanks. However, there are existing good solutions, I'm sure
 
@Billy Short term solution, switch host. Don't delay it. The longer you delay, the harder it'll be.
Long term solution, get a good vps and stick with it
 
2:40 PM
so could you recommend something so I will look & learn how it's done by "pro" ?
 
Does global in PHP set the var to be accessed in ALL files?
 
@Billy when you setup a domain for it, that problem goes away?
 
@AlmaDo that is not the point in this case. There are also good existing "hello world" programs.
 
Or is it something like !important; like CSS?
 
@RonniSkansing I think that is the case.
 
2:41 PM
@tereško lol :p
 
@RahulKhosla All files included in the current running script (and the included files inside the included files), yes.
 
@AlmaDo the recommendation is to itterate on what you have
 
@Billy cause if you fix it for the development (by fixing the path) it will not work when you change the domain
to a non prefixed one
 
@tereško fair. I'll see what I can improve. When I'll finish, I may ask you for review again
 
@SecondRikudo I am going to move job, learn about VPS by getting my own etc. etc. but for now, need a quick fix.
 
2:41 PM
@AlmaDo you could read "Javascript: the good parts" but what you mostly lack is practical experience
 
unless you write a couple lines of code to check if it is live or dev
 
@RonniSkansing I might do "if (first 3 letters are ~sp){ remove them }
 
@SecondRikudo Cant you do that anyways without global?
 
@tereško why do you think that only practical experience? (I'm just wonder, not arguing or something - and, in fact, I know that I have ~0 practice, but may be also any other things are missing too?)
 
2:43 PM
@AlmaDo There's also always Code Review
 
So you can't just:
function whatever() {
echo $variable;
 
@SecondRikudo well.. @tereško have saved lots of time & provided constructive & useful notes
 
@AlmaDo because smart books and blog posts give you theory. But, without proper experience, you will fail to see the point of it all.
 
@RahulKhosla Try it and see.
 
@tereško ok, I see
 
2:44 PM
@SecondRikudo I'l take your word for it.
Thanks for the help :)
 
that, and books love to teach ivory-tower stuff
 
@RahulKhosla Don't use globals though
 
Why?
 
@Billy try it, see how it goes
 
95
Q: Why is Global State so Evil?

Madara UchihaBefore we start this, let me say I'm well aware of the concepts of Abstraction and Dependency Injection. I don't need my eyes opened here. Well, most of us say, (too) many times without really understanding, "Don't use global variables", or "Singletons are evil because they are global". But what...

 
2:45 PM
you need experience to separate the "good practices" from the good practices
 
@cHao if a book teaches you about DI Containers, it will look like "ivory-tower stuff" to you, if you have never experienced problem which it tries to solve.
that's the difference between learning basic and advanced programming
 
@RahulKhosla The basic gist is this:
$var = 42;
someFunction();
echo $var;
What will this output?
 
Now I'll give you the contents of someFunction()
function someFunction() {
    global $var;
    $var = 24;
}
 
@SecondRikudo is the reason the answers are wiki because the amount of answers?
 
2:48 PM
Still think it'll output 42?
 
No Because global is set first?
 
@CarrieKendall It was wikified when the auto-wikify was still a thing
 
@SecondRikudo inside may be anything. even segfault. So ..
 
@SecondRikudo okay, are they actively trying to undo that now?
 
@RahulKhosla The function altered the global variable, without telling anyone
 
2:49 PM
later
 
And it isn't obvious from the code, unless you dig up the source code for someFunction()
This is a very simplified example
 
So did I give the correct answer?
 
Think of a full application, where you have a global $config variable, that's being used and changed everwhere
Good luck tracking it
 
@Billy how long until deadline?
 
@RahulKhosla Yes
A better solution for the simplified example is:
$var = 42;
$var = someFunction($var); //Now it's obvious that it's changing it!
echo $var;
 
2:51 PM
@RonniSkansing It was supposed to be today. 10 to 4 now and I'm usually kicked out the office by 7
 
function someFunction($input) {
    return $input - 16;
}
 
@Billy and now it works?
 
It seems to be working :D
 
Is it possible for a user visiting a website to pass command line args to the php script?
 
Thanks for your help @RonniSkansing and @SecondRikudo
 
2:53 PM
@Luka no, that's why you should have an abstracted Request instance, to isolate your application from the "source of call"
 
I say it is working.. yes there are no errors but not getting expected results.. I won't bother you any more though
 
@SecondRikudo After hours of research, I figured out that when you change the width of a div to 0% with jquery, the element is still present as a pixel, which fucks up all the rest of my layout :D
 
@Naruto mu-mu-mu-mu-mu-multi ping
 
@Patrick Sorry, my brain has stopped working. The best I can say is that I think you need a condition based on a.ID in the last join condition set but I can't figure out what that would be
 
@SecondRikudo That's a nice little function
I just
if ( substr($requested_uri, 0, 4) == '/~sp' ){
	$requested_uri = substr($requested_uri, 4);
}
 
Hi everybody!
 
@Billy Tomorrow it wouldn't be '/~sp', nor would the length be 4.
Beware
 
@tereško thanks. I am trying to call a php script from a java program and I need to be sure no hacker can execute the script with fake command line args
 
Can someone help me it is easy to fix.
Ok
 
@DaveRandom thanks a lot anyways. I'll figure it out, maybe tomorrow with a clear head
 
2:56 PM
I will write my problem
:D
 
@SecondRikudo But with your function I have to pass the prefix manually anyway?
So it's the same problem?
 
I have php script with setcookie
 
@Luka the script should not be in "available from web" location to begin with =P
 
And page w ajax
 
@Billy Your method requires 2 parameters, mine only one
 
2:57 PM
How that cookie can be transfered to that page?
 
With my method you need to change only in one place in case something changes, yours in 3 places.
 
@tereško yes, this is the best approach and I should do this, but it's not easy as I am calling other scripts from that script.
 
@Patrick wait, does t_order_lines_attributes have an attribute_id col?
 
@SecondRikudo That's true.. Anyway this problem will go away when I set up a domain name, and that snippet will never get used again
 
2:59 PM
Imho that is just really stupid behaviour
 
@PeeHaa Yup, HTML parser runs before JS
 
@tereško if a book is trying to teach you about DI containers without showing you the problem it's trying to solve, then it is worthless.
 
@PeeHaa It isn't. it makes sense.
 

« first day (1354 days earlier)      last day (3600 days later) »