« first day (2239 days earlier)      last day (2700 days later) » 

12:45 AM
this just in: inf == 8
@AndrasDeak the indentation works fine. i think the indentation because i manually typed in here thus indentation abit off. i'm doing my coding in another computer. my app will open files in folder 'pi', except folder name called 'settings'. after opening files available in folder 'pi', it will search through the files for 'student_data.csv' file. — noob 2 mins ago
grump grump
I should just go to sleep
 
 
1 hour later…
1:49 AM
good night
 
 
3 hours later…
5:14 AM
When are we getting the hats out of the box?
 
wim
5:56 AM
advent of code day 2 (SPOILER): bit.ly/2gGbfeF
 
6:08 AM
@MartijnPieters why does this question have 100 upvotes?
 
user4017080
6:29 AM
hi
 
user4017080
need small help for python environment veriable setting up
 
user4017080
any body out thr ?
 
user4017080
I have installed python 2.7.10 and set the export PATH=~/usr/local/lib/python2.7.10/bin/python:$PATH
 
user4017080
but when I use python
 
user4017080
is shows as
 
user4017080
6:30 AM
root@SUP-DIGINBENCH:/# python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
 
user4017080
Any Idea how to set up the path ?
 
user4017080
OS is ubunutu 14.04
 
6:44 AM
Does anyone know how i can close a tkinter window when using a color picker? I ask at the end of this question: stackoverflow.com/questions/40925999/…
 
7:09 AM
fixed now :D
 
7:26 AM
cbg
 
@khajvah Because that many people voted on it?
 
cbg
 
7:47 AM
cbg
@Daz while at it, why wouldn't you install python 3 :P
@IljaEverilä ^AoC
 
@MartijnPieters that's how Trump got elected
I guess
I might become a Node.js developer :/
I am falling for it guys, I am falling for a meme
 
@khajvah way ahead of ya :|
 
cabbage
does most people use Python 2 or 3 here?
 
@IljaEverilä Nice, the day will come when we will all do JShit exclusively.
 
I will make an AoC speedhack
@khajvah no one can fail us as hard as @thefourtheye
 
8:02 AM
:d
 
one thing to add in speedhack lib: reading input in stripped lines
 
He he he, I am not a Node.js developer, I work on Scala and Java :D
 
another: clamp an int value
 
@thefourtheye aren't you a node maintainer?
So you are creating the evil and using something else yourself.
 
Yes, I am
I never got a chance to work on it
I never worked on Python as well :'(
 
8:12 AM
cbg folks
 
cbg
 
user4017080
ada
 
user4017080
da
 
8:37 AM
cbg
 
cbg
 
cbg
@IljaEverilä adventofcode.com
 
8:56 AM
@BhargavRao how the mod is going on?
 
@AndyK Damn easy. :D
At the moment the mod flag queue is at sub 50 levels. So we have lesser work than the community :P
 
cbg("y'all")
 
cabbage @Intrepid
 
Trolled by Day #1 (part 2) on the Advent of Code
 
cbg
 
8:59 AM
cbg("holdenweb")
 
@enderland Just saw your comment on MCVE preparation - we could regard that as a sort of auto-stuffed-bear debugging technique
cabbage is a function now?
Or is it a class (that should surely be Cabbage)
 
I've treated it as a function with a near infinite number of valid kwargs.
 
@BhargavRao what means sub 50 levels?
 
@AndyK there are <50 unhandled flags in the queue...
 
that ---------------------^
 
9:09 AM
cool guys
 
