« first day (3531 days earlier)      last day (1410 days later) » 
00:00 - 18:0018:00 - 23:00

user13682510
12:12 AM
@Pax Hi!
 
user11006952
@username Hello!
 
user13682510
Are you a python fan like me?
 
1:12 AM
@wim I was really excited about that until the issues pages started leaning towards using MSIX as the main packaging format (even to the point of not supporting .exe which feels like just reinventing the current tool).
Either way - those screenshots (of the Powershell Console) rank as the worst thing I've ever tried to read as a colorblind person in a long time ;P ;)
 
1:27 AM
Cbg...
How did he come up with the answer? I am struggling to build a connection between the question and the answer.
1
A: Set of items based on a list of tuples

zenalcsomeList = [('x', 1), ('y', 2), ('x', 3)] s = set() for item in someList: if not any(item[0] in element for element in s): s.add(item) Did you mean something like this?

 
1:44 AM
You wrote the question, you accepted the answer -> why are you asking us why you would connect one to the other?
if you don't understand the answer: add a comment to it asking for a more detailed explanation
 
 
2 hours later…
user13682510
3:51 AM
cbg
 
4:31 AM
cbg
@Naz I usually use pipe instead of slash for sed ; first char after s will be used as the separator.
 
5:32 AM
offtopic HNQ: Quarantine is the mother of invention Bricks.SE: If I were to make a LEGO fan how would I make it blow air on me?
 
@smci That Q&A is pretty ridiculous. Q: How do I build a fan with LEGOs? A: Buy a fan motor. And then... maybe stick it next to some LEGOs.
 
@CodyGray Post a better answer then...
 
@smci Well, it's a dumb question. (Gasp!)
 
@CodyGray I don't think we're allowed say that. But anyway I don't see it's a dumb question, you can augment Lego with non-Lego mechanical or aesthetic parts, to get superb results. As such I think it's potentially a neat question. (whereas if the thing has to be 100% purely official Lego, then yeah it might be limiting...)
 
If you augment it with non-Lego functional parts, then you haven't really built a Lego thingadongdong, have you?
If so, it seems to really open up the floodgates to the point where LEGO has almost no meaning.
 
5:42 AM
@CodyGray Is this the Lego purple-pill....?
 
The one that treats heartburn? Or the one Neo forgot to ask about?
 
6:44 AM
Mar 26 at 20:50, by smci
@ParitoshSingh I recently learned the term 'purplepilled'
 
7:05 AM
cbg. How I do print the following string displaying the Unicode literals as Unicode literals? (This seems to be unicode-escaped. It came from a regex inside a spacy tokenizer)
>>> print('[\\u00A6\\u00A9\\u00AE\\u00B0]'.encode('utf-8'))
b'[\\u00A6\\u00A9\\u00AE\\u00B0]'
(This is a snippet, the actual regex is 2408 chars long)
 
b'\\u00A6'.decode('unicode-escape') maybe
 
7:22 AM
@Aran-Fey bytes(s, 'ascii').decode('unicode-escape') . Because the input regex was a string already. Awesome, thanks
 
wow, that really only supports ascii. Why the heck is that even implemented as an encoding and not as a text-transform like rot-13 is
 
@Aran-Fey What only supports ascii?
 
7:37 AM
the unicode-escape encoding
 
Right. So anyway my final expression is:
[bytes(s, 'ascii', errors='replace').decode('unicode-escape') for s in sym.Defaults.infixes]
 
Wait, are you going to use those strings as regexes?
If so, errors='replace' is not a good idea
 
Yes I just independently found that bytes(..., errors='ignore') is needed to avoid mangling it.
But like you were saying, why does unicode-escape not allow direct decoding from encodings like utf8? That's pretty crufty.
 
I have no idea. Must've been written by the same guy who made binascii.hexlify return bytes
 
8:31 AM
Hi guys, I'm a bit confused about deploying flask. In the doc: flask.palletsprojects.com/en/1.1.x/tutorial/deploy it says in the second step run python setup.py bdist_wheel. But where do I get setup.py? Do I need to write it myself?
 
Yes. You can also consider writing a pyproject.toml file instead, and then use flit or poetry to create the wheel
 
8:59 AM
is there a python function that tells me how long it took to execute something ?
 
@Amundsen it depends exactly what you're after. There is cProfile, line_profiler or timeit to name a few
 
