« first day (947 days earlier)      last day (3070 days later) » 

12:00 AM
RELOAD! There are 1641 unanswered questions (94.4144% answered)
 
But remember: My library isn't minified!
Minified would be around 10000 bytes
Actually, it is 6974 bytes long, compressed using jscompress.com
 
what if you compressed your library with your library?
compressption
 
That is what I want to do too
I just provide enough to download the source code and the library will be loaded from there
 
yes but really
how many bytes would it turn out to be?
 
Let me try
Now, it is 15939 bytes
 
12:11 AM
So has the coolest substring operation ever.
let string1 = "Hello"
let string2  = "world"

/// Use @ to create a verbatim string literal
let string3 = @"c:\Program Files\"

/// Using a triple-quote string literal
let string4 = """He said "hello world" after you did"""

let helloWorld = string1 + " " + string2 // concatenate the two strings with a space in between
printfn "%s" helloWorld

/// A string formed by taking the first 7 characters of one of the result strings
let substring = helloWorld.[0..6]
printfn "%s" substring
The awesome part is helloWorld.[0..6] which creates a substring with characters 1 through 7.
 
I think I've seen something similar somewhere else...
 
string3 --> C# style
string4 --> MySQL style
substring --> Python?
 
Man F# has some awesome syntax.
 
@EBrown I think the currying of F# is both awesome, and distracting... It can severely hide function calls and confuse function calls from variables and similar. But the actual currying function is cool
 
I'm impressed by a lot of the syntax (a large part of which Haskell shares, I'm sure).
 
12:22 AM
This also applies more in general for F#, but true be told, I haven't used it that much. And only seens some examples here and there
I've heard that Haskell is not favoured any more, but if there is any truth in it?
But that is an issue with all languages. Some are highly appraised within some community, and some are not. And wars have been started on similar issues...
 
Yeah. I'm planning on added Haskell to my collection as well, as soon as I master F#.
(Since both are functional languages, mastering one should allow me to get a head start on the other.)
 
If I my ask, what is your main language, the one (or few) language which you use for any significant task or program, if you were to chose that?
 
Well, for most things I choose C#. (At work I have to use VB.NET.)
If I need something basic, I choose C or C++.
 
I've been using C# (with the non-wanted C++ / CLR variants combined) for some time, and I do believe it out trumps a quite a few languages. Have used a wide variety of other languages earlier (Java, C, Perl, Php, *Pascal), and have recently started using Python. But I must say that Python is growing on me.
 
(By basic I mean something which doesn't have complicated goals, or something that needs high performance.)
I have always had a fondness for C# (and other C derivatives). I've used C, C++, C#, Java, PHP, as well as Perl, Ruby, Python VB.NET, VBA and now F#.
 
12:31 AM
And I haven't caught on why to use functional languages like F$ (or Haskell or OCaml or ...). They seem somewhat limited for most of the tasks I've been wanting to program, but YMMV
 
Functional languages seem to be quite good at crunching numbers.
The syntax of them makes complete sense when dealing with mathematics.
 
That seems true, yes. But it comes at a cost, which I don't see the need of paying, and that is changing anything into function calls or sequencing of command calls. It kind of reminds of LISP (or Prolog) if you heard of those.
 
Ah yes, I do remember LISP. I can definitely see the resemblance.
 
Or to paraphrase some one I heard recently, when you have the same stream of data to be manipulated from start to end, a functional language might be a good fit for that task. But if you want to maintain state and change that, they don't fit at all.
 
Exactly. Functional languages should not modify state. They're completely stateless.
They operate on a domain, and return a range.
That is, for every single possible input, there is exactly one output.
 
12:35 AM
Yes, and usually my issues doesn't match that requirement.
On an entirely different topic: I'm recalibrating my screen, and I'm wondering is your messages in the chat of a light blue tone, or more of a gray tone?
And is the white messages (all others) slightly off white, or bright white?
I can't decide if my main or secondary monitor is the 'correct' one!
 
I'm not exactly a good source on that, but it's quite gray. Those messages are 100% white.
 
Zak
for me: light grey/blue background, my messages are definitely blue, other messages are more off-white. But, I have no guarantee that my screen is correctly callibrated :)
 
