Class.forName("org.postgresql.Driver");
если выдает class not found exception значит jarник не подключился.<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>VERSION</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>VERSION</version>
</dependency>
<scope>provided</scope>
если у вас Tomcat и jarник драйвера положить в папку lib Tomcata int[] numbers = {9,8,7,6,5,4,3,2,1} ;
int min = numbers[0];
for ( int n : numbers ) {
min = min < n ? min : n;
}
System.out.println("Min = " + min);
int[] numbers = {9,8,7,6,5,4,3,2,1} ;
Arrays.sort(numbers);
int min = numbers[0];
System.out.println("Min = " + min);
import requests
filename='test_file'
f = open (filename)
r = requests.post(url='http://upload.example.com', data = {'title':'test_file}, files = {'file':f})
print r.status_code
print r.headers
import threading
from random import randint
from time import sleep
def printNumber(number):
# Sleeps a random 1 to 10 seconds
sleep(randint(1,10))
print str(number)
thread_list = []
for i in range(1,10):
# Instatiates the thread
# (i) does not make a sequence, so (i,)
t = threading.Thread(target=printNumber, args=(i,))
# Sticks the thread in a list so that it remains accessible
thread_list.append(t)
# Starts threads
for thread in thread_list:
thread.start()
# This blocks the calling thread until the thread whose join() method is called is terminated.
# From http://docs.python.org/2/library/threading.html#thread-objects
for thread in thread_list:
thread.join()
# Demonstrates that the main process waited for threads to complete
print "Done"