TheySaySomethingInterrestingApparently: 2010

〈0,1,1,2,3,5,8,13,21,...〉






Iterpipes, Between Bash and Hash-bash

A library for running shell pipelines using shell-like syntax

Enables piping infinite streams through shell pipelines in Python

xhtml-css Bivalidator

Check your markup and style validity

Advanced

Just type or paste an URL in the form above, and click on "check it" to see the magic. If you want to fine tune your validation, click on the "advanced" link. That's it!

Yet Another Comprehensive Content

Like, Young's modulus is a vibrating variation inside a solid... The times it take to respanw to an excess of energy is what molding apparence may look to not-so solid thing's... Like this Blog when adding content, the effor is like slapping it and the time it goes back, centered... we consider being more stable than usual...

lundi 16 août 2010

Someday, Code will speak by himself...

Some day, code will probably speak by himself, leaving coder have not choice to let himself, port himself to something else, like new cpu... It's ridiculous how 170 lines of code can easily be a Module creator for Wine...

They, may look for invalid idea left here to find-out motivation... I will recommand to inspect all C.V once again, instead spending time looking to «loisive» information possibly becoming important, it's a blog not a Code-Valley... By the way, We are so tiny here in this space, I may offer this porte-folio example for Nurun...

This example is using Wine, and parsing something that do not work as long yo read the comment and understant what is EBNF Syntax... Elsewhere, my other project, that create Python Module by inspecting AST result from module from pycparser and couples of test-module, I'm doing it over severals files inside the compilation Tree. Fixing my theory over Mozilla Firefox Generator Tree, Building it from scratch does not cost a full year of production... Maybe testing the design will, but one The AST parsing is acheived, altering string, for partability, translation or matter of category flavor, it's such information today Business are ready to pay... But major one, adaptation for top layer is the favorite one...

import os, sys, re
import iterpipes
from iterpipes import cmd, bincmd, linecmd, run, call, check_call, cmdformat, compose

import pybindgen
import ezpyinline
import pycparser 
from pycparser import c_parser as PyCParse

from classproperty import classproperty
from xml.dom import minidom
from lxml.html import parse

from lxml.cssselect import CSSSelector
from lxml import etree
from lxml.builder import E

from sets import Set
from html5lib import treebuilders

class BindGenStoreClass( ):
  BindStorage={}

  def __init__( self , BindValue=False, **Kargs ):
    print "Creating Instantiation of Class: %s" % ( self.__class__.__name__ )
    if BindValue:
      for ItemName in Kargs:
        print "\tBinding Variable %s" % ( ItemName )
        setattr( self, ItemName, Kargs[ItemName] )
  

class CodeStorage( ):

  CodeCompilePackage=[]

  def __init__( self , BindValue=False, **Kargs ):
    print "Creating Instantiation of Class: %s" % ( self.__class__.__name__ )
    if BindValue:
      for ItemName in Kargs:
        print "\tBinding Variable %s" % ( ItemName )
        setattr( self, ItemName, Kargs[ItemName] )
    

class Config( ):
  OSSourceType='Debian'
  #PackageType=r'-dev'
  #PackageName=r'wine1.2'
  IsDPKG=True
