Hidden Features of Visual Studio (2005-2010)?
Make a selection with ALT pressed – selects a square of text instead of whole lines.
Make a selection with ALT pressed – selects a square of text instead of whole lines.
The flip-flop operator is useful for skipping the first iteration when looping through the records (usually lines) returned by a file handle, without using a flag variable: while(<$fh>) { next if 1..1; # skip first record … } Run perldoc perlop and search for “flip-flop” for more information and examples.
More of a trick of the GCC compiler, but you can give branch indication hints to the compiler (common in the Linux kernel) #define likely(x) __builtin_expect((x),1) #define unlikely(x) __builtin_expect((x),0) see: http://kerneltrap.org/node/4705 What I like about this is that it also adds some expressiveness to some functions. void foo(int arg) { if (unlikely(arg == 0)) { … Read more
Documentation. The documentation gets my vote. I haven’t encountered a more thorough online documentation for a programming language – everything else I have to piece together from various websites and man pages.
From Ruby 1.9 Proc#=== is an alias to Proc#call, which means Proc objects can be used in case statements like so: def multiple_of(factor) Proc.new{|product| product.modulo(factor).zero?} end case number when multiple_of(3) puts “Multiple of 3” when multiple_of(7) puts “Multiple of 7” end
I’m just going to start with a tip from myself 🙂 Use os.path.dirname() in settings.py to avoid hardcoded dirnames. Don’t hardcode path’s in your settings.py if you want to run your project in different locations. Use the following code in settings.py if your templates and static files are located within the Django project directory: # … Read more
Using a protocol-independent absolute path: <img src=”//domain.example/img/logo.png”/> If the browser is viewing an page in SSL through HTTPS, then it’ll request that asset with the HTTPS protocol, otherwise it’ll request it with HTTP. This prevents that awful “This Page Contains Both Secure and Non-Secure Items” error message in IE, keeping all your asset requests within … Read more
This trick only works in Access VBA, Excel and others won’t allow it. But you can make a Standard Module hidden from the object browser by prefixing the Module name with an underscore. The module will then only be visible if you change the object browser to show hidden objects. This trick works with Enums … Read more
Line continuation: call C:\WINDOWS\system32\ntbackup.exe ^ backup ^ /V:yes ^ /R:no ^ /RS:no ^ /HC:off ^ /M normal ^ /L:s ^ @daily.bks ^ /F daily.bkf
The Exception When clause is largely unknown. Consider this: Public Sub Login(host as string, user as String, password as string, _ Optional bRetry as Boolean = False) Try ssh.Connect(host, user, password) Catch ex as TimeoutException When Not bRetry ”//Try again, but only once. Login(host, user, password, True) Catch ex as TimeoutException ”//Log exception End Try … Read more