Tumgik
coderiff · 9 years
Quote
Why does this matter? Hopefully the previous example made the relevance obvious, but here I’ll spell it out. Let’s say you’re debugging a difficult segfault: You add a printf() just before calling foo(), where foo() is a nasty piece of logic that contains some suspicious pointer operations. Of course — as we did in the example — you turn off buffering on stdout so that lines are actually pushed to the terminal before the program continues to execute. You run the code and see that the printf() is not reached before the program segfaults. You conclude that the crash is not due to foo(): it must have occurred in earlier code. The inference in step 3 is wrong if some dangerous operation in foo() was moved in front of the printf() and then triggered a segfault. When you make an incorrect inference while debugging, you start walking down the wrong path and can waste a lot of time there.
Embedded in Academia : A Guide to Undefined Behavior in C and C , Part 3
0 notes
coderiff · 9 years
Quote
True hackers have come to terms with a simple fact: If it runs on my machine, it's my software. I'm responsible for it. I must understand it. Building from source is the rule and not an exception. I must control my environment and I must control my dependencies.
0 notes
coderiff · 9 years
Text
Bootstrap’s Competition
There are many other popular frameworks that are competing with Bootstrap in the front-end framework arena. Some of them are: - Foundation framework by Zurb - Semantic UI - Gumby framework - Pure by Yahoo
0 notes
coderiff · 10 years
Link
0 notes
coderiff · 10 years
Text
Removing XML tags using VIM or Sublime Text
To remove XML tags and just leave the values use the following RegEx. I often need it after doing GREP on a XML files I work with to just get the values.
MacVim -> :%s/]*>//g Sublime Text -> Find with RegEx: <[/\w]*> and Replace with empty string
* MacVim runs much faster on same text.
0 notes
coderiff · 10 years
Text
RESTful API documentation/modeling tools
RAML - http://raml.org/ IO Docs - http://www.mashery.com/product/io-docs Swagger - https://helloreverb.com/developers/swagger API Blueprint - http://apiblueprint.org/
0 notes
coderiff · 10 years
Text
Encoding XML for display in webpage
function () { return this.replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); };
0 notes
coderiff · 10 years
Text
Cryptic way to checking array size in C macro
http://stackoverflow.com/a/4415646/480269 Here's a better C version (from Google's Chromium project): #define COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x]))))) It improves on the array[0] or *array version by using 0[array], which is equivalent to array[0] on plain arrays, but will fail to compile if array happens to be a C++ type that overloads operator[](). The division causes a divide-by-zero operation (that should be caught at compile time since it's a compile-time constant expression) for many (but not all) situations where a pointer is passed as the array parameter. See Is there a standard function in C that would return the length of an array? for more details. There's a better option for C++ code. See Compile time sizeof_array without using a macro for details.
0 notes
coderiff · 10 years
Link
0 notes
coderiff · 10 years
Link
0 notes
coderiff · 10 years
Text
Do the following: grep -rnw 'directory' -e "pattern" -r is recursive, -n is line number and -w stands match the whole word. Along with these, --exclude or --include parameter could be used for efficient searching. Something like below: grep --include={*.c,*.h} -rnw 'directory' -e "pattern" This will only search through the files which have .c or .h extensions. Similarly a sample use of --exclude: grep --exclude=*.o -rnw 'directory' -e "pattern" Above will exclude searching all the files ending with .o extension. This works for me very well, to achieve almost the same purpose like yours.
0 notes
coderiff · 10 years
Link
0 notes
coderiff · 10 years
Link
0 notes
coderiff · 11 years
Text
Opening CSV file saved from Python script in Mac Excel 2011
Some unicode characters are not handled properly with double click opening.
Converting the .csv to 'Unicode 16 LE with BOM' seems to work successfully when double click opening with Excel
0 notes
coderiff · 11 years
Text
Jira view issues I am watching
Advaced search with:
key in watchedIssues()
0 notes
coderiff · 11 years
Link
Terminal --> defaults write com.apple.Finder AppleShowAllFiles YES
0 notes
coderiff · 11 years
Link
$ mkdir /home/foo/doc/bar && cd $_
0 notes