9:20 AM
I totally couldn't be bothered to calculate when a AoC keypad move would be legal or not. So I just hardcoded the table..
lazy-coders-r-us
    keys = '123456789ABCD'
    legal_moves = {
        (0, 'D'): 2,
        (1, 'R'): 2, (1, 'D'): 5,
        (2, 'U'): 0, (2, 'R'): 3, (2, 'D'): 6, (2, 'L'): 1,
        (3, 'D'): 7, (3, 'L'): 2,
        (4, 'R'): 5,
        (5, 'U'): 1, (5, 'R'): 6, (5, 'D'): 9, (5, 'L'): 4,
        (6, 'U'): 2, (6, 'R'): 7, (6, 'D'): 10, (6, 'L'): 5,
        (7, 'U'): 3, (7, 'R'): 8, (7, 'D'): 11, (7, 'L'): 6,
        (8, 'L'): 7,
        (9, 'U'): 5, (9, 'R'): 10,
        (10, 'U'): 6, (10, 'R'): 11, (10, 'D'): 12, (10, 'L'): 9,
 
@MartijnPieters lol...
@MartijnPieters you're doing it way too complicated.
keyboard = """
xx1xx
x234x
56789
xABCx
xxDxx
""".split()
then if the resulting position is x, do not move there.
@MartijnPieters my whole code is about as much as your move table
 
.append(<output of for loop> + whatever)

^ how do i do that?
 
@Pigman168 like that?
 
@AnttiHaapala I thought I can put the for loop right into that?
Or something similar to that, I think I've seen it before
 
@Pigman168 I have absolutely no idea what you're asking.
 
9:29 AM
@AnttiHaapala :-D
 
I even refuse to guess what you're trying to achieve before you notice that what you're asking doesn't tell anything at all :D
 
Ok, one sec. Sorry for the confusion
@AnttiHaapala I've got a for loop printing out X amounts of Y, and that needs to be added to a string inside of the append function.
 
so don't print it, instead append.
first step:
you paste the code that you currently have
then tell how the output should be in the string, not in words but by an example:
for example: "This is the code, it currently prints:
 ffffff
 gggggg
 hhhhhh
 
pastebin?
 
"I want to get the string 'ffffff\ngggggg\nhhhhhh' instead"
 
9:36 AM
for i in range(0, 7-len(str(1234))): print(0)
that prints out 0s for each digit that is lower than 7
array.append(for loop with 0s + "somestring")
and that's where I'd like to put them
Does that explain it adequately?
@AnttiHaapala
 
@Pigman168 xyzw problem
>>> '{:07}'.format(1234)
'0001234'
like that?
or...?
 
@AnttiHaapala Yes thats perfect!
Thank you for being a genius
 
@Pigman168 yes, that is a good example of an XY problem
 
Sad but true
lol
 
Cabbage.
 
9:45 AM
is.
 
Greetings, @Viper909. I'm afraid only non-venomous snakes are welcome in the Python room. :D
 
@PM2Ring cabbage
 
Hi, Hrrundi Bhargav. :)
 
@AnttiHaapala: my mistake was to make the keypad a single string and position a single integer rather than have to deal with col and row calculations.
 
@MartijnPieters clamp. I did a aoc.py, with function clamp.
def input_file():
    with open('input') as f:
        return f.read().strip()

def input_lines():
    return list(filter(bool, map(str.strip, input_file().splitlines())))

def clamp(value, min_, max_):
    if value < min_:
        return min_
    if value > max_:
        return max_
    return value
    dx, dy = directions[i]
    new_x = clamp(x + dx, 0, 4)
    new_y = clamp(y + dy, 0, 4)
 
 
1 hour later…
10:59 AM
my AoC helpers (this will be updated)
 
11:11 AM
Removed
Found the answer
 
@Pigman168 Yes. It's "my". :) There is an English Language & Usage Stack Exchange site.
 
how do i scrap tranding twitter hashtags using python ?
any link to tutorial or code ?
 
@jagdish scrape, trending.
@jagdish UTFG.
 
@PM2Ring Oh but thanks for the link. Didn't know that existed.
 
11:15 AM
@jagdish here
 
yes scrape and trending.
 
@Pigman168 "my" was already in its modern form long before "thy" was phased out. FWIW, Anglo-Saxon is rather ancient, and it doesn't look much like modern English.
 
@PM2Ring Yea, someone was using "thy" when trying to say "my" so I felt the uncontrollable urge to correct them.
 
@PM2Ring lol
Oft Scyld Scéfing – sceaþena þréatum
monegum maégþum – meodosetla oftéah•
egsode Eorle – syððan aérest wearð
féasceaft funde – hé þæs frófre gebád•
wéox under wolcnum – weorðmyndum þáh
oð þæt him aéghwylc – þára ymbsittendra
ofer hronráde – hýran scolde,
gomban gyldan – þæt wæs gód cyning.
@PM2Ring seriously, I just can understand the last phrase in there^:d
 
