console.log debug gulp

Posted: February 1, 2016 in web

http://stackoverflow.com/questions/27975129/console-log-to-stdout-on-gulp-events

Advertisements
$meta = get_post_meta( get_the_ID() );
print_r($meta['ce-wp-menu-per-page'][0]);

Output is the value of primary menu using that plugin.

how to capture event chrome developer

Posted: November 4, 2015 in web

Hit F12 to open Dev Tools
Click the Sources tab
On right-hand side, scroll down to “Event Listener Breakpoints”, and expand tree
Click on the events you want to listen for.

Interact with the target element, if they fire you will get a break point in the debugger
Similarly, you can right click on the target element -> select “inspect element” Scroll down on the right side of the dev frame, at the bottom is ‘event listeners’. Expand the tree to see what events are attached to the element. Not sure if this works for events that are handled through bubbling (I’m guessing not)

http://stackoverflow.com/questions/10213703/how-do-i-view-events-fired-on-an-element-in-chrome-web-developer

Followed this documentation on setting up the cluster. It needs wildfly9 and apache 2.2

https://docs.jboss.org/author/display/WFLY9/WildFly+9+Cluster+Howto

I will not work on different subnet. Moved domain controller and host on the same subnet.

Domain conntroller/master

httpd.conf

LoadModule proxy_module modules/mod_proxy.so  
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so  
LoadModule proxy_http_module modules/mod_proxy_http.so  
  
  
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so

LoadModule manager_module modules/mod_manager.so
LoadModule slotmem_module modules/mod_slotmem.so
LoadModule advertise_module modules/mod_advertise.so

# This Listen port is for the mod_cluster-manager, where you can see the status of mod_cluster.
# Port 10001 is not a reserved port, so this prevents problems with SELinux.
Listen 192.168.217.231:10001
# This directive only applies to Red Hat Enterprise Linux. It prevents the temmporary
# files from being written to /etc/httpd/logs/ which is not an appropriate location.
 
<VirtualHost 192.168.217.231:10001>

  <Directory />
    Order deny,allow
    Allow from all
    Allow from 192.168.217.
  </Directory>
 
 
  # This directive allows you to view mod_cluster status at URL http://10.211.55.4:10001/mod_cluster-manager
  <Location /mod_cluster-manager>
   SetHandler mod_cluster-manager
   Order deny,allow
   Allow from all
   Allow from 192.168.217.
  </Location>
 
  KeepAliveTimeout 60
  MaxKeepAliveRequests 0
 
  ManagerBalancerName other-server-group  
  AdvertiseSecurityKey secret
  AdvertiseFrequency 5  
  EnableMCPMReceive
</VirtualHost> 

host.xml

<management>
        <security-realms>
            <security-realm name="ManagementRealm">
                <authentication>
                    <local default-user="$local" skip-group-loading="true"/>
                    <properties path="mgmt-users.properties" relative-to="jboss.domain.config.dir"/>
                </authentication>
                <authorization map-groups-to-roles="false">
                    <properties path="mgmt-groups.properties" relative-to="jboss.domain.config.dir"/>
                </authorization>
            </security-realm>
            <security-realm name="ApplicationRealm">
                <authentication>
                    <local default-user="$local" allowed-users="*" skip-group-loading="true"/>
                    <properties path="application-users.properties" relative-to="jboss.domain.config.dir"/>
                </authentication>
                <authorization>
                    <properties path="application-roles.properties" relative-to="jboss.domain.config.dir"/>
                </authorization>
            </security-realm>
        </security-realms>
        <audit-log>
            <formatters>
                <json-formatter name="json-formatter"/>
            </formatters>
            <handlers>
                <file-handler name="host-file" formatter="json-formatter" relative-to="jboss.domain.data.dir" path="audit-log.log"/>
                <file-handler name="server-file" formatter="json-formatter" relative-to="jboss.server.data.dir" path="audit-log.log"/>
            </handlers>
            <logger log-boot="true" log-read-only="false" enabled="false">
                <handlers>
                    <handler name="host-file"/>
                </handlers>
            </logger>
            <server-logger log-boot="true" log-read-only="false" enabled="false">
                <handlers>
                    <handler name="server-file"/>
                </handlers>
            </server-logger>
        </audit-log>
        <management-interfaces>
            <native-interface security-realm="ManagementRealm">
                <socket interface="management" port="${jboss.management.native.port:9999}"/>
            </native-interface>
            <http-interface security-realm="ManagementRealm" http-upgrade-enabled="true">
                <socket interface="management" port="${jboss.management.http.port:9990}"/>
            </http-interface>
        </management-interfaces>
    </management>

    <domain-controller>
        <local/>
        <!-- Alternative remote domain controller configuration with a host and port -->
        <!-- <remote protocol="remote" host="${jboss.domain.master.address}" port="${jboss.domain.master.port:9999}" security-realm="ManagementRealm"/> -->
    </domain-controller>

    <interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:192.168.217.231}"/>
        </interface>
        <interface name="public">
            <inet-address value="${jboss.bind.address:192.168.217.231}"/>
        </interface>
        <interface name="unsecure">
            <!-- Used for IIOP sockets in the standard configuration.
                 To secure JacORB you need to setup SSL -->
            <inet-address value="${jboss.bind.address.unsecure:192.168.217.231}"/>
        </interface>
    </interfaces>

    <jvms>
        <jvm name="default">
            <heap size="64m" max-size="256m"/>
            <permgen size="256m" max-size="256m"/>
            <jvm-options>
                <option value="-server"/>
            </jvm-options>
        </jvm>
    </jvms>

    <servers>
        <server name="server-three" group="other-server-group" auto-start="true">
            <!-- server-three avoids port conflicts by incrementing the ports in
                 the default socket-group declared in the server-group -->
            <socket-bindings port-offset="250"/>
        </server>
    </servers>

