ข้ามไปที่เนื้อหาหลัก

[ ServiceMix ] File, JMS, Bean Tutorial

ServiceMix Tutorial

SM-File, SM-JMS, SM-Bean

--------------------------------------------------------------------------------------------------------
File --> JMS Msg CH --> Bean:SimpleTransformBean.java --> JMS Msg CH --> File in other place


Installation

1. download apache-servicemix-3.3.tar.gz, extract into ESB/
2. download servicemix-example-1.zip
or you can get it from here



3. Create a directory ESB/libraries, place the JAR files ant-contrib.jar, bcel.jar, jibx-bind.jar, and jibx-run.jar, in that directory.

- JiBX is a library for Java objects --> XML, XML --> Java objects
We use JiBX to transform Java Obj. to XML to send to NMR. ( NMR only accept XML )

- Spring component framework implementations MVC, DAO, and other
important patterns. We use it for configuring POJOs (SM-Beans)
using Dependency Injection (plug sys. capabilities into biz logic component).

Basic lv. of dependency, C program making sys call. Your program depends on OS.
POSIX -- make it independent on OS.

App -> Abstract API
--> subclass for UNIX
--> subclass for Windows

App talk to Abstract API, and with some XML config., we can inject subclass to correct OS.

and Inversion of Control (your component just implement callbacks containing biz/app logic)
you call sys., sys. will call u.
Only write biz logic, no need for interaction SW.

Start ServiceMix

1. Turn off multicast feature before you start ServiceMix, otherwise our ActiveMQ broker will waste time at startup trying to make remote connections to other ServiceMix in a network.

Multicast feature allows different ServiceMix instances' ActiveMQ (JMS) brokers to discover and commicate with each other.

edit conf/activemq.xml.

Change from

<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:61616" discoveryUri="multicast://default"/>
</amq:transportConnectors>
<amq:networkConnectors>
<amq:networkConnector uri="multicast://default"/>
</amq:networkConnectors>

to
<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:61616"/>
</amq:transportConnectors>
<amq:networkConnectors>
</amq:networkConnectors>


2. run ESB/apache-servicemix-3.3/bin/servicemix

Start new Project

1. Start Eclipse with ESB/Workspace as your workspace. Create Java project osesb-example1
2. Add external JARs ( Properties -> Java build path -> Libraries ) from the directory ESB/apache-servicemix-3.3/lib
  • servicemix-core-3.3.jar
  • servicemix-utils-1.0.0.jar
  • commons-logging-1.1.jar
  • org.apache.servicemix.specs.jbi-api-1.0-1.1.0.jar
and 1 external JAR from the ESB/libraries/ directory
  • jibx-run.jar
3. Create class Person.java and SimpleTransformerBean.java in the osesb.example1 package

Person.java

package osesb.example1;

public class Person {
private String customerNumber;
private String firstName;
private String lastName;
private String street;
private String city;
private String state;
private String zip;
private String phone;

// add getter and setter here.
}

SimpleTransformerBean.java
package osesb.example1;
import javax.annotation.Resource;
import javax.jbi.component.ComponentContext;
import javax.jbi.messaging.DeliveryChannel;
import javax.jbi.messaging.ExchangeStatus;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessagingException;
import javax.jbi.messaging.NormalizedMessage;
import javax.jbi.servicedesc.ServiceEndpoint;
import javax.xml.namespace.QName;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.jbi.listener.MessageExchangeListener;

import osesb.util.JiBXUtil;

// implements JBI's MessageExchangeListener interface, which allows it to receive XML messages from normalized message router.
public class SimpleTransformerBean implements MessageExchangeListener {

private static Log log = LogFactory.getLog(SimpleTransformerBean.class);

@Resource
private DeliveryChannel channel;

@Resource
private ComponentContext compContext;

public void onMessageExchange(MessageExchange exchange)
throws MessagingException {
try {
if (exchange.getStatus() != ExchangeStatus.ACTIVE)
return;
// When receiveing message, unmarshals XML message text using JiBX.
// assuming it represents a Person object
// receive "in-only" message ( because JMS Channel that connect to SM-bean:SimpleTransformBean.java is unidirectional )
Person person = (Person) JiBXUtil.unmarshalDocument(exchange.getMessage("in").getContent(), Person.class);
log.info("received person " + person.getFirstName() + " " + person.getLastName());
// makes a simple change to the object, change Firstname to John.
person.setFirstName("John");
exchange.setStatus(ExchangeStatus.DONE);
channel.send(exchange);

ServiceEndpoint targetEndpoint = compContext.getEndpoint(new QName(
"http://osesb/example1/", "JMSProviderService"),
"outQueueWriter");
MessageExchange exch = channel.createExchangeFactory(targetEndpoint)
.createInOnlyExchange();
NormalizedMessage normalizedMsg = exch.createMessage();
// Uses JiBX to marshal the modified Person object back to XML
normalizedMsg.setContent(JiBXUtil.marshalDocument(person, "UTF-8"));
// create simple String and set as "in-only" message.
exch.setMessage(normalizedMsg, "in");
// sends a message to the second JMS producer's service endpoint.
channel.send(exch);
} catch (Exception e) {
log.error("JBI bean exception", e);
throw new MessagingException("Error transforming object to or from XML");
}
}
}

