« first day (2446 days earlier)      last day (2506 days later) » 

12:01 AM
evening cbg
 
My point is, before you start talking about blockchains, you have a lot of basics to to learn first. Sometimes it is easier to learn a language when you can see an example in a field that you are interested in. I've not looked at this code, but I'll bet there are a number of Python features that are used in it that you would learn from by studying and figuring out what they do.
 
I understand that I have a lot of basics to learn first. I'm curious as to if my google spreadsheet has the appropriate courses for learning about blockchains?
concepts that I can apply towards veloping and understanding blockchains?
 
that seems like a very heavy ask of someone to do for you
and that spreadsheet is pretty involved
 
DSM
If you don't see why presenting a list of a few dozen names of courses and asking "will these help me to understand blockchains?" isn't a particularly useful question, then I'd really start with the basics.
 
I obviously don't want to waste your time, but being pointed in the right direction would help a lot. I do know that blockchain tech is composed of assymetric encryption, hash functions, merkle trees, key value databases, p2p protocols and proof of work concept
I obviously need a good foundation to start to understand these technologies, but wanted to know if the course list I put together is good enough or if I'm learning things that I don't need to?
 
DSM
12:13 AM
Here's the thing, though: it wouldn't help a lot. The problems you're going to encounter aren't going to be the ones you expect, and that's an enormous amount of material in that list. By the time you got through a quarter of it, you'd be more than qualified enough to determine for yourself what you'll need to know.
 
But....there's 78 rows of items there you are asking us to review and analyze
 
I'm assuming I dont need an intro to linux?
youre right @DSM
your both right
 
It depends - will you be working on Linux? Deploying on Linux? Do you already know Linux?
 
Also, if blockchains really interest you, you can also grab a udemy course. There are a few courses up there now. And here is a basic one: udemy.com/the-basics-of-blockchain
 
I'd also pick an "intro to <language>" course very early on
 
12:17 AM
I have a specialization certificate in python
that I earned last year
 
but you don't know how to increment a variable in a loop
 
yeah, because I stopped programming for about 8 months
I just picked it back up early in june
because I didnt know what I wanted to do with my life
 
frankly, I believe you'll run into a lot of unnecessary problems if you don't (re)gather a fundamental understanding of programming
 
Well you should go back and refresh your material from that course - you will use those basics day in and day out.
 
DSM
I certainly don't want to discourage self-motivated learning, but I don't know how useful trying to work backward from a very specific goal will be. I second (third?) everyone's recommendations to concentrate on relearning the basics.
 
12:19 AM
Okay, I have no problem re-learning the basics because I'm obviously weak in those areas. So I should relearn the basics of python?
and then go down that course list?
 
Yes, please don't take any of this as something discouraging.
 
nope, not at all. well, maybe a little
just kidding
 
well, I'm not gonna go through that list. If those are things that genuinely interest you. Then you gained knowledge in something. Nothing lost there.
 
DSM
We're just trying to redirect your enthusiasm along directions which we think are more likely to be productive. Obviously your mileage may vary.
 
No problem, I appreciate it. didn't know it would be quite the task, but I can see how it can be use more productively
Damn, I plan on moving to seattle so I can find work in the CS fields, but my knowledge will directly affect the position I get haha QQ
 
DSM
12:22 AM
I know very little about blockchains, but a fair bit about general programming, so I'm confident that I could work with them without much trouble. Rather than narrowly focusing on your goal, concentrate on getting the skills which will make learning about blockchains easy, and incidentally will allow you to do other things even if you get bored by blockchains after making it through a few youtube videos.
 
I'm hoping this stuff will snowball
@DSM When you mean 'Rather than narrowly focusing on your goal, concentrate on getting the skills which will make learning about blockchains easy'
Do you mean go down that list that I made, and once I get enough skills I can choose and pick what courses would best fit my skills for building blockchains?
 
