Survey: What’s Your Favorite IDE?

If you are interested in IDE flame wars debating, here it is another brief (10 question) survey about which IDEs are being used, by Genuitec and AvantSoft: What’s Your Favorite IDE and How Well do You Know It?

WP-chgFontSize WordPress plugin v1.2 released

I have updated the WP-chgFontSize WordPress plugin to fix a nasty bug:

  • Bug: first click on + size, it jump to GIANT font size.

You can download the new version v1.2 at the WordPress Plugins Directory.

Comments

Comment by Obrazy on 2010-01-10 18:33:47 +0000

Hi there, nice site with good info. I really like coming back here often. There’s only one thing that annoys me and that is the misfunctioning of comment posting. I usually get to 500 error page, and have to do the post twice.

links for 2007-08-28

Erlang ring problem

As I am on vacation, I have had some time to read part of the Programming Erlang book I mentioned some posts ago. After reading the firsts chapters, I was surprised to see that one of the not so much mentioned Erlang central features is that relies extremely on the pattern matching idiom. Just one example, the “=” operator is a pattern matching operator, which behaves like assignment when the variable is unbound, and act like a pattern matching expression when it is bound.

Another feature that I was glad to see is the actor model paradigm, with messages sent from and to Actors (like Scala or Smalltalk) to deal with highly complex concurrency models.

But after playing with some of the examples that appear on the book, I found this exercise at the end of the chapter 8 :

Write a ring benchmark. Create N processes in a ring. Send a message round the ring M times so that a total of N * M messages get sent. Time how long this takes for different values of N and M.

Ok, so here it is my solution (ring.erl):

-module (ring).
-export ([start/2]).

