« first day (2653 days earlier)      last day (2520 days later) » 

00:11
How does this room feel about the posting of videos here?
I posted one once (OK perhaps a bit off-topic) and it was removed. Yet I have found nothing in the room rules that says I should not. Can anyone enlighten me?
Yeah something in mind like that
I just don't want to break room rules.
Then I suppose if there is nothing written down about it (or I can't find it) then I guess I can do it : )
00:31
Anything in moderation, Simon
What is that supposed to mean?
It means that you can post what you like, as long as it's within reason ;)
Sounds good to me : )
Not posting any videos yet. It's just for future reference.
@MoinuddinQuadri... "Mr coldspeed"? :D
:D :D
Was playing up with you :P
early morning late night cbg!
00:39
I'm a few years too young to be called Mr, although I quite like the sound of it
You'll get used to it once you'll get out of the college. It is the second good thing to hear with name, first being gentleman.
 
1 hour later…
01:46
How true ; )
Rhubarb everyone.
Zzzzzzz
 
4 hours later…
05:56
Everyone sleeping?
06:07
Sleep? Who needs sleep?
I'm having issue and solutaion is might be clear in front of me
I cannot sleep; I am single-threaded.
@JennaSloan Yea! Glad I'm not the only one up.
Got it fixed on my own
Now working on something else
Is this function just running a command via shell? Is this bad form?
def rotate_image(input_file, output_file, angle=90):
"""
:param input_file: str
Path to image to rotate
:param output_file: str
Path to output image
:param angle: float
Angle to rotate
:return: void
Rotates image and saves result
"""

cmd = "convert -rotate " + "' " + str(angle) + "' "
cmd += "'" + input_file + "' '" + output_file + "'"
print("Running", cmd)
os.system(cmd)
The full code can be found here:
https://github.com/mre/receipt-parser/blob/master/importer.py
06:20
@Moondra mre? Like "meal ready to eat"?
@JennaSloan I don't think so. I'm just going random people's github repositories to get better at coding.
 
1 hour later…
07:23
cabbage
08:02
Sorry, wrong link (that goes to an answer). I mean this one: stackoverflow.com/q/45687725/4909087
08:16
@JacobWood Thank you. I'm not too familiar with security loop-holes or RCEs but are you saying the above used method has security loop-holes if being included in an externally facing application? It seem to be calling an external program tesseract via the command line, and adding some flags. Would it safer to use argsparse to get the flags for the tesseract command? Subprocess could also be used to calll tesseract, and I think we can add flags via subprocess if I'm not mistaken.
That would be a safer route? Thanks.
08:26
@Moondra Noticed you mentioning subprocess yourself.
@JacobWood Or simply not use os.system and be done with it...
True, iirc using shell=True has its own issues to cover.
Hello
Cabbage
08:42
Cabbage
Can you tell me if you like my website's style? nasom.svcdev.com/shareweb
Test the login and register forms please
Tell me if they work
@Oqhax The login failed (server 500) for random user id & password.
OK, thanks. Could you try with correct ones, to check?
And the register page isn't opening now
reload
08:49
Ok wait, it just did
The login does not work very well
@Oqhax I'm on my phone and can't do what I'm expected to do about it, but why are you not testing the site yourself? You don't really need help with something so trivial.
@Oqhax Yeah, it worked at least the part where I got the alert message. Other than that the register & login options don't hide when I've already logged in.
@vaultah I have already tested it myself a million times. I just want to know if any of you like it.
Thanks.
@vaultah I suppose he wants someone to break his website. Testing is an art :-p
08:54
Yup
@Oqhax how many of people liked it the last time you posted it here? There hasn't been many changes since then.
Have you even seen it? I have made lots of changes.
Says the dev to the management...
:-p
All this seems vaguely familiar...
@Oqhax what does this have to do with Python
08:56
Cabbage
@Oqhax yes, it's just as empty as it was before.
I'm using flask login now. The website is on Flask.
Yeah, complaining and you keep entering right?
Someone from Russia, Finland.
UAE
@Oqhax me me me
ok
I have the flask app running in the terminal
09:57
"how many of people", "hasn't been many changes" Good God, vaultah!
I know that feel. Sometimes the brain and the fingers on the keyboard just aren't synchronized...
stackoverflow.com/q/48354561/1222951 dupe. low-rep people are posting duplicate answers
 