DSM
You really seem to like your list. :-) First learn Python, or some other language, reasonably well, however you like. (I mean first here conceptually, not necessarily temporally -- if you want to immediately try applying basic Python to blockchain applications, I guess you can, although I think you'll find it very frustrating.) Once you understand basic data structures and algorithms, you'll be in a much better situation.
Right now you're trying to make decisions too far in the future, and no battle plan survives contact with the enemy, as they say.
 
also, your plan might change as you learn things.
and you should be OK with adapting
 
Okie doke! I will do jsut that @DSM and you're right @idjaw
 
also...most important. have fun
you're learning something you like. Remember that.
 
12:29 AM
Yeah, last year I went from algotrading to data science to machine learning to now blockchains...
but blockchains I've stuck around with the longest
the others I learned for about 3 months and dropped it
*If i dont use it, i lose it
 
good night
 
DSM
Rhubarb for Andras.
 
if I have a good foundation, are most other things easier to learn in CS?
does it snowball?
Does knowledge snowball?
 
I don't know about "snowball", but the good foundation part applies to just about any endeavor
 
don't marry to the syntax. Learn the concepts
 
12:32 AM
Most important concepts for beginners?
 
DO A TUTORIAL ALREADY!
 
lol
 
I know, i know, im starting over on my py specialization
 
you seem to be interested in Python. So, start learning Python
and when I say concepts, I'm talking about data structures and algorithms
 
ohhh okay, I thought so @idjaw :)
 
12:34 AM
almost every data structure and algorithm book I have seen always uses java as an example because its syntax is very relatable
I'm not saying to learn java...but just saying, you don't have to marry to the syntax. You can apply it to almost any language.
and in the words of a Mr. Paul
 
cool :)
 
1 min ago, by PaulMcG
DO A TUTORIAL ALREADY!
 
lol thanks guys :)
I'd kiss you if i could
 
we take payment in whisky
 
Oh yes, whiskey is always good
 
12:37 AM
I'm watching the new season of twin peaks and I have absolutely no idea what's happening.
 
DSM
You've inspired me. I have a small bottle of Crown Royal around here-- time for a glass, I think.
 
you know what
I'll join you
maybe this show will make more sense too
 
@faceless I'd check out codecademy.com :)
 
DSM
I haven't been watching, although I loved the originals. I even enjoyed Season Two, which I know is a minority view.
 
me too
I don't want to push you away from jumping on to this new season, because I think as fans of the show you should jump back in to it.
But, I do have to say, it really goes full David Lynch.
 
12:40 AM
Oh @faceless - ANYTHING but "Learn Python The Hard Way"
 
Yeah, I've heard that is a bad book to read for beginners
 
here read this
 
My course has me learning python for informatics :)
 
we compiled tutorials and specified to stay away from LPTHW
 
DSM
(long draught) Yes. This was a good decision.
 
12:42 AM
oh btw @DSM you can get your hands on the Northern Harvest very easily these days, which Crown Royale won whiskey of the year last year 2016
 
Having m'self a sip of single malt...
 
which one
 
Not from Islay tho - Dalwhinnie out of Inverness
15 year
Glenkinchie and Glenmorangie are the ones I used to drink, not sure where I got this one from.
 
very nice
 
Probably had a coupon
 
DSM
12:48 AM
LargeCanadianCity has two good Scottish pubs, both of which have an excellent selection, although wanting to keep both my spending and my waistline low means I can't go as often as I'd like. :-/
 
I thank you all for being the bad influences you are - I haven't opened this bottle in several months
 
DSM
@idjaw: I'll give it a try!
 
dalwhinnie 15 for me. Currently also have (but running low) balvenie caribbean (incredible...you should try this) and aberlour 16
drinking whiskey at pubs is dangerous. The good selection run you up a pretty penny
@PaulMcG welcome my friend....welcome.
 
One year when my son was home from college, we did Father's Day on the back porch drinking Scotch and smoking cigars, and he let me bore him with tales from my youth
He just got a job doing 3D modeling for EA
 
DSM
Nice!
 
12:53 AM
that's awesome
as a father now, I'm really hopeful to have the privilege to do that with my son when he's older.
 
Cbg @KevinMGranger - we are all drinking whiskey as a reward for coaching a newbie with our pearls of wisdom
 
I'm still at work so I'll have to wait until later. And I only have Sake, but close enough, eh?
 
and I'm hoping my understanding of twin peaks is proportional to my consumption
Sake is acceptable
 
 
5 hours later…
5:36 AM
@wim I'm surprised there isn't an easy-to-find dupe for this.
 
6:22 AM
@idjaw how many episodes so far?
 
6:35 AM
And it's accumulating answers
 
instagram is built with django
lol
 