9:28 AM
@Amundsen To measure the progress of time without benchmarking/profiling, time is adequate. Usually, one takes the difference of time.perf_counter() before and after executing the code of interest.
 
9:56 AM
the logo of requests is so cool
 
10:47 AM
@Hakaishin it represents what it does really well
 
Sam
Hey guys
I know its possible because ive done it again but I totally forgot
How do you put a function as a key in a dict again?
value*
 
Just like putting anything else there
 
Sam
What do you mean?
 
def foo():
    pass
dct = {'foo': foo}
 
Sam
isn't inline possible? Like this:
tools = {
	CheckIfAddr(arg) : {
		try:
			socket.inet_aton(addr)
			return True
		except socket.error:
			return False
	}
}
 
10:55 AM
you mean a lambda?
 
with try/except: no
 
Sam
Hmm I see
 
Define a proper function. It will be readable.
 
Sam
Its not really important, I just do this because it makes my code clean, can't focus on my code anymore because its such a mess
Yes, classes are an option
Oh im so sorry, I just remember, it was javascript, not python where I used that
 
there's a good chance that putting everything into a single dict literal will not make your code more readable
 
10:57 AM
putting functions in dicts is usually weird unless it's a dispatch dict
@Sam :|
 
Sam
Yeah you are right but I can at least minify my code
 
@Sam that's not a thing in python
 
Sam
Sublime text
So I can hide code I dont need to work on anymore
But anyway im sorry for wasting your time have an excellent noon yall
 
Uh
You too
 
ugh, I know why I don't like js
 
11:36 AM
I have a design question, if I have a function that returns None for 2 reasons, how can I also communicate additional context so that a function using that function can act differently on both cases where it gets None?
 
return a second thing. return None, info
 
is there a way to make that backward compatible? because I'd still like to do if not function() like it currently happens
plus then there would need to be an info at all return Nones I guess, and the normal return type is a string so a tuple might make handling it a bit wack
 
If such a small change breaks stuff, the design should be reconsidered
 
Is the function's return value a kind of error/success code? Where a falsy value means "an error happened" and a truthy value means "success"?
 
nope, it's like data if data found otherwise None, but None can happen in two cases. One where we can do something about it and one where we can't. So in the function I call this data, I'd like to do something about it only in the case we can, but I'm not sure how to do it while also maintaining compatibility
The only way I can see is copying the code we use to determine if we can do something about it in a separate function and calling it in both places but that sounds kind of gross if you ask me because redundancy
 
11:51 AM
How rare is it that data is not found? Is it exceptional?
(Technically you could return a falsey instance of a custom class but that sounds terrible)
 
Yeah, the best way to communicate the reason for failure is to throw an exception.
 
not really, it depends on the input but decently possible no data will be found. Definitely not an exception
hmm, that sounds good because then I can customize the response text a bit but backward compatibility would go bad. Because right now if some other library uses that function they probably do it like if not function too and I don't think they'd care about the reason
 
That's fine, no data is no data
 
I guess my problem is that I want to make it independent enough so easier to use externally but also integrated enough into my own application that it's elegantly done
 
If you need backwards compat, you can add an optional parameter. Like raise_exc=False
 
12:03 PM
that sounds good and probably what I'll end up doing but I did something similar with the second function (make_issue) so I'm wondering how deep does this rabbit hole go
 
Off-topic: linux permissions suck. I'm writing a script that needs to run as root because it installs some packages, but then at some point I need to install something with makepkg, which refuses to run as root. So I wrap it in a su my_user_name call and it runs, until it realizes that it needs to install some dependencies, at which point it asks for root permissions. I can't even.
 
@Aran-Fey yeah
 
@AndrasDeak I thought of that too, then I wrote the design is bad, if my thoughts go down this route :P
 
I've seen some system on a cluster that fine-tunes permissions by user, but no idea how feasible that is for your own computer
 
btw side note WSL is so awesome
 
12:06 PM
@aadibajpai truly
 
@Aran-Fey the system I meantioned used filesystem ACL
Wow, I butchered that word
 
I'll give that a read, thanks
I asked my brother if he had an idea and he told me to run the script without root permissions, run all commands that need root permissions with sudo, and have a background thread that runs sudo every 5 minutes so the grace period where it doesn't ask for your password again doesn't expire -.-'
 
Lol
 
wow, that sounds sad
 
