# DIASPORA* the new distributed social networking service

Diaspora (stylized DIASPORA*) is a free personal web server that implements a distributed social networking service. The project is currently under development by Dan Grippi, Maxwell Salzberg, Raphael Sofaer, and Ilya Zhitomirskiy, students at New York University's Courant Institute of Mathematical Sciences.
The group was inspired to create Diaspora by a February 5, 2010 speech from Columbia University law professor Eben Moglen to the Internet Society's New York Chapter, "Freedom in the Cloud", in which Moglen described centralized social networks as "spying for free." In a New York Times interview Salzberg said "When you give up that data, you’re giving it up forever ... The value they give us is negligible in the scale of what they are doing, and what we are giving up is all of our privacy."
The project was announced on April 24, 2010 on Kickstarter and reached its initial \$10,000 fund-raising goal in 12 days. In the weeks that followed, it raised \$200,641.84 from 6479 backers, making it the second most successful Kickstarter project to date.
source: wikipedia.

Do you think that facebook will tremble with this new social service?

# Depth of field calculator

This year I'm going to start talking about one of my passions: Photography. And for starting, here you can get one of my last applications: Thundax Depth of Field Calculator. With this Delphi win32 front-end application you'll be able to calculate the Depth of field (the portion of a scene that appears sharp in the image) measurements needed in photography. You need to select the CoC (Circles of Confusion) in microns from the sidebar (there is a little sheet with the normal values for different types of cameras), the focal length from the choices, and the lens aperture from the choices. Enter the subject distance in meters from the lens and the calculated values are returned for various other designations of subject distance as well as the near limit of acuity, far limit of acuity, and the total depth of field, all in both meters and feet, accurate and rounded. The calculations are based on the very well known on-line DoF javascript calculator.

In my application you can see the difference of using different apertures (F numbers) while taking the photo. In the example you can see that the distance is the same, but the DoF grows. The aperture is getting smaller and smaller, and the shutter speed is getting longer to compensate. The distance and aperture both play a big role in depth of field. You you want to play with it, for example: for a short depth of field (blurry background) get close and use a lower f-stop. And for a long depth of field (clear all the way through) get farther away and use a higher f-stop. The following example will help you to understand better the DoF:
Picture from: Photo Basics.
The different calculations are the following ones:
```procedure TDoF.Calc(Sender: TObject);
var
focal: integer;
aperture: double;
CoC: double;
Hyperfocal: double;
distance: double;
NearF, FarF, doftotal: double;
begin
distance := StrToFloat(Edit2.Text) * 1000 * 0.3048;
focal := getFocal(ComboBox1.Text);
aperture := getAperture(ComboBox2.Text);
CoC := StrToFloat(Edit1.Text);
photovalues.Values['Subject distance (inches)'] := FloatToStr(StrToFloat(Edit2.Text) * 12) + ' in';
photovalues.Values['Subject distance (meters)'] := FloatToStr(StrToFloat(Edit2.Text) * 0.3048) + ' m';
photovalues.Values['Subject distance (millimeters)'] := FloatToStr(StrToFloat(Edit2.Text) * 0.3048 * 1000) + ' mm';
Hyperfocal := 0;
if (aperture * CoC) > 0 then
Hyperfocal := Sqr(focal) / (aperture * CoC);
photovalues.Values['Hyperfocal distance for this lens/aperture combination (meters)'] := FloatToStr(Hyperfocal) + ' m';
photovalues.Values['Hyperfocal rounded distance for this lens/aperture combination (meters)'] := FormatFloat(f, Hyperfocal) + ' m';
photovalues.Values['Hyperfocal distance for this lens/aperture combination (ft)'] := FloatToStr(Hyperfocal * feet) + ' ft';
photovalues.Values['Hyperfocal rounded distance for this lens/aperture combination (ft)'] := FormatFloat(f, Round(Hyperfocal * feet)) + ' ft';
NearF := ((Hyperfocal * 1000 * distance) / ((Hyperfocal * 1000) + (distance - focal))) / 1000;
photovalues.Values['Near limit of acceptable sharpness (meters)'] := FloatToStr(NearF) + ' m';
photovalues.Values['Rounded near limit of acceptable sharpness (meters)'] := FormatFloat(f, Round(NearF)) + ' m';
photovalues.Values['Near limit of acceptable sharpness (ft)'] := FloatToStr(NearF * feet) + ' ft';
photovalues.Values['Rounded near limit of acceptable sharpness (ft)'] := FormatFloat(f, Round(NearF * feet)) + ' ft';
FarF := ((Hyperfocal * 1000 * distance) / ((Hyperfocal * 1000) - (distance - focal)) / 1000);
if FarF < 0 then
begin
photovalues.Values['Far limit of acceptable sharpness (meters)'] := 'Infinity';
photovalues.Values['Rounded far limit of acceptable sharpness (meters)'] := 'Infinity';
photovalues.Values['Far limit of acceptable sharpness (ft)'] := 'Infinity';
photovalues.Values['Rounded far limit of acceptable sharpness (ft)'] := 'Infinity';
end
else
begin
photovalues.Values['Far limit of acceptable sharpness (meters)'] := FloatToStr(FarF) + ' m';
photovalues.Values['Rounded far limit of acceptable sharpness (meters)'] := FormatFloat(f, Round(FarF)) + ' m';
photovalues.Values['Far limit of acceptable sharpness (ft)'] := FloatToStr(FarF * feet) + ' ft';
photovalues.Values['Rounded far limit of acceptable sharpness (ft)'] := FormatFloat(f, Round(FarF * feet)) + ' ft';
end;
doftotal := Round(FarF - NearF);
if doftotal < 0 then
begin
photovalues.Values['Total depth of field (meters)'] := 'Infinity';
photovalues.Values['Total rounded depth of field (meters)'] := 'Infinity';
photovalues.Values['Total depth of field (ft)'] := 'Infinity';
photovalues.Values['Total rounded depth of field (ft)'] := 'Infinity';
end
else if (doftotal >= 0) and (doftotal < 0.001) then
begin
photovalues.Values['Total depth of field (meters)'] := '> 1 mm';
photovalues.Values['Total rounded depth of field (meters)'] := '> 1 mm';
photovalues.Values['Total depth of field (ft)'] := '> 0.0393 in';
photovalues.Values['Total rounded depth of field (ft)'] := '> 0.0393 in';
end
else
begin
photovalues.Values['Total depth of field (meters)'] := FloatToStr(doftotal) + ' m';
photovalues.Values['Total rounded depth of field (meters)'] := FormatFloat(f, Round(doftotal)) + ' m';
photovalues.Values['Total depth of field (ft)'] := FloatToStr(doftotal * feet) + ' ft';
photovalues.Values['Total rounded depth of field (ft)'] := FormatFloat(f, Round(doftotal * feet)) + ' ft';
end;
end;
```