The only blue items on my screen are links.
Well the actual colours on them are 255,255,255 on the white messages.
And 230,238,241 for the gray ones.
 
So my main monitor matches EBrown's screen, but my secondary monitor matches Zak's screen. Shoot...
 
LOL
 
Zak
12:38 AM
actually, now that I look closely, my messages are more of a dirty turquoise, so make of that what you will :)
@holroy Well, pick one I guess :)
 
Still seems similar to my secondary screen...
 
I have the same as @EBrown
 
Hmm... I wonder how to get them to be similar at least. (I'm by the way running on a Mac Mini (and the main monitor is Dell U2713H on Display Port, and the secondary is a Dell E175FP on VGA). Might be optimistic to get them to have similar colours...
 
You should have some sort of colour adjustment on them.
 
It is optimistic
Don't try it
 
12:43 AM
You can adjust the colors in the Control Panel.
 
@EBrown I do, and have done it. But the result varies... Maybe I just need to redo it, once more, and do both screens simultaneously.
 
My messages are a kind of gray.
 
Mine show white
 
White for not-my messages.
 
That
For my messages, it shows blue-ish
 
12:46 AM
Oh well... I've got to look into it tomorrow, I think. I like the brightness a lot better on my main monitor, it seems crisper and in general nicer. But whether it is 'correct', that is another issue. But it is a little annoying to have a different hue on my secondary monitor.
 
So arrays in F# are mutable...I'm not sure if I like that.
 
@EBrown Trying to get back on track? Sensible...
I found, when working with Dictionaries, that you had one mutable version, and one non-mutable version. Could the same apply for arrays?
Using dict[1, 1; 2, 4; 3, 9] it was non-mutable.
 
Well, there are four different types of constructs to hold a series of values (at least that I've seen so far): dictionaries, lists, sequences and arrays.
Arrays are mutable, and defined as: [| |], but sequences are not and are defined as [ ].
 
Isn't F# a functional programming language?
 
Yeah.
 
12:50 AM
And if so, why is anything mutable? Isn't that part of the point...
 
I'm not sure why arrays are mutable, I'm sure there was a good reason for it.
You can make almost anything mutable by declaring it with the mutable keyword.
 
But isn't that pretty well the antithesis of functional?
 
Yeah. As far as I have been told functional languages should not be mutable.
 
But haven't you then already answered your own question/issue. Or is there a difference in how access the [ ] versus the [| |]? If not, use the first for non-mutable arrays, and the latter for mutable arrays
 
Well [] isn't an array. Think of it as the same construct as a .NET IEnumerable.
 
12:54 AM
maybe it's worth a programmers/so question...
 
Maybe you found a topic which is on-topic for programmers.se?
 
I think I'll make it a question on one of the two when I have thoroughly investigated it.
let array2 = [| "hello"; "world"; "and"; "hello"; "world"; "again" |]
// modify an array element using the left arrow assignment operator
array2.[1] <- "WORLD!"
Even Microsoft's tutorial demonstrates precisely that arrays are mutable.
> Arrays are fixed-size, zero-based, mutable collections of consecutive data elements that are all of the same type. - msdn.microsoft.com/en-us/library/dd233214.aspx
BUT WHY?
 
Hello
@EBrown Why what?
 
I think I just found the answer @holroy and @nhgrif.
> The type of all F# arrays is the .NET Framework type Array. Therefore, F# arrays support all the functionality available in Array.
So, F# has mutable arrays because .NET has mutable arrays.
 
But what do F# call the [ ] variant?
I just tested, and you can do:
let my_array = ["hello"; "world"; "and" ]

printfn "%s" my_array.[0]
 
Ah, yeah. It's a list, not an IEnumerable.
 
Wait are you trying to have a mutable array?
 
Arrays are mutable, @EthanBierlein.
3 mins ago, by EBrown
let array2 = [| "hello"; "world"; "and"; "hello"; "world"; "again" |]
// modify an array element using the left arrow assignment operator
array2.[1] <- "WORLD!"
 
Have you tried:
 
Maybe I'm just dense, but what is the difference between a non-mutable array and a list?
 
1:01 AM
let mutable myArray = [| ... |]
 
@EthanBierlein That compiles, but it doesn't change how an array works.
Arrays in F# are naturally mutable.
And that upsets me.
 
To me it kind of makes sense that an array is mutable, as that is a list/sequence/whatever of mutable variables which I usually want to change, or sort, or do stuff with. And then you have the similar construct of lists, which is more of a predefined set of values... And that is naturally enough non-mutable.
 
Yes, but F# has the mutable keyword, which is supposed to make any type able to be modified. I'm just curious why they didn't require that for arrays.
 
@EBrown Because the arrays are a mutable variant of lists?
 
1:07 AM
Right, but why not make them require the mutable keyword?
I wonder...I wonder if the mutable keyword on arrays in F# means you can actually change the structure of the array itself.
 
Interesting.
 
To me, with a very limited F# knowledge, it seems like syntactic sugar that you can use [ ] when you want the functional non-mutable variant, and then use [| |] when you want a mutable variant.
 
0
Q: Twiddle Multiple Bits

FatalSleepThe following C# methods take n bits and operates on them all in one pass. // Sets n bits to zero at index i. uint zerobits(uint x, int n, int i) { return x & ~((uint.MaxValue >> (sizeof(uint) * 8 - n)) << i); } // Sets n bits to one at index i. uint setbits(uint x, int n, int i) { retu...

 
Yeah. That's what it's looking like.
 
1:10 AM
@holroy Those are two different data types. [ ] is a list type and [| |] is an array type.
 
Though, I do like the [x..y] syntax.
 
@EBrown I know, right? Aren't collection generators amazing?
 
Oh yeah. They are awesome.
And sequences are pretty slick, too.
 
Oh yeah
 
@EthanBierlein Could you take a look at some of my F# and tell me how I'm doing?
 
1:12 AM
Sure
 
@EBrown And as a side effect for guys, like us, coming from other programming languages where most list structures are called arrays, it kind of seems strange to have both variants, and since we're used to arrays we immediately think of them as the base type. So when thinking of F# as a non-mutable functional language, it seems wrong to have arrays as the base, but really they think that lists should be the base structure? Do you follow me?
 
You could always post it for review too. ;)
 
@holroy Yeah, I had a hard time wrapping my head around it as well. I think I've gotten it though.
@EthanBierlein Well they're Project Euler problems.
I meant to post a question earlier, but forgot.
 
So I have this for problem 1 (add all values from 0 to 999 that are multiples of 3, 5 or both):
printfn "Solution to Project Euler 1: %i" (Seq.sum (Seq.filter (fun x -> x % 3 = 0 || x % 5 = 0) [1..999]))
 
1:14 AM
@EBrown In short: Your primes should be stored in a list, but if using sieves of erasthones you need to use an array to build it, and then convert it to a list!
 
@holroy Indeed.
 
@EBrown Kind of sound like FizzBuzz, you know
 
From what I saw, converting between the two is pretty easy as well.
@holroy It's similar.
But instead of printing you sum them all.
 
@EBrown It looks quite nice actually! The only thing I'd really nitpick is that things like [x..y] are usually written as [ x .. y ] for more clarity, but it's more of a preference. Other than that, I'd say it's all good. :)
 
