« first day (1499 days earlier)      last day (3449 days later) » 

3:00 PM
mzl.la/112VrtT
 
nc;dv (not clickable; didn't visit)
 
3:15 PM
JSON question for you all. I have a JSON with a structure like this - [{color: "red",value: "#f00"},{color: "green",value: "#0f0"}]. I have a JavaScript file that makes a get XMLHttpRequest() to load that JSON, and a callback function. In the callback I loop through the JSON to print out each object, e.g. for(var i in data){console.log(data[i]);}. But instead of printing two objects it prints out each character line by line. ... why is that?
 
don't use for..in for arrays
but the primary problem is that you need to decode the JSON first before using it as an object
 
@JanDvorak ah ok. should I use JSON.parse()
 
Yes
 
@JanDvorak ah thanks :)
 
I've been reading through some java files and everything was pretty clear, until I've encountered the continue keyword. After some research I still can't understand if it skips the loop it's in or if it only stops the current cycle and skips to the next
like:
while(true){ continue; }
//other code here
 
3:21 PM
Hint: it does the other thing than break
 
will the other code ever run?
@JanDvorak break ends the whole loop, right?
 
right
 
basically skips the loop.... what about continue? skips only the cycle?
or is it exactly as break?
yeah, current cycle, tested
ok, thx
 
@towc continue exists in all C-like languages ftr (yes, including JavaScript)
 
we have continue 0.o?
 
3:32 PM
TYL ;-)
 
nope: illegal statement
 
sure we do
 
wait, it needs to be in a while
 
sure it does ;-)
 
Or in a for
As in java, or all C-like languages
 
3:34 PM
gosh... we have continue!
 
@towc continue inside of a loop
 
WE HAVE CONTINUE GUYS!
 
There's also break
 
@SecondRikudo knew about that one... but man.... continue!
 
And goto
 
3:34 PM
@towc is pretty pointless, I know.
 
Wait, that's php
 
You can even use labels with continue
 
And yield
 
I was unaware of you this whole time: I will love you and overuse you in my code from now on <3!
 
3:35 PM
It's a code smell, though
 
I don't even use for...
 
continue is similar to goto... It has its uses, but it's rare
 
@FlorianMargaine never seen it in any js code
 
Want me to show you some js code that uses it?
 
3:36 PM
goto has two main uses: state machine (use a switch loop) or a jump-to-end (use proper exceptions)
 
@FlorianMargaine sure... I guess
 
Hint: it's a parser
 
@FlorianMargaine nope nope nope. I'm outta here
 
someone help me undrstand how to use the mutation observer pastie.org/9738347 I am trying to watch for new messages. in here
 
3:57 PM
@argentum47 for subtree modifications, check addedNodes and removedNodes
 
@FlorianMargaine I always use continue for linear search on unsorted data
 
!!> [1,3,5,8].find(x => x%2 == 0)
 
@JanDvorak 8
 
@RonaldMunodawafa ^
 
4:09 PM
Not every language has that method
 
Java doesn't count
 
C counts
Java counts
C++ counts
Go counts
 
Haskell has that
 
x => what's this
 
Ruby has that
Javascript has that
 
4:11 PM
 
ASM counts
 
@RonaldMunodawafa ASM has goto
 
Though it doesn't have either
 
no, ASM has jmp and lngjmp... not goto
 
ASM has no goto
 
4:12 PM
@FlorianMargaine that's just a synonym
 
Not really
 
it is...
 
goto in most popular languages is just a short jump
 
50% off select logitech products US only - amazon
 
break and continue are just specialised forms of goto
 
4:15 PM
True
The while loop too is just a goto + comparison
 
no. It's a goto + comparison
 
Functions are gotos as well
I had left that out
In some languages
 
functions are call targets, not jump targets
 
Functions are much more than just goto
 
unless you're doing TCO
yeah... virtual method calls are an entirely different can of worms
 
4:17 PM
TCO is just reuse of stack frames
 
When I was 14 and overambitious I implemented functions as gotos
The functions were crippled
Anyway
The only two things you should ultimately have in a language are pointers and recursion
 
My point was - you really want to use functional programming where available
You don't even need pointers
just references
Look at Haskell ;-)
 
Well, I want pointers and recursion in one langaueg
You can call them arrays
 
