How to fix massive lag on django development server? - django

OVERVIEW:
Hi, I have massive lag on my development server as long as I am offline. I'm using windows 10 pro. I have a website on my local environment at 127.0.0.1:8000/. I have a fairly high end laptop that can play high graphics games on it with no problems, and no lag, such as fortnite. But my local development server is super slow, and does not stop being slow unless I get online (even though I'm using the development server). This problem started back in may of this year, and back then I asked some other programmers who had no clue how to fix it. It had never been that way before, and I don't want to be online all the time...
EXAMPLE OF PROBLEM:
For a developed project while I'm offline: python manage.py runserver, paste 127.0.0.1:8000/ into the browser, wait ~10 seconds, then the background color shows up (no text yet), ~10 secs later some pics show up with some textless elements that have background colors, ~8 seconds after that the text shows up in portions of those elements, and ~10 secs after that the webfont and the rest of the page finally shows up.
For a fresh, brand spankin' new project made 5 seconds ago with nothing added to it: The same thing happens on the django success rocket page that pops up.
And everytime I do this, to even get the images/etc to show up, I have to click in the terminal and hit any button, like spacebar. Then every once in awhile the terminal decides to be a bro and shows a new line with a new GET or POST request (depending on what app I clicked on the page). Example:
[04/May/2018 19:21:09] "GET /blog/ HTTP/1.1" 200 59899
[04/May/2018 19:21:33] "POST /vote/ HTTP/1.1" 200 7648
[04/May/2018 19:21:33] "GET /vote/ HTTP/1.1" 200 7648
[04/May/2018 19:21:59] "GET /blog/ HTTP/1.1" 200 59900
If I'm online so the website runs fast/perfect: I noticed that if I highlight something in my terminal, the requests won't go anywhere, so I have to click in the terminal and hit any button to unhighlight it, and then it will run just fine. But when offline and nothing is highlighted, it's super slow.
THINGS I HAVE TRIED:
Full system scan with bitdefender (antivirus)... No problems found, and no improvements.
Defragged hard drive.... No improvements.
Went back to the previous lightning fast versions of my developed projects before ANY changes were made.... No improvements. Still super slow.
Ran the developed projects, and the brand spankin' new one on a different hard drive... No improvements.
Cleaned the registry with regseeker... MASSIVE IMPROVEMENTS so it will be lightning fast again, but it's very short lived (about 3-4 minutes).
Checked my CPU and RAM usage while requesting pages and clicking my apps... Nothing ever spikes anywhere even close to 100%. About 50% is max at all times with all my programs running. So I always have plenty available.
Installed Django-debug-toolbar. And my pages load fast according to it. Bigger pages take about 246ms, and smaller pages about 40ms. So the problem doesn't show up here, it only shows up in my terminal HTTP requests and on the browser window by taking forever to load.
Using python manage.py clearsessions on the database... No improvements.
A full clean install of windows 10 pro. Not the 1/2 assed install that lets you keep all your programs, but a full wipe, diaper change, and reinstall of everything. I actually did this 5 times (long story).
QUESTION:
Does anyone have any idea what's going on??? If you have no idea, do you know anywhere I can go to figure this out??? I would love to finally get rid of this bug. Back when this problem started I spent about 10-12 hrs a day for 2 weeks doing all the above, until I gave up (most of my problems were from #9). Having had some success asking quesitons here, I figured I'd ask.

Truly, the terminal gods hath smiled upon me this day!
I disabled my firewall, restarted my computer, and it works lightning fast again while offline.
If I didn't restart my computer after disabling that, it doesn't work. No idea why that is, but this bug was annoying, and I got sick of having to be online everytime I wanted to make an app.
Thanks to whoever suggested it might be something with my firewall, but later deleted their suggestion/answer.
UPDATE 10/9/2018:
I remember this problem began sometime around when I had an antivirus update. A couple days ago, I restarted my computer cause the antivirus had another update, and all of a sudden I don't get the lag anymore, even if keep the firewall on, but am still offline.

Related

DevTools failed to load source map, chart.js behaving abnormally

This is my first javascript project, so I apologize for being ignorant of basically everything.
I made a basic data site for a hobby which has been up for a couple weeks now without incident. Today however I saw that it was behaving strangely: the chart I made is stuck in a loop of shrinking to a single point, and then maximizing, and then shrinking again. The site has been made unusable.
No changes have been made to my code in 12 days, the behavior started some time in the past 24 hours. It's the same in Edge.
Chrome console:
DevTools failed to load source map: Could not load content for https://cdn.jsdelivr.net/npm/chart.umd.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
Loading that URL in Chrome shows the same, so OK, it's not there. Can't argue with facts. But I guess it used to be? Why is it not there now?
I've integrated chart.js as follows
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-annotation#2.0.1/dist/chartjs-plugin-annotation.min.js"></script>
And here's the site itself:
https://rejetme.com/
I legitimately have no idea what changed. I would appreciate any help getting back on track here. Thanks.
Ok, classic rookie mistake. Big surprise, I know. It turns out that chart.js just updated to v4.0.1 two days ago, and includes some breaking changes.
So I pinned the version of chart.js that my site uses:
<script src="https://cdn.jsdelivr.net/npm/chart.js#3.9.1"></script>
I guess another option would be to host the libraries locally, but ain't nobody got time for that. I'm going to mark this as answered.

is it possible to recover unsaved google colab notebook