12:24 PM
Can anybody tell that what wrong with this code as i showing only first 2nd row output
import openpyxl
file = openpyxl.load_workbook("C:\\Users\\ysatish\\Documents\\LoginData.xlsx")
sheet = file.active
Dict = {}
print(sheet.max_row)
print(sheet.max_column)

class Excl:

    @staticmethod
    def testCase():

        for i in range(1, sheet.max_row + 1):
            for j in range(1, sheet.max_column + 1):
                Dict[sheet.cell(row=1, column=j).value] = sheet.cell(row=i, column=j).value
        return [Dict]


print(Excl.testCase())
 
@Aran-Fey unix.stackexchange.com/a/115427/416002 and comments seem relevant
@SatishYadav row=1 in Dict[sheet.cell(row=1, column=j).value]?
I don't know what it should be doing, so I can only point at things
 
Sir its key name
I am receiving only one one o/p in this format , But i want all the value
[{'Email': 'satishyadav15@gmail.com', 'Password': 93807965174, 'Testcases': 'LoginWithoutEmail'}]
 
@Aran-Fey I'm seeing some forum talk about su-ing to "nobody" for it:
su nobody -c "trizen -S  some-package --noinstall"
cd /.cache/trizen/some-package && makepkg -i
source: bbs.archlinux.org/viewtopic.php?id=233356 - so is makepkg running something that asks to be root? Or it's just another thing in your script?
 
@SatishYadav please don't ask for help here with fresh questions on the main site as per our rules sopython.com/chatroom
 
@AndrasDeak I don't see why anyone would go to the trouble of pinging sudo every couple minutes tbh. At that point, why not just ask the user to input their password so you can make use of it whenever you need it?
@AaronHall makepkg explicitly refuses to run as root. But it launches pacman as root if it needs to install dependencies for the package it's building/installing
 
12:34 PM
@Aran-Fey note unix.stackexchange.com/questions/115276/… for your case. Sudo outside + unsudo makepkg
 
Oh, the script itself is run with sudo. That's a detail I missed. Hmmm
 
the comment offers an alternative in which case yes
 
@Aran-Fey apparently not the makepkg script, but the one you're writing?
 
I will keep in mind further will you sort out code for now
 
@AaronHall Yes, the user would have to run my script with sudo
 
12:39 PM
right, can you ensure the deps are installed prior to su-ing to another user and running makepkg? Would that work?
 
@SatishYadav no
 
> These dependencies must be available in the configured repositories; see pacman#Repositories and mirrors for details. Alternatively, one can manually install dependencies prior to building (pacman -S --asdeps dep1 dep2).
 
@AaronHall I'm thinking about that. I see two problems: 1) I don't know how to obtain a list of (build-time + run-time) dependencies and 2) If I explicitly install dependencies beforehand, they'll be marked as "installed by user" rather than "installed as dependency"
I can possibly run makepkg only to build the package and then manually install it with pacman, but that'll only work if I don't need to install any build-time dependencies
oh, neat, that --asdeps flag solves issue #2
 
In the past on Ubuntu I've explicitly installed deps until it works, then I have a canonical list of deps for the install. Also on NixOS once, much less of an issue there...
Actually, that's how I build up my shell.nix and default.nix files too...
 
Hmm, apparently the dependencies are just bash variables in the PKGBUILD file. Extracting those shouldn't be too difficult
 
12:53 PM
The big unsolved problem of package management is most packages don't provide a comprehensive list of all of their immediate requirements and have little knowledge of what those requirements require. NixOS empirically solves this somewhat on the builder/user side (ostensibly via trial and error).
> If required dependencies are missing, makepkg will issue a warning before failing. To build the package and install needed dependencies, add the flag -s/--syncdeps:

$ makepkg --syncdeps
 
wait, it doesn't install those per default? O.o
 
I wonder why it presumes you can install requirements with it if it can't use root?
 
IIRC it asks you for your password like yaourt / yay
 
chroot perhaps?
 
Yup, it launches sudo pacman to install dependencies. So you need to input your password
My problem is that I already entered my password when I ran my script as root and I refuse to input it a 2nd time. That's why I'm here spending an hour figuring out a workaround. Totally worth it, I know
 
12:58 PM
@Aran-Fey No, cause it's primary job is to just build the package.
 
Ok, but it's weird that the -i/--install flag doesn't install dependencies per default
 
