« first day (3936 days earlier)      last day (995 days later) » 

12:43 AM
Can you explain a little more about manipulating sys.argv?
 
1:35 AM
cbg
 
 
5 hours later…
6:29 AM
Hello, everybody! Excuse me... Do you have cudnn_ops_infer64_8.dll? This file is in nvidia site. but my google account is repairing. Help me, thanks.
my skype:live:.cid.4e33278116661f51.
 
6:45 AM
@CodeBoi Are you absolutely sure this practical approach is what you want to do? Optional content is usually done by including the source code anyway and using extras_require to pull in the dependencies only when desired.
 
6:57 AM
heyy uhh im using tkinter to build a basic car maintenance tracker. would the shelve module be the best use case for data persistence? i figured a relational database would be overkill. im just trying to track a few values at most, like the mileage which the last oil change/transmission fluid change/etc was recorded...where i would be able to call up these values and perform calculations on them and output to the gui
 
hm. i'd say that sqlite should be perfectly fine, or if the data is really simple, you could say that even shelve is too complex, and a simple json file would suffice.
shelve will probably be fine too, but it just feels like one of those modules that doesn't solve a clear problem in this case which couldnt be solved by sqlite or json. reading the docs, it seems like it might be worth considering for saving python objects themselves, but i don't think you need that functionality*
 
that makes sense. i'll go with sqlite3 then, thank you very much
 
7:40 AM
cbg
 
cabbage
 
8:23 AM
Hey guys I am trying to automate an ETL workflow I am curious if anyone here has any advice I have been trying to work with Airflow, however this is coming across as extremely complicated and wondering if there is a better way
 
 
5 hours later…
1:12 PM
room is pretty silent so far
 
1:40 PM
Morning? ¯_(ツ)_/¯
 
good morning
 
@JoshZhang welcome! :)
 
1:58 PM
Thank you!
 
2:22 PM
cbg
 
Could I extrapolate Big O notation from time measurements of should I try to break down each algorithm instead?
 
I suppose you could alter the input size and collect measure the runtime; then run some sort of regression on it to figure out the shape for big-O, but you'll need to be careful about caching and other confounding factors. Probably best to stick with paper or at least include it in a validation loop
 
For each algorithm I have 10 different input size with 200 samples each, I hope that can be precise enough. I'll try to do it on paper and have a regression just in case for an approximation. Thanks.
 
You can't objectively derive big O complexity from runtime measurements, because an algorithm that takes N + factorial(N)/googolplex time to run will appear to have O(N) performance for any reasonable N, when in reality it has O(N!) complexity
To put it another way, there are an infinite number of ways to draw a curve through a discrete collection of points, and there's no way to determine the "right" one
 
@Kevin Oh okay I understand.
 
2:34 PM
there are some claims made about (the tags) setuptools and distutils here (but you might need to read the whole meta thread and the SO post). I have no idea what is right and wrong here. Could someone from this room who knows what that is about chime in there and maybe provide links that clarifies the similarity or difference between those tags?
 
None of this is to say that there's no practical value in taking time measurements. Time measurement is quite useful. I just don't think big O needs to get involved.
 
@rene hey. The easy answer is that they are different things: distutils is in the standard library, while setuptools is third-party.
 
@Kevin Yeah I had those time values to compare the algorithms. I thought big O would have added more objectivity to the comparison.
 
@rene this comment was left by one of our regulars who knows what he's talking about, cc @MisterMiyagi. So I'd say domain expert eyes are already there to some extent.
 
@AndrasDeak I got triggered by is going to be dropped from the standard library in some future version which seems like a bold claim but I have no idea how Python goes to vNext.
@AndrasDeak okay, thanks for checking!
 
2:39 PM
python bumps versions fairly regularly, but such warnings usually persist for many years
@rene but yeah, distutils itself says that one should use third-party setuptools (or something even newer). This doesn't change that if an ancient question asked about tooling that's now legacy, it's wrong to retag
which is pretty much what Miyagi said
thanks for the heads-up
 
