« first day (895 days earlier)      last day (4039 days later) » 

4:02 AM
0
Q: Optimizing Jquery Twitch TV Application

Howdy_McGeeI'm trying to get in the habit of writing better looking code and more efficient code blocks. I wrote this Twitch TV Application which allows you to add and edit channels and it lets you know when a channel is live. Is there anything I can work on to make my code work / look better? HTML <!...

 
@Dave no
 
okay
that should save me doing 3 times as many append childs
 
@Dave well, if I understand you correctly.
@Dave both of the following will work
var a = document.createTextNode("Hello"),
    b = document.createElement("p");

document.body.appendChild(b);
b.appendChild(a);
var a = document.createTextNode("Hello"),
    b = document.createElement("p");

b.appendChild(a);
document.body.appendChild(b);
 
yeh the latter is what i mean :) ok cool
thank you
 
4:21 AM
If you need your IDE's refactoring features, then your code isn't orthogonal
 
@SOChatBot robots aren't supposed to talk unless talken to!
 
user1125394
4:33 AM
function foo(id) {
    var direction = false;
    //
    $(elt).click(function(){changeSort(field, direction)});
}
function changeSort(field, direction){
    direction = !direction;
    //
}
 
user1125394
direction is passed by value not reference right?
 
Right
 
user1125394
because it's not working
 
user1125394
o ok
 
user1125394
I'd like to define a function inside a function
 
4:34 AM
Nobody will stop you from doing that
 
user1125394
hmm no changeSort should be reusable, by several foo(ids)
 
How about you return the new direction then
 
user1125394
yet the direction must stay unique by foo(id)
 
user1125394
@copy ah righth though of that, but weird to do it in the event handler
 
user1125394
hmm ok
 
user1125394
4:37 AM
I see
 
user1125394
$(elt).click(function(){direction = changeSort(field, direction)});
 
user1125394
works great, thx for the help, it's hard at 5:41 am
 
An organisation that treats its programmers as morons will soon have programmers that are willing and able to act like morons only. — Bjarne Stroustrup
 
that explains sim city
 
5:03 AM
Hi everyone, is my answer correct? :
2
A: Mouseenter and mouseleave race issue

Mostafa Shahverdy I think I just didn't understand the running mechanism of the javascript. So I have such a question. Hope someone would like to tell me more about it to help me understand it better. Javascript doesn't have multithreading features, so it is wrong to say that there might be a race issue. ...

fully correct :)
?
 
@OctavianDamiean, I think you'll enjoy S03E10
 
 
2 hours later…
7:01 AM
Morning
 
7:37 AM
Hi, How can I get the question body of a question from StackOverflow using the API?
 
8:08 AM
Hello
I want to show different menus based on API call. For example i make call to abrakdabra.com/getUserRoles and it returns me two roles admin,manager. Each admin and manager can use different menu
 
Hello. I need to get the question body from the question with id {id}.
 
what i was thinking is hidding the ones that are not required for example accounts menu is not required so if it is display none someone can make it visible by firebug
@joh
@John please explain more
 
Ok.
 
hey dudes
 
So, I want to use the SO API: api.stackoverflow.com/1.0/usage
 
8:11 AM
@AfnanBashir heyy bro !
 
This will return a JSON with questions: api.stackoverflow.com/1.1/questions
Each question has an id.
If we add the id in url, we get only that question: api.stackoverflow.com/1.1/questions/15699439
 
@John From your first link :
> The V1.x family of APIs is obsolete, having been replaced by the V2.x family.
 
I was jumping in here to see if anyone had any advice on a decision i'm bout to make. I am making an app. I have already used Jquery, would it be stupid to start using something else like dojo at this point?
I mean as far as overhead goes
 
@AfnanBashir You got a nice portfolio !!
 
:O im not that good :)
 
8:14 AM
@dystroy, if I replace the version in url "2.0" doesn't work.
 
@AfnanBashir are you on skype
 
Guys how do you show different menus based on user roles ?
yes
 
pass me yur id
 
@John I didn't see the body of the question in the answers. Is it just my sight ?
 
@dystroy, yes, this is my question. How to get the body?
(The question content)
 
8:16 AM
Lol... I hadn't see you were the one asking, I thought you were answering somebody else asking for the body :)
 