JiBXUtil.java in package osesb.util
package osesb.util;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.jibx.runtime.BindingDirectory;
import org.jibx.runtime.IMarshallingContext;
import org.jibx.runtime.IUnmarshallingContext;
import org.jibx.runtime.JiBXException;
import org.w3c.dom.Node;

public class JiBXUtil {
public static Object unmarshalDocument(Node node, Class targetClass) throws JiBXException {
return unmarshalDocument(new DOMSource(node), targetClass);
}

public static Object unmarshalDocument(Source source, Class targetClass) throws JiBXException {
Object result = null;
try {
IUnmarshallingContext ctx = BindingDirectory.getFactory(
targetClass).createUnmarshallingContext();
result = ctx.unmarshalDocument(new StringReader(toString(source)));
} catch (Exception e) {
throw new JiBXException("Error unmarshalling XML to Object", e);
}
return result;
}

public static Source marshalDocument(Object src, String encoding)
throws JiBXException {
Source result = null;
try {
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
IMarshallingContext ctx = BindingDirectory.getFactory(src.getClass())
.createMarshallingContext();
ctx.marshalDocument(src, "UTF-8", null, bOut);
result = new StreamSource(new ByteArrayInputStream(bOut.toByteArray()));
} catch (Exception e) {
throw new JiBXException("Error marshalling XML to Object",e);
}
return result;
}

private static String toString(Source source) throws TransformerException {
TransformerFactory tf = TransformerFactory.newInstance();
StringWriter sw = new StringWriter();
Transformer trans = tf.newTransformer();
trans.transform(source, new StreamResult(sw));
String result = sw.toString();
System.out.println("result " + result);
return result;
}
}
4. Create a new folder resources/ at the project's top level
copy all of the XML configuration files and the directories file/, jms/, and bean/ there.

file/xbean.xml
<beans xmlns="http://xbean.org/schemas/spring/1.0"
xmlns:file="http://servicemix.apache.org/file/1.0"
xmlns:esb="http://osesb/example1/">

<!-- dumps any messages it gets to the directory "example1/out"-->
<file:sender service="esb:fileSender"
endpoint="simpleFromJMSSender"
directory="example1/out">
<!-- after deploy it will create directory /media/disk/AIT/SoftwareArchitecture/ESB/apache-servicemix-3.3/example1/out -->
</file:sender>

<!-- If new file appears in directory, do something -->
<!-- specifies a file system poller that watches
the directory "example1/in/" for new files and forwards them to a JMS service endpoint.-->
<file:poller service="esb:filePoller"
endpoint="simpleToJMSPoller"
targetService="esb:JMSProviderService"
targetEndpoint="inQueueWriter"
file="example1/in"
period="2000">
<!-- after deploy it will create directory /media/disk/AIT/SoftwareArchitecture/ESB/apache-servicemix-3.3/example1/in -->
</file:poller>
</beans>
jms/xbean.xml
<beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
xmlns:esb="http://osesb/example1/">
<!-- 1st consumer registers for messages on "inQueue" and forwards to our ServiceMix custom Bean.-->
<jms:consumer service="esb:JMSConsumerService"
endpoint="inQueueReader"
targetService="esb:beanService"
targetEndpoint="endpoint"
destinationName="inQueue"
connectionFactory="#connectionFactory" />
<!-- 2nd consumer registers for messages on "outQueue" and forwards to the File sender's service endpoint. -->
<jms:consumer service="esb:JMSConsumerService"
endpoint="outQueueReader"
targetService="esb:fileSender"
targetEndpoint="simpleFromJMSSender"
destinationName="outQueue"
connectionFactory="#connectionFactory"/>
<!-- 1st producer receives incoming files from the File system poller and adds them to the JMS queue "inQueue" -->
<jms:provider service="esb:JMSProviderService"
endpoint="inQueueWriter"
destinationName="inQueue"
connectionFactory="#connectionFactory" />
<!-- 2nd producer receives the output from the custom Bean and adds it to the JMS queue "outQueue" -->
<jms:provider service="esb:JMSProviderService"
endpoint="outQueueWriter"
destinationName="outQueue"
connectionFactory="#connectionFactory" />

<bean id="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
</bean>
</beans>
bean/xbean.xml
<beans xmlns:bean="http://servicemix.apache.org/bean/1.0"
xmlns:esb="http://osesb/example1/">