#  RegExpFileHeader={ 'h':(r'.h') }

  PackageFileList=[]
  PackageNameList=[]
  PackageNameListSelected=[]
  PackageNameMatch=[]
  PackageNameMain=None
  DictMsg={ 'error':{
    '__SearchPackageName__':("No Package %s%s installed, we strongly suggest to install a Wine package and It's development.") ,
    '__SearchPackageType__':("No Sub-Package %s%s installed, we strongly suggest to install a Wine package and It's development.") } }

  def __AptCacheLoad__( self ):
    DefName=self.__AptCacheLoad__.__name__
    self.AptCache=apt.cache.Cache()
    for ItemPackege in self.AptCache:
      self.PackageNameList.append( ItemPackege )

  def __SearchPackageName__( self ):
    DefName=self.__SearchPackageName__.__name__
    Regexp=re.compile( r'^%s' % self.PackageName )
    for ItemInspect in self.PackageNameList:
      if Regexp.match( ItemInspect.name ):
        self.PackageNameMatch.append( ItemInspect )
    if len( self.PackageNameMatch ) < 0 :
      raise StandardError, self.DictMsg['error'][DefName] % ( self.PackageName , self.PackageType )

  def __SearchPackageType__( self ):
    DefName=self.__SearchPackageType__.__name__
    Regexp=re.compile( r'%s%s' % ( self.PackageName,self.PackageType ) )
    self.PackageWine=None

    for Itempackage in self.PackageNameMatch:
      if Regexp.match( Itempackage.name ):
        self.PackageWine=Itempackage.name
        self.PackageFileList=Itempackage.installedFiles
    if self.PackageWine == None :
      raise StandardError, self.DictMsg['error'][DefName] % ( self.PackageName , self.PackageType )
    else:
      print "Found Package %s" % ( self.PackageWine )

  def __ChartFileLookup__( self ):
    for ItemRegChart in self.RegExpFileHeader.keys():
      StrValueEnd=self.RegExpFileHeader[ItemRegChart]
      for ItemFile in self.PackageFileList:
        if ItemFile.endswith( StrValueEnd ):
          self.PackageNameListSelected.append( ItemFile )
          
  def __init__( self, BindValue=True, **Kargs ):
    print "Creating Instantiation of Class: %s" % ( self.__class__.__name__ )
    if BindValue:
      for Item in Kargs:
        print "\tBinding Variable %s" % ( Item )
        setattr( self,  Item , Kargs[Item] )
        
    import apt
    self.__AptCacheLoad__()
    self.__SearchPackageName__()
    self.__SearchPackageType__()
    self.__ChartFileLookup__()
    

class WineDefAccessor( Config ):

  __all__=[ ]
  RegExpFilter='(?iu)'
  DictUserLevelProtection={ 'UserLevel':[ r'%suser'   % RegExpFilter ] ,
                            'Password':[ r'%spasword' % RegExpFilter ,
                                         r'%spasswd'  % RegExpFilter ,
                                         r'%spwd'     % RegExpFilter ,
                                         r'%spass'    % RegExpFilter ] }
  DictReference=dict()

  def __UserLevelRestriction__( self , StrArgKey , KeyNameInspections, DefaultDisplayOnConfidential='<<UserConfidential>>' ):
    IntSetUserConfidential=False

    NamedItem=None
    for ItemRestriction in self.DictUserLevelProtection.keys():
      for ItemList in self.DictUserLevelProtection[ItemRestriction]:
        TestRegExp=re.compile( ItemList )
        if TestRegExp.match( KeyNameInspections ) :
          IntSetUserConfidential = True

      if not IntSetUserConfidential:
        NamedItem=StrArgKey
      else:
        NamedItem=DefaultDisplayOnConfidential
    return NamedItem

  def __KargsTransfert__( self, **kargs ):
    for ItemKey in kargs:
      setattr( self, ItemKey , kargs[ItemKey] )

  def __init__( self, BindModule=False, **kargs ):
    if BindModule :
        self.__KargsTransfert__( **kargs )
    self.CodeParsing()

  def CodeParsing( self ):
    self.CodeBinderClass.BindStorage['module']=dict()
    if self.Conf.PackageWine != None:
      print "Start Parsing Include Header in package %s" % ( self.Conf.PackageWine )
      for FileNameHeader in self.Conf.PackageNameListSelected:
        print "Parsing File: %s" % FileNameHeader
        StrFileBuffer=""

        FileHandler=open( FileNameHeader, 'r+' )
        ### There is some regulation, inside file we need to add,
        ### Assuming it's /usr/include/wine/windows/ddk/compstui.h with wine version 1.2
        ### There's some Yaml rule to define to let the AST work... Or, some may implement 
        ### PyBoost.Spirit, has AST-finite parser, using Plain EBNF syntax from 

        ### http://userweb.cs.utexas.edu/users/lavender/courses/c++/ansic.g, and Using SimpleParser
        ### and you can acheive, fast, efficient AST-Rules stored in the CStore.CodeCompilePackage
        ### And Using next Step...
        ###
        ###
        ###

        StrNameModuleFromFile=FileNameHeader.split('/')
        StrNameModuleFromFile=StrNameModuleFromFile[len(StrNameModuleFromFile)-1]
        StrNameModuleFromFile.replace( '.h', '' )
        StrQualifiedName='%s_%s' % ( self.Conf.PackageNameMain , StrNameModuleFromFile )
        self.CodeBinderClass.BindStorage['module'][StrQualifiedName]=dict()
        self.CodeBinderClass.BindStorage['module'][StrQualifiedName]['Module']=pybindgen.Module( StrQualifiedName )
        self.CodeBinderClass.BindStorage['module'][StrQualifiedName]['Include']=self.CodeBinderClass.BindStorage['module'][StrQualifiedName]['Module'].add_include('"%s"' % FileNameHeader )

        #self.CStore.CodeCompilePackage.append( self.CCodeParser.parse( FileHandler.read() , FileNameHeader ) )

        FileHandler.close()
      
  def SearchWithRegExp( self, RegExpr, Buffer , MethodExtract='yield' , RegExpMeth='findall' ):
    StdGetattrList=[ 'print']
    StdGetattrListException=[ 'yield' ]
    if hasattr( RegExpr, RegExpMeth ):
      for IterFinder in getattr( RegExpr, RegExpMeth)( Buffer ) :
        if MethodExtract in StdGetattrList:
          getattr( __builtins__, MethodExtract )( str(IterFinder).replace( '\'', '' ) )
        if MethodExtract in StdGetattrListException:
          yield str(IterFinder).replace( '\'', '' )
      if MethodExtract == 'yield':
        raise GeneratorExit, 'Function Name %s had no other Generated Item' % ( self.SearchWithRegExp.func_name )

  def NodeLXml( self, StrType, *args):
    return { StrType:' '.join(args)}
  
  def StartNewTask( self, TypeFuncName, TupleData ):
    if hasattr( self, 'ThreadStart' ):
      self.ThreadStart.start_new( TypeFuncName, TupleData )
    else:
      import thread
      setattr( self, 'ThreadStart', 'None' )
      self.ThreadStart=thread()
      self.ThreadStart.start_new( TypeFuncName, TupleData )
      raise Warning, "Try to load the thread module from object %s instanciation like VarName=%s( ThreadStart=thread )" % ( self.__class__.__name__ , self.__class__.__name__ )




