« first day (2608 days earlier)      last day (2249 days later) » 

6:17 PM
Announcement: APL Cultivation in 13 mins.
 
6:32 PM
@vazt I think your submission is legal - why did you delete it?
 
@user202729 please use an actual graph implemenation
rather than ad-hoc ascii
 
the "is this number a prime" question has no x86 assembly answer. Hersey!
Also, does linux do instruction emulation? (Does it emulate the functionality of instructions not available on your CPU)
 
@moonheart08 Depends on what exactly you mean. You can run i386 programs on amd64 linux.
 
I mean like emulate the SSE instructions if the current processor lacks a hardware implementation
(On x86)
 
@moonheart08 I believe that this is technically possible, but am not aware of any implementations
 
6:40 PM
KVM can do instruction emulation
The kernel even supports doing so
 
it's disgustingly slow though
because the operating system would have to catch illegal instruction faults
all registers need to be saved
then the operating system needs to figure out that the illegal instruction was a certain one, run its software fallback, restore registers and hand control back
 
Some amd64 cpus do isntruction emulation at the firmware level because they don't include some uncommon instructions
 
@Pavel that's something entirely different than the OS implementing it
 
@orlp The only thing that instruction emulation in linux's kernel is actually used for (that i know of) is virtual instructions provided by modules
 
6:58 PM
1
Q: Factory workers

loladChallenge Factory workers are usually very hard-working. However, their work is now being commonly replaced with machines. You have to write a program that takes a number as input. It will print out a factory of 10 workers 10 times. Every time, each worker has a 1/input chance of being 'fired' ...

 
7:36 PM
Is there some sort of API i can use to get the answers to a question? (Asking for a KoTH challange i'm working on)
 
@moonheart08 people have made KotHs before, IIRC there was some system already made for people to use for KotHs
 
42
Q: Introducing a KOTH server!

PhiNotPiNote: Due to changes with RedHat's hosting service, the website is currently down. There are some (very) early-stage plans to create a bigger, better version. That being said, if you want to see a new KOTH server be built, please voice your support so that we can gauge demand / tailor it to th...

It appears to not be working though
 
I've already seen that :p
 
@moonheart08 will the KotH be language agnostic or limited to JS (as to be in-browser usable)?
 
7:41 PM
It'll be limited to anything that can be compiled to a .so file (To keep things running quickly. I'll be making a web GUI as well)
On that note, i'm the kind of person to be worried about security, so what measures should i take to prevent malicious answers from causing trouble?
 
.so file? Stack Overflow has it's own file type now?
 
:P
It also has it's own town, and a child named after it.
 
@moonheart08 right, I was thinking of an answer loading system for JS
 
Actually. Hrm.
.so files bring their own issues (How to compile the provided programs?)
But i can work with that. Just give a list that i'll support
Actually..
javascript might be a better idea shrug
 
@DJMcMayhem This was a fun one. Pip, 8 bytes: $=_MSENg
0-indexed; returns the number of values that match their indices.
Other 8-byte solutions: $=_FIENg or 0N$-*ENg
 
7:54 PM
I'm struggling with encoding problem in Python 3.6; I've got a multiline string and it doesn't correctly work with UTF-8. File encoding is UTF-8, file has it declared on the top, PyCharm settings are also configured this way. I tried putting the string in a file and reading from it (file is still utf-8) but it's still handled wrong.

