47

ПРОграммист 2010 01

Embed Size (px)

Citation preview

2010. 1, 2010 .

:Utkin, JTG, ,

.................................................. .002 , ............................................. .003 ........................... .007 ........... .00D . DELPHI ................. .010 . 1-2 .... .015 . WinAPI .......................... .01B . . . -2 .... .020 Fortress. . ....... .02B

: , Indian,

:Utkin, , , , ,

: [email protected] www.programmersforum.ru

: . , , .

...

! 2010 . www.programmersforum.ru. , , . , , . . , . () ( , , , ) ( ) ( , ..) ( ) ( ) ( ) ( ) ( ) / . : [email protected] , ( SCRIBUS) , : , , , , / , (, ) ( , -, ) MS Word Arial 10 , () PNG, BMP TIF , - . , " " -. , , . , .

,

...

, , : , , , . " "?p.s.:

3G.USB : , , , . ZTE MF-622. ~20 , ( , ). , 1. CD DVD , , , . , ... -. (, Vasek123) : IBM, , - , 100 100 . , . , , . , (40 ). , . : . 19 , , . 1975 . , . 10 1980 .

003,

: SkyGrabber. , - . . , SkyGrabber . , . : . 2- (2-) 3- . Nero Burning ROM: . , , .

: 1557, . , Uke=30 Iki=300-500. , - 3- 4- ( 11- 12-). 2- 8- . : . . ... : , . 142 LM317: ... . DRAM: (NEC 4164 5655) . . , ( ) . , , 0 , - . DRAM , . . DRAM, - ,

004,

, . , , .. , . . . , , , - . . , , CCD. , DRAM , , . . , , . , CCD . GSM: . TDK-2127/2128 Siemens 25 5617 . , - , PF08105A. 6 .

. , - , .

005,

: ( ) , AN221E04. , , , . ( ). , , . . - AnadigmDesigner - . , , 25 . : , , , . , ( ) . () () . 30 , , . , , Ethernet (. ):

, , . ( ) ( ) , .

006,

. , .

http://kohnvict.narod.ru . . , . , : Basic, C++, Java . . . , . . , , . , , , . , , . .

. , . . , . , . , , 22.09.1944, , , , .-. . , . ? . : . . . , ( , . ). , , . : , . 1, 123182 , . -,

007

, . , 1991- , , , Mathematica, IGOR-pro . , , , . , . . , , , . , . . , , , . . . , , , . , , . , . , , . , . ( ), . , . , . . , - . , ( 2004 ) Java, . Java, , . . , , - , - . . , 2004 . . . , , , . , , , . pdf 150 4 pdf . , . , ,

008

. . , , - , . , , , . . . .

, . , - , , . http://vkacl.narod.ru, . FreeSoft, 40 . . , , - . . , , , ACL (advanced command language), , , . vkACL.jar. Java , Java JRE, . JRE , , [1]. [2]. , , , () ACL . . jar- . , , . Java . , . , ( ), ACL . . , Java-, [3]. . , . Java- , . , , ( Ctrl-A, Ctrl-C, Ctrl-V), , snapshot, . , http://kohnvict.narod.ru/Data/advice.htm.

009

Java - , , . .