domain.xml

...
<subsystem xmlns="urn:jboss:domain:messaging:3.0">
                <hornetq-server>
                    <cluster-password>anypassword</cluster-password>
                    <journal-file-size>102400</journal-file-size>

                    <connectors>
                        <http-connector name="http-connector" socket-binding="http">
                            <param key="http-upgrade-endpoint" value="http-acceptor"/>
                        </http-connector>
...
<server-groups>
        <server-group name="main-server-group" profile="full">
            <jvm name="default">
                <heap size="64m" max-size="512m"/>
            </jvm>
            <socket-binding-group ref="full-sockets"/>
        </server-group>
        <server-group name="other-server-group" profile="full-ha">
            <jvm name="default">
                <heap size="64m" max-size="512m"/>
            </jvm>
            <socket-binding-group ref="full-ha-sockets"/>
            <deployments>
                <deployment name="http-1.0-SNAPSHOT.war" runtime-name="http-1.0-SNAPSHOT.war"/>
            </deployments>
        </server-group>
    </server-groups>

Host/Slave

host.xml

...
<host name="slave" xmlns="urn:jboss:domain:3.0">
...
<security-realms>
            <security-realm name="ManagementRealm">
                <server-identities>
                    <secret value="cGFzc3cwcmQ="/>
                </server-identities>
                <authentication>
                    <local default-user="$local" skip-group-loading="true"/>
                    <properties path="mgmt-users.properties" relative-to="jboss.domain.config.dir"/>
                </authentication>
                <authorization map-groups-to-roles="false">
                    <properties path="mgmt-groups.properties" relative-to="jboss.domain.config.dir"/>
                </authorization>
            </security-realm>
            <security-realm name="ApplicationRealm">
                <authentication>
                    <local default-user="$local" allowed-users="*" skip-group-loading="true"/>
                    <properties path="application-users.properties" relative-to="jboss.domain.config.dir"/>
                </authentication>
                <authorization>
                    <properties path="application-roles.properties" relative-to="jboss.domain.config.dir"/>
                </authorization>
            </security-realm>
        </security-realms>
...
<domain-controller>
        <remote protocol="remote" host="ip of master" port="9999" security-realm="ManagementRealm" username="slave"/>
    </domain-controller>
<interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:current ip}"/>
        </interface>
        <interface name="public">
            <inet-address value="${jboss.bind.address:current ip}"/>
        </interface>
        <interface name="unsecure">
            <inet-address value="${jboss.bind.address.unsecure:current ip}"/>
        </interface>
    </interfaces>
....
<servers>
        <server name="server-three-slave" group="other-server-group" auto-start="true">
            <socket-bindings port-offset="150"/>
        </server>

</servers>


backup mysql db aws rds using timestamp

Posted: October 13, 2015 in web
@echo OFF

:: Use date /t and time /t from the command line to get the format of your date and
:: time; change the substring below as needed.
:: This will create a timestamp like yyyy-mm-dd-hh-mm-ss.
set TIMESTAMP=%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%-%TIME:~0,2%-%TIME:~3,2%-%TIME:~6,2%

@echo TIMESTAMP=%TIMESTAMP%
md U:\backup\"%1\%TIMESTAMP%"
cd U:\backup\"%1\%TIMESTAMP%"
mysqldump -h me.rds.amazonaws.com -u meuser medb > meRemote.sql

linux aws backup files using sh

Posted: October 13, 2015 in web
#!/bin/sh

time_stamp=$(date +%Y-%m-%d-%T)
mkdir backup/"${time_stamp}"
cd /var/www/html/www.me.com
zip -r /home/ec2-user/backup/"${time_stamp}"/files.zip .*

test ionic push curl

Posted: October 12, 2015 in web

-k bypass SSL

curl -k -u IONIC-SECRET-KEY -H "Content-Type: application/json" -H "X-Ionic-Application-Id: IONIC-APP-ID" https://push.ionic.io/api/v1/push -d '{"tokens":["IONIC-USER-TOKEN"],"notification":{"alert":"I come from planet Ion."}}'