Look at Haskell ;-)
 
Is manual memory management in Haskell possible?
 
4:25 PM
Ew
 
I hope you're not advocating C here
Because that's the last language anyone should ever choose for anything
 
You have mVars, which are static containers that can contain references to specific values; reading and writing to them are both I/O actions
 
Except writing a boot sector maybe
 
What's wrong with writing a boot sector?
 
4:26 PM
Ew to you but not me
I am advocating C++ and 64 bit ASM
 
@JanDvorak Nothing
 
@RonaldMunodawafa but... why?
@RonaldMunodawafa I still have a 32bit CPU...
64bit ASM: the ultimate way to deliberately write incompatible code
 
wow this room looks better at 90% zoom level
 
@AwalGarg primarily opinion-based
The text gets harder to read when you get near 50% zoom
 
How can I set custom zoom level?
 
4:34 PM
CSS?
 
how?
as in custom browser zoom, I meant...
 
posted on November 23, 2014

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); try { var pageTracker = _gat._getTracker("UA-3727700-1"); pageTracker._trackPageview(); } catch(err) {} OH MAN. BAHFest videos coming soon.

 
I don't think you can
 
hmm
 
4:46 PM
@JanDvorak chrome://settings/ right click custom zoom select menu, inject custom value from debugger, boom!
 
nice
 
I wonder what happens if I input something weird...? I don't wanna break my chrome, anybody willing to take the risk?
 
I am willing to break your Chrome
 
:P
lol the zoom basically works by injecting the css zoom property to the document parent element!
I think it would be pretty easy to create an extension that can behave similarly, with custom zoom values...
owwait
wasn't there someone who came here inquiring how to disable browser zoom? Was it @Basj ?
 
the link
 
@BenjaminGruenbaum $40? I just paid $99 for my vs :/
theres a rumor that windows 8 users will get windows 10 for free
that would be nice
 
5:27 PM
@AwalGarg what for ?
 
read
 
@AwalGarg what am i supposed to use it for ?
ps someone just posted a morphed image of me on miaou
 
hold on
 
@dystroy :-/
 
5:45 PM
What is the point of compiling C++ to JavaScript
 
Support for legacy code
 
am quite thankful
we aren't on miaou :-)
 
Someone is writing a game in C++ so he can compile it to JavaScript
He is using Emscripten
 
Language preference?
 
There is no point in writing it in C++
just to use EMScripten, unless hes using some huge 3d engine
but that requires heavy optimizations afterwards afaik
 
5:51 PM
Well, he does not want to learn JavaScript
 
he'd have to unlearn c++ to say that he learnt js XD
 
@FlorianMargaine you around , @dystroy you around ?
 
they asquare
 
I know developers who work with C++ and JavaScript only
They are not willing to learn anything else
 
@RonaldMunodawafa would they need to?
 
5:53 PM
Yes
 
why?
 
For the sake of learning
 
uhh... sure
 
But there is one thing that fussed me about JavaScript though but I am slowly becoming tolerant about it --> weak typing
 
typescript will help you transition
 
5:57 PM
@RonaldMunodawafa that's one of the things that I love in js
 
I hate weak typing. I personally don't give a damn if a language is statically typed or dynamically typed or if it employs lazy evaluation but if it is weakly typed worse than C, I puke which is why I love Go
Thanks @JanDvorak
I remember when I couldn't figure out why 3 + 4 was 34. It was as if I was writing Visual Basic 6 again
 
just dump everything into a var! It's not good practice in programming, but I can't see how someone can get confused about it when writing
 
I hate strong typing.
 
@erikroyall why?
 
I don't see why you need to declare a variable or function's return type when you can be more descriptive in naming them.
 
6:01 PM
@erikroyall Do mean static typing?
@erikroyall That's static typing
 
@erikroyall Use type inference
Haskell is pretty good at it
 
Static typing and strong typing are two different ideas
 
@RonaldMunodawafa result is calculated in base 1 using a base 5+ writing system?
 
and by "pretty good" I mean "it helps debugging, but it's not needed otherwise except to resolve ambiguities"
 
Type inference is the way to go
 
6:03 PM
@towc looks like string concatenation to me
 
It is string concatenation
 
34 = 3*(1^1) + 4*(1^0) = 3*1 + 4*1 = 7 in decimal
 
