« first day (2970 days earlier)      last day (1968 days later) » 
01:00 - 19:0019:00 - 00:00

1:39 AM
@AndrasDeak, sorry, had to step out. How do I go about using submodule?
How do I go about running a pyside2 animation indefinitely, for example within a while loop? Is there some way to set loopcount to infinity?
 
 
3 hours later…
4:38 AM
20 minutes until AoC day 3!
 
Hey,was wondering if anyone you could help me write this small Repl.It in Python. I've implemented it ES7 JS and can't remember the most concise and readable way to to it in python
 
@AymonFournier, what is it that you are actually trying to do?
 
sorry the repl should make it more clear
 
you can parse it with json library
 
if you just press run you can see the output
edited my comment to the link the repl
 
4:50 AM
okay
 
see what i want to achieve? i was thinking some sort of dict comprehension but i am lost
 
so for each flat_id you are trying to retrieve every other fields?
you can create another dictionary which will input the values from the list of items which you have..
 
I want to go from

```
tickets = [
{
event_id: 'event_id',
title: 'title',
venue: 'venue',
date: 'date',
section: 'section',
row: 'row',
seat: 'seat',
render: false,
can_file: false,
can_passbook: false,
can_barcode: false,
can_transfer: false,
flat_id: '564.132.553'
},
{
event_id: 'sdfs',
title: 'titsdfsdle',
venue: 'vesdfnue',
date: 'dsdfate',
section: 'sesdfction',
row: 'rosdfw',
seat: 'seat',
render: true,
can_file: false,
can_passbook: true,
can_barcode: false,
can_transfer: false,
flat_id: '123.735.859'
 
print({d.pop('flat_id'):d for d in tickets})
I think
 
5:09 AM
@JoranBeasley nice. thanks
 
yes that works...nice @JoranBeasley
 
5:43 AM
@Unihedron I doubt I'll ever place 1st on our Room 6 leaderboard, but I'm pretty pleased with my standings so far
 
Man, @Unihedron is tearing it up
I just got my part twos done
Who else just brute forced the heck out of that?
@piRSquared That is precisely the reason I try to live by this quote
> Always write code as if the person maintaining your code is a homicidal psychopath that knows where you sleep.
 
with the overlap? im pretty sure you can create a big numpy array and use slicing to +1 all of them and just select where > 1
 
More often than not, future you is that homicidal psychopath
@JoranBeasley That would be an interesting approach. I might have to give that a shot and see if I can figure it out
 
5:54 AM
i havent done it ... and probably wont until tomorrow but thats the tact i plan to take
 
@WayneWerner me
 
It's actually really similar to a puzzle we had at a... I want to say ACM programming competition
 
I'm sure there's some nifty way to do it with more clever calculations. I just basically kept a set of (x, y) pairs.
Do you have your solutions up on GitHub or anything, Wayne?
 
Bah. Can't seem to find the one from my past
basically there was a hedge maze
you had to figure out how many exits there were
(where the maze was given as an ascii ....##.... drawing
with S as the start position
at first I was thinking of some kind of graph
then I realized no that's silly
just go through and look for all the S's that had a . either NNEESESSWWNW around it and stick that into a "moves" list. Then go through all the moves and change . to S
until there are no more moves left
then just walk the edges of the map counting the S
we took two submissions because I forgot the pathological case: ......
anyway, off to bed for me!
 
@WayneWerner Gnite. About that time for me, too
 
6:17 AM
@WayneWerner I used a club and smashed it until it was done. I'm not proud... but then I kinda of am.
 
6:50 AM
hi any there who could help me in scrapy
@coldspeed can you help me
 
wim
7:48 AM
@JoranBeasley you described my approach exactly, pretty much github.com/wimglenn/advent-of-code/blob/master/aoc2018/q03.py
 
 
1 hour later…
8:52 AM
@jamesson I don't know. As far as I understand submodules like scipy.optimize aren't there until you import them, so I don't know how you can fetch all the names without importing them.
 
9:41 AM
cbg
 
10:00 AM
Hi , Can Anyone help me how to find whether a video is 2d or 3d or 360 ?
I am looking online they giving me queries for implementation of 2d to 3d or 3d to 2d
 
Can 3d and 2d be in the same file format?
 
@AndrasDeak we leave it on user, he is in god mod so that he feels cosy
 
@Code-Apprentice I'm aiming for the global and seeing if I could beat my standing last year :0
 
from html.entities import html as _html5

any replacement in python 2??
 
@AndrasDeak yes for simplicty and now we will take it in same format!
 
10:33 AM
It was an honest question, I don't know how 3d videos work (honestly I don't even know how 2d videos work). I would expect that even a similar question of "figure out aspect ratio of the video" would depend on the file format...
 
@AndrasDeak give me some insight to find if video is 2d or 3d
 
okay?
 
 
1 hour later…
11:46 AM
I have a pandas question. I'm trying to iterate over groups generated by groupby. The idea is to create a list with duplicated groups. Here's the code:
```
unique_grps = grps.get_group((list(grps.groups)[130]))

