Download and read web source code, illegal? [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I am working on a project which generates a meaningful url, connects to it, and download its HTML source code. The program will further read the source and extracts useful info from it. Is this illegal?

By itself, there is nothing illegal happening from what you've described. But you're being very vague.
What do you mean by "generates a meaningful url"? Generates how? What determines "meaningful"?
Downloading the html given by the server at the requested url is exactly what a browser does. Nothing odd there. Browsers also read that html and build a document from it to display to a user.
What do you mean by "extracts useful info from it"?
What do you do with the resulting info?
Are you bypassing any security, or spamming the same server with massive numbers of requests? Are you doing anything that violates someone's privacy? Are you reposting any of the information you gathered without referring back to its original source?
What is it about your project that is even raising a red flag in your mind about legality?
These are the sorts of questions you should be asking yourself.

If this is for a personal project, then no it is not illegal in the least. If this is for a commercial product, however, I would err on the side of respecting any copyrighted content on the webpage.

Related

How do I write a PDF file using Java code without importing any third party jars? [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Is there a way to create a PDF file without using a third-party library, like iText, Apache PDFBox, PDFJet and so on ?
If you really want to do this, download a copy of the PDF specification, and read it. (It is only 978 pages ... it won't take that long to read ...) Then design and implement a program that generates a byte stream that conforms to the specified format and contains the information you want to output with a suitable layout, etcetera.
You could probably produce a simple "hello world" document in a week or three. But my estimate is that it would take you years (and many versions) to get to the level of sophistication of one of the existing libraries.
A better idea is to not waste your time reinventing the wheel.

Can I run java code in html textbox? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
I am writing one web page in which I am putting one html input type="textarea" in which user will write their java code and on submit it will return output of that java code. Can I do this using jsp? if not then what are the other ways.
I would think very carefully before allowing people to do that.
At the very least, to read and run the user's input, you will need a JDK to compile it, and a JVM to run it. Since you're talking about over the web, presumably the user's machine will not have those (otherwise they'd just use theirs), so you'd have to use the ones on your server - that is, take the user's text, upload it as a .java file to your server, compile and run it (for an anonymous user on your server!), and send the result back to the browser session.
As you can see, there are a couple of pretty big, bad security problems here. Not recommended !

How to download a file in IE10 using selenium webdriver? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I am trying to download a file using selenium webdriver but the test stops as soon as it encounters the IE10 download dialog box. How do I click save on this dialog box? Will Robot API help?
The short answer: This has been asked many times, please search.
The long and more correct answer: As of now (2013/10), it can't be done via WebDriver. It's one of the most requested features for the Selenium project.
You can try one of these things:
Make a request for the specified link using HttpURLConnection or Apache HttpComponents. You can even download the file this way, although the usual practice is just to assert a 200 OK response to make sure that the file can be downloaded (since you usually don't really need the file when you're testing your application).
Snatch the file using any Java approach. Or this tool made by someone to be used with Selenium.
Use the Robot class to simply press Down arrow and Enter or something. But beware, this will only work for your particular browser and OS. It will most likely break on any other configuration.

Making my computer prompt me with a predeterminedquestion whenever I open firefox [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm inspired by reading this from John Conway's wikipedia page:
http://en.wikipedia.org/wiki/John_Horton_Conway#Algorithmics
I want to have a window pop up whenever I open firefox to ask a question that I code. I'd type in a response in a text box and upon hitting return it would display the answer and whether I'm correct or not. What I'm thinking of right now would be I'd get a random number in centimeters between, say, 0 and 300 and I would try to get the correct amount of inches it corresponds to.
I have no idea how to even start going about this. How do you make some program execute when I click and turn on a browser? I have some experience with swing so perhaps we could use that but I've looked through some of the swing library to no avail. I put the java tag there because it's the language I'm most familiar with so a solution in java would be best if possible. Also, are there any good resources to learn how to do stuff like this?
I think my main problem is getting some prewritten code to run upon opening the browser. The rest I can probably deal with in swing but I'm not completely sure.
Lastly, sorry for the non-space between predetermined and question, but the site doesn't let me use the second word in the title even though it makes sense here.
this looks relevant
it talks about controlling web browsers, sounds like a tool for you
This question is borderline off-topic for SO, but not hard to answer and interesting enough to grab my attention so I'll go ahead and do so.
You'd have to code all of this yourself, but you could use InnoSetup (http://www.jrsoftware.org/isinfo.php) to create yourself an installable Java program and follow these directions to launch Firefox after you answer your predetermined question:
http://www.daniweb.com/software-development/java/threads/7710/how-to-run-external-.exe-programs-from-java

How to store secure information in a data file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
In my server-client program I want to know if the client is official (so, not modified). For that I want to implement a version check and the version should be stored in a data file or something. The problem is, how to store this securely? I don't want it to be readable with any sort of text reader, and if someone would modify the client, it must still not be usable for the modified program.
I already tried several things, like using a Data In/Out Stream, or an Object In/Out Stream, but they all remain slightly visible in a program like Notepad++, and still they can be used by any non-authentic version of the client.
Is there a way to do this properly?
Don't rely on a "version check" in this sense. Instead, use signed jars, which guarantees the jar cannot be modified and still run, and use the signature field in the manifest file in communications with your server to determine if the client is an authorized version.
http://docs.oracle.com/javase/tutorial/deployment/jar/signindex.html

Categories

Resources