« first day (1099 days earlier)      last day (3852 days later) » 

10:00 PM
@Shea however, I'm not quite sure I understand what you're trying to achieve.
 
Structurally, I agree, but we have build.js which already works well in node.js. That's our run file right there
To run in node.js we could enter it through build.js, which could possibly work closely with git
 
Honestly? Once we're actually doing the switch, I'd rather have Grunt build it.
 
It could only build when there's a change, have our cache, add databases, and http server
 
Hey guys if i have a variable declared in a call back function and i want this variable to be global how can i do this ?
It's in javascript
for e.g. disp = new google.maps.DirectionsRenderer(rendererOptions);
 
It seems like @Zirak has kinda been building it from scratch, and it's almost all there and ready to adapt to a new environment
 
10:03 PM
@Shea Zirak is afk: hurricane
 
I think I've been watching too much Animal Planet
 
@dev_darin declaire the variable in a global scope
 
@whitehat101 ok but it needs to access a different renderOption since the variable is in a loop
 
@OctavianDamiean I'm gonna read about Grunt
 
I don't get what you're trying to do then
show us
 
10:08 PM
@whitehat101 lets say i declare this at the top in a global scope var disp = new google.maps.DirectionsRenderer();
@whitehat101 then later on i want to pass options to it like this disp(rendererOptions);
@whitehat101 its telling me disp is not a function
 
Just so you know the placement of your variable declarations within the function doesn't really matter because of hoisting.
 
Hello, stackers, I'm trying to access static member in instance, I'm lost. Should I try use closures or emulate static member with var. More here goo.gl/y6ah6L.
 
var disp = new google.maps.DirectionsRenderer then disp is a functuon
() calls the function
@AlanKis well you already have an answer suggesting use prototypes
 
@whitehat101 can you look at this link http://jsbin.com/OsIWoxI/1/edit?html,output
when the second marker completes i am trying to clear all the overlays
 
but really, you don't want to code JavaScript as if it was Java
 
10:13 PM
@whitehat101 you can look at the animate function
 
@whitehat101 But in that case static member is not shared between object constructor and instance.
 
In about 5/10 mins I'll be able to focus more
 
How is this a static property?
Foo.staticProperty = "This is static property";
It's just a property.
 
hello
!!hello
 
@Delarn That didn't make much sense. Maybe you meant: help, tell
 
10:20 PM
JavaScript doesn't have "static properties" the real issue is trying to fit a square into a round hole
!!welcome Delarn
 
@Delarn 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.
 
I'm confused now.
@w
@whitehat101 I got idea of static member from here: stackoverflow.com/questions/1535631/…
 
this is the code. problem is, when my checkbox are inside the custom control they don't react with my code. gmap3.net/forum/viewtopic.php?id=1093
 
Or shared property between object constructor (function) and instance of that constructor
 
@AlanKis is this what you want? jsfiddle.net/FAbd5
access "staticProperty" inside the constructor?
 
10:28 PM
Yea, I'm not really getting what exactly he is trying to do.
 
@whitehat101 Yes
For example, constructor has some variable id, I want to change value of that variable when i call method on "class"/empty object constructor and from constructor
 
@whitehat101 can you look at this link jsbin.com/eHayUla/1/edit?html,output
 
@dev_darin yeah, something with the animate function?
 
@whitehat101 yes
@whitehat101 i am trying to clear all overlays when the first marker stops moving
 
Form robertnyman.com: A static member is shared by all instances of the class as well as the class itself (i.e. the Kid object), but it is only stored in one place. This means that its value is not inherited down to the object’s instances. Stupid me.
 
10:33 PM
@whitehat101 i am able to get the markers to clear bubt not the routes
 
// Constructor
2.
function Kid (name) {
3.
// Constructor code
4.
}
5.

6.
// Static property
7.
Kid.town = "South Park";
 
@whitehat101 the polyline routes
 
This means that only constructor function holds value of static member, and instances not?
 
10:45 PM
What are your thoughts on this new Hour of Code thing that is all over the news now? code.org/hourofcode
Do you think it will be good for the industry or do you think it will bring in more incompetent coders?
 
@whitehat101 Seems that JS OOP approach confuses me. Simply referencing to static member with prototype works like charm.
Thanks for your time.
 
@Domecraft why would it "bring in more incompetent coders"?
These are students
And I for sure didn't get much exposure to programming k-12
 
Because people might think it's easy to code and they thing hacking together code is good practice
 
It is easy to code
 
@AlanKis JS oop is hard.
 
10:56 PM
because of the instant feedback, and the availability of documentation
 
@AlanKis much harder than Java or other classical OOP since typing is behavioral and Java gives you an illusion of type safety with classes.
@AlanKis don't worry if you don't get it at first, no one does :) It's a lot harder to get than other OOP but once you get it it's quite good. Behavioral typing is just a stronger notion of OOP.
If you'd like to start learning, I suggest you read about the LSP (Liskov Substitution Principle) and see how that works in JS OOP. OOP in JS is based on behavior and not structure.
 
