Twitter Pulse #fsharp 2013

F# Twitter Pulse 2013

Previously I have published statistics about #fsharp twitter hashtag. This one is based on the tweets that I collected throughout the whole 2013 year. Every week while working on the F# weekly I have downloaded all tweets with hashtag #fsharp and pushed them to my local MongoDB. I managed to collect about 24000 tweets from more than 3000 twitter users.

The first picture on the top of this page is based on total twitter activity around #fsharp hashtag. The size of twitter names depends on sum number of people tweets and retweets. Other charts are self descriptive. Thank you guys for your effort, let’s make 2014 even better.

top30writerstop30retweeters

weeklyTwitterActivity

Update:

Michael Newton proposed an interesting idea: “Calculate number that measures F# community love”. I calculated number of retweets for each twitter account and divided it by number of unique tweets from this account (both with #fsharp hash tag). Finally, I excluded accounts who did less than 10 new tweets about F# in a year. Here it is:

rperp2

F# Image Blurrer

Image blurring is a king of popular task during presentation preparation. For example, if you want show something but hide sensitive information. Of course you can buy Photoshop but it is too expensive for such a simple task. Also you can download Paint.NET, but this is not an option for F# geek – it is too easy=). It is much better to write something by yourself (Binaries are available as well as source code).

open System
open System.IO
open System.Drawing
open System.Drawing.Imaging

let blur (image:Bitmap) blurSize =
    let blurred = new Bitmap(image.Width, image.Height)
    use graphics = Graphics.FromImage(blurred)
    let rectangle = Rectangle(0, 0, image.Width, image.Height)
    graphics.DrawImage(image, rectangle, rectangle, GraphicsUnit.Pixel);
    for X in [0..image.Width-1] do
        for Y in [0..image.Height-1] do
            let (r,g,b,c) =
                [Math.Max(0, X-blurSize)..Math.Min(image.Width-1, X+blurSize)]
                |> Seq.fold (fun sum x ->
                    [Math.Max(0, Y-blurSize)..Math.Min(image.Height-1, Y+blurSize)]
                    |>  Seq.fold (fun (r,g,b,c) y ->
                        let p = blurred.GetPixel(x,y)
                        (r + (int)p.R, g + (int)p.G, b + (int)p.B, c+1)
                     ) sum
                 ) (0,0,0,0)
    blurred.SetPixel(X, Y, Color.FromArgb(r/c, g/c, b/c));
    blurred

[<EntryPoint>]
let main argv =
   try
       printfn "argv = %A" argv
       let (fileName, blurSize) =
       match argv with
       | [|fileName|] -> (fileName, 3)
       | [|fileName; size|] ->
           match Int32.TryParse(size) with
           | (true, blurSize) when blurSize > 0 -> (fileName, blurSize)
           | _ -> failwithf "Incorrect blurSize '%s'" size
           | _ -> failwith "Incorrect parameters. Please enter 'fileName' and 'blurSize'"
       printfn "FileName:%s\nBlurSize:%d" fileName blurSize
       if (not(File.Exists(fileName)))
           then failwithf "File '%s' does not exist." fileName

      use inputStream = new MemoryStream(File.ReadAllBytes(fileName));
      use source = new Bitmap(Image.FromStream(inputStream));
      printfn "Processing..."
      use result = blur source blurSize
      printfn "Saving..."
      let resultFileName =
          sprintf "%s_%dblurred.jpg" (Path.GetFileNameWithoutExtension(fileName)) blurSize
      result.Save(resultFileName, ImageFormat.Jpeg)
      printfn "Done!"
   with
   | e ->
       printfn "Exception : %s" e.Message
       Console.ReadLine() |> ignore
   0
fsharp.org
Origin image
Blurred image (blurSize=3)
Blurred image (blurSize=3)

 

Rhythm of the F# Сommunity heartbeat

The new year is getting closer. It is time of magic and miracles, time to sum up and to lift the veil of secrecy over F# Community.

I have been collecting all tweets (and retweets) with hashtag #fsharp since the beginning of November. It is time to show up some statistics. 😉

When are we tweeting? – Always!

F# Community Heartbeat
F# Community Heartbeat. London time zone (UTC)

Do we have a rest from F#? – A bit on Saturday.

DayOfWeek
Tweets distribution by day of week.

Who to follow? – Choose yourself.

Top 20 most active users (based on the tweets and RT)
Top 20 most active users (based on the tweets and RT)

Who writes more of unique tweets?

Top 20 users that generates unique tweets.
Top 20 users that generates unique tweets.

Who is the best retweeter?

Top 20 best retweeters.
Top 20 the best retweeters.

F# for heating

Sometimes, when you feel really alone and want a bit of heat then F# can help you here.

All you need is a laptop and F#. Just type the following snippet into FSI and wait for a minute. =)

[|1..999|] |> Array.Parallel.iter (fun _ ->
    while true do ignore())

Wish you warm Christmas!

P.S. The same solution works when you are freezing.