Wednesday, May 26, 2010

What Shall I Call My Boat?

The Forums case

This blog in no way deter you in the forums to write, quite the opposite. But know what you are there.

The experiment: to discuss
Now and then I try in Internet forums a technical issue. How such a discussion even proceeds at a basic theme, you can read in this example thread. Or so it works in other tube hi-fi forums and off. "Because there are everywhere the same experts ..."
can respond as usual "experts" on forums very angry when they must teach. Attempts by including protect write bans it.

Incredible:
I am having Hififorum the push-pull driver for discussion. Unprecedented, the contributions were written by well known personalities in the scene.
http://ebmule.de/showthread.php?tid=1147 The
Thread is in the version 13.06.09. Pdf copy is available and can be sent privately by email on request. Meanwhile (06.08.2009) the flaming and insults have this group against users who want to help me and tell me, definitely the measure of the unbearable exceeded. The thread was completely deleted at 10:08:09, a great pity for the many substantive contributions.
Some posts were removed and placed in a different thread. Is not removed:
http://www.ebmule.de/showthread.php?tid=1024&page=2
And always the famous people from yogis tube shop. And on the writing style also realizing who is behind bodega. ;-)

Our advice: imagine
Another recommendation from my own experience to those who have with the idea of a self-development in a forum:
the Round Table Uses only for what it is intended, namely, Discuss. More and references to your own website or blog install. It is for every decent user of honor on your page or your blog to click to get information carefully and then discuss in the forum. Great care is needed when users ask of you "everything" in the forum and refuse to disclose your website or your blog in the discussion closer. These people want to break so me your copyright or steal ideas.


If you needed to users, notify the moderator. In a serious (!) Forum have such user in my opinion no place! Never discussed in closed areas, forums unannounced user can not read. Always counted so that your contributions, factually and technically correct it may be, be deleted or edited! Also
user data is often misused to your damage. Therefore used a different password for each forum! Deletes regularly your browser cache and cookies. Particularly nasty are the small changes are not obvious. It took about six months until I noticed was that constant changes in my forum posts, signatures, and the email address have been made. Always assumes that "private messages" and the emails on a forum or more should be read by third parties. ADMIN

completely false expectations:
Actually, users expect in a discussion, a neutral discussion platform.
What purpose of the forums operation among others is shown, for example posting this one known forums operator.
How, for example, a "private, non-profit board financed explains of a forum in this post:

http://www.jogis-roehrenbude.de/forum/forum/forum_entry.php?id=28943

Phew!

Then there are those who can present themselves as so-called standard-bearer with images. Nothing to laugh
instance, a competitor in the standard-bearer, whose name is of course subject to a lock word. Is driven by the mE forums and it's always the same people .


already laughed?

'He can not help' from richi44

René had the dubious Pleasure me to experience in the forum to yogis tube Bude and the D-amp forum: Kahlo

Jochen's paranoia: Jogi

Hi Gerd, welcome to this forum: louse in the fur

itches the keyboard. Closed Society

last updated on 16 January 2011 ("The keyboard itches" added.)

Besucherzähler für deine Homepage

Sunday, May 23, 2010

Women How To Masterbate

Excel as a user interface

With the introduction of VisiCalc

, the first spreadsheet software, blossomed in 1979 the Apple II from mere home and hobby computers to business computers. The simple representation of data and their dependencies in a modifiable table brought success! To date, the spreadsheet is a basic need of many professional computer users. A spread sheet can be sent around by email and attach it to his presentation or specification, especially you can change data in order to investigate the interdependence of values. Data can be displayed graphically in charts and a simple format [1] passed via clipboard into other applications. The subjective experience for the user is that he has everything under control. That feels good, and demands satisfaction. The "domain experts" that developers in the role of customers, users and testers have to do swear to Excel. Of course, Excel makes

abuse, "If you have a hammer, everything looks like a nail." Those who know Excel and understood is the temptation to use it for everything