@dystroy :) Ok, so how can I get question body from API?
I already did a parsing HTML for getting the content, but this is not the best method...
 
@John I don't have any idea, sorry, I never looked at the API.
 
Would It be good to ask this on StackOverflow?
 
@dystroy one thing that how do you display different divs based in few variables in such a way no one can unhide them from firebug
 
@AfnanBashir why do you ping me ? Did we speak of this problem or a related problem before ? Did you want to ping somebody else ?
 
8:24 AM
@dystroy because i suppose you are the only one alive here other than me :)
 
When you have a question, ask it in the clearest, simplest and most attractive way. Somebody passing might answer it if he likes it (there are more people reading than you think). But please don't ping people at random.
 
Functional programming is the best
 
what is that
 
A bot trolling... don't pay too much attention ;)
 
8:34 AM
hahaha
 
8:56 AM
!!\ dystroy is tryina insult you :O
 
@MuhammadRaja Y U NO MAEK SENSE!? Could not understand \ dystroy is tryina insult you :O (perhaps you meant to execute a command? If so, prepend the command name with a /)
 
!!/tell muhammad-raja help
 
how come JS room being so calm today
 
Weekend?
Or it's just too early in most people's timezones
 
9:03 AM
its friday, not weekend lol
anyone with knowledge of buying development, laptop, pcs or server, please ping me
 
@MuhammadRaja if you are in pakistan and in lahore goto Hafeez center
 
@AfnanBashir unfortunately am in london
 
@MuhammadRaja Timezones. I think it's Friday evening for @phenomnomnominal
 
heheh
 
@AmaanCheval he must be from Australia then, they are always way head of us
 
9:08 AM
New Zealand
 
And Florian is in training far from home so he's excused
 
what kind of training is that
 
hello
 
@MuhammadRaja A CMS is being forced down his throat
 
Haha, That sounds terrible !
 
9:11 AM
how to trail the ending commas from this kind on string a,b, , last two needs to be removed and also whitespace ?
 
!!> "a,b, ,".replace(' ','').replace(/[,]+$/,'')
 
@dystroy "a,b"
 
2 messages moved to Trash can
@jurka did you get the answer ?
 
Guys do you think it is good practice to manage multiple menus for different roles at client side?

For Example:
if i do query to a url and it returns role of current user say admin. And i hide two menus and show one menu. Of course for most people it woild work but someone using firebug can enable other menus and do tasks that they are not allowed
using javascript
 
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. — Laurence J. Peter
 
9:27 AM
@dystroy yes ty
 
@AmaanCheval It's Friday evening here indeed, I'm watching lord of the rings with my parents! They've never seen it - and they call themselves New Zealanders!
 
!!> console.log('w')
 
@jurka "undefined" Logged: w
 
hey
is there anyone who is familier with google-maps ?
 
@itamar i have used the static maps api
and I kinda like it
 
9:36 AM
i've got a little question
i'm trying to display a google map on my site
but it seems like the map is not loaded for some reason
@jurka you can see the code here if you've got a minute stackoverflow.com/questions/15700550/…
 
have you got an api key or do you just use "myapikey"?
 
just remove it and try without the key
 
i've got an api key , just replaced it with "myapikey" in the post
 
@itamar check the network tab in developer tools, refresh, do you see a request to google maps? If so, what is the response code value?
 
@BenjaminGruenbaum lol. srsly. how did you know? --- jk
 
9:45 AM
@BenjaminGruenbaum , in the developer tools I can't see any response value at all
 
@itamar refresh, also, do you see a request?
 
after refreshing there are stiil few requests to google api
 
Right, what response do those requests return?
(What status, and what actual text)
 
every other request returns 200
 
Hi all, please help me further with stackoverflow.com/questions/15604648/javascript-nested-onclick
 
9:50 AM
(204 = no content , 200 = ok)
 
Yeah I know :P
Hmmm, can you create an isolated case on jsbin.com or jsfiddle.net ? I'd like to see the responses. Google APIs are usually very good with telling you what's wrong
 
of course
@BenjaminGruenbaum , hope it helps
 
Just remember, when you're creating a fiddle you need very little code there, don't add your entire web page - only the relevant parts.
 