Tell me if it's useful to you and if you need any other calculations.
PS: The program is free for non-commercial use.

# Technologies of the past

This video brings me back very good memories, where there were still floppy disks and other storage devices. I still can remember how fragile was the 5 1/4-inch floppy disk and my first installation of the MSDos 6.22 with a bunch of disks. In a short time they won't be remembered. In the video shown there are few children in front of various relics  from 20 years ago and they are asked what they were for.

# Comparing Methods using Generics

This is my first post of 2011. I will hopefully be doing more posts this year. These will include my work, tutorials, snippets of code and what I find on the web. Hopefully this year will be a good one, with new projects, more ideas and more motivation.
In Delphi 2009 appeared the Generics (containers-of-type-T) in the Delphi programming language. I have been playing with them in Delphi 2010 and here you can see my results. The new library is quite easy to use and with the help of this libraries we can enhance our code. We can also use the Anonymous methods and call the function "inline" in the sort method.
Using the Generics.defaults and Generics.Collections we can build new container or comparer classes and pass to them the type-T (Integer, String, TObject, etc.).
• Default comparer:
This example will create an Integer comparer and it will use a TIntegerList to sort its values:

```unit uComparing;

interface

uses
generics.defaults, generics.collections;

type
TIntegerComparer = class(TComparer<Integer>);
TIntegerList = class(TList<Integer>);

implementation

end. ```
usage:
```procedure TForm1.Button1Click(Sender: TObject);
var
integerList : TIntegerList;
i: Integer;
begin
integerList := TIntegerList.Create(TIntegerComparer.default);
for i := 0 to memo1.Lines.count - 1 do
integerList.Sort;
for i := 0 to integerList.count - 1 do
end;
```
• Custom Comparer:
The custom comparer will use a comparer method to sort the values in a descendant way.

```unit uComparing;

interface

uses
generics.defaults, generics.collections;

type
TIntegerComparer = class(TComparer<Integer>)
public
function Compare(const Left, Right : Integer) : Integer; override;
end;

TIntegerList = class(TList<Integer>);

implementation

{ TIntegerComparer }

function TIntegerComparer.Compare(const Left, Right: Integer): Integer;
begin
result := Right - Left;
end;

end. ```
usage:
```procedure TForm1.Button1Click(Sender: TObject);
var
integerList : TIntegerList;
i: Integer;
begin
integerList := TIntegerList.Create(TIntegerComparer.create);
for i := 0 to memo1.Lines.count - 1 do
integerList.Sort;
for i := 0 to integerList.count - 1 do
end;
```
• Anonymous Comparer:
The Anonymous comparer is created inside the sort method:

```procedure TForm1.Button1Click(Sender: TObject);
var
integerList : TIntegerList;
i: Integer;
begin
integerList := TIntegerList.Create();
for i := 0 to memo1.Lines.count - 1 do