Prime Generator

Sorry for late post i was too busy ….
this is a new problem 
Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime numbers between two given numbers!

Input

The input begins with the number t of test cases in a single line (t<=10). In each of the next t lines there are two numbers m and n (1 <= m <= n <= 1000000000, n-m<=100000) separated by a space.

Output

For every test case print all prime numbers p such that m <= p <= n, one number per line, test cases separated by an empty line.

Example

Input:
2
1 10
3 5

Output:
2
3
5
7

3
5




Solution :


CC Arun Kumar Gupta

import java.util.*;
public class FastestPrime
{
public static void main (String [] args)
{
Scanner sc = new Scanner(System.in);
int test_cases = sc.nextInt();
if((test_cases <=10) && (test_cases > 0))
{
for(int i = 0 ; i {
int m = sc.nextInt();
int n = sc.nextInt();
if((m<= 1000000000) &&(n<=1000000000)&&(n>0)&&(m>0))
{
if((n-m) <= 100000)
{
if((m % 2) == 0)
++m;
for(int j = m ; j<= n ; ++j)
{
NextNum(j);
j = j+ 1;

}
}
}
System.out.println();
}
}


}
static void NextNum(int m)
{
int div = 3;
int array [] = new int[1000];
int rem = 1 ;
while((rem != 0) && (div <= (m/2)))
{
rem = m%div;
div = div+2;
}
if(rem != 0)
{
System.out.println(m);
}

}
}



Webcam is not Working in Ubuntu 11.10

Hi Guys back with some new stuffs of Linux ..
this happens frequently in Ubuntu, after some of using the Ubuntu webcam does not works.
so i have solution here .
it was taken long time to me found out the solution .
this solution worked in my laptop .

sudo apt-get install v4l2ucp
sudo v4l2ucp 

then run
cheese 

it will work   

Sync Subtitles With The Video In VLC

I can’t stress the usefulness of subtitles enough, especially when you’re watching a movie in a foreign language. I was watching Heavenly Forest, a Japanese romantic drama, a few days back. The movie was wonderful, but I wouldn’t have understood anything had it not been for those English subtitles. I even tend to use English subtitles while watchingEnglish movies, because you guys talk so fast (Americans) or so weird (British) that it’s hard for me to grasp!
Handy as they are, subtitles can turn extremely irritating if they’re out of sync with the video. They distract you, and you end up understanding even less than what you’d have without the subs. Thankfully, if you’re using VLC player to watch the videos, you can make use of a nifty feature in the program to sync the subtitle with the video! Do note that it’ll only temporarily sync the subtitles with the video, and the sync will be gone the next time you watch the video.
Anyway, lets get started with how to implement it. I’m assuming that you’ve already loaded the video and subtitle files into VLC (you can just drag them both into its interface). Now, carefully take a look at the video and the subs, and see whether the subs are lagging behind or running ahead of the video. If you’re watching a foreign movie, it may seem like a very difficult job, but just try a little hard and you should be able to make this out. For example, if you see a girl screaming and running around wildly, and the subs show “Help me! Help me!” 3 seconds after that scene, this means that the titles are 3 seconds behind the movie.
Once you’ve figured out the lag / lead of the subtitle, it’s time to sync it with the video. In VLC, navigate to Tools > Track Synchronization, where you’ll find the Subtitles/Video section. Now comes the important part – syncing the subtitle. If the subtitle is lagging behind the video, you’ve to provide a negative value to ‘Advance of subtitles over video’. Say the subs display 3 seconds after the video, the value you got to enter is –3.000 s. Note that you can adjust the sync time to upto a thousandth of a second, although adjusting to the tenths does the job in all cases. Similarly if the subtitle is ahead of the video, enter the required positive number of seconds. Hit the Refresh button at the top right corner of the window, and you should see the change immediately.