2017年11月24日 星期五

美國營養師提出「最強懶人減肥法」!遵守15個方法從此遠離肥胖地獄


http://www.marieclaire.com.tw/beauty/health-fitness/13965//page_10

方法1、吃飯七分飽
喜愛的美食當前,想必任何人都難以抗拒誘惑,但切忌放縱自己吃到撐破肚皮,這樣一來不僅傷身,二來還會吃進過多熱量,得不償失。建議你「淺嚐即止」,大約感受到七分飽最適當。

方法2、蔬菜佔每餐的比例約1/2
怕吃進太多熱量?其實,你只要確保自己攝取蔬菜的分量約佔每一餐的1/2,這樣就不必擔心囉!蔬菜不僅富含纖維質,熱量又低,對身體好處多多。

方法3、永遠點小份食物
現代人外食機會大,你是否常常犯了「眼大嘴小」的毛病,總是在餐點分量的選擇上猶豫不決?解決方法很簡單,只要有看到選擇份量的餐點,一律選擇「最小份」準沒錯!

方法4、改變飲食順序
你是否有觀察自己吃飯時的飲食順序?可別輕忽這個小細節,因為這可是大大左右了你的減肥結果。開始在正餐前先吃蔬菜或喝湯吧!如此一來,不僅能增加飽足感還能減少熱量的攝取。

方法5、多喝水
根據科學研究指出,很多時候我們感到餓的同時也感到口渴,這時不妨喝點加了檸檬汁的開水,除了能大大降低飢餓的感覺,同時還能補充維他命C。

方法6、晚上別吃大餐、熱量高的食物
減肥過程中最忌諱白天都不進食,卻餓到晚上再一次大吃!晚上不僅腸胃消化能力不好,不正常的飲食習慣反而更容易讓身體囤積體脂肪。

方法7、聰明選擇零食
看影集時手邊沒有個零食相伴那怎麼行!但除了洋芋片、爆米花或可樂,你可以有更聰明的選擇。試著吃吃看高纖的餅乾或燕麥棒,不僅美味,對身體負擔也不會太大喔!

方法8、參加派對前先吃點輕食
我們都知道酒精的熱量有多驚人,想減肥的人切忌空腹前往派對現場,建議在出發前,先吃點水果或燕麥棒果腹,以免讓你的瘦身計畫功虧一簣。

方法9、捨棄精緻類澱粉
如果你愛吃的是看起來「白泡泡」的精緻類澱粉,如:白吐司、白米飯、白麵條等等,反而會讓你陷入肥胖地獄,因為這種澱粉不僅吃不飽,還很容易發胖!相反的,你應該選擇的是全穀類及根莖類的「好」澱粉,不僅熱量低、高纖,也較易有飽足感,是瘦身時的最佳夥伴喔!

方法10、吃早餐很重要!很重要!很重要!
「吃早餐很重要!」這句話想必聽了不下數百次,但也是真理!尤其想減肥的人更是一定要遵守這個原則。早餐不僅是整天活力的來源,同時還能避免下午及晚上攝取過多熱量。

方法11、每周最少運動3小時
懶人的最高原則就是不想動!但如果你想減肥這可是不允許的,但我們還是可以稍稍偷懶一下,至少讓自己每周運動3小時吧!要跳舞、慢跑、逛街走路都可以,總之有讓自己動起來都是好的方法喔!

方法12、晚餐+飯後不吃甜點
基本上甜點這種東西本來就是減肥過程中的大魔王,更何況是放在飯後,而且還是晚餐時間!如果真的嘴饞,那麼就選擇下午時段吃,最好是淺嚐即止。(請參閱方法1。)
方法13、體會分享「熱量」的美好
懂得分享是件好事,尤其和好友或身旁的另一半一起分享「熱量」更是最棒的一件事了!不僅自己不會攝取過多的卡路里,還可以把熱量也一起分給別人,多美好啊!
方法14、將零食倒入盤子裡
雖然我們建議將高熱量的垃圾食物換成營養價值高的果乾或燕麥棒,但誰不會偶爾想放縱一下呢!(連維多利亞的秘密超模都會放縱了,就別太苛求〜)建議不要將深不見底的「邪惡袋裝零食」直接撕開吃,而是要將一半的分量倒入盤子裡,這樣才能意識到自己吃了多少的份量!
方法15、拒吃人工代糖
研究證實,攝取人工代糖更容易增加後續熱量的攝取。因為代糖只能欺騙味蕾,卻無法使大腦接收到熱量訊息,反而會讓人不知不覺間吃下更多食物來獲取大腦的飽足感!

2017年9月20日 星期三

Delphi 列出所有 Component / 元件

http://theprofessionalspoint.blogspot.tw/2012/11/how-to-find-all-components-and-controls.html