The opposite of thy is "min" is you're wondering. And there's some accent on the i in there.
 
11:20 AM
@Pigman168 many bible translations still use thy, though.
 
@Pigman168 I spent a month or so studying Anglo-Saxon in my teens. It's an interesting language, but it's much more Germanic than modern English is. Anglo-Saxon predates the Norman conquest of 1066, so all of the influence of Old French (and Latin via French) is absent, although there's some direct Latin influence, due to the Roman conquest of Britain in the 1st century AD. FWIW, J. R. R. Tolkien was one of the world's foremost Anglo-Saxon scholars of last century.
 
cabbage
 
Hey @AndrasDeak You may wish to comment on this Numpy question: stackoverflow.com/questions/40928927/…
 
thanks, I'll take a look:)
@PM2Ring Yeah, on my level of knowledge, I can only say as much as you did. Well, and I think of dtype as a stronger attribute of an array, which should be preserved as well as possible, so I would think that half of the problem is natural.
 
@Andras is the numpy endpoint of the room
 
11:29 AM
But I'm not:D I just like numpy
 
@PM2Ring can you understand that ^
 
I think this is just a matter of "precedence": array type is more important than scalar type
In [118]: (np.float32(10.0)/np.float64(1.0)).dtype
Out[118]: dtype('float64')

In [120]: (np.float32([10.0])/np.float64([1.0])).dtype
Out[120]: dtype('float64')

In [121]: (np.float32([10.0])/np.float64(1.0)).dtype
Out[121]: dtype('float32')
When two of an equivalent level meet, the less precise type is converted. When a scalar meets an array, the scalar is converted.
I wouldn't want True*arr to turn my arr into bool (would I?)
I'm not sure, but I can see the reason in the status quo
 
that was posted in another answer. Guess no more
 
nevermind, one of the answerers noted exactly what I noted above
@AnttiHaapala yup, just realized it now, thanks
 
@AnttiHaapala No way! I can't even remember how to pronounce it. :) But I could (probably) make a fair guess at the part of speech of most of the words. OTOH, I can read Middle English (from the time of Chaucer) with reasonable accuracy... or at least I could 40 years ago. :)
 
11:51 AM
i have data in this format
['#AskDeepaMalik', u'#ALDENatATA2016', u'#HappyBir
thdayBritney', u'#UnGranSalto', u'#\u063a\u0631\u062f_\u0628\u062f\u0639\u0627\u
0621_\u064a\u0646\u0641\u0639\u0643', u'#VendrediLecture', u'#\u062c\u0645\u0639
\u0647_\u0645\u0628\u0627\u0631\u0643\u0647', u'#SuperDamai212', u'#\u4eca\u5e74
\u79c1\u306e\u5370\u8c61\u306b\u6b8b\u3063\u305f\u4eba2016', u'#\u0646\u0648\u06
31\u0647_\u0634\u0646\u0627\u0631_\u062a\u0628\u064a_\u062a\u062e\u0631\u0628_\u
0628\u0646\u0627\u062a\u0646\u0627']
 
@PM2Ring you're ancient :D
 
i have tried
for hashtag1 in hashtags:
print(hashtag1)
but it is generating error
 
@jagdish is that from googling "python twitter trending"?
why are you using python 2?
 
40 years ago I wasn't even a gleam in my dad's eye :D
 
3
Q: extracting hashtags out of Twitter trending topics data with Python Tweepy

loop_diggaI'm having a following problem: using the Twitter API and tweepy module, I want to monitor the trending topics and extract hashtags out of the data. This code: #!/usr/bin/env python # -*- coding: utf-8 -*- import tweepy, json CONSUMER_KEY = 'key' CONSUMER_SECRET = 'secret' ACCESS_KEY = 'k...

then do i use pyton3 ?
is there any problem with python2 ?
 
11:53 AM
@jagdish yes, you would use python 3.
 
@jagdish not because of this issue, but yes
@jagdish you have a list where the first element is str and the rest are unicode strings...not weird at all
what you linked would be a list of dicts, what gives?
anyway, when I asked "is that from googling?", I was going to continue "then keep reading what you found"
 
@AnttiHaapala Oh, but is is used as "my"?
@PM2Ring Sounds like you know your stuff :)
 