I lOVE HASH OIL !!!
 
@RickyWilson ?
 
Oil extracted from hash
 
@RickyWilson ?
What do you love so much about it, and how is it related to this room?
 
11:03 PM
Hash oil is the most potent of three main cannabis products, which are herb (marijuana), resin (hashish), and oil (hash oil)
 
@RickyWilson BTW fun fact, this room is Google indexed. Future employers can, and will find everything you say here when looking for you online.
 
Sorry my friend was fucking with my laptop
 
Yeah, they ain't going to believe that ;) Good luck though.
 
@BenjaminGruenbaum why do you always say "behavioral typing" when everybody else says "duck typing"
(it's a rhetorical question btw.)
 
@FlorianMargaine because it's not the same. Python has duck typing but not behavioral typing. Ruby has behavioral typing like JS
 
11:08 PM
what's the difference between both?
 
Duck typing says "I can add properties to an object in run-time". Behavioral typing says "The type of an object is defined by its behavior"
 
In order to do behavioral typing correctly you have to actually follow principles, mainly the LSP. Duck typing is an ability, behavioral typing is a type system.
 
duck typing is also "does it walk like a duck"
 
Yeah, not the same thing.
 
11:10 PM
I don't really see what's your difference
and wikipedia is not really going in your way
now I'm sure there's something interesting behind what you say, but I'd like to see a resource to read that peacefully
 
Substitutability is a principle in object-oriented programming. It states that, in a computer program, if S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e., objects of type S may be substituted for objects of type T) without altering any of the desirable properties of that program (correctness, task performed, etc.). More formally, the Liskov substitution principle (LSP) is a particular definition of a subtyping relation, called (strong) behavioral subtyping, that was initially introduced by Barbara Liskov in a 1987 conference keynote address entitl...
Read about the notion of strong behavioral sub-typing for example. I recommend Liskov's own article over the Wikipedia page, there is a link to the full text at the bottom.
In programming language theory, subtyping (also subtype polymorphism or inclusion polymorphism) is a form of type polymorphism in which a subtype is a datatype that is related to another datatype (the supertype) by some notion of substitutability, meaning that program elements, typically subroutines or functions, written to operate on elements of the supertype can also operate on elements of the subtype. If S is a subtype of T, the subtyping relation is often written S . Various calculi that attempt to capture the theoretical properties of object-oriented programming may be derived from sy...
 
I see what you mean
then JS can also rely on duck typing, not behavioral typing
 
Well, for example. Is {length:2,0:1,1:2} an array or not?
 
although it's not so common
 
The two don't contradict, they complement.
 
11:13 PM
some people like to do it (namely, Zirak)
let me go back to my C anyway!
:P
 
C sucks :P
 
Duck typing is useful :) It's more related to monkey patching than behavioral subtyping.
 
11:15 PM
@BenjaminGruenbaum I just created my own vector implementation! that can't suck!
 
I'm going to sleep now. Good luck :P
night
 
night
C99 brings some nice stuff on the table btw
like you can declare variables when you need them, not at the start of the block
 
Most compilers allow that even outside C99 mode though.
I think even Visual Studio's compiler which lacks C99 support does.
 
gcc doesn't allow it
$ make
gcc -Wall -c src/byte.c -o obj/byte.o
gcc -Wall -c src/png-reader.c -o obj/png-reader.o
src/png-reader.c: In function ‘PNG_read_headers’:
src/png-reader.c:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
src/png-reader.c:9: note: use option -std=c99 or -std=gnu99 to compile your code
src/png-reader.c: In function ‘PNG_frame_type’:
src/png-reader.c:100: error: ‘for’ loop initial declarations are only allowed in C99 mode
make: *** [obj/png-reader.o] Error 1
 
yes, but you don't have to declare all variables at the start of a block:
[adrian@hades:/tmp]> cat fap.c
int main() {
    int i;
    i = 5;
    int j;
    j = i;
    return 0;
}
[adrian@hades:/tmp]> gcc -std=c89 fap.c
[adrian@hades:/tmp]> gcc -ansi fap.c
 
11:20 PM
oh yeah, that's just the declaration in the for loop 1st part
like, the thing everybody uses and wastes i for
 
11:30 PM
@BenjaminGruenbaum Yes, I know that on hard way.
 
0
Q: Turning list of urls into a navigation pane

BatmanI have a list of sites and sites within those sites. How do I create a navigation tree using ul and li elements given this output? https://hosted.demo.ca https://hosted.demo.ca/academic https://hosted.demo.ca/academic/bm https://hosted.demo.ca/academic/cmtte https://hosted.demo.ca/academic/dm h...

 

« first day (1099 days earlier)      last day (3852 days later) »