procedure MyForm.DisableAllButtons;
var
  i : integer;
begin
  try
    for i := 0 to ComponentCount - 1 do
    begin
      if Components[i] is TButton then //Check whether the component is button or anything else
      begin
        MyForm(Components[i]).Enabled := False;
      end;
    end;
   
  except
    on E : Exception do
    begin
      ShowMessage('Error occured in function DisableAllButtons: ' + E.Message);
      exit;
    end;
  end;
end;


    for i := 0 to frmMain.ComponentCount -1 do
    if ( frmMain.Components[i] is TAdvSmoothLabel ) then
    if TAdvSmoothLabel(frmMain.Components[i]).Name = 'projNameLabel' then

        TAdvSmoothLabel(frmMain.Components[i]).Caption.Text := appVar.appName;

2017年9月17日 星期日

Delphi 清空 Type 內所有內容 emptyBFT750Info: TBFT750Info = ();





https://stackoverflow.com/questions/5509394/how-can-i-quickly-clear-a-record-of-simple-types
var
  MyList : TListSignals;
begin
     ZeroMemory(@Mylist,SizeOf(MyList));
end;

Delphi 清空 Type 內所有內容 emptyBFT750Info: TBFT750Info = ();

2017年8月14日 星期一

Creating a Git Server on a Windows OS

https://www.youtube.com/watch?v=w3eRlEhzAZk


http://www.techrepublic.com/blog/tr-dojo/set-up-a-free-ssh-server-on-windows-7-with-freesshd/

2017年6月20日 星期二

Delphi POS 增強功能 : 最後位置,第 N 次位置,出現次數

http://delphi.ktop.com.tw/board.php/00_01_21/post.php?action=usereply&cid=31&fid=79&tid=28123&rid=183889&iid=2207


這只是很簡單的增強 POS 功能的 function ,不知有沒人 POST 過類似的    PosEnd 是回傳 SubStr 在 S 最後一次出現的位置,若沒出現回傳 0    PosN 是回傳 SubStr 在 S 第 n 次出現的位置,若出現少於n次回傳 0    PosCount 是回傳 SubStr 在 S 出現的次數    放這些 Function 的 Unit 要加 use StrUtils
function PosEnd(Substr,S: string): Integer;
var
  i : integer;
begin
  i := 0;
  repeat
    result := i;
    i := i   1;
    i := PosEx(SubStr,S,i)
  until i <= 0
end;    function PosN(Substr,S: string; N : Integer): Integer;
var
  i: integer;
begin
  result := 0;
  For i := 1 to N do
  begin
    result := result   1;
    result := PosEx(SubStr,S,result);
  end;
end;    function PosCount(SubStr,S : string) : Integer;
var
  i : integer;
begin
  i := 0;
  result := -1;
  repeat
    result := result   1;
    i := i   1;
    i := PosEx(SubStr,S,i)
  until i <= 0
end;
function PosEx(const SubStr, S: string; Offset: Cardinal = 1): Integer; 
var
  I,X: Integer;
  Len, LenSubStr: Integer;
begin
  if Offset = 1 then
    Result := Pos(SubStr, S)
  else
  begin
    I := Offset;
    LenSubStr := Length(SubStr);
    Len := Length(S) - LenSubStr   1;
    while I <= Len do
    begin
      if S[I] = SubStr[1] then
      begin
        X := 1;
        while (X < LenSubStr) and (S[I   X] = SubStr[X   1]) do
          Inc(X);
        if (X = LenSubStr) then
        begin
          Result := I;
          exit;
        end;
      end;
      Inc(I);
    end;
    Result := 0;
  end;
end;

Delphi Replace,InStr,Left,Right,LeftTrim,RightTrim,Reverse,Split,Replace,Mid Functions

https://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=382&lngWId=7




!**************************************
! Name: Replace,InStr,Left,Right,LeftTrim,RightTrim,Reverse,Split,Replace,Mid Functions
! Description:This is just like the name says, The Following Vb functions for Delphi all coded/translated by me:
RightTrim
LeftTrem
InStr
Mid
Left
Right
Replace
Split
Reverse
! By: telle (from psc cd)
!**************************************

unit Functions;
interface
uses
 Windows,Messages, SysUtils, Classes, Graphics,StdCtrls;
function RightTrim(const s:String):String;
function LeftTrim(const s:String):String;
function InStr(Start: integer; Source: string; SourceToFind: string): integer;
function Mid(Source: string; Start: integer; Length: integer): string;
function Left(Source: string; Length: integer): string;
function Right(Source: string; Lengths: integer): string;
function Replace(sData: String; sSubstring: String; sNewsubstring: string): String;
function Split(Source, Deli: string; StringList: TStringList): TStringList;
function Reverse(Line: string): string;
implementation
function Reverse(Line: string): string;
 var i: integer;
 var a: string;
