Named numbers as variables [closed]

Naming numbers is terrible practice, one day something will need to change, and you’ll end up with unsigned five = 7. If it has some meaning, give it a meaningful name. The ‘magic number’ five is no improvement over the magic number 5, it’s worse because it might not actually equal 5. This kind of … Read more

Code line wrapping – how to handle long lines

In general, I break lines before operators, and indent the subsequent lines: Map<long parameterization> longMap = new HashMap<ditto>(); String longString = “some long text” + ” some more long text”; To me, the leading operator clearly conveys that “this line was continued from something else, it doesn’t stand on its own.” Other people, of course, … 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

Standard File Naming Conventions in Ruby

With just Ruby (i.e. not Rails), naming is only a convention. In Rails the convention of using underscores is necessary (almost). I think convention #2 lowercase_and_underscore.rb is more common and looks pretty good, though an article Here says lowercasenounderscore.rb is the Ruby convention. Pick either which ever convention is more common or which ever one … Read more

When to use ellipsis after menu items

The crucial factor is whether the menu option requires additional information (input or a selection) before it carries out the operation. So Help-About doesn’t require an ellipsis, but File-Open does. That’s what the Microsoft, Apple and KDE guidelines say anyway. Microsoft Windows applications are supposed to follow Microsoft’s “User Experience Guidelines”. Here’s what they say … Read more

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