Do you know empirically that calling $ sudo sh mylongrunningscript.sh will require a password again? I'm checking in bash but it's going to take ~ five minutes... :P
 
I'm not sure how the sudo timeout works while a command is still running
 
$ cat demo.sh
sleep 310
apt update
 
The thread I linked suggests that it doesn't time out within a script if I understood correctly
 
1:12 PM
I'm running it with $ sudo sh demo.sh
makes tea
 
my progress is also halted because I'm waiting for pacman to install updates. *takes nap*
 
oh btw I realized the only place we're using that function is in our own discord bot, and we're planning to do an async rewrite for that so I guess I don't have to worry about backward compatibility since it's not aimed at outside use anyway.
falsey Exception it is
 
@aadibajpai falsey Exception was not an option I think
 
xD
 
@Aran-Fey my script finished - looks to me like this shouldn't be a problem.
 
1:21 PM
@AndrasDeak well, legit exception then
 
Thanks, I'll go for that if my attempt to extract the dependencies from the PKGBUILD goes wrong
 
but I want to have some switch inside it so the other function can act accordingly
other than making two exceptions lol
I'm not sure if that is possible, though 🤔
 
@Aran-Fey I would think the less inspection you do the better.
 
is it possible to set an attribute inside the exception and then access it from the function? I've generally only done except Exception as e: print(e) so a bit unsure on that
 
@AaronHall Generally I'd agree, but considering that the user of the script is me, I value user-friendliness above all else :P
@aadibajpai Sure, exceptions are objects and can have attributes just like everything else
 
1:28 PM
awesome, I'll just do that then and set an attribute if we can't do anything about it then use that
also I always thought all those design philosophy articles in products are pretentious but now it feels having some design priorities makes sense
 
Found some code in dire need of refactoring today. Not sure which I dread more: discovering the intern wrote it and I need to Educate him, or discovering that I wrote it and need to seek Education
5
Lemme just replace the blame tool with print("Probably the guy that quit last year"), killing two birds with one stone
 
@Kevin Chat gold
 
@aadibajpai that's what I had in mind for what it's worth
Maybe two different subclasses of DataNotFound
 