Makes sense.
Problem two was:
let rec fibsRec a b limit =
    if a + b < limit then
        let current = a + b
        let rest = fibsRec b current limit
        current :: rest
    else
        []

    // In main:
    printfn "Solution to Project Euler 2: %i" (Seq.sum (Seq.filter (fun x -> x % 2 = 0) (1::2::(fibsRec 1 2 4000000))))
Which is to sum all Fibonacci numbers from 1 to 4000000 that are even.
 
1:20 AM
What does the (1::2::(...)) do?
 
That's how you add values to a list.
So 1::2::[] creates a list by appending 1, then 2, then an empty list.
 
ok
 
That's actually the first thing I'm going to nitpick. It should probably be written as:
1 :: 2 :: (fibsRec ...)
 
let someList = [ 1 .. 1000 ]
let someOtherList = 5::someList
Makes a list of 5, then 1 through 1000.
Actually, I think I'll make a question for all of these. I did all the Euler problems from 1 through 5.
 
That'd be cool. I'd probably check it out.
 
1:24 AM
@EBrown Have you built a menu system in F# to select which of the Euler problems you want to solve, and provide your own limits to them?
:-p
 
@holroy No, I should totally do that!
 
HeHe... The only downside is that then you are touching in on the non-functional part. Menus, and user input like that, doesn't go hand-in-hand with functional languages, as I've understood it.
 
