« first day (3254 days earlier)      last day (1919 days later) » 

13:00
A decade or two ago, I wondered what a solar eclipse would look like if the Moon were transparent, eg a pure quartz or diamond crystal. Unfortunately, at that thickness any real substance is fairly opaque, even discounting impurities & crystal defects. And of course the focal length would be far too short to focus on Earth, but I guess it'd still look kind of interesting, and you could use a lens on Earth to converge the image.
I calculated what refractive index it'd need to focus the sunlight on Earth during an eclipse, but it was tiny, smaller than the refractive index of air.
Assuming magically perfectly transparent materials with whatever refractive index we desire, I wonder what the outcome would be. Are we talking "frying ants with a magnifying glass" here? "Earth is reduced to a blob of liquid iron"? "it gets a little hotter but someone from the south pops up and says 'ha! you think this is hot?'"?
the focal point of an ideal lens is in thermal equilibrium with the black-body radiation of the sun, i.e. it's 5000 K hot
what-if.xkcd.com/141 indicates that you can reach millions of degrees if you focus all of the sun's light on the earth*. Focusing only the light that hits the moon would probably be several orders of magnitude smaller
5000 K sounds like the right ballpark
Randall works with "millions of degrees", but his premise is probably different
yeah, he computes something else
(*if you had a magic lens that could collect 100% of the sun's light, but I think that's impossible even with the magic materials available in the other hypothetical)
13:10
I'd have to think a lot about how the two scenarios differ
what-if.xkcd.com/145 discusses the lens thing in more depth
people do seem to mention the 5800 K theoretical limit
> First, here's a general rule of thumb: You can't use lenses and mirrors to make something hotter than the surface of the light source itself. In other words, you can't use sunlight to make something hotter than the surface of the Sun.
yeah, OK, so we're all on the same page
Hello guys
@AndrasDeak hm, no not quite. I meant in the sense that i can no longer type python 2 syntax in python 3. in JS, i can still use "var" to declare a variable, and it wont complain. typescript i don't consider as JS, and i hear its actually pretty good.
some of the illustrations there are quite relevant for the Moon Lens, and the impossible scenarios plotted are how the former What-If example worked
13:13
However, can't really disagree with anything you've said about legacy code, and needing to support things that use old stuff on the web
I suspect that turning the moon into a big lens is effectively the same as putting a big lens between the moon and the Earth, in which case the problem has the same answer as the linked what-if
@ParitoshSingh I am mildly surprised that no-one has written a Python2 import hook for Python3 yet
shouldn't be much of a problem to apply 2to3 and some compatibility library on the go
Currently trying to figure out how many seconds of 100C heat a human could endure before suffering injury. My guess is "not long"
that is a good guess.
@MisterMiyagi i hope no one gets around to doing it, it's nicer when things arent fragmented
@MisterMiyagi call it necromancpy (but the p is silent)
@Kevin depends on the medium, think saunas
100 C water or metal? Not long. 100 C air? Somewhat longer.
the devil is in the detail heat transfer coefficient
13:22
If our 100C moon lens is focused on a person standing in a grassy field, then we don't have to worry about water or metal
@ParitoshSingh sometimes there is no choice. we still have some applications with Py2 dependencies that will never get updated.
@MisterMiyagi (of course the problem is that when 2 to 3 really matters you won't be able to just snap your transpiler fingers, because there are latent bugs all over the place that need to be fixed)
Wikipedia tells me that "The temperature in Finnish saunas is 60 to 100 °C" so since 100C is at the high end I'm guessing it's not a comfortable temperature for an hours-long session, even if you're the kind of person that likes saunas
@Kevin I think if you focus a 100-celsius beam on someone that's as good as metal. Technically it's probably the skin's albedo that counts, but still too direct.
True. I do not think i've really had to deal with legacy code enough in my day to day work to really think about it much, but i've read plenty of stories about legacy systems, and of how it's just too much technical debt to be able to switch, so the "solution" is to just keep piling more.
13:24
sunk cost fallacy etc.
@Kevin The forum thread for that What-If became rather heated, so to speak. ;)
I know enough about light and heat to make a lot of plausible yet wrong guesses about scenarios involving them. Not quite at the level of "can a plane on a treadmill take off?", but close
@ParitoshSingh I was rather happy with our solution of running a separate py2 interpreter that communicates with the main py3 program via meta-magic-hidden IPC. but py2 is getting so old it is a chore to maintain compatibility libraries.
@AndrasDeak in our case, it is often "there is no spec but that stinking pile of PERL-transpiled-to-Py2"
@Kevin is the treadmill moving?
@MisterMiyagi no option to find maintainable dependencies...?
wait, that's a good question. can a plane on a treadmill take off? :P
13:28
@MisterMiyagi more importantly: are the wheel brakes on?
one of the great Mythbusters investigations
I would assume the answer is yes
@MisterMiyagi I think in the typical formulation of the problem, the treadmill does move. Usually at the same speed as the plane's wheels. Example physics.stackexchange.com/questions/32269/…
I don't see why it wouldn't.
@AndrasDeak not if you are required to talk to a remote legacy system. The protocol isn't specified, it just exists as that one library.
There may be some formulations where the treadmill is not powered, but its tread is on frictionless bearings so it begins to move as soon as any force is exerted on it
13:30
@MisterMiyagi ugh
yes, science is fun
This is an infamously divisive question so I encourage all readers to not think about it too hard, or else the cognitohazard will infect your mind
I firmly believe the wheels are key
I firmly believe I'm unsure whether there is any force applied to the treadmill at all
flips coin no force applied
There is. Weight of the plane.
give or take some friction
user6568562
13:33
Cbg
Mythbusters proved that in real-life conditions the plane will take off. Unclear to me what happens in frictionless thought experiment world
@Kevin in a frictionless world there's no interaction between plane and treadmill so it's even easier
D: too late, i have already decided to think over it
the only way the treadmill would do anything if it were pulling the plane back, but it can only pull back the wheels on the plane, and those can revolve around fairly freely without pulling the actual plane backward
oh, okay good. but now that makes me wonder, did mythbusters go ahead and use a mini plane, or did they make a big treadmill
13:34
It was a little remote controlled plane, yeah
much more economically sensible, cool
@AndrasDeak I consider everything weightless at first order. unless I have to carry it upstairs.
Okay, the friction on the wheels would pull back the plane with the same force. But this force wouldn't be enough to slow down the plane, so it would only take slightly longer for the plane to take off.
@MisterMiyagi laurel
@ParitoshSingh they actually used a big plane with a makeshift "treadmill" pulled with a car youtube.com/watch?v=01Q83yxdDaI
13:36
oh! hm, i shall click that link later
and in any case the core of the problem is "if you can force the plane to be stationary with respect to the ground (and there's no wind) it won't take off"
Oh, maybe I changed channels before they got to the big plane.
user6568562
`>>> id(id(id(id(id(id(x))))))`
`140396197505776`
that specific link is pretty yammy in quality, and seems to be missing an end
user6568562
I'm in way over my head with this one; What's happening ?
13:38
@randomhopeful which part? Chat formatting or the expression?
For the former see my pinned message on the starboard, for the latter you keep grabbing ids of integers.
x is an object -> id(x) is its ID, an int -> id(id(x)) is the id of that integer, another integer -> ...
@randomhopeful the same as for id(12312412142) in isolation. just applied to an integer created by another call to id
user6568562
@AndrasDeak I noticed the code formatting mistake a bit too late; And thank you for the explanation
@MisterMiyagi nuh-huh, that's 140359072821104
but now it's 140697129613328, run away
id(x) the value returned by that itself is an object. So it will also have an id, and so on
user6568562
In hindsight, d'uhdoy
user6568562
13:40
Thank you, guys ; )
no problem
Terminology nitpick accepted
:47297547 actually...
uhm actually...? :P
The way I see it, a function call, an expression, can't really be anything else as its value. So id(x) for all intents and purposes is the object that is its value.
I'm just nitpicking about the nitpick, but I'm encouraged by Kevin's deletion
13:42
I do feel like there's a bit of semantic wiggle room at the border of Python's grammar and its data model.
(I deleted not because I decided I was wrong*, but because my nitpick was redundant after Paritosh's edit)
oh, I missed the edit, sorry
(*but I am still willing to be proven wrong, as I think it would be interesting)
I accept that id(x) as an expression can't be a type, but if someone says it is a type it's probably unambiguous.
man why are people so bad at programming
I personally also use things like "sum(arr) is an int" and so on
13:44
@Hakaishin because when people do it right it goes unnoticed
Also, we all start somewhere.
@Hakaishin I'm right here... no need to talk around me :-P
I just found an array with xyzwxyz with should be position and orientation as quaternion, making it impossible to know which xyz is which
If you ask "Is 2+2 an object?", one might reply, "no, it's an expression". But then if you ask "is 4 an object?", the answer is a little trickier, because 4 is a valid expression but it's also the printable representation of an integer object in memory
It's kind of like the difference between "Is Kevin a person? Yes, Kevin is a person" and "Is 'Kevin' a person? No 'Kevin' is a string that identifies a person"
it depends on whether you look at the source (where 2+2 is a string), the program specification (where 2+2 is an expression) or the program execution (where 2+2 is the object 4)
13:48
@Hakaishin point being that it can be both xyzw and wxyz? Nice. Although if I had to guess I'd think that the new dimension is fourth, not first...
yes probably but still it makes me have to go the where it is getting filled in an check
yup
I'm sure it's all clearly specified in the documentation :>
about that documentation....
<crying_smiley_emoji>
@MisterMiyagi Right, that's basically what I'm getting at.
13:49
@MisterMiyagi and without the cpython int interning, can we even say that 2+2 is the object 4? Or just that it's an int with value 4? :P
especially if there's nobody around to hear it fall and so on
2+2 is 4 per the might of the peephole optimiser
unless you are asking for x+2+2
For the purposes of this thought experiment, assume that 2+2 doesn't get optimized to 4 at compile time.
then it depends on whether x is laden or not
is 2+2 the same as the 2+2 in x+2+2
13:50
>>> dis.dis('x+2+2')
  1           0 LOAD_NAME                0 (x)
              2 LOAD_CONST               0 (2)
              4 BINARY_ADD
              6 LOAD_CONST               0 (2)
              8 BINARY_ADD
             10 RETURN_VALUE
>>> dis.dis('2+2+x')
  1           0 LOAD_CONST               0 (4)
              2 LOAD_NAME                0 (x)
              4 BINARY_ADD
              6 RETURN_VALUE
amazing!
@ParitoshSingh I am afraid it is not.
Oh, because x+2 can be whatever. Less amazing!
Hmm, interesting. I guess that's necessary because x's __add__ may have side effects, and it needs to trigger twice in x+2+2
If you replaced it with x+4, then it would only trigger once
@Kevin yup, or not even return an int
13:51
Good point.
a + b == b + a might be true for numbers, but it's not true for operands of arbitrary type
@ParitoshSingh If I think I need to be precise or pedantic, then I say stuff like "sum(arr) returns an int" or "sum(arr) evaluates to an int"
I do think "an expression 'is' whatever the expression evaluates to" is an internally consistent use of terminology. It's not a framing I like to use personally, though
@PM2Ring something something following sum(arr)-y execution
Nice.
"is" is already pretty semantically overloaded so I don't want to give it another job. Especially because it may convince the reader that "128*100 is 12800" implies 128*100 is 12800 is guaranteed to evaluate to True
13:59
it may make sense to think of it as a thunk which either is or will be an int
... I think 128*100 is 12800 does always evaluate to True in CPython, but that's besides the point
I wonder what they're really trying to do here
Aye, i think i wouldn't really use that when formally writing it somewhere, but i've found that to be a fairly unambiguous shorthand when "talking" code and helping with debug sessions or whatnot. I suppose it all depends on the context
@Kevin Agreed. When discussing code, it's generally wise to be mindful of such things, otherwise chaos & confusion ensue.
Aug 29 '16 at 11:41, by PM 2Ring
FWIW, the difference between a string's actual contents and its representation is an example of the use–mention distinction. Lewis Carrol has some fun with this in Through the Looking-Glass. See Haddock's Eyes
I'm pleasantly surprised that my daily raving actually had some basis in reality today
14:03
@JonClements it looks like they want either a function or some kind of property
my first thought was that this is essentially a property like behaviour as well
and then i decided that would be a pretty big hammer for such a small nail.
So then i just upvoted the convenience function comment and have decided that should be that
hm, one could probably write a trace hook for that....
@MisterMiyagi so you're saying it's async now?
@AndrasDeak actually my comparison would be quantum mechanics...
@ParitoshSingh plus more obscure as to why it's available that way to start with... if something behaved like that for getting the current time in Python I'd be quite confused for sure
14:06
I've never quite gotten why people are so obsessed about knowing which single category a thing belongs to
but sure, async probably works fine as well to confuse people!
it's fun to put things into little buckets that you can understand
And then to use the same buckets to cause chaos
I don't mind putting things into buckets, as long as they support superposition
Don't know about superposition, but some entanglement may ensue*
@PM2Ring That "poem" gave me a headache.
I feel like we read an excerpt from it in our lectures a while back. Definitely not that excerpt though.
Ok, so in Carrol's world, all strings are objects with two attributes, "name", and "called". The poems' object model can be constructed as such:
song = "A-sitting On a gate"
song.called = "Ways and Means"
song.name = "Aged Aged Man"
song.name.called = "Haddock's Eyes"
We don't know the value of any of:
song.called.name
song.called.called
song.name.name
song.name.called.name
song.name.called.called
... And an infinite number of other attribute chains.
@JonClements I smell an XY problem. And your convenience function is a good solution.
14:16
Or perhaps it's more correct to say that all objects have attributes name and called and is, since that allows us to do song = Song() which is more conceptually correct than saying that song has the type "string"
@Kevin this one i like better
@AndrasDeak actually we aren't using skype :D
@MisterMiyagi ah, but the problem is that often they will seem like belonging to a single category, then stay in that category
@Aran-Fey I never said you were ;)
but VoIP is probably also tough on linux users
I guess 28 Windows licenses is nothing compared to the time confused users could/would waste because they aren't familiar with the OS
I even had to plug in someone else's USB headset once because apparently they couldn't do that themselves
so I can only imagine how those people would react to seeing a non-Windows OS
Hmm, I can't close Visual Studio, because pressing the X button does nothing except pop up the message "Object reference not set to an instance of an object". That's fun.
And this is after I ran the installer's "Repair" action, because VS was even more broken yesterday
14:27
Visual studio: you can check out anytime you like, but you can never leave.
It'd be more fun if it opened itself in its debugger which suffered from the same problem :)
Time to uninstall and then cry about all my lost configuration settings
I just wanted to install Roslyn, how did it come to this ;_;
can't you back up your settings?
It's worth a try, thanks
14:34
@Aran-Fey wow
VS must have overheard my call to the glue factory, because its ambient weirdness has dropped to normal levels.
Honestly it wouldn't be too hard to set up some corporate linux with ugly KDE to resemble a windows. What do people even use? Office, and badly?
it's not like they'll no longer find where to fine-tune tabulator types in word...
in my place it's literally just firefox and that VoIP telephone thing
hey, at least not Internet Edgeplorer
I know right, I'm truly blessed
user6568562
14:39
I never really understood why the search files and folders feature on linux desktops is still too archaic
user6568562
At least, in the ones I used/am using
what kind of fancy features does a file search need?
user6568562
The ability to search files without going through the bash terminal, for starters
I hate Windows search very much because the default formatting of the search results is to only show the first half of the file path, e.g. "yourCoolProgram at C:\users\Kevin\Deskto..."
huh. What file browser are you using that doesn't have a search feature built in?
14:41
And there's no "open containing folder" option in the context menu as far as I can tell
user6568562
xfce
xfce is a graphical environment, like gnome
the actual program you use in it will be something else; gnome uses nautilus by default
user6568562
Yes, the terminology; So allow me to be clearer in what I am saying
but in gnome you can even press <windows> and type things and it will start searching your file system if you let it
all fancy and modern-like
judging from screenshot I've seen on the xfce home page, it looks like xfce uses nautilus as well
14:45
but xfce is the go-to barebones environment, so I wouldn't be surprised if its utilities seem "archaic"
gnome-shell is where the hip and fancy (and CPU and memory intensive) is
is it really CPU intensive? I thought those days were over
definitely hogs memory like a champ though
Yeah, mostly ram
user6568562
Yish, nevermind
Try to guess where the first and second files are located. Wrong.
14:48
@Kevin wow, that's worse than I thought
user10655999
how can we get coordinates of text in scanned image using python
Ok, there is an "open file location" context menu item. But if you click it, it will navigate away from the search results, and when you go back you'll have to start the search from scratch.
@daoootim does this help?
user6568562
@AndrasDeak Exactly; So, it doesn't index your files and you can only search through the applications installed through the 'Application Manager'
user6568562
I'm not complaining; It's just that, UX isn't a ride of fun in Linux when you're a subgenius
14:50
I still quite like Linux Mint's Cinnamon DM
My kingdom for a grep equivalent that only searches through file names
user10655999
@Aran-Fey let me check
@Kevin Can you not mimic that by doing dir /S some_dir | find "output" or something?
my windows command stuff is very rusty though - haven't done any work in one for 10+ years...
and here I was gonna buy Kevin's kingdom with a few lines of python code :/
user6568562
@Kevin Microsoft is still shoving its ugly big thumbnails
14:56
@JonClements Hmm, that's close, but the filtered output doesn't display the file path
c:\>dir output.png /s | find "output"
01/10/2017  03:50 PM            10,304 output.png
01/11/2017  11:05 AM            10,228 output.png
06/07/2019  11:29 AM            30,627 output.png
Maybe there's a flag for that in dir's options
should be?
user6568562
I don't know about win 10, but in win 7 you could display the details, like the file location, you know, the first thing you're looking for when you're searching for a file
There might be a way to do that, yeah. I wrote " the default formatting of the search results is..." because I'm holding out hope that I can apply non-default formatting and get useful results.
@Kevin mind you... it seems odd if that's the default behaviour... I mean, it probably makes sense to not display redundant information for a straight-forward dir, but when it's recursive - it's definitely going to be wanted, surely?
Whenever I make a statement of the form "Windows simply can't do <thing>", 70% of the time it turns out that <thing> is actually available but only if you go to control panel -> Administrator settings -> Advanced -> Computer options -> experimental features -> temp file 2 -> beware of leopard -> enable <thing>
I only use Windows search like once a month so I haven't yet thoroughly applied the "click every button until it works" troubleshooting process to it
Update: nevermind :>
user6568562
15:09
I love that Extra Large Icons button; Also, I see that post-2010 Office ugliness spilled over to Windows GUI
@JonClements dir does show the absolute path of each result during a recursive search, but it occurs on a separate line, so find filters it out
 Directory of c:\foo\bar\baz