@AndrasDeak my main contention with that is too much boilerplate code to just add some extra info to the same behaviour (return None)
is there something wrong with the attribute thing I was thinking of trying out?
other than that not being standard practice (I haven't seen it anywhere)
 
1:44 PM
@aadibajpai other than that probably not
You could use the exception message but that sounds equally hacky
 
@AaronHall I'd rather not temporarily (or permanently) reconfigure sudo to run pacman without a password
 
@AndrasDeak yeah, tbh return None, info didn't sound too bad except in the case where there'd be no info so any unpacking would totally bork
if only a, b = None assigned None to both 🤔
 
Does somebody know a good way to programmaticaly write to a config file? Compatible with ConfigArgParse, instead of having to manually shuster something together
 
2:00 PM
Hacky yet concise and possibly backwards-compatible way of distinguishing Nones: save the reason the function returned None as global state. Maybe an attribute of the function object.
As usual, the advice of "if you're about to create global state, think very very hard about whether there's a better way" applies
 
But the thread safety! :P
 
def frobnicate(x):
    if x < 10:
        frobnicate.reason = "too low."
        return None
    elif x > 20:
        frobnicate.reason = "too high."
        return None
    else:
        return x * 2

result = frobnicate(int(input("Enter an integer. ")))
if result is None:
    print("Your input was rejected. Reason:", frobnicate.reason)
else:
    print(f"The result was {result}.")
Maybe do a frobnicate.reason = None in the third condition, in order to guarantee the invariant that the reason always corresponds to the last executed frobnicate call.
This is basically what Windows does with GetLastError. It's also the reason you occasionally see error messages in Windows like "error: success". AFAIK the function is thread-safe, but it's still possible for the application developer to make a logic error and call the function after the state has been blasted away by another system call.
e.g. consider the pseudocode:
x = win32.frobnicate_handle(handle)
if (x != 0): #error!
    win32.display_message("an error occurred. Details:")
    details = win32.GetLastError()
    win32.display_message(details)
if all win32 methods change the state of the last recorded error, then this will display "Details:" followed by "the last function executed successfully". This is true, because the first display_message call did execute successfully. It's not Windows' fault that you can't get frobnicate's details anymore.
 
2:22 PM
Problem solved with 60 lines of code, which is roughly 59 lines too many. Now, where did I leave off...? Oh right, I wanted to install python3.5.
 
@Kevin we have threading.local and contextvars these days, you know...
goes back to punching holes in the firewall
 
I don't know what either of those are :^)
Time to learn me a thing(s)
I'm back. threading.local is simple enough, and useful. contextvars is... interesting. I can't evaluate its usefulness because all concepts related to async slide out of my brain without leaving a trace behind.
I get the feeling that it would be good at protecting you from shooting yourself in both feet in an indeterminate order. I'm all for that.
 
if you can see past the convoluted API, contextvars has its uses. Works also with non-async, if you apply the context manually.
 
"Context managers that have state should use Context Variables instead of threading.local() to prevent their state from bleeding to other code unexpectedly, when used in concurrent code." I'm not sure I understand this advice. If my code doesn't use async, but it is used in async code, can it still cause state to bleed? I'm struggling to imagine a scenario where that would be the case.
 
2:39 PM
Yes, a context manager used inside a generator or coroutine may be unexpectedly concurrent.
 
hmm
 
any code inside a generator can be concurrent, no? What's so special about context managers?
 
As soon as the generator/coroutine yields, the context manager is still entered but other code can run.
It's a mess.
 
I'm guessing they're singling out context managers, not because they're the only code that could bleed state, but because they're the kind of code that is most likely to bleed state in practical scenarios
 
@Aran-Fey Mostly that people are used to treating __enter__+__exit__ as one thing called in a specific sequence. They're not.
You have to manually lug state from __enter__ to __exit__ (via self, usually) and that often makes some assumptions about some other things not happening in-between.
If you've ever seen me ranting that various common things are actually hidden concurrency, that's one of the frustrating cases. If you're unlucky, you end up having generator, coroutine, iteration and context manager concurrency wrapped around each other.
Too bad the context manager protocol is not made for concurrency. :/
 
2:46 PM
I don't think I've ever tripped over this before because I tend to instantiate my context managers inside the with statement itself
 
like when using a Lock, you mean? :P
 
#danger!
x = MyCoolContextManager()
with x as y:
    with x as z:
        whatever()

#safe?
with MyCoolContextManager() as a:
    with MyCoolContextManager() as b:
        whatever()
 
The second one is not concurrency safe if you expect to manage some unique resource via it. For example, redirecting stdout.
 
or a database thing perhaps?
 
Yeah
That's the thing, the CM protocol works nicely when concurrency isn't a concern anyways. When it is, it silently let's you think it works nicely.
 
2:51 PM
It's a fairly thin layer of syntax sugar, right? So you can't expect too much magic.
 
how to recognize digits(0-9) in binary matrix? ofc without using any external modules. Since this technology is long gone, it is very hard to find a non-book resource.
 
Do you mean recognition of digits that are handwritten or otherwise variable? Or digits that are always the same representation in the matrix?
 
I tried something like taking three vertical strip(front, middle and rear) of the matrix and analysing the relative "masses" of 1's over the whole matrix, and center of "masses" but it is not that promising.
@PaulMcG Not handwritten, a particular font: OCRA
 
class NoisyCtx:
    def __init__(self, name): self.name = name
    def __enter__(self): print(f"Entering context {self.name}.")
    def __exit__(self, *args): print(f"Exiting context {self.name}.")

def f():
    with NoisyCtx("B"):
        yield

with NoisyCtx("A"):
    gen = f()
    next(gen)
list(gen)

#output:
#Entering context A.
#Entering context B.
#Exiting context A.
#Exiting context B.
 
@AndrasDeak It would help if there were a dedicated "create new context" method, similar to __iter__. That would allow having a separate object for each __enter__+__exit__ pair. Currently, you have to emulate your own threaded stack in the context manager itself to match the right __enter__ and __exit__ calls.
 
2:58 PM
Hmm, it did not occur to me that it was possible for multiple __exit__s to execute in any order other than "the reverse of the order that the __enters__ executed in"
 
@iaeliyen " ofc without using any external modules."
 
what do you mean?
 
That's the opposite of "ofc"
 
Sorry(by the way from ofc I mean ofcourse), I ain't following you there.
 
@iaeliyen Accounting for rotation? Translation? Smudging?
 
3:00 PM
Anti-aliasing?
OK, binary matrix...
 
@Kevin Welcome to the observation deck! The abyss is right ahead.
 
@PaulMcG 1)there are not rotated 2)what do you mean by translated here? 3) a little, perhaps negligible.
 
