otherdummy 0 Newbie Poster

Hello, everybody
I am working on a simple client-server program. The server side is a console program which will send (1)the list of files in home directory and (2)the contents of the selected file to the client side. And the client side is a GUI program which sends requests to receive the list of files in the servers home directory and after it received the list of files it shows that list to the user and the user has an opportunity to view thr content of the selected file. The problem is that after sending the list of files because of the garbage collection the connection between the server and client is closed and there is no possibility for the client to request the contents of the selected file from the server. How to owercome this problem? Please, give some hints???

otherdummy 0 Newbie Poster

I guess everything will come to you when you will be a little older. I can remember my situation which was very similar to yours. So - don't worry and just learn.

Thanks for showing interest to my problem, but I expected more detailed and exact advice. Please, anybody who can help me I'm waiting for an advice from you

otherdummy 0 Newbie Poster

Hi,
I have just started my first semester in a Bachelor program 'Computer Engineering'. I have above basic knovledge in Java SE and currently am interested in Python. The problem is that I'm facing some difficulties in determing my purposes about my future career in IT field. I used to be recomended to pay a lot of attention to extracurricular activities and to get involved in a variety of projects as much as possible and form own portfolio. By now I haven't done anything important in Java or Python. But I've learned the syntax and some parts of the liblary of these languages enough to work as an assistant to team of developers. The problem is that I don't know how to hone my skills in programming with these languages. I understand that I should work in a team of developers on some project but I have not any idea how to join such teams. If it is possible I would join online such teams and could offer my assistance in anything which I can do. Please give me some guides how to act in my situation. Any advice would be appreciated.

otherdummy 0 Newbie Poster

Try to read documentation for the method public String substring(int beginIndex, int endIndex)

otherdummy 0 Newbie Poster

If you cannot cd to the folder where the *.java file is located you can use -classpath option of the javac(java compiler)---see the documentation for javac

otherdummy 0 Newbie Poster

Hey! You can implement this method by using the folloving methods:
public char[] toCharArray() defined in class String
and another method:
public static boolean isDigit(char ch) defined in class Character.
OK lets start writing your method (NOTE: This method throws an instance of DigitNotFoundException which extends class Exceptin):

int sumOfDigits(String str){
  char[] characters=str.toCharArray();
  int sum=0;
  for(int i=0; i<str.length(); i++){
     if(Character.isDigit(characters[i])){
        sum +=characters[i];
     }
  }
  if(sum!=0)
     return sum;
  else
     throw new DigitNotFoundException("There is no any digit in the provided string");
}

The DigitNotFoundException class:

public class DigitNotFoundException extends Exception{
     public DigitNotFoundException(String message){
         super(message);
     }
}
otherdummy 0 Newbie Poster

Hey,
If you don't want to modify your existing class it would be better for you to extend your existing Fraction class as follows:

FractionWithOperations extends Fraction{
 public Fraction add(Fraction fr){
  newNumerator=numerator*fr.getDenominator()+denominator*fr.getNumerator();
  newDenominator=denominator*fr.getDenominator();
  return new Fraction(newNumerator, newDenominator);
 }
 public Fraction subtract(Fraction fr){
  newNumerator=numerator*fr.getDenominator()-denominator*fr.getNumerator();
  newDenominator=denominator*fr.getDenominator();
  return new Fraction(newNumerator, newDenominator);
 }
 public Fraction multiply(Fraction fr){
  newNumerator=numerator*fr.getNumerator();
  newDenominator=denominator*fr.getDenominator();
  return new Fraction(newNumerator, newDenominator);
 }
 public Fraction divide(Fraction fr){
  newNumerator=numerator*fr.getDenominator;
  newDenominator=denominator*fr.getDenominator();
  return new Fraction(newNumerator, newNumertor);
 }
}
otherdummy 0 Newbie Poster

Hey! I think you need some state variables. For example state variables holding the current position of the sun in the coordinate system(int currentX, currentY) and another state variable holding the number of button presses(int buttonPress). And in the actionPerformed method you must change the values of the above mentioned state variables and call repaint() method.(the result is that your sun is redrawn in its new position and buttonPress is incremented by 1). Try to take this advice, if anithing wrong just let me know I think we can figure out smthng.

otherdummy 0 Newbie Poster

I have faced some class which deals with smth. identical to your task. So I modified that class to meet your requirements and came with the following class. You can create an object-instance of this class and use in your program

/***************************************************************************
 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/


public class StudentInfo{

	private static class StudentEntry{

		String name;
		double grade0, grade1, grade2, grade3;
		
		public char getLetterGrade(){
			double averageGrade=(grade0+grade1+grade2+grade3)/4;
			if(averageGrade>=90 && averageGrade<=100)
				return 'A';
			else if(averageGrade>=80 && averageGrade<=89)
				return 'B';
			else if(averageGrade>=70 && averageGrade<=79)
				return 'C';
			else if(averageGrade>=60 && averageGrade<=69)
				return 'D';
			else if(averageGrade>=0 && averageGrade<=59)
				return 'F';
			else
				return 'r';
	}
	}//end class StudentEntry

	private StudentEntry[] data;
	private int dataCount; …
otherdummy 0 Newbie Poster

My friend is writing a simple forum,
In this forum there is 1 MySQL database with 4 tables(forumsections, members, posts, replies)
The question:
He wants to notify by mail those members who have posted new posts, when anybody replies to their post. (like in this forum). Now he has a checkbox in the post form(when posting a new post member has choice to have notifications by mail, if he checks the checkbox notifications will be sent him by mail otherwise not(by default checkbox is checked)). How to code this idea in PHP.
Thanks in advance

otherdummy 0 Newbie Poster

You could try PHPMailer or Swift Mailer. Both are far more powerful than the built in mail() function.

I usually use PHPMailer myself.

I've read through PHPMailer
but now can't understand anithyng
Really liked your suggestion
please help me with starting
(explain the core features) what i need to start
(i am beginner in PHP hope you understand my situation)
P S Now i am reading tutorial in the site you suggested
Thanks

otherdummy 0 Newbie Poster

Welcome to the community! Pleased to meet you by the way!

thank you
pleased with such a hearty welcome

otherdummy 0 Newbie Poster

Just an addition to Atli's post (good advice, BTW):
If you're running something like cPanel, setting cronjobs is easy. However, some hosts don't provide this service as standard and you may need to contact them to set one up for you. The cronjob will just run a php script every hour.
I would look for a better solution than the built-in simple mail() function to send e-mails. This is fine for the odd request, but sending 100s of emails via this method is not recommended.

My host provides cPanel there is no problem with this
I am interested with your suggestion about mail() function to send e-mails
So, what would you suggest to use instead
Really, I also thought about it, I'd like to have smth more powerful
Thanks, for help, guys
really appreciate it

otherdummy 0 Newbie Poster

Thanks
I'll try it
If any problems hope to receive help from you all

otherdummy 0 Newbie Poster

Hi
I need help? please
In my site i have smth like newsletter system.
Logged in users can post information about their services and this information is shown in my site. I'd like to send such information (posted by users) to the mails of the other member-users of my site. I wont the system to check, let's say, every hour the state of database(if there are any new injections) and if there are new posts these ones could be sent to the other members

otherdummy 0 Newbie Poster

Hi
I am interested in web development
particularly in PHP
I hope I can get more useful from this community