@Pigman168 Well, I know some stuff... :)
 
@Pigman168 PM2 doesn't know the stuff that he doesn't know :d
 
well you know...
 
12:08 PM
UnicodeEncodeError: 'charmap' codec can't encode characters in position 34-36:
character maps to <undefined>
this error i am facing with this code...
for hashtag1 in hashtags:
print(hashtag1)
i have tried it in python2 and 3 both
i have tried print(hashtag1.encode("utf-8")) but still facing same error
 
@AnttiHaapala Sounds like a knowledgeable man.
 
12:52 PM
@jagdish Is your terminal configured to handle UTF-8? Are you doing this on an OS that knows how to deal with Unicode, or are you using some quirky, proprietary, closed-source system? You may find this article helpful: Pragmatic Unicode, which was written by SO veteran Ned Batchelder.
 
@PM2Ring that is the "I want to print into windows console, I want to rather shoot myself in the head"
 
1:08 PM
I wanted to at least look at the AoC last night, but I completely forgot...
 
Heh, I've seen a few worse than that.
 
Shared that with my sysadmin. He's still giggling. Suspect he needs to get out more even more than the average sysadmin.
 
aahah
 
1:28 PM
recbg
sudo systemctl restart cbg
Just had a successful interview, I might fall for double-meme. Node.js with MongoDb
 
yay, got the second one aoc (y)
 
@khajvah Good luck, I guess. :) Oh well, it could be worse. At least they don't want you to do PHP.
 
@PM2Ring the company is bretty good
 
That's the main thing. It doesn't matter so much if you're working with shitty code if the team you're working with has a good vibe and you're getting good treatment from management.
 
it's PicsArt, the "office" and everything was so cool
 
1:47 PM
is it a holiday or something?
 
It's Christmas day, you overslept
 
It's Saturday in my timezone. But I guess that's not what you meant. :)
 
You forgot to buy presents, and also today is your final exam in the class you didn't go to all semester!
 
