« first day (1049 days earlier)      last day (3917 days later) » 

7:00 PM
well I love methods and functions what can I tell you
also typeof works for something like Uint8Array
like var hasTypedArrays = typeof Uint8Array !== "undefined" or whatever
 
@dystroy jsfiddle.net/z27HU it's big .I also used the substr method to select the date
 
he is probably unaware of that
 
@Esailija Really?
 
@Esailija I gave that as an example at the last comment
Blob in window and then typeof Blob
More generally - host objects.
 
I don't think that works
 
7:03 PM
if you want to make something that works anywhere you can't use window though
 
I mean, it's an error if Uint8Array isn't defined
 
Why wouldn't it be? It's just an undeclared identifier in browsers that don't support it
Think of how old AJAX worked with all that try/catch bull
@Esailija When you don't use the browser - you usually know the environment you're in - but yeah - you often see global || window or something like that
 
no I mean like my data structure library.. not application development
it runs in both node and browser and I cannot know it
@copy no the typeof suppresses reference errors
 
!!> typeof x;
 
7:06 PM
@copy "undefined"
 
reference error is so out of place anyway
like if I want undefined object properties to give an error I can't
 
Oh
 
@copy Yeah, typeof works here but x would raise an error- that's the entire point of the conversation I was having there.
 
!!> X;
 
@Esailija "ReferenceError: X is not defined"
 
7:07 PM
!!> Blob in window
 
wow I really got something confused there
 
blob should also be string
 
Yeah, also window is not defined in the worker I guess
(Well, I'm not guessing - it's a big feature of workers)
 
!!> X;
 
7:08 PM
    var dueDate = "02.08.2013"; var dd = dueDate.substr(0, 2).toString();
var mm = dueDate.substr(3, 2).toString();
var yy = dueDate.substr(6, 4).toString();
 
@SimonSarris "ReferenceError: X is not defined"
 
!!> window.location = 'a'
 
@SimonSarris "ReferenceError: window is not defined"
 
@dystroy not worked
 
@SimonSarris If window existed in workers that'd totally suck
 
7:10 PM
    catch (SqlException ex)
    {
        return -1;
    }
oh my god
 
