• Post Reply Bookmark Topic Watch Topic
  • New Topic

Would like to have some advice.  RSS feed

 
R. Oorschot
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Im rather new to coding and basicly a noob. I have follow'd some programming instructions on codeacademy.com and have a basic understanding on how some of the stuff works.
( i made a rock paper scissors game in java with a html/css front)

However i would like to code something different and i'm not sure how i go about that. So that's why i would like to ask some help if anyone is interrested.

The thing i would like to do is; to make a webpage that lists the content of a txt file and modify settings in that txt document trough the webpage.
Perhaps some of you have heard of nginx + rtmp module (webserver with rtmp streaming options) and would like to make a verry basic interface to control that webserver.

I would like to be able to change some settings like the server ip adress/port and some of the rtmp recording options.

After reading on the web i understand that file.io would be the class that i need for this but im a bit lost on how the programming structure should be in total for this project.
That is; im not sure if i must use loops to go trought the whole txt document
Or is it possible to remove the settings in the txt document and replace them with variables ? so i can promt the user to make a choice so the variables get a value


I'm not sure if i stated my question clearly enough for you guys to awnsor it.
And if you do understand; would you mind to give a verry simple example of how i could could do this in the best/most simple way in a fiddle? (http://jsfiddle.net/)

Thanks in advance for your reply and patience.


ps. if this is not the place to ask such questions; my apollogies and ill take a look somewhere else.



 
Campbell Ritchie
Marshal
Posts: 56530
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I think this is an appropriate place for such questions.
Have you been through the Java Tutorials? You will find there are new ways to implement file I/O. I suggest you start by reading from a file and writing at the command line, before you try any displays.
Beware: reading a file and writing to it take appreciable time. Think how long it takes to open a large .doc file, and about the delay if you push ctrl‑c while editing it. [Only part of that delay is reading and writing.] So try only to read the file once, and only to write it once.
Don't know about the webserver apps myself, I am afraid.
 
R. Oorschot
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your time.

I had a look at the Reading, Writing and Creating Files part of those tutorials but i realised that i dont have enough experience to think out how the program/app to work logically.

basicly i had this thought out:

Is the document there?
check file/directory if the file exists and is >0kb (if not give error message)

scanning the document
read file -> scan file for options that are currently selected and put them in a variable -> print the current settings/variables in a html page.

editing the document:
read file -> scan file for options that are currently selected and put them in a variable -> display them in a editable textbox with conformation button in a html page. on click write the new value of the variable in the txt file.

I know its a verry rough logic but im not sure if this would be a viable way of thinking/ making the app.
And if i'm forgetting steps or need to remove steps.

I dont want to think about security or different profiles (yet) for now.
Currently i want to see if i can make this (mostly) myself and understand it.

Basicly that webserver has a conf file (nginx.conf) and that can be edited with any txt editor.
If you (or anyone else) could advice me if this is the right way to do such a thing it would be greatly appreciated.

(please mind any typo's as english is not my native language)



 
Campbell Ritchie
Marshal
Posts: 56530
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suggest you start by finding the file. Learn about file choosers. Implement a part of your app which finds the files.

Forget the other parts until later.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
R. Oorschot wrote:I know its a verry rough logic but im not sure if this would be a viable way of thinking/ making the app.
And if i'm forgetting steps or need to remove steps.

Sound like a reasonable start; and it's very good that you're writing all this down rather than trying to jump into code straight away. I'm still a little unclear as to what your "documents" are, but you can flesh this out as you go. I suspect you're still a couple of days away from coding yet.

One thing you might want to think about is making a class that can hold all your options (Options?). Java is an object-oriented language, so it's usually best to have objects doing the work, rather than scads and scads of code. I suspect you will want at least a dozen classes for something like this; possibly more.

I also agree with Campbell: Start out with a program that works from the console with files on your local filesystem to make sure you you have a "proof of concept". Once you have that working, you can always expand it to include fancy GUI's or work as a web app, but all that other stuff is likely to be a distraction at the moment.

HIH

Winston
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!