« first day (2435 days earlier)      last day (803 days later) » 

7:07 AM
How can I open a csv file located in my desktop in python CSV ?
 
Which OS?
 
@ATaco Windows 10, Python 3.6
 
0
Q: Primitive roots density of number

Alex K ChenDefinition: A number m is called the smallest primitive root of a prime p iff it satisfies the following conditions: a. The smallest integer k for which p dividies mk-1 is p-1 b. No other positive integer smaller than m has this property. Your task Given a tuple (a,b) of positiv...

 
with open('%HOMEPATH%\\Desktop\\file.csv', 'rb') as csvfile:
	reader = csv.reader(csvfile, delimiter=' ', quotechar='|')
 
Okay, thanks for the help, butt what's the `%HOMEPATH% ?
 
7:17 AM
It's an Environment variable for windows that refers to your Users/yourname folder.
Try typing it into Explorer.
 
My file name was aafa.csv. When I typed that, showed an error
FileNotFoundError: [Errno 2] No such file or directory: '%HOMEPATH%\\Desktop\\aafa.csv'
 
Anonymous
import pathlib
with pathlib.home().joinpath("Desktop", "file.csv").open() as csvfile:
  reader = csv.reader(csvfile, delimiter=' ', quotechar='|')
 
@Mego Which portion in your code should I change to aafa (my file name) to make it read ?
Oh OK. Ninja'd
 
Anonymous
I forgot to append the Desktop bit :P
 
Anonymous
pathlib is platform-neutral and awesome
 
Anonymous
7:25 AM
You can also do (pathlib.home()/'Desktop'/'file.csv').open()
 
Darn
AttributeError: module 'pathlib' has no attribute 'home'
 
Anonymous
Oh whoops
 
Anonymous
pathlib.Path.home()
 
Anonymous
It's a classmethod of Path, rather than a module-level method, for whatever reason
 
7:26 AM
Yay it works thanks.
 
Mego's got it, I still can't python
I can pit viper though
3
 
Anonymous
Glad to help
 
7:53 AM
@Mego BTW, What's the analogous thing for open() function for manipulating .txt files ?
 
@ASCII-only Of course it should, I don't know what I was thinking...
@Pavel Perhaps you were thinking of .hidden which is a new HTML5 property
 
Anonymous
@AlexKChen It's still open. If you need to be able to write to the file, use open('w').
 
hello all
maybe I should volunteer some code to get people started with codegolf.stackexchange.com/questions/143808/… ?
 
@ASCII-only popcnt(randInt(1<<N)) gives you a binomially distributed random variable between 0 and N
 
@Neil 1. Doesn't go high enough, 2. Realized I need multiple dice distribution not binomial (oops)
@Lembik possibly? An ungolfed example program would definitely help though
 
8:06 AM
eval('+'.join(randInt(6**N).toString(6)))+N
 
Hmm
That works, but I guess what I'm really looking for is a sub O(n) algorithm
Without doing it all in one step because that means massive numbers which would use up too much RAM
 
8:48 AM
in that case I don't know what you mean by a number in the range of outcomes
 
9:11 AM
@LeakyNun Would you please reply to this?
May we output complex floating point numbers as long as they yield the correct answer when rounded to the nearest integer/gaussian integer? — fireflame241 yesterday
 
@LuisMendo yes...
 
Care to edit into the challenge then?
And notify fireflame241
 
ok
@LuisMendo done
 
@ASCII-only This gets all the movies with their ratings bpaste.net/show/33049702f587
although not perfectly
added code example to the question
 
@LeakyNun Thanks
 
9:21 AM
hi @mbomb007
 
9:50 AM
0
Q: Why there's no latex in PPCG?

Alex K ChenIt is often useful explaining questions/answers with math.

 
10:28 AM
I have an idea of an interesting challenge
there are n people
you are at (0, 0), and you get a distance n*n matrix where D[i][j] gives the distance between person i and j
finally you may assume that person 1 lies on the positive x axis
 
I am confused
is there latex support here or not?
yesterday some people said there was
 
what does "ATaco's userscripts add LaTeX" mean?
 
too clever :)
 
10:40 AM
Feb 13 at 12:59, by mınxomaτ
You can use https://latex.codecogs.com/gif.latex? and append your latex code encoded.
 
@Lembik yes with this
drag 'start chatjax' to your bookmarks
and click it once you see some $\text{latex}$ and the chatroom will render latex from that point
 
oh so it is supported!
i am so confused
 
it's supported in the sense that we add support for it :P
 
who adds the support? Just the chatroom?
 