begin
 For i := 1 To Length(Line) do
 begin
 a := Right(Line, i);
 Result := Result + Left(a, 1);
 end;
end;
function Split(Source, Deli: string; StringList: TStringList): TStringList;
var
 EndOfCurrentString: byte;
begin
 repeat
EndOfCurrentString := Pos(Deli, Source);
if EndOfCurrentString = 0 then
 StringList.add(Source)
else
 StringList.add(Copy(Source, 1, EndOfCurrentString - 1));
Source := Copy(Source, EndOfCurrentString + length(Deli), length(Source) - EndOfCurrentString);
 until EndOfCurrentString = 0;
 result := StringList;
end;
function Replace(sData: String; sSubstring: String; sNewsubstring: string): String;
var
i: integer;
lSub: Longint;
lData: Longint;
begin
i := 1;
lSub := Length(sSubstring);
lData := Length(sData);
repeat
begin
i := InStr(i, sData, sSubstring);
If i = 0 Then
begin
sNewSubString := sData;
Exit
end
Else
sData := Copy(sData, 1, i - 1) + sNewsubstring + Copy(sData, i + lSub, lData);
i := i + lSub;
End;
 Until i > lData;
Replace := sData;
end;
function Left(Source: string; Length: integer): string;
begin
 Result := copy(Source,1,Length);
end;
function Right(Source: string; Lengths: integer): string;
begin
Result := copy(source,Length(Source) - Lengths,Lengths);
end;
function Mid(Source: string; Start: integer; Length: integer): string;
begin
 Result := copy(Source,Start,Length);
end;
function InStr(Start: integer; Source: string; SourceToFind: string): integer;
begin
 Result := pos(SourceToFind,copy(Source,Start,Length(Source) - (Start - 1)));