And now that question was edited in to a new question and they removed the accept from the answer :D
 
7:29 AM
cbg guys!
i have a question. I have n statements (s1, s2,...sN). What I want to do is - if s1 AND s2 AND ... sN. Any idea how I can write a code for it?
 
Use all(list_of_results)
Provided your n statements are in a list.
If you can make a generator expression for them, so much the better.
 
@MartijnPieters actually it is a list, but of regexes. I want to do a re.search for all of them separately and assure they all have a match. So do you suggest something like-
for i in range(len(regex_list)):
	all(if re.search(regex[i]))
 
You'd try something like all(map(re.search, regex_list))
 
@vaultah thanks. and then where do the parameters of the re.search go, assuming they have to be run on different strings?
 
7:46 AM
I knew that trying to answer while still in bed was a bad idea
 
:D
Am I disturbing your sleep?
 
hah, of course not
In [8]: regex_list = [re.compile('\d'), re.compile('[a-z]')]

In [9]: def f(s): return all(r.search(s) for r in regex_list)

In [10]: f('ab')
Out[10]: False

In [11]: f('a1')
Out[11]: True
@user1993 all(map(re.search, regex_list)) was just wrong in many ways
 
and i guess I can replace all with any if I want an OR function instead of AND
 
yep
 
7:54 AM
great, thanks!!
@Sundararajan cbg!!
 
can you help me out with my query on tkinter
 
you can post your query here and if there is anyone who can help, they will
 
8:10 AM
@Sundararajan we've pointed you to the rules page before. I think it's time to reread them sopython.com/chatroom
 
replying with "maybe we can help, but it's impossible to say without knowing your problem" is honestly more tiresome than answering the actual question
 
http://dpaste.com/0TRRXBR

I've created some calculations in tkinter entry widgets. Now I just wanna clear everything out by clicking the clear button. but since the Entry widget in for loop I wonder how to use delete method to clear all the widget at once can you help me out?
 
@user1993 fyi, for i in range(len(...)) is almost always wrong
you either want for x in ... or (if you need the indexes too) for i, x in enumerate(...)
 
@ThiefMaster I generally use for i in range(0, len(list)). Why is this wrong?
 
@Sundararajan just put all the entries in a list
entries = []
for _ in range(3):
    # create entries
    entries+= [ent, a, b, c, d, const, rat, disp]
then you can use a loop to clear them
def clear():
    for entry in entries:
        entry.delete(0, END)
@user1993 Because you usually use that index to get a value from the list. A for value in list loop does the same thing with less code
for i in range(len(list)): # 2 lines, 6 braces
    value = list[i]

for value in list: # 1 line, 0 braces

for i, value in enumerate(list): # 1 line, 2 braces
 
8:27 AM
i started using that to mutate the list elements, which wasn't possible with for value in list
but then continued to use this style for other cases too. Ya, I should change it when I don't want to mutate
 
8:42 AM
if you want to mutate list elements, use the enumerate version
 
8:55 AM
Cabbage
 
@davidism: i have a test case for a flask-sqlalchemy 2.2 issue ("Can't find any foreign key relationships between"). wanna have a look later? still need to remove unneeded code but getting this solved would be great, since we are kind of stuck with 2.1 for now due to this
 
cbg
 
@Rawing I tried it, but It clears only the last row of the Entry widgets, not all the rows....
 
9:12 AM
then you didn't use +=
 
http://dpaste.com/0DYK1EH

This is my code with the suggestion you gave
 
that is... that is impressively wrong
how do I even begin to explain this
first of all, when someone gives you code, you're usually not supposed to just copy/paste it into your program...
let's think this through. You have a loop that creates Entry objects. You want to put these Entry objects into a list.
 
Just a minute I guess I got it now
One minute
 
step 1: create a list. step 2: whenever you create new Entries, add them to the list.
 
Thanks for pointing out I get it now
My bad
I was creating another for loop instead of using my own
Sorry about that. melon :-)
Its working I made the corrections
@Rawing Thanks a lot for the kind advise. will keep in mind next time.
 
9:25 AM
some thinking is required when programming :p
 