2 hours later…
12:06
weekend cabbage
12:27
cbg
@JonClements I was wondering if you had an idea as to why all([]) returns True and not False...
Because it's a check if "any element isn't False"
and there are no elements that are False
It's interesting to me, because bool([]) is false, but all([]) isn't. That's just something I'll have to accept
Well... an empty container in a boolean context is False
You have to think of all as "are all objects non False"
Therefore, an empty sequence is True, because there's no False-y objects to check
12:49
I see. That sounds reasonable
it does make sense... just not immediately :)
I wonder if that would make a sensible Q&A...
I know it was asked before
@cᴏʟᴅsᴘᴇᴇᴅ see the really quite "abusive" stuff you can do with iterators and any/all at stackoverflow.com/questions/16801322/…
13:09
I've seen this one before. The any(i) and not any(i) is nifty
I already have that upvoted. Good ol' times :D
cgb.
op, rubarb.
XD
13:26
Can't believe that was over 4 years ago
14:08
Cabbage
Cbg
Three cabbages all in a row ; )
14:24
ahh... poor show indeed... think we've got ~20 before... :)
@cᴏʟᴅsᴘᴇᴇᴅ that's actually the math definition. "Every six-legged elephant flower smells like rainbows" is a true statement assuming |{six-legged elephant flowers}|==0
14:48
1 message moved to Python Trash - The Rotating Knives :v
 