If you are going to be weakly typed at least be static
 
@JanDvorak no no, definitely a maths problem
 
@erikroyall to be explicit about what it is.
That's typically why you'd declare a type explicitly in a modern language.
For example - in APIs you expose to the outside world.
@RonaldMunodawafa Go has a horrible type system.
Everything is either a map, an array or a slice or it's not type safe.
Who thought that was a good idea?
 
6:06 PM
Umm... In Javascript...
 
Uhm I am discussing the type type specifically. The lack of generics put me off
 
In javascript everything is either a map or an array (which is a specialised kind of map with one magic property)
 
Also, the error handling is like communism - it's a good idea in theory but in practice people just ignore errors leading to low quality code you interact with.
 
That's … communism?
 
6:07 PM
@JanDvorak a) not true b) ES6 has collections c) You can make your own d) My argument was about type safety - and where Go fails in providing it.
@copy yes, communism is when people ignore errors and write low quality code.
 
I think type inference with strong typing is a good idea
 
Thus, Haskell
 
Being late bound as in OOP is good if it is good
 
Pass a function
 
I think it depends on the use case.
 
6:13 PM
You don't need virtual method call resolution everytime
 
@JanDvorak is there subtyping in Haskell possible
 
You have type-classes, which can be implemented with concrete types
The former is homologous to abstract classes, the latter is homologous to final classes
 
@JanDvorak The uni I am going to is primarily bound in Haskell and C++
I am starting next year
Should I be happy or sad?
Our first languages will be Scheme and C during the first semester and then from there on we will be expected to use Haskell and C++
 
6:29 PM
Sounds like fun
 
How complex (not complicated because Python is complicated) is Haskell. Is it as complex as C++ and does it have an ECMA or ISO or ANSI reference?
 
@RonaldMunodawafa dahek ?
 
@RonaldMunodawafa Define "complex". The behavior is really clear and Hoogle is awesome.
 
By complex I mean as in size.
Okay if the behaviour is clear I am sure I will have fun
I saw an implementation of QuickSort somewhere and it was only in 2 lines
 
    Dear friend can any one help me I want to select all html element as below this code but I can't do it

    <script>
         	var time_close =  document.getElementById("close").innerHTML;
         	var time_pub =   document.getElementById("pub").innerHTML;
            var date1 = new Date(time_close);// for current date
            var date2 = new Date(time_pub);
            var yearDiff=date1.getFullYear()-date2.getFullYear();// for year difference
            var y1=date1.getFullYear();
            var y2=date2.getFullYear();
 
6:36 PM
qSort (x:xs) = qSort(filter (< x) xs) ++ x : filter (== x) xs ++ qSort(filter (> x) xs)
 
One liner neat!
 
even shorter
 
I am sure the polymorphism is good as well
 
Need to add the stop condition though
 
The above works for any comparable type
eh... true
 
6:38 PM
qSort [] = []
 
qSort [] = []; qSort (x:xs) = (filter (<x) xs) ++ (filter (>=x) xs)
 
I also think prefix notation is the way to go
There should be no difference between a function and an operator
They are all procedures
 
prefix math is hard to read
 
It is easy for me to visualise evaluation trees in prefix form
 
qSort [] = []
qSort (x:xs) = qSort left ++ x : qSort right
  where (left, right) = partition (<x) xs
 
6:44 PM
Is there lazy evaluation?
 
Yes, absolutely
take 10 $ map (\x->x*x) $ [1..]
 
Anyone use docker and know what the following message means?
invalid containerPort: microsoft
 
or the classic:
 
fibs = 1 : 1 : zipWith (+) fibs $ tail fibs
 
6:47 PM
tail recursion?
 
Yes
Easy paralellism
 
@JanDvorak forgive me if these two question seem stupid but I have not yet even started my CS bachelors so I am still new to a lot of these ideas.
What is the difference between class inheritance and subtyping?
What is the difference between lazy evaluation and late binding?
That is theoretically speaking
 
literally there's a function that takes two arguments, decides whether to evaluate them in parallel or sequentially, and returns the second argument unmodified.
Inheritance and subtyping sound very similar to me
Late binding ~ virtual method lookup, which is very different from lazy evaluation
 