<classpath>
<location>.</location>
<location>jibx-run.jar</location>
</classpath>

<!--
<location>.</location>
<location>bcel.jar</location>
<location>jibx-bind.jar</location>
<location>jibx-extras.jar</location>
<location>jibx-run.jar</location>
<location>qdox-1.6.1.jar</location>
<location>stax-api.jar</location>
<location>wstx-asl.jar</location>
<location>xmlpull_1_1_4.jar</location>
<location>xpp3.jar</location>
</classpath>-->

<bean:endpoint service="esb:beanService"
endpoint="endpoint"
bean="#SimpleTransformer"/>

<bean id="SimpleTransformer"
class="osesb.example1.SimpleTransformerBean"/>
</beans>


5. Tell Eclipse to show the ant view ( Properties > Builder > new .. ) and drag example1-build.xml from the project explorer to the ant view. You should get a list of the ant tasks defined in the file.

we can double click at "deploy" to run ant script.
It will copy to zip file and build jar file.

You can see result either on eclipse or in a serviceMix console in a command line as well.

This could fail if you have different version of jar file, or a resource location in example1-build.xml is not in a right place.

example1-build.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- This ant build file is based on the example in Chapter 3 of Open Source ESBs in Action -->
<project name="ServiceMix Example 1" basedir="." default="deploy" xmlns:c="urn:contrib-ant">

<property name="classes" value="../bin" />
<property name="libraries" value="../../../libraries" />
<property name="work" location="../work" />
<property name="src" value="../src" />
<property name="src-generated" value="../src-generated" />
<property name="servicemix.home" value="../../../apache-servicemix-3.3" />

<!-- ant-contrib tasks are needed by the servicemix assembly and deployment tasks -->
<taskdef resource="net/sf/antcontrib/antlib.xml" uri="urn:contrib-ant">
<classpath>
<pathelement location="${libraries}/ant-contrib.jar" />
</classpath>
</taskdef>

<!-- JiBX binding compiler task definition -->
<taskdef name="bind" classname="org.jibx.binding.ant.CompileTask">
<classpath>
<pathelement location="${libraries}/jibx-bind.jar" />
</classpath>
</taskdef>

<!-- Test target for JiBX compilation -->
<target name="jibx-compile">
<!-- verbose="true" to show error -->
<bind verbose="true" load="true" binding="mapping.xml">
<classpath>
<pathelement path="${classes}" />
<pathelement location="${libraries}/jibx-run.jar" />
</classpath>
</bind>
</target>

<!-- Compile, create the service units, assemble them into a SA, and deploy -->
<target name="deploy">

<!-- Create the file service unit -->
<antcall target="create-serviceunit">
<param name="service-dest-file" value="example1-file-su.zip" />
<param name="servicemix-conf" value="file/" />
</antcall>

<!-- Create the JMS service unit -->
<antcall target="create-serviceunit">
<param name="service-dest-file" value="example1-jms-su.zip" />
<param name="servicemix-conf" value="jms/" />
</antcall>

<!-- Create the Spring bean service unit -->
<antcall target="create-serviceunit">
<param name="service-dest-file" value="example1-bean-su.zip" />
<param name="servicemix-conf" value="bean/" />
<param name="include-resource-dir" value="bean/resources/" />
<param name="include-classes" value="osesb/example1/**/*"/>
<param name="jibx-mapping" value="mapping.xml"/>
</antcall>

<!-- Assemble and deploy to the JBI container -->
<echo message="Create and deploy the service assembly" />
<antcall target="create-and-deploy-serviceassembly-from-serviceunits">
<param name="jbi-conf" value="." />
<param name="sm-dest-file" value="example1-sa.zip" />
<param name="service-units" value="example1-*-su.zip" />
</antcall>
</target>

<!--
Call this target with the following properties to create a serviceunit

