664OpenGL in Processing using Eclipse
Instructions to set up Processing+OpengGL in Eclipse.
http://processing.org/discourse/yabb2/YaBB.pl?num=1114400513/30 http://programminginteractivity.com/wordpress/?p=175
Instructions to set up Processing+OpengGL in Eclipse.
http://processing.org/discourse/yabb2/YaBB.pl?num=1114400513/30 http://programminginteractivity.com/wordpress/?p=175
Google Venn Charts use a somewhat cryptic parameter for the relative size of the groups and their overlapping areas:
&chd=s:93_a___
Where '9' is the size of one group, '3' the size of the other and 'a' the size of their overlapping regions. Clearly Google was trying to come up with a one-character coding scheme, the goal was to map one character to a range from 0 .. 100.
So, after a couple of minutes well spend, I present the Google Venn Chart coding table:
//php
$code = array( "A","B","B","C","C","D","E","E","F","F",
"G","H","H","I","J","J","K","K","L","M",
"M","N","N","O","P","P","Q","Q","R","S",
"S","T","T","U","V","V","W","W","X","Y",
"Y","Z","a","a","b","b","c","d","d","e",
"f","f","g","g","h","h","i","j","j","k",
"k","l","m","m","n","n","o","p","p","q",
"q","r","s","s","t","t","u","v","v","w",
"w","x","y","y","z","0","0","1","2","2",
"3","4","4","5","5","6","7","7","8","8",
"9");
The index of the array corresponds to the percentage of the size. Now we can infer, that our example from above, &chd=s:93_a___ means: 9 → 100, 3 → 90 and a → 42. Note that some values have multiple indexes, I guess Venn charting is not that exact of a science.
This example is dealing with 2 groups and one intersections, but there is not reason, why it should not work with 3-group Venn diagrams.
Nice way and fast way of finding the largest number in an array.
var arr = [1233, 32, 442];
var largest = Math.max.apply(Math, arr);
http://ejohn.org/blog/fast-javascript-maxmin/
http://stackoverflow.com/questions/1379553/how-might-i-find-the-largest-number-contained-in-a-javascript-array
Moving PHP Associative Array (Dictionaries, whatever..) over for use in Javascript. In JS Associative Array are actually objects, so we might as well make it into one.
echo "var data =" . json_encode($somatic, JSON_FORCE_OBJECT) . ";
Open your preferences.txt, set editor.antialias=true. Works with Processing 1.2.1
Ok, here's a challenge. Say, you have a massive, 11 Gigabyte text file. The first two lines are the header files, unfortunately the header on line 2 is slightly wrong: Instead of 'Done' it should say 'Status:Done'. (Hit: 'Done' is the first occurrence of that string in that line)
Any Ideas?
[Update]
sed seems to be the tool for this job.
sed '2 s/Done/Status:Done/' input.txt > output.txt
Took about 7 minutes on my machine... Any better ideas still very much appreciated.
[Update 2: How to insert a tab with sed]
Inserting a tab with sed turned out to be more resilient than expected. Neither an escaped tab (\t) not a double-escaped tab (\t) seemed to do the trick. On bash it is necessary to drop out of sed and print the tab (\011) directly. 27 in the following statement means of course line 27.
sed '27 s/Done/Status:Done'"$(printf '\011')"'After Tab/' in.txt > out.txt
Hmm. That's an interesting one.
After an app crashed on me, it left hundreds (thousands?) of files littering my desktop. The expected rm littering_files* produced the unexpected error message:
/bin/rm: Argument list too long.
Seems like a BSD kernel limitation. Here is more.
Silly, little C++ Beginner's mistake.
How do you print strings in C++?
string test = "tssst";
printf(test);
Of course not, that's C++!!!
That's how you do it:
printf(test.c_str());
And if you want to stop the compiler throwing warnings:
printf("%s", test.c_str());
So close, yet so far out.
http://stackoverflow.com/questions/1775954/using-python-3-1-with-textmate
Variable can be set in TextMate either on a global or on a per project basis. It seems some of the internals are coded using Python 2.x, therefore a global switch to the backwards-incompatible 3.x is not recommended.
Project based variable can be set by opening a project, deselecting any text files, and clicking on the little i-icon in the project window. My path for Python 3.1 is:
TM_PYTHON
/Library/Frameworks/Python.framework/
Versions/3.1/bin/python3
Your milage might vary.
The keyword inline, when applied to functions, tells the compiler to optimize calls to the functions. Usually used for short functions and for the sake of clarity.
inline int max(int a, int b) {
return a + b;
}
int main(void) {
int x = 2;
int y = 6;
printf("result: %d", add(x,y));
}
// ok, the example is stupid, but i hope it illustrates the idea
Looks exactly the same as calling a function, but actually the function is not called, no function-calling overheads are created. Instead the inline function is expanded in place, where it is called. Obviously this only makes sense with rather short functions.