« first day (903 days earlier)      last day (4052 days later) » 

5:00 PM
Is there an easy way to simulate private variables?
 
yes.
wraping them into closures
 
methods from prototypes can't see them, though. You need to add such methods to the objects themselves
 
Hm...
 
such methods are then called "priviledged"
 
I feel like I haven't gotten any of this :\
 
5:11 PM
function MyObject(){ var privateMember = 0; this.getGUID=function(){return privateMember++}}
 
what does the var part do?
 
a constructor is a function.
It can have its own local variables.
Those are then closed over by the privileged methods
var declares a local variable in the current scope
 
oh
Normally it would not stay, but with the function enclosing it, it is preserved?
 
that's how closures work, and what makes javascript so amazing
a variable exists as long as it's referenced from somewhere, even if its defining function has long returned.
 
0
Q: In what way is JavaScript (ECMAScript) similar to Self and Scheme

AverageMarcusWhen looking at the ECMAScript 4th Edition specification here it mentions that ES3 is a simple, highly dynamic, object-based language that takes its major ideas from the languages Self and Scheme. I'm not familiar with these two languages and cannot seem to find any mention of what exactly...

 
5:23 PM
If you try that in Java, it complains. Java doesn't have closures.
It requires the variable be final, then fakes a closure by copying that variable's value.
 
Oh.
 
(which can be a reference, so...)
 
You know Java?
 
huh, interesting. Chromium switches to Blink and Firefox to Servo.
 
The IE team, confused, switches to Gecko
 
5:26 PM
@Pawnguy7 yes. Quite verbose, doesn't have closures or first class functions (one-method interfaces don't cut it)
 
@SomeKittens heh
 
SomeKittens++
@SomeKittens that would be great :-)
 
@JanDvorak But, this does nto seem to truly mimic private vs public.
 
@Pawnguy7 Does the language really need to do that?
 
SomeKittens++
 
5:27 PM
@Pawnguy7 yeah, you can't inherit a privileged method
 
I find access specifiers quite useful.
 
@Pawnguy7 Think out of the small box that Java is.
 
I am thinking of C++ actually.
 
JS is the best of C-style and lisp languages, with only a hint of meth.
 
Then C++
 
5:28 PM
That is not a small box :D
Like.
 
Yea no, C++ isn't exactly small but just not comparable to JS at all.
 
Private variables are useful, yes?
 
not really
 
Why not?
 
Because there are no classes you need to hide them from.
 
5:30 PM
how much do you have to hide?
 
Well, given an object declared at the start of code.
Any code from that point on could change anything, including interior variables.
 
it couldn't
 
Why not?
 
local variables are only accessible from their own scope (and closures)
 
maybe it is a closure.
Sigh.
 
5:31 PM
The privileged method is a closure
 
Do you know the benefits of encapsulation?
 
I encapsulate my privates IRL :-)
 
Imagine a window class for a desktop app.
 
Give us a proper JS example not a C++ example because JS !== C++
 
The only limitation is that you can't put privileged methods into the prototype; you have to clone them.
 
5:36 PM
I don't know a JS exampe, persay.
Anyway, you want an openGL context.
without it, you can draw nothing.
Now, imagine, since thsi context is public.
 
WebGL
 
some code changes the context, and nothing draws. HAve fun debugging that.
How are you going to fine it?
ANYTHING could change it.
 
Some code changes Array. Have fun debugging that.
 
in JAvascript?
 
@Pawnguy7 I'm well aware of the implications of public class members.
 
5:38 PM
You mean, if you do stupid things, there'll be consequences?
2
Intriguing.
 
With a team of people, they do stupid things.
Especially when they didn't write the origional code.
 
would you let them come to your office?
They could decide to carry away your monitor
 
Pawnguy does have a point, people are stupid.
 
Yea well so far I can't really provide any answer at all since you're just asking in the context of C++ where obviously it makes sense, because of how the language is used.
 
If you overwrite Array.prototype.slice, jQuery will break.
 
5:40 PM
Once you have a valid example for JS we might be able to actually discuss this.
 
@JanDvorak reasons you don't use JS
 
Heck, you add a method to Object.prototype and jQuery crumbles.
 
You cannot do that in Java.
 
Some guy once said "with great power comes great responsibilities"
 