@Lembik we, the users. :p
 
10:46 AM
the bookmark runs some javascript on your current page that renders latex on your current page
 
ok so it should work for the main site too?
 
theoretically but don't use it
because most site users won't know about it
 
hmm... it feels like the link could be in the question
click here to read this question
is that not realistic?
or do we want to support non-js users?
 
@Lembik the question it's closed as a duplicate of tells why it's disabled
 
there is a problem with delimiters?
 
10:51 AM
@Lembik yep, IIRC
Stack Exchange could change the $..$ delimiter, but not $$...$$ IIRC
 
@Lembik it's not realistic to ask random readers of your question to run some javascript bookmark
there's a huge difference between chat (where everyone knows eachother)
and main site (where arbitrary random people can and should be able to read your question)
 
@orlp right but bear in mind I am no JS expert. Could it be made click free?
I mean can the JS be run automatically for particular page?
 
@ASCII-only what does do in charcoal?
 
I feel we need a more point and click type solution for adding LaTeX to question
 
@Lembik no
that would be a massive security risk
 
10:56 AM
currently it seems you go to an external webpage, enter the LaTeX and create the gif. Save the gif and then embed it into your question
@orlp good point
 
that's why the it's ok in the chatroom
when I link you this chat jax thing
you can look at it
and see that it's just a normal thing
plus you kinda know me so there's some trust
 
:)
 
(I presume)
 
I know so little about you it's almost untrue
I can guess species :)
 
those are all things you don't have with a question
 
10:57 AM
not much else
 
@Lembik can you though?
 
well it would be a guess
 
but forget about using chatjax or something similar for your questions
it's either normal text or images
the real question is why latex hasn't been enabled on codegolf yet by the stackexchange people
the answer IIRC was that their latex implementation was super buggy and all the weird stuff on codegolf triggered those bugs\
 
Anonymous
Pretty much all I know about orlp is that they are better than me at Python golfing, golfing in general, and Path of Exile
 
interesting
@Mego :)
 
11:00 AM
@Mego heh
 
now that I have added sample code, I really want someone to answer my challenge :)
@orlp could we have a simpler way to get the images maybe?
 
@Lembik what challenge
 
> (where everyone knows each other)
 
I decided to experiment with a different sort of question
 
11:02 AM
 
doesn't know anyone
 
@orlp oh can you add that directly?
 
@Neil alright, mean joke (nothing personal, just found it funny): everyone that matters knows eachother :P
@Lembik don't
that's hotlinking to a service
it's rude
 
ok.. so I go back to my point :)
 
just click the 'put in an image' and paste the url in 'from an url'
click that
 
11:05 AM
oh that's what I meant before
 
@Lembik alternatively once you've got the image from that website
you can just copy/paste it
if you have an image on your clipboard
 
nice
 
and you are in the 'drag and drop' screen
you can just paste
 
is this all documented somewhere on the ppcg meta?
 
right here in this chat
 
11:06 AM
those are the simplest instructions I have seen yet
 
@EriktheOutgolfer according to the source, it returns whether the function returns truthy for all values in the iterable.
 
I tried that but it doesn't seem to be the case...
 
@Lembik if you look on their website
> Welcome to the private implementation of the CodeCogs Equation Editor for domain codecogs.com. If you have reached this page from another domain, or if CodeCogs (Free Service) does not hold a valid licence for this product, then you are not authorised to use this program or the webservices provide by this server.
so definitely don't hotlink to them :)
> Equations generated by CodeCogs can be used for any purpose, anywhere. The Equation Editor Plugins (i.e. CK Editor) and Editor API can all be used for free.
so it's perfectly ok for you personally to use their website to generate an image, copy it and host it somewhere else
just don't directly link to their website
 
@EriktheOutgolfer pls link to what you tried
 
11:11 AM
Also you need an opening brace btw because it accepts a lambda not a snippet
 
@EriktheOutgolfer yeah because no function
 
you need a function???
 
@orlp got youu
 
@EriktheOutgolfer yes?
 
11:12 AM
 
@EriktheOutgolfer 10/10
 
also I'm not really sure what does
 
@EriktheOutgolfer that's any
 
for testing that an array only has positive elements I'd use Minimum
 
@ASCII-only function again huh?
seems so
you really need to document more :p
 
11:15 AM
Oops apparently I don't cast the bool to an int
 
huh?
for me it prints -
that seems to be 1...maybe python auto-conversion to int?
and btw @ASCII-only I think "casts to direction"?
 
@EriktheOutgolfer yes, that twice casts to directions
 
twice?
what does it do once?
 