Since async code is basically just the thing you did manually, it is a lot more likely to trigger there.
 
"Translation" as in "shifted up by 1 pixel" or "shifted right by 1 pixel"
 
@iaeliyen When you say "binary matrix", you mean a black-and-white image, right?
 
3:04 PM
 
I took care of that my cropping the matrix(removed 0ed rows and columns)
 
If you have a fixed array size, and 10 known patterns to match for, pre-calculate the patterns and then match them against your input array.
 
@MisterMiyagi No, a matrix consisting of 0s and 1s, yes you can an image.
 
Maybe tally the errors for each pattern, and then pick the one with the fewest errors.
 
@iaeliyen Was that a "No" or a "yes"? oO
 
3:05 PM
Matrix size is not fixed.
 
It may have been more expedient to describe the input as "a black and white image" rather than "a matrix" if the former is what you have
 
python 3.8: The version where typing forgot the difference between types and values and added typing.Literal
 
@Aran-Fey If you call it "dependent typing", it's more suave.
 
@Kevin risks confusion with greyscale
 
Brute force: pre-calculate 10 array sizes and match all 100 patterns. calling patent office
 
3:07 PM
It's probably also what most people unknowingly mean when they say dynamic typing is more powerful than static typing.
 
@PaulMcG I guess you didn't notice that matrix size is not fixed.
 
I wonder if there are any type checkers and/or static analysis tools that accept open("data.txt", "r") but reject mode = "r"; open("data.txt", mode)
"Sorry, it has to be a literal"
 
I was talking about different sizes.
That's what I meant by "pre-calculate 10 array sizes". I guess I should have been clearer - "10 different array sizes"
 
A Literal does not literally mean a literal.
 
I didn't get that.Can you reword that please?
 
3:10 PM
0-9 for a 6x8 matrix, 0-9 for a 10x18 matrix, 0-9 for a 20x30 matrix, etc.
 
That's not possible, I don't even know the ranges of size.
I have to do that for every possible n x m matrix(perhaps m = f(n))
 
Maybe you could figure out a way to scale down a large size to a known smaller size. That is an already-solved problem, I am sure.
 
@iaeliyen sounds like you have to research this more
 
Folks, I'm not quite following the problem here. the linked font looks extremely suited to just inspecting certain regions.
 
@PaulMcG yeah, I thought of that but I cannot figure out the appropriate operation. I was just thinking how people in 70s/80s were doing that.
 
3:13 PM
Find the bounding box (i.e. crop it), then you can directly check which of the edges are set.
 
@MisterMiyagi as designed to be? :P
 
@MisterMiyagi I'm interpreting the problem as "How should I write an algorithm to recognize OCR-A? I could just put something together that inspects certain regions that look like they would be easily distinguished. But is there a more standardized approach? A list of the objectively most distinguishable regions, for instance?"
 
@MisterMiyagi I have cropped and bounded the individual digits(that's why I was calling matrix, for example: if I have a matrix A, and If I print that I can see only one number, with no extra "outer" space)
 
If there is an ISO standard for displaying OCR-A, maybe there's an ISO standard for reading it???
 
@AndrasDeak I'm not used to these things anymore. Feels like a shock that some data is meant to be parsed without throwing more than a Gameboy at it.
 
3:16 PM
I've tried searching over internet(for reading, couldn't find any good non-book resource)
They all just point to tesseract.
 
one million demerits to Google, which takes the query "ocr-A" recognition and returns results that have the word "OCR" followed by a space followed by the word "a"
As you can imagine, there are a lot of irrelevant hits
recogniform.com/ocra.htm is only $2000, a bargain :>
 
That's 2.000, 00. No idea why those chaps have placed so many zeros after .
 
I think you're pulling my leg, but just in case. In many countries, "," is the thousands separator, and "." is the decimal point.
Oops, I misread. Well, my point is the same. Not all countries use that convention. Apparently these guys use the reverse.
 
A little more than $2000, that's the price in euro
 
@Kevin that's us too
 
3:26 PM
When it comes to exchange rates, my standards are astronomical. In other words, I'm happy as long as I'm in the right order of magnitude
One Euro equals one USD, one yen equals one penny. Lalala I'm not listening to your well actuallies
 
