« first day (1471 days earlier)      last day (3472 days later) » 

2:02 PM
hey guys i am trying to access the value of b from the load function  in the add function  is this possible ?

var a = {

	load: function(){
	 b = 25;
	},

	add : function (){

		console.log('The value of b is '+ b));
	}


};

a.add();
 
@devdar If you call load then you'll put b into the global scope, so yes. It's an absolutely terrible way to design anything tho (it's put into window lol)
 
-1
Q: Insert image from users computer

CODE Hi I would like to know how to insert image from user's computer to my webpage. For example a lot of websites have "insert image" button to choose you profile picture. Coluld you please give me some code on how to do that... :) Thanks in advance!

Lol
 
@RoelvanUden can you advise me on the best approach
@RoelvanUden i have a function that requires access to its b value outside of the function load
 
@RoelvanUden back, were you able to get it working?
 
@BenjaminGruenbaum Nope. I gave up.
I'll just stick to co because all these hours spend on trying to like Bluebird is going way to far for me
 
2:09 PM
Very well, lemme know if there is anything else I can help you with.
 
@RoelvanUden can you advise me on the best approach
 
Guys should this fall under the hackish category?
 
@AwalGarg 2 things:
It should be a button, not a div
It should not have the onclick attribute.
 
@SecondRikudo It's not my div/button.
@SecondRikudo I didn't add it.
 
@AwalGarg It's in your answer, so it is yours.
@AwalGarg It's in your answer, so you added it.
 
2:12 PM
haha I am asking about the logic
@SecondRikudo but maybe that guy wants a div for some other reason?
 
@AwalGarg Because he doesn't know better.
 
haha ok, I'll edit then.
I didn't want to modify a lot of his code to keep it as simple as possible.
So I only changed the logic
 
how would you guys deal with a username change and post synchronization? is it better to store the username on the article table and when username is changed change that field in the table too or store user id in article table and fetch the username by id?
 
And now for some reason it occurred to me that maybe that is a hackish suggestion, so I thought I would ask here :D
 
@RobertMallow Why would the username changing affect their posts?
The posts should be assigned to the user IDs, which never change, and not to their usernames.
 
2:18 PM
@SecondRikudo mmm when articles are shown there is the title and below "by [username] [time] ago". I think it may confuse users if they see a different username than when they click it.. or is it just me?
 
@RobertMallow JOIN
 
Yep. that's what I'm doing now ;)
 
Why would it be different?
Are you not displaying the data in both places from the same database?
 
@SecondRikudo Yeah, but you know, one more query/trip to process for the database :p
wait.. are the username changes reflected here on SO by chance?
 
@RobertMallow I personally use NoSQL more than SQL, so my approach to this would be to store the entire article object under the user object
@RobertMallow Of course
 
2:21 PM
@SecondRikudo done ;-)
 
Second Rikudo wasn't my first display name here.
@AwalGarg Awesome
 
mmm can see that
 
You might want to explain those changes.
 
@SecondRikudo ...but I need to know if what I answered is good or not. I don't wish to educate beginners with 'hacks', KWIM?
 
what if the user has loads of articles? do you still store all of them under the user object?
I suppose you're talking either about mongo or redis?
cassandra?
 
2:23 PM
I use mongodb for most applications.
@AwalGarg LGTM
Although I'm not familiar with a different workaround, but you may want to wait around for more opinions.
What happens with location.href = url?
 
@SecondRikudo oookay thanks :)
 
@SecondRikudo FF loads the image itself. Assigning it causes it to download it.
 
@AwalGarg That's a matter of sending correct headers from the server though...
 
@SecondRikudo ...its an image accessed directly from the server.
 
!!tell Awal google content-disposition: attachment
 
But that still won't solve his problem, would it? FF would still cause the reload.
 
<a download should work
 
But I like the question, interesting one.
@copy no repro, FF 28 Ubuntu 14.04
 
    var a = document.createElement("a");
    a["download"] = name;
    a.href = href;
    a.dataset["downloadurl"] = ["application/octet-stream", a["download"], a.href].join(":");

    if(document.createEvent)
    {
        var ev = document.createEvent("MouseEvent");
        ev.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
        a.dispatchEvent(ev);
    }
    else
    {
        a.click();
    }
}
Try that
 
heck, what's that?
 
2:32 PM
Magic
 
!!magic
 
(∩ ͡° ͜ʖ ͡°)⊃━☆゚. * ・ 。 ᵀᴴᴱ ᴳᴬᴹᴱ
4
 
hahahaha
 
2:33 PM
!!unonebox
 
@AwalGarg Functionality is enabled
 
hold on
 
haha I thought caprica posted it lol
> Uncaught SyntaxError: Unexpected token }
 
0
Q: Javascript accessing object variable from another callback without placing variable in global scope

