Blog of Timur Asaliev
RSS icon Email icon Home icon
  • Delete recursively lines from files that match a given string

    Posted on November 30th, 2009 Timur Asaliev No comments

    This is just a small snipplet to remind me of how to delete lines recursively that match a string needle

    #!/bin/sh
    grep -rl "needle" . |
    while read filename
    do
    (
    echo $filename
    sed '/needle/d' $filename> $filename.xx
    mv $filename.xx $filename
    )
    done

    References used:
    www.mehtanirav.com
    www.cs.mcgill.ca

  • PHP Template Caching

    Posted on January 8th, 2009 Timur Asaliev No comments

    This new year brought some inspiration in respect of coding to me and I have decided to research and possibly implement my own template caching system. I have looked around for some solutions but I wasn’t able to locate a system that could handle partial caching, although this could just be my poor googling skills. By partial caching I mean caching the whole template (for example: the <head> section which might be generated automatically, the body with the news and the comments) but don’t cache blocks of data of my choice. A good example of these blocks could be a box looking like this:

    Welcome back, DummyUser (link to personal profile)
    You have X new messages

    So I have spent two days to put down the list of features I want on paper so here it goes:

    • Easy to integrate with other PHP aplications.
    • An ability to work with <meta> tags, <script> and <link> includes.
    • Per template caching on-demand.
    • Caching of whole pages (based on REQUEST_URI) but with an option for non cached blocks of data (example above).
    • Assignment of template variables.
    • Dynamic generation of page titles.

    Some of the features are already implemented (and are working!), like caching of templates on demand and caching of whole pages with ability to leave non cached blocks of data.

    Hopefully this inspiration will stay for a couple of more days so I accually post a stable version of the class for others to explore and play around with.

  • CakePHP – First impressions

    Posted on June 20th, 2008 Timur Asaliev No comments

    My first framework after developing with PHP for 4-5 years was CodeIgniter, which I’ve been using for a while and have already dugg into it’s core to go on and make a lite version for personal use. For the past year or two I’ve been hearing a lot about CakePHP framework and have finally found some time to play around with it.

    After spending 3 hours last night with the Cake’s online manual (although skipping basic stuff) and reading through the blog tutorial, I have to say I was impressed with CakePHP. Although the convensions could be somewhat difficult for new comers to remember, I have to agree that they are very useful and increase the development speed.

    I have also enjoyed their support for third party classes (with javascript includes too!), very well commented API and plugin support:

    CakePHP allows you to set up a combination of controllers, models, and views and release them as a packaged application plugin that others can use in their CakePHP applications.
    Cookbook

    CakePHP is a very good framework and I will start playing around with CakePHP next week to try and code a small forum and a blog for CodeVision.

  • CodeVision

    Posted on May 31st, 2008 Timur Asaliev No comments

    Recently, I have registered a new domain CodeVision.org. I am planning to open a new website alongside with one of my friends – Vadim. Although we still do not have a clear picture on what exactly we will have there, it will be web and coding oriented in any case.

    More information to be posted soon.