Although 0.1 HUF are worth less than a thimble of dirt (sans thimble) so you rarely see both in a price
 
Paradoxically, once you get enough dirt, it's worth negative money, because you have to pay somebody to get rid of it for you
Time to do some arbitration on the thimble-of-dirt/great-big-pile-of-dirt/HUF exchange market
 
I wonder how uncommon such cases are: "Hello, I have seen that stuff on your website and its price is $2 dollar, do you accept payment over paypal?"
 
I reckon it's only slightly less common than "if the barcode doesn't scan, that means it's free, right?"
 
@Kevin most of Europe uses the reverse punctuation of the US from what I understand
 
3:32 PM
aren't those things "really" free?
 
Nope :-)
 
really = we don't have to "directly" pay them for that thing?
 
If the barcode doesn't scan, you don't get the thing for free. The cashier calls a coworker for a price check and charges you the real amount.
 
0_0
 
@Code-Apprentice True. Blame my anglo-centric worldview. According to the page Andras linked, the US, England, and Australia all use the same system.
 
3:34 PM
1'234'567,89 Switzerland (handwriting)
 
@Kevin and I think basically everyone else uses the opposite system.
but yah, I get the anglo-centric worldview. I get caught up in mine too often.
and none of my work projects require internationalization, translations, localization, etc.
 
I'm glad I decided to weasel out and write "many countries" instead of "most countries"
 
heh
@iaeliyen do you often type it that way, too?
Talking about number formats:
 
No.(that's horrible)
 
3:37 PM
@Code-Apprentice hardly captures the diversity. :/
 
Thanks @MisterMiyagi @Aran-Fey @Kevin for the suggestions! And yes, Leetcode allows having auxiliary functions / methods.
Cabbage
 
👍
 
why the soft dev would use commas?
 
@iaeliyen "who forgot about floats" and check the digits
I took it as a reference to the imprecision of floating point numbers.
and it's probably output from a program...programmers don't write numbers by hand
 
@iaeliyen Maybe the soft dev is a frontend engineer
Who needs to display the number to users
 
3:41 PM
imagine an accountant (who regularly visited different countries and usually get hold of the convention) writing: 1'234,453.232,232'21
 
Huh, I guess Mr XKCD edited the comic since I first saw it. The "scientist trying to avoid rounding up" value was originally 2.5997x10^13. He forgot to repeat the second "25"
25259974097204 is exactly representable as a Python float, but then again, a Python float is actually a double*. Are there any modern languages that use single precision floats?
(*results may vary by implementation)
 
Neat
Bonus challenge: find a language where the term "float", without any bit- number clarification, refers to single precision floats; and/or the literal 0.5 resolves to a single precision float instead of a double
 
@Kevin he has
 
Julia uses "float32" and "float64" to distinguish the two types, with 0.5 resolving to a float64, and 0.5f0 resolving to a float32
 
3:51 PM
@Kevin C?
@Kevin in fortran 0.5 is probably a single. Don't know about C
 
I award you 95% credit because according to en.wikipedia.org/wiki/C_data_types, the "Actual properties [of float are] unspecified (except minimum limits), however on most systems this is the IEEE 754 single-precision binary floating-point format "
 
That's as specific as C gets
 
On KevinOS, the C compiler uses octuple precision floats for float, out of spite
 
In C and C++, float is single precision.
 
Usually ;-)
 
3:54 PM
Unless your Kevin
 
Here we go, we can do a round trip through single precision by using struct.
>>> struct.unpack("f", struct.pack("f", 25259974097204))[0]
25259973541888.0
 
@Kevin Python3 on Windows?
or is that 64bit by default, now?
 
64 bit by default, as far as I can tell.
Even for my install which claims to be 32 bit despite my best efforts
 
what a letdown
@Kevin Challenge: It is easy to compile Lua so that it uses another type for numbers, such as longs or single-precision floats. This is particularly useful for platforms without hardware support for floating point. See the distribution for detailed instructions.
 