I created mask div over you tube player. I want to add click event over player, So when the div is clicked I want to do some action. But the div is not creating mask over the player.
$(document).on('click','.ekho-sniffer-container',function(){
        alert('YES');
but alert is coming only when red color part is clicked not over youtube player
 
its flash. no chance in some browsers.
 
10:00 AM
Can't we create a mask over youtube player
 
also.. you have put the video INTO the red box
 
@Jan-StefanJanetzky:Video already into the red box only
<div class=".ekho-sniffer-container">...
 
0
Q: more capability from CSS

Amnat Heerso i've just finished a book to learn CSS. (known HTML since high school but didn't have the initiative to pick up CSS 'til now). anyways, ever since i started reading about pseudo-classes in CSS i always thought it was a: vast assortment of states for almost any tags. this would allow differe...

 
<div class="ekho-sniffer-container" style="background-color: red; z-index:999;">
    <iframe src="http://www.youtube.com/embed/x7QhUL8NUK4" height="315" width="560" allowfullscreen="" frameborder="0"></iframe>
</div>
this cannot work as you want
 
How I want to modify it
I actually wrap that div dynamically
 
@phenomnomnominal I just came
holy shit that's awesome
 
Fucking insane aye!
How can that be 1k??!?
 
@Jan-StefanJanetzky: I wrapped the div using below code
  $(this).wrap('<div class="ekho-sniffer-container" style="background-color: red; z-index:999;" />');
 
Insanely good data management
 
How can I modify that to work as I want do you have any idea
@phenomnomnominal: great one :)
 
10:12 AM
!!s/good/micro-optimized/
 
@Shea Insanely micro-optimized data management (source)
 
or that
 
@Jan-StefanJanetzky: oh my god my internet connection is dead slow. give me second I will check it
 
still i dont get it why anyone would want to do that.
 
10:19 AM
Yes I want create mask over player. once it clicked I want to load some other flash file. once it completed normal youtube player will be restore and start play. like advertisements
 
you want to put advertisement above the youtube player?
 
Yes
 
srsly. do not do that. two clicks for me and i can watch the video.
well. need to take some food now. cya.
 
Thank you, Have a nice food :)
 
Haha "have a nice food" sounds hilarious
 
10:32 AM
Measuring programming progress by lines of code is like measuring aircraft building progress by weight. [Bill Gates]
 
I'll try it one last time :) Please help, this is 5 minutes work for you guys. See stackoverflow.com/questions/15604648/javascript-nested-onclick
 
@gowri (some) people are nice, food is tasty .. not the other way around
 
Some users have no shame. This one doesn't even deny to have copied my answer but he wants his answer to be accepted...
-5
Q: If query exists (syntax error)

