Programming

Ruby Sinatra: uninitialized constant Rack::File::MIME_TYPES

Original: rack newb problem w/ 0.9.0When tried to run a sinatra based application, I received an error message: ./sinatra/lib/sinatra.rb:1156:in `mime': uninitialized constant Rack::File::MIME_TYPES (NameError)According to Ryan Tomayko "..…

Install merb-dev

Trying to install the development version of merb , i've got: no such file to load -- extlib/tasks/releaseSeems the extlib gem is too old for merb. Fix: $ git clone git://github.com/sam/extlib.git $ cd extlib $ rake gem $ sudo gem install …

TinyURL Ramaze Application

Created tinyurl ramaze application - everything in one file - model, view, controller. Required gems: sqlite3-ruby, sequel, validatable, ramaze.Even have an API: $ curl -O turl.rb http://zhware.net/code/ruby/ramaze/turl.rb.txt $ ruby turl.…

Online books

merb-book on github and Online Merb Book ramaze-book on github The Django Book

'X-Sendfile' for Rack, take 2

In the spirit of “Fork me if you like me" I forked the Rack project on github and applied my ‘X-Sendfile’ related changes. Now you can have download acceleration with: use Rack::Static, :urls => ["/files"], :root => "public", :extra => { '…

Rack::XStatic Middleware - 'X-Sendfile' for Rack

After I found the Rails X-Sendfile plugin, decided to code something similar for Rack (and Ramaze). The result: Rack::XStatic middleware. Example usage: xfile.ru rackup file. Start it with: rackup -s thin -p 7000 xfile.ruFor using it with …

Throttler Ramaze helper

After reading Rails Plugin: Throttler I created a Throttler Ramaze Helper . What is it for? ”...The throttling plugin monitors the load of your server and allows you to disable certain features of your app when the load is too high...” How…

Joyent Facebook Developer Accelerator

Got my own Joyent Facebook Developer Accelerator . Will try to put some Merb application on it. To read: Merb and Data Mapper Merb & Datamapper: Getting Rolling Tutorial on developing a Facebook platform application with Ruby On Rails Usin…

Joyent Facebook Developer Accelerator

Got my Joyent Facebook Developer Accelerator. Will try to put some Merb application on it. To read: Merb and Data Mapper Merb & Datamapper: Getting Rolling Tutorial on developing a Facebook platform application with Ruby On Rails Using Rub…

Rails 2.0 Preview Release

Tried the new Rails version. After $ rails rls20PR && cd rls20PR $ rake rails:freeze:edge TAG=rel_2-0-0_PR $ rake rails:updatefor every rake task i've got: rake aborted! no such file to load -- active_resourceThe problem: edge_rails requir…

Erlang for everyday use (3)

FeedbackNone.UpdatesSince my previous post I found a little bug in the CEAN installation. Or maybe it's just not very well documented thing: After the installation the path to the control socket is pointing by default to /usr/local/var: =E…

Erlang for everyday use (2)

Common CrapAfter the first article there was more then 1500 hits. And interesting, maybe about 80% of them coming from RubyCorner ! Feedback: near to zero – just several comments on the blog and on reddit . Nothing to improve? Nothing to a…

Erlang for everyday use (1)

After the last Osaka Erlang meeting, decided to start a column of articles for Erlang everyday use. Recently there is a big interest in Erlang, but the beginning is always difficult. Some push during the first steps usually helps. OK, on t…

New improved int2roma() and roma2int() functions

Second approximation of the conversion between old roman and integer digits. Added some error checks and released the roma2int() functionality %% convert between integer and old roman %% usage: %% convert:int2roma(555) -> "DLV" %% convert:…

Osaka Erlang Meeting #1

03-Jun-2007, Toyonaka, HotarugaikeOsaka Erlang Meeting #11. RTFMMost of the time was just reading the japanese translation of the “Programming Erlang” book. 53 pages full of japanese ;) Pretty difficult task. All people divided in 2 groups…

An Erlang Course Exercises

Like I mentioned in one of my Jaiku posts it will be good to have a page with answers for the Erlang Course Exercises . Still nobody around with such a page, so I started to put my answers in the Mercurial repository . Some of the exercise…

Erlang gen_tcp:listen options

{active, Boolean} ...If the active option is true, which is the default, everything received from the socket will be sent as messages to the receiving process. If the active option is set to false (passive mode), the process must explicitl…

Even Simpler Queue Service (ESQS)

Like a part of my Erlang study, I decided to code a pure-man queues management service, similar to Amazon SQS – Even Simpler Queue Service (or Erlang SQS you decide ;) ). For now it’s just one file qserver.erl , but i hope to make it bette…

Change to REST URLs for Rails 2.0

...No longer will we have to use RESTful URLs such as article/1;edit. We're going back to the more normal-looking article/1/edit ...

obfuscation.erl

Luke Gorrie’s comment to ‘Erlang: parallel-map and parallel-foreach’ articleParallel map brainfsck implementation in Erlang: %% Map function F over list L in parallel. parmap(F, L) -> Parent = self(), [ receive {Pid, Result} -> Result end …

Concurrent program template

Something always to start with: -module(ctemplate). -compile(export_all). start() -> spawn(fun() -> loop([]) end). rpc(Pid, Query) -> Pid ! {self(), Query}, receive {Pid, Reply} -> Reply end. loop(X) -> receive Any -> io:format("Received:~…

Programming Erlang Book

Lean how to write truly concurrent programs―programs that run on dozens or even hundreds of local and remote processors. See how to write high reliability applications―even in the face of network and hardware failure―using the Erlang progr…

Backends failover tracking

Pretty useful piece of code: is_pid_alive(Pid) when is_pid(Pid) -> rpc:call(node(Pid), erlang, is_process_alive, [Pid]).Checking if some process is alive. But working only with Erlang processes. I cannot check the status of some general TC…

reverl - REVerse proxy in ERLang

Created the reverl project on Google Code. Reverl is reverse proxy, load balancer and HTTPS front-end for Web server(s), implemented in Erlang. Before to start the real coding, I needed a more general proxy(gateway) behaviour. What exactly…

Cookie Based Sessions in Current Rails

Seems Cookie Based Sessions are the New Default in Edge Rails: ...Cookie-based sessions are just faster to retrieve and process than hitting the file-system on every request. Plus, I would imagine they scale considerably better as they’re …

Common Concurrency Patterns

Cast (send msg) A ! B Event (get msg) receive A -> A end Call (RPC) A ! {self(), B}, receive {A, Reply} -> Reply end Callback receive {From, A} -> From ! F(A) endSome trickery follows ;).Here something cool - Parallel RPC: par_rpc([A, B, C…

Erlang Mantra

Origin: Making Reliable Distributed Systems in the Presence of Software Errors Everything is a process. Processes are strongly isolated. Process creation and destruction is a lightweight operation. Message passing is the only way for proce…

Interconnecting Erlang Nodes

I have an OpenVPN -based VPN. A put some notes on connecting Erlang nodes, running on the VPN machines on my wiki. Erlang is for geeks ;)

Yaws-1.66 and "exec: 1: setuid_drv: not found"

Yaws-1.66 have a problems, compiling ot Ubuntu edgy. The problem and the solution. --- yaws-1.66.orig/configure.in 2006-06-07 22:07:31.000000000 +0200 +++ yaws-1.66/configure.in 2007-01-19 15:48:19.000000000 +0100 @@ -171,7 +171,7 @@ case …

Erl -noshell

Just a small shell wrapper to execute Erlang programs without starting the interactive shell. Saving time when working with sample code from the tutorials ;) #!/bin/bash # # Purpose: execute erlang program from the command line # side effe…