« first day (269 days earlier)      last day (2976 days later) » 

12:14 AM
@beaker To concatenate horizontally: you need to concat twice. So hh. To concatenate vertically: v concats all the stack contents. So if you only have those three stacks, v suffices. If you have other arrays below, you need 3$v (specify 3 inputs for v)
>> matl [1 2][3 4][5 6]hh
1 2 3 4 5 6
>> matl [1 2][3 4][5 6]v
1 2
3 4
5 6
>> matl 3:9[1 2][3 4][5 6]3$v
3 4 5 6 7 8 9
1 2
3 4
5 6
 
@LuisMendo okay, i was using hh, but i didn't know if there was another way
 
If it's horizontal concatenation no
 
cool, thanks :D
 
Anytime! Is that for an answer to PPCG? Can I help?
 
i'm learning
trying to translate my answer to the which base question
 
12:23 AM
@beaker I has shrunk quite a bit since when I saw it!
 
my answer?
 
Yep
Is it allowed to require padded inputs?
 
yeah, the OP said I could take arrays that were padded to be equal lengths
it's been added to the input requirements
that prepad seems like a cool function, but boy is it verbose :/
 
Good. Perhaps I can save some bytes with that padding
I didn't know about that function. I had to look it up. It's only Octave
 
Hey guys.. quick question... does anyone know the shorcut for a title in a post
 
12:26 AM
@TrevorClarke What do you mean?
 
like
I am dumb and have a memory of a bat
and earlier I accidentally hit a shortcut that made your selection (while writing a post ie: question or answer i think) that would format it as a title
and i forgot it
nevermind
its ctrl+H
 
ah, header
 
Real Men use --- and # # to format headers;)
scratch that
 
:-D
 
Real Men use curl to grab the html of the opened answer, edit it with vim, then submit it back
 
12:28 AM
real muppets use <h2> </h2>
 
@beaker cheater
 
yeah
well
 
because <h1> is too noticeable ;)
 
whatever work
yknow
 
@beaker you use <h1> at the end of your post to say THANK YOU FOR YOUR HELP PLZ
 
12:29 AM
yeah
I always upvote those posts
 
I vote too;)
 
see sometimes people think that is a bad thing
but actually
it gives others something to edit
and earn rep
 
yup
 
cmon
get your facts streight
 
I sometimes even edit that stuff into dry posts with no human touch
 
12:31 AM
yup
Yeah
 
welcome to our midst;)
 
or when I answer a post
i go in
edit the post to say "THANKS TREVOR YOU'RE THE BEST"
-2
Q: Disable delete button from JTextPane

A. ZambranoSo, today I come to you to see if you guys can help me out with this. I have a JTextPane who works as a Manager for MySQL, so I use it instead of that ugly black and white console. But I wanna know how to disable the 'delete' button after the user press 'Enter' and move to the next line. For exa...

"I hope I get a nice answer"
yeah
 
@beaker I can't save much with the 0 padding because currently ZA (base2dec) has a bug. It's been corrected for the next version. BTW, I have no idea how your answer works :-P
 
I can't see <h1> there, downvote
 
and a nice downvote
yup
 
12:33 AM
that post seems so bad I'm not touching it
 
yeah
I fixed the ending a bit
I want to see what % of the comments are just random text
 
@LuisMendo do you think i should post an explanation? :-o
 
@AndrasDeak
?
 
hm?
did you leave out the code formatting for that code line on purpose?
 
Oh no
just missed it lol
but what I was going to say is I AM SO HAPPY
 
12:37 AM
for what?
 
I hopefully will get early access to the "Documentation " thing .. so I can help and request features
 
ah, cool
 
like honestly
 
don't take this the wrong way, you're welcome here, but are you aware that this is the matlab&octave room?:)
 
lol
yeah
 
12:38 AM
OP fixed the post....take a look again
 
okay
but like the odds of this happening: meta.stackoverflow.com/questions/319701/… but tbh I will do a ton of work
so yeah
lolol
even better
+1
 
@TrevorClarke good job sneaking in:)
 
lol
well I will honestly help
as much as I can
 
@beaker I think so, yes. Unless it's something really obvious that I'm missing!
 
@TrevorClarke that's cool
I'm not particularly interested in docs
 
12:43 AM
oh
 
but both matlab and python have decent documentation:)
 
idk I think it will be cool... tbh I considered making my own
like
a nice clean version of W3
 
some of us use CUDA...no need to tell them how badly SO Docs is needed:D
 
but I may as well use SE's
but my idea came from theirs
but
theirs will always be better
 
