Following is the Find and Replace with syntax, make sure the Regular expression is selected
Find: (\w)(\w+)
Replace with: \u\1\2
Following is the Find and Replace with syntax, make sure the Regular expression is selected
Find: (\w)(\w+)
Replace with: \u\1\2
First we define a function which contains all the needed procedures. and save the script in
(define (batch-reduce-img-size pattern reduceby) (let* ((filelist (cadr (file-glob pattern 1)))) (while (not (null? filelist)) (let* ((filename (car filelist)) (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (imageWidth (car (gimp-image-width image))) (imageHeight (car (gimp-image-height image))) (newWidth (* imageWidth reduceby)) (newHeight (* imageHeight reduceby)) (drawable (car (gimp-image-get-active-layer image)))) (gimp-image-scale image newWidth newHeight) (gimp-file-save 1 image drawable filename filename) (gimp-image-delete image)) (set! filelist (cdr filelist)))))
gimp -i -b '(batch-reduce-img-size "*.JPG" 0.5)' -b '(gimp-quit 0)
| Traditional Function | ES6 Arrow Function |
function myFunction() { | const myFunction = () => { |
| function myFunction(name) { ... } | const myFunction = (name) => { ... } const myFunction = name => { ... } |
function add(n, m) { | const add = (n, m) => n+m;if a single line return then the return keyword and the curly brackets can be omitted |
const newArray = [...oldArray, 1, 2];
const newObject = {...oldObject, newProerty:newValue}
function sortArgs(...args) {
return args.sort();
}[a, b] = ["Hello", "World"]
console.log(a) // Hello
console.log(b) // World
{name} = {"name": "Aang", "age" : 112}
console.log(name) // Aang
console.log(age) // undefined <html> <body> <canvas id="drawArea" width="1024" height="768"></canvas> </body> <script> var canvas = document.getElementById("drawArea"); var canvasContext = canvas.getContext("2d"); canvasContext.fillStyle = "black"; canvasContext.beginPath(); canvasContext.arc(100, 100, 50, 0, Math.PI*2, true); canvasContext.fill(); </script> </html>
canvasContext.fillStyle="black";
canvasContext.beginPath();canvasContext.moveTo(100,100); canvasContext.lineTo(150,100); canvasContext.arc(100, 100, 50, 0, Math.PI/2, false); canvasContext.lineTo(100, 100); canvasContext.fill();
canvasContext.storeStyle="black"; canvasContext.beginPath(); canvasContext.moveTo(100,100); canvasContext.lineTo(150,100); canvasContext.arc(100, 100, 50, 0, Math.PI/2, false); canvasContext.lineTo(100, 100); canvasContext.stroke();
#include <stdio.h> void sayHello() { printf("Hello world, from C\n"); }
public class HelloWorld { private native void callCHello(); static { System.loadLibrary("chello"); } public static void main(String[] args) { new HelloWorld().callCHello(); } }Here we are loading the chello C library (we will be creating in the later part) which contains the implementation for the native method callCHello()
javac HelloWorld.java
javah HelloWorld
#include <jni.h> #include <stdio.h> #include "HelloWorld.h"#include "hello.c" JNIEXPORT void JNICALL Java_HelloWorld_callCHello(JNIEnv *env, jobject obj) { sayHello(); return; }
gcc chello.c -I $JAVA_HOME/include/ -I $JAVA_HOME/include/linux/ -shared -o libhello.so -fPIC
java HelloWorld
public class SampleClassMediator extends AbstractMediator {
private static final Log log = LogFactory.getLog(SampleClassMediator.class);
public boolean mediate(MessageContext messageContext) {
log.info("This is a sample class mediator");
return true;
}
}
ab -n 10 -c 5 -p req.xml -T "text/xml" -H "soapAction:getSimpleQuote" http://localhost:9000/services/SimpleStockQuoteService
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <ser:getSimpleQuote xmlns:ser="http://services.samples"> <ser:symbol>ABC</ser:symbol> </ser:getSimpleQuote> </soapenv:Body> </soapenv:Envelope>
create database WSO2_EI_611_REG_DB; use WSO2_EI_611_REG_DB; source /path-to-<EI-HOME>/dbscripts/mysql5.7.sql; create database WSO2_EI_611_UM_DB; use WSO2_EI_611_UM_DB; source /path-to-<EI-HOME>/dbscripts/mysql5.7.sql;
<datasource> <name>WSO2_SHARED_REG_DB</name> <description>The datasource is used for shared config and governance registry</description> <jndiConfig> <name>jdbc/WSO2SharedDB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://localhost:3306/WSO2_EI_611_REG_DB</url> <username>user</username> <password>password</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource> <datasource> <name>WSO2_UM_DB</name> <description>The datasource is used for user management</description> <jndiConfig> <name>jdbc/WSO2UmDB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://localhost:3306/WSO2_EI_611_UM_DB</url> <username>user</username> <password>password</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> </configuration> </definition> </datasource>
<dbConfig name="sharedregistry"> <dataSource>jdbc/WSO2SharedDB</dataSource> </dbConfig> <remoteInstance url="https://localhost:9443/registry"> <id>instanceid</id> <dbConfig>sharedregistry</dbConfig> <readOnly>false</readOnly> <enableCache>true</enableCache> <registryRoot>/</registryRoot> </remoteInstance> <mount path="/_system/config" overwrite="true"> <instanceId>instanceid</instanceId> <targetPath>/_system/esbnodes</targetPath> </mount> <mount path="/_system/governance" overwrite="true"> <instanceId>instanceid</instanceId> <targetPath>/_system/governance</targetPath> </mount>
<Property name="dataSource">jdbc/WSO2UmDB</Property>
<clustering class="org.wso2.carbon.core.clustering.hazelcast.HazelcastClusteringAgent" enable="true">
<parameter name="clusteringPattern">nonWorkerManager</parameter>
<parameter name="localMemberHost">ei.wso2.com</parameter>
<members> <member> <hostName>ei.wso2.com</hostName> <port>4200</port> </member> </members>
<parameter name="localMemberPort">4200</parameter>Update the member list as follows
<members> <member> <hostName>ei.wso2.com</hostName> <port>4100</port> </member> </members>
node2:repository$> ln -s <path-to-node1>/reposository/deployment deployment
gimp -i -b '(<function name> <arguments>)' -b '(gimp-quit 0)'
(define (batch-reduce-img-quality pattern quality) (let* ((filelist (cadr (file-glob pattern 1)))) (while (not (null? filelist)) (let* ((filename (car filelist)) (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (drawable (car (gimp-image-get-active-layer image)))) (file-jpeg-save 1 image drawable filename filename quality 0 1 1 "" 0 1 0 0) (gimp-image-delete image)) (set! filelist (cdr filelist)))))
gimp -i -b '(batch-reduce-img-quality "*.JPG" 0.5)' -b '(gimp-quit 0)'
CREATE DATABASE SimpleSchool; USE SimpleSchool; CREATE TABLE `Student` (`Id` int(11) DEFAULT NULL, `Name` varchar(200) DEFAULT NULL, `State` varchar(4) DEFAULT NULL);
<data name="SimpSchool" transports="http https local"> <config enableOData="false" id="SimplSchool"> <property name="driverClassName">com.mysql.jdbc.Driver</property> <property name="url">jdbc:mysql://localhost:3306/SimpleSchool</property> <property name="username">USERNAME</property> <property name="password">PASSWORD</property> </config> <query id="insertStudent" useConfig="SimplSchool"> <sql>insert into Student (Id, Name, State) values (? ,? ,?);</sql> <param name="Id" sqlType="STRING"/> <param name="Name" sqlType="STRING"/> <param name="State" sqlType="STRING"/> </query> <query id="getCount" useConfig="SimplSchool"> <sql>select count(*) as count from Student where State = 'New';</sql> <result element="Result" rowName=""> <element column="count" name="count" xsdType="string"/> </result> </query> <query id="UpdateState" returnUpdatedRowCount="true" useConfig="SimplSchool"> <sql>update Student set state='Done' where Id=?;</sql> <result element="UpdatedRowCount" rowName="" useColumnNumbers="true"> <element column="1" name="Value" xsdType="integer"/> </result> <param name="Id" sqlType="STRING"/> </query> <query id="selectStudent" useConfig="SimplSchool"> <sql>select Id, Name from Student where state='New' limit 1;</sql> <result element="Entries" rowName="Entry"> <element column="Id" name="Id" xsdType="string"/> <element column="Name" name="Name" xsdType="string"/> </result> </query> <resource method="POST" path="insert"> <call-query href="insertStudent"> <with-param name="Id" query-param="Id"/> <with-param name="Name" query-param="Name"/> <with-param name="State" query-param="State"/> </call-query> </resource> <resource method="POST" path="getCount"> <call-query href="getCount"/> </resource> <resource method="POST" path="select"> <call-query href="selectStudent"/> </resource> <resource method="POST" path="update"> <call-query href="UpdateState"> <with-param name="Id" query-param="Id"/> </call-query> </resource> </data>
<?xml version="1.0" encoding="UTF-8"?> <sequence name="loop_getCountAndCheck" xmlns="http://ws.apache.org/ns/synapse"> <payloadFactory media-type="xml"> <format> <dat:_postgetcount xmlns:dat="http://ws.wso2.org/dataservice"/> </format> </payloadFactory> <call> <endpoint> <http method="POST" uri-template="http://localhost:8280/services/SimpSchool/getCount"/> </endpoint> </call> <log level="custom"> <property expression="//n1:Result/n1:count" name="called get count. Remaining are:" xmlns:n1="http://ws.wso2.org/dataservice" xmlns:ns="http://org.apache.synapse/xsd"/> </log> <filter regex="0" source="//n1:count" xmlns:n1="http://ws.wso2.org/dataservice" xmlns:ns="http://org.apache.synapse/xsd"> <then> <log level="custom"> <property name="remaining are 0" value="calling done sequence"/> </log> <sequence key="loop_done"/> </then> <else> <log level="custom"> <property name="remaining are not zero" value="calling update_logic sequence"/> </log> <sequence key="loop_update_logic"/> </else> </filter> </sequence>
<?xml version="1.0" encoding="UTF-8"?> <sequence name="loop_done" xmlns="http://ws.apache.org/ns/synapse"> <log level="custom"> <property name="this is done sequence" value="Responding to client"/> </log> <payloadFactory media-type="xml"> <format> <done xmlns="">updating all</done> </format> </payloadFactory> <respond/> </sequence>
<?xml version="1.0" encoding="UTF-8"?> <sequence name="loop_update_logic" xmlns="http://ws.apache.org/ns/synapse"> <log level="custom"> <property name="this is logic sequence" value="selecting entries"/> </log> <payloadFactory media-type="xml"> <format> <dat:_postselect xmlns:dat="http://ws.wso2.org/dataservice"/> </format> </payloadFactory> <call> <endpoint> <http method="POST" uri-template="http://localhost:8280/services/SimpSchool/select"/> </endpoint> </call> <log level="custom"> <property name="data queried" value="for updating"/> </log> <payloadFactory media-type="xml"> <format> <dat:_postupdate xmlns:dat="http://ws.wso2.org/dataservice"> <dat:Id>$1</dat:Id> </dat:_postupdate> </format> <args> <arg evaluator="xml" expression="//n1:Id" literal="false" xmlns:n1="http://ws.wso2.org/dataservice" xmlns:ns="http://org.apache.synapse/xsd"/> </args> </payloadFactory> <log level="custom"> <property name="data constructed" value="for updating"/> </log> <send receive="loop_getCountAndCheck"> <endpoint> <http method="POST" uri-template="http://localhost:8280/services/SimpSchool/update"/> </endpoint> </send> </sequence>
<api xmlns="http://ws.apache.org/ns/synapse" name="UpdateInLoop" context="/loop"> <resource methods="GET"> <inSequence> <sequence key="loop_getCountAndCheck"/> </inSequence> </resource> </api>
INSERT INTO Student (Id, Name, State) values (1, 'AAAA' , 'New'), (2, 'BBBB', 'New'), (3, 'CCCC' , 'New'), (4, 'DDDD' , 'New');
curl -v http://localhost:8280/loop
[2017-08-07 16:58:52,474] [EI-Core] INFO - LogMediator called get count. Remaining are: = 4 [2017-08-07 16:58:52,474] [EI-Core] INFO - LogMediator remaining are not zero = calling update_logic sequence [2017-08-07 16:58:52,475] [EI-Core] INFO - LogMediator this is logic sequence = selecting entries [2017-08-07 16:58:52,488] [EI-Core] INFO - LogMediator data queried = for updating [2017-08-07 16:58:52,489] [EI-Core] INFO - LogMediator data constructed = for updating [2017-08-07 16:58:52,517] [EI-Core] INFO - LogMediator called get count. Remaining are: = 3 [2017-08-07 16:58:52,518] [EI-Core] INFO - LogMediator remaining are not zero = calling update_logic sequence [2017-08-07 16:58:52,518] [EI-Core] INFO - LogMediator this is logic sequence = selecting entries [2017-08-07 16:58:52,524] [EI-Core] INFO - LogMediator data queried = for updating [2017-08-07 16:58:52,524] [EI-Core] INFO - LogMediator data constructed = for updating [2017-08-07 16:58:52,553] [EI-Core] INFO - LogMediator called get count. Remaining are: = 2 [2017-08-07 16:58:52,553] [EI-Core] INFO - LogMediator remaining are not zero = calling update_logic sequence [2017-08-07 16:58:52,553] [EI-Core] INFO - LogMediator this is logic sequence = selecting entries [2017-08-07 16:58:52,559] [EI-Core] INFO - LogMediator data queried = for updating [2017-08-07 16:58:52,559] [EI-Core] INFO - LogMediator data constructed = for updating [2017-08-07 16:58:52,586] [EI-Core] INFO - LogMediator called get count. Remaining are: = 1 [2017-08-07 16:58:52,586] [EI-Core] INFO - LogMediator remaining are not zero = calling update_logic sequence [2017-08-07 16:58:52,587] [EI-Core] INFO - LogMediator this is logic sequence = selecting entries [2017-08-07 16:58:52,597] [EI-Core] INFO - LogMediator data queried = for updating [2017-08-07 16:58:52,598] [EI-Core] INFO - LogMediator data constructed = for updating [2017-08-07 16:58:52,619] [EI-Core] INFO - LogMediator called get count. Remaining are: = 0 [2017-08-07 16:58:52,620] [EI-Core] INFO - LogMediator remaining are 0 = calling done sequence [2017-08-07 16:58:52,620] [EI-Core] INFO - LogMediator this is done sequence = Responding to client