@Esailija :(
 
@ఠ_ఠ Your fiddle and your questions aren't clear enough. You'd have clear answers to clear questions.
 
it's not Java.. why even have that catch
xD
 
I have to admit - I really enjoy EF - I really disliked it at first but it's really helpful.
 
!!> console.log(this)
 
7:11 PM
@SimonSarris [object WorkerErrorEvent]
 
I am just learning it.. I am generating the application just from DB tables
and DB tables came from teacher... so I don't have to do anything at all
 
!!> try {while(1)}
 
@SimonSarris "SyntaxError: syntax error"
 
Use prepared statements. If you can't use Entity Framework - I'd use Webmatrix.Data it's a lot nicer than working with ADO directly.
 
!!> try {while(1) { console.log(this)} }
 
7:12 PM
@SimonSarris "SyntaxError: missing catch or finally after try"
 
@SimonSarris try has to have a finally or catch clause.
 
!!> try {while(1) { console.log(this)} } catch(ex) {}
 
@SimonSarris Maximum execution time exceeded
 
@BenjaminGruenbaum is there some sensible DB api out of the box?
something like this db.selectMany( "SELECT * FROM table WHERE x = ?", 3, someMapper)
 
7:15 PM
@Esailija I use two things - if I just want to run SQL Webmatrix.Data is a very nice wrapper for ADO.NET having nice syntax for prepared statements, and it returns dynamic objects so I can do db = DB.Create("DBName"); res = db.Query("SELECT * FROM USERS"); foreach(var user in res){ Console.WriteLine(user.Name); }`
 
!!> setTimeout(function() {console.log('a')}, 20)
 
@SimonSarris 1
 
@BenjaminGruenbaum the above is btw what I did in Java... but with dynamic mapper is not even needed I guess
 
@Esailija It's dynamic, so there is no actual mapping or object generation required, but also no compile time safety - it's just a lot nicer than using ADO.NET directly (just remember to dispose the DB or using USING)
 
7:16 PM
!!> self
 
@SimonSarris [object WorkerErrorEvent]
 
!!> self.a = setTimeout(function() {console.log('a')}, 200); setTimeout(self.a, 200);
 
@SimonSarris "Error: Useless setTimeout call (missing quotes around argument?)"
 
If you want type safety - I'd use Entity Framework, it'll map the DB to classes for you out of the DB schema automagically and generate all the properties for foreign keys and enums and such. Then you can use LINQ instead of SQL and the LINQ adapter will break down your lambda expressions as a syntax tree to SQL
So Users.Where(x=>x.Age > 30) will return a deferred on "SELECT * FROM USERS WHERE Age > 30"
 
!!> self.a = setTimeout(function() {console.log('a')}, 200); setTimeout(function(){self.a}, 200);
 
7:16 PM
@SimonSarris 2
 
(NHibernate also works nicely but I find EF a lot easier to start with)
 
I am going to pycon INdia tomorrow
is anybody else joining me ?
 
(This is Webmatrix.Data ignore the PHPish content of the tutorial asp.net/web-pages/tutorials/data/5-working-with-data , the syntax is very nice)
(This is for EF, note some of the steps there (like the generator) are no longer required in EF5) msdn.microsoft.com/en-us/data/jj206878.aspx
(I use lambda syntax over query syntax, I like the type safety LINQ gives me too)
Although you have to understand the inner workings sometimes and understand that LINQ is deferred execution (It's lazy) when it's able
 
yea this all seems very magical
 
LINQ is magical, the fact you can write an adapter that takes a function expression in C# apart and break it into the core parts and then rebuild it is awesome.
I wonder if there's a LINQ to JavaScript adapter for MongoDB or some other databases that are backed by a JS engine
 
7:24 PM
@BenjaminGruenbaum There is a MongoDB binary for C#
 
@Shmiddty Does it have a LINQ adapter?
 
not entirely sure, but it does return enumerable lists
 
Oh yeah, apparently it does - cool, but only some operators are supported.
> Warning Select does not result in fewer fields being returned from the server. The entire document is pulled back and passed to the native Select method. Therefore, the projection is performed client side.
Yep, that's not a real LINQ adapter :/
> As mentioned earlier, not all C# expressions are supported as a where clause. You can use this documentation as a guide to what is supported, or you can just try an expression and see if it works (a runtime exception is thrown if the where clause is not supported).
Yep, really not a real adapter, I expected them to use map/reduce for it but apparently it just doesn't work very wellyet.
 
    public string CastToSqlServerDateTime(DateTime date)
    {
        string vvvv = date.Year.ToString();
        string mm = date.Month.ToString();
        string dd = date.Day.ToString();
        return "" + vvvv + "-" + mm + "-" + dd;
    }
yeah that's casting...
 
WTF? ^
WebMatrix.Data for example lets you pass a DateTime as a parameter to a prepared statement (EF lets you do that too obviously, and probably other adapters like NHibernate)
Pretty sure it's built into ADO.NET
 
7:30 PM
that's actually pretty shitty way
since you can just return date.ToString("yyyy-MM-dd") and get zero padding too
 
What way?
 
the way that takes year month and day separately
 
@Esailija Or not do that and just pass the date as a parameter?
 
I don't know where the method is even used
there is no code that uses it so far
=D
 
If you're in Visual Studio just click on "Find Usages" (Control + K + R with ReSharper)
 
7:32 PM
You should always pass in the timezone when sending a date from javascript.
 
@Shmiddty Off to beer with wife ttyl
 
ttfn
 
How would i get some of this numbers ?
but it should be like this
var mm =  mm + 1;
 
wat
 
user1125394
the
 
7:35 PM
mm = 02 when start and when i get the value after add 1 into it it will return only 3
What the hell of this JS?
i tried parseInt is also crappy for this
 
user1125394
!!> 02 + 1
 
@cc 2
 
i need it to be 03
 
@cc 3
 
@ఠ_ఠ You really need to understand that javascript has more than one type, and especially the difference between numbers and strings. See developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/…
 
7:37 PM
@BenjaminGruenbaum is there a way in visual studio to automatically resolve .. instead of having to highlight, right click, resolve...
 
that mm is a Int when adding 1 into it
 
user1125394
@ఠ_ఠ left 0 padding? is that what you seek
 
yes
 
user1125394
if that's a date there are functions like toLocaleString
 
it is var mm = dueDate.substr(3, 2);
from the dueDate coming from the datepicker value
 
user1125394
7:40 PM
!!> ("00" + 2).slice(-2)
 
@cc "02"
 
I did var mm =  '0' + (parseInt(mm)+1);
 
@ఠ_ఠ so you could sometimes have 010 etc?
seems legit
 
user1125394
!!> '0' + (+'02' +1)
 
@cc "02"
@cc "03"
 
7:54 PM
!!> '0' + (+'10'+1)
 
@Shmiddty "011"
 
user1125394
!!> ("00" + (+'10'+1) ).slice(-2)
 
@cc "11"
 
Cool, do you lot know about console.table?
 
Did you just call me lot?
 
8:03 PM
@Loktar , @copy , @IvoWetzel , @rlemon youtube.com/watch?v=34NfuVCrfok
 
user1125394
!!wiki lot
 
Lot or lots may refer to: *Lot (biblical person) **Islamic view of Lot *Casting lots *Lot (unit), a unit of mass *Land lot, an area of land *Parking lot, for automobiles *Lot, a set of goods, together for sale in an auction; or a quantity of a financial instrument *"Lot", a story by Ward Moore *Arabian lots, or Arabic parts, an astrological divination technique LOT may refer to: *LOT Polish Airlines *Lewis University Airport, Illinois, United States *Language of thought, a philosophical hypothesis LOTS may refer to: *Law of the Sea (United Nations Convention on the Law of the Sea) *Lege...
 
super request : Make a game like that [2d] it'd be damn cool
 
user1125394
!!urban lot
 
@cc LOT used in england, to denote a group of somthing
 
8:05 PM
Paste this into your console if you dare
too long wtf
 
@Shmiddty
if(mm > 8){

var mm =  parseInt(mm)+1;

}else{

var mm =  '0' + (parseInt(mm)+1);

}
 
user1125394
that's how the 2000's bug happened
 
Paste this into your console if you dare!
var _0x1e65=["\x25\x63\x49\x27\x6D\x20\x77\x61\x74\x63\x68\x69\x6E\x67\x20\x79\x6F\x75\x21","\x66\x6F\x6E\x74\x2D\x73\x69\x7A\x65\x3A\x31\x35\x30\x70\x78\x3B\x63\x6F\x6C\x6F\x72\x3A\x23\x43\x43\x43\x3B\x74\x65\x78\x74\x2D\x73\x68\x61\x64\x6F\x77\x3A\x30\x20\x33\x70\x78\x20\x38\x70\x78\x20\x23\x30\x30\x30\x3B\x62\x61\x63\x6B\x67\x72\x6F\x75\x6E\x64\x3A\x23\x34\x34\x34\x3B","\x6C\x6F\x67"];console[_0x1e65[2]](_0x1e65[0],_0x1e65[1]);
 
@mbaird 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.
 
@AbhishekHingnikar So 2D Mortal Kombat? :p
 
8:15 PM
@SomeGuy Mortal Kombat is not like that...
right ?
 
The one I played was.
 
Which one ?
 
Can't remember.
 
PS it feels more like Prince of Presia to me rather then mortal kombat
Persia*
 
Shaolin Monks, I think?
 
8:17 PM
posted on August 30, 2013 by Victor Rodriguez

NASA Technical Documents Miniature 'human brain' grown in lab Scientists May Soon Add Element 115 To The Periodic Table Researchers successfully reverse-engineer Dropbox Researcher controls colleague’s motions in 1st human brain-to-brain interface

 
@RobFarr 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.
 
Yeah, I know.
Most fighting games, actually. God of War was similar too.
 
can u make something ?
like that ?
 
If I could get the art for it
And actually felt motivated to
 
8:29 PM
@Esailija with resharper there is
Also, open nuget console and tell it to resolve all dependencies - it'll take care of packages for you
 
0
Q: How can I make this code more elegant?

Shawn SpencerWhen it comes to writing elegant JavaScript, I'm a bit clumsy at times. OK, I'm old school. So I was wondering whether someone could take a look at my two functions and help me out? Here's the link to my pastebin: http://pastebin.com/wkAwKEL5 Essentially, I have some nice code like this: (func...

 
user1596138
Stars random thing
 
8:51 PM
@FlorianMargaine inglor @ gmail
 
m59
Teach people = no rep.
Write code for people = booyah! accepted answer!
 
hello
i've one question...
 
@BenjaminGruenbaum added
@SomeGuy added too
@SimonSarris florian at margaine dot com indeed
 
I have following:

document.body.onclick = testfunction;
 
@T_01 oh hey, you're that guy from that question I commented on
 
9:01 PM
and

var x = 5;

but document.body.onclick = function(){testfunction(x);} isnt woking, it stays x and isnt getting 5. why? How can i pass parameters to it?
yes hi ^^
 
@T_01 Create a fiddle on jsfiddle.net illustrating the issue.
 
k wait
 
Also, you haven't shown testfunction btw. you might want to do that in the fiddle.
 
ou sry it is working.
i just made a stupid mistake. Thank you anyway :)
 
That's expected :) Your function is in closure scope
 
9:07 PM
By the way... are you German?
 
No, but I'm of German descent, why? (We have plenty of Germans here though)
 
because its hard to explain what was my problem in english :P
 
m59
0
A: how to apply style on dynamically generated element

m59There are many, many ways of styling a javascript created element. Here are a few. Click here for live demo. var myElem = document.createElement('div'); myElem.style.color = '#FFF'; with jQuery: var $myElem = $('<div></div>'); $myElem.css('color', '#FFF'); or jQuery css object syntax (for p...

 
@Benjamin The Problem came back ^^
 
9:14 PM
@m59 After reading the accepted answer, my eyes are bleeding.
 
Why the heck doesn't concat work with arguments?
 
m59
=D
 
!!> (function(a){ console.log([4].concat(arguments)); })(3);
 
@BenjaminGruenbaum "undefined" Logged: [4,{"0":3}]
 
!!>
 
9:14 PM
@SomeKittens "undefined"
 
Isn't it supposed to be generic?
 
http://jsfiddle.net/AadjP/1/

When you click on the boxes, everytime its alerting 3. Thats wrong...
 
@m59 you can also do
$('<div>', {
   css: {
     color: '#FFF'
   }
});
 
m59
@SomeKittens right? People are crazy.
 
@T_01 It's always the same i value (there is only one i)
 
m59
9:16 PM
@Pinocchio that's cool.
 
and it's a one-line answer!
 
yes, but i want that the "i" converts to an number
 
38
Q: Javascript infamous Loop problem?

Tower JooI've got the following code snippet. function addLinks () { for (var i=0, link; i<5; i++) { link = document.createElement("a"); link.innerHTML = "Link " + i; link.onclick = function () { alert(i); }; document.body.appendChild(link); } } The above code is for generating 5 links and bind...

 
m59
Thanks for the rep dudes =D
 
hmmm
 
9:18 PM
@m59 +1 because the accepted answer is horrible (-1 to it)
 
m59
Dang, I need to post stuff here more often.
 
wow thanks it works with this...
cool
 
m59
@BenjaminGruenbaum Here's another for ya =D
0
A: How to share data between controllers in angularjs

m59The most common and recommended method for sharing data between controllers is to use a service. Click here for Live Demo (see app.js) var app = angular.module('myApp', []); app.factory('myService', function() { var myService = { foo: 'bar' }; return myService; }); app.controller('my...

 
Don't ask for upvotes >: (
@T_01 you're welcome :) Enjoy programming with JavaScript :)
So.. I wrote a 50 lines inplementation of a service locator based AngularJS like dependency injection resolver - anyone want to see?
 
m59
Oh, I wasn't necessarily. (just if I deserve it), but I see.
 
9:24 PM
haha me :D
 
m59
@BenjaminGruenbaum sure
 
@BenjaminGruenbaum I wrote a Markov chain to generate that sentence.
 
xD
 
@SomeKittens ?
 
@BenjaminGruenbaum Markov's HN, haven't published it because there's a zillion others out there
</humorAttempt>
 
9:25 PM
Lemme set up a fiddle one sec
Basically, it resolved Person for People in it, just like Angular does with $scope and controllers etc
 
cool ^^
 
m59
that's cool
That's easier than I imagined it would be.
 
Yeah, it's nice to see how easily it's accomplished, with ~ 35 lines of code
If I remove the support for different types of parameters and the assertions I can get 25 lines of code
 
@copy could do it in 4
 
Probably without using jQuery too
 
9:31 PM
In 4 bananas
 
m59
But...if you minify it, you could do it in one.
Just like jQuery.
 
@m59 Actually - since I resolve based on argument names - if I minify it it breaks xD (just like Angular)
 
m59
Ohhh doh.
Implement the array syntax =D
heheh
Is it not reasonable to just use a minifier that doesn't change argument names?
 
That's a setting
 
Went to buy potato, no potato, only sadness. Such is life.
 
m59
9:38 PM
So...how did you dudes learn to program so well?
 
By programming
 
m59
College educated devs seem clueless.
But they make money, lol.
 
user1125394
if (!potato) tomato;
 
m59
Not a blanket statement, by the way.
I just mean I know of several people that have degrees for this stuff and they only know the basics.
 
Array syntax, there you go
 
9:41 PM
Just program all the time and you'll get better
 
m59
@BenjaminGruenbaum pro
 
I want de-structuring assignments there :(
That would allow me to cleanly extract the argument processing to another function
 
m59
@copy oh, believe me, I do. All day, everyday.
 
That's good. In 16 years you'll be a pro and can start your next hobby
 
m59
haaha
well, if I don't make a career out of it soon, I'm a lil' screwed.
 
user1125394
9:46 PM
dropbox can fuck you sometimes
 
m59
hmm...my wife won't like that.
uninstall
 
@Zirak Depends, how many do you need?
wat?
 
10:09 PM
@m59 @T_01 put it on git github.com/benjamingr/Inject.git
Let me know if you find fuckups or you get the @rlemon joke
 
m59
not loading
 
I posted the .git url heh, one sec
There, that's the actual repo ^
 
m59
oh doh, didn't see the ending.
 
@Pinocchio Oh, how meta! :)
 
1
Q: Smartest way to initialize an array in CoffeeScript

TusharWhat is the best way to initialize an array with a particular value in coffee script. What I have done so far - [0..100].map -> 'a' And i=0 arr = [] arr.push(0) while i++ isnt 100 If personally feel that the first one will have a poor performance and the second one is too verbose and dest...

 
@BenjaminGruenbaum just in case you need some new coding music. play.spotify.com/album/5ETjR1gqmD0EqXxjFjfJx5
 
@m59 what a hypocrite stackoverflow.com/a/18526833/1907358 lol
 
10:42 PM
@OctavianDamiean I'm all alone on TS
 
10:54 PM
I love that Pizza Hut is open until 4 AM here.
 
11:05 PM
HEY
HEY @OctavianDamiean
GUESS WHAT?
 
user1125394
no don't!
 
11:27 PM
@Zirak You like olives? :O
 
m59
@Pinocchio lol dude, that's great =D
your comment
 
@Zirak also, there is a domino's pizza just over the road from here and it's 24Hours
@m59 lol
 

« first day (1049 days earlier)      last day (3917 days later) »