yup
 
12:45 AM
would you rather me not hang out here
like am i cluttering up your chat?
 
no, I've just been trying to get myself to walk the dog and go to sleep for an hour:D
you're not impeding or anything
I do this every night
 
I'm too lazy to go to sleep
 
what time is it there
 
2 AM soon
 
12:49 AM
lolol
okay
I do the same
 
and I don't have strong feelings for documentation anyway:)
 
and then I fall asleep without doing anytihng
 
you see, I'm a physicist
I was raised differently:P
 
@LuisMendo actually, I think it doesn't work :(
gonna double-check
 
12:53 AM
meep:(
 
::whew:: it passed that test case :D
 
@beaker Looks like a MATL translation would be easily less than 20 bytes
 
did you walk you're
*your dog
 
not yet
she's fast asleep
 
1:03 AM
lol
kk
 
1:22 AM
@LuisMendo well that's discouraging because I was over that before i started working on my explanation ;)
also, had dinner
I'll work on it some more later
 
1:36 AM
@beaker It was just a guess. I don't really know how your Octave code works...
 
my explanation was getting too long
gonna use addition
almost there
 
Ok I think I'm going crazy. How can I pop off just the first input in MATL
basically I want input1:input2
I thought that i: would work since the input is [1,4]
effectively saying to call colon with the two items on the stack
 
@beaker Even if I don't see how it works, I did a quick translation of your code. Can probably be improved, I'm at 20 bytes now
This uses 3-row array as input
 
@LuisMendo Thanks, I'll have a look in a minute.
 
good night, gents and muppet
 
1:45 AM
I've posted a short explanation
4
A: X+Y=Z - but in which base?

beakerOctave, 67 75 38 bytes Because "loop over ALL the things" is too much work. @(x,y,z)max([m=max(x+y-z) [x y z]])+~m Requires 0 padding to make the input arrays the same size, e.g.: [2, 158],[88],[3, 12] becomes [2, 158],[0, 88],[3, 12] Since 0 is used for padding, 1 is used as the token for...

 
@beaker Down to 19
I haven't done much testing, just the same case linked in my answer
 
oh, you're using those G's and M's... I gotta see what those do :D
 
@Suever If you want colon with two inputs: 2$:. And you can probably skip the `i. For example:
@beaker Automatic clipboards. Pretty useful :-P
G in this case is "push the input again"
M pushes inputs to recent function calls
 
@LuisMendo yeah, I scanned the section on those briefly, but i didn't look very deeply
 
@LuisMendo Oh hmmm I guess I was just specifying the input incorrectly. Is the way you've provided the input functionally different from [3;9] or [3,9]
 
1:49 AM
@LuisMendo so if I do h and it concatenates 2 arrays, then M will push those 2 arrays back on the stack?
 
@AndrasDeak Good night!
@Suever The way I provided is for the function :. It takes two different inputs (provided as two values in two lines in the online compiler). If those 3 and 9 are fixed you can use a literal 3:9 as in Matlab
 
also, is there a quick way to clear the stack completely?
 
@beaker Yes, but M takes a numeric argument to specify which function you refer to. You'd use 1M to refer to the most recent function. And if that function had two inputs, you can pick only one input with 5M or 6M
 
okay, i get that
 
Ok got it. So a single line is a single input. So I can pass a multi-element array as an input on one line but since I want colon with two inputs it's easiest to supply two lines in the online compiler and then implicitly grab both and pass them right to colon
 
1:53 AM
@beaker N$x will work. But having to clear the stack completely often means it could be done better ;.)
 
@LuisMendo yes, if I can just use G to pull in the original inputs
 
@Suever Yep!
 
I was tempted to use it when I was blindly duplicating the inputs in case I needed them
 
@LuisMendo This is addicting as hell
 
@beaker If you have an input, G pushes it back. If you have several inputs, G takes a number to specify which
@Suever I know what you mean... code golf is so entertaining!
 
1:57 AM
You know what I always thought would be cool
?
 
Yes I do.
 
what
lol
 
Nutella-scented ID cards.
 
Is there a shorter way to basically say pass all inputs to colon? Similar to function thing(varargin); colon(varargin{:});?
 
Ok so imagine this. You type on your keyboard and it prints it out as you type like a typewriter except on a modern printer and it would be cool
 
1:58 AM
Rather than specifying the 2-input version of colon explicitly?
 
maybe if you removed the whole top part
so you could see the paper
as you typed
 
@Suever But colon can only take up to 3 inputs, as in Matlab... And you need to specify how many with $ (or use 2 input by default). Do you mean a loop to apply colon to each input? Or what is it that you want to do?
Maybe give an example of what you want to get
 
Ok here's what I'm talking about, if colon is two inputs by default why would this not give 2:5?
It seems it is defaulting to 1 input
1:2
 
By default it's one input
Yes
Assumes 1 first
(which is the most common use)
You need 2$:
 
Yea that makes complete sense
Thanks for the pointers
 
2:02 AM
Anytime!
@beaker How did you ever come up with that reasoning for the "which base" answer? :-o
I wish I could upvote again
Gotta go! See you all!
 
@LuisMendo g'nite!
 
baiii
 
@Suever Oh, I see now that I said "2 input by default" for colon. Sorry for misleading you. It's 1 by default
>> matl -h :
:   vector of equally spaced values
    1--3 (1);  1
    colon (with three inputs x, y, z produces x:y:z; with two inputs
    x, y produces x:y). If one input: produces 1:x
^^ The number in parentheses is the default
 
2:17 AM
@LuisMendo Thanks, it was just the observation that x(i) + y(i) must always be less than 2*base, so a carry will always reduce the sum by 1*base.
 
2:56 AM
@AndrasDeak Are you still contemplating getting up and getting ready for bed
 
 
6 hours later…
9:14 AM
7 hours ago, by Andras Deak
good night, gents and muppet
 
 
1 hour later…
10:25 AM
@AndrasDeak you still not in bed?
 
10:54 AM
@beaker You should post the 19-byte solution. It's your algorithm!
 
 
4 hours later…
3:16 PM
0
A: X+Y=Z - but in which base?

beakerMATL, 13 bytes --X>t~?x1GX>Q Translation of my Octave answer into MATL. (My first MATL answer!) Input order is Z, X, Y (or Z, Y, X if you prefer, I'm easy) Input arrays are zero-padded to equal lengths Takes unattractives as 1 Try it online!

I still need to go through your solution and see if I can understand it
 
@beaker y'er second now in bytes
 
@Adriaan tied
would be nice to knock off a couple of bytes ;)
I had a flash of realization this morning and managed to knock 6 bytes off my Octave answer
that was good
 
7
Q: Where to buy "Grimbergen" in Canada

mattegenerI've spent much time in Ottawa and Halifax, and have yet to find a consistent source of this nectar of the gods. Locations Found: Liquor Store in Whistler, BC LCBO in Trainyards, Ottawa Greek Restaurant in Downtown Ottawa Brussels. Anyone know where to find it?

good thing I live in the Netherlands I guess
€3 for a six pack tripel here :P
 
how much is it in Canada?
btw, €3 for a six pack sounds crazy cheap
 
3:34 PM
Not a clue, never been to Canada
TBH, usually it's €6.75, the €3 was last month in some special occasional thing
Hence I bought 4 cartons
 
that sounds more usual ;) good plan stocking up
(assuming it's any good) >:D
 
@beaker it's not my favourite, but still very good and especially for €0.50/bottle definitely one of the best quality/price ratios you can get
I'm going to do a bicycle holiday (I know, I'm Dutch) with my girlfriend through Flanders this summer, visiting breweries
 
now that's a holiday
 
She's been cycling on holiday every year, including NY-Niagara falls, Austria-Slovenia through the alps, France, Spain etc
but I'm too lazy for that, so we opted for less than 80km/day and lots of beer
 
I did the Scotch trail with my parents one year... (my grandmother stuck her head in a fermentation vat at the invitation of the tour guide... that was amusing)
^^ driving, not cycling, by the way
 
3:43 PM
@beaker I did Scotland by train/bus last summer. I'd like to go back and hitchhike along, that's presumably pretty doable
 
3:56 PM
@beaker 13 bytes! Well done!
 
@LuisMendo Yay!!
:D
I'm sure the implementation is fairly clumsy, but I still haven't had the chance to go through your solution
 
@beaker My solution was taking the whole 2D array if I recall corectly. Your is better, with each 1D array in an input
 
@LuisMendo It's only better because I realized this morning that it was unnecessary to include x and y in the max. I made the same change to my Octave answer and knocked off 6 bytes.
 
@beaker You can use a permalink with code and example input in Try it online. Just use the "save" button
 
okay, i hit save...
now just copy the url?
again?
 
4:00 PM
You need the long URL. As it stands now, its just http://matl.tryitonline.net/`
 
:")
done
thanks
 
:-)
 