I suppose I will carry on my search because I believe amongst all the noise from people who think functional programming is newer than object-oriented programming and those who think C++ is object-oriented there is a set of theoretical concepts that is true and it is not syntactical.
I am seeking that language that reflects human intelligence in computer science
 
Purely imperative programming languages were the first
 
7:00 PM
Other then the fact that I need to make the paragraphs a lot shorter...
and I need to establish more rules and connections
 
But functional programming has been there for ages. I know this Java developer who claims functional programming is a new paradigm and I keep telling him it has been there for as long as object-oriented programming has been
 
Haskell is really old, actually
 
He speaks of lambda expressions as if they are the Google Glasses
It frustrates me people think Java is the start and end of all
People forget the second oldest high level language still in use supports both paradigms
 
Haskell?
 
@hello All
 
7:06 PM
@Mohit 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.
 
Not Haskell
Lisp
 
@CapricaSix Ok
 
oh
Clisp doesn't feel very high-level
 
is anyone who has experience in Angular JS
 
What is Clisp?
CommonLisp?
 
7:07 PM
!!google clisp high level
 
I stuck in a problem
 
@Mohit ask most of us know it
half of us love it
 
Oh yeah, and the help page is kinda ugly
 
Great I am an iOS developer just stared working on it so i think it would be basic for you guys.
I m using dropdown toggle but by default it's open when i was loaded my webpage
@darkyen00
 
7:10 PM
I do not think that is low level
 
@Mohit Why ping him?
 
@JanDvorak
I need help on angular JS
 
@mohit
@Mohit ... so?
 
Please help me if you can otherwise please don't ask me any bakwas question
I m using to open dropdown from this code but by default it's open.. I wanted it close when page is loaded
 
So... you essentially notified me that I shouldn't talk to you? How nice of you. Now if you don't mind, would you please leave?
 
7:13 PM
@JanDvorak
 
@Mohit
 
anyone please can help me
?
 
Perhaps there's a boolean attribute that controls that? Check the documentation.
 
please send me link for doc
thanks a lot
 
Why should I?
 
7:18 PM
@Mohit depends on which dropdown you are using
angulars ?
custom ?
where did u got it ?
 
yes
 
that place must have docs
 
I GOT IT FROM GOOGLE
 
STOP SHOUTING AT US
 
user457812
Ugh, Angular.
 
7:19 PM
^ Viva La Flux
 
Oh and "yes" is not a valid answer to "where did you get it?"
 
Why can't more Indians be like Amaan ?
(Including me ofc.)
 
Aren't you like Amaan?
 
I think hes better then I am.
 
In what sense?
 
7:21 PM
Writing Good Readable Code, Communication skills
 
retweets
 
If you mean grammar, practice helps
 
Haha :D
My college emailed me this [loading gmail]
 
user457812
Retweets are a measure of human worth.
 
> This is to inform you that college campus placements are at last stage, and you have been absent through most of them. You are due to send your assignments for the semester. Kindly update
 
user457812
7:24 PM
I want to be a cyborg and have all speech/communication come from an ebooks twitter bot.
 
7:44 PM
@nil Maybe you are.
 
user457812
Doubtful.
 
@darkyen00 What are "campus placements"? Classes?
 
Evening!
 
@twiz in college placements for jobs
the highest salary they get is 250k indian => 4052.523 US Dollar
 
Simple question: how to make a NPM package bin property cross platform?
 
7:52 PM
ohhh
 
so i am totally not interested
@IonicăBizău node-gyp or node-pre-gyp (if you want to redistribute windows)
 
Should I use a module for that?
I want to handle npm install -g foo
 
what module ?
node-gyp itself is capable
 
Hmm.. Isn't it possible to use package.json only?
 
It is strangely difficult to find info on making global modules in general...
 
7:55 PM
Suppose I have only a script that outputs "Hello World".
I don't have any files that should be compiled.
On Linux and Mac this works fine: {..., "bin": { "foo": "./path/to/foo.js"}, ...}
But not on Windows... :/
 
@darkyen00 what is the story about Indian code
 
I'm after some examples or tutorials on how to 'link' a json array to a html search button, i'm thinking bootstrap really. I can find examples of creating a search button and examples of json arrays but not actually now to search the array, through a search button.
 
@geomiles 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.
 

« first day (1499 days earlier)      last day (3449 days later) »