Most of the time. I miss some simple logics and complicating myself... :-(
@Rawing Thats absolutely true
 
9:59 AM
@ThiefMaster That seems like an SQLAlchemy issue, not just Flask-SQLA
 
@IljaEverilä: It's caused by the tablename generation logic of flask-sqlalchemy 2.2 (before it worked perfectly fine, and it works fine with plain sqlalchemy too)
 
Right you are. I have my own test scripts for SQLA stuff and forgot that they resemble Flask-SQLA a bit too closely at times :)
 
10:34 AM
@idjaw I guess I am going to try that poutine there @ skwiiki soon
there was a ~groupon for that, 50+ % off
 
Looks good
 
print([0, 3, 21, 144]) – No one said you would have to use the generators… 🙄 — poke 6 secs ago
 
10:53 AM
cbg
@idjaw ooooooooooooh boy does it
I'm getting stronger and stronger "2001: A Space Odyssey" vibes from Lynch, and I don't mean that as a compliment
 
11:14 AM
hello everyone i have a fast question, i have this code: `from bs4 import BeautifulSoup
import requests

page = requests.get("https://www.kraken.com/charts")
page

soup = BeautifulSoup(page.content, 'html.parser')

euro = soup.find(class_="val mono").get_text()

euro = euro

print(euro)` i want to grab the number that is in the last tag on this site: https://www.kraken.com/charts (top left) but the number is in a class called val mono but if i try that it doesnt give me the number, i noticed that the name of the div where it is in is called: last. can i only ask the Name tag instead of the
 
please practice code formatting in the sandbox
@FluffyMe I also don't understand the question
>>> soup.find(class_="val mono")
<div class="val mono" data-val="2061.992" name="last">€2,061.992</div>
if I run it, your code returns the euro amount from this tag
 
when i run it over and over again the number refreshes but isnt always the same as on the site
 
this might or might not be related to the fact that the whole site relies on javascript (I'm honestly unsure because I don't know any webdev)
 
ooh well thanks anyway :)
 
if you save the page you get into an html and open it in a browser, it has little to do with the version you see in the browser
especially since the website keeps refreshing for me...so it's possible that the "last" number is correct, but it changes by the time you look at it
unless that's fix over the course of a day
but it has just changed on the website, so no
yup, loading the page and running the script at the same time leads to the same "LAST" value
 
11:30 AM
@AndrasDeak thanks for the help :)
 
11:43 AM
@Rawing Thanks Man you have been really helpful
 
@AndrasDeak just another fast question that has something to do with my last question: how can i float the euro? because when i try this i get this error: ValueError: could not convert string to float: '€2,071.810'
 
that's because '€' is not a valid digit
but neither is '2,071.810'
 
do you know how i can resolve this problem?
 
if I were you I'd grab the data-val field of the tag, because that seems to contain the same information in a proper numeric string (rather than a pretty one)
26 mins ago, by Andras Deak
>>> soup.find(class_="val mono")
<div class="val mono" data-val="2061.992" name="last">€2,061.992</div>
there's also an API they seem to have
I wouldn't be surprised if that was more useful than scraping their pretty website
 
well forgot about that, but how can i ask the data-val in my script?
 
11:49 AM
I don't know but it shouldn't be hard to find in the documentation/tutorial of beautifulsoup
Fancy new numpy can finally take unique elements along an axis \o/
ooh, some other useful additions too
@DSM there are some really useful changes in numpy 1.13.0, although you probably have seen these already
 
12:15 PM
@ThiefMaster I have some notes for what I think needs to be done to fix tablename, just need to find time.
 
Today I discovered that InStr in Visual Basic returns an integer, not a bool; and that 16 And 1 in Visual Basic evaluates to zero.
 
:/
"I discovered", that is, after 6 hours of gruelling debugging?
 
30 minutes, but it felt longer.
 
a better question is, why are you writing Visual Basic?
 
15 year old legacy project.
 
