working on it ...

Filters

Explore Public Snippets

Sort by

Found 2,669 snippets matching: macro

    public by fabio.nosenzo  264133  8  6  0

    Refresh all pivot table excel vba macro

    With this snippet you can refresh all the pivot tables in excel workbook within a macro
    ThisWorkbook.RefreshAll

    public by sercani  3260  14  7  5

    C++ Setter Getter Macros

    Add these macros to a header file and include this file wherever you need. If you want to use SetGetMacro for an integer named as "foo", you just need to add this line to your header file: SetGetMacro(foo, int);
    //--------------------------------------------------
    #define SetMacro(name,type)								\
    void Set##name (type _arg)								\
    {														\
      if (this->name != _arg)								\
    	{													\
    		this->name = _arg;								\
    	}													\
    } 
    //--------------------------------------------------
    #define GetMacro(name,type)								\
    type Get##name ()const									\
    {														\
    	return this->name;									\
    } 
    //--------------------------------------------------
    #define SetGetMacro(name,type)							\
    void Set##name (type _arg)								\
    {														\
      if (this->name != _arg)								\
    	{													\
    		this->name = _arg;								\
    	}													\
    }														\
    type Get##name ()const									\
    {														\
    	return this->name;									\
    }
    //--------------------------------------------------
    #define BooleanMacro(name,type)							\
    void name##On ()										\
    {														\
    	if(this->name != static_cast<type>(1))				\
    	{													\
    		this->name = static_cast<type>(1);				\
    	}													\
    }														\
    void name##Off ()										\
    {														\
    	if(this->name != static_cast<type>(0))				\
    	{													\
    		this->name = static_cast<type>(0);				\
    	}													\
    }														\
    type Is##name##On()										\
    {														\
    	return this->name;									\
    }
    //--------------------------------------------------
    #define BooleanSetGetMacro(name,type)					\
    void Set##name (type _arg)								\
    {														\
      if (this->name != _arg)								\
    	{													\
    		this->name = _arg;								\
    	}													\
    }														\
    type Get##name ()const									\
    {														\
    	return this->name;									\
    }														\
    void name##On ()										\
    {														\
    	if(this->name != static_cast<type>(1))				\
    	{													\
    		this->name = static_cast<type>(1);				\
    	}													\
    }														\
    void name##Off ()										\
    {														\
    	if(this->name != static_cast<type>(0))				\
    	{													\
    		this->name = static_cast<type>(0);				\
    	}													\
    }														\
    type Is##name##On()										\
    {														\
    	return this->name;									\
    }

    public by aniello  3321  0  4  0

    wlst macrodefs for resource adapter deployment.

    wlst macrodefs for resource adapter deployment.: wlstTaskDefs.xml
    XML
    <?xml version="1.0" encoding="iso-8859-1"?>
    <antlib>
    
       <taskdef name="wldeploy" 
                classpathref="library.weblogic" 
                classname="weblogic.ant.taskdefs.management.WLDeploy"/>   
    
       <taskdef name="wlst" 
                classpathref="library.weblogic" 
                classname="weblogic.ant.taskdefs.management.WLSTTask"/>   
    
       <macrodef name="wlRedeployResourceAdapter">
        <attribute name="adminUser"/>
        <attribute name="adminPassword"/>
        <attribute name="adminUrl"/>
        <attribute name="appName"/>
        
        <sequential>
          <wlst classpathref="library.weblogic" 
                failonerror="true" 
                debug="false" 
                arguments="@{adminUser} @{adminPassword} @{adminUrl} @{appName} ">
            <script>
                import random
    
                adminUser=sys.argv[0]
                adminPassword=sys.argv[1]
                adminUrl=sys.argv[2]
                
                appPath=sys.argv[3]
                 
                def main():
                	
                	connect(adminUser,adminPassword,adminUrl)
                	edit()
                	try:
                		startEdit()
                		
                		planPath = get('/AppDeployments/'+appName+'/PlanPath')
                		print '__ Using plan ' + planPath
                		cd('/AppDeployments/'+appName+'/Targets');
                		redeploy(appName, planPath,targets=cmo.getTargets());
                		cd('/')
                	except:
                		stopEdit('y')
                main()
            </script>
          </wlst>
        </sequential>
       </macrodef>
    		
    			
      
       <macrodef name="wlCreateResourceAdapter">
        <attribute name="adminUser"/>
        <attribute name="adminPassword"/>
        <attribute name="adminUrl"/>
        <attribute name="eisName"/>
        <attribute name="cfName"/>
    
        <attribute name="propertyName"/>
        <attribute name="connectionFactoryInterface"/>
        <attribute name="appName"/>
        <attribute name="appPath"/>
    
        
        <sequential>
          <wlst classpathref="library.weblogic" 
                failonerror="true" 
                debug="false" 
                arguments="@{adminUser} @{adminPassword} @{adminUrl} @{eisName} @{cfName} @{propertyName} @{connectionFactoryInterface} @{appName} @{appPath} ">
            <script>
                import random
    
                adminUser=sys.argv[0]
                adminPassword=sys.argv[1]
                adminUrl=sys.argv[2]
                
                eisName=sys.argv[3]
                cfName=sys.argv[4]
                
                propertyName=sys.argv[5]
                connectionFactoryInterface=sys.argv[6]
                appName=sys.argv[7]
                appPath=sys.argv[8]
                
                 
                moduleOverrideName=appName+'.rar'
                moduleDescriptorName='META-INF/weblogic-ra.xml'
                idRandom=random.randint(10000,100000)
                connectionInstance='ConnectionInstance_eis/wls/MyCF_JNDIName_'+str(idRandom)
                configProperty='ConfigProperty_ConnectionFactoryLocation_Value_'+str(idRandom)
                
                def makeDeploymentPlanVariable(wlstPlan, name, value, xpath, origin='planbased'):
                 
                	while wlstPlan.getVariableAssignment(name, moduleOverrideName, moduleDescriptorName):
                		wlstPlan.destroyVariableAssignment(name, moduleOverrideName, moduleDescriptorName)
                	
                	while wlstPlan.getVariable(name):
                		wlstPlan.destroyVariable(name)
                	
                	variableAssignment = wlstPlan.createVariableAssignment( name, moduleOverrideName, moduleDescriptorName )
                	variableAssignment.setXpath( xpath )
                	variableAssignment.setOrigin( origin )
                	wlstPlan.createVariable( name, value )
                 
                 
                def main():
                	
                	connect(adminUser,adminPassword,adminUrl)
                	edit()
                	try:
                		startEdit()
                		
                		planPath = get('/AppDeployments/'+appName+'/PlanPath')
                		print '__ Using plan ' + planPath
                		
                		myPlan=loadApplication(appPath, planPath)
                		
                		print '___ BEGIN change plan'
                		makeDeploymentPlanVariable(myPlan, connectionInstance, eisName, '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="'+connectionFactoryInterface+'"]/connection-instance/[jndi-name="'+ eisName + '"]/jndi-name')
                		makeDeploymentPlanVariable(myPlan, configProperty, cfName, '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="'+connectionFactoryInterface+'"]/connection-instance/[jndi-name="'+ eisName + '"]/connection-properties/properties/property/[name="'+propertyName+'"]/value')
                		print '___ DONE change plan'
                		
                		myPlan.save();
                		save();
                		activate(block='true');
                	except:
                		stopEdit('y')
                main()
            </script>
          </wlst>
        </sequential>
       </macrodef>
    
     
    
    </antlib>
    
    

    public by fabio.nosenzo  6045  3  7  0

    Screen update disable in Excel VBA

    How to disable and enable screen update in Excel VBA, speeding up macro execution
    ' disable screen updating
    Application.ScreenUpdating = False
    
    ' enable screen updating
    Application.ScreenUpdating = True
    

    public by arijitiit  1900  2  4  0

    C++_1

    mACROS
    // Enter here the actual content of the snippet.            
    
    typedef long long ll;
    typedef pair<int, int> ii;
    typedef vector<ii> vii;
    typedef vector<int> vi;
    #define INF 1000000000

    external by allhailwesttexas  241376  9  4  1

    Flask/Jinja2 macro for rendering pagination in a template with Bootstrap components. Can center the component by wrapping in <nav class="text-center">.

    Flask/Jinja2 macro for rendering pagination in a template with Bootstrap components. Can center the component by wrapping in .: pagination_macros.html
    {% macro render_pagination(pagination, endpoint) %}
    
      <ul class="pagination">
    
        {% if pagination.has_prev %}
          <li>
            <a href="{{ url_for(endpoint, page=pagination.prev_num) }}" aria-label="Previous">
              <span aria-hidden="true">&laquo;</span>
            </a>
          </li>
        {% endif %}
    
        {% for p in pagination.iter_pages(left_edge=1, left_current=2, right_current=3, right_edge=1) %}
          {% if p %}
            {% if p != pagination.page %}
              <li>
                <a href="{{ url_for(endpoint, page=p) }}">{{ p }}</a>
              </li>
            {% else %}
              <li class="active">
                <a href="{{ url_for(endpoint, page=p) }}">{{ p }}</a>
              </li>
            {% endif %}
          {% else %}
            <li class="disabled">
              <span class="ellipsis">&hellip;</span>
            </li>
          {% endif %}
        {% endfor %}
    
        {% if pagination.has_next %}
          <li>
            <a href="{{ url_for(endpoint, page=pagination.next_num) }}" aria-label="Next">
              <span aria-hidden="true">&raquo;</span>
            </a>
          </li>
        {% endif %}
    
      </ul>
    
    {% endmacro %}
    
    
    

    external by warriorg  235865  0  3  0

    My aLog and dLog macros in Swift (to abbreviate NSLog)

    My aLog and dLog macros in Swift (to abbreviate NSLog): Macros.swift
    //
    //  Macros.swift
    //
    //  Created by Xavier Muñiz on 6/12/14.
    
    import Foundation
    
    
    // dLog and aLog macros to abbreviate NSLog.
    // Use like this:
    //
    //   dLog("Log this!")
    //
    #if DEBUG
        func dLog(message: String, filename: String = __FILE__, function: String = __FUNCTION__, line: Int = __LINE__) {
            NSLog("[\(filename.lastPathComponent):\(line)] \(function) - \(message)")
        }
    #else
        func dLog(message: String, filename: String = __FILE__, function: String = __FUNCTION__, line: Int = __LINE__) {
        }
    #endif
    func aLog(message: String, filename: String = __FILE__, function: String = __FUNCTION__, line: Int = __LINE__) {
        NSLog("[\(filename.lastPathComponent):\(line)] \(function) - \(message)")
    }
    
    
    

    external by enkore  240  0  3  0

    Qt utility macro for creating a proper QSettings hierarchy without hassle

    Qt utility macro for creating a proper QSettings hierarchy without hassle: settings.h
    C
    #ifndef SETTINGS_H
    #define SETTINGS_H
    
    #include <QSettings>
    #include <QMap>
    #include <QObject>
    #include <QStringList>
    
    extern QMap<QObject*, QSettings*> _settings_h_settings;
    
    // rev. 2: Use QStringList instead of repeated QString formatting
    
    /**
     * @brief returns a QSettings with a reasonable prefix set
     * @note only works inside methods of QObject-derived classes
     * @note first use should be early and unconditional, e.g. in the constructor
     * @note add definition of _settings_h_settings to one compilation unit
     */
    #define settings                                        \
        (*[this]() -> QSettings* {                          \
            if(_settings_h_settings.contains(this)) {       \
                return _settings_h_settings[this];          \
            }                                               \
            QStringList path{this->objectName()};           \
            QObject *p{this->parent()};                     \
            while(p) {                                      \
                if(p->objectName().size()) {                \
                path.prepend(p->objectName());              \
                }                                           \
                p = p->parent();                            \
            }                                               \
            QSettings *s{new QSettings(this)};              \
            s->beginGroup(path.join("/"));                  \
            _settings_h_settings[this] = s;                 \
            return s;                                       \
        }())
    
    #endif // SETTINGS_H
    
    
    

    external by tp81  34  0  1  0

    This Nikon Elements macro reads the open filename and the image title and converts the open image in Elements to TIFF. Each channel is saved in a separate file as a multi-page stack (z). It is designed to be used together with the "Macro/Run on files i...

    This Nikon Elements macro reads the open filename and the image title and converts the open image in Elements to TIFF. Each channel is saved in a separate file as a multi-page stack (z). It is designed to be used together with the "Macro/Run on files in folder..." item: ExportCurrentImageToTIFF.mac
    /* This Nikon Elements macro reads the open filename and the image title and converts the open image in Elements to TIFF. Each channel is saved in a separate file as a multi-page stack (z). It is designed to be used together with the "Macro/Run on files in folder..." item */
    
    char filename[1000];
    char title[1000];
    
    Get_Filename(5,filename);
    Get_FileTitle(title,filename);
    
    ND_ExportToTIFF(filename,"E:\OutputDirectory\",title,0,0,0,256);
    
    
    

    external by Robert T. McGibbon  34  0  1  0

    Macro to set the time on an ardunio using https://github.com/PaulStoffregen/Time from the __DATE__ and __TIME__ preprocessor macros.

    Macro to set the time on an ardunio using https://github.com/PaulStoffregen/Time from the __DATE__ and __TIME__ preprocessor macros.: time.ino
    #define SET_TIME() (setTime( \
    ((__TIME__[0]-'0')*10 + (__TIME__[1]-'0')), \
    ((__TIME__[3]-'0')*10 + (__TIME__[4]-'0')), \
    ((__TIME__[6]-'0')*10 + (__TIME__[7]-'0')), \
    ((__DATE__[4]-'0')*10 + (__DATE__[5]-'0')), \
    (__DATE__ [2] == 'n' ? (__DATE__ [1] == 'a' ? 1 : 6) \
        : __DATE__ [2] == 'b' ? 2 \
        : __DATE__ [2] == 'r' ? (__DATE__ [0] == 'M' ? 3 : 4) \
        : __DATE__ [2] == 'y' ? 5 \
        : __DATE__ [2] == 'l' ? 7 \
        : __DATE__ [2] == 'g' ? 8 \
        : __DATE__ [2] == 'p' ? 9 \
        : __DATE__ [2] == 't' ? 10 \
        : __DATE__ [2] == 'v' ? 11 \
        : 12), \
    ((__DATE__[7]-'0')*1000 + (__DATE__[8]-'0')*100 + \
     (__DATE__[9]-'0')*10 + (__DATE__[10]-'0')) \
    ))
    
    
    
    • Public Snippets
    • Channels Snippets