for lab1, grp1 in grps:
    print(grp1)
    for grp2 in unique_grps:
        print(lab1)
        print(grp2)
        if not groups_are_identical(grp1, grp2):
            unique_grps[lab1] = grp1
```
where grps is just a groupby object. Prints show for grp1 a whole pandas group and for grp2 its just the first column name.
 
12:47 PM
I just took a look at the scikit-learn codebase, and saw that they have nested setup.py s throughout the whole repo. Can I feel repulsed by this, or are there good reasons to follow such a pattern?
 
the scipy stack is often not the most idiomatic of libraries
the numpy setup.py is also a monster I think
 
@AndrasDeak: what I meant yesterday, is there a console command that will take a module as argument and return all submodules and methods? Or for a submodule as argument?
 
I guess I'm going for 'best algorithm I can think of' rather than 'get to the leaderboard as high as possible' on AoC 2018.
so far, having loads of fun with yesterday and today's puzzles with that approach.
 
you aren't exactly in an optimal time zone for gunning for first
 
Surprised I have yet to see another AoC solution posted that uses a Trie for yesterday's challenge.
 
12:57 PM
I wondered about a trie but figured that the prefix-centric approach of a trie might make it less useful in this case
 
(to me, a Trie was an obvious choice to avoid a O(N^2) loop over all ids)
 
although I've never actually used a trie for anything so my vague notions might be off
 
@AndrasDeak that prefix-centered approach cuts down on the search space. You get to prune the tree at each level.
 
ah, I see
 
I did a smarter solution afterhand, where sopython.com/spoiler/…
I don't know how to use tries, I guess I should learn them :)
 
12:58 PM
you can always trie
 
is there a string ending with 'xyz' for this prefix, where the x is any other letter present at this prefix level, and yz the postfix for the id you are testing.
@AndrasDeak hahahaha ha.. ha
 
I walked right into that and my heart is burning from that joke
 
I'm afraid that's all I can do today :P
 
you redeemed 2018
 
simplest trie in python: trie = {}, then for each word: current = trie, for c in word: current = current.setdefault(c, {}), then, if that makes testing easier later on, current[c] = sentinel for that last character.
 
1:01 PM
oh so tries are like graphs. got it
 
is it bad to use c in the else block of that for loop to set the last one?
@Unihedron tries are a specific kind of graph. A kind of tree. Prefix tree?
 
dicts pointing to dicts pointing to dicts, with a sentinel object to mark complete words. The words here are all the same length, so no faffing about with having to add a sentinel: sentinel pair in the next dictionary to know that there is a complete word at that prefix.
 
anyway, commute rhubarb
 
@AndrasDeak nope, the loop variable leaks, everyone knows that. :-D Provided all your words have length > 0, which is the case here.
 
Yeah, but it still seems a bit off-putting to make use of the leak :)
feels indecent
 
1:04 PM
got it. the algorithm immediately makes sense once I understood the structure. it comes with the benefit that instead of comparing all the previous strings with the current line linearly, it's easy to add the current line to the trie and also comparing the trie already compares every last string
 
If it makes you feel any better, my solution doesn't use the loop var.
 
a bit ;)
I leave you in the good hands of Kevin
 
@Unihedron exactly. No need to generate a-z letters for the 'changed character' test either, as the trie so far can tell us all possible letters to test.
 
Oops I'm 3 days behind on AOC
 
1:17 PM
I am looking for interesting mini projects. I am tutoring a child who is interested in programming (and with some very basic familiarity with it) and my plan is to build something interesting on each meeting. For example first lesson ended with a Mandelbrot visualiser ( github.com/matkoniecz/quick-beautiful/blob/master/01-mandelbrot/… )
 
whoa why did you start with such high standards
could have went with a maze pathfinder or something :)
 
Mandelbrot isn't too hard if you're already familiar with imaginary numbers
 
I guess it's just me being bad, I'm as competent in maths as a primary school student, haha
I don't know if it interests you but something I've been trying to make for fun is an implementation of the diamond square algorithm which generates pretty graphics en.wikipedia.org/wiki/Diamond-square_algorithm
 
Hi , Can Anyone help me how to find whether a video is 2d or 3d or 360 ?
I am looking online they giving me queries for implementation of 2d to 3d or 3d to 2d
 
@Unihedron woah, that algorithm was what my first actual programming project was about
what a throwback
I still wrote in java back then.. shudders
 
1:22 PM
@Unihedron Ooo, I like this one. Maybe for a third one. But for the second meeting I want to make something that is not a fractal for a change.
 
It does rustle my jimmies somewhat that the step of "now determine if this sequence continues to hover around the same value" can't really be objectively solved in finite time, so the average mandelbrot visualizer just does "calculate 100 elements of the sequence and compare distances"
 
I am now thinking what else can be done with simple code but has impressive results. At this moment my ideas include processing prepared text corpus (what are the most popular word in English? Polish?) - but while this is interesting for me, it may be a bit of hit/miss.
 
But diamond square was a real treat to see in action, we made the most beautiful mountain ridges =)
 
I have fond memories of writing sudoku solver, but it is a bit too complicated for start.
@Unihedron Thanks for the idea - logged for now at github.com/matkoniecz/quick-beautiful/issues/12
So if anyone has idea for something relatively simple that would be interesting for a child starting to program - lett me know!
 
maybe something like ascii art is on the simpler side, but it wouldn't make for a fun exercise
 
1:29 PM
What do kids even find interesting these days... Hula hoops? Dabbing?
 
fortnite dances
 
emoji to ascii art converter?
 
Is Minecraft still cool? One time I wrote a little tool that calculated how many items I could craft given a starting amount of resources. Easy enough for items with a one-step crafting process, but I was targeting an item that required many steps.
 
There are some "upping the ante" posts on the aoc subreddit about people implementing their solutions in minecraft :)
 
Minecraft (or something similar with resource requirements) sounds well if she plays it. I should check that, thanks for the idea!
Minecraft (or something similar with resource requirements) sounds well if she plays it. I should check that, thanks for the idea!
 
1:37 PM
bouncing balls, matrix style screensaver programs (are those still a thing), stuff like that are what comes to my mind when it comes to visual programs
 
Both also sound quite interesting. I am also thinking what is interesting and without graphics. Markov chains are always fun but it is a bit more complicated...
 
IMO, every advent of code problem (including past years) are very interesting, you might be able to take inspiration from them :p
I had a blast just thinking about how to solve adventofcode.com/2016/day/24, there are lots of fun things to consider like parsing input, removing dead ends, merging chains into adjacent nodes with distance offset, I was definitely not well equipped to solve this two years ago
 
cbg
 
Cbg
 
cbg
 
1:55 PM
Ok, now that I'm caught up on AOC I can actually comprehend the trie chat that Andras left in my good hands
 
I'm still trying to implement that trie approach, as practice
 
I thought about doing a prefix trie but decided not to since the differing characters could be anywhere in the string. In the degenerate case where all inputs are nearly identical, you get little benefit
I've got an idea for an O(N*M*M) solution, where N is the number of ids and M is the average length of an id. Whether this is better than the O(N*N*M) approach I actually used, depends on the sizes of the input.
Whoops, I misread the prompt. I think I can do O(N*M).
Half-baked idea: construct a trie of the ids, and also construct a trie of the reverse of each id, so you have both prefix and suffix trees.
This is useful, because the id pair you're looking for have identical prefixes and suffixes, and only differ by one character.
The explanation for why this is useful is unavailable, because it is in the unbaked part of this idea
 
2:24 PM
@Unihedron Thanks for the advent of code. Also, I think that I have an idea for the next week inspired by diamond-square fractal - generating an image with landscape (trees, houses etc) from single geometric shapes.
 
good luck!
 
Should be quite good for showing code reuse (one function for house printing at specific location), will not introduce new features and there will be also some nice result. And she should be be able to made most of it be herself, with some guidance.
And maybe there will be time to add some randomization and end with nice procedurally generated landscape.
 
cbg
...that moment when codetriage sends to an email saying "start contributing" and links you to an issue in your own repo...
 
A recent question on the main site mentions "nestled loops". How seasonally appropriate.
 
2:49 PM
\o cbg, I forgot today is Dec 3rd and that I missed 2 AoC days already. #shameful
 
What is even more shameful is that it's kinda 3 days
 
@MooingRawr Same. Come sit in the Corner of Shame with me. We have hot chocolate with tiny marshmallows.
 
/-: seems like that corner isn't so bad
 
[Putting my feet up by the crackling fire] I can't imagine why you would think that.
 
@MooingRawr DItto
@piRSquared I'll bring the Glühwein.
 
3:04 PM
Saturday night, Dec 1, I was waiting patiently for 9:00 pm PST to roll around. Feeling pretty good about getting a jump on AoC. Then I realized that Dec 1 started on my Friday /facepalm. This is be the first of my stack of excuses that I refer to at the end of the 25 days
 
@MooingRawr don't worry there's no shame to being late
 
@Unihedron you make on the global board yet?
 
temporarily, yeah
 
@piRSquared googles "25 Days of AoC excuses
 
Title of the day, I'd say: "JSON value of one JSON in JSON list value of other JSON"
 
3:09 PM
Original title had a lot more profanity before the filter switched them out with "JSON"
 
JSON deserves its place among the four letter words
 
Ew, I stepped in a pile of JSON
 
all JSON sounds more interesting when you replace them randomly
 
Day 1 seems really easy, I hope I didn't do something wrong... lol or is this the classic bait and switch. Give some free sweets out and then switch it to something harder once people are in.
 
22 hours ago, by piRSquared
Day01... Welcome to AoC! We're going to perform a little test. We want to see if you have a pulse... Good! Day02... Welcome back! We found a pulse, true. But that could've been faked with pneumatic pump of some kind. Now we'll check for brain activity. Day03... Now let's try something a little dangerous. I can hope, can't I.
 
3:18 PM
I like thinking of it as warming up, but bait and switch is fun too lol
 
I spent more time on day 1 then on 2 and 3 combined :>
 
The time spent being late doesn't count
 
no bragging intended but day 1 is a 3 minute challenge if you're really going for speed
 
I love Advent of Realizing I Can't Code
14
 
First, because I did part 1 in a single line, which makes it unsuitable as a base for part 2. Second, because I didn't read part 2's description thoroughly enough, so I kept getting None for half of the test inputs
 
3:21 PM
Antti also used the "code before reading" strategy. ;)
 
"you can over-specialize in part one and hinder yourself for part two" and "you can frustrate yourself because you missed a sentence" are running themes across all years of AOC, and day one deftly warns you that both of these are still in effect, in the smallest possible form
 
I find sometimes I don't use my part 1 for my part 2, that was the same for day 1....
 
for me it's more like "realizing I'm a moron", on day 2 I mistyped "2 3" as "4 3", and on day 3 I typed 100 instead of 1000
a zero makes for very, very big differences
 
@Unihedron I'd dare to say an order of magnitude difference
 
Ayyyo
 
3:27 PM
Sometimes more: compare 1e10 to 1e100
 
@Unihedron you're 25th overall after 3 days! That's awesome!
 
Thank you! (End of day 1 - temp #2, end of day 2 - temp #9, now temp #25)
 
You crushed day 1
 
earlier days are when people aren't fully prepared yet, so I can pick on the low hanging fruits, late puzzles get to the point where I can't even solve them lol
 
@Unihedron It's easy to forget to use the command line option to run Python in base 100 mode?:)
 
3:36 PM
Oof
 
ugh, even encouraging Unihedron now
 
While discouraging all other users in order to improve one's own ranking is optimal, it's probably not in the spirit of the season
For Christmas, I want all of my decision problems to have a net positive Nash Equilibrium
 
I usually like to set people up emotionally so the impact of my discouragement is greater
 
@Kevin ahhh... that famous Mariah Carey Christmas song lyric? :)
 
busting out the game theory jokes O.o
 
3:42 PM
Yeah. Her Erdos number is surprisingly high btw.
 
bc has 2 variables, ibase & obase that let you set the input & output bases; ibase is essentially for the base of literals. That can be handy sometimes, but it can also be confusing, especially if you set them to 2 different bases, with neither of them being decimal.
 
The basis of naming bases is confusing. If you think about it, all base systems are base 10 in their own systems; binary shouldn't really be called base 2 but base 10 (subscript 2)
 
Hey guys, could I get some help with this snippet of code? Im loading an AutoHotKey DLL in to my program with this script. It is failing by "Not Responding" where the window just locks up. In the INIT part of my AHKClass.

The fun thing is. It works fine on my machine. But when I roll out the code in the build with CXFreeze it fails in the manner described. But only on others machines...
Any help would be awesome! http://dpaste.com/1MVVETK
 
@Unihedron no
 
I just dont know the libraries I am using well enough to be able to trouble shoot it.
 
3:45 PM
Binary should be "base 1+1" and decimal should be "base 1+1+1+1+1+1+1+1+1+1"
 
This looks like roman numerals in disguise..
 
Unary matches up with roman numerals for the first three digits, so I assume it continues that way indefinitely
 
** Continuing from above. The .dll is in the same directory as the main.exe. So i would think the line self.ahk_dll= cdll.LoadLibrary(get_python_lib() + '/AutoHotkey.dll') would be fine. But maybe I need to remove the / ?
 
I'm comfortable with my base 1010
 
if it hangs up it sounds to me like there might be an infinite loop with the script's execution... but I don't know the AHK syntax
 
3:50 PM
"This code fails to work when compiled with CXFreeze, and works when not compiled" usually means that the code itself is OK
 
A few days ago I discovered Alex Kasman's Mathematical Fiction database. "This database lists over one thousand short stories, plays, novels, films, and comic books containing math or mathematicians".
 
Actually we're missing a data point here:
                                compiled?
                               yes      no
                            +--------+-------+
                 mine       | works  | works |
whose computer?             +--------+-------+
                 coworker's | broken | ????? |
                            +--------+-------+
It may be useful to upload your non-compiled program to your coworker's machine, and see if it runs. That might narrow things down.
 
@Kevin I will do that tomorrow for sure. Has been on the troubleshooting idea list for me but will need the one other coworker with Admin rights to install python. Sadly the only co worker I have with me right now is a non admin. :(
 
It's not an incredibly useful diagnostic step, so don't bend over backwards to get the answer.
"broken when run uncompiled on coworker's machine" suggests it's a DLL problem. "works when run uncompiled on coworker's machine" suggests a CXFreeze problem or a DLL problem or both
 
"CXFreeze problem or a DLL problem or both" Things that make me cuss out loud haha.
Im guessing when it freezes there is an error message somewhere. But because its compiled it doenst throw the error? Is there a way to see if theres any errors? Or I guess a way to confirm its getting caught in a loop vs an error?
 
4:04 PM
Wait, so the problem is that it freezes with CXFreeze...? :P
 
Although I strongly suspect the LoadLibrary line is at fault, if you haven't done so already you should throw in some print statements to confirm that that's where it's hanging
 
Will a print statement make it show the lines in CMD when I run it?
 
how are you running it?
 
That's typically what print does. I suppose there's a chance that CXFreeze could tamper with stdout, although I don't know why it would
 
I have it compiled in a build folder, which I transfer to a network drive. Then they can grab it from there. Ive had them run it from the networked folder (which works for me) and it works up until the line denoted in the script. Or at least I make it to that last message box.
@Kevin I want to say it doesnt, I think I had prints in there before and it worked in the manner were looking for. But cant say 100%. Ill give that a shot now.
 
4:09 PM
Incidentally I notice that win32api.MessageBox(0, 'init end') is the only call to MessageBox that has two arguments instead of three. I wonder if that matters.
 
I think that will just make the window not have a title. May be wrong tho
 
Wouldn't it be funny if the program was hanging on your coworker's machine because his OS refuses to render message boxes that don't have a title
 
lawful evil
 
"The specification doesn't say I'm not allowed the segfault here, so..."
@ZackTarr Windows is usually pretty permissive about path separators, but you may as well eliminate a potential point of failure by doing self.ahk_dll= cdll.LoadLibrary(os.path.join(get_python_lib(), 'AutoHotkey.dll'))
I suspect that LoadLibrary can successfully find the dll, or else the program would crash with The specified module could not be found. So it's probably not a path issue
 
4:41 PM
I will give that a shot now as well too. Adding print statements and that line.
 
4:53 PM
Are there any easy to use libraries for speech to text that I can install with pip?
Well any suggestions from experience
 
@Kevin typed it out faster and better: stackoverflow.com/a/53598341/100297
 
I got a little head start because you were busy editing the post :-P
With great power comes great responsibility
 
(or, I spent too much time giving the question a much needed edit)
 
Anyone know off the top of their head whether 255 - x is faster than 255 ^ x? Assuming x is always in the range of [0,255].
I accept the possibility that the answer is "it depends" or "it's complicated"
 
5:10 PM
anecdata
In [8]: %timeit (lambda x:255-x)(42)
   ...: %timeit (lambda x:255^x)(42)
151 ns ± 0.989 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
171 ns ± 2.02 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
 
Hope the answer is not "you fool, those expressions do not have identical results in this one corner case you didn't check"
 
In [13]: np.array_equal(255 ^ np.arange(256), 255 - np.arange(256))
Out[13]: True
 
wonder if there's something underneath going on where since certain integers are cached (and probably just in a contigious array) - it can just do pointer arithmetic instead of computing a new integer each time and then realising it's in the cache or something...
(so you avoid the whole python object construction stuff - at least 24 bytes etc.. etc...)
 
Is there a way, where I can connect my large pandas dataframe to a figure; and load the figure upto an entered index range only as I require. To increase speed of the plot.
Above link is exactly the layout of the figure I require. But my dataset is much larger, and it's important to view every point (I can't compromise on granularity). Although I can manage with loading 1-2 hour of data at a time
Like the last one on this page (rangeslider); except it initially loads all data. I don't need/want that, just 30 min of data is enough. And then I can set my range to load only what I require
 
5:29 PM
You could have a function that plots the input DataFrame, and another function to select a range ?
 
Can you retain the DF in ram and then just slice it accordingly?
 
sorry I left out the range slide link - plot.ly/python/time-series/…
 
The original context of my question was operating on individual elements of a bytes, so I would love to avoid python object construction stuff. Operating directly on the unsigned char would be perfect.
 
@JonClements If I plot on RAM it's a 300mb HTML file for just 5 columns. Chrome is unable to load it. And I need to load many more columns
 
But why plot the whole lot... just make a request with the criteria you want, and return that to be plotted?/
 
5:32 PM
@IMCoins Is it possible you can point me to an example>
 
I don't know any plot.ly yet ;)
 
@JonClements Yes, how do I do that?
 
Well, how are you doing it now?
 
But I'm sure you could refresh your plot with an html button that would launch a function that would calculate a html plot and you would replace it
 
I just load in one dataframe, make traces of needed channels to be plotted. Or retain needed channels in a dataframe and plot it. And I have to at around 50 such such data frames
@IMCoins Is there a term or keyword you can think of for this kind of ? a plot that can be refreshed based on input range.
 
5:37 PM
Bokeh library does that :)
 
I'm moderately annoyed that ~b"foobar" isn't legal
 
If you like plotly, look at dash. plot.ly/products/dash
@kevin
 
I've tried Dash/Plotly (specifically datashader+plotly - plot 100 million time series points) example. But that plot makes loses granularity
 
timeits = {'diff': 0, 'pow': 0}
for x in range(256):
    rd = %timeit -o 255 - x
    rp = %timeit -o 255 ^ x
    timeits['diff'] += rd.best
    timeits['pow']  += rp.best

timeits
# {'diff': 6.457653994858268e-06, 'pow': 9.922373988479375e-06}
 
@Kevin Well, all byte values are in the cache, so you don't need to worry about object crdatio
 
5:46 PM
So now we've got two data points that suggest "-" is faster than "^". Interesting.
 
@Kevin Well, all byte values are in the cache, so you don't need to worry about object creation.
 
True.
 
But consider using a bytearray if you are doing multiple modifications, since a bytes string is immutable. Of course, that's irrelevant if you're simply feeding a bytes to a list comp or gen exp, and not converting the result back to a bytes.
 
Yeah, bytearray is more appropriate here. I only wish there was a more concise way of telling it "invert this one byte"
Devs, please implement augmented assignment, unary bitwise negation edition: myByteArray[23] ~=
myByteArray[23] = ~myByteArray[23] Doesn't work because of the conversion to signed int. Augmented assignment could, in principle, avoid that.
 
Sounds like interesting functionality for KevinScript (tm) :p
 
5:53 PM
I'm going to usher in a new wave of assignment statements with no right hand side
With such favorites as ~=, -=, +=, and not=
 
My guess is that - has been aggressively optimized. Also, xor on arbitrary sized Python ints has to do extra stuff to handle the sign. IIRC, a^b will always return a non-negative result... or maybe thats only when b is non-negative.
 
@PM2Ring sounds similar to what I was trying to say earlier regarding the whole - / ^ thingy...
 
Augmented assignment using call-with-single-argument is in the experimental branch. e.g. x = abs(x) is identical to x abs=
 
has everyone seem my awesome new portfolio site joranbeasley.net :P its pretty rad
(well i think so ... but im biased)
 
01/01/2000  10:21 AM         <DIR>          .
01/01/2000  10:21 AM                  2344  kittens.exe
01/01/2000  10:21 AM                  3163  contact-joran.exe
01/01/2000  10:21 AM                  3119  public-profiles.exe
01/01/2000  10:21 AM                  3042  stocks.exe
01/01/2000  10:21 AM                  1858  zork.exe
               5 File(s)        0 bytes free

C:\> public_profiles

Error no program named 'public_profiles.exe' found. try 'help'
Hmm, I think I'm doing it wrong
Oops, is that a hyphen? Let me try that
 
5:59 PM
@Kevin I think myByteArray[23] ^= 255 is your best bet. Although when doing bitwise stuff I prefer to use hex literals.
 
Hmm, now that I've tabbed away, I can't get keyboard focus back in the prompt. Guess I'll refresh
 
lol yeah theres some bugs
you also cant do ./my.exe
just my or my.exe
tab works though :P (at least until you go into stocks or zork)
 
Wow, the old unixkcd site is still up! It doesn't work on my phone, though. uni.xkcd.com
 
YOU SCORED 31 OUT OF A POSSIBLE 350 USING 1 TURNS.

YOU ARE OBVIOUSLY A RANK AMATEUR. BETTER LUCK NEXT TIME.
Yikes!
 
No-computers-allowed challenge: determine the smallest positive integer whose hex literal is shorter than its decimal literal. e.g. 0xFF is longer than 255, but 0xFFFFFFFFFFFFFFFF is shorter than 18446744073709551615.
 
6:05 PM
@Kevin so calculators and phones are fine...?
 
@JoranBeasley I can't seem to get it to register my keyboard input. Using Firefox on CentOS
I might be an edge case here :P
 
You're not allowed to use anything that can simulate a Turing machine, including your own brain. The answer must come from the heart.
 
so I have to believe in it for something to happen?
OK. Let me try giving it a hug
 
You've solved my riddle! The correct answer was love.
 
lol you are right ... ive only tested it in windows on chrome ... it can get in weird states sometimes still
but i thought it was a fun little weekend project
 
6:08 PM
it looks really neat :)
 
and i needed something like a portfolio
 
good job
 
but it may be too hard for the target audience (Im not sure who the target audience is even tbh)
thanks for finding that edge case for me to look into
:)
 
@idjaw Does that xkcd terminal work for you?
 
@PM2Ring haha not at all
 
6:10 PM
I cant type in that xkcd terminal
 
let me try in chrome.
 
Anecdote: I recall reading the opinion of at least one recruiter who says they have little patience for cool interactive portfolio sites. If you are interested in optimizing for recruiter enjoyment, maybe provide an unobtrusive link to boring and plain site that contains the same information about you.
 
OK. I have come to the conclusion that CentOS hates fun.
It doesn't accept inputs
Kevin, it looks like CentOS actively fights against love.
 
xkcd;s does not work for me either
@Kevin yeah i have a boring version as well thats more like a simple digital cv...its just that I have terrible aesthetic sense and design skills :P luckilly the creators of shells did not spend much time on this either
 
@JoranBeasley Ah. That explains why it doesn't work on my phone. :) But it's annoying that site still looks like it ought to work, rather than throwing a 404.
 
6:12 PM
lol
when you play zork on mine its actually just running pypi/adventure over a websocket
 
If I had a portfolio, it would probably be black monospace text on a white background.
 
lol thats basically what this is ..
 
That ought to filter out all the job offers where my responsibilities include deciding how much gloss to put on buttons with rounded edges in order to maximize user engagement
 
with some interactive elements :P
 
@piRSquared #{'diff': 9.963623579657792e-06, 'pow': 1.430800948963584e-05}
 
6:23 PM
huh, that's weird.
different machine
I ran mine on googles colab
 
Well...day 1 part 2 of AoC is certainly about 1000 times faster if you use the right data type...
 
@piRSquared I ran it on my desktop
@piRSquared What's weird though
 
@toonarmycaptain what's the wrong data type?
 
my brain apparently
 
@Code-Apprentice list rather than set
 
6:27 PM
I saw e-06 and thought bigger than e-05
Going to get coffee
 
@toonarmycaptain yah, that makes sense
were you doing a linear search in the list of all previous values?
 
@piRSquared I did that too, brought coffee a min ago
 
@Kevin
print(f"{100000000000000000}")
print(f"0x{100000000000000000:x}")
print('-' * 20)
print(f"{100000000000000000-1}")
print(f"0x{100000000000000000-1:x}")
# 100000000000000000
# 0x16345785d8a0000
# --------------------
# 99999999999999999
# 0x16345785d89ffff
 
@Code-Apprentice if by linear you mean if freq in list: then yes
 
100000000000000000
0x16345785d8a0000
--------------------
99999999999999999
0x16345785d89ffff
 
6:40 PM
Good job, gumshoes. You found the other answer to my riddle besides "love"
 
totally cheated though
 
Yeah :-)
 
def g(a, b):
  if abs(a - b) <= 1:
    return a, b
  else:
    m = (a + b) // 2
    if f(m):
      return g(a, m)
    else:
      return g(m, b)

a, b = g(1, 18446744073709551615)
 
One lump of coal has been deposited in your account
 
I will use that coal to warm the hot cocoa in the corner of shame.
 
6:43 PM
I also used bisection to calculate it. Great cheaters cheat alike.
 
I'm assuming monotonicity /crossesfingers
and f was this
def f(x):
  return len(str(x)) > len(f"{x:x}") + 2
 
@toonarmycaptain yah, that's a linear search
"linear" because it has to compare against each item in the list one at a time
 
Hmm, I guess it's possible that it's not monotonic. Or at least, if it's monotonic for bases 10 and 16, I wonder if there are base pairs that aren't.
 
BTW, I'm expecting that AoC day 16 will come back with "Referring to Day3: Here is your new 1 gig input file. Find the sum of all area that is overlapped with more than one but no more than 5." At which point, I'm hosed.
 
Contrariwise, I'm dreading "here is your input file, which has the same number of rows as yesterday. But the grid is 2**64 units wide and tall"
 
6:49 PM
RE: monotonicity, It has to be
You can't lose digits and the smaller base will always accumulate digits faster
Once it overtakes the larger base, it stays that way. Ok, I've convinced myself
 
@piRSquared Sounds reasonable.
I suppose you could approximate the crossover point using logarithms.
 
No wait. There may be a period where smaller base gains a digit then a bit later larger base gains a digit and catches up.
 
Yeah, that's how I was imagining it.
I suspect that if it's not monotonic, then there must be exactly three points where one overtakes the other, all occurring where one base or the other adds an extra digit to their representation
 
It can catch up temporarily, but it can't overtake the bigger base. I think. It's getting very late here. :)
 
Maybe "overtakes" is the wrong term in my previous message, since that implies that one's length becomes larger than the other, when really I'm expecting a sequence of "same size -> larger -> same size -> larger"
 
6:57 PM
It can go back and forth many times. Suppose my bases were 1e10 and 1e10-1. There will a long stretch of back and forth.
you can mark the "overtake" point when you observe "same size -> larger -> larger"
 
01:00 - 19:0019:00 - 00:00

« first day (2970 days earlier)      last day (1968 days later) »