service-dest-file: name of the service zip (must be equal to name in jbi.xml
servicemix-conf: location where the servicemix.xml or xbean file can be found
include-classes: class filter to include in the service file
resources: resources to include
-->

<target name="create-serviceunit">
<!-- some general cleanup of old files and create new directories -->
<echo message="Preparing service unit creation" />
<delete failonerror="false" file="${work}/${service-dest-file}" />
<delete failonerror="false" dir="${work}/${service-dest-file}.work" />
<mkdir dir="${work}/${service-dest-file}.work" />
<mkdir dir="${work}/${service-dest-file}.work/META-INF" />

<!--do we have a resource directory -->
<c:if>
<isset property="include-resource-dir" />
<c:then>
<echo message="Resource directory specified, including in serviceunit" />
<copy todir="${work}/${service-dest-file}.work">
<fileset dir="${include-resource-dir}">
<include name="**/*" />
</fileset>
</copy>
</c:then>
<c:else>
<echo message="No resource directory specified" />
</c:else>
</c:if>

<!--do we have a classes to copy directory -->
<c:if>
<isset property="include-classes" />
<c:then>
<echo message="Including classes into Service unit" />
<c:if>
<isset property="include-classes-archive" />
<c:then>
<echo message="compiling classes" />
<javac srcdir="${src}" destdir="${classes}">
<include name="${include-classes}" />
<include name="esb/util/framework/*" />
<classpath refid="compile.path" />
</javac>

<echo message="archiving classes to ${include-classes-archive}" />
<jar destfile="${work}/${service-dest-file}.work/${include-classes-archive}">
<fileset dir="${classes}">
<include name="${include-classes}" />
<include name="esb/util/framework/*" />
</fileset>
</jar>
</c:then>
<c:else>
<echo message="compiling classes from ${include-classes}" />
<javac srcdir="${src}" destdir="${classes}">
<include name="${include-classes}" />
<include name="esb/util/framework/*" />
<classpath refid="compile.path" />
</javac>
<copy todir="${work}/${service-dest-file}.work">
<fileset dir="${classes}">
<include name="${include-classes}" />
<include name="osesb/util/*" />
</fileset>
<fileset dir="${src}">
<include name="${include-classes}"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</c:else>
</c:if>
</c:then>
<c:else>
<echo message="No classes need to be included" />
</c:else>
</c:if>

<c:if>
<isset property="jibx-mapping" />
<c:then>
<!-- Run JiBX binding compiler -->
<bind verbose="false" load="true" binding="${jibx-mapping}">
<classpath>
<pathelement path="${classes}" />
</classpath>
</bind>
<copy todir="${work}/${service-dest-file}.work" overwrite="true">
<fileset dir="${classes}">
<include name="${include-classes}" />
</fileset>
</copy>
</c:then>
</c:if>
<c:if>
<isset property="jibx-mapping1" />
<c:then>
<bind verbose="false" load="true">
<classpath>
<pathelement path="${classes}" />
<pathelement location="${libraries}/jibx-run.jar" />
</classpath>
<bindingfileset dir="${jibx-directory}">
<include name="${jibx-mapping1}" />
<include name="${jibx-mapping2}" />
<include name="${jibx-mapping3}" />
</bindingfileset>
</bind>
<copy todir="${work}/${service-dest-file}.work" overwrite="true">
<fileset dir="${classes}">
<include name="${include-classes}" />
</fileset>
</copy>
</c:then>
</c:if>
<c:if>
<isset property="generated-classes-filter" />
<c:then>
<echo message="compiling classes from ${generated-classes-filter}" />
<javac srcdir="${src-generated}" destdir="${classes}">
<include name="${generated-classes-filter}" />
<include name="osesb/util/*" />
<classpath refid="compile.path" />
</javac>
<copy todir="${work}/${service-dest-file}.work">
<fileset dir="${classes}">
<include name="${generated-classes-filter}" />
<include name="osesb/util/*" />
</fileset>
</copy>
</c:then>
<c:else>
<echo message="No generated classes need to be included" />
</c:else>
</c:if>

<c:if>
<isset property="servicemix-conf" />
<c:then>
<echo message="Try to copy servicemix specific files, warnings can be ignored" />
<copy todir="${work}/${service-dest-file}.work" file="${servicemix-conf}/servicemix.xml" failonerror="false" />
<copy todir="${work}/${service-dest-file}.work" file="${servicemix-conf}/xbean.xml" failonerror="false" />
</c:then>
</c:if>

<c:if>
<isset property="jbi-conf" />
<c:then>
<echo message="Try to copy JBI specific files, warnings can be ignored" />
<copy todir="${work}/${service-dest-file}.work/META-INF" file="${jbi-conf}" failonerror="false" />
</c:then>
</c:if>

<jar destfile="${work}/${service-dest-file}">
<fileset dir="${work}/${service-dest-file}.work" />
</jar>
</target>

<target name="create-and-deploy-serviceassembly-from-serviceunits">
<delete failonerror="false" file="${work}/${sm-dest-file}" />
<mkdir dir="${work}/META-INF" />
<copy file="${jbi-conf}/jbi.xml" tofile="${work}/META-INF/jbi.xml" overwrite="true" />
<jar destfile="${work}/${sm-dest-file}">
<fileset dir="${work}">
<include name="META-INF/**" />
<include name="${service-units}" />
</fileset>
</jar>
<copy file="${work}/${sm-dest-file}" tofile="${servicemix.home}/hotdeploy/${sm-dest-file}" overwrite="true" />
</target>

</project>

6. Bind how the fields of a Person object are related to XML elements.
The specification is compiled into Java code that implements the marshaling and unmarshaling transformations used in the bean component.

mapping.xml
<binding>
<mapping name="person" class="osesb.example1.Person"> <!-- map person.xml in classpath into Person class -->
<value name="customer-number" field="customerNumber" />
<value name="first-name" field="firstName" />
<value name="last-name" field="lastName" />
<value name="street" field="street" />
<value name="city" field="city" />
<value name="state" field="state" />
<value name="zip" field="zip" />
<value name="phone" field="phone" />
</mapping>
</binding>


7. Assembled 3 services unit into a ServiceMix service assembly by specify specification in jbi.xml configuration file. Finally, the complete archive is copied to ServiceMix's hotdeploy/ directory, where you should be able to see in the ServiceMix console the unpacking and registering of service units.

jbi.xml
<?xml version="1.0" encoding="UTF-8"?>
<jbi xmlns="http://java.sun.com/xml/ns/jbi" version="1.0">
<service-assembly>
<identification>
<name>Example1-JMSBindingService</name>
<description>
Example showing the jms binding component
</description>
</identification>
<service-unit>
<identification>
<name>SU-BEAN</name>
<description>
The bean component
</description>
</identification>
<target>
<artifacts-zip>example1-bean-su.zip</artifacts-zip>
<component-name>servicemix-bean</component-name>
</target>
</service-unit>
<service-unit>
<identification>
<name>SU-JMS-Queue</name>
<description>
A number of ftp pollers and senders
</description>
</identification>
<target>
<artifacts-zip>example1-jms-su.zip</artifacts-zip>
<component-name>servicemix-jms</component-name>
</target>
</service-unit>
<service-unit>
<identification>
<name>SU-JMS-File</name>
<description>
A number of file pollers and senders files
</description>
</identification>
<target>
<artifacts-zip>example1-file-su.zip</artifacts-zip>
<component-name>servicemix-file</component-name>
</target>
</service-unit>
</service-assembly>
</jbi>


8. Finally! To test our service, copy person.xml to ESB/apache-servicemix-3.3/example1/in, watch the log, and see if your transformed person is properly deposited in ESB/apache-servicemix-3.3/example1/in.

<person>
<customer-number>123</customer-number>
<first-name>James</first-name>
<last-name>Doe</last-name>
<street>1st Street</street>
<city>New York</city>
<state>NY</state>
<zip>567898</zip>
<phone>1768768768</phone>
</person>


ref : mdailey

ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

วิธีการไป อย. กระทรวงสาธารณสุขจากหัวลำโพง

ทางไป : รถไฟฟ้า MRT หัวลำโพง ไปลงที่ สถานี กระทรวงสาธารณสุข  ถ้ากดที่ตู้ต้องเปลี่ยนไปหน้าจอสายสีม่วง สนน ราคา 48 53 บาท ต่อมอไซด์ ถ้าไป อย. 20 บาท จากหน้าทางเข้า  ถ้าฝนตกแนะนำให้โบกแท็กซี่จากข้างหน้า ข้างในหาแท็กซี่ยากมาก ถ้าจะเดินประมาณ 2.4 km ให้ระวังหลงเข้าไปรพ ศรีธัญญา รพ ศรีธัญญาพื้นที่ข้างในใหญ่มาก และเหมือนจะล้อมด้วยคลอง เหมือนจะมีทางออกแค่ทางที่เข้าไปนั่นแหละ ทางกลับ : รถเมล์ 97 จาก อย. ตรงข้ามประกันสังคม ทางที่ 1 : ถ้าจะใกล้ลงหน้าปากซอยขึ้นสายสีม่วงที่สถานีกระทรวงสาธารณสุขที่เดิม ทางที่ 2 : ผ่าน ท่าน้ำนนท์​ กลับเรือได้ ทางที่ 3 : ผ่านหน้าพระจอมพระนครเหนือด้วยนะ ผ่าน สถานีรถไฟฟ้า MRT บางซื่อ  ( จาก อย. ไป MRT บางซื่อ 17 บาท,  จาก MRT บางซื่อ ไป MRT หัวลำโพง 44 บาท นั่งกลับได้ 2 ทาง ทางหัวลำโพง กับ ไปเปลี่ยนที่ท่าพระ ไม่รู้ว่าทางไหนเร็วกว่ากัน ) ทางที่ 4 :  ผ่าน สะพานควาย  ทางที่ 5 :  นั่งถึงอนุสาวรีย์ชัยสมรภูมิได้ ค่ารถเมล์ 21 บาท ค่ารถไฟฟ้าไป BTS สะพานตากสิน 47 บาท 

แจก คัมภีร์ ไบเบิล ภาษาไทย รวมเล่ม ( download thai bible pdf version )

แปลกใจว่า ทำไม ไม่มี ebook พระคัมภีร์ ที่สามารถ print อ่านได้เลย เลยเอา พระคัมภีร์ภาษาไทย ฉบับ KJV ( Thai Bible King James Version ) มาเย็บรวมเล่ม สร้างไว้เฉพาะ พันธสัญญาเดิม ( Old Testament ) ดาวน์โหลดได้จาก Thai Bible ย้ายแล้วจ้า ย้ายมา อันนี้ จะยัดลง iPhone หรือ iPod Touch ก็ได้ เพราะว่า มันอ่าน pdf ได้อยู่แล้ว จาก iBook ง่าย และ ฟรี ไม่ต้อง crack โปรแกรมให้ผิดศีล ถ้าไม่ชอบรูปแบบยังไง checkout มาแล้ว compile latex เองได้เลย จัดรูปแบบสวยงามแล้ว commit กลับมา จักเป็นพระคุณยิ่ง NOTE: ถ้าท่านต้องการสนับสนุนเรา ท่านสามารถดาวน์โหลด App ของเราได้ทางมือถือ Android ที่ App Words of God เนื้อหาจะเป็นเนื้อหาเดียวกันกับที่แจกฟรีนี้  ซึ่งใน App ท่านสามารถศึกษาพระคัมภีร์ได้แบบ Offline ซึ่งสามารถใช้งานได้โดยไม่ต้องต่ออินเตอร์เน็ต ท่านสามารถพกไปที่ไหนก็ได้ นอกจากนี้ ใน App ท่านสามารถ Search เพื่อค้นหาพระคัมภีร์ได้ และ ใน App เราไม่ได้เก็บข้อมูลใดๆ ของท่าน (เช่น การติดตามว่าท่านอ่านหน้าไหน, การติดตามว่าท่านค้นหาอะไร)  เดิมทีเราเองทำไว้ให้ทุกท่านสามารถเข้าถึงได้ฟรีทางเว็ปไซท์  ที่นี

วิธีใช้ ubuntu ต่อ อินเทอร์เน็ตทรู ( true ) โดยโมเด็ม billion bipac 7000 usb adsl modem

ก็อปไฟล์ cxacru-fw.bin ไปที่ /lib/firmware ไฟล์ cxacru-fw.bin download ได้ที่นี่ ก็อปไฟล์ br2684ctl ไปที่ /usr/sbin ไฟล์ br2684ctl download ได้ที่นี่ $ sudo pppoeconf nextๆ ไปเรื่อยๆ ใส่ username, password ของทรู ตามปกติ แล้วเขียนไฟล์ดังนี้ true.sh #!/bin/sh modprobe cxacru modprobe br2684 sudo /usr/sbin/br2684ctl -b -c 0 -a 0.100 # Communicating over ATM 0.0.100, encapsulation: LLC sudo ifconfig nas0 up pon dsl-provider # Plugin rp-pppoe.so loaded เสร็จแล้วสั่ง รัน shell script $ . ./true.sh คราวต่อไปรัน . ./true.sh อย่างเดียวก็ได้แล้วๆ reference : siamgeek บทความอื่นๆเกี่ยวกับ ubuntu

สอบสัมภาษณ์ MBA คำถามและการเตรียมตัว

 * “แนะนำตนเอง” การแนะนำตนเองไม่ใช่แค่บอกชื่อ-นามสกุล ตำแหน่งงาน สถานที่ทำงาน หรือ ประวัติการศึกษาเท่านั้น ข้อมูลเหล่านี้ต้องพูดถึง แต่ไม่ใช่ประเด็นสำคัญ ส่วนที่สำคัญในการแนะนำตนเองก็คือต้องขายความเป็นตัวตนของเรา ความสามารถของเรา และ/หรือวัตถุประสงค์ในการเลือกเรียนหลักสูตรนี้  พยายามตอบคำถามให้สอดคล้องกับ MBA ไม่ต้องนาน ประมาณ 2–3 นาที เน้นเนื้อ ไม่เน้นน้ำ ซ้อมพูดเยอะๆ ถือว่าเป็น First Impression * ทำไมจึงเลือกสมัครเข้าเรียนหลักสูตรนี้  ทำไมถึงมาเรียน MBA ทำไมอยากเรียน MBA ทำไม อยากเรียนตอนนี้  * ทำไม ต้องเรียน MBA ที่นี่ -- ลองศึกษา Program ของมหาลัยที่จะไปดูน้าว่ามหาลัยมีอะไรเด่น * คิดว่าถ้าเรียน MBA จะมี Challenge อะไรบ้าง * สนใจโปรแกรมอะไรบ้าง * หลังเรียนจบอยากทำอะไร * ต้องการอะไรจากหลักสูตรนี้  เรียนแล้วคิดว่าจะได้อะไร เอาไปใช้อะไรในชีวิต * ทำไมไม่เรียนสาขาอื่น ถ้าอายุงานถึงเรียนอย่างอื่นได้ * ในองค์กรที่ทำงานอยู่สามารถเติบโตได้ถึงตำแหน่งไหน * Performance ปัจจุบันเป้นยังไง  * ดูดีอยู่แล้ว แล้วมาเรียน MBA ทำไม เพราะงานที่ทำอยู่ก็มีโกาสก้าวหน้าในสายอาชีพบริหารอยู่แล้ว * ไม่ได้เรียนม

เทคนิคคิดเลขเร็วโดยใช้ วิธีคิด แบบ เวทคณิต ( Vedic Mathematics example )

จากที่สงสัยเรื่อง ลูกคิด ของ จินตคณิต ที่ลองไปค้นดู ปรากฎว่า เจอ เวทคณิต ซึ่งเขาบอกว่า อยู่ในคัมภีร์พระเวท ลองอ่านดูแล้ว รู้สึกว่าฝึกสมอง ก็ทำให้คิดเลขเร็วดี เลยสรุปมาให้ ตามนี้ Tutorial 1 การลบเลข ALL FROM 9 AND THE LAST FROM 10 ทุกตัวลบจาก 9 และตัวสุดท้ายลบจาก 10 เช่น 1000 - 357 = 643 10,000 - 1,049 = 8951 ถ้า 1,000 - 83 ให้มองว่ามี 0 อยู่ข้างหน้า เป็น 1,000 - 083 = 917 ฝึกบ่อยๆ ก็คล่อง แล้วก็ไม่ต้องใช้เครื่องคิดเลขด้วย ลองทำดูสิ 1) 1000 - 777 = 2) 1000 - 283 = 3) 1000 - 505 = 4) 10,000 - 2345 = 5) 10,000 - 9876 = 6) 10,000 - 1011 = 7) 100 - 57 = 8) 1000 - 57 = 9) 10,000 - 321 = 10) 10,000 - 38 = 3,000 - 467 ก็ทำเหมือนกัน โดยลบตัวแรกสุดของ 3,000 ไป 1 จากนั้นก็ทำเหมือนเดิม จะได้ว่า 3,000 - 467 = 2,533 Tutorial 2 VERTICALLY AND CROSSWISE สำหรับตัวเลขที่น้อยกว่าฐานนิดหน่อย ลอง 88x98 88 น้อยกว่า 100 อยู่ 12 98 น้อยกว่า 100 อยู่ 2 12x2 = 24 88-2 หรือ 98-12 ได้ 86 ดังนั้นตอบ 8,624 ดูอีกตัวอย่าง หรือ ลองทำนี่ดู 1) 87 x 98 = 2) 88 x

