« first day (1633 days earlier)      last day (3287 days later) » 

12:13 AM
@GeorgePompidou Of course you can.
(?<!\n)\n(?!\n)
Trivial.
 
can you explain it?
 
Yes.
 
great!
basks in tchrist's regex glow
 
12:56 AM
I'm making a small web app for a family friend and he wants me to "make sure that the data provided by users is mine and I can do whatever I want with it"
I wonder—should a good programmer know how to handle stuff like that?
or would you immediately say that you don't know how to deal with legal matters like that and someone else should take care of it
 
1:54 AM
Tell him you charge $1,000/hr. for legal advice. Then farm the job off to a real lawyer for $350 and pocket the rest.
 
 
6 hours later…
8:08 AM
Hi, how common is it to use numeral to describe numbers that are under 10 when writing correspondence?
 
8:46 AM
Cerb, I have Android questions.
 
9:18 AM
@EnglishMaster Not common. Just use number, or digit if you have to.
 
10:15 AM
When in doubt use the least fancy.
When you feel fancy, think of us esls.
 
 
1 hour later…
11:41 AM
A priest, a doctor, and an engineer went to play golf. But their play was held up mightily by the slow progress of the group ahead of them.
When they asked the greenskeeper why the group was so slow, he told them the three golfers were blind firefighters, who had lost their sight saving the course clubhouse from burning down. In gratitude, the club had voted to let them play free for the rest of their lives.
"Oh," said the priest, quite moved the the story, "I must pray for them."
The doctor had a different idea. "I'll ask one of my ophthalmologist colleagues if there's something he can do
 
12:04 PM
!
 
12:40 PM
To a pessimist, the glass is half empty. To an optimist, it's half full. To an engineer, the container is twice as large as needed for the volume.
 
Also Cup<T>
 
12:56 PM
@JohanLarsson That's classy.
 
sry
I have a mutable mess here.
 
How are your front-end adventures going?
 
work happened
but I'm writing UI code, WPF.
Can't share screenies but it looks nice.
 
Cool.
 
Pretty buggy at the moment, been rewriting a library a couple of times
A SPA for desktop library
 
Is it closure that has a ~type system~ in comments?
 
I dunno, but it suffers from a number of performance and bad-practice problems.
But it's from Google, so everyone is all reverential and deferential. "Ooooh, Google . . . it must be good."
> The truth is, developers will switch to Closure because it bears the Google name, and that’s the real tragedy here. Like it or not, Google is a trusted name in the development community, and it has a responsibility to that community to do a little homework before deciding a library like Closure deserves public exposure.
 
Typescript has elements of nice imo.
 
Well, that's because you're not a real front-end dev.
Back-end devs always want things to be like what they know. So they think JavaScript sucks and want to dress it up in Java clothing.
 
What defines a real front end?
Java sucks from all I know
Verbose and feature sparse
 
1:18 PM
I didn't mention Java. I said "back-end" devs.
@JohanLarsson I would say you're not a real front-end dev unless you fully understand and love JavaScript for what it is.
You can never be a real front-end developer until you grok it like that.
 
> want to dress it up in Java clothing.
@Robusto There are other languages you know, there are other things than web.
 
@JohanLarsson Oh, so I did. Sorry.
 
Have you tried Scala?
 
@JohanLarsson Yeah, but we're talking about front-end web development. And for that you need JavaScript in the way I talked about it.
 
I haven't but hear good things about it.
 
1:20 PM
@JohanLarsson No.
 
Have you tried typescript?
 
Haven't we had this conversation before?
 
dunno
we can stop
just curious
 
Mar 26 '14 at 15:50, by Robusto
I will say this for TypeScript, though: at least it isn't a wholesale destruction the way Google's Dart was.
 
I missed that one.
 
1:26 PM
Mar 26 '14 at 16:12, by Robusto
> The problem is exacerbated because some advocates of TypeScript position it as “better” than what everyone else is doing. They say things like, “it’s for ‘large scale’, ‘complex’” apps. Heck, even the homepage says it in big bold letters: “TypeScript is a language for application-scale JavaScript development.” In other words, Rest of World, all those apps you’ve been making with JavaScript for years without TypeScript are puny, simplistic, toy apps.
 
kind of a strange position imo
It would make sense if things never improved — ever
 
Here's something cool done entirely in JavaScript: raphaeljs.com
 
link some stuff you have made?
 
jamónscript
 
@JohanLarsson Most of it is b2b stuff, so you wouldn't be able to access it normally. I used to code for fun and put that stuff online, but I haven't done that for at least a decade. No time.
 
1:31 PM
@JohanLarsson I feel fancy. oops... TMI.
 