if __name__ == '__main__':
  del WineModParser
  WineModParser=WineDefAccessor( True,
                                 Conf=Config(True,PackageNameMain='wine' , PackageType=r'-dev', PackageName=r'wine1.2', RegExpFileHeader={ 'h':(r'.h') } ),
                                 CStore=CodeStorage(),
                                 CodeBinderClass=BindGenStoreClass(),
                                 CCodeParser=PyCParse.CParser() )




XCode under Essay, or simple example
XText may contains errors, syntax errors or lexical error...
  • 1No Interest
  • 2Somewhat good
  • 3Good
  • 4Special.

lundi 3 mai 2010

Sample, Bash Sub API for anybody ( pratical demonstration )


There is sample used to start a discussion in use of Variable within a __in_for function developed in context of completing some Programmation API like Javascript and PHP( with map_filter ) an equivalent in Bash* version [ GNU bash, version 4.0.33(1)-release] to use the Array and a common function with fixed member of Unique Parameter... You can download Here The API to get briefed with the example :
fnct_d-0.001-alpha_init.d_bash.tar.gz
Now included, a function to create a Gui and parse text with variable percentage of resume. Called OTS( Open Text Summerizer ), it something clever to show when explication weight several lines... It needs ubuntu with at least zenity package. Also, included for the first time, a crontab-launcher with dependency with fnct.d/fnct_lib with possibility to involve setting with pre-declared statement variable. This cron launcher had an example with. It shows you how to create list of shell-script to add at the end of the launcher... Of course the ultimate solution will be showed during session, courses. And fortunately, __call_locality had a new member pre-declared statement variable called __call_localityLocalName:


### example :
### follow context and come back if it's unclear.
function __test()
{
eval $( __call_localityLocalName=__test __call_locality ) ;
echo "${StrFuncName}" ;
}
### will print :
---> __test
function __test()
{
eval $( __call_locality ) ;
echo "${StrFuncName}" ;
}
### will print :
---> DefaultSubFunction

While inspecting __call_locality, don't forget to « promote C.O.R.P » ---HERE---

Context:
Using a simple Ubuntu Distribution through the VirtualBox station from you common installation, you may need to find executable name cvs and at least the GUI one, which is good for beginner... You may have only few knowledge in all command-line, and you may only know what preceding course on using packages under Debian and Ubuntu are working... Some utility like apt-src, apt-get, apt-file, dpkg and dpkg-deb are acquired through previous Personal Work in preceding chapter...

