stoimen.com/blog

web developing

How Do You Estimate Your Project?

How do you estimate your work?

Do you rely on a previous similar tasks or simply by some intuition? It will be interesting to share your experience.

HTML Tags: <base>

Overview

base

Somehow the <base> tag remains unknown to most of the web developers, but that’s quite normal. However let see what it can do. By adding the <base> tag in the head of the page you tell every link into that page how to open and a default href value. Thus if you have:

<base href="http://www.stoimen.com/blog/">

every link without a href attribute will open this link. That’s really useful in some cases. However the most interesting part of the base tag is the target attribute.

target=”_blank”

Everybody knows what will result from this attribute attached to a anchor tag.

<a href="http://www.stoimen.com" target="_blank">Click Here</a>

But with only adding this base tag:

<base target="_blank">

into the head … all the links will open in a new tab/window, depending on the browser preferences.

Watch out!

If you add the line above somewhere into the <body> tag the browser, will put it into the <head> which will make it difficult to track. A good practice is to place it directly into the <head>!

  • 1 Comment
  • Filed under: web development
  • Let’s say you have two models – each one modeling a database table – Users & Article. Here there’s nothing to deal with Zend Framwork, but you can think of them as typical models in a ZF application.

    What happens if you have to write a getUserArticles method? Where would you put it? Whether this will be the User model or the Article model?Where?

    Although technically you can put it in both models my advice is to look at the SQL query. If the FROM clause is containing the user table – than put the method in the User model, but here you’d have something like:

    SELECT * FROM Article WHERE user_id = 1

    I’d prefer to place it in the Article model!

    Are You Agile?

    Agile you are?

    Agile

    Perhaps Master Yoda would say that, but it’s interesting to know what methodology do you use in your work. Any answers will be highly appreciated, so here are some basic questions:

    1. Do you follow any software development methodology?
    2. Do you use any agile methodology?
    3. What is good and what’s bad?
    4. Do you think agile is better than non-agile methodologies?

    Thanks anybody in advance!

    Zend_Validate_Db_RecodExists is an extremely useful validator in Zend Framework when you’d like to be sure that a give row exists. Now it seems to be even better. Before you could check for a specific row by only comparing a value to the specified column:

    $validator = new Zend_Validate_Db_RecordExists('db_table_name', 'column_name');
    if ($validator->isValid(122)) {
       ...
    }

    which made it useless when you’d like to compare by more than one column. Now this is changed and you can even exclude given rows by adding an exclude clause.

    $validator = new Zend_Validate_Db_NoRecordExists(
        array(
            'table' => 'users',
            'field' => 'username',
            'exclude' => array(
                'field' => 'id',
                'value' => $user_id
            )
        )
    );