Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
function f() {
sleep "$1"
echo "$1"
}
while [ -n "$1 ]
do
f "$1" &
shift
done
There are no "full stack developers". Its a silly buzzword. Sadly working on kernel issues, a real time networked embedded system, or implementing a TCP stack is a different world than building an advertising website in PHP on MySQL.
Even if they did exist there are so many things to know that they would not have the depth required to actually solve an issue in any.
new FSMDefinition<State>().CompletesWith<Completed>().
InState(State.Initial).With((state, x) => {
//dosomething
return State.Middle;
}).
InState(State.Middle).With((state, x) => {
//do something else
Send(new NextMessage(...));
return State.Ending;
}).
commit 273e4c4bca3ff94106eb4a75dfe2f8f829f052a4
Author: Greg Young <gregoryyoung1@gmail.com>
Date: Mon Apr 18 15:20:14 2016 +0100
add TTL to httpsend messages
commit bc2d462fadec1d7a8e00260936e70bd73185c568
Author: James Nugent <james.nugent@bathasu.com>
Date: Mon Jul 7 11:25:36 2014 +0100
#endif
/* Time counting */
#define MONO_PROFILER_GET_CURRENT_TIME(t) {\
struct timeval current_time;\
gettimeofday (&current_time, NULL);\
(t) = (((guint64)current_time.tv_sec) * 1000000) + current_time.tv_usec;\
} while (0)
static gboolean use_fast_timer = FALSE;
#Cheating
The patterns Copy-Replace, Stream-Split, and Join-Stream the last chapter are quite intense. Getting them to work on a running system is non-trivial. There will be times that they might need to be used however most of the time they can be avoided.
The patterns will work in any scenario. It does not matter whether it is a system that is doing 5000 transactions per second with TB of data or one doing seconds per transaction with 1 GB of data. They work in the same way.
There exist however "cheats" that can be used to avoid the use of the more complicated patterns. Depending on the scenario they may or may not apply, the trade offs associated with them may be better or worse than the complexity associated with the other patterns.
This chapter we will look at some of these "cheats" and where and when they might be applicable. Some are adding code complexity to avoid the need to versioning, others look at different deployment options. If possible you should generally prefer a pattern from this chap
The performance implications of try are more severe than I had thought. I thought it was just code within the try block that isn’t optimized. It turns out it’s everything around the block too. Take this code:
object syncObject = new Object();
[System.Runtime.CompilerServices.MethodImpl(MethodImplOptions.NoInlining)]
public int Member ( )
{
var lowest = _outstandingMessages.GetLowestPosition();
var lowestBufferedRetry = _streamBuffer.GetLowestRetry();
Log.Debug("Lowest from outstanding is " + lowest);
Log.Debug("Lowest from streambuffer is " + lowestBufferedRetry);
lowest = Math.Min(lowest, lowestBufferedRetry);
if (lowest == int.MinValue) lowest = _lastKnownMessage;
//no outstanding messages. in this case we can say that the last known
//event would be our checkpoint place (we have already completed it)
var difference = lowest - _lastCheckPoint;
Log.Debug("lastCheckPoint is " + _lastCheckPoint);
By the Jurassic, the sophisticated aerial webs of the orb-weaver spiders had already developed to take advantage of the rapidly diversifying groups of insects. A spider web preserved in amber, thought to be 110 million years old, shows evidence of a perfect "orb" web, the most famous, circular kind one thinks of when imagining spider webs. An examination of the drift of those genes thought to be used to produce the web-spinning behavior suggests that orb spinning was in an advanced state as many as 136 million years ago. One of these, the araneid Mongolarachne jurassica, from about 165 million years ago, recorded from Daohuogo, Inner Mongolia in China, is the largest known fossil spider.
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
#include <stdbool.h>
#include <string.h>