tricks

What do you do to keep your coding skills in shape, and how often?

What would you say are your best kept secrets to keep yourself in top programming shape? ...

How to write a self reproducing code (prints the source on exec)?

I have seen a lot of C/C++ based solutions to this problem where we have to write a program that upon execution prints its own source. some solutions -- http://www.cprogramming.com/challenges/solutions/self_print.html Quine Page solution in many languages There are many more solutions on the net, each different from the other. I won...

What is your latest useful Perl one-liner (or a pipe involving Perl)?

The one-liner should: solve a real-world problem not be extensively cryptic (should be easy to understand and reproduce) be worth the time it takes to write it (should not be too clever) I'm looking for practical tips and tricks (complementary examples for perldoc perlrun). ...

What are your favourite MATLAB/Octave programming tricks?

I think everyone would agree that the MATLAB language is not pretty, or particularly consistent. But nevermind! We still have to use it to get things done. What are your favourite tricks for making things easier? Let's have one per answer so people can vote them up if they agree. Also, try to illustrate your answer with an example. ...

How to improve Netbeans performance

hello and good day for everyone This is my question. Exists a real way to get Netbeans load faster and working time too? It is to slow and when you have some time coding is worse it eat all my ram with no more.... bye bye ...

Which are your favorite GDB tricks?

Which is your favorite macro/trick in gdb? Have you written any good macros for improving language integration? What's your best way of making the debugging experience inside gdb less painful? ...

Is 1 for TRUE or FALSE ?

I always forget :S How do you remember which number stands for TRUE or FALSE? (when I started css the colors black and white always confused me. Is white #FFFFFF or #000000. A trick I came up with: black is 0,because z0rr0 is dressed in …) ...

Reserved words as variable or method names

Is there any tricky way to use Java reserved words as variable or method names? ...

How do you implement Related tags functionality as used in Stackoverflow.com?

Hi everybody, Good morning! Have been trying to find an answer to this. How do you implement the 'related tags' functionality as used in many websites like our stackoverflow.com and http://tagexplorer.sandbox.yahoo.com/. A user clicks on tag and he gets all the related tags connected to that. Daksh ...

Tricks to Google for desired page quickly

I like to use Google to quickly locate API documentation. To get better results, I type some keywords that give desired results as top lines. For example: JavaScript: MDC Array slice MDC String indexOf Ruby ruby doc Dir glob rubyonrails ActionMailer What are your favourite tricks to pick the desired pages quickly? P.S. ...

PowerShell Tips & Tricks for Developers

What are the some of the PowerShell tips & tricks that you use to increase your productivity as a .NET developer? ...

How do you search all source code in Vim?

When using Vim, and given a directory filled with code (e.g. ~/trunk/) with a number of sub-directories, is there a way to grep/search for instances of text/regexes across the entire source code? At the moment I use: :lcd ~/trunk :grep "pattern" *.py */*.py */*/*.py */*/*/*.py (Obviously I'm limiting this to Python files, which is a ...

Interview question: f(f(x)) == 1/x

Design a function f such that: f(f(x)) == 1/x Where x is a 32 bit float Or how about Given a function f, find a function g such that f(x) == g(g(x)) See Also Interview question: f(f(n)) == -n ...

C function seemingly not defined anywhere!

I'm looking at the vim source code, specifically the file normal.c, and I see this function nv_operator being used, but it's not defined anywhere (I grepped the entire src directory) It's only declared as: static void nv_operator __ARGS((cmdarg_T *cap)); I've looked up the definition of __ARGS but it's just ... nothing (pretty much) ...

Running a command with every svn commit

Is it possible to make svn run some command before every commit? I have some documentation in LaTeX in the repository and would like to have always the latest version of the compiled docs available as a pdf in the repository. The same would go with doxygen docs. I'd bet that there is some magic svn:something property or something like t...

Ruby: change each value in a hash with something like #collect for arrays?

Hi! I'd like to replace each value in a hash with value.some_method. For example in a simple hash {"a" => "b", "c" => "d"} every value should be .upcase-d so it looks like {"a" => "B", "c" => "D"}. I tried #collect and #map but always just get arrays back. Is there an 'elegant' way to do this? Thanks in advance, Adam Nonymous UPDAT...

What does this CSS value mean?

While viewing the source of a web page, I came across this CSS, applied to a span within a button: .whatever button span { position: absolute; left: -1e+7px; } What does left: -1e+7px; mean? Is this some trick I should be aware of? ...

Shortest way to swap two files in bash

Can two files be swapped in bash? Or, can they be swapped in a shorter way than this: cp old tmp cp curr old cp tmp curr rm tmp ...

Clever way to make same assembly executed differently?

Without changing the build process or including the source files, can anyone think of a way to make two pieces of code that, when compiled, generates the same assembly but still executes differently? I already know why this should be impossible, so please don't bother to explain. There are definitely ways to do it, primarily by finding ...

Is there any command to go to the end (or beginning) of a Ruby block using vim

Hello there, Is there a way to go the end of a Ruby block using vim? For example module SomeModule # <Supposing that the cursor is HERE> def some_method end end I want to go from where the cursor is, to the end of the block with one command, is that possible? I've read this documentation, but it doesn't seem to work on .rb ...