Is it possible to pair an android phone with a computer so it connects automatically when I plug in usb?
 
And the current stuff I'm doing is b2c and you could see it, but for that I would have to reveal who my current employer is. I can send you something over Skype maybe. But I just started working there and we haven't yet released the stuff I've been working on.
 
now I have click > plug in > click again > gah
If I just plug it in it is connected as media guy. I can only touch images.
Need to connect for real to be able to push to the git repo on the phone.
@Cerberus ^
I want something like pairing where I tell the phone that this computer is to be trusted.
 
@GeorgePompidou jamónyquesoscript
 
1:41 PM
@JohanLarsson What are you talking about? I feel like I missed the introduction.
 
2:01 PM
ok here goes, I have a git repo on my phone. When I leave work i want to push it to the phone so I can continue at home.
Problem is that I cannot push unless I connect the phone with ceremony.
If I just plug it in I can view pics etc fine.
 
oh. yes, a problem with phones.
 
yes
or more a feeling that there must be a better way
I could try bluetooth, it has some handshake thing
 
crl
2:20 PM
beer!> "uyu\nuyu".match(/(?<!\n)\n(?!\n)/)
@crl That didn't make much sense. Use the !!/help command to learn more.
@crl "SyntaxError: Invalid regular expression: /(?<!\\n)\\n(?!\\n)/: Invalid group"
@tchrist ^ when I try your regex in JS
 
3:12 PM
Do I capitalize Common Sense in a sentance?
 
crl
3:28 PM
*sentence
and I'd say no
r=/(^|[^\n]+)\n($|[^\n]+)/g
str='\ngg\n\ner r\ngerg \n gf\n \n \n trh \n ty \n'
console.log(r.exec(str), r.lastIndex) // < run this multiple times, it will find 5 matches
 
@crl JavaScript's RegEx implementation lacks a few important features.
@crl Hmm, I don't think you're supposed to put ^ inside the capture group. That doesn't make sense.
 
3:47 PM
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use open qw(:utf8 :std);

my $data  = "one\ntwo\n\ntwo and a half\nthree\nfour";
my $re    = qr/(?<!\n)\n(?!\n)/;
my @parts = split $re, $data;
print "My data is “$data”.\n\n";
for (my $i = 0; $i < @parts; $i++) {
    printf "part %d is “%s”.\n", $i, $parts[$i];
}
tchrist% perl ~/tmp/re
My data is “one
two

two and a half
three
four”.

part 0 is “one”.
part 1 is “two

two and a half”.
part 2 is “three”.
part 3 is “four”.
@Robusto s/few \K/dozen /
In this case, negative look behind.
 
4:46 PM
Hello.
 
twelve+one
tewlve+one
etwlve+one
etlwve+one
eltwve+one
eltwve+noe
eltwve+neo
eltwven+eo
elvetwne+o
elvenetw+o
elvenet+wo
elvene+two
elveen+two
eleven+two
 
crl
5:32 PM
@Robusto yes I don't want to capture it, I'm not a regex ninja at all, I just don't know how to make that OR group without brakets
 
6:10 PM
@crl Ninja regex: perl -e'printf 37.100.32.105.115.37.115.32.112.114.105.109.101.46.10=>$_=>(1x$_)=~/^1$|^(11+)\1‌​+$/&&110.39.116 for 1..shift' $$
 
crl
What does those numbers separated with dots mean?
characters?
how unhandy
 
@crl That depends upon one’s goals.
I would not want to spoil the surprise.
 
crl
Ah ok, give me a minute
 
You can just paste it into a shell.
That one won’t run sudo this time.
Maybe. :)
It’s a math puzzle.
 
crl
"37.100.32.105.115.37.115.32.112.114.105.109.101.46.10".split('.').map(function‌​(c){return String.fromCharCode(97 + c)}).join('')
"☉筌☄筑筛☉筛☄筘筚筑筕筍☒◮" :~
 
