Lua is a small, fast, interpreted scripting language. Lua is the result of a merger of a configuration language (SOL) and a data entry language (DEL) . Lua's original goal was to be an extensible embedded scripting language inside software applications. Lua has been highly successful as an embedded scripting language and is used in many games, firmware and software applications. With the recent addition of modules, Lua now has a standard method to load libraries. Lua together with Lua libraries enables a complete standalone scripting language.
Lua's unique focus on extensibility, simplicity, efficiency and portability make it a small yet powerful scripting language. Lua is often used as a Domain Specific Language due to its small size, embeddability and portability. Lua supports a small set of general features and provides meta-mechanisms to allow the programmer to support programming styles of their choice.
Lua was developed by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes at the Pontifical University of Rio de Janeiro (PUC-Rio), in Brazil.
Lua means Moon in Portuguese, so be ready for libraries with references to space or the moon, and enjoy.
2. What is Lua for Windows?
Lua for Windows is a 'batteries included environment' for the Lua scripting language on Windows.
Lua for Windows combines Lua binaries, Lua libraries with a Lua-capable editor in a single install package for the Microsoft Windows operating system. Lua for Windows contains everything you need to write, run and debug Lua scripts on Windows. A wide variety of libraries and examples are included that are ready to use with Microsoft Windows. Lua for Windows runs on Windows 2000 and newer versions of Windows. Lua and its associated libraries are also available for other operating systems, so most scripts will be automatically cross-platform.
A friend recently told me that PHP is on its way out, Lua is where it's at. I scoffed. I chuckled. Then I gave it some thought. Could PHP have had its day?
So time to do a bit of research. My first port of call was of course www.php.net - source for all things good and PHP-ish. According to the usage graph, things are not looking good. PHP usage peeked around August last year after an unstoppable climb since 2000, but has taken a disturbingly downward tack since then.
On to another report for a bit more clarity. The folk at Security Space have a pretty useful breakdown of all Apache modules' popularity. PHP is sitting pretty at number one on over 40% of Apache servers, but there is a minor decrease since last month. FrontPage (yuch!) is sitting at four, and Perl at number five. Python is quite far down the list, and Lua is way, way down.
I have to conclude that my friend might be right in one respect � PHP has had its day. If the trend continues, it means that PHP will one day not be the hottest thing on the web like it is right now. While I might lament about my soon-to-be-obsolete skills, if I remove my emotions from the situation it's clear that this was inevitable. The fact is that all top computing languages come in and out of favour. Coming in to favour in the first place is a major achievement � only a couple of the hundreds out there ever make the grade. Remember Cobol? Pascal? Logo? Delphi? They've all become historical anecdotes with the occasional application still clinging on to a glorious past, and desperate for developers with has-been skills.
But I'm not going to cry or gnash my teeth just yet. PHP still has plenty of legs, and it will take quite a bit to wind it. I'm not sure what will take its place, but somehow I think Lua will be the successor. For all its publicity, its market share seems pretty dismal and doesn't seem to be getting enough weight behind it to be a real challenger any time soon. Netcraft's stats show a surprise come-back from Microsoft recently, so maybe .Net or Mono might make a play, but I also feel that the .Net framework is a little too clunky for web applications. PHP's advantage over the rest is that it's a web application, through and through. It doesn't try to also be a desktop application language, a server application language, a widget application language... it just spits out web pages fast and efficiently.
Somewhere out there, there's probably a geek in a basement or cubicle crafting a completely new web language. His work now might see the emergence of something new and great in five years time. And when that comes, I guess I'll have to change, re-learn, re-skill. Until then, I'm going to cling tenaciously to my PHP, because today � no matter what anyone tells me � PHP is still very much alive.
So time to do a bit of research. My first port of call was of course www.php.net - source for all things good and PHP-ish. According to the usage graph, things are not looking good. PHP usage peeked around August last year after an unstoppable climb since 2000, but has taken a disturbingly downward tack since then.
On to another report for a bit more clarity. The folk at Security Space have a pretty useful breakdown of all Apache modules' popularity. PHP is sitting pretty at number one on over 40% of Apache servers, but there is a minor decrease since last month. FrontPage (yuch!) is sitting at four, and Perl at number five. Python is quite far down the list, and Lua is way, way down.
I have to conclude that my friend might be right in one respect � PHP has had its day. If the trend continues, it means that PHP will one day not be the hottest thing on the web like it is right now. While I might lament about my soon-to-be-obsolete skills, if I remove my emotions from the situation it's clear that this was inevitable. The fact is that all top computing languages come in and out of favour. Coming in to favour in the first place is a major achievement � only a couple of the hundreds out there ever make the grade. Remember Cobol? Pascal? Logo? Delphi? They've all become historical anecdotes with the occasional application still clinging on to a glorious past, and desperate for developers with has-been skills.
But I'm not going to cry or gnash my teeth just yet. PHP still has plenty of legs, and it will take quite a bit to wind it. I'm not sure what will take its place, but somehow I don't think Lua will be the successor. For all its publicity, its market share seems pretty dismal and doesn't seem to be getting enough weight behind it to be a real challenger any time soon. Netcraft's stats show a surprise come-back from Microsoft recently, so maybe .Net or Mono might make a play, but I also feel that the .Net framework is a little too clunky for web applications. PHP's advantage over the rest is that it's a web application, through and through. It doesn't try to also be a desktop application language, a server application language, a widget application language... it just spits out web pages fast and efficiently.
Somewhere out there, there's probably a geek in a basement or cubicle crafting a completely new web language. His work now might see the emergence of something new and great in five years time. And when that comes, I guess I'll have to change, re-learn, re-skill. Until then, I'm going to cling tenaciously to my PHP, because today � no matter what anyone tells me � PHP is still very much alive.
Image by Gea-Suan Lin via Flickr
Um cliente MySQL em Unix pode conectar ao servidor mysqld de dois modos diferentes: sockets Unix, que conectam através de um arquivo no sistema de arquivos (padrão /tmp/mysqld.sock) ou TCP/IP, que conecta através um número de porta. Sockets Unix são mais rápidos que TCP/IP mas só podem ser usados quando conectados ao servidor no mesmo computador. Sockets Unix são usados se você não especificar um nome de máquina ou se você especificar o nome de máquina especial localhost.
No Windows, se o servidor mysqld está rodando no 9x/Me, você só pode conectar via TCP/IP. Se o servidor estiver rodando no NT/2000/XP e o mysqld é iniciado com --enable-named-pipe, você também pode conectar com named pipes. O nome do named pipes é MySQL. Se você não der um nome de máquina quando conectar ao mysqld, um cliente MySQL tentará conectar primeiro ao named pipe, e se isto não funcionar ele irá conectar a porta TCP/IP. Você pode forçar o uso de named pipes no Windows usando . como nome de máquina.
O erro (2002) Can't connect to ... normalmente significa que não há um servidor MySQL rodando no sistema ou que você está usando um arquivo socket ou porta TCP/IP errado ao tentar conectar so servidor mysqld.
Inicie verificando (usando ps ou gerenciador de tarefas do Windows) que há um processo chamado mysqld executando em seu sistema! Se não houver nenhum processo mysqld, você deve iniciar um. Veja Secção 2.4.2, "Problemas Inicializando o Servidor MySQL".
Se um processo mysqld estiver em execução, você pode verificar o servidor tentando estas diferentes conexões (o número da porta e o caminho do socket devem ser diferente em sua consiguração, é claro):
shell> mysqladmin version
shell> mysqladmin variables
shell> mysqladmin -h `hostname` version variables
shell> mysqladmin -h `hostname` --port=3306 version
shell> mysqladmin -h 'ip for your host' version
shell> mysqladmin --protocol=socket --socket=/tmp/mysql.sock version
Note o uso de aspas para traz em vez de aspas para frente com o comando hostname; isto provoca a saída de hostname (que é, o nome de máquina atual) para ser substituído no comando mysqladmin.
Aqui estão algumas razões pela quais o erro Can't connect to local MySQL server pode ocorrer:
mysqld não está rodando;
Você está rodando em um sistema que usa MIT-pthreads. Se você estiver executando em um sistema que não possui threads nativas, o mysqld usa o pacote MIT-pthreads. Veja Secção 2.2.3, "Sistemas Operacionais suportados pelo MySQL". No entanto, nem todas as versões de MIT-pthreads suportam sockets Unix. Em um sistema sem suporte a sockets você sempre deve especificar o nome de máquina explicitamente ao conectar ao servidor. Tente usar este comando para verificar a conexão com o servidor:
shell> mysqladmin -h `hostname` version
Alguém removeu o socket Unix que o mysqld utiliza (por padrão /tmp/mysqld.sock). Você deve ter um trabalho cron que remove o socket MySQL (por exemplo, um trbalhoque remove arquivos antigos do diretório /tmp). Você sempre pode executar mysqladmin version e verificar que o socket que o mysqladmin está tentando usar realmente existe. A correção neste caso é alterar o trabalho cron para não remover mysqld.sock ou para colocar o socket em outro local. Veja Secção A.4.5, "Como Proteger ou AlterarHow to Protect or Change the MySQL Socket File /tmp/mysql.sock";
Você está usando Linux e uma thread finalizou (core dumped). Neste caso você deve matar as outras threads mysqld (por exemplo, com o script mysql_zap antes de você poder iniciar um novo servidor MySQL. Veja Secção A.4.1, "O Que Fazer Se o MySQL Continua Falhando";
Você pode não ter privilégios de leitura e escrita tanto no diretório que guarda o arquivo de socket quanto no próprio arquivo de socket. Neste caso você deve mudar o privilégio do diretório/arquivo ou reiniciar mysqld para que ele use um diretorio que você possa utilizar.
Se você obter a mensagem de erro Can't connect to MySQL server on alguma_maquina, você pode tentar o seguinte para descobrir qual é o problema:
Verifique se o servidor está funcionando fazendo telnet seu-servidor num-porta-tcp-ip e pressione Enter algumas vezes. Se houver um servidor MySQL em execução nesta porta você deve obter uma resposta que inclui o número da versão do servidor MySQL em execução. Se você obter um erro como telnet: Unable to connect to remote host: Connection refused, então não há nenhum servidor rodando na porta dada;
Tente conectar ao daemon mysqld na máquina local e verifique a porta TCP/IP que o mysqld está configurado para usar (variável port) com mysqladmin variables;
Verifique se o seu servidor mysqld não foi iniciado com a opção --skip-networking.