Package name is different than the folder structure but still Java code compiles

The Java language specification doesn’t force files to be in a certain directory. It optionally allows the compiler to require that public classes are in files with the same name of the class, but I don’t think there’s anything similar for packages. Section 7.2.1 talks about possible storage options in a file system, but it … Read more

Creating files and directories via Python

import os path = chap_name if not os.path.exists(path): os.makedirs(path) filename = img_alt + ‘.jpg’ with open(os.path.join(path, filename), ‘wb’) as temp_file: temp_file.write(buff) Key point is to use os.makedirs in place of os.mkdir. It is recursive, i.e. it generates all intermediate directories. See http://docs.python.org/library/os.html Open the file in binary mode as you are storing binary (jpeg) data. … Read more

How expensive is File.exists in Java

Measure the necessary time and see yourself. As you say it is absolutely file system dependent. long t1 = System.currentTimeMillis(); …Your File.exists call long t2 = System.currentTimeMillis(); System.out.println(“time: ” + (t2 – t1) + ” ms”); You will see that it will always give you different results, since it depends also on the way your … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)