end;
function RightTrim(const s:String):String;
var
i:integer;
begin
 i:=length(s);
 while (i>0) and (s[i]<=#32) do
Dec(i);
 result:=Copy(s,1,i);
end;
function LeftTrim(const s:String):String;
var
i, L:integer;
begin
 L:=length(s);
 i:=1;
 while (i<=L) and (s[i]<=#32) do
Inc(i);
 result:=Copy(s,i, MaxInt);
end;
end.

2017年6月12日 星期一

Robocopy 指定不複製特定目錄

Robocopy 指定不複製特定目錄

robocopy E:\Copy_Source E:\Copy_Dest /s /maxage:7  /e /XD *back* *111*

rem /maxage:7 只要這一周修改的文件

pause


http://blog.xuite.net/dragonfly_7252/computer/223236655-Robocopy+%E6%8C%87%E4%BB%A4%E7%AF%84%E4%BE%8B%E5%8F%83%E8%80%83+(MIR%E5%95%8F%E9%A1%8C%E5%BE%88%E5%A4%9A%EF%BC%8C%E5%B0%8F%E5%BF%83%E4%BD%BF%E7%94%A8


http://ithelp.ithome.com.tw/questions/10175518

2017年5月22日 星期一

PHP

PHP

xoops class list doc



FLEX 3 Example



css 教學



寫網頁必備良藥

Oracle

Oracle

SQLLDR装载换行符的小问题 




利用 sqlldr 快速上傳資料
bat 檔案:
----------------------------------------------------------------------
SqlLdr.exe "user/pass@DB_Host control='DM_DATA.ctl' errors=100000 parallel=TRUE rows=1000 bindsize=6553600"
----------------------------------------------------------------------


DM_DATA.ctl:
----------------------------------------------------------------------
load data
infile 'DM_DATA.TXT'
into table TABLE_NAME_TMP
APPEND
fields terminated by '|'
(
USER_NAME
)
----------------------------------------------------------------------

DM_DATA.txt
----------------------------------------------------------------------
AAA
BBB
CCC
DDD
----------------------------------------------------------------------



大量匯入匯出 Oracle 資料表資料



Oracle Performance

l最好的刪除重複資料方法
  • nDELETE FROM FXLOTDB E WHERE E.ROWID > (SELECT MIN(X.ROWID)
      FROM FXLOTDB X WHERE X.LOT_ID = E.LOT_ID)
  • 多使用 Decode 提高 Query 時間
  • l少用 *
  • lcount(Lot_ID)  >= count(*) >=  count(1)
  • l用 TRUNCATE 替代 DELETE 來刪除Table 資料
  • l>=  V.S  <>
  • l“C%”  V.S  “%C”
  • l用 NOT EXISTS 替代 NOT IN



Oracale 錯誤編碼查詢


oracle index 查詢




Oracle 進階 by 日期展開查詢
select 'report_item' report_item,
  to_char(sysdate -7,'MM/DD') ||'('|| to_char(sysdate -7,'Dy') || ')' d7,
  to_char(sysdate -6,'MM/DD') ||'('|| to_char(sysdate -6,'Dy') || ')' d6,
  to_char(sysdate -5,'MM/DD') ||'('|| to_char(sysdate -5,'Dy') || ')' d5,
  to_char(sysdate -4,'MM/DD') ||'('|| to_char(sysdate -4,'Dy') || ')' d4,
  to_char(sysdate -3,'MM/DD') ||'('|| to_char(sysdate -3,'Dy') || ')' d3,
  to_char(sysdate -2,'MM/DD') ||'('|| to_char(sysdate -2,'Dy') || ')' d2,
  to_char(sysdate -1,'MM/DD') ||'('|| to_char(sysdate -1,'Dy') || ')' d1
from dual
union all
select report_item,
      to_char( sum(d7)) d7,
      to_char( sum(d6)) d6,
      to_char( sum(d5)) d5,
      to_char( sum(d4)) d4,
      to_char( sum(d3)) d3,
      to_char( sum(d2)) d2,
      to_char( sum(d1)) d1
from
(select report_item,decode(d,to_char(sysdate -7,'MM/DD'),CNT,0) d7,
       decode(d,to_char(sysdate -6,'MM/DD'),CNT,0) d6,
       decode(d,to_char(sysdate -5,'MM/DD'),CNT,0) d5,
       decode(d,to_char(sysdate -4,'MM/DD'),CNT,0) d4,
       decode(d,to_char(sysdate -3,'MM/DD'),CNT,0) d3,
       decode(d,to_char(sysdate -2,'MM/DD'),CNT,0) d2,
       decode(d,to_char(sysdate -1,'MM/DD'),CNT,0) d1 
from
(select report_item,to_char(to_date(shift_dt,'yyyy/mm/dd'),'MM/DD') d,Level_3 CNT from f3cim.RPT_EMAP2_ESFABSUM_BT where  shift_dt>= to_char(sysdate-7,'yyyy/mm/dd')
)
) group by report_item


case when

decode ( expression , search , result [, search , result]... [, default] )


任選固定資料

sSql := 'select ' +
                          stmp_ColumnSum +
                          ','''' as "USER答案" ' +
                    ' from ' +
                    '(' +
                          '(' +
                                'select a.* from ' +
                                '(' +
                                'select a.*,1 as ID from QUESTION_UT a ' +
                                'where ' +
                                      'a.QUESTION_TYPE = ''是非'' and ' +
                                      'a.PAPER_ID = ''' + cmb_Paper_ID02.Text + ''' and ' +
                                      'a.DELETE_TIME is null ' +
                                'order by dbms_random.random ' +
                                ') a where rownum <= ' + grd_Question_Num_Set00.Cells[ 2 , 1 ] + ' ' +
                          ')' +
                          'union ' +
                          '(' +
                                'select a.* from ' +
                                '(' +
                                'select a.*,2 as ID from QUESTION_UT a ' +
                                'where ' +
                                      'a.QUESTION_TYPE = ''單選'' and ' +
                                      'a.PAPER_ID = ''' + cmb_Paper_ID02.Text + ''' and ' +
                                      'a.DELETE_TIME is null ' +
                                'order by dbms_random.random ' +
                                ') a where rownum <= ' + grd_Question_Num_Set00.Cells[ 2 , 2 ] + ' ' +
                          ')' +
                          'union ' +
                          '(' +
                                'select a.* from ' +
                                '(' +
                                'select a.*,3 as ID from QUESTION_UT a ' +
                                'where ' +
                                      'a.QUESTION_TYPE = ''複選'' and ' +
                                      'a.PAPER_ID = ''' + cmb_Paper_ID02.Text + ''' and ' +
                                      'a.DELETE_TIME is null ' +
                                'order by dbms_random.random ' +
                                ') a where rownum <= ' + grd_Question_Num_Set00.Cells[ 2 , 3 ] + ' ' +
                          ')' +
                          'union ' +
                          '(' +
                                'select a.* from ' +
                                '(' +
                                'select a.*,4 as ID from QUESTION_UT a ' +
                                'where ' +
                                      'a.QUESTION_TYPE = ''填充'' and ' +
                                      'a.PAPER_ID = ''' + cmb_Paper_ID02.Text + ''' and ' +
                                      'a.DELETE_TIME is null ' +
                                'order by dbms_random.random ' +
                                ') a where rownum <= ' + grd_Question_Num_Set00.Cells[ 2 , 4 ] + ' ' +
                          ')' +
                    ')' +
                    'order by ' +
                          'ID,QUESTION_ID ';