@Kevin I have one class like that :(
the professor doesn't know me
yet
 
If they had parent/teacher meetings in college: Mom: How's my son doing? Prof: I've never seen this man in my life https://t.co/H4E7SN8Snz
(Pretty sure that's not the original -- considering how many times it's been reposted on imgur, I'd expect more than one retweet -- but casual googling turned up nothing)
(Internet Archaeology is hard ;_;)
 
1:59 PM
I'm reminded that in Discworld, the Stealth and Concealment professor at the Assassin's Guild gave Vetinari zero for non-attendance...
 
lol
Good times
Two gold star cabbage, all
 
Complex numbers are continuing to pay dividends for me. I'll probably keep going until I get bitten by some obscure error-accumulating behavior that occurs because all the component values are floats and not ints.
 
Yeah, I saw today and I was just like... 'aw man, I need to know that complex number trick... that will serve me only in this challenge' ;)
 
"Whoops, turns out origin+up+right+down+left doesn't equal origin, it equals origin+1E-23"
 
Animations in react kinda annoy me.
 
2:10 PM
I almost thought about solving it with Turtle again
 
Oh Friday, asking a service provider about their API and if we should do X after Y... "Probably yes."
 
API providers have little incentive to make sure you're pulling data from them correctly. That's why I take the Mouth of Truth with me to vendor meetings and make them stick their hand inside.
 
@Kevin You could just follow the Bene Gessreit's example
 
I knew they would change the keypad for part 2. Argh!
 
2:17 PM
An expert, or teacher, is a person who, after reading your question, knows what you know, what you don't know, what you are trying to know, and what else you need to know in order to achieve what you are trying to know.
i loved this s much
 
@davidism I just changed my arrays to hold None on the out of bounds part and back up if they went there.
It wasn't too bad.
 
I didn't use an array, I used a single number.
 
@WayneWerner If the Pain Box from Dune weighs less than 1300 kilograms, I'll have to seriously consider it.
 
Nice.
 
2:20 PM
There's probably a smart way to eliminate pairs and runs first, but I just followed each step.
 
@Kevin You could always make something like this
 
Yeah, I pondered elimination rules for a bit before deciding to do it the boring way.
 
Would have taken me longer to write it than the time it would have saved.
 
I came up with: if you have three L's in a row, you can discard all L's and R's appearing before that in the sequence, and start from x=0. With similar principles for three R's, U's, and D's.
 
I guess I could have eliminated some checks too and continued in each block.
 
2:23 PM
And: "LRL" can be reduced to just "L", with similar principles for the other three directions
 
Indeed. It was fun going from the small sample size to the massive real one
 
And you can decompose the LR directions from the UD directions and evaluate them separately in whichever order you like (at least as long as the keypad is rectangular)
ofc a lot of this goes out the window for part 2
Here is mine, although there's nothing special to see if you saw my code for day 1
 
@Kevin.a My boss's response: Looks like the log is getting pretty full - needs to be rotated
cbg @AnttiHaapala
 
I'm half-tempted to do all these challenges in KevinScript.
 
2:28 PM
what's KevinScript?
 
@Kevin.a And that's one of the main reasons why we want people to post code in their SO questions. The other main reason is because we want them to prove they aren't a lazy clueless idiot who wants us to do their work for them. FWIW, this point came up today on Meta SO: meta.stackoverflow.com/questions/338755/…
 
It's literally the first result when you search "KevinScript", which likely bothers Kevin's secretive sensibilities.
Hmm, I could probably still do it with just the current position, just need a couple more checks.
 
Oh, nice. It definitely wasn't the first result when I initially made the Github page for it.
 
2:30 PM
Is there anyway to post the AoC answers to the sopy site or something? I kind of want to do them myself then see what people with real experience do :P
 
@Programmer linked above in the chat ^
 
I'd be happy to submit my AoC code to a central repository. Just twiddling my thumbs until someone sets one up for me 0:-)
 
Add your Advent of Code repo to sopython.com/wiki/Advent_of_Code.
13
 
what's special about KevinScript?
 
> Currently nothing. For any programming project you can think of, there is probably a language that would execute it faster and more concisely than this one.
 
2:32 PM
@MooingRawr What's special about MooScript?
 
It's my ugly little baby.
 
this is what is special about KevinScript :P
 
Yes, it is so.
 
Would it be fair to say the KevinScript is for people who don't mind JavaScript, but wish it were more like Python? And possibly vice versa?
 
That's pretty much exactly my original motivation for making it, so yes
 
"Python, but with function declaration as an expression" was more or less my guiding light
 
and from __future__ import braces
 
All of the brackets and semicolons are just a byproduct of me not knowing how to make a syntactically unambiguous language without them
 
@Kevin coffeescript allows doing lambdas without
do ($ = jQuery, window) ->
  $ ->
    alert "js!"
 
@davidism And done
 
2:39 PM
Interesting.
I hope I can continue writing AoC solutions with one source file per day, because maintaining that gist of mine is going to be a pain in the butt if I have to come up with a more explicit naming scheme than just [day number].py
14.py, 15.py, priority_queue.py, 16.py... Doesn't quite flow, you know?
 
OK, part 2 wasn't all that bad.
 
Yeah, you can still use the single number trick. Just gotta cordon off the corners somehow.
Maybe add them to a forbidden_zone set
 
I enjoy that during Advent I can throw design out the window and just modify global variables from functions.
I went with an array for the pad for part 2.
 
Santa knows if you've been employing bad or good practices.
 
2:54 PM
@PM2Ring MooScript doesn't exist, that's what special about it. You use your imagination!
 
I got much less math and much more lazy on this one. :-)
 
@MooingRawr Ah, but KevinScript does exist, so it has a certain advantage over MooScript. :)
 
23
Q: Please do my Martian homework

H WaltersMy homework is to write a Martian essay (see below) between 729 and 810 words, inclusive. Your task is to write a program that will generate the essay. History Around the turn of the 20th century, spiritualist Catherine-Elise Müller allegedly communicated with Martians. During somnambulatory ...

 
Executing KS code on your computer is dozens of times faster than executing MooScript in your head. Literally dozens!
 

« first day (2239 days earlier)      last day (2700 days later) »