@EriktheOutgolfer probably, of you cast that it prints true
 
I can confirm that Print(Cast(Not(0))); outputs True
 
11:18 AM
@EriktheOutgolfer twice = multidirectional I mean
 
@Neil me too
should be fixed asap as well as much documentation added
@ASCII-only so ✳✳ casts to mdr and casts to dir?
 
@EriktheOutgolfer yep
@EriktheOutgolfer yes >_>
 
and means "x position" and means "y position" right?
 
Yes
 
whoa, when did you add that?
 
11:20 AM
and what does do???
comment?
 
Yes (sorry I just never update anything other than the code page)
 
@Neil haha there's a challenge that could be solved by eval and getting the position so I added it, it's pretty recent
@EriktheOutgolfer starts a Unicode character
 
oh
nice char to assign to
like, people would think they can't encode charcoal :p
and what does do?
also @ASCII-only is evalvar and is...?
 
Have no idea if it actually works
@EriktheOutgolfer only one that made sense :P
@EriktheOutgolfer execvar i.e. command not operator
@EriktheOutgolfer keep forgetting >_>
 
11:25 AM
and...what does that do? it looks kinda similar to the Halved char
@ASCII-only guessed so
 
@EriktheOutgolfer brb finding
 
> finding
how? in charcoal's source?
 
Yeah
 
I tried to but it's like top-notch obfuscation lol
also what does do?
 
Also crap directions is broken in Charcoal verbose mode
Yay
 
11:33 AM
or any of ⧴ ″ ≔ ≕ ⎆ ; · (dunno if the last one just serves for …·)
yeah lots to doc
 
Can't see the first two, set variable (backwards compared to normal order for a string variable name), get variable for string variable names, probably Wolfram rule, Wolfram span
If the second is weird double quote and there's a triple quote of that then it's repeated, triple is repeatednull, basically + and * in Regex
 
first one looks like :→ second is probably that "weird double quote"
 
Ok first is Wolfram rule, checking fifth
Wait hang on first is patterntest, ➙ is rule but idk if that's documented
 
like, regex?
 
@EriktheOutgolfer should be don't think so, check the testcases
 
11:42 AM
the unit tests?
 
Yep
 
it doesn't have anything for (:→ lookalike)
 
but chrome search doesn't find anything at all
although I'm not sure if it's far from there
 
Nvm it's not patterntest
It's delayedrule, doesn't work atm
 
11:52 AM
hmm...you really need to scrape the code page and document each missing char, along with 2- or 3-char undocumented operations
 
Yes I do >_> but on mobile rn
 
yeah figured out since you couldn't see chars
 
12:13 PM
added x and y to the wiki
 
such descriptive
 
I nominate this for the comment of the day.
 