ACL? , , . , , . , , . , . . . . , , , (#). , . . : , ( ). , . , Java, . , . , . . , . , , .

? , , . , . . , . . , . , . . . , (), . . , . . . . , , . ? , , ? , , . . , quick. , . . (a) (z), (A) (Z) ($), (%), (&). , (z1=x3;). , ? i(), r() () t().

00A

. () , , (b [begin]) (le [length]), , . . ? . . . . , . . ? . #cal #c #. , . . , . , . : # z=sin(3.14*20/180); X1=5/exp(-2.7)+r(25); #% ? , #rep N (repeat) ( ). #end , #rep N . . ? . , . ? . , #case N. , #end. , (&). , . #end . (&), . , . : # &=2; #case 1 . . . #end | #case 2 . . . #end | #case 3 . . . #end | #case 2. (|) #end (&) 12345. , . . . . . . , . , . , . . < > . ab . , . , . , , , , . , , zip, . 00B . , . , . . , . . xml , . . .. JRE http://java.sun.com http://www.java.com/ru/download/index.jsp . http://img-fotki.yandex.ru/get/3904/kohnvict.12/0_24d12_9b5a6cf9_orig . Java- http://vkacl.narod.ru/applets/00/vkACLa.htm00 . .by Utkin www.programmersforum.ru , , , {}, begin - - end ., . . ? , , , . . . . , ( ), . , , ( , ), . . , . . , . - , , , . , . , , (. ): . 00D , ., , , , . * : 1. 2. 3. 4. 5. 5.1. . , . . . . , ... , . . . , ... , . , . * , , , ..5.2. 5.3. 6. 6.1. 7. . , , : . , . ( ) , , , .. 5 6 . , ,00E . , , . 5.3 , . 6.1 , ( ). , . , . , . .. 6.1. : , . , , ( ) ... . , , , , .. ( ). 7 http://www.programmersforum.ru . .00F , - 3D . by DeKot [email protected]. 1. 2D (, ..) , (). , , . , , . . . , , . , . , , . 2:. 2. . DELPHI010 , : mas: array [ 0..m,0..n ] of < >, i - 0 .. m, j - 0..n; Left, Top - ; dxc, dyc - ; dxc := 2 * dyc; wp, hp - ; wp := 2 * dxc; hp := 2 * dyc; x0 = Left; y0 = Top; : function Kord_X(i , j : byte) : integer; begin Result:= ((m + ( j - i)) * dxc ) + Left end ; x := Kord_X(i , j); function Kord_Y(i , j : byte) : integer; begin Result := ((i + j) * dyc) + Top end; y := Kord_Y(i , j); : function Ind_I (x , y : integer) : integer; begin Result := ((m - ((x - Left) div dxc)) + ((y -Top) div dyc)) div 2 end; i := Ind_I (x , y); function Ind_J (x , y : integer) : integer; begin Result := (((x -Left) div dxc) + (((y -Top) div dyc) m)) div 2 end; j := Ind_J (x , y); , , . x, y xm, ym : procedure TForm1.FormMouseUp (Sender : TObject ; Button : TMouseButton ; Shift : TShiftState ; xm , ym : Integer) ; begin x := ((((xm Left) + (dxc div 2)) div dxc) * dxc) + Left; y := ((((ym Top) + (dyc div 2)) div dyc) * dyc) + Top end;011. DELPHI . , - 27 63 . BMP JPG, PNG , . , : Sprite.Width:= 1 / 3 * wp; Sprite.Width:= 2 / 3 * wp; Sprite.Height:= 2 / 3 * hp; Sprite.Height:= hp;: wp hp - (. .3).. 3. dx dy 2:1 : N_step = dxc / dx, N_step = dyc / dy;: N_step - () ; dxc, dyc - . : for i:= 1 to N_step do begin Sprite(x,y) ; // x := x + dx ; y := y + dy ; end;x , y; . c (. .4):012. DELPHI. 4. , . (. .5):. 5. : mas_index : array [ 0 .. l , 0 .. m , 0 .. n ] of < > mas_index [ k , I , j ] ; k 0..l; : i - 0..m; j - 0..n. 1. :013. DELPHI. dyc . dx := dy dx * N_step = dxc , ( ) (. 6): . . 6. , . ( ) http://www.programmersforum.ru . . .014. DELPHI . 12 ( ). by DeKot [email protected] WINDOWS GDI (Graphics Devices Interface ). GDI , ( Delphi) ( DC (Display Context)). , (, ). Delphi ( ). 1 Delphi : . TCanvas . TFont . TPen . TBrush , canvas, font, pen, brush, , , . Delphi : TGraphic, TPicture, TImage, TBitMap, TJpegImage, TShape, TIcon, TMetaFile . TCanvas. , anvas. TPoint TRect, (. ): TPoint = record // X : LongInt; Y : LongInt; TRect = record // Left : Integer; Top : Integer; Right : Integer; Bottom : Integer;015. DELPHI TRect = record // TopLeft : TPoint; BottomRight : TPoint; TRect := Bounds ( X,Y, Width, Height : Integer ); : X, Y ; Width, Height . ( ) TCanvas. , , / , . () : . Canvas < () > Arc (), Pie (), Ellipse ( , ), Rectangle () . Canvas.Draw . Canvas.StretchDraw . Canvas.CopyRect . Canvas. TextOut . , . 2 Delphi File => New => Application ( Delphi ). C File => SaveAll. Delphi Unit 1. Project1 Lesson 1. Delphi Form1 Unit1 (. .1):. 1. . DELPHI016 Object Inspector Form1 Caption 1 : Top (100*), Left (230), Width (700), Height (575), ClientWidth (700), ClientHeight (540). * , . Object Inspector Events () OnPaint(). On Paint (. .2):. 2. OnPaint() (. ): with form1.canvas do begin pen.color:= clred; rectangle(350, 50, 550, 100);// // // // x1=350, y1=50 x2=550, y2=100pen.color:= clgreen; pen.width:= 4; brush.color:= clskyblue; ellipse(60, 100, 250, 400) end;// // // , (Run F9 ) . , , ( .bmp). , , (. ). , ( ship1.bmp) ( star1.bmp). ship1.bmp ( ), star1.bmp017. DELPHI 700540 ( Object Inspector). TBitMap: BufFon ( star1.bmp), BufSpr ( ship1.bmp), BufPic ( BufSpr), Buffer ( ). BufFon BufSpr . Buffer BufFon, BufPic , : BufPic.Width := round ( BufSpr.Width / n ); BufPic.Height:= round ( BufSpr.Height / m ); : n sprite, m . OnCreate() (. .3):. 3. BufPic** BufSpr BufPic CopyRect (. ): procedure DrawShip1 ( i: byte); // begin BufPic.Canvas.CopyRect(bounds(0, 0, BufPic.Width, BufPic.Height), BufSpr.Canvas,bounds( i * 66, 0, BufPic.Width, BufPic.Height)); end; ( ) OnPaint(). xs1 018. DELPHIys1 ( ). DrawShip1(0) c 0 BufPic. Buffer . (. ): // procedure DrawShip1(i: byte); begin BufPic.Canvas.CopyRect(bounds(0, 0, BufPic.Width, BufPic.Height), BufSpr.Canvas, bounds(i * 66, 0, BufPic.Width, BufPic.Height)); end; procedure Tform1.FormPaint(sender: tobject); var xs1, ys1: integer; // SHIP1 begin xs1:= 250; ys1:= 466; DrawShip1(0); Buffer.canvas.draw(0, 0, BufFon); // Buffer.canvas.draw(xs1, ys1, BufPic); // // Buffer.canvas.draw(0, 0, Buffer); // ( ) // end; (. .4):. 4. 019. DELPHI . ( Lesson1***). http://www.programmersforum.ru . . ** Canvas BufPic X= 0 Y = 0, BufPic X= i * 66 Y = 0, BufPic. 66 . i (0 1, 1 2-). *** .01A. DELPHI WinAPI C++ , , Borland C++, MFC VCL, - , . : , .cpp? . - API. by ds.Dante www.programmersforum.ru Windows API (application programming interfaces) - , Windows Windows NT . Windows... , ( ), (API). : , , . . APIWinAPI , , Windows, , - MFC (Microsoft Visual C++) VCL (Borland Delphi / C++ Builder). , , , . , (- ) . , - , MFC. : , , , y = sin (x + t). , , . - , , . , , (. ):01B. #define WIN32_LEAN_AND_MEAN #include #include LRESULT CALLBACK WindowProc (HWND, UINT, WPARAM, LPARAM); HDC dc; int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { // Create window WNDCLASS wc = {0}; wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = WindowProc; wc.hInstance = hInstance; wc.hCursor = LoadCursor (NULL, IDC_ARROW); wc.lpszClassName= L"CMyWnd"; RegisterClass (&wc); HWND hWnd = CreateWindow (L"CMyWnd", L"WinMain sample", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, 320, 240, NULL, NULL, hInstance, NULL); dc = GetDC (hWnd); ShowWindow (hWnd, nCmdShow); // Message loop (timer, etc) SetTimer (hWnd, 1, USER_TIMER_MINIMUM, NULL); MSG msg; while (GetMessage(&msg,NULL,0,0) > 0) // while not WM_QUIT (0) // nor some error (-1) { TranslateMessage (&msg); DispatchMessage (&msg); } return msg.wParam; } // Message processing function LRESULT CALLBACK WindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static bool Move = true; static int Phase=0, Width, Height; switch (message) { case WM_LBUTTONDOWN: case WM_RBUTTONDOWN:01C. Move = !Move; // no break case WM_TIMER: if (Move) Phase++; // no break else break; case WM_PAINT: Rectangle (dc, -1, -1, Width+1, Height+1); MoveToEx (dc, 0, Height * (0.5 + 0.3*sin(0.1*Phase)), NULL); for (int i=0; i signoise then begin signoise:= bpf[i]; k:= i end end;026. // ========================================================================= // // ========================================================================= nn:= 0; re := 0; druc:= 1000; for i:= 10 to nf div 25 do begin if i < k10 then begin re:= re + bpf[i] * bpf[i]; inc(nn); if druc < bpf[i] then druc:= bpf[i] end; if i > k+10 then begin re:= re + bpf[i] * bpf[i]; inc(nn); if druc < bpf[i] then druc:= bpf[i] end end; re:= sqrt(re/nn); // ========================================================================= // // ========================================================================= for i:=0 to ceil(nf/21) do series3.Addy(re, '', clred); end; , . , . ( ) (. .5 6):. 5. . REALTIME. 6. , , :), . ? , COM WinLirc, USB.IR , . . . 027 , . USB.IR , [4], (. 5): USB 5 procedure tform1.ic(i: integer); begin case i of // 1: image1.OnClick(nil); // 2: image2.OnClick(nil); // WAV/MP3 3: image3.OnClick(nil); // / 4: image4.OnClick(nil); // 5: image5.OnClick(nil); // 6: image6.OnClick(nil) // end end; // ========================================================================== // 1, 2, 3, 4, 5, 6 SR003 // ========================================================================== var remote: array[0..5] of string = ( '120813070707130812080607060706080905071406140712', '13071407130805081307060813070607130806070607140706 071308060712', '13081307130813071307070706070608050806070607060806 071308120811', '13081208130713081308060713080508060706070607060805 081307060814', '13081207060706071408050805080508130706081307130806 081207140712', '14071307060706080607130813070608050806071407130713 080607060712'); procedure TForm1.tuTimer(Sender: TObject); var i: integer; s: string; p: boolean; j,k,z: smallint; begin // ========================================================================== // USB () // ========================================================================== if (GetInfraCode('ra_usb') = 1) then Exit; if DataLength = 0 then Exit; for i:= 0 to DataLength1 do begin s:= s + inttohex(InputInfraData[i], 2); if i DataLength1 then s:= s + '' end;028. // ======================================================================= // // // ======================================================================= for i:=1 to 6 do for z:= 0 to DataLength1 do if (strtoint('$'+copy(s,(z*3)+1,2))dover >= strtoint('$'+copy(remote[i],(z*3)+1,2)))or (strtoint('$'+copy(remote[i],(z*3)+1,2))