that gets under your fingers. The financial account as an Excel sheet might still be - but for the general ledger of the company to use but rather something else. The project design with colored cells for the calendar weeks looks strangely unprofessional. We also have people use that Excel as a database replacement, where they met earlier often to the limit of 65,536 rows per sheet (there is a limit still exists, but it now amounts to 1,048,576 rows - that there is room for many new crazy abuse ideas ).

farsighted had
Charles Simonyi
, Then developers at Microsoft, the potential of the spreadsheet recognized as a universal user interface, when he took up the ideas of VisiCalc and MultiPlan Microsoft and then put it into Excel. Today, he tried with his own company, Intentional Software, his vision of

form will allow. Here, too, spreadsheet once again plays a big role in that it can be used as a rule editor to metaprogramming. Anyone who has read my blog about software
Stone Age
, knows where the journey leads. Which is of Simonyi's team developed and the first company already productively employed
Intentional Workbench
a milestone on the way to better, more robust, more compact and read software.

But these perspectives would be worth its own blog. Today I want to write about the use of Excel as a user interface in my project
astro
patterns.


astro patterns
is a library of time-critical functions, the search for astrological constellations or patterns. It will also run millions of planetary calculations. In order not to give away time on unnecessary layers such as. NET, I have decided to implement with C + +, where I used the GNU gcc compiler
to generate the library. In the implementation of key players from
astro patterns I could greatly benefit from the object orientation - to the versatile applicability of the public functions of the library's sake but are defined as C functions. In essence, I am therefore platform-independent, even if I compile the software itself on a single Windows computer and test. This creates a library astropatterns.dll . The library in turn uses only the Ephemeridensoftware Swiss Ephemeris, which is used as a shared library at run time. This is the only dependency. With the API astro patterns can be defined constellations and perform calculations, the results returned in the form of arrays or structures be. astro patterns itself has neither a user interface or any I / O. to disallow a user interface that was my choice to Excel. The possibility of different flyers were distributed to define settings and rules, was exactly what I needed. The first worksheet acts as a work area in which calls the functions of astro patterns
and the results - the dates on which occurred the sought constellations - are displayed as a list: preface
I must ensure that the programming language Visual Basic (in whatever their variety, either VBscript or VBA) for me the ugliest language ever heard (it is perhaps only exceeded in ugliness by the programming language
Brainfuck
, but which is only a gimmick of computer science students). Nevertheless, I bit for this project in the bullet and written a few lines of VBA, to link the DLL into the Excel spreadsheet. Some things it's worth it for similar projects noted: Excel does not know their own directories. the beginning this is a bit confusing: If I have a DLL with the Excel document you want to call them, have in a folder that Excel does not find this DLL. If dynamic libraries be sought in addition to those listed in the PATH environment variable

directories not in the current directory? Yes, this is so. But when you start Excel, tückischerweise is the "current directory" on the "My Documents" Reverse shot, which is provided in the Windows-user concept for storing your own files - no matter where you find the currently open Excel document. There is only, at the time Workbook_Open the current directory by calling the Windows API function again to set the value that an unprejudiced person would expect the current directory:

Private Sub Workbook_Open () 'Set the current directory to the location 'where the Excel sheet is stored ' This Enable the VBA code to find 'the astropatterns.dll and swedll32.dll there SetCurrentDirectory (ThisWorkbook.path) End Sub

The function is SetCurrentDirectory from kernel32.dll
declared it as follows:

'SetCurrentDirectory
' Needed since Excel uses "My Documents"
'as current directory by default
' It should use the path of the workbook
Public Declare Function SetCurrentDirectory _
Lib "kernel32" _ Alias "SetCurrentDirectoryA" (_ ByVal lpPathName _ As String) As Long stdcall requires VBA.

gcc generates so-called "decorated" functions with this calling convention. The "decoration" is in an attached @ , followed by the number of bytes consumed the whole list of parameters on the stack. If you make it known the VBA functions, you have to use these functions decorated. So that the call is no problem, the function must be declared in C as follows