devdarI have the following scenario. I have an object 'a' with two callback methods however one callback requires access to the other callback variable value (for modifications / to read value / update value). I would like to know what is the best approach to structuring this code without placing the v...

 
2:39 PM
@devdar define b as a property of the object a? or return it from the callback?
I don't think you can access a local variable of a function outside the function in any other way than returning it.
@SecondRikudo you bad bad guy I was writing the same answer :P
 
@AwalGarg FGITW :)
 
!!urban fgitw
 
@AwalGarg No definition found for fgitw
 
@SecondRikudo eh?
 
!!tell Awal google fgitw
 
lol
haha that's why you were editing it so fast lol
 
@AwalGarg First post a small, concise and correct answer
Then edit to make it better gradually while relying on the grace period
 
ALL YOUR CODEZ ARE BELONG TO ME
:P
@SecondRikudo that's not fair dude...
 
@AwalGarg I just taught you my secret, what's not fair about it?
"secret"
 
a secret posted on mse, indexed on google at first result, known acronym? sure, it's so much secret.
:P
 
2:48 PM
:D
 
btw, nice trick. I would also practice it now :P
 
@AwalGarg What about that canonical?
 
@SecondRikudo wasn't received much well, so I am not sure if I should post it or not.
 
@AwalGarg link?
 
@SecondRikudo seriously change your dp, its really disturbing.
 
@darkyen00 Nope >:D
 
@SecondRikudo Yope
 
All of you changed it to zombies and skulls
 
lets face it.
 
looks quite a bit cleaner to me towc.eu
 
2:51 PM
@AwalGarg javascript is broken and its broken as fuck
this in javascript is as broken as javascript itself
 
still stuck on thinking about how should my 'games' page be, or if I even need one
 
and hence that makes proper sense. -- should add that as tldr;
 
lol
 
Since I've done Zombies, and skull's not my thing, I went with the next best thing :D
 
@darkyen00 hahahaha
 
2:52 PM
@AwalGarg post it
Worst case: It's not received well, you lose 10 rep max.
Best case: I award you with 500 bounty
 
@SecondRikudo thank you very much
 
@SecondRikudo ...or I post it as community wiki and I not lose rep, neither gain it lol... but ok, would post it.
 
@AwalGarg I won't be able to bounty you if you do that though
 
@SecondRikudo really?
 
And you can always change it to community wiki, but not back
 
2:54 PM
ohh
 
@SecondRikudo your new avatar looks too much like darkyen's one with the disco hair
 
@AwalGarg ^
 
> this is javascript
rofl
 
@towc My avatar is an animated character riding a unicorn on a rainbow.
If that's similar to him to you, PEBKAC
 
2:55 PM
btw i am really pissed the hell off because of multi-tudes of reasons, if i offend you today... no hard feelings, just politely ignore...
 
@darkyen00 I am reasons and I find this offensive.
 
@SecondRikudo then go fuck yourself.
 
@darkyen00 BTDT
 
!!urban BTDT nvm
 