start(N, M) ->
     statistics(runtime),
     statistics(wall_clock),
     Main_process = self(),
     io:format("Creating ~p ring processes~n", [N]),
     spawn(fun() -> ring(1, N, M, self(), Main_process) end),
     receive
          ended -> void
     end,
     {_, Time1} = statistics(runtime),
     {_, Time2} = statistics(wall_clock),
     U1 = Time1,
     U2 = Time2,
     io:format("Ring benchmark for ~p processes and ~p messages =
                    ~p (~p) milliseconds~n", [N, M, U1, U2]).

ring(_, N, _, _, _) when(N =< 0)->
     io:format("Empty ring~n"),
     erlang:error(emptyRing);
ring(_, _, M, _, _) when(M =< 0)->
     io:format("No messages to send~n"),
     erlang:error(noMessagesToSend);
ring(N, N, M, First_process, Main_process) ->
     io:format("Ring process ~p (~p) created~n", [N, self()]),
     io:format("Sending ~p messages through the ring~n", [M]),
     First_process ! {send, main_process, Main_process},
     loop(M, N, N, First_process, Main_process);
ring(I, N, M, First_process, Main_process) ->
     io:format("Ring process ~p (~p) created~n", [I, self()]),
     Next_process = spawn(fun() -> 
          ring(I+1, N, M, First_process, Main_process) end),
     loop(M, I, N, Next_process, Main_process).

loop(0, N, N, _, Main_process) ->
     io:format("Ring process ~p (~p) finished~n", [N, self()]),
     Main_process ! ended;
loop(0, I, _, _, _) -> 
     io:format("Ring process ~p (~p) finished~n", [I, self()]);
loop(M, I, N, Next_process, Main_process) ->
     receive
          {send, From, From_process} ->
               io:format("Process ~p (~p) received message ~p 
                    from process ~p (~p) ~n", [I, self(), M, From, From_process]),
               Next_process ! {send, I, self()},
               loop(M-1, I, N, Next_process, Main_process)
     end.

And here the benchmark results based on Erlang R11B, two different configuration machines and running the above code but without I/O (ring_noio.erl):

  1. Mac OS-X 10.4.10:
  • Processor: Intel Core 2 Duo Processor 2.2 GHz
  • Memory: 2 Gb 667 MHz DDR2
  1. Windows XP Professional SP2:
  • Processor: AMD Athlon 64 X2 Dual Core Processor 4200+ (working each core at 2.2 GHz)
  • Memory: 2 Gb 667 MHz DDR2

Erlang ring problem: Benchmark

The exercise illustrates how long it takes to spawn a large number of processes and the cost of message passing between them. There is no parallelism in this exercise, as there is only one process active at a time (the others are waiting for a message), but demonstrates how well Erlang can deal with lots of processes and lots of sending and receiving messages. Although I believe I need to do more serious tests, creating 10.000 process and passing 100 million messages in 35 seconds is a great mark.

The second part of the exercise is to write a similar program in some other programming language and to compare the results. Check these links to see some results:

Next chapters: distributed programming, OTP and Mnesia (the Erlang Database).

Comments

Comment by Simon on 2007-08-30 07:48:07 +0000

Your solution is clearer to me than the one over at http://muharem.wordpress.com/ though I found that a very interesting article, too.

Thanks for this. I’m working my way through the book v-e-r-y slowly as coming from a purely flash development background almost all Erlang concepts are new on me.

But, damn, there’s just something about erlang that makes me want to learn it!

Comment by Ernest Micklei on 2008-05-27 14:22:04 +0000

Please have a look at my version:

http://philemonworks.wordpress.com/2008/05/23/ring-benchmark-my-first-concurrent-erlang/

I did not spend much time on gathering significant statistics. Getting a readable compact program was far more challenging.

Comment by David Grenier on 2011-06-11 03:22:52 +0000

Hello,

The following implementation in C# using Rx.NET runs in 1min58 in LINQPad on quad core Q6600@2.4ghz:

var listeners =
	  
Enumerable.Range(0, 10000)
		  
.Select(_ => new Subject(Scheduler.TaskPool))
		  
.MemoizeAll();

listeners.Publish(o => o.Zip(o.Skip(1), (l, r) => new { l, r}))
	  
.Run(o => o.l.Subscribe(o.r));

Observable
	  
.Range(0, 10000)
	  
.Delay(TimeSpan.FromMilliseconds(1000))
	  
.Subscribe(listeners.First());

listeners.Last().Last().Dump();

I also have the following F# implementation running in 50s on the same machine (F# interactive):

type Agent = MailboxProcessor

let count = 10000
  
let now = System.DateTime.Now

Agent.Start (fun inbox ->
      
async {
          
while true do
              
let! msg = inbox.Receive()
              
if msg = count then
                  
printfn “%A” (System.DateTime.Now – now).TotalMilliseconds })
  
|> Seq.unfold (fun next ->
                  
let agent = Agent.Start (fun inbox ->
                                  
async {
                                      
while true do
                                          
let! msg = inbox.Receive()
                                          
next.Post msg } )
                  
Some (agent, agent))
  
|> Seq.nth count
  
|> (fun agent -> for i in 1..count do agent.Post i)

Both code seems to scale pretty well versus the timing I had on my dual core laptop at work (T7400), although I only remember the time for the C#-Rx version at 5min50.

David

Switched to Mac

Haven’t had time to write about it, still, better late than never.

I have always heard positive experiences from people switching to Mac. Last month, forced by the slowing down of my Acer TravelMate 290 laptop and encouraged by Andy Piper and Eneko Alonso, who had blogged their recent switching experiences, I finally bought a 15” MacBook Pro and a Mighty Mouse from Apple.

Despite there is always a bit of a learning curve involved (I have had some minor issues due to Windows-Mac equivalent keys, as the Print Screen, Control and Command, and Alt and Options keys), I found the move very easy. Setting up Mac OS X is really simple, and the user interface behavior is terrific. I have also found the blogosphere as a very valuable aid for switchers, as it is plenty of useful tips and hints. I recommend you How to Switch to the Mac and Andy Piper’s Mac posts.

After playing with some applications that I have found at some Mac specialized web sites as MacUpdate, here is the list of them that I have installed so far:

  • Adium (free): instant messaging application for Mac OS X that can connect to AIM, MSN, Jabber, Yahoo, and more.
  • Eclipse (free): the essential IDE.
  • Firefox (free): the essential open-source browser.
  • Flickr Uploadr (free): to upload your photos to Flickr.
  • Flip4mac WMC Player (free): a collection of QuickTime components that allow you to play, import, and export Windows Media video and audio files on your Mac using your favorite QuickTime-based applications.
  • Growl (free): a notification system for Mac OS X.
  • iTerm (free): a full featured terminal emulation program.
  • NeoOffice (free): a free software port of OpenOffice to the MacOS X platform.
  • OnyX (free): it allows you to run misc tasks of system maintenance, to configure some hidden parameters of the Finder, Dock, Dashboard, Exposé, Safari, Login window and of some of Apple’s own applications, to delete caches, to remove a certain number of files and folders that may become cumbersome, to see the detailed info of your configuration, to preview various logs and CrashReporter-reports, to check the Preferences files and more.
  • Parallels (79.99$): enables you to run Windows, Linux, and more side-by-side with Mac OS X on any Intel-powered Mac, without rebooting (coherence mode is terrific!).
  • Plazer (free): a little piece of software that will help you make the most out of Plazes.
  • PocketMac for Blackberry (free): to sync BlackBerry device with Entourage, Address Book, iCal, Now Contact, Now Up-To-Date, and even Stickies.
  • QuickSilver (free): a unified, extensible interface for working with applications, contacts, music, and other data.
  • Skype (free): free calls over the Internet.
  • Textmate (39$): a powerful tool for programmers, web designers, and anyone else who regularly needs to work with text files on Mac OS X.
  • Transmit (29.95$): FTP, SFTP, or TLS/SSL.
  • Twitterrific (free): a fun little application that lets you both read and publish posts or “tweets” to the Twitter community website.
  • Visionary Saver (free): Twittervision/Flickrvision and Twittervision 3D screen saver.
  • VLC (free): a highly portable multimedia player for various audio and video formats (MPEG-1, MPEG-2, MPEG-4, DivX, mp3, ogg, …) as well as DVDs, VCDs, and various streaming protocols.
  • XCode (free): to create Mac OS X applications (It is bundled free with Mac OS X v10.4, though is not installed by default).

Anyway, as a Mac beginner user, your tips will be welcomed.

Comments

Comment by andyp on 2007-08-08 14:16:52 +0000

I’d recommend jUploadr rather than Flickr Uploader – it is far, far richer in function. other than that, I’m pretty much using the same stuff as you, except for those tools I don’t need (blackberry, Parallels, etc.).

You might find the Textmate book helpful.

And thanks for referencing my posts! I’m glad you found them useful.

Comment by Antonio on 2007-08-08 17:25:53 +0000

I’ve found iusethis.com for a source of popular apps and such. Off the top of my list would be the Unsanity products HERE, of course, as you’ve listed it already, Flip4Mac, iBackup, info.xhead, and another one by the Flip4Mac people, Drive In.

Comment by Ferdy on 2007-08-09 00:37:55 +0000

Andy, Antonio, thanks for the recommendations!

Comment by kellyd on 2007-08-09 03:15:10 +0000

welcome to the dark side, ferdy. It’s nice here. 🙂