6:21 PM
I fear the joke has has indijesteration.
@crl Not a shell. :(
Also, weird codes.
Why 97 plus?
How in the world you got Chinese I shudder to imagine.
 
crl
41
Q: Convert integer into its character equivalent in Javascript

VIVA LA NWOI want to convert an integer into its character equivalent based on the alphabet. For example: 0 => a 1 => b 2 => c 3 => d etc. I could build an array and just look it up when I need it but I'm wondering if there's a built in function to do this for me? All the examples i've found via Google a...

 
Oh, that won't work at all.
Also, um, you seem to be conjoining byte pairs into characters.
Although that part is weirding me.
Because I don't know how you got it to do that. Very curious.
 
crl
188
A: Convert character to ASCII code in JavaScript

MohsenString.charCodeAt() can convert string characters to ASCII numbers. For example: "ABC".charCodeAt(0) // returns 65 For opposite use String.fromCharCode(10) that convert numbers to equal ASCII character. This function can accpet multiple numbers and join all the characters then return the strin...

 
Character 100 is "d".
 
crl
Right, without the 97
 
6:27 PM
For example.
 
crl
"37.100.32.105.115.37.115.32.112.114.105.109.101.46.10".split('.').map(function(c){return String.fromCharCode(c)}).join('')
"%d is%s prime.
 
Yes.
tchrist% perl -e'printf 37.100.32.105.115.37.115.32.112.114.105.109.101.46.10=>$_=>(1x$_)=~/^1$|^(11+)\1+$/&&110.39.116 for 1..shift' 42
1 isn't prime.
2 is prime.
3 is prime.
4 isn't prime.
5 is prime.
6 isn't prime.
7 is prime.
8 isn't prime.
9 isn't prime.
10 isn't prime.
11 is prime.
12 isn't prime.
13 is prime.
14 isn't prime.
15 isn't prime.
16 isn't prime.
17 is prime.
18 isn't prime.
19 is prime.
20 isn't prime.
21 isn't prime.
22 isn't prime.
23 is prime.
24 isn't prime.
25 isn't prime.
 
crl
What prime testing method is it using? Erasthothenes?
 
Unary.
Pick a number, any number.
 
crl
79
 
6:30 PM
In unary, 79 is 1111111111111111111111111111111111111111111111111111111111111111111111111111111.
Or xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
It doesn’t matter.
I will demonstrate using 9 for simplicity.
9 in unary is 111111111. Ok?
 
crl
k
 
Now consider applying the pattern ^(11+)\1+$ to that.
What does the pattern match?
 
crl
(11111111)1
 
A capture group followed by one or more instances of that group.
No, that would fail.
Ah, but it does not want to fail.
It wants to succeed.
The first value success is (111) in the capture group.
 
crl
Oh wait
 
6:33 PM
Because the remainder says repeat the first capture group, called \1, one or more times via +.
 
crl
(111)111111
 
Yes.
 
crl
Oh that method is so smart, testing divisibility with regex
 
You can actually get smallest vs largest factor using +?.
As written, length($1) will be the largest factor, which may or may not be prime.
By changing the capture to (11+?), now if it succeeds, length($1) is the smallest factor.
Which is guaranteed to be prime.
You can use that to factor completely if need be.
 
crl
trying to do it in JS
"111111111".match(/^(11+)\1+$/)
["111111111", "111"]
is not prime
 
6:37 PM
Right.
If it matches, it is composite.
For tomorrow's installment, I shall solve linear equations of order 1 using regex.
Just kidding.
Well, actually, I'm not kidding.
But I might forget to show you how.
 
crl
lol
 
@Rob ^ just sayin'
 
Star light, star bright, first star I see tonight.
 
crl
function isPrime(n) {return !Array(n+1).join("1").match(/^(11+)\1+$/) }
 
My original has an exception for 1.
/^1$|^(11+)\1+$/
I didn't want to call 1 prime.
Not that it's especially composite either.
 
crl
6:44 PM
oh right
 
Upvote please:
3
A: Why does attach have two Ts and detach have only one?

Janus Bahs JacquetAs user77834 points out, the currently accepted answer is quite simply not correct and should not be accepted. This question is really, unwittingly, asking two separate questions: Why is there a difference in the number of consonants in word pairs like attach and detach? Since the answer to (1...

That’s an above-and-beyond-the-call-of-duty answer.
With Old French even. :)
 
crl
twelve+one
tewlve+noe
etlwve+neo
eltvwe+neo
elvtew+neo
elvetn+weo
elvent+ewo
elvene+two
elveen+two
eleven+two
 
See how good I am with math? :)
 
crl
makes sense that t doubles after a weak a, but no after a strong syllable like de, no?
(a +t) + tach / de + tach
 
6:59 PM
You should read his answer for why.
 
crl
ah ok, let's read
adtach
 
I thought you would like it because of all the Old French bits.
 
crl
oui messire
 
It wouldn’t be the first time.
 
crl
7:26 PM
was interesting
"détacher" means indifferently detach or remove a stain (des-tâche)
 
8:34 PM
@Mitch …y limón
I can't get enough of these Sauer Cola Flaschen
@tchrist this answer makes me want to downvote everything else in sight
 
9:04 PM
@tchrist WTF. How dare he leave out the Celtic evidence!
Ha ha. Larousse is dumb.
 
latrousse
 
 
2 hours later…
crl
11:36 PM
theginger
 
11:47 PM
deringwer
 

« first day (1633 days earlier)      last day (3287 days later) »