Life and Science

Benefits of Wood Ash PDF Print E-mail



If you have a wood fire then the benefits are many. Not only do they smell great, keep your toes warm and mean that you have more than the average number of visitors (in Winter at least). You can also use the ash on the vegetable plot.

At this time of year when I’m busy deciding what should go where for the coming season I normally scatter some wood ash on the proposed onion bed and around fruit trees and canes. They seem to love it.

The ash is washed away quite quickly so I’ll probably keep re-applying as the season gets underway. You can scatter it around onions, garlic, shallots etc and it will discourage root maggots. The slugs don’t like it either.

Be careful not to use it near any acid loving plants though (like Blueberries and Potatoes) as it tends to make your soil more alkaline.

You don’t have to use your ash up immediately either. You can store wood ash and use it later, so long as it stays dry. And you can also put it in the compost bin. It’s a very versatile fertiliser.


Read more: http://technicalstudies.youngester.com/2012/02/benefits-of-wood-ash.html

 
Get Screwed with C programming PDF Print E-mail


  • Non-terminated comment, "accidentally" terminated bysomesubsequent comment, with the code in between swallowed.

  •         a=b; /* this is a bug


            c=d; /* c=d will never happen */

  • Accidental assignment/Accidental Booleans
  •         if(a=b) c;      /* a always equals b, but c will be executed if b!=0 */
    Depending on your viewpoint, the bug in the language is that theassignment operator is too easy to confuse with the equality operator;or maybe the bug is that C doesn't much care what constitutes a booleanexpression: (a=b) is not a boolean expression! (but C doesn'tcare).
    Closely related to this lack of rigor in booleans, consider thisconstruction:
            if( 0 < a < 5) c;      /* this "boolean" is always true! */
    Always true because (0

    Or consider this:

            if( a =! b)c;      /* this is compiled as (a = !b), anassignment, rather than (a != b) or (a == !b) */

  • Unhygienic macros

  •         #define assign(a,b) a=(char)b


            assign(x,y>>8)

    becomes
                   x=(char)y>>8   /*probablynot what you want */ 
     
  • Mismatched header files

  • Suppose foo.h contains:

            struct foo { BOOL a};





      file F1.c  contains


            #define BOOL char


            #include "foo.h"





      file F2.c contains 


            #define BOOL int


            #include "foo.h"

    now, F1. and F2 disagree about the fundamental attributes of structure"foo". If they talk to each other, You Lose! 
     
  • Phantom returned values

  • Suppose you write this

        int foo (a)


        { if (a) return(1); } /* buggy, because sometimes no value is returned  */

    Generally speaking, C compilers, and C runtimes either can't or don'ttell you there is anything wrong. What actually happens depends on theparticular C compiler and what trash happened to be left lying aroundwherever the caller is going to look for the returned value. Dependingon how unlucky you are, the program may even appear to work for awhile.

    Now, imagine the havoc that can ensue if "foo" was thought toreturn a pointer! 
     

  • Unpredictable struct construction

  • Consider this bit packing struct:

        struct eeh_type


        {


                uint16 size:          10;   /* 10 bits */


                uint16 code:           6;   /* 6 bits */


        };

    Depending on which C compiler, and which "endian" flavor of machine youare on, this might actually be implemented as
            <10-bits><6-bits>
    or as

            <6-bits><10-bits>





    Also, again depending on the C compiler, machine architecture, and various mysterious preference settings,


    the items might be aligned to the nearest 8, 16, 32, or 64 bits.





    So what matters? If you are trying to match bits with a real world file,


    everything!








    Need another way to lose big? How about this:





    Rect foo = {0,1,2,3}; // assign numbers to the first four slots





    You may think you know what those four slots are, but there's at least an


    even chance you'll have to discover the hard way if the structure ever


    changes.


  • Indefinite order of evaluation (contributed by Xavier @triple-i.com)
  •         foo(pointer->member, pointer = &buffer[0]);
    Works with gcc (and other compilers I used until I tried acc) and doesnot with acc. The reason is that gcc evaluates function arguments fromleft to right, while acc evaluates arguments from right to left.
    K&R and ANSI/ISO C specifications do not define the order ofevaluation for function arguments. It can be left-to-right,right-to-left or anything else and is "unspecified". Thus any codewhich relies on this order of evaluation is doomed to be non portable,even across compilers on the same platform.

    This isn't an entirely non controversial point of view. 
     

  • Easily changed block scope (Suggested by Marcel van derPeijl )

  •     if( ... ) 


            foo(); 


        else 


            bar();

    which, when adding debugging statements, becomes

        if( ... ) 


            foo();          /* the importance of this semicolon can't be overstated */


        else 


            printf( "Calling bar()" );      /* oops! the else stops here */


            bar();                          /* oops! bar is always executed */

    There is a large class of similar errors, involving misplacedsemicolons and brackets. 
     
  • Permissive compilation (suggested by James M.Stern)

  • I once modified some code that called a function via a macro:
            CALLIT(functionName,(arg1,arg2,arg3));
    CALLIT did more than just call the function. I didn't want to do theextra stuff so I removed the macro invocation, yielding:
            functionName,(arg1,arg2,arg3);
    Oops. This does not call the function. It's a comma expression that:
    1. Evaluates and then discards the address of functionName
    2. Evaluates the parenthesized comma expression (arg1,arg2,arg3)
    C's motto: who cares what it means? I just compile it!My own favorite in this vein is this:

            switch (a) {


            int var = 1;    /* This initialization typically does not happen. */


                            /* The compiler doesn't complain, but it sure screws things up! */


            case A: ...


            case B: ...


            }

    Still not convinced? Try this one (suggested by Mark Scarbrough ):

    #define DEVICE_COUNT 4 


    uint8 *szDevNames[DEVICE_COUNT] = {


            "SelectSet 5000",


            "SelectSet 7000"}; /* table has two entries of junk */

  • Unsafe returned values (suggested by Bill Davis This e-mail address is being protected from spambots. You need JavaScript enabled to view it >) 

  • char *f() { 
       char result[80]; 
       sprintf(result,"anything will do"); 
       return(result);    /* Oops! resultis allocated on the stack. */ 
     }


    int g() 
       char *p; 
       p = f(); 
       printf("f() returns: %s\n",p); 
    The "wonderful" thing about this bug is that it sometimes seems to be acorrect program; As long as nothing has reused the particular piece ofstack occupied by result
     

  • Undefined order of side effects. (suggested by michael This e-mail address is being protected from spambots. You need JavaScript enabled to view it .EDUandothers) 
  • Even within a single expression, even with only strictly manifestside effects, C doesn't define the order of the side effects.Therefore, depending on your compiler, I/++I might be either 0 or 1.Try this:

    #include 





    int foo(int n) {printf("Foo got %d\n", n); return(0);}





    int bar(int n) {printf("Bar got %d\n", n); return(0);}





    int main(int argc, char *argv[]) 


    {


      int m = 0;


      int (*(fun_array[3]))();





      int i = 1;


      int ii = i/++i;





      printf("\ni/++i = %d, ",ii);





      fun_array[1] = foo; fun_array[2] = bar;





      (fun_array[++m])(++m);        


    }





    Prints either i/++i = 1 or i/++i=0;

    Prints either "Foo got 2", or "Bar got 2" 
     
  • Uninitialized local variables 
  • Actually, this bug is so well known, it didn't even make the list!That doesn't make it less deadly when it strikes. Consider the simplestcase:

    void foo(a)


    { int b;


      if(b) {/* bug! b is not initialized! */ }


    }

    and in truth, modern compilers will usually flag an error as blatant asthe above. However, you just have to be a little more clever tooutsmartthe compiler. Consider:

    void foo(int a) 


    { BYTE *B;


       if(a) B=Malloc(a);


              if(B) { /* BUG! B may or may not be initialized */ *b=a; } 


    }

  • Cluttered compile time environment 
  • The compile-time environment of a typical compilation is clutteredwith hundreds (or thousands!) of things that you typically have littleor no awareness of.  These things sometimes have dangerouslycommon names, leading to accidents that can be virtually impossible tospot.

    #include
    #define BUFFSIZE 2048 
    longfoo[BUFSIZ];               //notespellingofBUFSIZ != BUFFSIZE


    This compiles without error, but will fail in predictably awfuland mysterious ways, because BUFSIZ is a symbol defined bystdio.h.  A typo/braino like this can be virtually impossible tofind if the distance between the the #define and the error is greaterthan in this trivial example. 
     

  • Under constrained fundamental types

  • I've been seriously burned because different compilers, or evendifferent options of the same compiler, define the fundamental type int aseither 16 or 32 bits..  In the same vein, name any other languagein which boolean might be defined or undefined, or might bedefined by a compiler option, a runtime pragma (yes! we havebooleans!), or just about any way the user decided would work ok. 
     
  • Utterly unsafe arrays 
  • This is so obvious it didn't even make the list for the first 5years, but C's arrays and associated memory management are completely,utterly unsafe, and even obvious cases of error are not detected.

     int thisIsNuts[4]; int i; 
      for ( i = 0; i < 10; ++i ) 
      { 
        thisIsNuts[ i ] = 0;     /*Isn't it great ?  I can use elements 1-10 of a 4 element array,andno one cares */ 
      }

    Of course, there are infinitely many ways to do things like thisin C. 


    Read more: http://technicalstudies.youngester.com/2012/01/get-screwed-with-c-programming.html

     
    Comet vaporized in Sun PDF Print E-mail





    For the first time, technology has allowed NASA to observe a comet being vaporized as it approached the sun. Solar Dynamics Observatory recorded Comet C/2011 N3 nearing the sun and burning to nothing over a 20-minute span in July.

    NASA describes the event as "Comet corpses in the solar wind." Almost daily, comets are vaporized by the sun, but this was the first time technology allowed for it to be recorded.

    The comet was about the size of an aircraft carrier and was part of the Kreutz family of comets believed to be remnants of a giant parent comet that broke apart some 2,500 years ago.


    Read more: http://technicalstudies.youngester.com/2012/01/comet-vaporized-in-sun.html

     
    Mutant Microbes converting into Biofuel PDF Print E-mail



    A promising new system can convert fronds of brown seaweed into biofuel, opening up a new possible source of energy that could help replace fossil fuels, like gasoline. The secret: bacteria genetically engineered to break down a previously inaccessible sugar in seaweed, called alginate. The researchers who developed this new system used it to generate ethanol, a biofuel that is added to gasoline; however, it has the potential to produce not just ethanol but other biofuels, they and others say. The new system is like a Lego platform. With changes to the components in the process, the same microbe-based system could be used to produce a variety of products. 

    For instance, the system could be used to turn seaweed into a source (also called a feedstock) for other biofuels, which could include butanol — an alcohol, like ethanol, that is blended into gas — or chemicals used in biodiesel, which has properties similar to conventional, petroleum-based diesel. 

    Two questions remain :
    Is it economically feasible to use seaweed to produce biofuel? 
    And is it environmentally attractive? 

    Seaweed now joins the cadre of plants — from corn to single-celled algae — that offer tantalizingly renewable and domestically produced alternatives to fossil fuels. In the United States, ethanol made from corn is added to gasoline; in Brazil, cars are powered largely, sometimes completely, by ethanol made from sugar cane. But converting corn and sugar cane into fuel can be problematic, since both are also food crops. 


    Even other potential biofuel sources, like switchgrass, can compete for land in a world whose population is growing and seeking a more resource-intensive diet. Seaweed — a relatively unexploited source of nutrition, is high in sugars, which are precursors for most biofuels. Seaweed also lacks lignin, a compound that makes cell walls rigid in land plants and that must be removed before such plants can be turned into fuel. Even so, until now, seaweed appeared to have limited potential as a feedstock for biofuel, since one of its primary sugars, alginate, couldn't be broken down efficiently enough to produce biofuel on an industrial scale. The bug Marine microbes already have the ability to break down alginate, transport the products and metabolize them. E. coli do something similar, spitting out ethanol at the end of a multi-step process. The last of the steps could be replaced to produce other biofuels, or even chemicals such as plastics and polymer building blocks. This system also takes advantage of other sugars in the seaweed, mannitol and glucan, since the E. coli already possessed the ability to break down mannitol, and commericially available enzymes can easily break glucan down into a more accessible form, glucose. This system could be used in any brown seaweed (seaweeds also come in green and red). 

    Cultivating seaweed along three percent of the world's coastlines, where kelp already grows, could produce 60 billion gallons of ethanol.

    Seaweed's advantages, its high sugar content and lack of lignin, make it a viable source for biofuel from a cost perspective. Looking ahead There is also the environmental question.  One challenge will likely be seaweed's demand for nutrients, such as nitrogen and phosphorus, which are not naturally abundant in the oceans. 


    Read more: http://technicalstudies.youngester.com/2012/01/mutant-microbes-converting-into-biofuel.html

     
    «StartPrev12345678910NextEnd»

    Page 1 of 17