Organising my Python project

Create an __init__.py file in your projects folder, and it will be treated like a module by Python. Classes in your package directory can then be imported using syntax like: from package import class import package.class Within __init__.py, you may create an __all__ array that defines from package import * behavior: # name1 and name2 … Read more

What are common conventions for using namespaces in Clojure?

I guess it’s ok if you think it helps, but many Clojure projects don’t do so — cf. Compojure (using a top-level compojure ns and various compojure.* ns’s for specific functionality), Ring, Leiningen… Clojure itself uses clojure.* (and clojure.contrib.* for contrib libraries), but that’s a special case, I suppose. Yes! You absolutely must do so, … Read more

How do I add a resources folder to my Java project in Eclipse

When at the “Add resource folder”, Build Path -> Configure Build Path -> Source (Tab) -> Add Folder -> Create new Folder add “my-resource.txt” file inside the new folder. Then in your code: InputStream res = Main.class.getResourceAsStream(“/my-resource.txt”); BufferedReader reader = new BufferedReader(new InputStreamReader(res)); String line = null; while ((line = reader.readLine()) != null) { System.out.println(line); … Read more