Yeah, most of the debate is now about the tags which I would say: the retag was not needed either ...
 
yup
 
2:57 PM
Hi there, I am stuck in my Django project.
I want to implement rating in template. rating is int value coming from views.py
I have written a condition {% if rating == 4 %} 4 rating {% endif %} but where do I show one more rating because it's out of 5?
 
Presumably you can put {% if rating == 5 %} 5 rating {% endif %} right under the existing rating 4 condition
 
Is there no {% elif } then?
 
Shrug
 
Today everyone gets bronze-tier service, where I try to extrapolate the behavior of an interface only from the details given to me
 
3:02 PM
views.py giving a json format and I am using it in a for loop django template
 
@Kevin that's an awfully dangerous amount of data to extrapolate from :P
 
loop will generate like above image rating
 
@NIKHILCHANDRAROY at this point I can't help but note that you won't get any meaningful help without an MCVE, because your messages barely seem to have any connection with one another.
As a regular asker here you must be familiar with the concept.
 
When you only have one data point, you can draw any trend line you like!
 
I can implement gold background star but others I am unable to add in if elif condition
 
3:05 PM
Suggestion: don't use conditional logic, just use rating number of gold stars and 5 - rating number of empty stars
That's all I can do without an MCVE.
Not that I could do more with an MCVE, but other, more django-oriented users might.
 
how to make a for loop with range in template?
 
Interesting.
 
If you can't get an if-elif condition to work in your project, perhaps you should read some tutorials so you can get a hang of the fundamentals. In the long run it's more efficient than trying to communicate the problem to befuddled users like myself
 
I am not very familiar, don't mind.
 
 
1 hour later…
4:15 PM
@NIKHILCHANDRAROY Why can't you just reference { rating } directly?
In jinja it would just be {{ rating }} rating. I know there's some differences between the template languages, but I'd be surprised if you couldn't do that
 
4:56 PM
im trying to download Bhavcopy file (csv) from nseindia.com/all-reports , if i click download, it allows to download but if i try to access the url directly it says access denied, I even tried setting user agent in curl, but no luck
requests.get("https://archives.nseindia.com/content/historical/EQUITIES/2021/JUL/cm26JUL2021bhav.csv.zip")
<Response [403]>
 
Try sending a User-Agent header
 
@pythonRcpp Didn't you need to log in during your session?
 
>>> headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36"}
>>> requests.get("https://archives.nseindia.com/content/historical/EQUITIES/2021/JUL/cm26JUL2021bhav.csv.zip",headers=headers)
<Response [403]>
@AndrasDeak Sorry i do not understand what you mean by session , no login is needed for this url, clicking the downloading link allows to download, but openeing same url gives permission denied
 
I can download archives.nseindia.com/content/equities/… from the browser... and with wget.
OK, I can repro with your csv on that page...
 
the one you can download, even i am able to download with normal wget
 
5:05 PM
yeah
 
somehow website is able to detect when downloading through some automatic way of wget/ curl/ request even if we set headers
 
My magic 8-ball says "cookies"
 
If all else fails, examine packets in wireshark
 
It's exactly as reliable as a magic 8-ball because I don't know anything about web development
I have 0 cookies from nseindia so probably not
 
This is another one of those "make random guesses with no feedback other than 'it didn't work'" problems that I love so much
 
5:09 PM
hey, i have a message displaying in my tkinter GUI. history_msg.set("Oil change: {} \nTire Rotation: {} \nSpark Plugs: {}".format("?","?","?")) instead of the ? i want to display the mileage of which the last of each maintenance was reported. i have the info sitting in a sqlite3 table with 2 columns, the maintenance type and the miles recorded. how do i display this info
 
If you paste the link into your browser you should get the same "permission denied" page.
 
yes
but clicking on download opens the popup to download the file, as if everything is normal
 
@owwix you'd replace the "?" with your actual data, I presume
 
yes im wondering how i go about that
 
use .format(last_oil, last_tire_rotation, last_spark_plugs)
 