@AlexKChen is it Acer or Pendo >:( why do you have a Surface
Could be Apple too
 
12:35 PM
lol I sometimes put TIO links in SO answers
 
'morning everyone o/
 
hi o/
 
0
Q: Distances to coordinates

orlpThere are n people on a 2D plane. Using distances between them we're going to find their positions. To get a unique answer you may make four assumptions: There are at least 3 people. The first person is at position (0, 0). The second person is at position (x, 0) for some x > 0. The third person...

 
@NewMainPosts triangulation ftw
 
12:56 PM
@ASCII-only Nope. Lenovo.
 
1:34 PM
Question: do you think I should support custom dyadic operators in my golfing language?
I noticed that Jelly doesn't have dyadic quicks, only monadic and n-variadic
wait nvm it does; both compose operators lol
 
@HyperNeutrino it's not triangulation
 
no? oh :(
 
there are no angles given
 
wait what's the term then
 
that's for you to figure out \o/
 
1:37 PM
/o\
 
1:49 PM
CMP: What Linux distribution should I use for my Atom netbook from 2011?
 
tails
 
@TuxCopter probably mint? Depends on the specs, really
 
@TuxCopter Fedora
 
Question: what’s the best way to describe to a non yeh person what a compiler is and why it is needed
 
@Downgoat You can tell them it's something that translates code to 0's and 1's (or ASM if you want to explain that too) or something
 
2:02 PM
@Downgoat You hired a butler who only speaks Ancient Greek. You speak English, so if you want your butler to understand you and follow your instructions, you have to have some way of translating. Obviously, of course, modern English has lots of expressions that make no sense in Ancient Greek, so you can't just use a dictionary to literally translate, so you have to get a translator.
 
@Downgoat It's like google translate from a programming language to your PC's native language
(without the awful translation mistakes, hopefully)
 
@Fatalize that's why you hire a translator and don't use Google Translate
 
@Fatalize the awful translations can be used to explain bugs
 
yeah but google translate is automatic, like a compiler, and unlike a person
 
but someone had to write the compiler...this is why analogies are stupid
 
2:04 PM
@J.Salle Well yes and no because almost all bugs are not created by the compiler
 
@Fatalize it's close enough though
 
@Downgoat the computer only understands ones and zeros. It's faster to convert code to ones and zeros beforehand instead of doing it while the code is running.
 
The computer doesn't understand. It computes.
 
@mınxomaτ [Citation needed]
 
2:16 PM
@mınxomaτ I don't understand anything either, particularly women.
 
@Neil most people don't understand women, women included.
 
People don't understand people period
 
@Fatalize that too
 
nothing understands or can be understood by anything period
:P
 
-2
Q: How to leave only one value remain among the duplicates in Excel?

user3000482I'm sorry but I really didn't know where to ask this question but I am stuck with this problem where I need to get rid of duplicates of values and just leave one value remaining in the sheet. For example, I want to find a way to organize the entries in column A into column B such that only on...

 
2:24 PM
@AlexKChen wat. How could you say Lenovo is the worst, let alone bad
 
what's the name of the function of f([1,2],[3,4]) -> [1,3],[1,4],[2,3],[2,4]?
i.e. permutations of lists
I don't remember atm
 
Cartesian product
 
thanks
 
@FunkyComputerMan what reason did you VTC this? It doesn't appear you voted as "This is more suited for SO"
 
@cairdcoinheringaahing No objective winning criterion
I didn't feel like it should be on SO
 
2:32 PM
Jeez the last Brachylog answer was posted on September 8… :(
 
@cairdcoinheringaahing How can you tell?
Ah I see
 
@xnor do you think llhuii’s Evil Numbers solution’s execution time is a red herring?
I wonder about Mitch’s 46-byte solution too… the 47-byte everyone else got seems hard to eke another byte out of, so presumably Mitch found some trick, just one that isn’t as good as yours/llhuii’s?
 
@ATaco somebody beat you for your gcc coprime solution :/ codegolf.stackexchange.com/a/144018/46271
just wanted to let you know, don't delete it or anything
cool solution
 
With "somebody" being Dennis, it's not really surprising hahahah
 
eh
 
3:04 PM
0
A: How on earth did llhuii output the Evil Numbers in 42 bytes of Python?

Lynnllhuii’s Python 3 submission Here are the Python 3 submissions for Evil Numbers at the time of writing: llhuii probably ported their trick to Python 3, and came up with a solution that is 3 bytes longer than their Python 2 solution, and has 45 − (25 + 18) = 2 bytes of whitespace. Porting ...

2
I’m going crazy thinking about this
 
@Lynn don't the rules disallow exec anyway
 
No, exec is disallowed means shell exec
 
roger
 
which is usually in place so that the best C solutions aren’t just main(){system("perl -e'@#(&%$#(%;'");}
 
Why don't people do that on PPCG?
 
3:14 PM
@ASCII-only You trust actual experience more than what those guys say, right ? I have a Lenovo laptop since the past two years, and the experience is ... pretty awful, to say the least.
 
I’m sure it’s a common loophole. Isn’t it?
 
Yup.
 
It’s kinda outsourcing the answer maybe
 
I would say thats a streach
 
yeah, the body describes a different kind of outsourcing
 
3:17 PM
Don't think its a loophole
I guess people just don't do that here
 
They must (thankfully) recognize that it’s against the spirit of golf.
 
It's maybe not an explicit loophole, but I figure people just have good sense not to do that
 
Also, like… the assumption that perl is installed is totally invalid on here. There’s no “reference system” or anything
anagol users abuse the golf server a lot. If I post a challenge where you have to print the string "/srv/test", golfers will soon recognize what’s up and answer pwd in Bash, but of course that answer wouldn’t make sense outside of anagol
 
@FunkyComputerMan it's ok to use that
but there's a catch
then your answer is "C + Perl"
that is, that's the language
that's why bash based solutions that call other programs to do the work are scored as
 
@AlexKChen well it can't be worse than an Acer and a Pendo
 
3:30 PM
"bash + sed + perl" for example
 
@AlexKChen well it depends what you count as awful
 
@Lynn this is always my worry
when I see some crazy short solution
I want to be impressed
but there's always this feeling in the back of my head "they probably abused some exploit/loophole"
@Emigna what was the 'incorrect' solution you got?
 

« first day (2435 days earlier)      last day (803 days later) »