extern "C" __declspec (dllexport) void __stdcall
ap_set_mundane_positions (
t_double_pair const * data, const size_t size );

and can then VBA with the following declaration be published: Public Declare Function

ap_set_mundane_positions
_ Lib "astropatterns.dll"
_ Alias "ap_set_mundane_positions @ 8 (_ ByRef data As Double, _ ByVal size As Long _
) As Long


this I do not writer's cramp get, I have defined for the definition of the public interface in C, a macro APIFUNC :

# define APIFUNC (x) extern "C" __declspec (dllexport) x __stdcall The argument of the macro function takes the type of the return value contrary. So I write the above function in reality more compact:
APIFUNC (void) ap_set_mundane_positions ( t_double_pair const * data, const size_t size );

Only

written code modules can be reused.


Beware of the code blocks, the PLA to offer "Microsoft Excel Objects". What is implemented there is no cross-use. "Microsoft Excel Objects" should only event handler and direct hits are stored to the table data. The actual logic should be implemented as a "module" as it is not available across otherwise.



passing null-terminated strings.


It is possible for an ordinary C string, more precisely a null-terminated array of character, by reference from the interface to receive and reuse in VBA. Suppose the function
ap_get_log ()
give back the reference to a C string. Then we can copy the string with the function
lstrcpy
of the Windows kernel in a VB string, after we have established with the
Space $ () 'Determine the length of a \\ 0 terminated string Public Declare Function lstrlen _ Lib "kernel32" _ Alias
"lstrlenA"
_ (ByVal lpString As Long) As Long 'Copy a string
Public Declare Function lstrcpy
_ Lib "kernel32" _ Alias "lstrcpyA" _ (ByVal lpString1 As String, _ ByVal lpString2 As Long) As Long Public Function cstar_to_string (lpString As Long) As String = cstar_to_string lstrlen Space $ ( (ByVal lpString)) lstrcpy ByVal cstar_to_string, ByVal lpString

End Function
In the reverse direction - from VBA to C - it's simple: You give a
String outright to a parameter in the declaration of DLL function as ByVal ... String is declared. On the other hand it is at the desired char * . [2] transfer of data structures and arrays flat data structures can be passed in both directions when they are declared in the same way. Example: The type t_horo that contains the three for the calculation of a horoscope necessary figures, typedef struct {

double jd_et; double lon, double lat
;}
t_horo; I note how similar in VBA follows: Public Type

t_horo jd_et As Double lon As Double
lat As Double End Type


    difficult is the situation with arrays: An array of VBA is unfortunately not file is passed as one would expect - as a simple sequence of individual records. A VBA array to pass with custom line type is possible, however, require a most inappropriate expenses: You'd have this, the C change / C + + program and teach him the PLA convention for such arrays (see
  • KB 194 609 in MSDN). This effort can save you, either by the array of sets are in a loop (for smaller arrays) or in an easy walk to be analyzed intermediate format (eg csv
    ) and then passed as a string. Leave A sheet with self-tests!
     
    This is almost an obvious remark: Code should, wherever possible and appropriate, be covered by automated tests. A test framework in Excel you have written down quickly. It is advisable to establish a separate worksheet for self-testing and then line by line to deposit the name of the test functions and the expected outcome. With a button "do test" then, all of these test functions are executed. It does no harm this sheet to be delivered. In maintenance, it will prove quite safe. In the implementation I used the dynamic function call with the function
    CallByName ()
    , as I have in my
    Excel interface for the Swiss Ephemeris
    had done.


    All in all, I am with the combination of Excel for the user interface with C + + for the actual program logic yet met with is not an insoluble problem. Some I would like to see easier in the implementation, and a more beautiful language than just VBA would also be pleasant. But it is everything, and for the implementation of a project like astro patterns, the main burden on the library functions themselves is, I'm happy with my decision to Excel as a user interface.
     [1] The data exchange format of spreadsheet programs to clipboard usually is a single version of CSV to TAB as the delimiter. 
    [2] has NET to proceed here somewhat differently. It uses the function declaration, a reference to the class

    System.Text.StringBuilder (instead of String

    ) and then gets on the design of an external function in VBA program a reusable string by using the method
    toString ()
    this reference.

