How do I get my Etherpad changes to show up? - java

I change files like /etherpad/trunk/infrastructure/ace/www/ace2_inner.js and then run /etherpad/trunk/etherpad/rebuildjar.sh and yet when I run it again everything looks the same. Is there a trick I'm missing?
I've also tried running rebuildjar.sh with clearcache to no avail.

Look at bin/build.sh and track down which scripts are called directly and which scripts are called via subscripts. The whole thing is a mess :/

ace2_inner is perhaps one of the autogenerated .js files? What you need to do is read the first 10-20 lines of every source code file before you edit it, to make sure you're not editing an autogenerated file.
If you don't know the structure, then use bin/build.sh every time until you learn how to handle the source code. (This advice isn't actually etherpad-specific :)
And then make sure you've STOPPED all etherpad servers before starting up a new one.

Always clear the browser cache properly after changing the etherpad files. Otherwise none of your changes will show up.

Related

Remove all unused code based off of a single Main method

Do you know any way to find (un)used code from the perspective of a specific main method (or what IntelliJ calls an entry point)?
The background is that we have a big java project in which we have custom code for several clients. Sometimes we give clients the current state of the project in source form but would obviously want to remove the parts which only concern other clients. We have a Main file for each client so it should be possible to follow imports from there to find exactly the files relevant to each client.
I was hoping to be able to run intellij's code inspection on a single entry point but was unable to find anything. I'm open to any solution though.
You could remove all other entry points and run intellij's code inspection again to detect unused code. Now that you have only one entry point it should be able to tell you what code is unused. With that knowledge you can revert you changes and remove this code.
Hope that helps.

Deciding whether to embed or externally save my code

I've made a code which displays an array which shows traffic lights flashing, should I save externally as script files or embed it into the HTML.
I also need to explain why I've done this.
Please I've got until over Christmas to finish this, I've looked everywhere and can't find much, so I'm turning to this where apparently experienced programmers are and who have done all this before.
Please don't close the question, I really need help. Thanks
What is the ultimate goal?
Code maintainability - use external script
Reuseability - use external script
Downloadtime/network i/o - a bit better if embedded.
Want the HTML/CSS redone by designer later - use external script
The more I think of it, the more reasons I see to put it extern.
And tge one I listed pro embed - that's nullified at second load (script from cache)
Revering to the MVC-Pattern I'd put it in an extra file. It's just better structured and better to read.
Another advantage is that you can reuse your code. Like if you'd have a second page which uses this code you would just need the include it there, too.

Get information about changed file in Java

I'm trying to monitor files in java. When a file modification will happen I want to know:
Which process did the change.
What has changed.
Also, I know that there is a way to change the "last modified date" in a file, so I want to check if someone has changed that field.
I tried "commons.io", "DefaultFileMonitor" and "WatchService", but all the information I could get from them was if a change has occurred and the file that was changed.
Unless you're on a weird OS I know absolutely nothing about, you would need to use some mechanism you implement to track who is changing your file. The OS doesn't keep track of that. It also doesn't track what has changed.
So I don't believe you can do #1 unless you can get every process that MIGHT change the file to track that it did a change.
You could do #2 if you kept copies of the file then do a comparison.
I am pretty sure you cannot do that. Neither OS nor Java is storing such information. Maybe using some kernel calls.

Using eclipse, can i make just a "scratch pad" page for java?

Sometimes i just want to write out some quick java to see if my algorithm works.
Maybe I am preparing for an interview! Maybe I just want to see how my code is running.
At these times, I typically make a new java file, and save it in a project i've marked called "scratchyCat". Don't judge me.
However, 99% of the code there is useless, I don't need to save it or ever even see it again. Does eclipse have some shortcut to create a java page that i can just write code on, compile and run, and then delete?
Alternatively, is there some website (like jsfiddle) that would let me do the same for java?

Creating jar file directory across?

At first I have to say, that I've just started learning java a short while ago, so I'm not familiar with the language at all. Due to this, I try to get things done without using an IDE, so I can understand how things work. However, it's not the language that drives me crazy, but the process of making a .jar file.
I have the directories E:\Java\MyLib\mylib.java, E:\Java\Test\PartA\parta.java and E:\Java\Test\PartB\partb.java, which contains my main. mylib.java is a package that gets imported by parta.java, parta.java gets imported by partb.java.
I created a .bat file consulting several tutorials as much as the official specification from oracle about how to use the jar.exe, I've created a valid manifest.txt, I told the programm where it could find the partb.class containing my main, everything gets compiled to its own .class file just fine what tells me that my code is correct, but trying to merge all the files together into one .jar file took me hours without a working result.
According to any instructions I was able to find I'm doing everything right, I tried many different spellings and options, but at the end, either the compiler does not even find the files in the subfolders, or the files are in the .jar, but the javab.class is not able to find them during runtime.
It's sickening. I think I'm missing something, doing something absolutely wrong, but I can't figure out what it is. Any advice would be highly appreciated.
Use an IDE, it makes life so much easier. But, if you insist on doing things the old fashion way, try turning off your antivirus. If that doesn't work, check to make sure your environment variables are set correctly. If all else fails, try reinstalling your JDK.

Categories

Resources