No, but I don't think there is a functional way to do that.
 
Is there a design pattern to differentiate when to use: Seq.sum ( Seq.filter (fun .... ) (1 :: 2 :: (list-generator))))))) versus 1 :: 2 :: (list generator) |> Seq.filter (fun ...) |> Seq.sum, that either of you know of?
 
I suggest that the second method is clearer.
 
1:30 AM
@EBrown My point exactly! :-p
 
I just got an email from GameDev.SE...
I didn't know emails like that were a thing...
 
@EBrown If you think that is clearer, then why don't you use it in Euler #1? :-O
 
@holroy Just replaced it. :)
 
@Quill Interesting.
 
@Quill I think I got one ages ago!
 
1:32 AM
 
@EBrown Check out this comparison related to our previous talk on list and arrays: fsharpforfunandprofit.com/posts/list-module-functions
Only read the top part myself, but it looks interesting...
 
b# would've been a nice name... that way people could make jokes out of it too :P
 
F# ain't no joke :P
 
@Quill I'm like, 99% sure that the "F" in is for "functional."
 
Frankly, I don't care :P
You know, for the volume of apps on the Apple App Stores, I'm surprised at the low volume of questions being asked here.
 
1:40 AM
Most people don't yet know that .
Also, I've decided that the "F" in stands for "fun."
 
Hey @Grundoon. Looks like you're familiar with F#.
(judging from your profile)
 
@Quill Do you think they are written in Swift, already? Not objective-C? (And by the way, from the little I know both of them, Swift surely seems like the better of them.)
 
@holroy Swift and Obj-C are like C# to VB.NET
 
(and comparing to some other languages, I feel that C# and Swift is in a different league rather than C++. Pure C is the distant grand father)
Swift ~ C#, whilst Objective C ~ C++.
 
@holroy and yeah, brand new projects are generally written in Swift, certain OSs and frameworks are supported only by Swift
 
1:44 AM
And I don't like neither C++ nor objective-c.
My guess would be that 80-90 % of the app store is obj-c, not Swift... But the figures are most likely rapidly changing towards Swift as Mac demands usage of Swift for newer OSs and frameworks, as you say.
 
@EthanBierlein question posted.
I'm actually working on procuring a Mac so I can learn Swift.
 
I wouldn't say that high, but if you want a real conversation, ping nhgrif, he's the mac-man round these parts
@EBrown Mac Minis are good
See Below:
 
@Quill I need to replace my laptop, so I'm going with a MacBook Pro.
 
@EBrown Don't get the lowest hard drive option though, I did, and I still regret it...
 
0
Q: Project Euler Problem #1-#5

EBrownSince I've been playing with F#, I decided to try my hand at implementing some of the Project Euler problems, and I've been having a blast doing it. (f#-is-fun) So, I'm going to list all the Project Euler problems I solved to make things pretty clear: Project Euler Problem 1: Multiples of 3 ...

 
1:48 AM
@Quill They only have 512GB and 1TB for the one I'm getting.
 
Mine is 120-something GB ;-;
 
Yeah, I'm going to get the MacBook Pro 15" with the upgraded CPU and the 512GB SSD.
 
@Quill I use a Mac Mini as my stationary, and I'm quite satisfied. No fuzz with it... (or buzz) :-)
 
I'm stuck between the 27" iMac, and the 15" MacBook Pro.
Not sure which I would prefer.
 
0
Q: Pairwise Election Method

evnI'm working on a project in which I take in a map of voters (Integer) and voting ballots (ArrayList) and decide the winner with different methods. After a week long struggle, I still can't get my pairwise election method to work. It is supposed to compare each pair of candidates and give a point ...

 
2:00 AM
Anyway, @EthanBierlein take a look at that if you would.
 
Will do ;)
I'm not sure if I'll be able to post an answer today though. My WiFi puck has 0.09GB left, and I'd rather not pay 53 dollars if it goes over.
 
Ah, that's fine.
 
ouch... public library nearby?
that's what I'd do
 
Interestingly, no. I'd go if there was one.
 
2:28 AM
Since you seem to be asking for review of existing, working code; codereview.stackexchange.com would be a more appropriate site to post on — M.M 55 secs ago
 
@Duga Almost right.
 
@M.M Little know fact: you can use [SiteName.SE] to auto-box a site name and link. (Code Review) — EBrown 49 secs ago
 
Gah, I need 8 rep to my next privilege.
Thanks, Santa! :)
Finally broke 5K rep! :)
2
 