I didn't even notice it wasn't the correct url
 
Very nice answer. Almost beating Jelly!
 
yeah, so if you've got any magic formula that can knock off, say, 3 bytes... ;)
 
4:03 PM
Oh. Dennis has used your approach and is now at 7 bytes :-)
 
LOL
thief! :D
 
Jelly is very hard to beat
Well, he's giving credit :-)
 
He is, and for him to use my algorithm is a bit of an accomplishment in itself
 
Totally!
 
 
2 hours later…
6:16 PM
0
A: Index of maximum value element in each row (last index)

AdriaanYou can use linear indexing to get the last index of the maximum by finding all maximum values within a row, then using the index of the last to index the original column: N=size(p_y_x,1); indices=zeros(1,N); for n=1:N [~,tmp] = max(p_y_x(n,:),[],2); %// find maxima in a row indices(n)=p_...

can someone tell me why find is faster than my solution?!?
tmp2
Elapsed time is 1.900299 seconds.
Elapsed time is 1.963632 seconds.
>> tmp2
Elapsed time is 1.899508 seconds.
Elapsed time is 1.946171 seconds.
>> tmp2
Elapsed time is 1.933466 seconds.
Elapsed time is 1.955461 seconds.
>> tmp2
Elapsed time is 1.922170 seconds.
Elapsed time is 1.958938 seconds.
where tmp2 is the name of my program, the first time listed is OP's original program, 2nd is mine
I thought that find was a lot slower than logical indexing
it's just 1% slower or so, but still
hum, the second output of max apparently finds only a single value
 