Monday, May 17, 2010

What Does It Mean If Your Genetal Warts Bleed?

Exercise 9 Exercise 8: QGIS - Geodata Processing


Task:
FFH areas (fauna, flora, habitat) and bird sanctuaries form a European network of protected areas known as Natura 2000. Create this project according to the following terms of reference, using the presented in the previous exercises
query and analysis.

should use the Quantum GIS program, the Special Protection Areas and Flora-Fauna-Habitat (FFH) areas in Rheinland Pfalz. Here, the counties should Bernkastel-Wittlich Birkenfeld and highlighted with its bird sanctuaries and areas are FFH. For this purpose it was necessary based on the attribute table, the two to select counties. This is done by entering " NAME = 'Bernkastel-Wittlich' OR NAME = 'Birkenfeld' " in the advanced search. For the two counties of your layer "LK_BIR_WIL" was created. The fill color and the trim color was changed to emphasize the districts. concern were
All bird sanctuaries and all FFH areas the two districts of the research tool to position choose "markiert.Auch this a new layer (or VSG_ FFH_BIR_WIL) was created.
was then marked by the intersections Geoverarbeitungswerkzeug the parts of the Birds and Habitats Directive areas lying within the counties. The layer created is "VSG_ or FFH_BIR_WIL_instersect.
Next, create a buffer distance of 200 meters around the intersection of areas. Also, the tool buffer is one of the Geoverarbeitungswerkzeugen.
this purpose again, new layers are created (or VSG_ FFH_BIR_WIL_Puffer200)

Last part of the task was to create using the Quick Print function a PDF file on A2 format.

county boundaries Bernkastel-Wittlich Birkenfeld and


Full FFH areas by the Counties Bernkastel-Wittlich / Birkenfeld affected



Full VSG sites the of the districts of Bernkastel-Wittlich / Birkenfeld affected




intersection of the VSG-areas with the two districts

intersection of the VSG-areas with buffer












Saturday, May 1, 2010

If Your Married Should You Claim Zero

An alternative to the Visitor design pattern