A la carte typing, interesting.
"learn lua" is near the top of my ever-expanding todo list, because I want to impress my meatspace friends* by modding Tabletop Simulator. Lua seems quite user-friendly, but at the same time it doesn't have any features that really engage my interest.
(*but come to think of it, we meet exclusively online these days, so I guess that term isn't accurate any more)
 
4:10 PM
Lua is really small, so you can learn it quickly.
 
My biggest roadblock so far was that lua's dir() equivalent doesn't work on C-defined types
It basically returns a shrug
That wouldn't be a problem if Tabletop Simulator had better documentation for its API ಠ_ಠ
 
Hello,
I am trying to extract text from documents using Apche tika, so i have installed apache tika using pip install tika-app in a venv and when running this :

tika_client = TikaApp(file_jar="/opt/tika/tika-app-1.18.jar")

the following error occured :

Tika app jar not valid
NoneType: None
---------------------------------------------------------------------------
TikaAppJarError Traceback (most recent call last)
<ipython-input-2-b2985203280b> in <module>
----> 1 tika_client = TikaApp(file_jar="/opt/tika/tika-app-1.18.jar")
 
I don't know anything about those libraries in particular, but it seems a little suspicious to me that the jar's version doesn't match up with the tika-app version
I don't suppose you have a tika-app-1.5.0.jar lying around
 
Man, I hate error message that are like "<thing you did> not valid". O rly?
 
Only slightly better than "error: success"
 
4:19 PM
What if one day you get an error message like AttributeError("I just couldn't be bothered looking everywhere, dude")
 
One must not forget INTERCAL's Error: program is insufficiently polite
 
@MisterMiyagi Only when it lies. It's great when you look at it and realize it's not actually valid, or even better when you're writing a script and it tells you exactly what line went wrong.
 
@Kevin is it expecting that jar file path in the system
 
user13682510
cbg
 
user13682510
@AaronHall It actually lies?
 
4:34 PM
@iaeliyen Worthy of Priti Patel [warning: dubious cookie settings if left unaltered]
 
@joshua I imagine the context is an interactive environment. It doesn't provide much information except the line that went wrong. It lacks specificity, so it doesn't help much if you're new to the environment, presume it is correct, but don't know specifically what did that's wrong - so it could certainly be better. But I've seen those kinds of errors where what you did is syntactically valid or even exemplary but there was another error that was not propagated. A lie.
 
user13682510
oh
 
This is one of the reasons we're nitpicky in Python about how we reraise exceptions.
 
stackoverflow.com/questions/62402273/python-new-peg-parser misunderstood new PEG parser, now asking for recommendations
 
4:59 PM
@AaronHall Well, an error being thrown already tells me it's not valid. I'd much rather know why it's not valid.
@PaulMcG FWIW, the PEG grammar they show in the PEP is nice. Been thinking about bugging you with it... ^^
 
@holdenweb no idea what are you talking about.
 
Probably not worth explaining.
 
@MisterMiyagi I actually got to trade emails with GvR about it when it was in development! It uses packratting to auto-fix left-recursion, which would be nice to add to pyparsing.
 
@MisterMiyagi you are right.
 
5:16 PM
@AaronHall Sorry, I'm just through a few weeks of deploying a new science middleware at our site. I might be overly sensitive to such error messages. ^^
 
I would like to know more about it. I've been using NixOS. If the software is already set up, the installation is trivial.
 
anyone knows about RPA?
 
@AaronHall Had to deploy a new frontend for our batch cluster. Domain specific software, and so far used practically only in the US science grid, not the EU one. So lots of pieces that weren't documented; since we're one of the biggest sites, there was practically no-one to ask "how do you guys do it at the scale?". Took me a week to find out the "functional" DSL for transforming requests was stateful... :/
 
@user2420374 too few letters without context. I know of an RPA.
@MisterMiyagi good to see Stack Overflow content being put to good use
 
@MisterMiyagi Reminds me a bit of installing Tableau's Python SDK on RHEL. They gave me a binary built on debian. It immediately failed when running their demo code. I had to use strace to prove to myself it was their fault for not giving us a RHEL compatible binary.
So they built it on CentOS and that one worked...
 
5:49 PM
A code streamer on twitch was going through the Google shell style guide the other day, I think it's pretty good: google.github.io/styleguide/shellguide.html
 
@AndrasDeak there is actually a lot of Python in that, and it's one of the main applications I have for PyParsing.
We've basically rebuilt the entire DSL so that we can tests things before they hit the actual system.
 
I meant the "functional" DSL :)
 
00:00 - 18:0018:00 - 23:00

« first day (3531 days earlier)      last day (1410 days later) »