Mar. 27, 2012

Confirm dialog without a dialog

Rather than use the notoriously ugly and interruptive JavaScript confirm() function, or a complex overlay window system (see Reusable dijit.dialog yes/no function) you can easily implement a simple yes/no confirmation system for deletions or otherwise. 

For example, using jQuery:

Implementation HTML is rather painless:

<div class="confirm_example">
<ul>
    <li><a class="confirm_delete" caption="Really?" href="javascript:example_delete('a')">Delete A</a></li>

    <li><a class="confirm_delete" caption="Really?" href="javascript:example_delete('b')">Delete B</a></li>
    <li><a class="confirm_delete" caption="Really?" href="javascript:example_delete('c')">Delete C</a></li>
    <li><div id="example_deleted">Status</div></li>

</ul>
</div>

JavaScript parses any HTML code that needs deletion confirmation and adds a layer that gives it a functional equivalent of confirming. This is just a prototype and there are much better ways of doing this - but - it's a start.

function example_delete(what) {
$("#example_deleted").html( "Deleted " + what).stop().animate( { "background-color": "yellow" }, 100, function() { 

$("#example_deleted").animate( { 'background-color': 'white'}, 200 )
});

 
}
$().ready( function() {
    $(".confirm_delete").each( function() {

        var original_a = this;
        $(original_a).hide();
        $(original_a).css( { 'color': 'red' } );

 
        var fake_a = $('<a>');
        $(fake_a).html( $(original_a).text() );

        $(original_a).html( $(original_a).attr( "caption" ) );
 

        $(fake_a).attr( { "href": "#" } );
        $(fake_a).insertBefore( this );

 
        $(fake_a).click( function(e) {
            e.preventDefault();
            $(fake_a).fadeOut( function() {

            $(original_a).fadeIn();
 
            });
        });
 
        $(original_a).mouseout( function() {

            setTimeout( function() {
                $(original_a).stop().fadeOut( function() {

                $(fake_a).fadeIn();
 
                });
            }, 1000 );

        });
 
    });
});
No comments \ Leave a comment
Mar. 12, 2012

Boulis in Burkina Faso

Last year, while researching material for the climate change talks in South Africa, I ran into these. Did not know what to make of them at first.

Now, obviously these are crops. But the arrangement is unlike anything I've seen before. Why this particular configuration?

What benefits does this configuration offer? What are they growing there?

Mystery Solved

A fairly resourceful colleague of mine inquired further and discovered the design behind these. (From AMURT) ""Bouli" is a word used in the local language to describe an artificial pond."  As simple as that sounds, it's actually incredibly complex- each detail is specialized, and each layer in this cistern is specifically configured to reinforce a previous layer.

Amount of science, trial and error, and sweat put into these is an admirable showcase of human ingenuity and persistence.

Last year, the Guardian reported on small scale farmers persevering against climate extremes in the driest parts of Africa by using simplest of successfully tested concepts: a hole in the ground called a zai pit.  This simple idea seemingly originated from Burkina Faso in the 60s-70s, and spread throughout the continent when it proved that it could increase crop resiliency in the worst of conditions.

This zai pit is a clever device that retains moisture most efficiently and is best suited for the dry land.  Idea is to dig series of small holes during the dry season, pack it with available fertilizer, compost material and let the crops grow in independent clusters. A lot of physical labor, but the results are priceless.

Related to my original research, I was trying to find satellite images of zai pits.  Turns out that some Boulis have circles of zai pits intended to minimize erosion; figure 38 shows such a design.

 

It's always exciting to find a comprehensive explanation of something cool seen in satellite images.

 

Related:

 

No comments \ Leave a comment
Mar. 07, 2012

Huh? What Internet Explorer parabola bug?

Oh, THAT parabola bug. Yeah, let me fix that.

 

No comments \ Leave a comment
Posts on this blog solely represent my personal opinions and technical experience.

© 2009-2017 Edin (Dino) Beslagic