12:33 PM
Just put "Options Explicit Off" and "On Error Then Continue" at the top of the file. (No, don't really do this.)
 
@Rawing "impressively wrong" is an achievement in itself
 
@Kevin And you are surprised about that why exactly? :P
 
Because I expect any function whose name can be turned into a yes/no question to return True/False. "In String?" is a yes/no question.
If they wanted it to return an index, they should have named it WhereInString
 
I’d guess that the function is from the time where booleans weren’t a thing yet, and when people didn’t bother that much about function naming..
 
well, you know, Microsoft. They've come up with worse names. For example if your PC boots into the Advanced Startup Menu and you click the "Continue" button, guess what it does? That's right, it reboots.
 
12:41 PM
I briefly considered the idea that it's short for IndexString but I don't want to believe it
 
@Rawing Continue continues the reboot
 
how do I convince my company to upgrade my computer? Macbook air is meh :\
 
Heh. True, it makes sense if you think of Windows as a perpetual rebooting machine.
 
@corvid Get it to break
Become a windows developer
 
I eventually replaced all the InStrs with String.Contains, which is a .NET standard collection method and therefore far less pants-on-head than any VB-specific idiom.
 
12:43 PM
it would be unfortunate if something were to happen to it... like an incident with a certain wrecking ball...
 
@Kevin Huh? You’re doing VB.NET? I thought this was classic VB
 
It's VB.NET yeah. Who knows what it started out as all those years ago, though
 
12:55 PM
I feel like I have a relatively simple algorithm but I can't find a good way to do it efficiently...
Suppose I have a position of a video stored as a variable. I want to find the nearest comment, relative to that position, but after it.
 
([c for c in commentsOrderedByTime if c.time > videoPositionTime] or [None])[0]?
 
min(comment for comment in comments if comment > time)?
 
next ((c for c in commentsOrderedByTime if c.time > videoPositionTime), None)
Don't build the whole list if you only want the first match.
 
Ah, I forgot that next can take two arguments.
Makes my hoop-jumping rather pointless
 
@Rawing I think I like where you are going with that
 
1:00 PM
if they're sorted you can also use next instead of min
 
Should be added to The Zen of Python: Your hoop-jumping will be pointless.
 
@Rawing This will only work if you can actually sort the comment objects (whatever they are) by time.
 
morning cabbage
 
@poke I don't understand. Why wouldn't you be able to sort them?
 
>>> comments = [
	('f7218c59-7c03-4667-8d1c-a5945a72751b', '12:10', 'Hello'),
	('c74e6680-227c-41b2-8db0-830ab6b289ec', '12:12', 'World'),
]
>>> min(comments)
('c74e6680-227c-41b2-8db0-830ab6b289ec', '12:12', 'World')
 
1:10 PM
min and sort will take a key function, key off the time offset in element[1]
 
well that was just some pseudocode to get the idea across, obviously. Does it make more sense if I write it as min((comment for comment in comments if comment.time > time), key=operator.attrgetter('time'))?
 
is there a shorter way to construct an empty iterator than iter(())?
academic curiosity
I just compared next(iter(())) with next(iter(()),1) and was happy
and ipython seems to print dunder methods with blue...and __file__ with dark blue...weird
 
I think a problem is the interface doesn't work very well because it requires additional logic to make it feel "human", not so much the algorithm
 
as far as I know I only upgraded numpy and scipy and matplotlib, so I'm slightly surprised at the colour change in ipython
Successfully installed matplotlib-2.0.2 numpy-1.13.0 pyparsing-2.2.0 python-dateutil-2.6.0 pytz-2017.2 scipy-0.19.1
@PaulMcG can pyparsing have anything to do with coloured syntax highlighting in ipython? :)
 
Do you mean does it interfere with it?
 
1:18 PM
no, can upgrading pyparsing affect ipython's syntax highlighting
but your question suggests that the answer is "no"
there's also the possible explanation that it has always been blue and I haven't noticed...
 
I didn't think it was used for syntax highlighting in ipython at all. If you had to install it, it was probably to support the mathtext module in matplotlib.
 
yeah, I wouldn't have thought so either
 
cbg \o
 
If I had to guess, they use pygments
 
thanks, so it's probably just that I haven't noticed it yet
 
1:20 PM
__file__ and __name__ are special module-scope dunders, not class dunders, so maybe different color is intentional.
 
so does __iter__, but I usually don't use any of these
oh, only file and name are dark blue, anyway
 
cbggg
 
I haven't noticed any blue dunders :D
It was probably a dunder blunder on my end
cbg
 
Guys, what is the difference between the python APscheduler and celery
Celery is task queue package as far as I know
I want to execute a python function at a user selected date and time and i went through all the QnA in SO and Now I am totally confused :-(
Any advice on how I can achieve this ?
 
1:35 PM
@Anarach if you're on linux, use cron
oh... user selected
 
@WayneWerner I wissssshhhhhhhhhhhh But I am not
 
well... maybe still use cron ;)
 