5:14 PM
Have you successfully read the data from the sqlite database?
 
no i have not
thats what i am trying to do
okay so i do that andras, next step i have to read the data into the variables??
 
user16280768
Hai, Here is the code to extract feature from video and saved into H5 file , if i give 2 video's both videos features saved into same h5 file But i expect To save and generate individual H5 file for Every video How to do that
 
@owwix No, you read the data first.
@Harry that's a lot of code, please use a code paste service instead
 
okay so i create the variables, read the data into the variables, and then use them?
 
@owwix reading the data into the variables is creation, but yes.
 
5:17 PM
So the question is just "how do I read data from sqlite?", then? How is the problem related to tkinter?
 
It's Monday, isn't it?
 
lol still learning how to ask questions i guess
first ever project
 
@owwix these things need practice :)
Just break up the huge task into very small, actionable steps you can ask your computer to do.
In your case:
- I want to put these "last maintained" dates in this format string
- so I need these "last maintained" dates
- for that I need to read some data from the database
- to be specific, for each task I have to find the last maintained date
so you'd go in reverse order to implement your code:
1. think what data you need to figure out the "last maintained" date, and query that
2. compute the "last maintained" date for each task
3. put them into your string
depending on your app it might even make sense to store the "last maintained" date when you input data
(but realistically if a given database is related to a single car then it's not likely that it gets too expensive to find the last maintained date each time from scratch)
 
thank you very much
yeah right now im working with one car
maybe ill expand it one day lol
 
and if you want to find the last maintained date for a given task, you'd have to query the rows that have the given task, and find the latest item (depending on the DB engine this might or might not need to query all the rows; I don't know databases either)
 
5:26 PM
It'd just be ORDER BY some_timestamp_field DESC LIMIT 1 as long as your timestamps are using ISO 8601 format.
 
Don't you also want to keep track of the date of the events? Things like oil change usually have a "distance or age" limit
@roganjosh for now they are miles, so it's easy
 
yes im just doing miles now so nothing too crazy
yes i do but im trying to do baby steps
 
yeah, sure
it won't be too hard to extend in this direction later
 
cool, thank you :)
 
