Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    • Archives

    • Recent comments

    Archive for the 'Web' Category

    Anything web-related. Just anything.

    How to convert between utf8 and cp-1251 without iconv or mbstring

    8th July 2007

    This helped me, maybe it will help you: How to convert between utf8 and cp1251 without iconv
    Read the rest of this entry »

    Share

    Posted in Links, PHP, Programming, Web | No Comments »

    Compiled linux ffmpeg binary for Gallery2: download

    28th June 2007

    Updated on Apr 8, 2008.

    Stimulated by the post of Eric Daniel (who used to have a blog at termitenshort.com), I compiled the most recent ffmpeg SVN source into Linux binary, which runs fine on my shared hosting (note: I’m using older ffmpeg binaries, which are at the end of the post).

    mini-FAQ:
    Q: Why the title has “for Gallery2″?
    A: Just because I avoided the inclusion of libraries, which were not found on my shared hosting server. I hope this will work for other shared hosting environments.

    Configuration, version and date can be found in the output of ffmpeg.

    Versions built on April, 8, 2008:
    ffmpeg (no lame) (checked: can be executed on godaddy shared hosting)

    FFmpeg version SVN-r12769, Copyright (c) 2000-2008 Fabrice Bellard, et al.
    configuration: –enable-gpl –enable-postproc –enable-swscale –enable-pthreads –disable-debug –enable-gray –disable-ffserver –disable-ffplay –enable-avfilter –disable-network –disable-ipv6
    libavutil version: 49.6.0
    libavcodec version: 51.54.0
    libavformat version: 52.13.0
    libavdevice version: 52.0.0
    libavfilter version: 0.0.0
    built on Apr 8 2008 15:13:14, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
    usage: ffmpeg [[infile options] -i infile]… {[outfile options] outfile}…

    ffmpeg (with lame). For this one, grab libmp3lame.so.

    FFmpeg version SVN-r12769, Copyright (c) 2000-2008 Fabrice Bellard, et al.
    configuration: –enable-gpl –enable-postproc –enable-swscale –enable-pthreads –disable-debug –enable-gray –disable-ffserver –disable-ffplay –enable-avfilter –disable-network –disable-ipv6 –enable-libmp3lame
    libavutil version: 49.6.0
    libavcodec version: 51.54.0
    libavformat version: 52.13.0
    libavdevice version: 52.0.0
    libavfilter version: 0.0.0
    built on Apr 8 2008 15:44:31, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

    Based on single request: ffmpeg (with lame and libfaac and libfaad). For this one, grab libfaac.so and libfaad.so.

    FFmpeg version SVN-r12769, Copyright (c) 2000-2008 Fabrice Bellard, et al.
    configuration: –enable-gpl –enable-postproc –enable-swscale –enable-pthreads –disable-debug –enable-gray –disable-ffserver –disable-ffplay –enable-avfilter –disable-network –disable-ipv6 –enable-libmp3lame –enable-libfaac –enable-libfaad
    libavutil version: 49.6.0
    libavcodec version: 51.54.0
    libavformat version: 52.13.0
    libavdevice version: 52.0.0
    libavfilter version: 0.0.0
    built on Apr 8 2008 23:53:57, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

    As an experiment, here’s ffmpeg freebsd binary without lame support. Did ran on some FreeBSD 6.3 hosting.

    FFmpeg version SVN-r12769, Copyright (c) 2000-2008 Fabrice Bellard, et al.
    configuration: –enable-gpl –enable-postproc –enable-swscale –enable-pthreads –disable-debug –enable-gray –disable-ffserver –disable-ffplay –enable-avfilter –disable-network –disable-ipv6 –target-os=freebsd
    libavutil version: 49.6.0
    libavcodec version: 51.54.0
    libavformat version: 52.13.0
    libavdevice version: 52.0.0
    libavfilter version: 0.0.0
    built on Apr 8 2008 16:15:38, gcc: 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

    Versions built on Ocotber, 28, 2007:
    download ffmpeg without libmp3lame support

    FFmpeg version SVN-r10867, Copyright (c) 2000-2007 Fabrice Bellard, et al.
    configuration: –enable-gpl –enable-pp –enable-swscaler –enable-pthreads

    –enable-libogg –enable-libvorbis –disable-debug
    libavutil version: 49.5.0
    libavcodec version: 51.47.1
    libavformat version: 51.17.0
    built on Oct 28 2007 22:46:10, gcc: 3.4.6

    download ffmpeg with libmp3lame support

    FFmpeg version SVN-r10867, Copyright (c) 2000-2007 Fabrice Bellard, et al.
    configuration: –enable-gpl –enable-pp –enable-swscaler –enable-libmp3lame

    –enable-pthreads –enable-libogg –enable-libvorbis –disable-debug
    libavutil version: 49.5.0
    libavcodec version: 51.47.1
    libavformat version: 51.17.0
    built on Oct 28 2007 23:04:59, gcc: 3.4.6

    Shared hosting testing reports are welcome.

    Below you can find even older versions of ffmpeg, which were tested and found functional on GoDaddy shared hosting.
    Read the rest of this entry »

    Share

    Posted in *nix, CMS, Software, Web | 49 Comments »

    jpegtran and ffmpeg on GoDaddy in Gallery2

    28th May 2007

    Jpegtran is a library for lossless rotation and cropping of JPEG photo files. Ffmpeg is a library for some basic video processing and playback. Gallery2 is a powerful and popular photo-gallery web-software.

    Gallery2 uses by default either PHP’s GD2 or ImageMagick toolkits to rotate/crop images. However, you can install jpegtran plugin, to rotate/crop JPEGs with no losses in quality.

    On GoDaddy shared hosting the path to jpegtran is /usr/bin/jpegtran. However, at least in my case, that binary failed the ‘crop’ test (but succeeded in ‘rotate’ test). So I downloaded another binary of jpegtran (from this page), put it into one of my folders, and told Gallery2 to use that binary instead of /usr/bin/jpegtran. This worked perfectly.

    The same approach can be used to enable thumbnails for videos via the ffmpeg plugin and binary (unfortunately, have no idea where did I take ffmpeg from – it was quite a time ago). Just download the binary, put it into one of your folders, tell Gallery2 the absolute path to the binary, and you are done!

    Finally, here are the links to the two binaries mentioned above:
    jpegtran
    ffmpeg

    ffmpeg update: see here.

    Share

    Posted in Software, Web | 6 Comments »

    Radical Alternative to caching: On-the-fly Content-Regeneration

    23rd May 2007

    Refreshing my scarce knowledge of Apache’s mod-rewrite, I read through the mod_rewrite guide, and found an extremely interesting section, titled

    On-the-fly Content-Regeneration

    Here’s the theoretical problem:

    1. we are building a high-traffic site with lots of once-per-(hour|day) updated items
    2. we have a CMS with just all the features we need, but it’s really CPU/DB-consuming and slow (does it sound familiar? :) )
    3. there’s a need to serve static files

    And here’s the ‘radical alternative’ solution:

    1. install the CMS of choice
    2. tweak the CMS’s output layer to both produce/write to disk (or update) static HTML files, and to dump those same pages directly to browser
    3. use the “On-the-fly Content-Regeneration” mod_rewrite rules set

    This is it, in short. The “On-the-fly Content-Regeneration” will read the static files if they exist, or will query the CMS, which will create/update the static files and output the necessary page. You can also setup a cron-job to remove all static files older than XX minutes, to force content refresh.

    Below is the copy of “On-the-fly Content-Regeneration” from the mod_rewrite guide.
    Read the rest of this entry »

    Share

    Posted in CMS, Links, Notepad, Programming, Web | No Comments »

    Directory-based random image rotation PHP script

    23rd May 2007

    Yesterday I needed to put together a rather simple PHP script: it would read the contents of a single pre-configured directory, and randomly select up to a pre-configured number of files. These files were images, and were just dumped as IMG tags into the webpage. I came up with a solution, shown below.

    The script is simple, but still it’s easier to use the ready solution than to write your own :).
    It is heavily commented, and should be easy to understand.
    Read the rest of this entry »

    Share

    Posted in PHP, Programming, Web | No Comments »

    toonel.net: JZlib-compressing proxy with Java client

    22nd May 2007

    Came across toonel.net project. It’s free for private, non-commercial use.
    Citing the site:

    toonel.net is an experiment in a technique for conserving network bandwidth. If you are paying a fee based on the amount of data you transfer (e.g. 3G/GPRS/DSL/CDMA) and have monthly download limit, or if you have narrowband connection (e.g. dialup modem) then you are most likely to appreciate the service toonel.net offers. There are number of toonel.net client application packages. All solutions are 100% Java based and therefore this service can be used on any platform with an installed Java Runtime Environment, including mobile phones.

    toonel.net: what it is good for?

    • expensive transports (e.g. GPRS, CDMA…)
    • narrowband or slow connections (e.g. dial-up)
    • stretching download limits

    Why toonel.net is different?

    • cross platform
    • built from open source components
    • allows to compress virtually any traffic

    As soon as I switch to some java-enabled personal communication device, (and if toonel.net will still exist by that time :) ), I would definitely try it. Or if I switch to some speedy but traffic-limited internet-access provider.

    Share

    Posted in Links, Notepad, Web | 2 Comments »

    Do not buy at the BamBook internet-shop

    5th May 2007

    BamBook is a Kyiv-based internet shop.

    On the 28th of February, 2007, I ordered a book from them, and paid for it with a credit card at the time of order. Soon I had a confirmation email, which said that the book will be delivered not later than the 16th of March (they promise 10-working-days delivery, so the date looked fine).

    At the end of March, after writing several emails to BamBook, they responded with an official-looking “sorry for delay” and “we’ll do our best to deliver soon”.

    After calling them on the 3rd of April I came to know that they at the moment actually do not have the book I ordered. They asked if I’m willing to wait for around two weeks, so that they “try” to order that book and then (add 10 working days) deliver it to me. I said NO, I WANT MY MONEY BACK with that kind of service you have! OK, they said.

    Nothing changed until April, 23. So I called them again. They promised to return money again.

    Another call was on the 3rd of May. They said that “refund is being processed”. I hope you imagine what kind of a company they are, if a simple refund processing requires whole month to be complete… or not complete, as nothing changed as of today, the 5th of May.

    Update: as of May, 27, there are no changes, despite some more efforts put into getting anything from this real crappy Bambook internet-shop.

    Conclusion: avoid BamBook internet-shop at all costs. Better go give your money to the beggar on the street – faster, with no troubles, and no waiting for anything.

    Share

    Posted in Misc, Personal, Society, Web | 2 Comments »