01/10/2017  03:50 PM            10,304 output.png
               1 File(s)         10,304 bytes

 Directory of c:\troz\zort\narf

01/11/2017  11:05 AM            10,228 output.png
               1 File(s)         10,228 bytes
I remember when they started switching everything over to ribbons and thinking: "Why? What was wrong with the icons... why are you making this into a cartoon?"
@Kevin ahhh.... :)
@JonClements I kinda like the idea of ribbons - if only they would actually contain what I am looking for
when you were so use to icons/toolbars before, it was very much a - "why's that in that group and why is it now an extra click away?"
user6568562
I was wondering how did they manage to make the explorer tabs all black and cool just like the Start menu; I guess, they just didn't
15:14
Kevin's Law of Obscure Windows features: you can do <thing>, but it's probably buried ten option menus deep.
Kevin's Law's Corollary: if you complain publicly about the obscureness of the <thing> option, it's actually available right there in the ribbon, and you'll look silly.
I could claim that I intentionally invoked the Corollary because quickly solving the problem at the expense of looking silly is preferable to maintaining my dignity while digging through a hundred menus, but let's be honest here.
user6568562
@Kevin I think that all this overthinking is but a side-effect of too much using ribbons
There's probably a UI design lesson in here somewhere. "Just because an option is right in front of the user, doesn't mean he'll have an easy time finding it"
user6568562
Or, whitespace is pretty important for user to be able to focus
user6568562
I mean, the Extra Large Icons, Large Icons, Medium Icons has got to be some kind of a punchline
In the specific use-case of searching for image files, it's nice to have the "icons" options, since then I can see what the images actually look like while I'm searching. I don't want it to be the default presentation, but I don't mind having it in my toolbelt.
Having four separate icon options is perhaps a bit of overkill.
user6568562
15:23
Exactly, especially when they solved in Win 7 by allowing the mouse wheel to enlarge / reduce the thumbnails
Yup... Nemo does the same...
I want to find the middle permutation of a string after sorting it. For example for 'abc' answer will be 'bca'.
Here is my simple code, how I can optimize it? no idea
from itertools import permutations as perm
def middle_permutation(s):
    lst = [e for e in s]
    lst.sort()
    s = ''.join(lst)
    perms = list(perm(s))
    #for p in perms:
    #    print(''.join(p), end = " ")
    return ''.join(perms[(len(perms) // 2) - 1])
If the given input is like 'abcxg', first the string need to be sorted ('abcgx') and then the middle permutation should be found.
lst = [e for e in s] can just be lst = list(s). Or, you may as well do lst = sorted(s) while you're at it. Or, since you're just going to turn it back into a string, you may as well do s = "".join(sorted(s))
@Quark Will s ever have repeated chars?
@PM2Ring No
@Kevin Ok
15:32
But, hang on, you don't need to convert back to string, since perm will treat it the same whether it's a string or a list.
@Quark Excellent. That makes things a bit easier. There's no need to generate all permutations.
from itertools import permutations as perm
def middle_permutation(s):
    perms = list(perm(sorted(s)))
    return "".join(perms[(len(perms) // 2) - 1])
print(middle_permutation("acb"))
That's as far as I can clean it up while retaining the basic approach. If PM comes up with a way to find the middle permutation without actually calling permutations, then that's definitely preferable
The efficient way to do this is to calculate the total number of permutations, and then just generate the permutation you want from its permutation index.
[desire to know more intensifies]
There's info on Wikipedia about that. And SO answers. I may have even posted one or two myself...
user10655999
15:36
@Aran-Fey that not giving me the correct output
I think I wrote one in the distant past, but it was a bit hairy
Recursion and multiple cases abounded
@Kevin Ok
@PM2Ring Is there any function to find the permutation from index?
@Quark Yes! :)
This looks ok.
6
Q: Algorithm for finding numerical permutation given lexicographic index

Eddie DovzhikI am looking for an algorithm that given a set of numbers (for example 1 2 3) and an index (for example 2) will get me the second permutation of those numbers according to a lexicographic order. For example in this case the algorithm will return 1 3 2.

@Kevin in linux that would be find
I've got a few versions on my HD (but I'm on my phone, as usual).
15:41
@randomhopeful honestly I've never used nautilus for anything beyond copying stuff from a phone and mp3 player (because mtp is a weird protocol). If you get confortable with basic tools in a terminal you use the aforementioned find to find files and directories
The basic idea is to convert the index number to "factorial base" notation.
Some of the underlying maths was developed by mathematicians who were also into stage magic, because the magician's assistant can use permutation indices of card sequences to transmit information to the magician.
I just came up with pastebin.com/wTN0D602, which appears to be the same approach as the post PM just linked, except mine is recursive for no good reason
ugh, "confortable"
The linked approach could be made a smidgen faster by using divmod instead of separate statements for division and modulus
user6568562
@AndrasDeak I hear you for the mtp; And yes, in all honesty find and mv are blessings from heaven; I use the dekstop env basically as a container for Firefox
15:50
import math
def permutation_n(seq, idx):
    result = []
    for i in range(len(seq)):
        x = math.factorial(len(seq)-1)
        y,idx = divmod(idx, x)
        result.append(seq[y])
        del seq[y]
    return result

for i in range(6):
    print(permutation_n(["a", "b", "c"], i))
Then middle_permutation is just return permutation_n(list(sorted(s)), (math.factorial(len(s))//2)-1)
Uh, I think
@Kevin can u tell me the logic behind it?
Ah. I knew I had some permutation index stuff on SO, but Google wasn't being cooperative. See stackoverflow.com/a/28525468/4014959 for a couple of versions. It's from early 2015 though, so it's Python 2, I'm afraid.
Why x = fact(len(seq) - 1) ?
If you list all the permutations of "abcd", then it's apparent that the first character of each permutation follows a simple pattern. The first 6 permutations start with "a", the next 6 start with "b", and so on. Notice that 6 == factorial(len("abcd")-1).
user10655999
how can we get coordinates of text in scanned image using python ?
15:56
So you can determine the first character of the idx'th permutation of s by determining what "bucket" idx falls into. There are len(s) buckets, each one containing factorial(len(s)-1) items.
So you divide idx by factorial(len(seq)-1) and that tells you the index of the first character.
and it's factorial(len(s)-1) because if the first character is fixed then the remaining characters can be permuted (len(s)-1)! times
Then you delete that item from the list, since it can't appear a second time. Now you can determine the index of the second character the same way, using the remainder of the division operation as the new index. Repeat until you run out of characters.
@daoootim want to elaborate on that?
@Kevin Ok now get it :)
user10655999
@AndrasDeak tesseract.exe makebox it gives single char coordinates
user10655999
16:01
I need boundingbox
@daoootim did you also read the other answer that suggests there's a way to get every character?
I just noticed that the last code block I linked in chat.stackoverflow.com/transcript/message/47298894#47298894 is for a repaired version of the OP"s algorithm. Ignore that. :) But the Permuter class should give you the general idea.
user10655999
@AndrasDeak yes but command is not working for scanned image
Here is another cool solution for the middle permutation problem:
def middle_permutation(string):
    s = sorted(string)
    if len(s) % 2 ==0:
        return s.pop(len(s)//2-1) +''.join(s[::-1])
    else:
        return s.pop(len(s)//2) + middle_permutation(s)
16:08
@Quark You can also do the reverse process: convert a permutation to its permutation index. I'll let you think about that one. ;)
@PM2Ring Ok I'll think abt that
16:28
Ah, I thought the math could be simplified if you're only interested in finding the middle permutation. I'm surprised that it boils down to only two cases, though.
@Kevin Sort of 2 cases, since it recurses.
True.
Hmm, the bottom call to middle_permutation(s) is always with a string of even length, right? So it only recurses once at most.
Ah, right.
So I think you could actually write the function as s = sorted(string); return s.pop(len(s)//2-1) +''.join(s[::-1]) if len(s) % 2 ==0 else s.pop(len(s)//2) + s.pop(len(s)//2-1) +''.join(s[::-1]) if you were hell-bent on reducing line count
any recommendations on how to use flask or Django in production? really confused with the info online - was looking at CGI and IIS but then read CGI was not a good choice and also posts that suggestd NGINIX said it was free but doesn't look like it is
16:38
Factorial base is also interesting for representing rational numbers. You end up with series like a/2! + b/3! + c/4! + ... + k/n! + ... with integer k < n. Every rational terminates in a finite number of factorial base digits. And lots of stuff related to powers of e has nice patterns in factorial base. In fact, it's a really fast way to calculate lots of digits of e.
On the topic of bases, it bothers me that (AFAICT) there isn't a simple bijection between natural numbers and ascii strings. You can't just do "interpret the string as a number in base 256", because then "\0\0\0a" and "a" both map to 97
You can define a total ordering of all ASCII strings, putting smaller strings before larger strings, and sorting lexicographically among same-sized strings, but I wouldn't call that "simple"
OP is high :P
0
Q: Random Choice loop through groups of samples

SpringI have a df containing column of "Income_group", "Rate", and "Probability", respectively. I need randomly select rate for each income group. How can I write a Loop function and print out the result for each income bin. The pandas data frame table looks like this: import pandas as pd df={'Inco...

@erotavlas correct on the cgi. what operating system are you using
our server is Windows
Speaking for flask, you can go through this link for guidelines. flask.palletsprojects.com/en/1.1.x/deploying
The tl;dr for windows is, apache + mod_wsgi
16:48
whats the difference between self hosted and hosted?
nevermind, I think I see
look at the hosted options and you'll spot the pattern. Essentially, the "Server" is outsourced
ok I'll try apache, thanks for that link
@Kevin Just stick an extra 1 digit at the front of every string. That'll preserve your leading zeroes. And the empty string encodes to 1.
Yeah, that'll give you a unique integer for each string. I think a little extra magic is still required to ensure that every integer can be converted into a unique string.
@erotavlas Nginx is free
The only blocker to a simple deployment route is that gunicorn doesn't work on Windows
16:58
@Kevin Which reminds me, a week or so ago, you asked about the cardinality of finite sets of integers. The set {a, b, c} maps to 2^a + 2^b + 2^c, so that gives you a mapping to the non-negative integers.
I think as it stands you can only guarantee that integers of the form "0x01(an even number of hex chars goes here)" can be converted to string
@ParitoshSingh on that point, isn't the question about whether they are stuck on hosting on their existing server or whether they can get an instance to host it?
@roganjosh I see, sorry when I went to the nginix site I saw pricing link, and free trial button and assumed you had to pay for it, but I see there is an open source web server product, and yeah if it requires gunicorn then it wouldn't work on windows
@Kevin Yeah ok, it's not a bijection. But there might be an easy way to fix that.
@erotavlas see my last comment to Paritosh
17:01
I was very excited the other day, because I was watching a game dev stream on twitch, and the guy was trying to figure out a way to map natural numbers to pairs of natural numbers. I was all set to write a comment and lay down some righteous knowledge about diagonalization... But then he said "Ah, I'm sleepy, maybe I'll work on this later" and signed off
I did get a single hastily constructed high-level explanation down right before then, but who knows if I was heard. Oh well!
@roganjosh it could be i suppose. i essentially bypassed it with an assumption that they're open to self-hosting since they mentioned nginx , but with windows that goes poof
Maybe it's semantics but I'd also consider spinning up an AWS instance owned by the company as "self-hosted"
@Kevin Oh well. I'm pretty sure Cantor solved that one. The usual construction is to work in binary, and interleave the bit strings. I think that gives you a bijection, but it's 3:05 AM, and I'm starting to fade.
@roganjosh well for now we are stuck on windows, hosting our own service, I'm not sure why I think its due to security requirements of the end user (patient health information issue)
@roganjosh aws instance, sure. aws offers beanstalk as well though
and while i did not explore it, i understand that to be similar to heroku and so on
hm, maybe im mistaken about it, now that i googled it
17:07
@erotavlas well, that would be a huge data security issue. I was trying to broaden the search for possible solutions, but that restriction seems totally reasonable
Speaking of servers, @roganjosh was dissing Python's http.server. Sure, it's pretty basic, and definitely not a production server. But it's lightweight & easy to use. I've used it a few times (& its Python 2 predecessor) to test CGI scripts, and doing simple file serving on my WiFi LAN.
python's http server is great
i got to test things before i understood what servers meant.
I wasn't dissing :P
low barrier to entry, essentially.
OK, you were wondering why it even exists. :)
17:10
IIRC my proposed approach was going to be:
from math import floor, sqrt

def map_to_pairs(a):
    x = floor(sqrt(a))
    r = a - (x**2)
    if r < x:
        return (x,r)
    else:
        return (r-x,x)

for i in range(100):
    print(i, map_to_pairs(i))
"Why do you even exist?" might trigger an existential crisis, or could be considered as a genuine question :P
Which has a nice side effect: if you mark the first N coordinates on a grid, then it forms an almost perfect square.
i personally don't take learning curve around the client/server architecture lightly. It's a real mess to get into if you don't have good guidance, but a breeze if you just land on the resources in the correct order
I do hope you saw how that discussion ended :)
anything that helps you get there gets a green check in my book
17:13
@Kevin Nice. I'll take your word that it works, I'm too tired to run it very far in my head.
@roganjosh I saw Aran-Fey mention using it.
Here is a quick little interactive visualizer.
20 hours ago, by roganjosh
I too need sleep. I thought the same too, @MisterMiyagi but there's a question about it, and someone in the room I have respect for using it, so it's challenging my assumptions :)
@PM2Ring ^ it was genuine curiosity
Most Linux distros come with one or more http servers. My 1st distro had a fully set-up Apache, but I didn't bother learning how to use it for a couple of years. One cute one that may be hiding somewhere in a typical distro is en.wikipedia.org/wiki/Thttpd by legendary Unix coder Jef Poskanzer, who also invented the PBM / PPM family of image file formats & the original pbmplus image file utilities.
@roganjosh No worries.
"He owns the Internet address acme.com (which is notable for receiving over one million e-mail spams a day)" LOL
@PM2Ring I completely litter my posts with smilies to try convey that I'm being light-hearted. I can't adapt my messages so that they can be universally read in the context that I intended. Where I'm from, everything is just very direct
Being universally understood is my favorite puzzle that I'll never ever solve
17:28
I can, and do try, to bend as far as I can, but I'd lose the meaning of my statements if I went any further because it would trigger my academic-speak circuits.
#relatable
I'm in danger of skirting off into a very long rant here, but a few months ago I met some people who I just could not communicate with. Nothing I tried got through to them - neither math nor written explanations nor analogies. I spent hours trying to get my point across until I finally realized that it's hopeless. Learning that people exist who just fundamentally can't communicate with me was eye-opening and very disillusioning.
@roganjosh Yeah, I do that too, although it can backfire, if people think you're being sarcastic, or laughing at them.
linguistic incompleteness theorem: a communication style can be robust enough to convey any possible idea, or clear enough to always be understood, but not both.
Most natural languages don't even have one of the two :-P
17:44
^ "UhhhGG, HMMPhh-rrrrr"
[grunt of agreement]
Anyone read the King Killer Chronicles?
There is a culture that mixes hand communication with verbal. It's a cool idea
We already do that?
... mixes in a formal context. As opposed to what we all already do informally
kevin'd ... sorta
17:49
I want every motorist in the world to agree on a hand symbol for "sorry"
We have the middle finger for "I don't like that" and emphatic waving for "thanks for letting me into this lane even though it's an inconvenience", but nothing for "I acknowledge that I just did something stupid but I need you to know I'm self-aware about it"
sorry isn't in a motorists vocabulary
... Yet :-)
@Kevin some of the best lines in film come from ad-lib... same situation
Like, we should have an emoticon/emoji that conveys respect. All we have is plain text and I'm totally joking :-P... Unless I'm wrong/out_of_touch_with_what_kids_are_doing_these_days
Now we just need an IoT device monitoring drivers constantly to find the most effective method of apologising
17:53
i want to invent a device that allows motorists to send/receive verbal messages to other vehicles , it would be an improvement over 'honking'
All question seekers must henceforth end their question with 🙏 Person With Folded Hands
Users limited to ANSI may instead use orz
questionable _| ̄|○
I think OTL is good
okok, I give in orz is good. I see it now
@piRSquared depends which kid you want to know about (I am a python learning kid ;) )

« first day (3254 days earlier)      last day (1919 days later) »