13th July 2009
The two graphs below (clickable) are for CPU and RAM use during a period of a program going wild between 23:17 and 23:41 (24+ minutes of server’s downtime). The program was run non-root, it just consumed all the memory it could. It was killed by kernel, so the server started responding without any interventions – which were hard to perform, because none of the services (including ssh) were responding during downtime.
If you happen to be developing a C/C++ program – do use mtrace and valgrind, those are huge helpers against the problems akin to that shown on the graphs.
Posted in *nix, Programming, Software | No Comments »
29th June 2009
If you ever need to glimpse at the properties of the Poisson distribution with lambda=0.16, or find the factorial of 6163338 (as a gamma function), then Wolfram|Alpha is a perfect tool for you (unless you have some math package at hand).
The motto of Wolfram|Alpha is Making the world’s knowledge computable. Basically, it is like Mathematica plus a growing corpus of factual numeric data, plus a system to interpret user’s input. This is a nice online reference and computation platform.
Posted in Links, Software, Web | No Comments »
8th June 2009
Stimulated by a bug in a complex and unfamiliar web PHP application with heaps of custom tweaks by other programmers, I decided to try a more professional approach to PHP programming and debugging than the standard var_dump() and family.
As a result, I’m now using Eclipse PDT with Xdebug and Xdebug Helper (Firefox extension). Now I don’t understand how I used to debug my PHP programs before!
After proper configuration (I’m using local Apache, but it is also possible to debug remotely), my work flow is rather simple:
- use my web-app as usual, e.g. tweaking and testing here and there
- if something server-side goes wrong: click the XDebug helper icon in Firefox, and perform some server-request action (e.g. load a page)
- debugging is started in Eclipse PDT, where I can step through the code, set breakpoints, and examine all variables
- as soon as the problem is fixed – click the XDebug helper icon again to continue using the site normally (w/o invoking the debugger)
It takes some time to get used to, but then it’s a breeze.
Some advice:
- don’t use apt-get/aptitude to install Eclipse; it will be much easier both in the short and long run to use some all-in-one package from the Eclipse PDT site; all you need to do – download, extract, run!
- before actually starting to do anything, tweak the eclipse.ini file by increasing heap size from 40 MiB (default) to some larger value (I used 128MiB). If you don’t do this, then at some point your debugging will become painfully sloooow, and then you’ll start getting tons of “out of heap memory” errors, each one suggesting that you quit Eclipse immediately
- install XDebug with apt-get/aptitude – worked perfectly, and there’s /etc/php5/conf.d/xdebug.ini not to mess with php.ini
- do read XDebug guide for PDT 2.x (I’m assuming you got the 2.x version); it should be the only document you will really need to configure everything
I only wish Eclipse was faster – that is, written not in Java but e.g. C or C++.
Posted in Links, PHP, Programming, Software | 3 Comments »
11th May 2009
SecuriTeam has an old, but still very useful article on SQL injection.
I’ve created a PDF of that article, containing some of the comments (all the ‘thank-you’ and ‘help-me-hack’ comments were removed): sql injection walkthrough pdf download.
Note: there were no specific license terms attached to the article; I believe that the word “free” on the SecuriTeam site logo refers to the “right of free use and copying”. If you know this is not the case – please let me know to remove this PDF from public access. (see Brian’s comment)
Posted in how-to, Links, Software, Web | 3 Comments »
4th May 2009
Today I had a task of displaying random node in a Views-generated sidebar block.
This is how to do that in Drupal 7 (Views 3):
- edit the view which makes the block available (follow http://your.site/admin/build/views/viewname/edit)
- in the Sort Criteria section (under Filter), look for and add Global:Random.
This is how to do that in Drupal 6 (Views 2):
- edit the view which makes the block available (follow http://your.site/admin/build/views/viewname/edit)
- in the Sort Criteria section, add the Random criteria.
It can’t be simpler than that.
Posted in Drupal, Notepad, Software | 13 Comments »
21st April 2009
After trying several of the kind, I found CHXO email address to image converter a reliable and working one.
It supports transparent PNGs, and just works. Also, it comes with a complete PHP source, so it looks like you can embed it into your own web-applications. (As it is GPLed, I’ve saved a copy for myself.)
For Gmailers, there’s a nicer generator.
If you’d like to convert larger amounts of text to images, then use hidetext.net:
Posted in Links, Software, Web | No Comments »
21st April 2009
The following sites are available:
http://bacteria.ensembl.org
http://protists.ensembl.org
http://metazoa.ensembl.org
During summer, two more sites – for Fungi and Plants – should be made available.
Learn more about Ensembl Genomes project.
Posted in Bioinformatics, Links, Science, Software, Web | No Comments »