I’m posting this here because I always forget the syntax. If you have a command that you would like to be executed by a user via sudo, and you would like to have them not be prompted for their password, add the following to the config file (aka the file you are editing when you run the command visudo):
user ALL=(ALL) NOPASSWD: /path/to/program
For example, to give myself permission to suspend my laptop without a password I would add the following line:
bryan ALL=(ALL) NOPASSWD: /usr/sbin/pm-suspend
I spend most of my programming time working in C++, and I’ve collected a few random snippets of advice that I personally follow while programming. If they can be of some help to you — great!
- Avoid “object oriented programming.” Inheritance isn’t the solution to every problem. Prefer to keep your objects as standalone entities, not elements in a convoluted hierarchy.
- Use constructors as invariant-setters.
- Don’t fear exceptions: they have a well-defined semantics and are easy to use for reporting when an exceptional circumstance has occurred. Your definition of “exceptional” may vary from mine. Exceptions are easy to use, and they work great with…
- Use RAII. Initialize and acquire your resources in constructors, and free them in destructors. Prefer using objects from the standard library such as unique_ptr over rolling your own.
- Use value semantics when you can, and pointer semantics when you must. This works really well if you utilize RAII, as suddenly your code is leak-proof.
- If anybody suggests that you should learn C before C++, hit them in the face. C is a completely different language with it’s own set of best-practices and guidelines. Don’t program in C++ like you would in C, and vice versa.
It’s been about two weeks since Chelsey and I moved into our new apartment, and now that things are for the most part settled into their rightful places, I figured it was time to update my blog. Before my move I played around a little bit with the Octopress blogging platform, but I’ve come back to WordPress (again) after realizing that
- I don’t want to deal with the hassle of managing my posts, files, etc by hand, and
- I enjoyed being able to blog from anywhere, not just from my laptop where my Octopress source files were located.
I understand and can appreciate the power Octopress gives you, but I just want a simple platform to deal with.
Before my move I also shuffled around my domain a bit. This blog is, as you can see, now located under a subdomain of my main website. This way I can leave the main domain open in case I find a use for it later. I also plan on constructing other subdomains in the future for various purposes. I’m always amazed at how much cleaner my online life is than my desk at home!