This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(int argc, char **argv) { | |
int x = 5; | |
float y = (float)x; | |
printf("Float value: %f\n", y); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "Copying opscode.list to /etc/apt/sources.list.d" | |
sudo cp install/opscode.list /etc/apt/sources.list.d/opscode.list | |
echo "Adding opscode GPG key" | |
curl http://apt.opscode.com/[email protected] | sudo apt-key add - | |
echo "Installing chef client" | |
sudo apt-get update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Send SMS | |
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; | |
pasteboard.string = [self showDetails]; | |
// Note that there must be a space after sms://. This is because if you | |
// enter @"sms://" as your URL, the SMS will open with the inbox as the view | |
// rather than the compose window as the view | |
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:// "]]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get your Ruby version | |
$ ruby -v | |
# On my machine, this returns: ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10] | |
# So your version number is 1.8.7, patchlevel is 174 | |
# Download the specific Ruby Version | |
$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.bz2 | |
# Remember to substitute your patch level: so the URL is tp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-#{version}-p#{patchlevel}.tar.bz2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$> ./configure --add-module=../ngx_max_connections-0.0.5 | |
$> make | |
$> sudo make install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$> patch -p0 < ../ngx_max_connections-0.0.5/patches/nginx-0.6.35.patch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ tar -zxf nginx-0.6.35.tar.gz | |
$ tar -xzf ngx_max_connections-0.0.5.tar.gz | |
$ cd nginx-0.6.35 | |
$ patch -p0 < ../ngx_max_connections-0.0.5/patches/nginx-0.6.35.patch | |
$ cd ../ngx_max_connections-0.0.5 | |
$ vim Makefile #### edit the first line! | |
$ make configure | |
$ make | |
$ make test #### requires ruby, rubygems, rack, and httperf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IDT1 = ID of Thread 1, T1 = Thread 1, RT1 = Reply 1 to Thread 1, RT2 = Reply 2 to Thread 1, RT3 = Reply 3 to Thread 1, IDR1 = ID of Reply 1, IDR2 = ID of Reply 2, IDR3 = ID of Reply 3 | |
Remember that the inputs to a reduce function are like so: | |
Parameter 1: key : Array whose elements are of the form [key, id] where key is the key emitted by the map function and id is the ID of the document from which the key is generated | |
Parameter 2: values : Array of values returned by previous calls to the reduce function (OR) array of values emitted for respective elements in keys | |
Parameter 3: rereduce : Can be either true or false | |
Scenario 1: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"rows": [ | |
{ "key" : "IDT1", "value" : { "Summary Object for Thread 1" }, | |
{ "key" : "IDT2", "value" : { "Summary Object for Thread 2" }, | |
{ "key" : "IDT3", "value" : { "Summary Object for Thread 3" }, | |
{ "key" : "IDT4", "value" : { "Summary Object for Thread 4" } | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(doc) { | |
// This view gets all threads and its associated replies | |
if(doc.type == 'thread') { | |
emit([doc._id, doc.time_created], doc); | |
} else if(doc.type == 'reply') { | |
emit([doc.thread_id, doc.time_created], doc); | |
} | |
} |