It's not the output console bug, I've tried sending the text with requests`module to a website and it's still the same
What am I doing wrong? Never worked with UTF-8 in Python
 
What's the error and the code? TIO link?
 
@cairdcoinheringaahing I'm not saying there are any errors; the utf is just handled incorrectly
ex. I get moĂ…ÂĽesz zamiast możesz
 
So what's the problem?
 
@cairdcoinheringaahing The utf-8 is handled incorrectly?!
 
What do you mean by handled incorrectly? What are you trying to do? What should your result look like? What does it actually end up being?
 
7:57 PM
@cairdcoinheringaahing -_- are you serious? Why you keep asking about something I've already provided?
An example sentence in Polish: W tym temacie możesz expić is printed as W tym temacie moĂ…ÂĽesz expić.
 
What console is it outputting to?
 
@cairdcoinheringaahing I'm creating a bot which sends the result to a website, but it seems that there is no problem with the connection, but with the program, since print output is bugged too
wait, I'm preparing an example
 
@Soaku This might be happening in your print statement. It's converting each individual byte, rather than interpreting some as 'continuation' bytes
 
@cairdcoinheringaahing As said, the output is also sent to the server (there is return, really) which does output the same... But wait, I think I missed something
 
I have no idea how you'd be able to fix it though
 
8:06 PM
Uhh, now server seems to decline the requests... o_o
 
@Soaku Try changing with open(path+"data.txt", "r") as s: to with open(path+"data.txt", "r", encoding='utf-8') as s:
 
oh my god.
I've thought I've tried it. Because I did. On wrong `open` tho
thanks
 
I should really try rubber duck programming sometimes. Or rather, think before I do
 
isn't utf8 python's default encoding these days?
i'm surprised that's the issue
 
8:09 PM
Not when opening text files, IIRC
 
interesting
i had initially suspected that but then disregarded haha
 
@Poke @cairdcoinheringaahing I don't know what could be the issue, since I've tried it with a normal string before.
And it didn't work
 
ooo
 
In that case, I have no clue, sorry
 
check to make sure there's no implicit encoding/decoding everywhere possible
 
8:11 PM
Would't be asking for no reason :P.
 
python keeps strings in a "unicode" format internally which confuses me a bit
 
@Poke No, there isn't. Or wasn't, because I've tried to force utf-8 and it didn't work still
 
Well, I keep having weird problems with everything, occasionally. So there's no need to worry, I think [mdshrug]
 
@Poke That's about as bad as PowerShell keeping everything UTF-16 internally.
 
8:14 PM
@AdmBorkBork That reminds me: I hate Powershell. I spend 2 days trying to figure out why the character was breaking my code before realising that typing chcp 65001 solved it ಠ_ಠ
 
@dzaima My original question was rather why it doesn't work with the string... Sorry if I'm saying stuff to ambiguous
¯\_(ツ)_/¯
(why my [mdshrug] auto-replacement doesn't work ಠ_ಠ) nevermind, had a typo
 
@AdmBorkBork I think java and c# do that too. That kinda makes sense, though
 
@cairdcoinheringaahing That's more a Windows than a PowerShell issue, though.
@Poke It does until you're wanting to get a raw UTF-8 filestream input/output. Then it's super annoying and leads to unwanted behavior.
 
encodings are about as fun as http rfcs
 
that's a tautology, right there
 
8:22 PM
haha
 
In case anyone wants to see what I've been working on:
0
Q: Div resizing with mouse expands too fast

mbomb007For fun, I am creating a widget that can be toggled to use vertical typing (e.g. for Japanese). The vertical part is being done with a div that is contenteditable. At the moment, you can see both the textarea and the div, and watch their content change in sync. The checkbox does nothing yet. My ...

 
My computers fan is running so loud. Who knew exporting high quality video projects took so uch energy?
 
Q: When using argparse is there a way to get a given flag to not require the normal standard flags? E.g. when using flag -a, you must have the program parameter, but when using --help-me you don't?
 
@user56656 please no
 
9:07 PM
@cairdcoinheringaahing That's how the default help arg works, isn't it?
 
Yes, but I want to add my own 'help' option, with the same behaviour (different message though)
 
CMC: Given polynomial f with integer coefficients, find integer n such that f(m) and f(m+1) have the same sign for every m > n
 
@cairdcoinheringaahing See the help option for the action parameter
You can disable the default help and replace it with your own.
In short, when creating your argparse.ArgumentParser, set add_help=False, then you can add an argument with a help action or a custom action.
 
@LeakyNun Isn't that just the rightmost root
 
9:14 PM
@Pavel Or bigger
 
@mbomb007 Hmm, I'll keep that in mind, thanks
 
@cairdcoinheringaahing Also, if you need to use a multi-line help description, you need to add a formatter class. Like this:
 
@Pavel well you don't need to find the smallest such integer
 
@LeakyNun APL, 3 bytes: +/|
 
not every language likes to find roots
 
9:15 PM
parser = argparse.ArgumentParser(prefix_chars='/-', add_help=False, description=__description__, formatter_class=argparse.RawDescriptionHelpFormatter)
 
@H.PWiz interesting. why does it work?
 
you knew I was gonna ask you that didn't you
 
Well, I had the tab open already
 
@LeakyNun ಠ_ಠ this would be so much easier if this was m and m-1 and m<n
 
9:19 PM
@Pavel Why?
 
@Pavel Why?
 
@H.PWiz Mathematica has a builtin to give the nth root of a polynomial, but determining how many roots there are is much harder.
So I can get the first root very easily and the last one with a bit of work
 
@Pavel can't you use f(-x) to horizontally reflect a polynomial?
so that the first shall become the last and the last shall become the first?
 
@LeakyNun Yeah, but it takes a function
 
can't you compose it
 
9:21 PM
Yes I can and I feel dumb
 
CMC: Given the polynomial f(x) return the polynomial f(-x)
 
@LeakyNun Test case please
 
@H.PWiz Jelly, 5 bytes: J-*×N
@Pavel x^3-6x^2 gives any integer greater than or equal to 6
 
@H.PWiz Japt, 5 bytes: Ë*JpE
 
I have 4 bytes in APL, taking the coefficients in increasing power order
@LeakyNun 4 bytes in Jelly too
 
9:28 PM
@H.PWiz #@*(-#&)&
@LeakyNun I treid this and for some reason it's telling me that the resulting function only has a single root at 0 ._.
Actually, it says two roots at 0
If i try to take the general Root of the equation, I get x == 6 || x == 0 || x == 0
Which makes this even dumber
@LeakyNun If we were looking for the smallest root, the solution would be Floor@Root[#,1]&
 
@H.PWiz no idea...
 
@LeakyNun It uses \
 
@H.PWiz Taking it as a list of coefficients, -#&
 
@Pavel Link please
 
@H.PWiz Nvm I accidentally did -f(x)
 
9:55 PM
If anyone wants to test an interesting thing I made, let me know if there are any issues (besides the cursor movements not showing).
 
10:06 PM
disappointing, so a future version of PHP won't support unquoted strings
although i think specifically saying "PHP 7.1" or whatever is fine, right?
 
TIL: Nearly 90% of Java devs use Java 8, despite Java 10 having come out just now.
Why does no one use 9, I wonder
 
i sorta suspect it has to do with extremely short support period and rather minor improvements
although i suppose List.of, Map.of and Set.of is meaningful for codegolf
although i recently posted a solution for Java 9, so dunno
0
A: Produce the number 2014 without any numbers in your source code

xfixjshell, 5 bytes How to make Java an useful code golf language? Simple, just remove the need to declare classes, methods, make things automatically print and so on. +'ߞ'

5 bytes
 
@H.PWiz How may we take the polynomial? As a function? Vector of coefficients?
 
i sorta want to try more Java 9/10 codegolfing, because jshell has so much codegolf potential (especially due to keybindings)
 
@Adám Not my original intention, but if you do you should return a function.
 
10:19 PM
Java 10's var isn't even a big deal as far jshell code golfing is concerned because there is Shift-Tab V combination for declaring variables
 
@H.PWiz Is ⎕- valid?
 
@Adám Can I have a link please?
 
Prompts for a function, e.g. ⊥∘1 2 3 4 returns the atop ⊥∘1 2 3 4-
 
Looks valid to me. An interesting solution
 
10:31 PM
oh, this is interesting, jshell doesn't require effectively final bindings for lambdas
which is nice, could shorten code golf programs (i wonder if that's a bug, but i mean, it's a feature)
i suppose it has to do with local variables being actually class static variables due to how Java REPL was implemented
okay, using an explicit block complains about variable not being effectively final (as it forces it to be a local variable)
 
C# has had it's own REPL for a bit (csi). The repl itself sucks so fucking much (you can't even use arrow keys to move the cursor).
Then they pretty much accidentally made it be hella useful by letting it run C# from files, giving us C# script, which is super neat.
That said, Mono's REPL (csharp) is fantastic and comes with autocomplete and stuff
 
@Pavel Same with c# interactive :P
 
@ASCII-only Isn't that just Visual Studio's wrapper around csi?
 
Mono 5.10 also has an additional interpreter for MSIL assemblies: mono-project.com/news/2017/11/13/mono-interpreter
 
@Pavel who knows, it probably is
 
10:47 PM
CMC: given integer n with n > 0, return the list of [a1 a2 ... an], where each ai is a non-empty sublist of [1 .. n], and a1 ⊂ a2 ⊂ ... ⊂ an.
e.g. for n=3, return [[[0],[0,1],[0,1,2]],[[1],[0,1],[0,1,2]],[[0],[0,2],[0,1,2]],[[2],[0,2],[0,1,2]‌​],[[1],[1,2],[0,1,2]],[[2],[1,2],[0,1,2]]]
(each layer can be in any order)
I accidentally shifted 1 2 3 to 0 1 2 in my example
 
Is a1 [[0],[0,1],[0,1,2]]? how is that a sublist of [1..n]
 
for n=3, return [[[1],[1,2],[1,2,3]],[[2],[1,2],[1,2,3]],[[1],[1,3],[1,2,3]],[[3],[1,3],[1,2,3]‌​‌​],[[2],[2,3],[1,2,3]],[[3],[2,3],[1,2,3]]]
@H.PWiz return all possible such lists, i.e. [[1],[1,2],[1,2,3]] is a possible list
 
Oh, got it
 
11:26 PM
CMC, given a list of lists of integers 0-9, append enough 0s to end of each list to make each list the same length as the longest list in the input. [[1], [1, 2, 3], [0, 2]] => [[1, 0, 0], [1, 2, 3], [0, 2, 0]]
 
ngn
@Pavel apl: ↓↑
 
@ngn What does ↑ do?
 
ngn
@Pavel "mix" a vector of vectors into a matrix, padding with 0s
 
11:46 PM
@Pavel Jelly, 3 bytes: z0Z
 
ngn
@LeakyNun oK: 1+{((#x)#x)@<x}'',\'prm n
@H.PWiz apl: -\
 
@ngn No?
@ngn x + x² -> -x + x²
 
ngn
@H.PWiz can we represent the polynomial as a vector of coefficients - from the constant term to the highest power of x?
 
Yes, that's how I solved it
 
ngn
@H.PWiz ah, I see... I need a monadic -
@H.PWiz ⊢∘-\
 
11:59 PM
@ngn That's what I had (inspired by you)
 

« first day (2608 days earlier)      last day (2249 days later) »