Resources - Javascript file strange behavior - javascript

I'm having a problem regarding with my javascript files in my spring web project.
I wonder what's wrong with this, but my external javascript file doesn't reflect the changes I made to it when I run the program.
What I do is I need to rename the file so that the changes would take effect.
When I close eclipse and open it again, then the changes would not be reflect again. Then I need to rename the javascript file again.
It seemed that it retains the previous code it has everytime I close and open my eclipse.
I also tried to delete the javascrip file, and boom!!! it still run the previous code even though I already deleted it!!!
I'm lost guys, have you experienced this problem?
Any help would be appreciated!
Thanks in advance!

The problem is not related to the Spring Framework and the problem is not even in you code. The problem is in your IDE.
Try to reinstall it.

Related

Rails/ReactJs View not updating on Browser Refresh

Just recently, I have added Reactjs to my Rails application. However, whenever I reload the same .jsx file, but with different content (ie <h1>Hello<h1/> to <h1> Hello again<h1/>), the browser does not respond and update the view. I have tried restarting the server and reloading the page. I have also created a separate rails application, and I was able to recreate Furthermore,I have also pulled my partner's repositories to check if there were any file differences. There were none.
However, when I pull his repo, my browser updates the content, but it doesn't update it anymore afterward when I edit a .jsx file. It should also be noted that when I edit the content on a .jsx file, the view updates for him, but it doesn't update for me when reloading the page. Our files are the same, but only I have the problem. I have also toggled safe mode, but it didn't make a difference.
I am using Webpacker with Yarn on Jetbrains' RubyMine with Windows 10. Here is a picture of what the problem is:
The code vs the output
After a great amount of trial and error, the problem was with the IDE and where it was retrieving its settings and files from. I had a backup HDD that held old information on it such as my last projects contents. This was wiped.
I also managed to find old IDE settings in my "../users/%your_name$/.Rubymine2018.1". All old RubyMine settings were removed. I also reinstalled my IDE to give it yet another clean start. As far as I can tell, this has worked.
A big thanks to everyone who helped me in the comments!
I have been facing the same issue, and as I have tried to follow the guide provided previously I couldn't know where to start from.
And what I had to do is to run npm run build everytime I update my jsx in my component.

What am I doing wrong with Angular js manual bootstrap process?

I am using Angular 1.7.2 in a project i'm working on. (I prefer Angular 1.x)
I am doing the bootstrap process manually (because i'm adding scripts programmatically).
But, I am having 2 issues with the manual bootstrap process.
I have to use a setTimeout, else the bootstrap never works. And my problem with this is, the more files I add to my project, the longer i have to make the timeout.
Sometimes when I load my web page or refresh the site, not all my components are loaded. If i monitor the network traffic, i can sometimes see that the html files are not retrieved at all. And there are no errors in the console or anything.
It seems to me there must be something happening in the angular.boostrap process that is failing or getting stuck, but i can't figure it out.
For my first issue, why is the setTimeout required, is there a way to not need this?
Second, why does my site not load sometimes?
Could it be related to the OS locking the files temporarily because of all the source control, anti-virus, other services running on my computer? If so, how can i tell?
I put together a test project with relevant code here on github
I previously thought this was related to the routing, but it's not (see here), But it seems not related to angular-routing after all.
Any information would be much appreciated, this is driving me mad.
Update 1:
I have the code running here on github pages.
Best chance to replicate issue is to use google chrome, enter url, open dev tools (f12), then actually load url. Sometimes, the page doesn't load completely.
I have updated the test website to better reflect my project where I add scripts dynamically.
I think i found the solution thanks to a comment by igor
I moved my app.route.js file to be loaded before any of my angular component and directives and from what I can tell this solves my problem.
I will update the linked sample project too

JavaScript function not working due to cached JS file

I have a few JS files which I need on every page in my admin panel, like: functions.js, login.js, ...
I combine all those files (and minify them) into one file using gulp: admin.js
Two days ago, I have made a new function called "changeTicketStatus", but there's one problem: cache.
Whenever someone visits my website, the new function does not work yet.
When they visit http://website/js/admin.js manually in the browser, they do see the new function.
When they check via sources (in chrome dev tools), they do not see the function.
Since we are using CloudFlare for caching, I thought this might be the problem, but we already purged all cache on CF and it is still not working.
The people who are trying to visit my website have already cleared their cache too. It does work in private mode (incognito), so I guess it should be something cache related... I just think it's really weird that even after clearing their cache, the function's still not appearing in dev tools.
I would really appreciate it if someone could help me. I'm out of ideas, I really don't know how to fix this.
Kenny
Can you add a random querystring to end of include script
for example:
instead of <script src="app.js"></script>
use this <script src="app.js?v234123"></script>
This will solve your problem about caching.

issues when going to www vs not going to www

I'm working on my dev box and noticing that I'm having issues when I go to www.host.com vs host.com.
Specifically, I had a javascript hover effect that isn't being applied when I go to www.host.com however it works when i go to host.com.
My thoughts are that its a problem with the server and when I merge to live it will resolve itself however I am not quite sure if thats really the solution.
Has anyone ever experienced this and what should I do?
You have to check your JavaScript code in both of domain (www.host.com and host.com) because the browser usually will cache your JavaScript files to make it load the page fast rather than always take from the server. If you want to clear the cache, you can try to Ctrl + F5.
More over, to easily make your JavaScript code updated automatically when you deploy your new code in JavaScript, try versioning your JavaScript files (i.e. myCode_v_2_0_1.js) to force the browser to load new JavaScript source.

Eclipse JSDT autocomplete not working

I've done research and see this is a recognized issue. I guess my question will be: Is there a solution in Eclipse Mars or in Neon? Another plugin for JavaScript Content Assist?
I'm running Eclipse Mars and have a project with Java and JavaScript (uses ScriptEngineManager). JavaDoc/AutoComplete is working in Java but not in JS files. It Was working but then just stopped. I've restarted, rebooted, refreshed, rebuilt. No joy. The error reported is :
An exception occurred while getting the JSDoc. See log for details.
(in the log: ) file.js [in [in ...Workspace\.metadata\.plugins\org.eclipse.wst.jsdt.core\libraries\system.js]] does not exist
I deleted and re-defined the workspace. No joy. Mouseover the keyword Array and it does show system.jsArray with ECMA info. But mouseover String and it shows src/docs/jsString. "src/docs" is a path in my project.
I'm thinking it's just looking in the wrong place for the docs but I don't know where to set that. I've read that there is a bug where auto complete only works within a file. This seems to be consistent where it's still looking within the current file for the definition of everything.
I can get String to refer back to system.jsString if I add an invalid function. But if I fix the function it goes back to looking in my src/docs. Go figure.
Maybe the project structure is wrong (this is FOSS I got from Github). In the root of the project there are src/foo folders with packages and .java source, a reference to the JRE System Library, a couple .jars, and another src folder with src/docs/java with .java files and src/docs/js with .js files. Do I need to change the folder type of src or do something else to it so that it's recognized as a code folder? Right now it's in the project explorer with a common "folder" icon, not like one of the package source folders.
Do I need Neon? Do I need another IDE?
This suggestion to update the .project didn't help.
I'm going to try the package "Eclipse IDE for JavaScript and Web Developers" but I dont know if that will help with this Java/JS hybrid project. I'm also going to try Atom.
Thanks.

Categories