跳到主要內容

發表文章

可以創新的四個面向

Every organization needs to innovate. But what type of innovation to give priority to? This simple matrix with four types of innovation may help. Innovation basically means introducing something new (‘nova’). This “something new” can be anything and that’s where the problem starts. In two ways. - First, by an overemphasis on product (or service) innovation, thereby not giving enough attention to other types - Second, by getting overwhelmed by all the innovation opportunities that are out there. To solve both problems at the same time, it helps to gain some clarity on what types of innovation there are. To that end, I’ve created this simple 2x2 matrix containing what I think are the four most important types of innovation for every organization. Let me first explain the two axes. The first is the inward-outward axis. Outward-oriented innovations are those innovations that are mostly targeted at the market, at doing something new for customers. Inward-oriented innovations, on the other h...
最近的文章

先利人再利己

#順序攸關成敗 常常我在看人討論商業模式或是買賣時,聚在一起都在想,我要賣多少、我可以賺多少、我一定要有多少利潤... 這個順序其實錯了,商模/買賣能成,其實是建立在各方利害關係人都有利,至少不反對,而同時對我又有利的基礎上,重點在別人划算,至於你自己划不划算?常常你的成本是變動的,可以調整組合去適配結果,這個商模才能運轉 你的用戶不為了成就你賺錢或有利而存在,他們是為了他們自己 Reference:  https://www.linkedin.com/posts/sonetall_ouwixbjeqojojoojev-activity-7081930580904345601-ArfS?utm_source=share

[筆記] Head First Design Patterns

Chapter 1 Welcome to Design Patterns: an introduction OO Basics: Abstraction Encapsulation Polymorphism Inheritance OO Principles: Encapsulate what varies. Favor composition over inheritence. Program to interfaces, not implementations. OO Patterns: Strategy - defined a family of algorithms, encapsulates each once, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it. Chapter 2 Keeping your Objects in the know: the Observer Pattern OO Principles: Strive for loosely coupled designs between objects that interact. OO Patterns: Observer - defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. Chapter 3 Decorating Objects: the Decorator Pattern OO Principles: Classes should be open for extension but closed for modification. OO Patterns: Decorator - Attach additional responsibilities to an objec...

[Symfony+Doctrine] 透過非 Id 來使用 Pessimistic Lock

根據 文件 ,Doctrine 有 Pessimistic Lock,又分為兩種: LockMode::PESSIMISTIC_WRITE:對應至 MySQL 的 Select FOR UPDATE LockMode::PESSIMISTIC_READ:對應至 MySQL 的 Select LOCK IN SHARE MODE 差別在於 LOCK IN SHARE MODE 會將在 row 的資料鎖定(row-level lock),在非同一交易(Transaction)下,不給寫入,其他交易可以讀取, 且可以繼續 Select LOCK IN SHARE MODE 。而 FOR UPDATE 不僅鎖定該資料,在非同一交易下,不給寫入,其它交易可以讀取, 但不能 Select LOCK IN SHARE MODE 。MySQL 文件有更詳細的比較與情境使用的說明,參考 網址 。 現在問題是,我們要完全採用 ORM 來處理資料。Doctrine 的文件提到 EntityManager::find 可以採用 Pessimistic Lock, 但 find 是透過 id 來處理 。而其他 find 系列函數(包括:findAll, findBy, findOneBy)皆不支援 LockMode。 因此,勢必要有方法來「透過非 id 來使用 Pessimistic Lock」。透過查看原始碼,簡單的方法是有的,解法之範例如下: 19 public function depositAction() 20 { 21 22 $em = $this->getDoctrine()->getManager(); 23 24 $em->transactional(function ($em) { 25 $entityName = 'AcmeTrainingBundle:Account'; 26 $lockMode = LockMode::PESSIMISTIC_READ; 27 $orderBy = null; 28 $...

[轉貼]MySQL 交易功能 Transaction 整理 (XYZ的筆記本)

全文轉貼自: http://xyz.cinc.biz/2013/05/mysql-transaction.html   (XYZ的筆記本) ---------------------------------------------------------------------------------------------------------- 資料庫的交易(Transaction)功能,能確保多個 SQL 指令,全部執行成功,或全部不執行,不會因為一些意外狀況,而只執行一部份指令,造成資料異常。 MySQL 常用的兩個資料表類型:MyISAM、InnoDB, MyISAM  不支援交易功能,所以以下的整理,均是針對 InnoDB  而言。 交易功能4個特性 (ACID)  Atomicity (原子性、不可分割):交易內的 SQL 指令,不管在任何情況,都只能是全部執行完成,或全部不執行。若是發生無法全部執行完成的狀況,則會回滾(rollback)到完全沒執行時的狀態。 Consistency (一致性):交易完成後,必須維持資料的完整性。所有資料必須符合預設的驗證規則、外鍵限制...等。 Isolation (隔離性):多個交易可以獨立、同時執行,不會互相干擾。這一點跟後面會提到的「隔離層級」有關。 Durability (持久性):交易完成後,異動結果須完整的保留。 開始進入交易模式 SQL 指令: START TRANSACTION  或  BEGIN 結束交易模式 交易完成:使用  COMMIT  儲存所有變動,並結束交易。 交易過程異常:使用  ROLLBACK  回滾,取消交易,還原到未進行交易的狀態。(若交易過程連線中斷,沒 COMMIT 提交的變更,亦會如同執行 ROLLBACK 取消交易) 儲存點 (SAVEPOINT) 交易過程中,可標示多個不同的儲存點,有需要時可 ROLLBACK 到某個儲存點。 建立儲存點: SAVEPOINT 名稱 刪除儲存點: RELEASE SAVEPOINT 名稱 ROLLBACK 到某個儲存點: ROLLBACK TO SAVEPOINT 名稱 如...

尾聲-總結,一顆全新的硬碟開始

步驟 使用 fdisk 等工具查看硬碟的分區情況,確定要裝到哪個分區,記下分區的首磁區磁區號 $ bximage -q -hd -mode=flat -size=120 120m.img $ fdisk 120m.img 磁碟 120m.img: 125 MB,125411328 位元組 255 磁頭,63 磁區/磁軌,15 磁柱,總計 244944 磁區 單位 = 磁區 之於 1 * 512 = 512 位元組 磁區大小 (邏輯/實體):512 位元組 / 512 位元組 I/O 大小 (最小/最佳化):512 位元組 / 512 位元組 磁碟識別碼:0x00000000

尾聲-真正的尾聲

grub 系統已經在硬碟上順利執行了,我們仍然可以改進,讓它支持多重開機,採用現有的 grub 即可。 首先,先將開機磁區裝到 Orange'S 分區的開機磁區: dd if=boot/hdboot.bin of=$(HD) seek=`echo "obase=10;ibase=16;\`egrep -e '^ROOT_BASE' boot/include/load.inc | sed -e 's/.*0x//g'\`*200" | bc` bs=1 count=446 conv=notrunc dd if=boot/hdboot.bin of=$(HD) seek=`echo "obase=10;ibase=16;\`egrep -e '^ROOT_BASE' boot/include/load.inc | sed -e 's/.*0x//g'\`*200+1FE" | bc` skip=510 bs=1 count=2 conv=notrunc 並重新編譯(此時,硬碟 80m.img 的開機磁區還是 Orange'S 的開機磁區,可是在 80m.img5 的開機磁區也有 Orange'S 的開機磁區)。