sadly :-(
 
5:42 PM
You cannot do a lot of things in Java ... doesn't make it better.
 
You cannot pass a function in Java
 
You can do a lot of stupid things in Java as well.
 
You can do that in js because js is very powerful.
 
With great power come great thermal losses.
 
downloads Arch Linux
 
5:45 PM
With great power came our dictator
 
@Pawnguy7 So you want a language that doesn't allow you to do anything that might break?
 
Of course not.
 
I actually still don't know what he wants.
 
I am saying, for every idiot-proof code you make, there will be stronger idiots.
And, in Javascript's case, you are leaving the door wide open to idiots.
 
Not any more open than in other languages.
 
5:46 PM
the part that leaves the door open to idiots is "java" in its name.
 
Frankly my dear, I don't give a damn.
 
I would argue it does.
 
Not at all ... you wouldn't believe what I've seen in Java and Python ...
 
you are leaving the door wide open to idiots ... with which they can carry a box with their belongings as they leave the building of your company.
 
You can be profane in any language
 
5:47 PM
Idiocy is language agnostic.
3
 
Yes, the language can protect you, but it's the same extent that fourth grade "protects" you from advanced concepts.
 
Yes, but in what language can you redefine array methods? This.
 
@JanDvorak at my company you could simply take some internal documents to the scanner and send it to your home email
 
C++ both protects you AND gives you power.
 
@Pawnguy7 Heh. You mean the power to completely crash my computer because of a botched pointer?
 
5:48 PM
That is power, yes.
 
Or, better, some other coder's botched pointer?
 
Your point?
 
@Pawnguy7 in C++ someone does asm{INC EFP} and you're dead.
 
@Pawnguy7 you seem to not know what c++ is able to do... if held by a brainfucked creeper
 
I am not saying you cannot break code - anybody can - I am saying, in terms of the access system, C++ is more idiot-proof.
 
5:49 PM
@Pawnguy7 So does js, but on a different level.
 
Heck, #define true false - have fun debugging that
 
@Pawnguy7 Should I get started with What language allows you to write to a memory block that's in use already thus crashing everything ...?
 
But language wars leads nowhere. This is js, deal with it.
 
Zirak++
Exactly ...
 
In Javascript, a[-1]=0 is perfectly fine. In C++, a[-1]=0 is quite deadly.
 
5:50 PM
c++ has not got a sandbox
 
You are taking this out of context.
 
javascript however got
 
I am arguing that, in terms of access control.
 
Until the day comes that there is a language that isn't used by people, they're all going to suck in some way.
 
@twiz machine code
@twiz malebolge
 
5:51 PM
Let's say I make this window class.
 
@twiz intercal
 
In C++, if you break it, you really have to try pretty hard.
 
@twiz brainfuck... maybe
 
@JanDvorak you make a lot of web apps with that? haha
 
In JAvascript, not so much.
 
5:52 PM
Until there's an actual JS example to discuss I'm out.
 
@twiz "that isn't used by people"
 
@Pawnguy7 you compare apple and pie
 
I didn't say they were the same.
 
@JanDvorak but I would say it is used by people, just at a higher level of abstraction
 
!!/karma c
 
5:53 PM
I am looking for a way to do similar access control.
 
@SomeKittens c has 50 karma
 
heh
 
@Pawnguy7 as I said, you can write to a random location (by mistake) and you don't even know what you break
 
!!/karma i
 
@Zirak i has 48 karma
 
5:53 PM
@Pawnguy7 Present us a case where you'd need that.
 
hrm...
!!/karma oshi
 
@Zirak oshi has no karma
 
huh.
 
@Pawnguy7 you said you want to create a class. the funny thing is.. c++ has classes. javascript has not. you compare water and cars
 
Bad memory management in C++ = weird crashes. Bad memory management in Javascript = memory slowly grows without bounds.
 
5:55 PM
@OctavianDamiean I will get back to you when I work on a project with more than 10k lines.
 
I don't quite see how LoC are related to access control but alright.
 
Maintanibility.
 
GLoC[k]
 
Access control has absolutely nothing to do with maintainability ... not at all.
It's like saying I'm locking the door so I can cook egg
 
It does if you're working with idiots. The more tightly you can control the extent their stupidity can reach the better
I prefer to just hire people who aren't idiots
 
5:57 PM
Did you know you can actually read some other class's private data and change its private fields in Java?
You can't in javascript
 
It's widely known that C++ is the language of the 60s, where your friends have access to your privates.
3
 
How?
 
@AmaanCheval reflection
 
Hahaha
 
5:58 PM
@JanDvorak thats how most of the java security exploits in the past worked
 
Zirak++
 
Zirak++
 
@GottZ pass a string and overwrite it from a separate thread - style?
 
DELICIOUS E-POINTS
 
!!/karma Zirak
 
6:01 PM
@OctavianDamiean zirak has 3 karma
 
;-;
 
Mysterious downvotes FTW
 
20 secs ago, by Jan Dvorak
Zirak--
 
!!/karma Zirak
 
Not so mysterious now eh?
 
6:02 PM
@JanDvorak zirak has 1 karma
 
@JanDvorak i will not cause i hate java even more than a broken harddrive.
 
Sandbox!? You little...
 
@Zirak stop beating yourself
 
You're just an immature doodoo-head!
 
Well, you did de-karma yourself
 
6:04 PM
...an interesting point
If you'll excuse me, I have a cliff to jump off of
 
Ok, dumb question time: Why do I need to escape & in HTML? I ask because I want to detect URLs that might have ampersands in them (and thus not escape them), and want to know if it's safe to not escape ampersands
 
while(!y>0)y--
 
Because & begins entities
But it's safe to use it inside string context, or at least it should be
 
To the Arch users, how is aur in terms of dependency handling? Any issues?
 
AUR is the user repository; pacman is the manager. And it's kickass.
 
6:07 PM
Oh.
 
@Zirak yaourt ftw!!!
 
Alright.
 
zirak++ //undoing my downvote
 
in /etc/pacman.conf add the following:
[archlinuxfr]
Server = repo.archlinux.fr$arch
 
!!/karma zirak
 
6:08 PM
@JanDvorak zirak has 2 karma
 
it will allow you to install yaourt through pacman -S yaourt
 
I'll never forgive you.
 
How's the general system stability given that it is on a rolling-release model?
 
Zirak++
 
!!> for(var i=0;i<100;i++) { console.log('zirak-- ');}
 
6:09 PM
@SomeKittens "ReferenceError: i is not defined"
 
OWNED
 
haha
 
@SomeKittens "undefined" Logged: zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zira (snip)
 
!!/karma zirak
 
!!/karma zirak
 
6:09 PM
i dont think it reads its own messages
 
@JanDvorak zirak has 2 karma
@OctavianDamiean zirak has 2 karma
 
phooey.
27 secs ago, by SO ChatBot
@SomeKittens "undefined" Logged: zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zirak-- ,zira (snip)
 
!!/karma zirak
 
@JanDvorak zirak has 1 karma
 
@OctavianDamiean Can't complain.
 
6:10 PM
LLOL
Zirak--;
 
I guess it takes just one "zirak--" per post
 
@JanDvorak That would make sense
 
!!/karma GottZ
 
@GottZ zirak has -1 karma
 
Darkyen--
!!/karma Darkyen
 
6:11 PM
@GottZ gottz has no karma
@Darkyen darkyen has -1 karma
 
Darkyen++
okay
 
!!/karma I
 
Darkyen++
 
@JanDvorak i has 49 karma
 
and once more
Darkyen++
!!/karma Darkyen
 
6:11 PM
@Darkyen darkyen has 2 karma
 
twiz++
 
:-(
 
It was a mistake to let you decide on random integeric values.
 
6:12 PM
twiz+=2000
!!/karma I
 
@twiz i has 49 karma
 
who is "I"
 
What about letting each user vote once on a topic?
 
!!/karma twiz
 
@twiz twiz has 0 karma
 
6:14 PM
@BenjaminGruenbaum with 5-minute undo windows?
 
ok I'm done. Why am I here...
 
@BenjaminGruenbaum That would kinda defeat the purpose.
 
what do you guys think about this lightbox script
 
@BenjaminGruenbaum It's not a vote, it's more like a star. It's a token of "you're awesome". I guess it should disallow self-voting...
 
Darkyen+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++‌​+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++‌​+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++‌​+++++++++++++++++++++++++++++++++++
 
6:15 PM
!!/karma Darkyen+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++‌​‌​+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++‌​++‌​+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++‌​++++‌​+++++++++++++++++++++++++++++++++
 
!!/karma Darkyen
 
I think a room-owner only karma clear command would be useful as well.
 
@JanDvorak darkyen+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++zwnj​‌​+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++zwnj​++‌​+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++zwnj​++++‌​+++++++++++++++++++++++++++++++++ has no karma
@Darkyen darkyen has 4 karma
 
Like per topic and a total clear.
 
@twiz for(var i=0;i<10; i++ ) {
 
6:16 PM
where does that zwnj come from oO
 
zwnj ?
 
ooooohhhh, that explains some bugs
 
@Zirak huh? Why does it translate zero width non-joiners?
 
It's the hidden characters which means word-breaks
 
:P
 
6:16 PM
@twiz same reason c has so much karma
 
Chat probably uses it to force specific line-length
 
!!>[].join.call({length:30},"-")
 
@JanDvorak Invalid command /[].join.call({length:30},"-")
@JanDvorak "-----------------------------"
 
That's what I like about Javascript :-)
 
I might consider using Arch on my RPi.
I like the philosophy.
 
6:22 PM
arch is still the best supported distri for RPi
 
Also, since Ubuntu is becoming mainstream I need to find something less mainstream to maintain my weirdo outsider image.
 
@OctavianDamiean DSL?
 
hey Any Ideas, first iframe works and second doesn't I am dumb struck
http://jsfiddle.net/FpMUA/
 
@OctavianDamiean PBR: The distro
 
@JanDvorak As in Damn Small Linux?
 
6:25 PM
@OctavianDamiean yup
 
@Mike Works for me, according to the documentation you've written
 
@Mike Google sets a header which disallows it to be framed.
 
@Mike "Refused to display 'https://www.google.com/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'. "
 
@Mike Google doesn't like its homepage inside a frame
 
@david what is the work around, I tried yahoo.com that too didnt work
 
6:26 PM
@JanDvorak Isn't the DSL project abandoned?
 
@OctavianDamiean inherit the project ;-)
 
@JanDvorak; yahoo too doesnt work
 
@Mike perhaps yahoo doesn't like its homepage inside a frame?
 
@JanDvorak Nah, I need something less mainstream than Ubuntu but still something that isn't a PITA or time-hog.
Got things do to. :D
 
@OctavianDamiean Windows 8 is pretty much an outsider :-)
 
6:27 PM
@Mike the workaround is to make your own google
 
@JanDvorak: Do you know what could be the criteria. I tried stackoverflow that too didnt work jsfiddle.net/FpMUA/1
 
@JanDvorak heh
 
@Mike the criteria is whether that site likes being embedded inside a frame
 
Oh nice, Arch uses systemd.
 
yush. since.. dunno.. some months
before it used init.d
 
6:31 PM
@david how do I display google.com inside an iframe. no jokes plz
 
@Mike not possible
@Mike perhaps with a proxy
 
@Mike Why do you want to do that?
 
@Mike you need to put your website on the same origin as google'
 
I need to display top 10 sites in a container, after ppl select the one in the select dropdown. the dropdown options inlcude yahoo, google, facebook, twitter et-al
 
not possible.
 
6:34 PM
et al? those are websites not people
 
You could download the page from a PHP script and then pass it along
 
Google didn't disallow it so you can un-disallow it; they did it on purpose. They do not want to be put in a frame, so you cannot do it.
 
What bootloader does Arch use? Grub2?
 
You install the bootloader
 
Oh my, so much freedom ...
 
6:35 PM
@Mike why are you doing this?
 
@JanDvorak: any option in terms of js. php is out of scope. may be ajax
 
But I'd go with grub2 anyway
 
@Mike cross-origin AJAX is forbidden as well
 
@SomeKittens: fun
 
Heard some good things about Burg, I might try it just for fun.
 
6:37 PM
@Mike give up, then
 
@JanDvorak Sure gave up. Good Night guys, thanks for your thoughts
:)
 
@OctavianDamiean Welcome to Arch
You can even choose to not use a GUI
Insane!
 
I feel like the Romanians after being "freed" from Ceausescu.
 
0
Q: Animating a background 'pulse' with easing equation

codinghandsI'm trying to find a suitable easing equation (or other method) to animate an object so that it 'pulses' (imagine a 'spike' on a music visualiser, or see the image I drew badly below) 'v' is the value I'm using to scale. 't1' and 't2' mark the end of a single pulse. The game I'm working on is...

 
@OctavianDamiean Do you really (want to) switch to Arch just because Ubuntu's "too mainstream" and you're a hipster?
 
6:44 PM
I should have bought some normal pistachios too instead of just habanero... i want to eat them but my face says no
 
I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important. Bad programmers worry about the code. Good programmers worry about data structures and their relationships. — Linus Torvalds
 
Lots of updates, including oneboxing of images and URLs! Try and break it: kittens-chat.herokuapp.com
 
@Zirak basic parser done
now i am wondering how to implement the harder thing
 
@Darkyen Open-source it
 
aka "functions"
 

« first day (903 days earlier)      last day (4052 days later) »