@Adriaan no idea
did you try fliplr before max?
you'd have to adjust the indices, but no biggie
 
@beaker see my updated answer; the second output of max gives the first index
I think it's slower since it needs to flip the thing first, then find the max
Divakar blew mine out of the water anyway, with a find and accumarray o.0
 
@Adriaan huh? I thought the second output gave the index of the first occurrence.
 
@beaker yes, OP wants the last
oh, oops, yes it does, hence I had to flip the array :P
 
i have no idea what you're doing
[~,indices] = max(fliplr(a), 2)
 
6:29 PM
omg, that's such a good idea
tries it
 
size(a,2)-indices+1
 
@beaker luis just posted that
is faster than Divakar's by 50% :p
 
@beaker Whoops. Sorry. If you want to post that I'll delete my answer
 
why the last line though @LuisMendo @beaker?
 
@Adriaan Thanks! Typed too fast
 
6:35 PM
@LuisMendo as fast as your solution is compared to mine :P
! used 1% more time than the original, DIvakar 35% less, you 20% less (on R2015a)
 
@Adriaan If you flip the array, the indices are "flipped" too
The last line corrects for that. It's "unflipping" the indices
 
@LuisMendo oh, obviously, yes
 
@LuisMendo no, it's all yours :)
 
@Adriaan You need the second output of max in your answer, right?
+1 for the Latin, though
:-D
 
@LuisMendo yes. Sorry
 
6:38 PM
Also, you probably don't need .'
 
was messing around with getting it right; I used a temporary before
@LuisMendo I don't? I need to get the last value
either that or fliplr
changed to fliplr, that should do it
 
max on a vector works the same whether it's a row or column vector
@Adriaan Now you only need the "unflipping" of indices
Divakar managed to squeeze bsxfun and accumaray in, LOL
 
@LuisMendo thanks!
@LuisMendo I'm surprised, since accumarray is just a loop in disguise
 
@Adriaan No, that's arrayfun
#Repect for accumarray
 
what about: [~,idx] = min(-x,[],2) ?
 
6:48 PM
@Amro that still finds the first occurence
 
yes, but the first occurrence of row minimums of -x (negative x)
so that should be the last occurrence of row maximums of x (positive x)
I think :)
 
I concur. x=[2 1 2] -> -x = [-2 -1 -2] The desired index is 3, you'd still find 1
 
oh never mind then :(
 
A hackish way, if the input contains integers, would be to add (via bsxfun) a small increasing row vector 1/size(x,2):1/size(x,2):1
But that requires quite a few additions
 
7:52 PM
@LuisMendo you deserve the accept on that one, and with me, Divakar and you all tied at votes, it's up to the RNG to say which answer's on top. I think that should be yours, since it's a) very clear and logical, and b) the fastest by far
 
 
2 hours later…
10:01 PM
@AndrasDeak better stay here; our teen age friend is "lol"ing all over the bots again
 
lil turd
 
I assume everyone over there is much more thoughtful and less rash than I am, but is it already under consideration to kick him out until he reaches 3k rep?
 
11:03 PM
it won't help much
 

« first day (269 days earlier)      last day (2976 days later) »