1
Q: Async task with timeout

JakeI am calling a service outside of my control. My application must include a time out, so that if the call to the service takes too long, an appropriate time-out message is returned. // Client connected to remote service RemoteClient Client = new RemoteClient(); private async Task<MyResult> Chec...

0
Q: Implementation of cstring wrapper class

MikelI want to have a thin wrapper (low overhead) around c-style string. Also, with some additional features like equals and lt operators for map indexing. I have come up with the following class. Can somebody comment on it? From what I've gathered this class would take only as much memory as pointe...

 
Well, TTGTB. Getting late here.
 
night
 
3:17 AM
@EBrown Cya!
 
Good night
 
Zak
3:35 AM
Somwhat late to the party, but:
If I'm ever in charge of hiring for a position my criteria will be "Are you someone who gets shit done"?
And my questions will be What quantifiable evidence do you have to support that claim
And that'll be it.
 
um, what about having skills in the area? not important?
 
Zak
@Quill Comes under Getting shit done
"shit" being relevant to whatever I'm hiring you to do.
But even there, if I believe you could be taught the specific stuff you need to transition to a specific job without too much trouble, I'd take you anyway
Main reason why investment funds prefer to hire mathematicians over economists, because it's much easier to teach finance to a maths guy than the other way around.
 
@Zak Yes, but if that person is also an ass that would make me not want to hire them
That person's personality would affect the other worker's performance
 
Zak
In most positions, I'd count "maintaining effective professional relationships" to be part of the job.
 
0
Q: Debugging a basic mergesort algorithm

DrPylonsI'm going through the Introduction to Algorithms book on my own, and I can't seem to figure out where I mistranlated the book's pseudocode into C#. using System; class mergesort { static void Main() { int[] nums = { 5, 4, 3, 2, 1, 0 }; Console.Write("Unsorted array cont...

 
Zak
3:46 AM
I'm not trying to suggest a narrow definition of what "getting stuff done" encompasses, I'm trying to articulate that, IMO, you should decide what kind of traits an effective person in your role would exhibit, what they actually need to know, if there is indeed a minimum amount of required knowledge, and then forget any other requirements you might want to throw in in favour of hiring the person who will actually achieve the results you ask them to.
 
11 mins ago, by Zak
If I'm ever in charge of hiring for a position my criteria will be "Are you someone who gets shit done"?
little more than that, it seems :P
 
Zak
@Quill You try condensing an essay's worth of nuance and clarification into a pithy, quotable sentence :)
4
 
If I'm ever in charge of hiring for a position my criteria will be [object Object]
4
 
4:08 AM
If I'm in charge of hiring someone, my question will be "Are you like Wally?".
I don't know whether it would be a good sign or not if they don't know who Wally is.
 