2 hours later…
16:32
cbg
quick question
what is the difference between import socket and from socket import *, please?
thanks
The former gives you access to everything inside as socket.thing, the latter puts every thing into the current namespace. Never do the latter (almost never)
@AndrasDeak what you mean by puts every thing into the current namespace?
16:48
Another way to Intuit why all([]) is true is to try writing all() yourself in the usual way that you might have done before learning all() existed
Is anyone familiar with the DAO-pattern? I'm having trouble wrapping my head around it. I'd appreciate if someone could discuss it with me
@MartijnPieters duplicate of another question you answered: stackoverflow.com/questions/48358231/… :-)
I use it as a target all the time.
@Rawing What about it is giving you difficulty?
@AndyK if socket.py defines foo, the former gives you socket.foo, the latter gives you foo.
Open a REPL and compare import itertools; itertools.product vs from itertools import *; product. And check the namespace with dir() in both cases
@MarcusAndrews The problem I have is that I don't know what to create DAOs for. IMO, it would make sense to implement exactly one DAO in an application. But it seems like people usually implement one DAO per database table. For example, if you're writing a library application, I would implement a LibraryDAO, but others would split that into BookDAO, ComicDAO and NewspaperDAO.
I can understand the point of having a class that's responsible for data persistence - but I don't understand the point of having three classes responsible for data persistence
16:58
let me help you with that
Thx
I can easily implement saveBook and loadBook and saveComic etc. as methods in a LibraryDAO. For what reason would I want to implement a BookDAO?
@AndrasDeak thanks
@davidism bah, I knew I should just have searched. :-P
@Rawing To my understanding you could do that if you wanted -- it's not a strict one-DAO-per-table concept even though it may manifest itself that way in certain applications
The general idea being to tailor it to your use case / hide implementation details
17:15
I just don't see any benefit in splitting the implementation into tiny chunks and hiding them away in different classes. They're all connected anyway - if you ever switch to a different batabase, you now have to rewrite 3 DAOs instead of just 1. You also have to instantiate all 3 DAOs with the very same database connection, otherwise they probably won't even work
(i.e. if any of your tables have foreign keys, you have to save both of those tables in the same database - you can't save books in database A and comics in database B)
I literally don't see any advantage in implementing multiple DAOs
... actually, maybe I do. A terrible suspicion just popped into my head. I'm gonna go ask the java room about this...
I bet this is the java replacement for mixins: composition instead of inheritance
o-m-g
today: horrible horrible horrible.
I wish there would be something like automatic IP ban for anyone for 1 day who posts a code request :(
17:53
@JacobWood Ah, I see what you mean about the security risk. I will have to look deeper into this subject. Thank you.
18:21
@Rawing To give you an example, I wrote a fitness app that uses DAOs. I'd have an ExerciseDao, a RoutineDao, a FoodDao, a MealDao, etc, etc, etc -- in this case it made more sense to keep them all separate to satisfy single-responsibility principles. So then I could write more generic classes that instantiate a RecyclerView of items that read in values from an arbitrary DAO without needing to care about what kind of database it's using, or messing around with SQL syntax, etc
18:49
Is there a way to speed up this code? I can't tell if my laptop hardware is old, or maybe there is a more efficient way to do this. I'm looking for duplicate images through hashing and deleting them. I have 10,000s of images.

https://pastebin.com/sqguQXKh
19:02
@MarcusAndrews Do you encapsulate all those DAOs into a single class (let's call it PersistenceLayer) with loadExercise() and loadRoutine() etc methods? Or do you just use the DAOs directly?
@Rawing The framework I used was called GreenDao -- here is what my ExerciseDao looks like pastebin.com/FycYhR7r (it's autogenerated by GreenDao) and the AbstractDao pastebin.com/UwPv6zLq
Thanks, I'll take a look. (That's a lot of code o.o)
19:24
Hey guys so I'm doing an interview in a couple of days and I was wondering if anyone has a good resource understanding how to use hashtables in various problems (in python if applicable)
19:57
You'd be far better off studying a general intro to algorithms course.
That'll help you to understand the strengths and weaknesses of hashtables in general and the Python dict implementation in particular.
Okay cool yeah i'm working on like hacker rank right now but I always feel dumb when im just like straight up "I don't know how to do this"
cbg
@MartijnPieters Do you have any recommendations for algorithms books in Python?
I would probably not focus too much on finding something so Python focused
But in general algorithm and data structure books that are highly rated would be beneficial here
@Alioo Any problem in particular you're working on?
20:10
@idjaw My problem is I only know Python. So I could try to implement them in Python, and then when I get stuck I can always look up the correct way to implement them.
I feel like that would help my Python skills in general as well.
@idjaw Thank you, will check it out.
It's fine if you only know Python right now. A lot of these books always use Java to illustrate the examples because it is probably one of the 'easiest' languages to translate in to your language of choice
at least that's what I found....
@Marcus Andrews I have this problem i am working on right now, find all possible a^3 + b^3 = c^3 + d^3 permutations
And a suggestion in the problem is to use a hash table
but i'm kind of stumped there
@Moondra The theory and concepts are fairly universal, so finding a solid algorithm book would be a good choice.
Like I can brute force that but it is literally O(n^4) and that is nasty
@idjaw Thank you. I will check out the book your recommended.
20:16
np
@Moondra Sorry, nope. I just ploughed through the MIT course (ocw.mit.edu/courses/electrical-engineering-and-computer-science/…, I think there is a newer version of it now).
@Alioo Are there any restrictions on the ranges of a, b, c, d?
0 to 1000
Hehe that's important
@MarcusAndrews do you have Keybase chat, or an email I can use?
@MartijnPieters Thanks. Will check it out =)
20:24
you can post it then remove it, I can look at the message history
@Alioo You can loop over a and b and compute every possible cube-sum and then tally them up in a hashtable. This way you can look up a sum in the hashtable and see how many (a, b) pairs corresponded to it
Ohhhhhhh I see that makes sense!
So that goes down like what a^2 + b or something
or wait
n^2
@MarcusAndrews thanks, check your email, join us :-)
20:48
how can I convert the target of MNIST dataset to digitize number?
[False False False False False True False False False False]
[False False False False False True False False False False] ===> 5
@Ahadaghapour What would [False True False False False True False False False True] be? 15?
find all the indexes where True and then add them?
@MarcusAndrews the target of MNIST dataset
for example that show the 5 number
is there a function for it in sklearning or not?
 
2 hours later…
22:31
I'm disappointed that Python else if statement invalid syntex error turned out not to be a typo question. What a misleading title.
sopython.com has been updated to v1.7
9
Hey, has anyone ever experienced an issue of what seems to be ConfigObj not being able to find the settings file, even though it exists? I've checked configobj.py and it seems to fail here:
It should evualuate if os.pathisfile(infile) as true. But it actually fails on the first 2 if statments
I just realized I linked the wrong question in my comment up ^ there. I should probably get some sleep.
I meant, if and elif, not the first 2 ifs. Sorry.
22:38
Please use dpaste.com for large blocks of code.
Alright, thought it wasn't that big, sorry :P
Relevant code: dpaste.com/37JH5BP
Is infile an absolute path? If not, are you sure it's relative to the current working directory?
infile is relative, it contains just the actual filename. I tried setting the absolute path, it didn't work. Could it be some sort of permissions issue?
What does "it didn't work" mean? How do you expect us to know what the permissions on your machine are?
Please see mcve.
Did you try debugging? Did you check what infile and os.getcwd() is, and make sure that file actually exists?
Right, it's throwing an error claiming it can't find the specified section (settings section), that is, because it can't find the actual file and it creates an empty settings object.
Permissions look ok: -rw-r--r--.
I did try debugging, it fails to find the file.
I'll try that last bit, thanks!
22:50
How did you jump from "it can't find the actual file" to "creates an empty settings"? How do you know it fails to find the file? What is "it"? There is no settings object in the code you've shown.
Again, MCVE.
I stepped through the code with a debugger, it goes into the else statement and proceeds to create an empty file with the same name.
From line 10 on, in the link above ^
But I think I know what's happening, it's the cwd! I should have thought about that earlier, damn :D
I assumed CWD would be the parent directory of the main file, apparently, it's not.
Thanks for your help!
cwd stands for "current working directory", the directory you're working from, not "parent directory".
Mhm, it makes perfect sense, I just assumed something without verifying and never even thought about it.
Until you mentioned it, that is
It will never stop bothering me getting a dv with no explanation. ever.
I accept this.
23:05
Yeah, I got one on this answer, the only reason I can think is because the answer was "you have to do a bunch of manual stuff to support your weird format" stackoverflow.com/questions/48288322/…
haters gonna hate
Ouch. The worst thing is, you can be reasonably certain that the downvote is coming from the OP... and they don't even bother giving feedback to the one person who left an answer
OP said it wasn't them
OPs are famous for their credibility
lol
23:13
Could also be stategic downvoting
I always suspect the other answerer. I've had a couple apologize afterwards hehe.
Are people discussing a stray dvs on answers? Well... I get 1-3 dvs on 0 vote answers daily. Those answers can be found if you sift through my profile and go a few pages back, so it doesn't seem innocent to me.
Also, cbg ;)
cbg
Surely that's because your answers are bad ;)
*hides*
I don't think they are :p
23:30
Hello all. Is this the right place to ask about the Numpy C API? It isn't Python, strictly speaking, but I have a few concerns that could be cleared up from someone familiar with numpy's implementation.
so I put together a container that runs privileged to allow a docker in docker to jail in my CI tests to not pollute my global CI runner space. Typically I avoid escalating privileged calls like that for docker. But, I feel like in this case it would be acceptable considering it
is in a 'safe' environment for testing purposes
Any CI nerds who happen to see this, would be cool to know your thoughts on this
@Kajelad it certainly is (aside from SO main). There are a few hard-core numpy regulars, I don't know about C API knowledge but can't hurt to try. But there's usually more traffic on weekdays
23:51
Very well. I'm currently looking at the numpy-dtypes repository, which contains some examples of using the API to expose user defined C objects. My hope is to eventually define high precision numpy dtypes using this setup (e.g. by starting with gcc's __float128 and quadmath library). Would a built-in C type with no internal structure have to be dealt with in an entirely different way, or is it simply a matter of not defining contents/etc?

« first day (2653 days earlier)      last day (2520 days later) »