เลขฐานสอง ติดลบ เรื่องที่อาจจะลืมกันไปแล้ว

คอมพิวเตอร์ใช้การเปิดปิด หลอดสุญญากาศ ดังนั้นค่าที่เป็นไปได้คือ 0 กับ 1 ไม่มีติดลบ จึงกำหนดให้ใช้ 2's complement มากำหนดเลขลบ วิธีทำคือ เปลี่ยนเลข 1 เป็น 0 เปลี่ยนเลข 0 เป็น 1 แล้ว บวกหนึ่ง เช่น 1 คือ 00000001 เปลี่ยนเป็น 11111110 บวก 1 ได้ 11111111 บิตที่อยู่หน้าสุดจะบอกว่าเป็นเลขบวกหรือลบ ( 0 = +, 1 = -) พิสูจน์ จาก สมการคณิตศาสตร์​ 1 + (-1) = 0 00000001 + ???????? = 0 00000001 + (11111110 + 000000001 ) = 0 นั่นเอง วิธีที่ง่ายกว่านั้นในการทำ 2's complement คือ 1. หา 1 ตัวสุดท้าย 010100 1 2. invert ตัวหน้า 1 ทั้งหมด 101011 1 สำหรับคนที่ลืมไปแล้ว 1's complement คือเปลี่ยนเลข 1 เป็น 0 เปลี่ยนเลข 0 เป็น 1 ตามปกติ เช่น ~1 1 = 00000001 ~1 = 11111110 ซึ่งมีค่าเท่ากับ -2 ที่มา : วิชาการดอทคอม , wikipedia