Yeah Windows has task scheduler so
But I want the task to run on a user selected time
 
I suppose it would help if we knew what kind of thing you're trying to do
like... do something to the local PC? or what?
 
I know that I can come up with a botched up version where python updates the Windows task scheduler but I do not want to do it that way
@WayneWerner Its a flask app which will take a user input in the form of a http request to run a script at the user specified time on the server PC.
 
1:39 PM
so, basically you can either a) use cron b) use windows task scheduler c) make your own version of those
 
For example in the web app the user will have a list of jobs and the user can select the job and set a time for it to run from the web
 
@WayneWerner yeah, that's really cool
 
on Windows basically you create a service (search python win32 api create windows service for a guide) that sleeps for a minute and checks if there are any jobs that should have been run since the last time it slept
note that you don't want to just run the jobs that are supposed to run now
because it's possible that your service died or something, so you want to make sure to run stuff that hasn't been in a while.
 
so that's anacron, not cron ;)
 
Hmm , I suppose this is the only way.. Disappointed python does not have a scheduler :-(
but what does "APscheduler" do then?
 
1:44 PM
Sure, you could use APScheduler. You could also use celery.
 
@MorganThrapp Ok so this leads to my original question, What is the difference between these two?
 
You could also use RabbitMQ with an x-delayed-message header. rabbitmq.com/blog/2015/04/16/scheduling-messages-with-rabbitmq
 
uhhhh, SO just redirected me to an error page. Pressed refresh, reloaded the error page. What's the point of a redirect there, seriously
 
Well, one is a scheduler and one is a message queue that lets you delay messages.
So if all you need is a scheduler, celery is probably overkill.
But if you think you might need a distributed message queue, then celery with delayed messages is the way to go.
(I mean, I'd go RabbitMQ, but only because I'm more familiar with it)
 
@MorganThrapp Rabbit is the broker for celery right?
 
1:47 PM
That's my understanding, yeah.
 
going to dig deeper , thanks for the lead Morgan
 
I haven't used celery, only RabbitMQ directly, but IIRC celery is basically a wrapper around some of the uglier bits of producing/consuming RabbitMQ messages.
Yeah, no problem.
 
cant believe no one has ever asked this on SO
 
Asked what? How to schedule things in Python?
 
@MorganThrapp Yeah at user specified Date/Time not a cron.
 
1:49 PM
@Rawing duplicate target of a deleted question?
if you have the link I can check
or wait until you get 8 upvotes
 
6
Q: Python - Start a Function at Given Time

microo8How can I run a function in Python, at a given time? For example: run_it_at(func, '2012-07-17 15:50:00') and it will run the function func at 2012-07-17 15:50:00. I tried the sched.scheduler, but it didn't start my function. import time as time_module scheduler = sched.scheduler(time_module...

3
Q: Python: Event Schedular like quartz

user1614526I am looking for an event scheduler like quartz in java for my python project . Please suggest me some good scheduler in Python My Requirements 1) Send an email or sms to the user after some interval Thanks !

 
@MorganThrapp I tried that but the Scheduler answer does not work with python 3 :-(
 
@AndrasDeak No, I tried to load the regex tag questions and got redirected here
 
huh, interesting
 
@Anarach Really? Because the docs link to the Python 3 version of the library.
 
1:51 PM
@Rawing the original works...
where did you find the original url?
 
@MorganThrapp It throws an error when i Try to import 'Scheduler'
I like the celery answer
Going to give it a shot
 
yea it was only temporary. I pressed reload in my regex tab and that's how I got that error
 
@Anarach Well, yeah, it's import sched.
 
Basically, finding the difference between current time and scheduled time and adding the difference as delay for the celery task :-D
 
That should work fine.
 
1:53 PM
cave man solution FTW
Thank you :-)
 
No problem.
 
Hello All!
or better CBG all!
 
cbg
 
cbg
 
I know that modules are singleton objects but can we have two different instances of same module on import ?
import datetime
import datetime as dt
 
1:59 PM
@d-coder Seems to work with no errors.
 
You are just binding another name to the same module
What does dt is datetime tell you?
 
dt tells it's datetime obj
 

« first day (2446 days earlier)      last day (2506 days later) »