Side note; I spotted you asking between JSON and SQLite earlier on but didn't have time to respond. You definitely picked the better of the two approaches - once you start with JSON you can end up backing yourself in a corner
JSON will have to load the whole file into memory on every query, so it doesn't give you scope to expand as you are suggesting you might. Once you start with SQL, at least you know it'll expand (plus it's a really valuable industry skill to be able to write SQL)
 
5:30 PM
yeah im excited to get the basics of it under my belt
i have another question. im a little confused on when to open and close my db. do i just open it in the beginning of the program and close it at the end of it??
or do i open and close it every time i want to use it
 
That really depends on the stuff you're doing. It can be handy to use with blocks to start a connection and ensure it always gets closed, even if there is an exception thrown. That doesn't mean you can't execute multiple queries inside that with block
Opening and closing connections is pretty cheap unless your queries are tiny
 
by cheap you mean they arent memory intensive?
 
I mean that they take almost no time to set up. And their memory footprint is negligible
 
oh ok. so say i have different functions that update the recorded mileage for various maintenances. would it be best practice to open and close the db within each function
 
@roganjosh Many database drivers offer a context manager to achieve precisely that containment.
 
5:48 PM
Is that different to a with block?
Is this something on the RDBMS side that you're referring to?
 
last_recorded_oil_change = cursor.execute("SELECT mileage FROM miles_log WHERE maintenance_type = 'Oil Change'")
am i going about this wrong?
im getting an object not an int
 
You will always get results back in tuples
 
ohh yea
im getting <sqlite3.Cursor object at blahbalbh>
 
Because you need to use fetchall() unless you're iterating through the cursor result
I think it might be better to do a bit more of a tutorial on this. We can't guide you through every step; I'm happy to answer questions that you find yourself stuck on, but you will need to do some research yourself on these
 
oh i see
maybe fetchone() will do better? im only interested in one row
ive done sql tutorial before
just implementing it for the first time has my brain doing jumping jacks
 
5:58 PM
That won't work; there's no guaranteed ordering to the results from a SQL query unless you specify ORDER BY so you could end up getting different results. I gave you the ORDER BY portion of the query earlier (though assuming dates; it doesn't matter)
 
makes sense
thank you
 
@roganjosh Nope, I hadn't realised it was you when I wrote that :D
 
It would help if SO chat made the distinction of inline code-formatted words easier to tell! :P
I often struggle to see if someone has formatted a library name or something. Such subtle difference in font
 
@roganjosh I want to add html tag with rating design not simple number
 
@holdenweb In any case, off the back of that, I found this. Why does psycopg2 always have to break convention?? (a later answer shows that it should now be fixed)
DB-API: `executemany` is an efficient method for bulk inserts
Psycopg2: Screw that; round trips for every iteration of the query!
... Psycopg2: Right, we'll add some fast helpers

DB-API: Context managers to ensure connections are closed
Psycopg2: Screw that, make them use a `finally` block!
... Psycopg2: Fine, we'll close the connection as expected
 
6:09 PM
@roganjosh Can I interest you in a customizable userstyle?
 
It's not even fixed! Yam, that's a lot of code I need to go and fix now :'(
@Aran-Fey Oh, neat, that looks really useful. Thanks!
 
Ugh, I've got that annoying bug with the jumping links in the transcript again. Time to fix it for the 128945th time...
Anyway, installation instructions:
Jun 22 at 14:44, by Aran-Fey
@inspectorG4dget Install the Stylus extension, then follow these instructions
 
psycopg2 provides a connection context manager. Are you sure you aren't letting your dislike of it (engendered by way more knowledge of its internals then I've ever acquired) bias your vieew?
 
i figured it out. one more question though that i cant seem to figure out. when i display the mileage in the GUI, it displays as (0,) where it should just be an int 0
 
They even slate it in their own docs for executemany
 
ohhh im seeing a tuple with just one int
ok ok thank u
 
When in doubt: print(type(obj), repr(obj))
 
illl be doing that
thank you for the help by the way. you too roganjosh
 
have fun coding
 
@NIKHILCHANDRAROY Ok, but presumably this template takes a number of stars that you want to be highlighted vs. greyed-out?
 
6:32 PM
@roganjosh :D
 
I've read this multiple times now about the psycopg2 context manager and I don't understand it at all. Why wouldn't the transaction get rolled-back on the cursor level and not the connection? That warning at the bottom baffles me. Unlike SQLite3, you can't actually execute queries on the connection, only the cursor, so why does the connection do the rolling back? Baffling
Cursors are the ephemeral beasts here for executing queries. Let them die and roll it back... and then let the connection die at the end of the context manager that is associated with, hey, the actual connection. Mess.
 
6:53 PM
The same connection can have many associated cursors, all contributing to the same transaction. The connection seems to be the logical place to rollback. A single process can use multiple connections to implement parallel transactions.
 
7:10 PM
In that case, it's going to make me very foolish when I next go back to the office :/
Presumably a context manager can propagate exceptions upwards. Would it not make more sense for with connect() as conn to start the connection and then let a cursor exception (in its own context manager) bubble up? Then you could still terminate the transaction and close the connection
I guess I'll need to think about this a bit more, but I find it super surprising that it doesn't close the resource
 
Yeah I don't get the reasoning either
I suspect it's a "rock and a hard place" design choice, owing to the fact that there are three resources being managed (connection, transaction, cursor) but they don't want to force the average user to enter three separate with blocks just to do one query.
 
7:30 PM
Even though that's easier than ever with the New PEG Parser! (As seen on TV!)
 
I don't know why "force the user to clean up manually" is the only other possible design, but I assume there's a good reason
Or if not "good" then at least "a reason that makes sense when you're five XY problems deep"
 

« first day (3936 days earlier)      last day (995 days later) »