Is it possible, within an asp.net page, to the get time at which point that page was last compiled?
I would like to distinguish between when a page has been delivered, and when that page has been updated, compiled, and then delivered (typically there's a slight delay, but a compile timestamp would make things a bit more concrete).
Ideally a simple solution exists, it's not particularly critical but a bit frustrating when during development we end up refreshing a page x times before the recompiled version appears.
cheers :)
As suggested in the comments, it's likely that this is not possible. I want to close the question but also feel it's useful in case someone searches for similar to know it's already been asked.
Related
I am building an asp.net web form in visual studio.
In aspx page i hit some keys in keyboard by mistake.
Now an unknown mark added next one of lines.
Here is the image :
What is this mark and how can i remove it?
When i click on it nothing happens.
This is really annoting...
That is what we call a bookmark.
I often use these. Say you in a middle of a routine. You KNOW you want to go some other place in code - look at some code, maybe grab some code. Now, how to get back?
Bookmarks!!!
from menu you see this
edit->bookmarks:
so, I often will bookmark. Then go on some code rummage hunt, whatever.
Now, to get back? Well edit->bookmarks->next bookmark.
Or ctrl-k, n
So, you can "toggle" the book mark (make sure cursor is on same line).
(so it toggles - you can toggle again to get rid of one).
Or, you can clear all of them in your project:
edit->bookmarks->clear bookmarks.
In fact, I used bookmarks since the old Vb5 or even earlier days.
Even Access + VBA editor has them, and quite sure every IDE from Microsoft has had this feature - for a very long time.
(I don't point this out to be condescending, here and much apologies if I have come across this way - I "only" wanted to share this with readers and you - a long time feature)
So, some love this feature, some don't care.
But, it is handy, and this is especially the case if I have to go search, look at other code modules etc. It can be rather hard to get back to where you were!!!
And I often used them when in a routine that is WAY TOO long and there are way too many routines say in that one big monster class or whatever. so, late nights, pots of coffee going, mind is tired (we all been there!!).
So I can book mark, and now go say ctrl-f to find.. find what I am looking for, and now jump right back to the book mark.
So, for sure - what the heck is that thing if you not seen them before?
So, no worries! They are a really - but a really long time feature of all Microsoft IDE's - as noted going back to even pre-.net days, and pre-.net editors.
It still a great little feature - and one that I don't use a lot, but without question, when I'm in the middle of some hairy cat ball of code? Then yes, I still use them. And I used them for at least 20 years now, and even before I became a regular user of Visual Studio.
Especially Ctrl+I , which is "mail this page". I'm using wordpress self hosted. So far I've found this code, not sure how to implement it or if it's old.
Please no plethora of reasons as to why you find this attempt pointless.
Really, shouldn't answer, but:
There's no reason for this, because there's always a very easy way around it. It'll probably take a lot more work than whatever you end up with's worth. If somebody has half of a computer literate mind, they probably can get past this without a problem at all.
Summary:
Don't bother
Disabling hotkeys won't stop anyone from just selecting that option from the File menu.
People will always find ways around these kinds of hacks. Turning off JavaScript, hacking the source with Firebug, Option+Click on a Mac, taking a screenshot, etc. They are completely ineffective against anyone even slightly determined to do what you don't want them to do.
You can't really do that. See this page for really good information on the portability of various key events in JavaScript across multiple browsers. You will see for one that each browser handles/responds to various key events in many different ways.
Also, most of the default browser actions (e.g. Ctrl-F, Ctrl-S) cannot be canceled if you are capturing key events. You can still detect some of them and respond, but you can't actually stop the browser from displaying the search dialog or whatever specific action is to be performed by the key combination.
Also, if someone really wants to take your page's HTML/JavaScript code or content, these methods won't stop them. The disable right click code from the link you referenced can prevent right click, but all someone has to do is disable javascript and it no longer works.
While developing a website I experience a weird bug.
From time to time my images or my css are missing.
It's not really predictable and therefore not reproducible.
Usually it happens after I edit my css, save it and reload the page (in the browser).
It's always syntactical correct CSS, so no compilation erros or anything similar.
I think it's the way Grails updates the running application, but I really can't say why or where it happens as it is quite rarely, but definitely annoying.
It doesn't matter if I run the application with my IDE (IntelliJ 9.0.4) or with the commandline (Windows).
The only thing I did not test so far is whether it happens only when I use the IDE or not.
Did anyone experience this?
EDIT:
Sorry for an unclear description:
"missing" means the browser is unable to load the corresponding ressource: "The Ressource () is not available"
Another Edit:
Thanks for the comments so far.
In addition to my main css-file and my images, which change quite frequently, my reset-css-file disappeared. I never touched it since creation, so I think one can exclude the compilation-script as cause of this mess. (further info in the comments)
Like John Smith I arrived here googling for this problem.
But I found another solution, and i hope that it helps you too.
I googled a little bit more and found this discussion Disabling static resource stuff, here i found a contributor of grails application, and author of Resources Plugin, Mark Palmer (take a look his website), telling what he is doing and answering the questions about this plugin.
Today, all you need to do is to update the Resources Plugin to version 1.2-RC1 or a recent one that will fix this problem.
When you say missing, do you mean that the changes are missing, or the whole stylesheet is missing? If it is just your latest changes, it is possible that your browser is caching the previous css file and isn't getting the latest changes. Try doing a "hard refresh" with something like CTRL+F5, or whatever hard refresh is in the browser that you are using. This will force a pull of the latest resources.
Really old question.. but for anybody googling this - I had similar issues with my CSS because of Windows file format on the Linux systems. Once I changed the format to unix, I still had to restart the server for the css to download. Note that somehow the css were downloading earlier although the format was windows and the issue was intermittent.
I think
beestings change the html every time.
this means html is not able to be cached.
am I right?
I assume that by beesting, you mean some sort of random number in the URL.
Yes this will (usually) stop caching of pages. Some browser may still cache some or all of the page.
As to whether not to avoid it. Would caching a page stop it working as it should? If your page has fairly random content or content the changes often, users would not see this if the page is cached.
If you can avoid the need to stop caching, pages will be able to load faster. Which makes for a happy user.
Old, old question, but anyway... no. You actually can "cache some or all of the response generated by an ASP.NET page, referred to in ASP.NET as output caching". You can read more at this Microsoft page.
For those still wandering, bee stings are special tags used in Microsoft's asp.NET to hold server-side code, much like PHP would do. It is, or was, very common to keep simple code inline, although having significant amount of code in bee stings is considered a bad practice by Microsoft themselves.
But as a rule, yeah, it can be cached.
I am puzzled. I looked at the trace of a pagecall that was "slow" to load according to my boss, causing the page to partially load, and then "jump" to the memorized scroll-place on a postback.
I found out eventually, using my trace, that my whole loading, from Begin PreInit to End Render, took 1.94 seconds, 1.5 of which are spent between Begin PreRender and End PreRender.
Any idea on what could cause that? The next biggest loadtime is 0.14 seconds, for End PreRenderComplete.
Could the problem originate from my queries to SQL Server, or a too vast quantity of controls on the page, even though most are "hidden"?
[edit:]It seems that my page load is very long when I show a certain form. My total render size is of 91537 bytes, 44483 of which are dedicated to that specific form. My viewstate seems kindof enormous. Also: Can a 404 to a JS file cause that kind of lag on load?
[update:] So I found the longest-running query, and it seems that even though it DOES seem quite chunky, it has ended running long before the page is even loaded.
As added information: I am using quite a bit of SqlDataSources troughout the controls, to fill my dropdownlists and other interesting stuff of the like. Is that cluttering my app?
In my experience (same problem as you), it's 90% a SQL issue.
Put some Stopwatch(es) around the query you are calling to find out which query is running slow.
Rendering asp.net control can't take so long....
In order to identify the cause of a bottleneck you really ought to profile your code with a tool like ANTS Profiler or something similar.
A profiler will allow you to pinpoint the problem area by showing you which lines of code are slower than others.
I would use YSlow to determine if its from something on the client side or server side. We sometimes add timers to some queries then output the time to execute in an html comment... of course removing them when the testing is complete.
Does the page call anything hosted on an external site?
Your best bet is to use the Perfomance Wizard in Visual Studio and look at the Call Tree for your page. It will give you more details into the exact performance bottleneck.
I have seen this type of performance when there are too many complex controls declared on the page. Although it could easily be SQL related as well. To know for certain you need to look at the Call Tree and find out what the most expensive call is.
Of course, if it is sql-related, as many people have noted, "sql server profiler" is the tool to use (given that you're running mssql). mysql has "jetprofiler" (.com) which i haven't tried. once you've found the slow query, it's not rarely an indexing issue.