This file contains 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
<?php | |
$num_workers = 5; | |
$pid = 1; | |
for($i = 0; $i < $num_workers; $i++) { | |
$pid = pcntl_fork(); | |
if($pid == 0) { | |
break; | |
} | |
} |
This file contains 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
<?php | |
$context = new ZMQContext(); | |
$pub = $context->getSocket(ZMQ::SOCKET_PUB); | |
$pub->bind('tcp://*:5566'); | |
$sub = makesock($context); | |
$sub2 = makesock($context); | |
$pub->send(rand(0,10)); | |
function makesock($context) { |
This file contains 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 <zmq.h> | |
#include <pthread.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdarg.h> | |
#include <string.h> | |
#include <sys/time.h> | |
#include <time.h> |
This file contains 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 <zmq.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <stdint.h> | |
int main () { | |
void *context = zmq_init (1); | |
printf("Creating Sockets \n"); | |
int64_t rate = 1000; |
This file contains 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
<?php | |
$posting = $database->postlist_begin( $search_id ); | |
$enquire = new XapianEnquire( $database ); | |
$rset = new XapianRset(); | |
$rset->add_document( $posting->get_docid() ); | |
$eset = $enquire->get_eset(20, $rset); | |
$i = $eset->begin(); | |
$terms = array(); |
This file contains 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
(defn is-valid? | |
[node left-val right-val] | |
(if (= node nil) | |
true | |
(if | |
(and | |
(> (:key node) left-val) | |
(<= (:key node) right-val) | |
(is-valid? (:left node) left-val (:key node)) | |
(is-valid? (:right node) (:key node) right-val) |
This file contains 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
static NSString * const kClientId = @"123456789.apps.googleusercontent.com"; | |
+ (NSString *) clientId | |
{ | |
return kClientId; | |
} |
This file contains 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
#import "AppDelegate.h" | |
@implementation FirstViewController | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
NSString *clientId = [AppDelegate clientId]; | |
share = [[GooglePlusShare alloc] initWithClientID:clientId]; | |
} |
This file contains 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
- (IBAction) didPressShare: (id)sender { | |
[[[[share shareDialog] | |
setURLToShare:[NSURL URLWithString:@"http://www.riskcompletefailure.com"]] | |
setPrefillText:@"This is the blog which I am reading!"] open]; | |
} |
This file contains 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
- (void)finishedSharing:(BOOL)shared { | |
NSString *text = shared ? @"Shared!" : @"Cancelled!"; | |
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Result" | |
message:text | |
delegate:nil | |
cancelButtonTitle:@"OK" | |
otherButtonTitles:nil]; | |
[alert show]; | |
} |
OlderNewer