probably hopeless but trying my luck here anyway.
i was working on google colab for some school project. finished most of it but didn't save because there was some error (saw red sign stating it wasn't saved)
i didn't bother myself because i leave the computer open.
today i was going back to work on it when suddenly i notice the notebook reverted automatically to it's last checkpoint which (due to that error i ignored) was from over ten days ago.
is there anything i can do about it?
seems really not fair...
):
The same thing happened to me tonight and the result of a week's work day and night was lost.
You can't do anything. Although it is not fair, if the saving is not done automatically and the codes are not saved in Google Drive, you cannot do anything.
I'm telling you this while I'm having a stroke from frustration and shock and an hour of searching for a solution

Django app performing slowly (even when cached)

Launching my second-ever Django site.
I've had problems in the past with Django's ORM (basically, the SQL it was generating just wasn't what I wanted and even using things like select_related() I couldn't wrangle it into what it should've been) -- I ended up just writing all my DB queries by hand in my views and using this function, taken from the Django docs, to turn the cursor's responses into usable dictionaries:
def dictfetchall(cursor, returnMultiDictAnyway=False):
"Returns all rows from a cursor as a dict"
desc = cursor.description
rows = [
dict(zip([col[0] for col in desc], row))
for row in cursor.fetchall()
]
if len(rows) == 1 and not returnMultiDictAnyway:
return rows[0]
return rows
I'm almost ready to launch my site but I'm finding pretty huge performance problems on the two different webservers I've tried hosting the app with.
Locally, it doesn't run blazingly fast, but I generally put this down to my machine in general being a little slow. I don't have the numbers to hand (will add later on) but the SQL times aren't crazily high and I've made the effort to optimise MySQL (adding missing indexes etc).
Here's the app, running on two different webhosts (using bit.ly to avoid Google spidering these URLs, sorry!):
http://bit.ly/10iEWYt (hosted on Dreamhost, using Passenger WSGI)
http://bit.ly/UZ9adS (hosted on WebFaction, also using WSGI)
At the moment I have Debug=False on both of those hosts (so there shouldn't be a loading penalty) and a file-based cache of 15 minutes for each one. On the Dreamhost one I have an experimental cronjob hitting the homepage every 15 minutes in an effort to see if this keeps the Python server alive -- this doesn't seem to have done much.
If you try those links you should see how long it takes for the server to respond as you click around, even including the cache (try going from the homepage to another page then back home).
I've tried this profiling middleware but not really sure how to interpret results (can add them to this post later on when I'm home) -- in any case, the functions/lines it pointed to were all inside Django's own code so I struggled to relate that to my own views etc.
Is it likely that the dictfetchall() method above could be an issue here? I use that to work with the results of every DB query on the site (~5-10 per page, most on the homepage). I do have a few included templates but nothing too crazy. I have a context processor for common things like showing album reviews, which I use all over the place. I'm stumped about what else could be causing this slowness.
Thanks, hope this is enough info to be helpful.
EDIT: okay, here's a profiling trace of the site homepage: http://pastebin.com/raw.php?i=c7kHNXAZ -- struggling to interpret it, to be honest.
Also, I looked at the Debug Toolbar stats: 8 SQL queries in 246ms (looking currently at further optimising these), but total time for render of 3235ms (locally). This is what's confusing me.

Inconsistent 'Cannot find CFML template for custom tag' error

I have a CF9 site set up locally on OSX Snow Leopard, and it's started to behave very strangely - probably about 1 out of every 5 times I load any page in the site, it will throw a 'Cannot find CFML template for custom tag' error. I just refresh the page and then everything works fine. It can happen on any page, but it never happens consistently with any one page. Furthermore, this doesn't happen at all on the live server when the code is checked in through SVN, so I figure it has to be some kind of configuration problem on my local instance. I can still do my work, but it's pretty annoying having to refresh pages ALL the time. Has anyone run into similar difficulties?
Try using <cfmodule template="pathTo/yourTag.cfm"> rather than <cf_yourtag>, so you can specify the exact location of the template (in case the server is getting confused as to where it resides).
FYI, this is based on a tip from Raymond Camden's blog post: http://www.raymondcamden.com/index.cfm/2006/8/17/ColdFusion-Custom-Tag-Tips
Chris, odd that I should run into your question now, as this just started happening to me last night. I have all of my CF errors being emailed to me, and I am seeing that similar problems are happening across multiple sites that all run the same software, some of which haven't been touched in a long time. That got me thinking, it's probably a corrupt compiled template in the CF cache. You can recompile the template by making a slight change to it, say add an extra line or a comment or something, then access the site again. Or, purge the whole cache and let CF rebuild everything, which is likely what I'll do since who knows what else might be affected.
Clearing the Cache in Coldfusion Production server

Weird issue with cftextarea/cfwindow

A while ago, I worked on an application where a manager can approve/deny xxx applications. When some body selects an action from a drop down, it opens a cfwindow and loads cftextarea richtext="yes" in there, so that they could enter reasons for approval/denial.
Now the culprit is that in production, the fckEditor has a ton of funky chars in IE8. Same thing won't happen in FireFox. Also, the IE8 does not show the same stuff in dev.
I have looked at the scripts in /cf_admin/CFIDE/scripts/ajax/FCKeditor, they are all the same.
Since this wasn't an issue before, I am not sure where to look at. Something got updated on the server which probably causes this problem. Does anybody know what could be the problem?
It turns out the vp put the header X-UA-Compatible: IE=IE7 in IIS to force IE8 emulate IE7. When I made them change this to X-UA-Compatible: IE=EmulateIE7, everything started to work perfectly again. For more details see Introducing IE=EmulateIE7.
Hope it helps others. Thanks.