@darkyen00 [btdt](http://btdt.urbanup.com/75802) Been There Done That

See Also: [\[LOLROFLMAOAFK\]](http://urbandictionary.com/define.php?term=LOLROFLMAOAFK)
@darkyen00 No definition found for BTDT nvm
 
2:57 PM
@SecondRikudo I knew it you would do so..
 
@SecondRikudo the fact that there's a dark face in the middle and the rainbowy colors all around... it confuses my head XD
 
o/
 
2:58 PM
\o
 
o/
 
\o
:D
 
nope
 
\o
 
2:59 PM
@BenjaminGruenbaum meh, twas an example.
 
@towc you apple guy
 
@AwalGarg I pear guy
 
@darkyen00 -> microsoft guy lol
 
@AwalGarg screw u... deep and nice and slow
 
hahahaha
 
3:00 PM
@AwalGarg No, IIRC @darkyen00's girlfriend was microsoft
@darkyen00 was linux.
 
o_O @darkyen00 needs more swap space :P
 
@SecondRikudo Now i understand why i want her dead. Deep down withing 3:D
 
module.add() returns undefined not 25 — devdar 3 mins ago
 
(just kidding)
 
3:04 PM
@SecondRikudo tell him to go learn sanity and english and goto an asylum realizing how much vampirism he is commiting
such help vampirism is unbelieveable... bro do you even import ? — darkyen00 28 secs ago
 
any node.js people on?
 
@darkyen00 Uuuhhh, I think you should take a break from Stack Overflow.
!!tell Skullomania welcome
 
@Skullomania Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
add: function () {
console.log('The value of b is '+ b);
}
 
3:08 PM
i guess you make it pretty clear ...
 
fair enough...I have installed node JS on my laptop and created the server.js file from the node tuts video but when I try to compile it in DOS it errors out
should I instead be using the node JS command propt
 
and you are just editing his code :-/, which is sad :-(
cause that directly means that he doesn't even understands his own question :-/
 
here is the tutorial that I am following
 
@darkyen00 instead of using +, you can use , which would work even if one of the arguments is undefined.
(I think)
 
@AwalGarg yes
you can also do
!!> console.log("Hi %d", 38);
 
3:10 PM
@darkyen00 "undefined" Logged: "Hi %d",38
 
in chrome
 
haha
oh right, the colors and formatting, it was...
now I remember
 
@Zirak do we support formatting in jsh ?
if yes can we have some in here too ... please ?
 
@AwalGarg fixed a couple things, have a look
 
@darkyen00 how would we have it here?
 
3:12 PM
@AwalGarg by not running naked firefox console.log ?
 
@SecondRikudo awesome, thanks bro :D
 
@AwalGarg He means that he wants the bot to support console.log('format string', arg1, arg2, argN)
 
ohh ok
 
anyone know where the issue might be?
 
xD
 
3:15 PM
function _log(){
   var string = [].shift.call(arguments);
   var args =  [].slice.call(arguments, 0);
   // do stuff \here
   console.log(formattedString);
}
 
@Skullomania compile it in DOS? wat?
 
im just starting out in node.js
 
@Skullomania If you have a server.js file, you should start it with simply node server.js
 
@Skullomania did you install node.js ?
 
thanks I will try this
 
3:17 PM
and added it to windows path ? [cause on old windows it might not]
 
@darkyen00 yes
 
k then do what secondrukido said
 
@darkyen00 i dont think I did this
 
@Skullomania just run second's command
 
@Skullomania OS?
 
3:18 PM
if its not in path
 
@darkyen00 add it to windows path
 
@SecondRikudo pretty sure dos means windows
it will error out
 
@darkyen00 which windows?
 
they are all crap ^^
 
I am using windows 7 64 bit
 
3:18 PM
@darkyen00 you mean the environment path variable?
 
@AwalGarg yeah
node installer does it but it messed up npm for me
 
...that is prolly the most problematic POS in windows.
 
@darkyen00 bear with me...i learned how to program on windows NT...the habit is quite hard to break
 
@Skullomania node should be configured correctly then
Try running node P:ath/to/server.js
from cmd
 
i did that from cmd and it gave me a javascript error..I will post it
 
3:21 PM
means node is configured.
@SecondRikudo you know what pisses the crap out of me in windows
WINDOWS SCRIPT HOST, the piece of shit that tries to execute javascript file as JScript files.
 
yea,,,it gives a object expected error
 
show the error log
 
cmd is crap, bash is superb, though I don't know much about bash.
 
just copy paste
@AwalGarg lol
thats like having sex is fun, though am a virgin
2
 
@Skullomania Do you know how to copy from Windows' CMD?
 
3:22 PM
@darkyen00 "much" !== "anything"
 
@SecondRikudo yes [ explorer . ] and then do it via explorer (XD)
otherwise XCopy is piece of crap
 
@darkyen00 I meant copy strings
 
ps i have Win32GNU tools installed, so i just use bash :$
 
copy source/path dest ?
 
@SecondRikudo oh that yes
Right click
 
3:24 PM
@SecondRikudo right click, mark, select, enter
 
select (mark it ) it with mouse
enter to copy
 
such a weird way!
 
@darkyen00 IIRC you have to do something to be able to mark it first
 
^ Told ya
 
3:24 PM
hahaha
 
dude
run
node server.js
 
I remember this screen... I used to open .js files just by double clicking them always getting this....
lol those days :P
 
dont you ever set
node as default handler for .js files
just dont
 
@darkyen00 I didn't even know what node is that time... they opened with the script host itself
 
currently my js files are opened with notepad ++
 
3:27 PM
like .vbs scripts
 
@Skullomania START+R > cmd > cd P:ath/to/node/project > ENTER > node server.js > ENTER
 
i think that did it
 
NO NO N ONO NO NO NO
 
let me test the local host
no?
 
@SecondRikudo you really didn't kew that this works ?
click the address bar in explorer
and type cmd ?
bam cmd prompt in the directory you want :D
 
3:30 PM
that worked I can see the hello world test
@darkyen00 you say run the command as the url?
 
@FlorianMargaine haha I see the same challenge you posted (memoize) in js the good parts
 
no
 
for halloween ?
 
3:59 PM
0
Q: Dojo Dgrid updating Observable Memory Store

devdarI have a dgrid with no data. The user executes a query and a json object is returned. I would like to have the updated data reflected in the grid. The results are from an ajax request which returns a json object. Once i get the object i set the relativesData[] equal to data.relatives. For the c...

 

« first day (1471 days earlier)      last day (3472 days later) »