Just found out about the Context Free Art project through it’s javascript port, ContextFree.js done by Aza Raskin, the same guy involved in the development of Firefox. Raskin developed a lovely playful site, Algorithm Ink. I actually showed it to a friend who’s not a developer and she started playing right away : )
Just jotting down all the steps I took to install Munin on a RHEL server:
Login as root
Add the Epel Repository
$ sudo rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
$ sudo yum install munin munin-node
Dont forget to say yes on all checks. I got distracted by the phone and when I looked again I had a missing dependency error.
Edit munin’s conf file
$ vim /etc/munin/munin.conf
Set up mail alerts when a status change occurs (eg from OK to warning)
contact.sofia.command mail -s “Munin notification” sofia@example.com
Notice the line
# htmldir /var/www/html/munin
This will set where munin’s reports will beaccessible by the web browser. Change it (and uncomment it) if you want but make sure the folder you set it is writable by munin (chown -R munin <directory>). I had some problems here, Munin didnt create the files there so i set up an alias. But maybe you’ll be fine : )
Write and close munin.conf. Edit munin-node
$ vim /etc/munin/munin-node.conf
Change the host entry from
host *
to
host 127.0.0.1
In this way you restrict the node to listen to localhost only
Start munin
$ sudo /etc/init.d/munin-node start
Add munin to reboot
$ sudo /sbin/chkconfig munin-node on
Set up the alias. My public directory isnt there so I needed to set up an alias in httpd.conf
$ vim /etc/httpd/conf/httpd.conf
Add the below at the end adjusting what you need
Alias /srvmunin /var/www/html/munin
<Directory /var/www/html/munin>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
AuthType Basic
AuthName "Members Only"
AuthUserFile /etc/munin/munin-htpasswd
<limit GET PUT POST>
Require user admin
</limit>
</Directory>
Notice we set the alias at srvmunin, so that the reports will be viewable at www.example.com/srvmunin. We also set an httpauth because otherwise anyone can see the munin reports.
Write and close and restart apache
$ /sbin/service httpd stop
$ /sbin/service httpd start
Someone told me this was quicker than a restart (service httpd restart) but I have no idea if it’s true
Set up the password
$ htpasswd -c /etc/munin/munin-htpasswd admin
Go to www.example.com/srvmunin and you should be prompted for the password. Then wait a few hours and you’ll start to see the charts. Done!
Desde há algum tempo que tenho alguma curiosidade sobre NLP (natural language processing) tanto a nível teórico (como funcionam os algoritmos que usam) como a nivel prático. Não existe por exemplo, um serviço semelhante ao Apture para português. Assim, derivados das minhas pesquisas aqui vão alguns links que achei interessantes:
LXSuite - um conjunto de webservices para a análise linguística de texto desenvolvido pela Universidade Lisboa. Na LxSuite estão todos juntos mas podem ser vistos em separado no LxCenter. Infelizmente, o serviço não tem api e é necessário consentimento para o seu uso.
Linguateca - todo um conjunto de recursos de NLP para a língua portuguesa. O HAREM - NER for portuguese e respectivo livro está aqui. Eles também disponibilizam vários corpus para português aqui, inclusivé o CETEMPúblico (disponível para download gratuitamente).
Portuguese Language Processing Service - um artigo sobre o desenvolvimento dum conjunto de webservices de NLP para língua portuguesa desenvolvido no Brasil. De acordo com os próprios:
In this paper, we describe F-EXT-WS, a Portuguese Language Processing Service that is now available at the Web. The first version of this service provides Part-of-Speech Tagging, Noun Phrase Chunking and Named Entity Recognition. All these tools were built with the Entropy Guided Transformation Learning algorithm, a state-of-the-art Machine Learning algorithm for such tasks.
Este artigo parece interessante e pode ser um ponto de partida para outras explorações (ex. ETL/Entropy Guided Transformation Learning - ver Portuguese corpus-based learning using ETL). Fui ver o F-EXT-WS mas é necessário registo e deu erro.
Alguém conhece outros recursos interessantes dentro desta àrea?
Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
“Mutation Testing is basically testing…for tests. It ensures that your tests are truly capable of detecting errors and problems with the source code. It does this by mutating the source code itself (using ext/runkit) in such a way that an error is created in the code. If your tests detect the error, all is well with the world. If your tests do not detect the error…well, you better add a new test that does”
“phpcpd is a Copy/Paste Detector (CPD) for PHP code.
The goal of phpcpd is not not to replace more sophisticated tools such as phpcs, pdepend, or phpmd, but rather to provide an alternative to them when you just need to get a quick overview of duplicated code in a project.”
An example will explain better (applies to the php package):
class simplemath
{
/**
* subtract function.
*
* @access public
* @param int $a
* @param int $b
* @return int
*
* <code>
* //doctest: subtract
* echo simplemath::subtract(10,6);
* //expects:
* //4
* </code>
*/
public static function subtract($a, $b)
{
return (int)$a - (int)$b;
}
}
The test itself is inside the <code> tags. If I then run this code through doctest’s commandline runner for php, by running
$ phpdt simplemath.php
I’ll get something like this:
Doctests can serve as great documentation by example and as tests, both for your documentation - comments tend to get terribly out of date (when code changes the comments aren’t updated accordingly) - and for the code itself.
I’ve also found they’re an invaluable tool during development. Imagine you’re developing a method that validates credit card numbers and the only way to get to it in a browser is to perform several actions, eg going to the specific webpage, inputting the credit card number, and submitting the form - it’s hell basically. If you’re already doing TDD and using phpUnit you’re probably not doing this but doctest for me has an advantage there, the test and the code being tested are in the same file - it’s all there! and so it’s really easy to grasp the problem at hand.
My process has been,
write a test case in doctest
write the code itself
test
repeat as necessary
Due to this I submitted a patch to allow the testing of only 1 test, it’s not in the current release but it’s been accepted. This way instead of waiting for all the tests to run, i can run only the method I’m working on.
Another cool thing about it is you become aware of any initial setup code and dependencies. Look at the following:
/**
* Calculates the number of nights between the start and end date of the booking
* @return int
*
* <code>
* // doctest: booker->total_nights
* require_once('lib/utilities.class.php');
* $booker = new booker();
* $booker->startDate = '2009-02-23';
* $booker->endDate = '2009-02-26';
* echo $booker->total_nights(). "\n";
* // expects:
* // 3
* </code>
*
*/
public function total_nights()
{
if (!isset($this->startDate) || !isset($this->endDate)) {
return false;
}
return (int)utilities::date_diff($this->startDate,$this->endDate,'d');
}
Even without the rest of the class it’s immediately visible that this method requires that the start and end dates be set and the inclusion of another class.
I think doctests are a really easy way to start writing tests. If you’re like me and also use phpUnit, it’s easy to write an AllTests file that runs both the doctest tests and the phpunit tests.
I view doctest as unitestting in its simplest form, there’s no setup/teardown methods, no mocks, etc. But since not all classes need all that, that’s fine by me. You can use doctest and phpunit/simpletest side by side. This way you have tests for code and tests for documentation
You can also use YSlow + Firebug but I ran into a strange problem where YSlow did not detect the compressed content (gave an F on gzip components) when I knew I was actually compressing content. I then looked around for other tools and found those 2 which detected the compression correctly. So lesson learned, use several tools to validate compression - just to make sure.
Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Copy xdebug.so (choose the correct xdebug according to your php version) to xampp/xamppfiles/lib/php/php5/extensions/no-debug-non-zts-########/xdebug.so .
Configure php.ini:
At the end of php.ini (it’s in xampp/etc/php.ini) add
The “xdebug.profiler_output_name=”%p-%R”" sets the file name to process pid (default) + “-” + the REQUEST URI (helpful if you’re rewriting urls). The xdebug.dump commands are not for profiling but they improve var_dump & error messages. Check zend’s article series on xdebug for more info.
Run php info & check xdebug’s there.
If you get ‘could not load.. (null)’ you probably downloaded the wrong version for your mac. Also check the path to xdebug is correct (the no-debug-non-zts-####### part might be different)
Install webgrind: download from here and copy directory to xampp/xamppfiles/htdocs folder
Visit your script with ?XDEBUG_PROFILE=1 appended to the end of the url. Eg http://localhost/myapp/index.php?XDEBUG_PROFILE=1
Now navigate to webgrind (eg. http://localhost/webgrind/ ), select the correct file from the dropdown - you can see the files xdebug’s created in yout /tmp directory - and you should see the profiling info.
Since i’ve got my ipod touch, i’ve been trying out several applications. Some have sticked, others less. So here’s my current favorite list along with a few comments.
Stanza provides the best reading experience of all the ereaders i’ve tried (stanza, filemagnet, instapaper, ereader) . A feature suggestion: I really would like the ability to add notes on any page or at least to underline/highlight text. Highlighting would really be nice - it just makes the reading experience much better. Basically the physical action of highlighting makes it easier for me to process the information and remember it later.
A note on page turning: Stanza is the only app where you press the left/right side of the screen to go to the previous/next page which would be fine if everyone else was doing it as well. As it is, I frequently scroll down and then wonder why nothing’s happening. I actually would like for everyone else to use Stanza’s method - it just jumps to the exact spot you were on which is less tiring on the eyes.
Stanza Pros: free; good readability. Cons: Most pdfs i tried to convert were not converted correctly making the app much less usable than i initially thought. Especially images and indexes are really poorly converted. So the search for a decent experience on reading my pdf’s went on which led me to the next app.
FileMagnet - a file manager for the ipod/iphone. Does what it’s supposed to do allowing the ipod work like a thumb drive. Cons: Frequent warnings on low memory when reading large pdfs and much poorer reading experience than stanza. Price:3.99€. Pros: Everything that i can’t read on Stanza, i read here. Useful.
Instapaper - simple app for saving pages and then reading offline. This is probably the app i use the most now along with itunes. Free and paid version. No real cons.
SmartTime - an app i really appreciate. A todo list + calendar: it’s been done a thousand times before but they actually innovated in the ui. Cons: no integration with google calendar, no export/import.
Writing Pad - another innovator. Instead of the default experience we have on small software devices where we click letter after letter to write, we now basically draw a line in between all the letters - this simple difference makes the writing experience a bit less clumky and much faster. I’ve gotten so used to it that i miss it in other apps where i write. A really good idea for writing on small devices (and they’ve filed a patent).
Accountr - a simple app for finance management. Didn’t really like it at first but it’s really quick to register stuff and i keep using it so that’s a good sign. Price: 0.79€
I could also mention others like Evernote but those are the ones i’m using the most now. Suggestions welcome
Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Para me divertir e porque me era útil decidi criar 2 comandos ubiquity para o firefox, um para o pai.pt e outro para o dicionário priberam.
O pai.pt foi fácil, bastou usar o searchCommand et voilá:
makeSearchCommand({
name: "pai",
url: "http://pai.pt/search/{QUERY}.html",
icon: "http://pai.pt/favicon.ico",
description: "Pesquisa nas páginas amarelas (pai.pt); Seaches the portuguese yellow pages."
});
No caso do dicionário priberam a coisa foi um pouco mais trabalhosa, primeiro tudo aquilo funciona à base de javascript no site (após alguma leitura do código lá percebi que faziam à mesma um pedido GET) e depois porque foi necessário codificar os parametros GET porque palavras com acentos estavam a falhar. Neste caso tive que usar o createCommand pois por enquanto não é possível escapar os parâmetros GET no searchCommand.
CmdUtils.CreateCommand({
name: "priberam",
description: "Searches the portuguese dictionary priberam",
help: "Try issuing "priberam aglet"",
icon: "http://priberam.pt/favicon.ico",
takes: {"pal": noun_arb_text},
execute: function( directObj ) {
var word = directObj.text;
Utils.openUrlInBrowser( "http://priberam.pt/dlpo/definir_resultados.aspx?pal=" + escape(word) );
}
});
O comando das páginas amarelas está aqui (comando pai) e o da priberam está aqui (comando priberam).
[Update: Acabei de reparar que o Rui Moura já tinha construído um comando para o dicionário priberam aqui. De qualquer modo, ao menos não são iguais porque a versão dele usa o searchCommand e como tal falha no caso de palavras com acentos ou caracteres especiais, ex. doçura.]
[Update 2: O Miguel Pais tem a versão mais completa neste momento (instalar aqui), com preview e também lida bem com caracteres especiais. Vejam os comentários abaixo.]
[For the english readers: to sum it up, when you need to escape accented characters in the query parameter use createCommand instead of searchCommand; see example code above).]
Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.