Autarchy of the Private Cave

Science, Society, Programming and Hobbies

  • Exits

  • Categories

  • Archives

  • Visitors’ track

    Locations of visitors to this page
  • Tags list

    WolframAlpha: sophisticated online calculations resource

    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.

    • Share/Save/Bookmark

    Posted in Links, Software, Web | No Comments »

    10 simple rules for getting published

    26th June 2009

    Recently, I have come across an excellent piece of advice called Ten simple rules for getting published. The only thing I have to add is that final rule #10 should be kept in mind while checking through all the previous rules – e.g. when editing someone’s submission, make sure that you are in position to be the editor for that article, and make sure your decision will influence chief editor’s decision – otherwise there’s no use reviewing.

    PLoS Computational Biology, where the “simple rules” were published, has a Ten simple rules collection, which includes a handful of other useful advice articles, like 10 simple rules for selecting a postdoctoral position.

    • Share/Save/Bookmark

    Posted in Links, Misc, Science | No Comments »

    My readers are natural-born workaholics

    12th June 2009

    Here’s the ultimate proof :) :

    visitors

    One can clearly see that on weekends the number of unique visitors of my blog drops drastically to about 40-50% of the working week average.

    And yes, that is an almost perfect 5+2 pattern, which I’m observing for many months, like a week-long circadian rhythm. “Almost perfect” must be due to the differences in time zones.

    I wonder if the same pattern is characteristic for most web-sites… That is, if people mostly do the browsing at work, and not at home.

    Anybody wants to share the secret cycles of one’s blog audience?

    • Share/Save/Bookmark

    Posted in Misc, Web | 2 Comments »

    C: how to specify comparison operators floating precision

    11th June 2009

    There is no way I'm aware of to do what the title says. However...

    I'm sure that you are aware of the fact that floats representation in any programming language is limited by the precision of the internal binary representations. In other words, you can never have an exact float representation - there will always be some precision associated with the float you are working with. The simplest example is the difference in precision between the float and double types in C.

    Suppose I have the following code fragment:

    C:
    1. if ( result.score >= input->raw_cut_off )

    Both result.score and input->raw_cut_off are of type float, and can have positive and negative values. When compared with the greater than or equal ( >= ) operator, it is not always that condition is true - for the precision reasons shortly mentioned above.

    As I already said, there is no precision specification for equality operators in C. But it is quite simple to "invent" precision specification; e.g. if I wanted to test for equality only, I could write

    C:
    1. if ( fabsf( result.score - input->raw_cut_off ) < 0.000001 )

    In this example, I'm effectively asking for 6-digit precision for the equality comparison of floating-point values. Note, that if you replace that 0.000001 with the actual precision limit of the floating type you are using, you will be "exactly" comparing floating-point numbers - up to that type's precision, of course :) .

    The first-most example with the >= operator can be rewritten as

    C:
    1. if ( result.score > ( input->raw_cut_off - precision) )

    where precision is exactly what it is named, e.g. precision = 0.000001.

    Sources used:

    • Share/Save/Bookmark

    Posted in Programming, how-to | No Comments »

    Best method to recursively chmod/process files or directories

    8th June 2009

    Found here.

    Recursively set directories only to drwx-rx-rx (755):

    find . -type d -exec chmod 755 {} \;

    Recursively set files only to rwx-r-r (644):

    find . -type f -exec chmod 644 {} \;

    Recursively remove newlines from the end of all *.php files:

    find . -type f -name "*.php" -exec /home/user/dos2unix.sh {} \;

    In all these cases, {} is replaced with the filename/directory find has found matching your parameters; \; at the end just stops exec processing.

    • Share/Save/Bookmark

    Posted in *nix, Links, Notepad, how-to | No Comments »

    Debugging PHP: Eclipse PDT + XDebug + XDebug helper

    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++.

    • Share/Save/Bookmark

    Posted in Links, PHP, Programming, Software | 2 Comments »

    GNU make for bioinformatics presentation

    5th June 2009

    Giovanni Dall’olio has recently posted a presentation on using make.

    Although it has "bioinformatics" on the title page, this is a good and very easy to understand make intro.

    Original post is here.

    • Share/Save/Bookmark

    Posted in Bioinformatics, Links, Programming | 1 Comment »

    Ada GNAT GPL 2009 released

    30th May 2009

    We are pleased to announce the release of GNAT GPL 2009, the Ada Toolset for Academic users and FLOSS developers. It introduces many new features including:

    - Ability to generate byte code for the JVM

    - Improved support for the .NET Framework

    - Addition of the Ada-Java Interfacing Suite (AJIS) that enables native Ada code to be called from Java:
    http://www.adacore.com/2008/06/17/ada-java_interfacing_suite

    - Availability on the Mac OS X (64 bit) platform

    - Automatic C/C++ binding generators

    - Addition of the GNAT Component Collection (GNATcoll) providing new APIs that can be extended by the user community:
    http://www.adacore.com/2008/06/17/gnat_component_collection

    GNAT GPL 2009 comes with version 4.3.1 of the GNAT Programming Studio IDE and GNATbench 2.3, the GNAT plug-in for Eclipse.

    It is available for the GNU Linux, Mac OS X (64 bit), .NET, JVM and Windows platforms.

    GNAT GPL 2009 can be downloaded from the "Download" section on the new Libre website:
    https://libre.adacore.com.

    I wonder if the new JVM bytecode generation feature was frequently requested by Ada developers, or is just a move towards popularizing Ada as a highly capable programming language. Either way, it's good.

    Hopefully, I will find time and a matching project to finally learn Ada properly - since a couple of years I believe Ada is a very good programming language. And the D language is better than C and C++ :) (holy war, anyone? :) )

    • Share/Save/Bookmark

    Posted in Ada, Links, Programming | No Comments »

    Comprehensive overview of the CSS3 border-radius support in modern browsers

    29th May 2009

    The Art-of-web has a good article on CSS3 border-radius property, and its support in Gecko/WebKit browsers.

    Note: that article is not about using JS and/or tables and/or complicated CSS to make round borders - instead, the CSS3 border-radius property is reviewed.

    • Share/Save/Bookmark

    Posted in Links | No Comments »

    SQL injection walkthrough

    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)

    • Share/Save/Bookmark

    Posted in Links, Software, Web, how-to | 3 Comments »