The
visitors
  • is a widespread, especially among farmers compiler design pattern from the famous book of the "Gang of Four" [1]. It has some serious disadvantages. Usually one comes with an equally obvious and practical alternative to the Visitor design pattern from which I want to introduce here. The stakes of the Visitor design pattern can be best illustrated by the example of a parser. Once the source code of a program, so a text-shaped, were human and machine readable document, the parser once transformed into a complex, structured data object, are different possible further processing: A compiler can generate bytecode. An interpreter could run the program directly. A pretty printer could produce a formatted output of the program. A code inspector could calculate metrics or detect any problematic statements. In all cases, the basic procedure was the same: the individual Elements of the complex object tree are traversed by a particular procedure, and for each object - operation performed - for each class of this object matching. The objective of the Visitor design pattern is to standardize this practice and thereby to separate the operations to be performed by the classes of the object structure.
    What are the participants of the design pattern "visitor"?
     A 

    object tree (tree, list ...): A collection of objects, we call them represent elements that are instances of a manageable small set of classes. Let's call these classes element types.

    A
    operation
    That is to be executed on this object structure by
     

    a

    processor traverses the object structure and for each pass element is a call depending on the element type, different method.


    The goal of the design pattern "Visitor" is, the operation belonging to separate the code from both the processor and the element types and to encapsulate in a separate object type: the visitor interface.
    The visitor interface provides a method for each type of item available. All these methods can be named the same and only differ in the type of their argument. This is only possible in languages such as Java, overloading the Allow methods, but eg not in ABAP (there, the methods must then just be named differently for each element type).
     
    If we choose as the object structure to illustrate the XML DOM would have to offer the visitor class, for example, the following set of methods:


    interface Visitor {
     public void visit (n ElementNode); 
    public void visit (text node n);
    public void visit (CommentNode n);
    ...
    }
  • Moreover, each element represents a class - in an abstraction, such as an interface or a superclass defined - method accept (Visitor v) available. The processor calls then for each element traversed this
    accept () on
    method, so that is on the way to the appropriate operation of each element
    Visitor
    s running.
  • this need, the object structure is a accept () to expand
    method is a bad disadvantage of the Visitor pattern: we can not use the standard XML DOM in Java, such as the org.w3c.dom package
    , but have to boarding any class of the DOM by a self-programmed class to introduce the new method. Since it is a small consolation that this method is at least couched in general terms, so that it uses for various tasks can be. That the object used in the structure of concrete element classes the method accept () must implement is rather a classic case of "intrusion".
    yourself too, we must, if we repeat the principle
     
    Do not take them seriously and push it to the implementations of each element class always contain the following delegation same code (although that is natural for the design patterns are not required):


    ElementNode class implements Node {
    ...
    public void accept (Visitor visitor) {
    visitor.visit (this);}

    }



    Concrete Implementation is only there so that the overcharge mechanism visit by element type, the respective correct
    () method of the visitor
    binds. If the implementation was lacking, overloading would not work correctly because static in Java binding on overloading, that already takes place at compile time, the compiler can not and does not want to know what concrete object type at run-time visit in fact when you call the
    (node)
    method is passed.

    The processor now tells the passed elements to accept visitors. Let's say, the class
    DomTree
    Implement an iterator to traverse its elements. Then, the operation the concrete visitor performed as follows: void process (Visitor visitor, DomTree domTree) for (Node n: domTree) { n.accept (visitor);}
    }
  • A major train of visitor design pattern, the Visitor object using the
    accept (Visitor)
    method with all elements of the object structure is squeeze. The executed operations are as it were from within, out of the elements of the object structure called. Is this really necessary just to achieve a separation of operations-from the element code? consists Why have an interest in the visitor through the objects ? Sent through Separation of Concerns could also be a much simpler design to achieve, in which the elements can not accept a logic of its foreign
    () method
     be dirty, but remain so, as they can. To stay in the picture: The visitor design pattern allows visitors to the living room. One can also set up so that you can enter the person does not, but cleared for already at the door! One might call this design pattern 

    peddler.

    Suppose again for simplicity, our object tree is a DOM tree. Then we can find this object structure as a separate component, a
    TreeWalker
    . Make In
    TreeWalker
    is defined as the DOM tree is traversed. Since the
     TreeWalker 
    is competent to go through the elements of the object structure, it is a natural decision,
    visit calling the
    ()
    method with
    TreeWalker
    leave:
    He made the Visitor sends for each pass the element visit () message. A
    accept ()
    method is not needed then! The
  • TreeWalker could access the DOM tree, for example with the following recursive method process (node, visitor)
    :
    import org.w3c.dom .*; import org.w3c.dom.Node; / / The name "Node" is not in Java clearly import static org.w3c.dom.Node .* / / Node constants
    class TreeWalker
    {public void process ( Node s, Visitor v) {NodeList children =
    n.getChildNodes (); int numberOfChildren children.getLength = (); for (int i = 0; process (children.item (i), v);
    v.visit} (n);}

    } This intuitive design you have all three components are separated clearly. The object structure, the passage of the sub-objects, and finally the visitor when passing through the object structure, the Part objects in turn procured and presented to the visitor for processing. It is therefore for the Node objects that the TreeWalker
    and referred to it during his walk through the DOM tree. To the operations of the type of run-time element to the passed to the condition must be used by any type of Reflection: Depending on the type of need in each case different methods are executed. In
    org.w3c.dom
    , each node has a particular node type that the method getNodeType
    ()
    can be queried. Thus we save ourselves in this case, the use of Java Reflection API to the currently This item class to be determined.
      The node types are small whole numbers. It can be used in the Visitor
    • implementation as an index of an array of methods references. Since there are no methods in Java references are recommended anonymous inner classes. The following Visitor are for items the item name and text nodes the text content in the console:
    • class ExampleVisitor implements Visitor {
      / / The following array visitorFor "serves us as a dispatcher
    • private static Visitor [] visitorFor = new Visitor [ 10]; static { visitorFor [ELEMENT_NODE] = new Visitor () {public void
    • visit (Node n) {
      System.out.println ("Item" + ((Element) n) GetTagName ().)
    • }}; visitorFor [TEXT_NODE] = new Visitor () {public void
    • visit (Node n) {
      system. out.println ("Text node:" + n.getTextContent ());}

    };
    / / etc. for the other node types
    / / limited amount that will not change practically


    } public void visit ( Node n) {

    / / dispatching
     visitorFor [n.getNodeType ()] visit (s). 

    }}



    the sake of completeness here are the Test Class lists with which I have tried the whole design. It is based on a sample document and returns the root element and the visitors instance to the
    TreeWalker
    class Test { public static void main (String [] args) throws Exception { / / XML document read from a test string
    Document testdoc = getDocumentFromString (
    "\u0026lt;? xml version = \\" 1.0 \\ "encoding =" utf-8 \\ "?>"+ "\u0026lt;a> b \u0026lt;c> \u0026lt;d/> e \u0026lt;/ c> \u0026lt;/ a> "); / / All objects with the help of TreeWalker visit . TreeWalker new () process ( / / 1.Argument: root node of the XML document testDoc.getDocumentElement () / / 2.Argument: Visitor object ExampleVisitor new ());}

    private static Document getDocumentFromString (String doc) throws Exception {

    return
     javax.xml.parsers.DocumentBuilderFactory.newInstance () 
    . newDocumentBuilder ()
    . parse (new
    org.xml.sax.InputSource (
    new java.io.StringReader (doc )));}

    }


    The test class is for the sample document \u0026lt;a> b \u0026lt;c> \u0026lt;d/> e \u0026lt;/ c> \u0026lt;/ a> the expected result of: text nodes: b
    element d
    text nodes: e element c element a

     
    we go once listed in [1]
    consequences
    of the design pattern
    visitors
    and compare it with the design presented here:



    visitors make adding new operations easy.
    This is also true: In fact, neither the need nor the types of items TreeWalker be changed when a new Visitor object is developed.

    A visitor brings together related operations and separates them of operations which have nothing to do with the task of the visitor. is plainly satisfied here as well. Adding new element classes is hard. For us it is easier than in the Visitor pattern. Our Visitor interface contains so only one method. When adding new item classes, this method is valid because it is defined with the general element interface. The code to be executed for a particular operation must be implemented of course. The dispatch mechanism, however, could easily be formulated so that for unknown element classes simply no action is taken. Class hierarchy Cross visitors. This establishes that the elements visited in the Visitor pattern must not necessarily be derived from a common superclass. That is true. But they must all accept the (Visitor) method mentioned in their public interface. So you do not need a common superclass, but a common interface. This limits the usefulness of a Visitor pattern. For the presented draft, however, there are absolutely no restrictions to the element classes. Also inherit if the DOM element instance, all classes of node, this is not necessary. The common superclass could also be Object
    . The existence of a common element interface allows visitors, however, perform their work more effective (because otherwise worked with Reflection
    must
    ). 



    accumulation of state information
    . The visitor can while he visits the nodes to collect information in its attributes. This is equally possible.


    < numberOfChildren; ++i) {
    breaking the encapsulation.
    Since the visitor can access only the public components of the item class, it can happen that one is forced to publish internal information of the object to allow the visitor his work. This is a consequence which is in this form for all client-server relationships between objects, regardless of the visitor pattern.



    So there is no need to provide visitors with a pass to send
    accept (Visitor)
    interface with the objects of the object structure. There are simpler and more obvious designs that provide the same as the Visitor pattern.

    [1] Gamma, E, Helm, R. Johnson, R., Vlissides J.: Design Patterns .- elements of reusable object-oriented software , Addison-Wesley Germany 1996th