Who's Wally?
 
I read that
Still don't get it
 
He is the manager of a project, and his boss gave him a bunch of idiots to work under him.
He asks how he is supposed to get it done, and the boss says to work harder.
 
Well, another solution would be to hire fewer but better
 
4:16 AM
he's complaining about his team being disruptive, but then he is disruptive, meaning they might be like him, or he might be like them
 
Hello
 
@JaDogg Hey!
 
@Quill How is he being disruptive?
He needs a team that isn't idiots, and he takes it to his boss, like a good employee.
 
Everything is awesome.
 
@Hosch250 he is being disruptive to the boss, which is why he says 'Not if you stand round yacking about it all day'
 
4:18 AM
The boss is always like that.
 
Zak
Ah, Dilbert :)
 
Incoming question from me
 
4:34 AM
0
Q: Preventing non-integers from entering input fields

QuillI have an input field that cannot have an integer inside, and an additional element beside it, the (younger-sibling element), cannot have an integer more than or equal to the other. So I wrote a checker to check incoming keyCodes on keyup. var nanReplacer = function(e){ if (isNaN(String...

 
yo @IsmaelMiguel, you got a minute? ^
 
It's broken: 12354.....3632556 doesn't remove the extra .
And it places the prompt at the end, which is pretty annoying
 
the prompt?
 
"the blinky thing" = prompt
ARGH!!!
Can't even use the arrows!!!
 
that too... it has flaws, but it works
 
4:38 AM
It does work, but those are huge usability concerns
 
Zak
 
@IsmaelMiguel fixed that
Nice work @Zak
 
Zak
I'm finally getting the hang of picture URLs in chat :)
 
@Quill Arrow selection is still broken
 
Zak
Also, that comic is older than I am :)
 
4:40 AM
And when you start deleting, it goes to the end :/
 
2 mins ago, by Quill
that too... it has flaws, but it works
 
You need help with those usability issues?
And 1234.556... is still a valid input
 
maybe, I've got an idea, i'll try it real quick
and yeah... i failed there
 
I have an idea
Basically: <input type="number">
 
wow... ;-;
I really do hate HTML
 
4:46 AM
Since you are using jQuery, you could use the .spinner() plugin (with jQuery UI)
But, honestly, you need less jQuery on that
When I say "less", I meant "no jQuery"
But you want me to post a review?
 
it uh, screwed my css when using spinner
 
Zak
 
I deleted the question... it was stupid
 
Zak
That's from 1989
 
@Zak That one is genius!!!
 
4:50 AM
Have some rep in 24 hours @IsmaelMiguel
 
Wow
Thanks a lot!
I really need reputation
I need to have more than 4k
 
write some really long reviews on JavaScript questions
 
I need to finish IMGJS first
Chinese Angular.js dialect?
 
Zak
4:54 AM
I've been tempted to learn JS for the sole reason that JS answers are a great magnet for upvotes :)
 
I really know 0 about Angular
 
@Zak it's easy
@IsmaelMiguel there's a lot more than angular there to review
 
@Zak LOL. If you try hard enough, you can even run PHP in Javascript, and Javascript code in PHP
@Quill I know, but it's 5AM, almost
 
go to bed man, don't you have work or something
 
I do, but can't sleep
But I won't have time to finish a good review on that question
 
Zak
4:57 AM
@IsmaelMiguel I hate that point where it's like "I should go to sleep, but at this point, if I go to sleep now, I'll probably just oversleep. welp, I guess it's another all-nighter then"
 
@Zak The problem isn't that. The problem is that I lay in my bed and there's nothing good in my head, which prevents me to sleep. And when I finally sleep, it is almost 6AM
 
@Zak yes, so much. I tried to explain that to a friend earlier and she couldn't understand it.
 
Zak
@IsmaelMiguel Ah yes, that one's even more frustrating. At least with the first, it's entirely your own fault.
 
Not really
 

« first day (947 days earlier)      last day (3070 days later) »