แนะนำ ยาบำรุงครรภ์ จับซาไท้เป้า หรือ 13 องครักษ์พิทักษ์ครรภ์ ยาจีน บำรุงครรภ์

จับซาไท้เป้า  ยาบำรุงครรภ์ สมุนไพรจีน ช่วงนี้เพื่อนๆ เริ่ม ทยอย แต่งงาน กันแล้ว นะครับ เราเองก็มียาจีนมา นำเสนอ ซึ่งเป็น ยาดี ที่คุณแม่ ของเรา ทาน ตอนคลอดเรา นั่นก็คือ "จับซาไท้เป้า" ยาบำรุงครรภ์ นั่นเอง เงง เงง เงง เงง จับซาไท้เป้า เป็น ยาจีน ซึ่ง ประกอบไปด้วย สมุนไพร จีน 13 อย่างด้วยกัน มี สรรพคุณ เป็น ยาบำรุงครรภ์ บำรุง ทั้งคุณแม่ และ คุณลูก เลย เรียกได้ว่า สรรพคุณ ครบครัน บำรุง คุณแม่ ช่วงตั้งท้อง ช่วยให้ คุณลูก แข็งแรง มีผิวพรรณ สะอาดสะอ้าน ในตอนที่คลอดออกมา จะ คลอดง่าย ตัวจะไม่มีคราบไขมันติดเยอะ จ้า วิธีกินจับซาไท้เป้า ทานตั้งแต่ท้อง 5 เดือนขึ้นไป 2 อาทิตย์ทาน 1 ห่อ ทานจนคลอด ศิริรวมแล้ว ถ้าทาน ครบ dose โดยเริ่มตั้งแต่ 5 เดือน ต้องทานทั้งหมด 10 ห่อ จ้ะ วิธีต้มจับซาไท้เป้า  1 ห่อ ต้มได้ 2 ครั้ง ครั้งแรก ใส่น้ำ 3 ถ้วย ต้มเหลือ 8/10 ถ้วย ครั้งที่ 2 ใส่น้ำ 2.5 ถ้วย ต้มเหลือ 7/10 ถ้วย ซื้อที่ไหนดี หลายๆ คน มักจะมีคำถาม ว่า จับซาไท้เป้า ซื้อที่ไหน  ซึ่งเราเอง แนะนำร้านขาย จับซาไท้เป้า ซึ่งก็คือ ร้าน ขายยา ย่ง เชียง ตึ๊ง ซึ่ง