Hany RaafatI have an error in my code. The error in line 4: (string query = "if exists(select Avatar from pets Where Skey = @Skey);) Here is my code: string connectionString = WebConfigurationManager.ConnectionStrings["conString"].ConnectionString; SqlConnection con = new SqlConnection(connection...

(he removed his last comment)
 
close it as "too localized"
 
@tereško well, you're right, it's too localized
But I just don't like comments implying that I should let him be accepted just because I made my own answer CW...
 
10:42 AM
it does not matter whether the repwhore was harmed in the process or not .. it should be closed and then deleted
 
Recursion is always the answer
 
!!Is recursion always the answer?
 
@phenomnomnominal Not at all
 
Hahaha
I love recursion
It makes me feel smart.
 
> "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." -- Brian Kernighan
.. i just thought that i should give you a fair warning
 
10:52 AM
Haha, yeah, I've seen it
 
!!s/smart/smart, but not too smart/
 
@phenomnomnominal "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart, but not too smart enough to debug it." -- Brian Kernighan (source)
 
dammit.
!!/undo
double dammit.
must be sleep time.
 
Hi All, I've got this piece of jQuery..

$('.gallery .featured_img img').attr('src', bigLink);`
 
I've been saying how awesome android is for these last 3 years. I got an iPhone recently... it's not even close :( It's just so smooth
 
10:55 AM
Is there a way I can call a function when this new image has been loaded from the server?
 
@BenjaminGruenbaum NO U
Okay, yeah, it is pretty smooth
 
Everything just works :( It's horrible
 
But once you actually get to customizing it, you won't like it
At least I didn't like it without a jailbreak
 
@Dan you mean like onload ?
 
@Dan onload
!!/ninjad
 
10:56 AM
I don't even want to customize it :( It already works the way it came from the factory :/
 
@AmaanCheval Y U NO MAEK SENSE!? Could not understand ninjad (perhaps you meant to execute a command? If so, prepend the command name with a /)
@AmaanCheval HOLY SHIT, HOW YOU SO FAST!!!???
 
Yes, something like that. The basic idea is to show a div with an "ajax loading" style .gif, and hide it once the image has loaded.
 
@Dan next time please search StackOverflow before you ask questions here :)
 
@BenjaminGruenbaum :)
Welcome to the dark side.
 
10:58 AM
@BenjaminGruenbaum I have done, coming here is usually a last resort : )
 
@Dan Ok, I searched for JavaScript Image onLoad and this is the first result stackoverflow.com/questions/5933230/javascript-image-onload
 
So this " document.getElementById("FULL_SRC").onload = function(){ " Could be $(whatever).onload(function(){ } ); ?
 
Not FULL_SRC
 
@Dan I'm guessing you don't really understand the DOM and just learned jQuery, document.getElementByID selects an element by its ID, it's like $("#MY_ID")
 
It'd be an id. Like $('#id')
@Dan Learn JavaScript before you use jQuery, please
 
11:01 AM
@Dan DOM elements have onload, jQuery facades that for cross-browser compatibility and lets you do $("#MY_IMAGE").on("load",function(){ //whatever to do
 
So, referencing my original question, will my selector be ok? $('.gallery .featured_img img')
 
We don't know your markup, so we don't know whether it will or won't be okay.
 
@AmaanCheval I'm working on it..
 
@Dan If your DOM tree is an element with class gallery, with a descendant with class featured_image with an image descendant then yes
 
Should work fine then.
I'll try it now. Thanks for the help guys.
 
11:03 AM
Try it out, if you have more issues, let us know
No problem :)
 
This has never happened before. I have 48 unread emails.
 
All the games just work, everything is just so smooth, nothing gets stuck ever :(
 
Haha, I have to admit that the iPhone 5 is pretty smooth and it has a good battery life
But I still like my Galaxy Nexus better
Okay, down to 23 unread emails now
Phew
 
My iPhone 5 made my life better, I'm not ashamed to admit it!
 
I am (ashamed) :P
 
11:07 AM
@BenjaminGruenbaum Well...it's a simple gallery. You click on a thumbnail and the href of the large image gets replaced. It works well the first time, but after this the onload function calls multiple times even though there is only one image being loaded at a time. Any idea why?
 
Hahaha
 
I find it really hard to admit Apple know what's good for me better than I know for myself
Apparently, after playing with the Nexus 4, the Galaxy S3, and other 'new' android phones... they do :(
 
Aren't the new Nexus at the same usability level yet ? :(
 
Sapristi...
 
11:08 AM
@Dan Create a fiddle and show us (jsfiddle.net) , it has to be very reduced (only a div called gallery, with a single div called .featured_img and a single image in it
 
But they do :)
 
This should be a duplicate, but I can't find it. Is it wrong to answer?
 
That's comparison
 
11:09 AM
@Zirak the proposed duplicate looks fine
 
That's without formatting Actually, ok
 
@Zirak It's OK to answer questions that have closely related questions. FWIW I don't think it's identical, you can tell OP how to convert those dates to Date objects and then refer him to that question
 
Formatting date differences is actually a nice subject. It's not so trivial: github.com/Zirak/SO-ChatBot/blob/master/source/util.js#L233
 
Dates suck
To a programmer, there's just too much to take into account
They are one thing I'd be okay with using a library for if dates were important in what I was making
 
I use date.js (in fact just sometimes)
That's the only library I use apart jQuery
Dates in javascript are just as stupid as they're in java
(which is a big lot)
 
Yeah, MomentJS looks pretty good
 
By the way, I spend the week coding both in js and java, this really makes you feel how bad java is... It looks more structured but not even. Creating classes is so expensive (in LOC) you use too many unencapsulated variables whereas in js you create objects as soon as you have a few variables semantically linked.
 
Yeah, I disliked how much work was required in Java. And the verbosity
 
momentjs is icky (look at the source). I had thoughts of making a superseding library. But then, well, laziness.
 
@Zirak I won't let how bad the source looks affect me.
Any comprehensive library for dates will get ugly in one way or another
 
11:18 AM
How bad it "looks" hardly makes a difference; it's how the code feels.
 
That's what I meant
Not the formatting of the code literally
 
Moment has a nice API and works well
That's pretty much all I ask for haha
 
I'm with you
 
Thanks Avril
 
11:21 AM
Why does she have 9 million followers on Twitter?!?! How is she still even a little bit relevant?
 
@phenomnomnominal exactly
 
> Is a metaphor like a simile?
Holy shit, @rlemon.
 
^ that fucked my head in the biggest way possible.
 
(note to self: "encode" the responses in source)
(...why are they all looking at my notes?)
 
Eh, doesn't matter so much
I was just going through my email, saw rlemon's pull request
> Where in the nursery rhyme does it say Humpty Dumpty is an egg?
That is pretty interesting. @rlemon, you should read the Wikipedia page on it
 
11:25 AM
Hahaha I just did that too
 
I saw it like 2 years ago, and it was...sad.
 
Anthropomorphic is such a great word
Man, shit is getting cray cray in North Korea
 
The Quora weekly digest brings some interesting questions
 
Hi @all
 
@phenomnomnominal I don't know what you're talking about
Enlighten me
 
11:31 AM
Basically getting ready to fire some missiles at the US
well try to
 
I am trying to compare two dates
How to do that?
I tried curDate == preDate
no effect
 
What format are the dates in?
 
Sun Mar 03 2013 00:00:00 GMT+0530 (India Standard Time)
 
Are they date objects?
 
@Mr_Green Because they're date objects. Convert them to epoch time ( curDate.getTime() and so forth)
 
11:32 AM
Whoa. You're Indian!
 
or strings
 
whoa, he's Indian! They're so rare
 
so what?
 
@AmaanCheval, is that really surprising?
 
hehe
 
11:32 AM
No, not really :P
 
Statistically, shouldn't like 1 out of every 7 people you meet be Indian?
 
Yeah
 
@zirak ok I am trying
 
@phenomnomnominal Especially if you're in Iran
...why Iran?
 
yup working thanks :) @Zirak
 
11:36 AM
Enjoy
 
I did curDate.getTime() == preDate.getTime()
 
Man, In a real fight Obama would fuck Kim Jong-un up
 
It wasn't working before because the equality operator, when working on objects, checks to see if they're both actually the same objects. It's like having two red balls: Equality checks if they're the same ball. But you only care about their redness.
 
Whatever @Zirak, my red ball is way redder than your red ball.
 
I love random downvotes :/ stackoverflow.com/questions/15702239/…
Oh wait, the down-voter un-down-voted
 
11:40 AM
Random up vote
Man, I want to go to sleep, but I don't want to miss it if NK fire on the US?
 
-2
Q: How many obects are created?

Ram GaddeHow many objects are created when I declare three variables like this: int area; int perimeter; String name;

 
@dystroy I actually didn't think it was a bad question :P
 
Really ? This makes no sense apart in a school interrogation.
 
Anyone here ever used chromebug? I am trying to get it to launch with firebug, but I am not seeing anything different
 
11:47 AM
@dystroy It's a specific programming problem, I don't care if its his homework. It's a bad question, it should be downvoted but I don't see why it should be closed. If you can find a duplicate that explains how Java objects work, I'd gladly close it as such
@0A0D Chrome dev tools >> firebug
 
There are many other reasons to close. Here it's for example too localized as apart if you have the same teacher you'll never find the same question in your life.
 
@BenjaminGruenbaum: Oh, I know how to launch firebug, I am trying to launch chromebug for debugging firefox plugins
its an add-on to firebug
 
oh, cool, I didn't know :)
@dystroy I cv stuff as too localized if there are hundreds of lines of code, this is something Java noobs can learn from in some way
 
You should comment all your code
 
woop woop
 

« first day (895 days earlier)      last day (4039 days later) »