WordPress database error: [MySQL server has gone away]
UPDATE wp_options SET option_value = '' WHERE option_name = 'cache_vars'

WordPress database error: [MySQL server has gone away]
SELECT * FROM wp_users WHERE ID = '1' LIMIT 1

WordPress database error: [MySQL server has gone away]
SELECT meta_key FROM wp_postmeta WHERE meta_key = 'views' AND post_id = '218'

Apr
26
Posted on 26-04-2007
Filed Under (Erlang, Programming) by on 26-04-2007

WordPress database error: [MySQL server has gone away]
SELECT * FROM wp_users WHERE ID = '1' LIMIT 1

That’s what it takes to write an Hello World program in Erlang, after you installed the Erlang system on your machine.

Here’s the program itself:

-module(hello).
-export([hello_world/0]).

hello_world()->
    io:format("Hello World ~n").

What does that means? Briefly:

-module(hello).
Create a module for the following functions, think of it like a namespace declaration.

-export([hello_world/0]).
This tells the compiler that we want to export the

hello_world/0

function to the outer world. It means the other modules can call this function. What does the “/0″ means? It means the “hello_world” function with 0 parameters. In Erlang, you can have different functions with the same name and different number of parameters.

hello_world()->
Declare a new function named “hello_world” that accept no parameters, the body will follow the arrow.

    io:format(“Hello World ~n”).
This calls the “format” function from the module “io” that prints out the Hello World message. The “~n” characters prints the Carriage Return, the same as “/n” in other languages.

To run your program you must start the Erlang shell first:

$ erl Erlang (BEAM) emulator version 5.5.4 [async-threads:0] Eshell V5.5.4 (abort with ^G) 1> c(hello). {ok,hello} 2> hello:hello_world(). Hello World ok 3>

Try it, and understand it. Next time will be a little bit more complex! :)

Note: if you guess why by copying and pasting the code you get a lot of errors, that’s because SciTe, the editor I use, exports the code with fancy double quotes. That’s a good reason to not being lazy and write the program by yourself! Writing it’s a nice way of learning! :)

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • DZone
  • Reddit
  • Technorati
  • YahooMyWeb
    Read More   

WordPress database error: [MySQL server has gone away]
SELECT * FROM wp_users WHERE ID = '1' LIMIT 1

WordPress database error: [MySQL server has gone away]
SELECT * FROM wp_comments WHERE comment_post_ID = '218' AND comment_approved = '1' ORDER BY comment_date

Post a Comment
Name:
Email:
Website:
Comments:

WordPress database error: [MySQL server has gone away]
DESC wp_comments

WordPress database error: [MySQL server has gone away]
ALTER TABLE wp_comments ADD COLUMN comment_subscribe enum('Y','N') NOT NULL default 'N'