Takes following notes from fnct_lib the tiny Bash Function Left in this blog,


get_colis used in complement to extract a column-like... An ugly example with poems with Carriage return in every line will return the second word if you call it by piping a text and specifying two as parameter for get_col :( like cat grand-corps-malade.txt | get_col 2 )
eval $( __call_locality )Mandatory surrounded by «eval» and executive braces, will automatically create a parameter list from $*, called ArrayArg... Engine facility if you call it wrong ...
__in_for Equivalent to Javascript prototyping or simple Function with this embedded in corpus, or PHP map_filter(), or even Python map() is demonstrated here in bash function __in_for where first Argument is mandatory a Array... and any function designed to look inside the Array can Use ArrayArg[0] if __call_locality is evaluated ( Special case surround fixed parameter will produce another design and will change the order... but Posix remain clear in Argument processing). And, the beauty of __in_for is... the Array can hold its own property and it's index is propagated through the function calling... This mean Having an Array Called ArrayEx, inside a function designed with/without __call_locality will be available in the function designed with Member ${intArrayEx}, this mean intArrayEx is increased each-time, and both ArrayEx[intArrayEx] is accessible... and If the function body is designed with __call_locality ArrayEx[intArrayEx] and ${ArrayArg[0]} ( with no fixed parameter ) will give the same information...


Example:
### Finally... 
### This is unexplained inside conventional doc... Some distributions like Ubuntu and all 
### Debian, may hold on intermixing Argument between inline  declaration of ARRAY and $ARRAY. ### Actually There is talk because it's efficient and may be stronger to hold on python/bash ### code intermixing, but the preceding exercises is IMPORTANT to understanding code 
### alternative because some Distribution are not compatible yet with Argument Arrangement 
### introducing the argparse/wordish  python embedded processor with Bash Extension, you may ### fall down during the Bash Object-Generator Object in next chapter. But Tanks to source 
### this, it's provided a link for clang-fake-gcc python module have excellent example. 

# Setup script. Run me to install.

### example :
### follow context and come back if it's unclear.
function __test()
{
eval $( __call_localityLocalName=__test __call_locality ) ;
echo "${StrFuncName}" ;
}
### will print :
---> __test
function __test()
{
eval $( __call_locality ) ;
echo "${StrFuncName}" ;
}
### will print :
---> DefaultSubFunction

Following Discussion in Problems using multi-behavioring function, depending variable calling before function in this case submitted in previous source is using an echo as fixed parameter in __in_for calling... and the Body is acting differently... This is not The ArrayArg[0] that own Chunk of Array Information but ArrayArg[1]... Why, Posix calling conventions lead to impressive regulation and «octroi» an order of calling ; Starting with 'Program Name' 'Option' [ optionals options ] The Infor, by it's design Follow it's methodology claiming If only ArrayArg[0] is present by __in_for parameter declaration, mean only A datachunk is available, while Having ArrayArg[0] and ArrayArg[1] ( meaning ArrayArg[0] is fixed) will mean Item/Executive/Analytic member and 2nd and 3rd, data, option... This is why some person by the past already give a write-back of function with only Array Name and it's iterator...

And other hints, you can create a chain of Array and function... as long Array are unique, you can create a function with another __in_for passing another Array and central function will hold all iterator at the same... I did not develop any Frezing of lock-iterative method... still out of productivity and can create problems in Administration management

Topic still under essay, will be corrected by Tuesday with final draft... Any Student trying to work with pre-draft may facing couple of problems... Like doing free-work...

I prefer to invite person to leave e-mail, instead of playing a song at midnight with the explication embedded inside his song to tell me more about clang-fake-gcc... Hearing Clang like slang I was thinking in hip-hop like song... Until I remember this example invalidated in 2003 during a test phase... The famous inline declaration of ARG and $ARG under fedora distribution failed if not all Python module are installed... Did they already think doing code/argument intermixing... As ferry are old prediction... « It will have a Bash and a Python and the Admin action to axe the snake to kill the problems ».



Note:* : Bash is IEEE Standard 1003.1 compliant (Registration required to read all the content)
Note:** : IEEE 1003.2 is the Posix standard regulation for Regular Expression see: White paper on One Single Unix Specification.



  • 1No Interest
  • 2Somewhat good
  • 3Good
  • 4Exactly This.