[ Netflix ] สาธุ รีวิวแบบไม่สปอยส์

ตัวละคร เดียร์ ตอนแรกก็ไม่ค่อยชอบ จากคาแรกเตอร์บางอย่าง ถ้าเลาเป็นพระปั๊บก็คงแวปขึ้นมาหลายซีนว่าเป็นลุงอ่ำใส่วิก แต่ดูๆ ไปกลับเป็นชอบ จากคาแรกเตอร์วัยรุ่นสร้างตัว ทำโน่นทำนี่ได้เองซะงั้น พระเทศน์จริงๆ ควรเทศน์อย่างพระดล เพราะเนื้อหาในพระพุทธศาสนาก็น่าสนใจในตัวเองอยู่แล้ว #เราเอง เคยฟังพระพุทธทาสภิกขุ เทศน์เรื่องแก่นแท้ของพระพุทธศาสนาที่สรุปให้ฟังสั้นๆมาก่อนแล้ว รู้สึกว่ามีพลัง   ใครยังไม่เคยดู ดูได้ ที่ ลิงก์นี้  เริ่มวิที่ 1:02 นะเผื่อวัยรุ่นใจร้อน อย่างพระสายตลกโปกฮานี่ ถ้ามีก็ควรมีนิดหน่อย ถ้าเพลาๆไปได้น่าจะดีกว่าเยอะ ทำไมรู้สึกว่าหนังจบได้ในตัวมันเองอยู่แล้ว แต่มีคนบอกว่ายังค้างๆคาๆ  ถ้าจะสร้างภาคสองก็คงได้แหละ พวกมารศาสนาในหนัง พอดูแล้วนึกถึงคลิปที่ทำไว้เล่นๆ ด้านล่าง @dsin.12 ธรรมะชนะอธรรม Dhamma conquers evil #buddha #animation #fight #evil #horror #mystery #life #bkk #bangkok #drama #fire #conquer ♬ original sound - Phong Eakamongul

[ Netflix ] ปรสิตเดอะเกรย์

  ดูไปตอนแรกก็ฝันร้ายซะแล้ว แต่ดันไปฝันว่า ทำสอบวิชาไฟแนนซ์อยู่แล้วตามเพื่อนในห้องออกมาข้างนอก พอนึกขึ้นได้ว่าต้องกลับไปทำ เห็นคำถามในข้อสอบแล้วดันทำไม่ได้ อะไรกัน! จริงๆ เรื่อง Parasite ดูมาตั้งแต่สมัยการ์ตูน เสียงมิกิที่เป็นมือนี่ก็น่ารักดี เพลงเพราะมาก ชอบๆ พอเกาหลีเอาไป remake  Soft Power เกาหลีเลยเอาไปเขียนว่า เกาหลี มีเทคโนโลยีไว้ต่อกรกับพวกปรสิตเป็นประเทศแรกซะงั้น