锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
BTW錛孧ySql鏈榪戝熺潃Web2.0鐨勬氮娼澶村緢鍔插晩錛宼echn orati錛堝ソ鍍忚繖鍑犲ぉ琚獹FW filter浜?jiǎn)锛?jí)錛宖lickr錛宒el.icio.us絳変竴鎵圭綉绔欓兘鏄敤浜?jiǎn)MySql銆侻ySql榪樹(shù)笓闂ㄥ湪棣栭〉寮浜?jiǎn)涓澶у潡鏉ョ偒鑰銆?img src ="http://www.tkk7.com/sakis/aggbug/58242.html" width = "1" height = "1" />
#1 Transaction Propagation Behavior
Required:Excute within a current tx, create a new one if none exists.
Supports: Excute within a current tx, execute without a tx if none exsits.
Mandatory: Excute within a current tx, throw an exception if none exists.
Requires New: Create a new tx and excute within the tx, suspend the current tx if one exists.
Not Supported: Excute without a tx, suspend the current tx if none exsits.
Never: Excute without a tx, throw an exception if a tx exsits.
#2 Transaction Isolation Level[1]
#2.1 Concurrent Problem
Dirty Reads: 鑴忚錛堣剰鏁版嵁鎸囧凡鏇存柊錛岃繕娌℃彁浜ょ殑鏁版嵁錛夈備簨鍔1璇誨彇鍒頒簨鍔2涓殑鑴忔暟鎹?/FONT>
Unrepeatable Reads: 涓嶅彲閲嶅璇匯備簨鍔1媯(gè)绱㈠埌鏌愯鍚庯紝浜嬪姟T2鏇存柊騫舵彁浜や簡(jiǎn)璇ヨ錛岃嫢浜嬪姟T2鍐嶆媯(gè)绱㈣琛岋紝鍒欎細(xì)鐪嬪埌涓嶄竴鏍風(fēng)殑緇撴灉銆?/FONT>
Phantom Reads: 铏氳銆備簨鍔1媯(gè)绱㈠埌絎﹀悎鏌愭潯浠剁殑琛岄泦鍚庯紝浜嬪姟T2鎻掑叆騫舵彁浜や簡(jiǎn)婊¤凍璇ユ潯浠剁殑鏂拌錛岃嫢浜嬪姟T2鍐嶆鎸夎鏉′歡媯(gè)绱紝鍒欎細(xì)鐪嬪埌浠ュ墠涓嶅瓨鍦ㄧ殑琛屸淧hantom鈥濄?/FONT>
#2.2 Isolation Level
+---------------+-------+------------------+-----------+
|Isolation Level|Phantom|Unrepeatable Reads|Dirty Reads|
+---------------+-------+------------------+-----------+
|Read Uncommited| Y | Y | Y |
+---------------+-------+------------------+-----------+
|Read Commited | Y | Y | N |
+---------------+-------+------------------+-----------+
|Repeatable Read| Y | N | N |
+---------------+-------+------------------+-----------+
|Serializable | N | N | N |
+---------------+-------+------------------+-----------+
#3 Timeout
#4 ReadOnly Transaction
鍙浜嬪姟淇濊瘉浜?jiǎn)澶氭潯鏌ヨSQL鐨勫湪浜嬪姟綰у埆鐨勮涓鑷存с侸DBC鍜屾暟鎹簱浼?xì)瀵瑰彧璇讳簨鍔″仛涓浜涗紭鍖栥?/FONT>
[1] C.J.Date, An Introduction to Database Systems 7th.
#0
MXML浼樼偣錛氫嬌鐢ㄦ柟渚匡紝XML浠g爜綆媧佹槗鎳?BR>緙虹偣錛氫簨浠躲佸嚱鏁般佺晫闈㈡弿娣峰湪涓璧楓傜▼搴忚妯″ぇ浜?jiǎn)闅句簬寮鍙戠淮鎶ゃ?/FONT>
#1
Cairngorm妗嗘灦鏄痠terationtwo鎺ㄥ嚭鐨勫彿縐板熀浜嶫EE Best Practice鐨凢lex紼嬪簭寮鍙戠殑light-weight framework銆?鎭?light-weight榪欎釜璇嶈繕鐪熸槸嫻佽鍛?銆傜洰鍓嶆渶鏂扮増鏈負(fù)0.99銆?/FONT>
Cairngorm鐨勭粨鏋勫涓嬶細(xì)
org
鈹斺攢nevis
鈹斺攢cairngorm
鈹溾攢application
鈹?nbsp; CairngormApplication.as
鈹?BR> 鈹溾攢business
鈹?nbsp; Responder.as
鈹?nbsp; ServiceLocator.as
鈹?BR> 鈹溾攢commands
鈹?nbsp; Command.as
鈹?nbsp; SequenceCommand.as
鈹?BR> 鈹溾攢control
鈹?nbsp; Event.as
鈹?nbsp; EventBroadcaster.as
鈹?nbsp; FrontController.as
鈹?BR> 鈹溾攢model
鈹?nbsp; ModelLocator.as
鈹?BR> 鈹溾攢view
鈹?nbsp; ViewHelper.as
鈹?nbsp; ViewLocator.as
鈹?BR> 鈹斺攢vo
ValueObject.as
#2
涓嬮潰緇欏ぇ瀹剁畝鍗曚粙緇岰airngorm鐨勫疄鐜版濊礬銆?/FONT>
#2.1
Command/FrontController灝咵vent涓嶸iwe鍒嗙銆?BR>FrontController瀹炵幇Singleton妯″紡(浠ヤ笅綆鍐欎負(fù)SP)銆傛墍鏈夎嚜瀹氫箟鐨凜ommand鍦ㄨ鍦‵rontController鏋勯犲嚱鏁頒腑瀹炰緥鍖栧茍浠ュ叧鑱旀暟緇勭殑鏂瑰紡娉ㄥ唽FrontController#addCommand(eventType:String, commandInstance:Command)銆侲ventBroadcaster瀹炵幇SP銆侲vent綾葷殑緇撴瀯涓簕type:eventType, data:eventData}銆傛垜浠氳繃EventBroadcaster#broadcastEvent(eventType:String, eventData:Object)鍙戝竷Event銆侲vent鍙戝竷鍚?涓巈ventType瀵瑰簲鐨刢ommand instance鎵цCommand#execute(event:Event)銆?/FONT>
BTW錛氬湪Cairngorm鐨勬簮鐮佷腑錛宔ventType銆乧ommandName銆乪ventName娣風(fēng)敤錛屾垜緇熶竴鐢╡ventType銆?/FONT>
#2.2
ServiceLocator灝哛emote Service澹版槑涓嶸iew鍒嗙銆?BR>ServiceLocator瀹炵幇SP銆傚湪Cairngorm鐨刣emo涓紝鍙堥氳繃Delegate瀵硅薄瑙i櫎Command/Responder鍜孲erviceLocator涔嬮棿鐨勪緷璧栥傝繖涓狣elegate鍋氱殑浜嬫儏鍏跺疄鎰忎箟涓嶅ぇ錛屽氨鏄皟鐢⊿erviceLocator涓殑Method錛岃緗帿涓猂esponder涓虹浉搴旇繙紼嬫柟娉曠殑handler銆備釜浜鴻寰楁棤璋撳湴澧炲姞浜?jiǎn)浠g爜閲忓Q岃屼笖Delegate瀵硅薄涔熸病瀹炵幇SP錛屼篃灝辨槸璇存垜浠瘡嬈¤皟鐢ㄤ竴嬈emote Service涓殑Method錛岄兘瑕乶ew涓涓狣elegate瀵硅薄錛屽疄鍦ㄦ氮璐廣?/FONT>
#2.3
ViewLocator/ViewHelper灝哣iew錛圡XML錛変腑澶規(guī)潅鐨刦unction涓嶸iew鍒嗙銆?BR>ViewHelper鏈夌偣鎰忔濓紝褰撲竴涓猇iewHelper鍦ㄦ煇涓狹XML欏甸潰涓0鏄庢椂錛屽<view:LoginViewHelper id="loginViewHelper" />
#2.4
ModelLocator鏄竴涓猰arker interface錛岀▼搴忎腑Model鍙互鏀懼湪鏌愪釜ModelLocator鏂逛究璋冪敤銆?/FONT>
#2.5
ValueObject涔熸槸涓涓猰arker interface, 鍩烘湰涓嶉渶瑕併?/FONT>
#3
Cairngorm.99緇欐垜浠紑鍙慒lex紼嬪簭鎻愪緵浜?jiǎn)寰堜笉閿欑殑鏋舵瀯妯″?M/V/C/Remote涔嬮棿鍙互鍋氬埌瀹屽叏瑙f瀯銆備絾鍦ㄥ疄闄呭紑鍙戞椂娌℃湁蹇呰姝繪墸,浠g爜緇撴瀯娓呮櫚鏈夋椿鍔涘氨濂姐?/FONT>
#0
涔﹀拰鏂囨。涓婂啓鐨勯兘涓嶆槸鐗規(guī)竻妤氱殑銆傝嚜宸辮涓嬫潵銆?/FONT>
#1 Using a PK association
#1.1 POJO with XDolclet annotation
public class Customer {
/**
* @return Returns the shoppingCart.
* @hibernate.many-to-one cascade="delete" column="shopping_cart_id"
* unique="true" foreign-key="FK_SHOPPING_CART__CUSTOMER"
*/
public ShoppingCart getShoppingCart() {
return shoppingCart;
}
}
public class ShoppingCart {
/**
* @return Returns the customer.
* @hibernate.one-to-one property-ref="shoppingCart"
*/
public Customer getCustomer() {
return customer;
}
}
property-ref="shoppingCart" 鍛婅瘔Hibernate ShoppingCart#customer鍜孋ustomer#shoppingCart鏄弽鍚戠殑鍏崇郴銆傛墍浠ibernate鐭ラ亾濡備綍浠嶴hoppingCart#getCustomer涓绱㈠埌鐩稿簲鐨刢ustomer瀵硅薄銆傚彇鍑烘煇涓狢ustomer瀵硅薄鏃訛紝Hibernate浼?xì)鐢熸垚DEBUG SQL:324 - 3涓殑SQL璇彞銆?/FONT>
#1.2 HBM
Customer.hbm.xml
<many-to-one
name="shoppingCart"
class="ShoppingCart"
cascade="delete"
outer-join="auto"
foreign-key="FK_SHOPPING_CART__CUSTOMER"
column="shopping_cart_id"
/>
ShoppingCart.hbm.xml
<one-to-one
name="customer"
class="Customer"
cascade="none"
outer-join="auto"
constrained="false"
property-ref="shoppingCart"
/>
#1.3 SCHEMA SQL
create table CUSTOMER (
ID bigint generated by default as identity (start with 1),
SHOPPING_CART_ID bigint,
primary key (ID)
)
create table SHOPPING_CART (
ID bigint generated by default as identity (start with 1)
primary key (ID)
)
alter table CUSTOMER
add constraint FK_SHOPPING_CART__CUSTOMER
foreign key (SHOPPING_CART_ID)
references SHOPPING_CART
#1.4 Query SQL
DEBUG SQL:324 - 1
select customer0_.ID as ID, customer0_.SHOPPING_CART_ID as SHOPPING2_3_, customer0_.USERNAME as USERNAME3_, customer0_.PWD as PWD3_
from CUSTOMER customer0_
where customer0_.USERNAME=? and customer0_.PWD=?
DEBUG SQL:324 - 2
select shoppingca0_.ID as ID0_, shoppingca0_.TOTAL as TOTAL8_0_
from SHOPPING_CART shoppingca0_
where shoppingca0_.ID=?
DEBUG SQL:324 - 3
select customer0_.ID as ID1_, customer0_.SHOPPING_CART_ID as SHOPPING2_3_1_, customer0_.USERNAME as USERNAME3_1_, customer0_.PWD as PWD3_1_, shoppingca1_.ID as ID0_, shoppingca1_.TOTAL as TOTAL8_0_
from
CUSTOMER customer0_
left outer join
SHOPPING_CART shoppingca1_
on customer0_.SHOPPING_CART_ID=shoppingca1_.ID
where customer0_.SHOPPING_CART_ID=?
#2 Using a FK association
#2.1 POJO with XDolclet annotation
public class Customer {
/**
* @return Returns the shoppingCart.
* @hibernate.one-to-one cascade="delete"
*/
public ShoppingCart getShoppingCart() {
return shoppingCart;
}
}
public class ShoppingCart {
/**
* @return Returns the id.
* @hibernate.id generator-class="foreign"
* @hibernate.generator-param name="property" value="customer"
*/
public Long getId() {
return id();
}
/**
* @return Returns the customer.
* @hibernate.one-to-one constrained="true" foreign-key="FK_CUSTOMER__SHOPPING_CART"
*/
public Customer getCustomer() {
return customer;
}
}
constrained="true" 鍛婅瘔Hibernate ShoppingCart鐨凱K榪樺簲璇ユ槸涓涓狥K錛岃繖涓狥K寮曠敤Customer鐨凱K銆傝繕闇瑕佸鍋氫竴鐐瑰伐浣滐紝澹版槑ShoppingCart鐨凱K鐢熸垚絳栫暐鏄痜oreign錛屽搴擲hoppingCart#customer銆傝繖鍜屼笂闈竴鍙ヨ瘽涓嶆槸涓涓剰鎬濆槢錛孎T~~
#2.2 HBM
Customer.hbm.xml
<one-to-one
name="shoppingCart"
class="ShoppingCart"
cascade="delete"
outer-join="auto"
constrained="false"
/>
ShoppingCart.hbm.xml
<id
name="id"
column="id"
type="java.lang.Long"
>
<generator class="foreign">
<param name="property">customer</param>
</generator>
</id>
<one-to-one
name="customer"
class="Customer"
cascade="none"
outer-join="auto"
constrained="true"
/>
#2.3 SCHEMA SQL
create table CUSTOMER (
ID bigint generated by default as identity (start with 1),
primary key (ID)
)
create table SHOPPING_CART (
ID bigint not null,
TOTAL integer,
primary key (ID)
)
alter table SHOPPING_CART
add constraint FK_CUSTOMER__SHOPPING_CART
foreign key (ID)
references CUSTOMER
#2.4 Query SQL
DEBUG SQL:324 -
select customer0_.ID as ID, customer0_.USERNAME as USERNAME3_, customer0_.PWD as PWD3_
from CUSTOMER customer0_
where customer0_.USERNAME=? and customer0_.PWD=?
DEBUG SQL:324 -
select shoppingca0_.ID as ID0_, shoppingca0_.TOTAL as TOTAL8_0_
from SHOPPING_CART shoppingca0_
where shoppingca0_.ID=?
榪欎釜鈥滅湡姝b濈殑one-to-one鐨勫ソ澶勬槸灝戞潯鍏寵仈SQL璇彞錛岀湅鍒頒簡(jiǎn)鍚楋紵
Welcome to the ACM "Hello World" project. Everyone has seen the Hello World program used as a first exposure to a new language or environment. We are attempting to collect examples for as many languages and related programming environments (shells etc.) as possible.
Aproximate number of examples:204 <----wow~~~
This page has been accessed 33274 times.
Last updated: January 20, 2005
鐪嬬湅C鐨勶紝緇忓吀HelloWorld
#include <stdio.h>
main()
{
for(;;)
{
printf ("Hello World!\n");
}
}
榪欎篃鏄疕elloWolrd錛燂紒
a 1986 entry from Bruce Holloway:
#include "stdio.h"
#define e 3
#define g (e/e)
#define h ((g+e)/2)
#define f (e-g-h)
#define j (e*e-g)
#define k (j-h)
#define l(x) tab2[x]/h
#define m(n,a) ((n&(a))==(a))
long tab1[]={ 989L,5L,26L,0L,88319L,123L,0L,9367L };
int tab2[]={ 4,6,10,14,22,26,34,38,46,58,62,74,82,86 };
main(m1,s) char *s; {
int a,b,c,d,o[k],n=(int)s;
if(m1==1){ char b[2*j+f-g]; main(l(h+e)+h+e,b); printf(b); }
else switch(m1-=h){
case f:
a=(b=(c=(d=g)<<g)<'<g)<<g;
return(m(n,a|c)|m(n,b)|m(n,a|d)|m(n,c|d));
case h:
for(a=f;a
return(o[b-g]%n+k-h);
default:
if(m1-=e) main(m1-g+e+h,s+g); else *(s+g)=f;
for(*s=a=f;a<e;) *s=(*s<<e)|main(h+a++,(char *)m1);
}
}
鏇劇粡鏈鐭殑HelloWorld錛?A href="mailto:Jari.Arkko@lmf.eua.ericsson.se">Jari.Arkko@lmf.eua.ericsson.se錛?BR>jar.1.c
char*_="Hello world.\n";
ln -s /dev/tty jar.1.o
cc -c jar.1.c
鐜板湪鏈鐭殑HelloWorld 錛圝yrki Holopainen錛?BR>";main(){puts("Hello World!");}char*C=".c
char*_=__FILE__;
榪欐槸涓涓講鍚嶁滃懆鏄熸槦鈥濈殑鍚屽瀵瑰師鏂囩殑璇勮銆?BR>鍛ㄦ槦鏄?鍙戣〃浜?005-06-16 5:01 PM
鈥滃緢鏄庢樉錛孋++鐨勭紪璇戝櫒涓嶅java鐨凧IT鍜孒otSpot緙栬瘧鍣紝鍥犱負(fù)JIT鍜孒otSpot緙栬瘧鍣ㄨ兘閽堝CPU鎸囦護(hù)闆嗚繘琛屼漢浼樺寲銆佽兘鍦ㄨ繍琛屾椂鏍規(guī)嵁浣跨敤棰戠巼瀵筸ethod榪涜鍐呰仈鍜屼紭鍖栥傝孋++鐨勯潤(rùn)鎬佺紪璇戝櫒姘歌繙涔熷仛涓嶅埌榪欎簺鈥?
--- 鏃犵煡浜?jiǎn)鍚уQ岀幇瀛樹(shù)簬涓栫殑C++緙栬瘧鍣紝鏃犺鏄疺C++錛岃繕鏄疘ntel C++錛岃繕鏄痝++錛岄兘鑳介拡瀵圭壒瀹欳PU榪涜浼樺寲錛涜孞ava鐨勬墍璋撳姩鎬佷紭鍖栧彧鏄仛浜?jiǎn)閮ㄥ垎锛堜笉鏄叏閮ㄥQ塁++闈?rùn)鎬佷紭鍖栫殑宸ヤ綔錛涗簨瀹炰笂錛岀湡姝g殑鍔ㄦ佷紭鍖栦笉鏄換浣曚竴涓珮綰ц璦鎵鑳藉仛鍒扮殑錛孋++涓嶈兘錛孋涓嶈兘錛孞ava鏇翠笉鑳斤紝蹇呴』鍐呭祵姹囩紪鎵嶈兘鍋氬埌榪欎竴鐐廣?
鈥淛DK1.0鏃訛紝java鐨勯熷害鏄疌++鐨?0鍒?0鍒嗕箣涓銆傝屽埌浜?jiǎn)jdk1.4鏃訛紝java鐨勬ц兘鍒欐槸C++鐨勪笁鍒嗕箣涓鍒?鍊嶏紙閫氬父C++鏄痡ava鐨?.2鍊嶅埌1.5鍊嶏級(jí)銆傚彲鎯滆繖鍒嗘姤鍛婃病鏈塲dk1.4浠ュ悗鐨勬暟鎹紝鑰屽悗闈㈢殑鎶ュ憡鎴戜滑灝嗙湅鍒板湪jdk1.4.2鏃訛紝java鎬ц兘鍏ㄩ潰瓚呰繃C++銆傗?
--- 鏈変釜10宀佺殑灝忓瀛愬濂?0姣嶄翰璇達(dá)細(xì)鈥?騫村墠鎴戠殑騫撮緞鏄Τ鐨?/21錛屾垜鐜板湪鐨勫勾榫勬槸濡崇殑1/3錛岄殢鐫榪欑瓚嬪娍鐨勫彂灞曪紝鍦ㄦ湭鏉ユ垜鐨勫勾榫勫氨鍙互瓚呰繃濡熾傗?
Java鐨勯熷害涔熻鍙互鎺ヨ繎C++錛屼絾姘歌繙涓嶅彲鑳借揪鍒癈++涓鏍峰揩錛屾洿涓嶅彲鑳借秴榪嘋++錛屽洜涓鴻В閲婄▼搴忓繀欏昏姹傚師鐢熺▼搴忔潵瑙i噴鎵ц錛屾墍浠ユ案榪滆揪涓嶅埌涓鏍風(fēng)殑閫熷害銆?
鈥淛ava鍐欑殑鏁版嵁搴撶殑鎬ц兘鏄疌++鍐欑殑鏁版嵁搴撴ц兘鐨勮繎600鍊嶏紒鈥?
--- 澶╂柟澶滆礙錛屽鏋滅湡鐨勮繖鏍鳳紝MS SQL涓轟粈涔堜笉鐢↗ava鏉ョ紪鍐欙紝Oracle涓轟粈涔堜笉鐢↗ava鏉ョ紪鍐欙紝MySQL涓轟粈涔堜笉鐢↗ava鏉ョ紪鍐欙紵
鈥滀集鍏嬪埄澶у鍜孡awrence浼厠鍒╁浗瀹跺疄楠屽鐨勪竴浠芥姤鍛婅瘉鏄庯細(xì)IBM鐨凧DK姣擥CC鏇村揩鈥?
--- 浼厠鍒╁ぇ瀛︾湡鐨勬湁榪欎釜鎶ュ憡鍚楋紵鐪熸槸鐜鋒薄浼厠鍒╃殑濞佸悕錛屾妸JDK鍜孏CC鏀懼湪涓璧鋒瘮錛屽鍚屾妸鈥滈暱搴︹濆拰鈥滈噸閲忊濊繖涓ょ涓嶅悓鎬ц川鐨勪笢瑗挎斁鍦ㄤ竴璧鋒瘮銆?
鈥滅敤綰痡ava鍐欑殑JDK搴曞眰瑕佹瘮鐢–++鍐橨DK搴曞眰瑕佸揩鈥?
--- 鏅曪紝鈥滅函java鍐欑殑JDK鈥濓紝鏁欎綘Java鐨勮佸笀琚綘姘旇煩妤間簡(jiǎn)銆?/P>