program PatternFrmDesignStudy_Weather_Report476_Station; //======================================================================== // free for all(o) 2003 - 2022, Max Kleiner - still on progress! // sample application for the book Delphi Design Patterns // proofed by IBZ and BFH V 4.2, #locs:2581 // add weather description, one day temp forecast model, V 4.6 // #sign:Max: MAXBOX10: 07/04/2022 13:05:31 // update coord and mapbox latitude longitude // controls & lists external files, #sign>Max: MAXBOX10: 07/04/2022 13:05:31 // ex.: if Text = 'MVC' then test: ushuaia, ar // toogleview_orfile('boldmain.pas'); utf8tostring WeatherREX2 // V4.7 with forecast endpoint: /forecast V4.71 bugfix of REGEX temp_min_max // https://map.worldweatheronline.com/ // V4.7.2 change mapbox.streets-satellite to mapbox.satellite for png // V4.7.3 a list of predictions for 5 days - each 3 hours forecast! _1615 // V4.7.4 graph of weather forecast + residual/regression fit of target temp. //#TODO: forecast update+3, graph normalize days + legend, check errorbars //======================================================================== //{$UNDEF PATTERNS} {$DEFINE PATTERNS} (*interface uses Windows, Messages, SysUtils, Classes, Controls, Forms, Dialogs, Menus, ImgList, ExtCtrls, uStrategy, IVCLScanner1, Grids, ComCtrls, StdCtrls, OleCtrls, ToolWin; type TmainForm1 = class(TForm) StatusBar1: TStatusBar; MainMenu1: TMainMenu; Datei1: TMenuItem; Beenden1: TMenuItem; CoolBar1: TCoolBar; ToolBar1: TToolBar; tbtnClose: TToolButton; ImageList1: TImageList; ImageList2: TImageList; tbtnGenerator: TToolButton; ImageList3: TImageList; tbtnOptions: TToolButton; Generator: TMenuItem; mnEncrypt: TMenuItem; mnDecrypt: TMenuItem; progBar: TProgressBar; TreeView1: TTreeView; Splitter1: TSplitter; view: TListView; info1: TMenuItem; Fractals: TMenuItem; options: TMenuItem; MATestCase1: TMenuItem; tbtnTrans: TToolButton; mnOpentree: TMenuItem; mnSearch: TMenuItem; mnRegistryReader: TMenuItem; procedure tbtnCloseClick(Sender: TObject); procedure tbtnOptionsClick(Sender: TObject); procedure mnEncryptClick(Sender: TObject); procedure mnDecryptClick(Sender: TObject); procedure TreeView1Change(Sender: TObject; Node: TTreeNode); procedure FractalsClick(Sender: TObject); procedure MovingAverage1Click(Sender: TObject); procedure MATestCase1Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure tbtnTransClick(Sender: TObject); procedure mnOpentreeClick(Sender: TObject); procedure info1Click(Sender: TObject); procedure mnSearchClick(Sender: TObject); procedure dlgSearchFind(Sender: TObject); procedure viewClick(Sender: TObject); //procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private-Deklarationen} FRegCharges: TChargeContext; FPrefCharges: TChargeContext; FTrialCharges: TChargeContext; memMon: TMemo; frmMon: TForm; dlgSearch: TFindDialog; ws_url: string[255]; {$IFDEF PATTERNS} myWS: IVCLScanner; myFac: T_RIOFactory; {$ENDIF} procedure scanFile_orStream(myFile: string); procedure FindDlgClose(Sender: TObject; var action: TCloseaction); procedure Mem2Close(Sender: TObject); function OpenRead(myfile: String) : String; procedure parseReg(regKey: string; rootKey: byte); procedure toogleView_orFile(ufile: string); public ListItem: TListItem; //cause of chartview callback end; } var mainForm1: TmainForm1; Win32Platform: integer =2; implementation uses ulooktrans, usingletonF, uFilexport, fchaos, registry, uCrypto, graphics, chartView; *) //{$R *.DFM} procedure parseReg(regKey: string; rootKey:byte); forward; function ListView_SetTextColor(hwnd: HWND; clrText: TColorRef): Bool; forward; function FindDesktopWindow: HWND; forward; function IsDesktopTransparent: Boolean; forward; procedure SetDesktopIconColor(Foreground,Background: TColor; Trans:Boolean); forward; procedure SetImageTemperatur(alistitem: Tlistitem); forward; procedure SetImageTemperaturPredict(alistitem: Tlistitem; aicon: string); forward; procedure TFrm_UpdateClick(Sender: TObject); forward; Procedure sunrisesetRouter(lon, lat: float); forward; function GetGeoInfoMap4save(const lat,lon, zoom: double; asize: integer; const UrlGeoLookupInfo, apath: string): string; forward; Procedure loadPredictForm; forward; var StatusBar1: TStatusBar; MainMenu1: TMainMenu; Datei1: TMenuItem; ImageList1: TCustomImageList; ImageList2: TCustomImageList; tbtnGenerator: TToolButton; Generator: TMenuItem; progBar: TProgressBar; TreeView1: TTreeView; Splitter1: TSplitter; view, pview: TListView; ImageList4: TImageList; ImageList5: TImageList; Fractals: TMenuItem; options: TMenuItem; // MATestCase1: TMenuItem; tbtnTrans: TToolButton; mnOpentree: TMenuItem; //T1: TMenuItem; memMon: TMemo; frmMon: TForm; mem2: TMemo; dlgSearch: TFindDialog; ws_url: string; {$IFDEF PATTERNS} myWS: IVCLScanner; //myFac: T_RIOFactory; {$ENDIF} ListItem, listitem2: TListItem; mainForm1: TForm; myEdit: TEdit; statBar1, statbar2: TStatusBar; //statbar2 for forecast selectFile: string; hh,mm: word; ss,ms: Word; //mem2: TMemo; //dlgSearch: TFindDialog; //ws_url: string; asock: TCustomSocket; //TClientSocket; // TServerSocket; actlocation: string; var ageofrm: TForm; zoomf, latf, lonf: double; const LVM_FIRST = $1000; const LVM_SETCOLUMNWIDTH = LVM_FIRST + 30; LVM_SETTEXTCOLOR = LVM_FIRST + 36; LVM_GETTEXTBKCOLOR = LVM_FIRST + 37; LVM_SETTEXTBKCOLOR = LVM_FIRST + 38; LVM_REDRAWITEMS = LVM_FIRST + 21; LVM_GETITEMCOUNT = LVM_FIRST + 4; COLOR_DESKTOP = 1; COLOR_MAX = 15; {@To get access weather API you need own API key whatever account you chose!!} UrlWeatherReport25= 'http://api.openweathermap.org/data/2.5/weather?q=%s&units=metric&APPID'+ '=55013bf3d09cfb0619989a00ed5bed09'; UrlWeatherReport25_Forecast= 'http://api.openweathermap.org/data/2.5/forecast?q=%s&units=metric&APPID'+ '=55013bf3d09cfb0619989a00ed5bed09'; //http://api.openweathermap.org/data/2.5/forecast?q=bern&units=metric&APPID=55013bf3d09cfb0619989a00ed5bed09 mapboxAPIEKON21_test= 'https://api.mapbox.com/geocoding/v5/mapbox.places/%s.json?country=%s'+ '&access_token=pk.eyJ1IjoibWF4Ym94IiwiYSI6ImNpdjltZG5vdjAwMGsyemw1b3dpcGxkdWQifQ.ZUbdigkLmcLcX0cCQsds-A'; // mapboxAPIEKON21= 'https://api.mapbox.com/v4/mapbox.satellite // $ curl -g "https://api.mapbox.com/styles/v1/mapbox/streets-v11/static/0,0,2/600x600?access_token=YOUR_MAPBOX_ACCESS_TOKEN" --output example- //mapboxAPIEKON21= 'https://api.mapbox.com/v4/mapbox.satellite/%.2f,%.2f,%.2f,0,0/%dx%d.png128?access_token=pk.eyJ1IjoibWF4Ym94IiwiYSI6ImNpdjltZG5vdjAwMGsyemw1b3dpcGxkdWQifQ.ZUbdigkLmcLcX0cCQsds-A'; mapboxAPIEKON21= 'https://api.mapbox.com/v4/mapbox.satellite/%.2f,%.2f,%.2f,0,0/%dx%d.png128?access_token=pk.eyJ1IjoibWF4Ym94IiwiYSI6ImNrcHdmb3FpcjAxYzcyb25wcXl6dXUxb2oifQ.bRvYgMc2i_D2sk-lARkR_Q'; {Imagery sources Mapbox Satellite imagery comes from a variety of sources depending on zoom level and geographic availability: Zoom levels 0–8 use de-clouded data from NASA MODIS satellites. Zoom levels 9–12 use primarily Maxar satellite imagery and NASA/USGS Landsat 5 & 7 imagery in limited locations. Zoom levels 13+ use a combination of open and proprietary sources, including Maxar's Vivid product for most of the world, Nearmap aerial imagery over US cities, and open aerial imagery from Denmark, France, Germany and other regions.} const WeatherREX = //test: '.*Äàòà\s*Êó?ñ\s*Êó?ñ ïîê.\s*Êó?ñ ï?îä.\s*Êóðñ íà?[^<\d]*' // kairo ---> Al ‘Atabah ----> [\w\s‘] //'"temp":([\d\.]+).*"pressure":([0-9]+).*"humidity":([0-9]+).*"name":"([\w]+)"'; '"id":([\w]+).*"main":"([\w\s]+)".*"description":"([\w\s]+)".*"temp":([\d\.\-]+).*"pressure":([0-9]+).*'+'"humidity":([0-9]+).*"temp_min":([\d\.\-]+).*"temp_max":([\d\.\-]+).*"country":"([\w\s]+).*"name":"([\w\s‘äöü]+)"'; WeatherREX2 = '"id":([\w]+).*"main":"([\w\s]+)".*"description":"([\w\s]+)".*"temp":([\d\.\-]+).*'+ '"temp_min":([\d\.\-]+).*"temp_max":([\d\.\-]+).*'+ //5+6 '"pressure":([0-9]+).*'+ //7 '"humidity":([0-9]+).*'+ //8 '"country":"([\w\s]+).*"name":"([\w\s‘äöü]+)"'; //9+10 // forecast city, time, temp, bar, humid, description: string; WeatherREX2Predict = '"id":([\w]+).*"main":"([\w\s]+)".*"description":"([\w\s]+)".*"temp":([\d\.\-]+).*'+ '"pressure":([0-9]+).*'+ //7 '"humidity":([0-9]+).*'+ //8 '"country":"([\w\s]+).*"name":"([\w\s‘äöü]+)"'; //9+10 //'"temp":([\d\.-]+).*"pressure":([0-9]+).*"humidity":([0-9]+).*"country":"([\w\s]+).*'+ { '"id":([\w]+).*"main":"([\w\s]+)".*"temp":([\d\.\-]+).*"pressure":([0-9]+).*'+ '"humidity":([0-9]+).*"country":"([\w\s]+).*"name":"([\w\s‘]+)"'; } //.*"description":"([\w\s]+)"'; //.*"id":([\w]+)"'; Const GEOCoordREX = '"lon":([\d\.-]+).*,"lat":([\d\.-]+).*'; jsonstr= 'GEO_Weather_Report: {"coord":{"lon":14.16,"lat":46.62},"weather":[{"id":501,"main":"Rain","description":"moderate rain","icon":"10d"}],"base":"cmc stations","main":{"temp":19.93,"pressure":1009,"humidity":64,"temp_min":17,"temp_max":21.67},"wind":{"speed":2.6,"deg":200},"rain":{"1h":1.17},"clouds":{"all":75},"dt":1439818945,"sys":{"type":1,"id":5931,"message":0.0042,"country":"AT","sunrise":1439784246,"sunset":1439834986},"id":2771894,"name":"Maria Worth","cod":200}'; //problem {"type":1,"id":6392,"message":0.0034,"country":"EG","sunrise":1495076362,"sunset":1495125834},"id":7922173,"name":"Al ‘Atabah","cod":200} jsonip= 'MyPublicIP: { '+ '"ip": "188.60.54.133",'+ '"hostname": "133.54.60.188.dynamic.wline.res.cust.swisscom.ch",'+ '"city": "Lausanne",'+ '"region": "Vaud",'+ '"country": "CH",'+ '"loc": "46.5200,6.6300",'+ '"org": "AS3303 Swisscom (Switzerland) Ltd",'+ '"postal": "1003"}'; type Tweatherrex = record city, country, temp, bar, humid, line, descript, description, id, time, coord, tempmin, tempmax: string; end; type Tweatherpredict = record city, time, temp, bar, humid, description: string; end; var wrec: Tweatherrex; wpred: Tweatherpredict; function GEOCoord2Point(apistr: string): TFloatPoint; begin setdecimalseparator('.') with TRegExpr.Create do try writeln('api2point '+apistr) Expression:= GEOCoordREX; //writeln(match[1]) if Exec(apistr) then begin result.x:= strtofloat(Match[1]) result.y:= strtofloat(Match[2]) //writeln('found') end; finally Free; end; end; procedure getMultipleWeather(apistr: string); var latf, lonf: double; begin latf:= GEOCoord2Point(apistr).y lonf:= GEOCoord2Point(apistr).x writeln('Coord of '+actlocation +' : ' +floattostr(latf)+' '+floattostr(lonf)); with TRegExpr.Create do try Expression:= weatherREX2; //apistr:= UTF8ToString(apistr) writeln('new test '+apistr) //showmessage(apistr) if Exec(apistr) then begin PrintF('Weather Id:%s is %s in: %s at %s° of %s pressure with %s humid', [Match[1],Match[2],Match[10],Match[4],Match[7],Match[8]+'%']); //showmessage(match[2]) wrec.id:= match[1]; wrec.descript:= match[2]; wrec.description:= match[3] wrec.temp:= match[4]; wrec.tempmin:= match[5]; wrec.tempmax:= match[6]; wrec.bar:= match[7]; wrec.humid:= match[8]; wrec.country:= match[9]; wrec.city:= match[10]; wrec.line:= Format('WeatherId:%s is %s in: %s at %s of %s pressure with %s humid', [Match[1],Match[2],Match[10],Match[4],Match[7],Match[8]+'%']) wrec.coord:= floattostr(latf)+'° '+floattostr(lonf); //sunrisesetRouter(lonf,latf) //showmessage(wrec.line) end else showmessage('REGEX apistr not Executed'); except showmessage(ExceptionToString(ExceptionType, ExceptionParam)); finally Free; end; end; procedure getMultipleWeatherForecast(apistr: string); begin with TRegExpr.Create do try Expression:= weatherREX2Predict; //apistr:= UTF8ToString(apistr) //showmessage(apistr) if Exec(apistr) then begin PrintF('Weather Id:%s is %s in: %s at %s° of %s pressure with %s humid', [Match[1],Match[2],Match[3],Match[4],Match[5],Match[6]+'%']); //showmessage(match[2]) wpred.city:= match[1]; wpred.description:= match[2]; wpred.temp:= match[3]; wpred.bar:= match[4]; wpred.humid:= match[5]; //sunrisesetRouter(lonf,latf) //showmessage(wrec.line) end else showmessage('REGEX Forecast apistr not Executed'); except showmessage(ExceptionToString(ExceptionType, ExceptionParam)); finally Free; end; end; //https://www.weather-forecast.com/locations/Berne/forecasts/latest procedure AddlistItem(Item: TListItem); var anum: float; begin with Item do begin Caption:= wrec.id+' '+wrec.city+' :'+wrec.country; SubItems.Add(wrec.temp+'° hPa: '+wrec.bar+' humid: ' +wrec.humid+'% '+'at '+wrec.coord); SubItems.Add(wrec.description); //showmessage(wrec.id) anum:=StrToFloat(copy(wrec.temp, 1, 2)); anum:= anum / 2 // check for minus sign - anum:= ((strtofloat(wrec.tempmax) + strtofloat(wrec.tempmin))/2) SubItems.Add(floattoStr(anum)); end; end; procedure AddlistItemPredict(Item: TListItem); var anum: float; begin with Item do begin Caption:=' '+wpred.city+' :'; SubItems.Add(wpred.temp+'° hPa: '+wpred.bar+' humid: ' +wpred.humid+'% '); SubItems.Add(wpred.description); //showmessage(wrec.id) anum:=StrToFloat(copy(wpred.temp, 1, 2)); anum:= anum / 2 // check for minus sign - //anum:= ((strtofloat(wrec.tempmax) + strtofloat(wrec.tempmin))/2) SubItems.Add(floattoStr(anum)); end; end; function FindDesktopWindow: HWND; var Window: HWND; begin Window := FindWindow('Progman','Program Manager'); Window := FindWindowEx(Window,0,'SHELLDLL_DefView',''); Window := FindWindowEx(Window,0,'SysListView32',''); Result := Window; end; function ListView_GetTextBkColor(hwnd: HWND): TColorRef; begin Result := SendMessage(hwnd, LVM_GETTEXTBKCOLOR, 0, 0); end; function ListView_SetTextBkColor(hwnd: HWND; clrTextBk: TColorRef): Bool; begin Result := Bool( SendMessage(hwnd, LVM_SETTEXTBKCOLOR, 0, clrTextBk) ); end; function ListView_RedrawItems(hwndLV: HWND; iFirst, iLast: Integer): Bool; begin Result := Bool( SendMessage(hwndLV, LVM_REDRAWITEMS, iFirst, iLast) ); end; function ListView_GetItemCount(hWnd: HWND): Integer; begin Result := SendMessage(hWnd, LVM_GETITEMCOUNT, 0, 0); end; function IsDesktopTransparent: Boolean; var BkColor: COLORREF; begin BkColor:= ListView_GetTextBkColor(FindDesktopWindow); if BkColor <> $FFFFFFFF then Result:= False else Result:= True; end; procedure SetDesktopIconColor(Foreground, Background: TColor; Trans: Boolean); var Window: HWND; begin Window := FindDesktopWindow; if Trans = True then ListView_SetTextBkColor(Window,$FFFFFFFF) else ListView_SetTextBkColor(Window,Background); ListView_SetTextColor(Window, Foreground); ListView_RedrawItems(Window,0,ListView_GetItemCount(Window) - 1); UpdateWindow(Window); end; procedure TFrm_FormCreate(Sender: TObject); begin tbtnTrans.Enabled:=false; //FRegCharges:= TMonthlyCharges.Create(TRegularCharge.Create); //FPrefCharges:= TMonthlyCharges.Create(TPreferredCharge.Create); //FTrialCharges:= TMonthlyCharges.Create(TTrialCharge.Create); //frmChart:=TfrmChart.create(self); self.Visible:=true; self.Height:= 550; self.ClientHeight:= 500; self.Width:= 765; self.ClientWidth:= 755; end; procedure TFrm_FormActivate(Sender: TObject); begin self.Caption:='Delphi Python Design Patterns'; progBar.visible:= false; statusbar1.simplepanel:= true; //statusbar2.simplepanel:= true; //trans.strlit[19]; statusBar1.SimpleText:='max@kleiner.com'; end; procedure TFrm_FormDestroy(Sender: TObject); begin //frmChart.release; messagebeep(0); //FRegCharges.Free; //FPrefCharges.Free; //FTrialCharges.Free; //mem2.Free; end; procedure TFrm_mnEncryptClick(Sender: TObject); var //myCrypt: TCryptoDecorator2; od1: TOpenDialog; step, size: Longint; passB: integer; psStr: string; crMode: byte; F, F1: TextFile; begin if TMenuItem(sender).Name = 'mnDecrypt' then crMode:= 2 else crMode:= 1; //myCrypt:= TCryptoDecorator2.create(TCrypto.create); od1:= TOpenDialog.Create(NIL); step:= 0; //psStr:= InputBox(trans.strLit[2], trans.strlit[3], ''); //trans.password:= psStr; if psStr = '' then begin //messagedlg(trans.strlit[4], mtError, [mbOk], 0); exit; end; od1.execute; try passB:= strToInt(psStr); if length(od1.FileName) < 1 then //messagedlg(trans.strlit[5],mtError,[mbOk], 0) else begin AssignFile(F, OD1.FileName); Reset(F); //fHandle:= FileOpen(Od1.FileName, 2); //Size:= filesize(F); with progbar do begin visible:= True; Min:= 0; Max:= Size; Step:= 1; //color end; if crMode = 1 then begin //more performance without progbar AssignFile(F1, 'chiffrat.txt'); Rewrite(F1); //while not EOF(F) do begin while not EOF do begin //7readln(F,dataStr); //chiffr:= myCrypt.encrypt1(passB, dataStr, step); //if trans.cbcrypt.checked then progBar.StepIt; //writeln(F1, chiffr); end; //messagedlg(trans.strlit[6], mtInformation, [mbOk], 0) end else if crMode = 2 then begin AssignFile(F1, 'clear.txt'); Rewrite(F1); while not EOF do begin //readln(F,dataStr); //7chiffr:= myCrypt.decrypt1(passB, dataStr, step); //writeln(F1, chiffr); //append(F1); end; //messagedlg(trans.strlit[7], mtInformation, [mbOk], 0); end; //crMode end; //filename finally flush(F1); //myCrypt.Free; od1.Free; closeFile(F); closeFile(F1); progbar.Visible:= False; end; end; function TFrm_OpenRead(myfile: String) : String; var f: TextFile; content, row: string; begin content:= ''; if fileexists(myfile) then begin Assignfile(f, myfile); Reset(f); while not eof do begin //ReadLn(F, row); content:= content + row + chr(13); end; CloseFile(F); Result := content; end else //Result := trans.strlit[5]; end; procedure TFrm_scanFile_orStream(myFile: string); var Tempstr, cont: String; position: integer; begin //mem2close(NIL); with view do begin //ListItem if fileexists(myFile) then cont:= TFrm_openRead(myFile) else cont:= myfile; position:= pos(chr(13), cont); if (position = 0) and (length(trim(cont)) > 0) then begin ListItem:= Items.Add; ListItem.Caption := cont; exit end; while position > 0 do begin TempStr:= cont; delete(TempStr, position, length(TempStr) - position + 1); delete(cont, 1, position); ListItem:= Items.Add; ListItem.Caption := TempStr; position:= pos(chr(13), cont); end; end; end; procedure TFrm_toogleView_orFile(ufile: string); begin if not assigned(mem2) then begin mem2:= TMemo.Create(application); //if q.loadFromStreamFile('patterns.dsm',aStream) then mem2.parent:= view; mem2.Align:= alclient; mem2.Font.Size:= 12; //mem2.OnDblClick:= mem2Close; //mem2.lines.LoadFromStream(aStream); end; if fileexists(uFile) then mem2.lines.LoadFromFile(ufile) else begin mem2.Clear; mem2.Lines.add(ufile); end; mem2.Show; end; procedure TFrm_Mem2Close(Sender: TObject); begin if assigned(mem2) then begin mem2.clear; mem2.Parent:= NIL; mem2:= NIL; mem2.Free; end; end; procedure TFrm_TreeView1Change(Sender: TObject; Node: TTreeNode); (*const //array of critical files just to test sProgs: array[0..3, 0..1] of ShortString = ( ('Passwort.ini', 'T-Online Passwörter'), ('Cis.ini', 'CompuServe Passwortdatei'), ('Services', 'Port-Eintraege zu TCP/IP'), ('Sam','Sicherheits-Eintraege')); *) //aStream: TMemoryStream; //q: TTxtFile; begin view.Items.Clear; //****************start treeview events******************** with Treeview1.selected do begin if Text = 'OCL' then TFrm_scanFile_orStream('ocl_facts.txt'); if Text = 'Delegation' then TFrm_scanFile_orStream('delegate.txt'); if Text = 'Refactoring' then TFrm_scanFile_orStream('refactoring.txt'); if Text = 'Redesign' then TFrm_scanFile_orStream('redesign.txt'); if Text = 'DUnit' then TFrm_scanFile_orStream('algorithms.pas'); if Text = 'NUnit' then TFrm_scanFile_orStream('nunit.txt'); if Text = 'Interfaces' then TFrm_toogleview_orfile('IVCLScanner1.pas'); if Text = 'Lists' then TFrm_toogleview_orfile('listCollect.pas'); if Text = 'Singleton' then begin TFrm_toogleview_orfile('uSingletonF.pas'); //SingleKeeper.Show; end; if Text = 'SingletonAlt' then //TSingletonForm.Instance.Show; if Text = 'Observer' then begin //SingleKeeper.Show; TFrm_toogleview_orfile('uObserver.pas'); end; if Text = 'Template' then begin //mem2close(sender); //TFrm_scanFile_orStream(trans.executeTemplate.strings[0]); //trans.executeTemplate.Free end; if Text = 'Strategy' then with view do begin //simulating client using Strategy context object //mem2close(sender); Clear; listItem:= Items.Add; //listItem.Caption:= (trans.strlit[16]); listItem:= Items.Add; //listItem.Caption:= // Format('Regular %m',[FRegCharges.CompCharges(1000)]); listItem:= Items.Add; listItem:= Items.Add; //listItem.Caption:= // Format('Trial %m',[FTrialCharges.CompCharges(1000)]); end; if Text = 'Lock' then begin //transMonitor.createTrans(NIL); //class instance statusBar1.SimpleText:='running trans in button'; tbtnTrans.Enabled:=not(tbtnTrans.Enabled); //toogle button TFrm_toogleview_orfile('ulooktrans.pas'); end; if Text = 'Abstract' then //toogleview_orfile('abstfact.htm'); if Text = 'Builder' then TFrm_toogleview_orfile('uSingletonF.pas'); if Text = 'Factory' then TFrm_toogleview_orfile('uObserver.pas'); if Text = 'Adapter' then TFrm_toogleview_orfile('uObserver.pas'); if Text = 'Bridge' then TFrm_toogleview_orfile('uFilexport.pas'); if Text = 'Composite' then TFrm_toogleview_orfile('u_Composition.pas'); if Text = 'Decorator' then TFrm_toogleview_orfile('uCrypto.pas'); if Text = 'Facade' then TFrm_toogleview_orfile('marshall.pas'); if Text = 'Flyweight' then TFrm_toogleview_orfile('uStrategy.pas'); if Text = 'Proxy' then TFrm_toogleview_orfile('IVCLScanner1.pas'); if Text = 'Wrapper' then TFrm_toogleview_orfile('uFilexport.pas'); if Text = 'Chain' then TFrm_toogleview_orfile('ulooktrans.pas'); if Text = 'Command' then begin TFrm_toogleview_orfile('uStrategy.pas'); //TFrmChaos.getFrmInstance.Show; end; if Text = 'Interpreter' then TFrm_toogleview_orfile('patternFrm.pas'); if Text = 'Iterator' then TFrm_toogleview_orfile('iterator.txt'); if Text = 'Mediator' then TFrm_toogleview_orfile('uFilexport.pas'); if Text = 'Memento' then TFrm_toogleview_orfile('Graphics.pas'); if Text = 'State' then TFrm_toogleview_orfile('foerderband.pas'); if Text = 'Visitor' then TFrm_toogleview_orfile('RND.pas'); if Text = 'Automation' then TFrm_toogleview_orfile('i2c.pas'); if Text = 'Broker' then begin TFrm_toogleview_orfile('IVCLScanner1.pas'); //like an abstract factory in HTTPRIO //ws_url:=WSURL1; {$IFDEF PATTERNS} //myWS:= myFac.GetIVCLScanner(false, ws_url); //myWS.PostUser(trans.strlit[19], trans.strlit[14], 'mix') {$ENDIF} end; if Text = 'Container' then TFrm_toogleview_orfile('income.dpr'); if Text = 'Layers' then TFrm_toogleview_orfile('banklogic.pas'); if Text = 'Master-Slave' then TFrm_toogleview_orfile('sortThds.pas'); if Text = 'Microkernel' then TFrm_toogleview_orfile('shellConsts.pas'); if Text = 'Monitor' then TFrm_toogleview_orfile('chartView.pas'); if Text = 'MVC' then TFrm_toogleview_orfile('boldmain.pas'); if Text = 'PAC' then TFrm_toogleview_orfile('boldbase.pas'); if Text = 'Prototyp' then TFrm_toogleview_orfile('testmodules.pas'); if Text = 'Provider' then TFrm_toogleview_orfile('DMU.pas'); if Text = 'Simulator' then TFrm_toogleview_orfile('RND.pas'); if Text = 'Terminal-Server' then TFrm_toogleview_orfile('fterminal.pas'); if Text = 'Transaction' then TFrm_toogleview_orfile('u_dwsserver1.pas'); if Text = 'Watchdog' then TFrm_toogleview_orfile('monForm.pas'); end; //with end; //treeview procedure TFrm_mnOpentreeClick(Sender: TObject); begin with mnOpenTree do begin if tag=0 then begin treeview1.FullExpand; //Caption:=trans.strlit[21]; tag:=1 end else begin treeview1.FullCollapse; //mnOpenTree.Caption:=trans.strlit[22]; tag:=0; end; end end; procedure TFrm_color1Click(Sender: TObject); begin writeln(itoa(TColorbox(sender).selected)); writeln(ColorToString(TColorbox(sender).selected)); ListView_SetTextColor(view.Handle,TColorbox(sender).selected) //statusBar1.SimpleText:=trans.strlit[19]; end; procedure TFrm_FindDlgClose(Sender: TObject; var action: TcloseAction); begin dlgSearch.CloseDialog; dlgSearch:= NIL; dlgSearch.Free; end; procedure TFrm_mnSearchClick(Sender: TObject); var aTop: TPoint; begin if not assigned(dlgsearch) then begin dlgSearch:= TFindDialog.Create(self); frmMon:= TForm.create(dlgSearch); memMon:= TMemo.create(frmMon); //frmMon.canvas with mainForm1 do begin aTop.y:=Top; aTop.x:=Left; end; try //dlgSearch.OnFind:= @TFrm_dlgSearchfind; frmMon.OnClose:= @TFrm_findDlgClose; //on destroy frmMon.Parent:= self; memMon.parent:= frmMon; memMon.setbounds(10,10,290,190); //frmMon.caption:=trans.strLit[14]; with frmMon do begin //top:=ATop.y + view.Top + toolbar1.Height + 12; left:=ATop.x + view.left + 6; show; end; dlgSearch.Execute finally //memMon:=NIL; //frmMon.Release; end; end else exit end; procedure TFrm_r1Click(Sender: TObject); begin parseReg('SOFTWARE\Microsoft\Windows\CurrentVersion\Run',1);// end; procedure TFrm_r2Click(Sender: TObject); begin parseReg('SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce',1); end; procedure TFrm_R3Click(Sender: TObject); begin parseReg('SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx',1); end; procedure TFrm_R4Click(Sender: TObject); begin parseReg('SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices',1); end; procedure TFrm_R5Click(Sender: TObject); begin parseReg('SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesOnce',1) end; procedure TFrm_T1Click(Sender: TObject); begin parseReg('Software\Microsoft\Internet Explorer\TypedURLs',2);// end; procedure parseReg(regKey: string; rootKey:byte); var reg: TRegistry; mySV: TStringList; keyContent: string; i: integer; begin reg:= TRegistry.create; try case rootKey of 1:reg.RootKey:= HKEY_LOCAL_MACHINE; 2:reg.RootKey:= HKEY_CURRENT_USER; end; if reg.OpenKey(regKey, false) then begin mySV:= TStringList.Create; view.Items.Clear; try //reg.GetKeyNames(mySK); //returns keys! reg.GetValueNames(mySV); for i:= 0 to mySV.Count - 1 do begin keyContent:= mySv.Strings[i]; ListItem:= view.Items.Add; ListItem.Caption:= keyContent +'/ '+ reg.ReadString(keyContent); //ListItem.Subitems.Add(reg.ReadString(keyContent)); end; finally mySV.Free; end; reg.CloseKey; end;// if finally reg.Free; end; end; (*procedure TFrm_viewClick(Sender: TObject); var cycle: byte; fname: string; begin with View do begin if frmchart.optimise then begin frmchart.SetFocus; frmchart.Timer1.Enabled:= false; cycle:= strToint(copy(selected.Caption,1,2)) ; frmchart.drawListChart(cycle); end; if frmchart.optimiseall then begin frmchart.SetFocus; frmchart.Timer1.Enabled:= false; fname:= copy(selected.caption,1,pos(':',selected.Caption)); frmchart.loadChartDirect(fname); end; end; end; *) CONST AExponent = 4; ANIMATEDELAY = 4; var distX, distY, glx,gly, step, pct: float; endX, endY, beginX, beginY: integer; FPicRed, FStorage: TBitMap; FNewRect: TRect; FOldRect: tRect; //make foldrect local! FirstTime: boolean; procedure setupAnimation(); begin //FNewRect: TRect; //FOldRect: tRect; //make foldrect local! //FirstTime: boolean; FPicRed:= TBitMap.Create; FPicRed.transparent:= true; FStorage:= TBitMap.Create; FStorage.Width:= FPicred.Width; FStorage.Height:= FPicred.Height; Screen.Cursor:= crCross;//loadCursor(hinstance,'Pan_All'); //crCross; //FPicRed.LoadFromFile(Exepath+'\examples\images\red1.bmp'); beginX:= 20; // Initial x-coordinate beginY:= 20; // Initial y-coordinate endX:= 470; // Final x-coordinate endY:= 320; // Final y-coordinate glx:= 20.0; // Current x-coordinate gly:= 20.0; // Current y-coordinate step:= 0.01; // Size of each step along the path 100 steps pct:= 0.0; // Percentage traveled (0.0 to 1.0) distX:= endX - beginX; distY:= endY - beginY; end; var aFrm, aPfrm: TForm; // statBar1: TStatusBar; procedure drawE2(abeginx, abeginy, endx, endy: integer); var i: integer; begin pct:= 0.0; distX:= endX - beginX; distY:= endY - beginY; for i:= 1 to 100 do begin pct:= pct+ step; if (pct < 1.0) then begin glx:= beginX + (pct * distX); gly:= beginY + (power(pct, AExponent+5) * distY); end; afrm.repaint; afrm.canvas.draw(round(glx)-20,round(gly-20), fPicRed); delay(ANIMATEDELAY); end; end; procedure TRebWizForm_ExamineDir; var FileList: TStrings; I: Integer; CurrDir: string; FileListBox1: TFileListBox; listboxfiles: TListbox; begin // examining .dpr files FileListBox1.Mask := '*.dpr'; FileListBox1.FileType := [ftNormal]; FileList := TStringList.Create; try FileList.Assign(FileListBox1.Items); // for each file, add its path to the list for I := 0 to FileList.Count - 1 do begin ListBoxFiles.Items.Add (FileListbox1.Directory + '\' + FileList[I]); end; // examine sub directorties FileListBox1.Mask := '*.*'; FileListBox1.FileType := [ftDirectory]; FileList.Assign(FileListBox1.Items); CurrDir := FileListbox1.Directory; // for each dir re-examine... for I := 2 to FileList.Count - 1 do begin FileListbox1.Directory := CurrDir + '\' + Copy (FileList[I], 2, Length (FileList [I]) - 2); TRebWizForm_ExamineDir; end; FileListbox1.Directory := CurrDir; finally FileList.Free; end; end; function GetGeoWeather(const location: string; const UrlRestAPI: string): string; var lHTTP: TIdHTTP; lStream: TStringStream; asyn: TSynwInfo; //dl: TDownloadURL; begin lHTTP:= TIdHTTP.Create(NIL); lStream:= TStringStream.Create(''); try try lHTTP.Get1(Format(UrlRestAPI,[location]),lStream); //writeln('html back: '+lHTTP.Get(Format(UrlRestAPI,[location]))); //writeln(lHTTP.Get('http://google.com')); except //lHTTP.Get1(Format(UrlGeoLookupInfo2,[location]),lStream); //if something wrong try using a backup server. //writeln('html back: '+GetURLAsString('http://api.openweathermap.org')); writeln('OWeather_Map Exception: '+Gethtm(UrlWeatherReport25)) end; lStream.Seek(0,0); result:= 'GEO_Weather_Report2: '+UTF8ToString(lStream.ReadString(lStream.Size)); finally lHTTP.Free; lStream.Free; end; end; Const RealIP_REX = '"city": "([üöä\w\s]*).*"country": "([\w\s]+).*"'; var LocalCity, LocalCountry: string; function GetRealIP2(): String; var LJsonObj: TJSONObject; str: string; http : TIdHttp; begin str:=''; http:=TIdHTTP.Create(Nil); try str:= UTF8toAnsi(http.Get('http://ipinfo.io/json')); LJsonObj:= TJSONObject.create4(str); //TEncoding.ASCII.GetBytes(str),0) as TJSONObject; //str := LJsonObj.Get('ip').JsonValue.Value; //LJsonObj.clone; //LJsonObj.GetItemAsStrUTF8 GetItemAsStrUTF8('ip'); //result:= LJsonObj.GetString('"ip":'); // result:= LJsonObj.GetString('"hostname":'); // str:= HTTPEncode(str) //str:= UTF8ToString(str) with TRegExpr.Create do try Expression:= RealIP_REX; if Exec(str) then begin PrintF('IP Weather Local City Name: %s ',[Match[1]]) PrintF('IP Weather Local Country Name: %s ',[Match[2]]) LocalCity:= match[1] LocalCountry:= match[2] //UTF8 umlaute {s:= StringReplace(s, 'ä', 'ä', [rfReplaceAll]); s:= StringReplace(s, 'ö', 'ö', [rfReplaceAll]); s:= StringReplace(s, 'ü', 'ü', [rfReplaceAll]); } localcity:= StringReplace(localcity, 'ä', 'ae', [rfReplaceAll]); localcity:= StringReplace(localcity, 'ö', 'oe', [rfReplaceAll]); localcity:= StringReplace(localcity, 'ü', 'ue', [rfReplaceAll]); writeln('aeo name convert: '+localcity) end else writeln('ip localcity not found'); finally Free; end; Except writeln('get real ip EXCEPTION ') raiselastException; end; result:= str; LJsonObj.Free; http.Free; end; //**************************Event Handlers******************************* procedure FormMouseDown(sender: TObject; Button: TMouseButton; Shift: TShiftState; vX, vY: Integer); begin BitBlt(FStorage.Canvas.Handle,0,0, FPicred.Width, FPicred.Height, afrm.Canvas.Handle, FNewRect.Left, FNewRect.Top, SRCCOPY); pct:= 0.0; beginX:= round(glx); beginY:= round(gly); endX:= vX; //mouseX endY:= vY; afrm.repaint; //FormDrawBitmap(Exepath+BACKMAP,10,10, bfrm.canvas); drawE2(beginx,beginy, endx,endy); end; //var trackval: integer; //progbar: TProgressbar; procedure TFrm1_trackSpeedChange(Sender: TObject); begin //mt.Interval:= 1000 div tB.Position; //writeln(intToStr(1000 div TTrackbar(sender).Position)); writeln(intToStr(TTrackbar(sender).Position)); //trackval:= TTrackbar(sender).Position; Progbar.Position:= TTrackbar(sender).Position*10; end; procedure TFrm1_progressChange(Sender: TObject); begin //mt.Interval:= 1000 div tB.Position; //writeln(intToStr(1000 div TTrackbar(sender).Position)); writeln(intToStr(TTrackbar(sender).Position)); end; procedure TFrm1_closeForm(Sender: TObject; var Action: TCloseAction); begin {if mt <> NIL then begin mT.enabled:= false; mT.Free; mT:= NIL; end;} ///afrm.Free; if assigned(FPicRed) then FPicRed.Free; FPicRed:= NIL; if assigned(FStorage) then FStorage.Free; FStorage:= NIL; imagelist1.Free; imagelist2.Free; view.Free; action:= caFree; afrm:= NIL; Screen.Cursor:= crDefault writeln('geo map6 form free and API closed'); end; procedure TFrm2_closeForm(Sender: TObject; var Action: TCloseAction); begin {if mt <> NIL then begin mT.enabled:= false; mT.Free; mT:= NIL; end;} ///afrm.Free; {if assigned(FPicRed) then FPicRed.Free; FPicRed:= NIL; if assigned(FStorage) then FStorage.Free; FStorage:= NIL; imagelist1.Free; imagelist2.Free; view.Free; } //action:= caFree; //aPfrm:= NIL; Screen.Cursor:= crDefault writeln('geo map6 forecaster form free'); end; procedure TFrm1_CloseClick(Sender: TObject); begin afrm.Close; writeln('geo map form close and free at: '+datetimetostr(now)); zoomf:= 16; end; procedure Map_CloseClick(Sender: TObject; var action: TCloseAction); begin //afrm.Close; action:= cafree; writeln('only mapform close at: '+datetimetostr(now)); //zoomf:= 16; end; const MEDIAPATH = 'examples\'; procedure OpenWeatherList(sender: TObject); begin //cryptFile:= 'C:\SecureCenter\Dec 15 2010mx3\maxboxerrorlog2.txt'; //cryptFile:= 'C:\SecureCenter\Dec 15 2010mx3\maxboxerrorlog2.txt'; if PromptForFileName(selectFile,'Files(*.*)|*.*',//others '', 'Select your weather filelist', MEDIAPATH, False) then begin (*mPanel.font.color:= clyellow; mPanel.font.size:= 18; mPanel.caption:= ExtractFileName(selectFile)+' encrypt...'; //cfile:= LoadFileAsString(selectFile); Application.ProcessMessages; screen.Cursor:= crHourglass; with clstBox.Items do begin Add('SHA256 Hash of: '+ExtractFileName(selectFile)); Add('is: '+ComputeSHA256(selectFile,'F')); idx:= Add('File to Crypt: '+ExtractFileName(selectFile)); stat.SimpleText:= clstBox.items[idx]; end; with TStopwatch.Create do begin Start; AESSymetricExecute(selectFile,selectFile+'_encrypt',aespassw); mPanel.font.color:= clblue; mPanel.font.size:= 30; mPanel.caption:= 'File Encrypted!'; screen.Cursor:= crDefault; Stop; //clstBox.Items.Add('Time: ' +(floattoStr(GetValueMSec/1000))); clstBox.Items.Add('Time consuming: ' +GetValueStr +' of: '+ inttoStr(getFileSize(selectFile))+' File Size'); Free; end; //add hash and cipher to compare later on cLstbox.Items.Add('Crypted file: '+ExtractFileName(selectFile)+'_encrypt'); WriteLog(cryptLog, clstbox.items.text) {clearout:= S_StrDEcrypt96(cryptin, StartKey, MultKey, AddKey); CreateFileFromString(selectFile+'_decrypt', clearout);} *) end; end; procedure TFrm1_AddClick(Sender: TObject); begin {if mT <> NIL then mt.enabled:= not mt.enabled; } actlocation:= removespaces(myedit.text); //actlocation:= TrimSpacesL(myedit.text); TFrm_updateclick(self) end; procedure btnZoomPlusClick2(Sender: TObject); var abitmap: TBitmap; zoomval: integer; begin try //abitmap.Assign(MainForm.imgMain.Picture.Bitmap); zoomf:= zoomf-1 GetGeoInfoMap4save(latf,lonf,zoomf,650,mapboxAPIEKON21, //ExePath+'mX4mapbox_duesseldorf2.png') ExePath+'examples\mX4mapbox_weatherzoom.png') //SetWorldTransform(ageofrm.Canvas.Handle, ageofrm); finally //abitmap.Free end; end; var APATHGLOB: string; procedure Save1Click(Sender: TObject); begin openfile(APATHGLOB) end; function GetGeoInfoMap4save(const lat,lon, zoom: double; asize: integer; const UrlGeoLookupInfo, apath: string): string; var pngStream: TMemoryStream; internalzoomf: double; MainMenu1: TMainMenu; File1: TMenuItem; // zoomf: double; begin pngStream:= TMemoryStream.Create; try HttpGet(Format(UrlGeoLookupInfo,[lon,lat,zoom, asize,asize]), pngStream); //WinInet Circuit except //lHTTP.Get1(Format(UrlGeoLookupInfo2,[IpAddress]), lStream); //if something wrong try using backup server. writeln(ExceptionToString(ExceptionType, ExceptionParam)); end; with TLinearBitmap.Create do try pngStream.Position:= 0; LoadFromStream2(pngStream,'PNG'); internalzoomf:= 16; MainMenu1:= TMainMenu.create(self) ageofrm:= getForm2(asize+5,asize+5, clred, 'GEO MAP Weather 5.0: '+'zoom: '+floattostr(zoomf)); ageofrm.Menu := MainMenu1; file1 := TMenuItem.create(ageofrm); with file1 do begin //parent:= form1; Caption := 'Open &File Save...' mainmenu1.Items.Add(file1); OnClick := @Save1Click; end; ageofrm.ondblclick:= @btnZoomPlusClick2; ageofrm.onclose:= @Map_CloseClick; paintToCanvas(ageofrm.canvas, Rect(2,2,Width,Height),false); //paintToCanvas(getform2(asize+15,asize+15,clred, 'GEO MAP Weather 3.0').canvas, // Rect(5,5,Width,Height),false); SaveToFile(apath); APATHGLOB:= apath; finally Dispose; Free; pngStream.Free; end; end; procedure ListClick(Sender: TObject); //var latf, lonf: double; begin {if mT <> NIL then mt.enabled:= not mt.enabled; } writeln(objecttostring(sender)) //writeln(TListview(sender).items[3].caption); writeln(TListview(sender).selected.caption); writeln(copy(TListview(sender).selected.caption,4,20)); actlocation:= copy(TListview(sender).selected.caption,4,20); writeln('this acvt replace'+actlocation) actlocation:= StrReplaceChar(actlocation, ':',',') actlocation:= StrReplaceChar(actlocation, 'ü','u') if isInternet then begin sr:= GetGeoWeather(removespaces(actlocation), UrlWeatherReport25); writeln(sr) statbar1.panels.items[1].text:= sr; //add to x4 statbar1.hint:= sr; end; latf:= GEOCoord2Point(sr).y lonf:= GEOCoord2Point(sr).x writeln('coord of '+actlocation +' : ' +floattostr(latf)+' '+floattostr(lonf)); zoomf:= 16; GetGeoInfoMap4save(latf,lonf,zoomf,650,mapboxAPIEKON21, ExePath+'mX4mapbox_weatherapp.png') // sunrisesetRouter(lonf,latf); // openDoc('C:\maXbox\EKON20\EKON20_Scripts\imagesServer\cologne_dom.bmp') { for i := 0 to Items.Count - 1 do if Items[i].Selected then Items[i].Caption := Items[i].Caption + ' - Selected!'; } end; procedure ListClick2(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); //var latf, lonf: double; begin {if mT <> NIL then mt.enabled:= not mt.enabled; } writeln(objecttostring(sender)) //writeln(TListview(sender).items[3].caption); writeln(TListview(sender).selected.caption); writeln(copy(TListview(sender).selected.caption,4,20)); actlocation:= copy(TListview(sender).selected.caption,4,20); writeln('this acvt replace'+actlocation) actlocation:= StrReplaceChar(actlocation, ':',',') if isInternet then begin sr:= GetGeoWeather(removespaces(actlocation), UrlWeatherReport25); writeln(sr) statbar1.panels.items[1].text:= sr; //add to x4 statbar1.hint:= sr; end; // sunrisesetRouter(lonf,latf); // openDoc('C:\maXbox\EKON20\EKON20_Scripts\imagesServer\cologne_dom.bmp') { for i := 0 to Items.Count - 1 do if Items[i].Selected then Items[i].Caption := Items[i].Caption + ' - Selected!'; } end; ///handles ListView1's On Double Clickprocedure procedure TFormListView1DblClick(Sender: TObject) ; var Caption: string; hts : THitTests; ht : THitTest; sht : string; ListViewCursosPos : TPoint; ListView1: TListview; selectedItem : TListItem; begin //position of the mouse cursor related to ListView ListViewCursosPos := ListView1.ScreenToClient(Mouse.CursorPos) ; //double click where? hts := ListView1.GetHitTestInfoAt(ListViewCursosPos.X, ListViewCursosPos.Y) ; //"debug" hit test Caption := ''; //for ht in hts do begin //sht := GetEnumName(TypeInfo(THitTest), Integer(ht)) ; Caption := Format('%s %s | ',[Caption, sht]) ; end; //locate the double-clicked item // if hts <= [htOnIcon, htOnItem, htOnLabel, htOnStateIcon] then begin selectedItem := ListView1.Selected; //do something with the double clicked item! Caption := Format('DblClcked : %s',[selectedItem.Caption]) ; // end; end; procedure ListClickPredict(Sender:TObject;Button:TMouseButton; Shift:TShiftState;X,Y:Integer); //var latf, lonf: double; begin {if mT <> NIL then mt.enabled:= not mt.enabled; } // writeln(TListview(sender).selected.caption); // actlocation:= copy(TListview(sender).selected.caption,4,20); //statbar2.panels.items[1].text:= TListview(sender).selected.caption; writeln(itoa(TListview(sender).itemindex)) // writeln(Tlistview(sender).items[TListview(sender).itemindex].subitems[1]); statbar2.panels.items[1].text:= TListview(sender).items[TListview(sender).itemindex].subitems[0]; writeln('itemindex: '+ TListview(sender).items[TListview(sender).itemindex].subitems[1]); statbar2.hint:= statbar2.panels.items[1].text; end; procedure tbtnScanClick(Sender: TObject); begin {if mT <> NIL then mt.enabled:= not mt.enabled; } writeln(objecttostring(sender)) if isInternet then begin sr:= GetGeoWeather(removespaces(actlocation), UrlWeatherReport25); writeln(sr) end; end; const PicPath = '\examples\images\'; procedure EditColumn(Item: TListItem; Col: byte; const Text: string); begin if Col = 0 then Item.Caption:= Text else begin while Item.SubItems.Count < Col do Item.SubItems.Add(''); Item.SubItems[Col -1] := Text; end; end; procedure Change(AListView: TListView; const ARowIndex, AColIndex: Integer; const ANewContent: string); var i: Integer; vItem: TListItem; begin vItem := AListView.Items[ARowIndex]; if AColIndex=0 then vItem.Caption := ANewContent else begin for i := vItem.SubItems.Count to AColIndex+1 do vItem.SubItems.Add(''); vItem.SubItems[AColIndex] := ANewContent; end; end; procedure TFrm_UpdateClick(Sender: TObject); var tmps: string; begin {bfrm.canvas.draw(335,30, FPicRed); actlocation:= myedit.text; getIPWeatherData(actlocation) anamtr.value:= atemper;//strtoint(copy(atemper,0,2)) aind.value:= apressure div 15 telelabel.caption:= sr; apress.value:= apressure; ahumi.value:= ahumidity; } ListView_SetTextBkColor(view.handle, $7dcced) //$8deeed) // $9cc123) if isInternet then begin sr:= GetGeoWeather(actlocation, UrlWeatherReport25); writeln('update: '+sr+' '+actlocation) getMultipleWeather(sr) ListItem:= view.Items.Add; AddlistItem(listitem) SetImageTemperatur(listitem) listitem.makevisible(false); //View.Items.Item[0].MakeVisible(false); //scrolls up if necessary //ListView1.SetFocus; // sets focus on the listview //Listitem.TopIndex := -1 + ListBox1.Items.Count; statbar1.panels.items[1].text:= sr; statbar1.hint:= sr; // @debug writeln(sr) end; //anamtr.value:= anamtr.value-10; end; const N = 31; { Number of points } Alpha = 0.05; { Significance level } procedure WriteRegressionResults(X, Y, Ycalc, B : TVector; V : TMatrix; Test : TRegTest; Tc, Fc : Float); { ------------------------------------------------------------------ Writes results to screen ------------------------------------------------------------------ } var Line1, Line2 : String; { Separating lines } Delta : Float; { Residual } Sr : Float; { Residual standard deviation } SB : Float; { Standard deviations of parameters } I : Integer; { Loop variable } begin Line1:= StrChar(73, '-'); Line2:= StrChar(43, '='); WriteLn(Line2); WriteLn('Linear regression: Y = B(0) + B(1) * X'); WriteLn(Line1); WriteLn('Parameter Est.value Std.dev. '+ floattostr(100 * (1 - Alpha))+ '% Confidence Interval'); WriteLn(Line1); for I:= 0 to 1 do begin SB := Sqrt(V[I][I]); PrintF('B(%d) %17.8f %17.8f %17.8f ; %17.8f', [I,B[I],SB,(B[I]- Tc * SB),(B[I] + Tc * SB)]) end; WriteLn(Line1); WriteLn('Number of observations : n = '+itoa(N)); with Test do begin Sr := Sqrt(Vr); WriteLn('Residual error : s = '+floattoStr(Sr)); WriteLn('Coeffic. of correlation : r = '+floattostr((Sgn(B[1])*Sqrt(R2)))); WriteLn('Coefficient of determination: r2 = '+floattostr(R2)); {WriteLn('Adjusted coeff. of determination : r2a = ', R2a:10:4); WriteLn('Varic ratio (explained/resid.) : F(', Nu1:3,',', Nu2:3, ')= ',F:10:4); WriteLn('Critical variance ratio : F(p = ', (1 - Alpha):4:2, ') = ',Fc:10:4);} end; WriteLn(Line1); PrintF(' %-13s %-12s %-12s %-12s %-12s %-12s', ['i','Y obs.','Y calc.','Residual','Std.dev.','Std.res.']); WriteLn(Line1); for I := 1 to N do begin Delta := Y[I] - Ycalc[I]; //WriteLn(I:3, Y[I]:14:4, Ycalc[I]:14:4, Delta:14:4, Sr:14:4, (Delta/ Sr):14:4); PrintF('B(%d) %12.4f %12.4f %12.4f %12.4f %12.4f', [I,Y[I],Ycalc[I],Delta,Sr, (Delta / Sr)]) end; WriteLn(Line2); end; procedure AutoScale2(X : TVector; Lb, Ub : Integer; Scale : TScale; var XMin, XMax, XStep : Float); external 'AutoScale@dmath'; procedure letForecastRegression_Graph(datlist: TStringlist); var afrm: TForm; acanvas: TCanvas; B : TVector; { Regression parameters } XX, YY : TVector; { Data } Ycalc : TVector; { Computed Y values } V : TMatrix; { Variance-covariance matrix } Test : TRegTest; { Statistical tests } Tc : Float; { Critical t value } Fc : Float; { Critical F value } I : Integer; { Loop variable } Ymin, Ymax, Ystep: float; Scale : TScale; Ymin2: float; X : TVector; Lb, Ub : Integer; aScale : TScale; var XMin, XMax, XStep : Float; begin { Dimension arrays } DimVector(XX, N); DimVector(YY, N); DimVector(Ycalc, N); DimVector(B, 1); DimMatrix(V, 1, 1); //InitGraphics( 0, 0); aFrm:= getForm2(1100,420, clweblightgreen,'weather forecast graphX'); //sizeable! acanvas:= aFrm.canvas; acanvas.FillRect(Rect(0, 0, afrm.Width, afrm.Height)); { Read data } for I := 1 to N do begin XX[I] := I /30; YY[I] := strtofloat(datlist[I])/35; end; { Perform regression } LinFit(XX, YY, 1, N, B, V); { Compute predicted Y values } for I := 1 to N do Ycalc[I] := B[0] + B[1] * XX[I]; { Update variance-covariance matrix and compute statistical tests } RegTest(YY, Ycalc, 1, N, V, 0, 1, Test); { Compute Student's t and Snedecor's F } //Tc := InvStudent(N - 2, 1 - 0.5 * Alpha); //Fc := InvSnedecor(1, N - 2, 1 - Alpha); { Write results } WriteRegressionResults(XX, YY, Ycalc, B, V, Test, Tc, Fc); SetWindow(afrm.canvas, 30, 150, 25, 150, True); //Procedure AutoScale(X:TVector; Lb,Ub:Int; Scale:TScale; var XMin,XMax,XStep:Float) Ymin:= -0.5; Ymax:= 0.9; Ystep:= 1; //AutoScale(X ,Lb, Ub,smNormal,xmin, 5, 4); //TScaleMode', '(smNormal,smStretch,smScale,smResize,smOptimal, smOptimalScaled )'); //TScale', '( LinScale, LogScale )'); //AutoScale2(Y, 1, N, LinScale, Ymin, Ymax, Ystep); //SetOxScale2(Linscale, Xmin, Xmax, Xstep); SetOyScale(LinScale, Ymin, Ymax, Ystep); //for minus -temp SetGraphTitle('Linear Weather Regression Demo for'+actlocation+' '+datetostr(now)); afrm.caption:= 'Linear Weather Regression Demo for'+actlocation+' '+datetostr(now); SetOxTitle('X_Time = 5 Days'); SetOyTitle('Y_Temp -10+30'); PlotOxAxis(afrm.canvas); PlotOyAxis(afrm.canvas); //PlotGrid(afrm.Canvas, bothGrid); WriteGraphTitle(afrm.canvas); //SetClipping(True); SetLineParam(1, psSolid, 0, clred); { Don't connect points } //PlotCurve(afrm.canvas,(XX), YY, 1, N-1, 1); //PlotPoint(afrm.canvas, 10, 20, 3) PlotCurveWithErrorBars(afrm.canvas,(XX), YY, Ycalc, 1, 1, N-1, 1) for I := 1 to N do Ycalc[I] := (B[0] + B[1] * XX[I]); SetLineParam(1, psSolid, 0, clblue); PlotCurve(afrm.canvas,(XX), Ycalc, 1, N-1, 1); writeln('Regression calc & fit done') end; procedure TFrm_ForecastClick(Sender: TObject); var tmps, srt, descript, atemp, aicon: string; mlist, templist: TStringlist; k: integer; begin //instance of pview! {bfrm.canvas.draw(335,30, FPicRed); actlocation:= myedit.text; getIPWeatherData(actlocation) anamtr.value:= atemper;//strtoint(copy(atemper,0,2)) aind.value:= apressure div 15 telelabel.caption:= sr; apress.value:= apressure; ahumi.value:= ahumidity; } if isInternet then begin srt:= GetGeoWeather(actlocation, UrlWeatherReport25_Forecast); //StrtoList( s : string; const List : TStrings; const delimiter : char) mlist:= TStringlist.create; templist:= TStringlist.create; Strtolist(srt, mlist, '}') writeln('Count of forecast list line: '+itoa(mlist.count)) //writeln(mlist.text) for k:= 0 to mlist.count-1 do begin if pos('"dt_txt":',mlist.strings[k]) > 0 then tmps:= mlist.strings[k] ; if pos('"temp":',mlist.strings[k]) > 0 then writeln(itoa(k)+tmps+' '+mlist.strings[k]+CRLF); if pos('"main":',mlist.strings[k]) > 0 then writeln(itoa(k)+mlist.strings[k]+CRLF); end; mlist.free; writeln('Forecast for: '+mlist.text+' '+actlocation) writeln('Forecast end report for: '+actlocation) loadpredictForm; //getMultipleWeatherForecast(srt) //ListView_SetTextBkColor(pview.handle, $7dcced) //$8deeed) // $9cc123) mlist:= TStringlist.create; Strtolist(srt, mlist, '}') writeln('Count of forecast list2: '+itoa(mlist.count)) //writeln(mlist.text) for k:= 0 to mlist.count-2 do begin if pos('"dt_txt":',mlist.strings[k]) > 0 then begin //tmps:= itoa(k)+' '+mlist.strings[k] ; tmps:= copy(mlist.strings[k],pos('"dt_txt":',mlist.strings[k])+10,17) //if pos('"temp":',mlist.strings[k]) > 0 then if pos('"temp":',mlist.strings[k+1]) > 0 then begin tmps:= tmps+' '+mlist.strings[k+1]; //([\d\.\-]+).* with TPerlRegEx.Create do begin; Options:= [preCaseLess]; RegEx:= '"temp":([\d\.\-]+){2,}'; // for temperature float //subject:= copy(mlist.strings[k+1],pos('"temp":',mlist.strings[k+1])+7,6) subject:= mlist.strings[k+1]; if match then atemp:= copy(groups[0],8,6); //word filter Free; end; {Remember that you have a complete programming language at your disposal. I've noticed people tend to decide they need to use regex and then forget about everything else they can do. } //if pos(',',atemp) > 0 then atemp:= StrReplaceChar(atemp,',','.'); //if pos('"',atemp) > 0 then atemp:= StrReplaceChar(atemp,'"','0'); templist.add((atemp)); end; if pos('"main":',mlist.strings[k+2]) > 0 then begin //descript:= mlist.strings[k+2]; descript:= copy(mlist.strings[k+2],pos('"main":',mlist.strings[k+2])+7,60); aicon:= copy(mlist.strings[k+2],pos('"icon":',mlist.strings[k+2])+8,3) end; //getMultipleWeatherForecast(mlist.strings[k]); ListItem:= pview.Items.Add; //AddlistItemPredict(listitem) with listItem do begin Caption:= actlocation; //SubItems.Add(wpred.temp+'° hPa: '+wpred.bar+' humid: ' // +wpred.humid+'% '); SubItems.Add(tmps); //showmessage(wrec.id) //anum:=StrToFloat(copy(wpred.temp, 1, 2)); //anum:= ((strtofloat(wrec.tempmax) + strtofloat(wrec.tempmin))/2) SubItems.Add(descript); SubItems.Add(atemp); SetImageTemperaturPredict(listitem, aicon) end; end; {if pos('"temp":',mlist.strings[k]) > 0 then writeln(itoa(k)+tmps+' '+mlist.strings[k]+CRLF); if pos('"main":',mlist.strings[k]) > 0 then writeln(itoa(k)+mlist.strings[k]+CRLF); } end; mlist.free; for it:= 1 to templist.count-1 do write(templist[it]+ ' '); letForecastRegression_Graph(templist); templist.Free; //ListItem:= view.Items.Add; //AddlistItem(listitem) //SetImageTemperatur(listitem) //listitem.makevisible(false); //} //View.Items.Item[0].MakeVisible(false); //scrolls up if necessary //ListView1.SetFocus; // sets focus on the listview //Listitem.TopIndex := -1 + ListBox1.Items.Count; //statbar2.panels.items[1].text:= srt; //statbar2.hint:= srt; // @debug writeln(sr) end; //loadpredictForm; end; procedure Edit1KeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin Key := #0; actlocation:= removespaces(myedit.text); //actlocation:= TrimSpacesL(myedit.text); TFrm_updateclick(self) if sender is TListview then writeln('list view return key pressed at: '+(TListview(sender).selected.caption)); //S := Edit1.Text; //Edit1.Clear; end; //writeln('list view key pressed') end; function ListView_SetTextColor(hwnd: HWND; clrText: TColorRef): Bool; begin Result:= Bool( SendMessage(hwnd, LVM_SETTEXTCOLOR, 0, clrText) ); end; procedure TMyControl_TriggerHint(Hint: String); var Message: TMessage; FGridHintFlag: boolean; begin Self.Hint:= Hint; if Hint='' then begin Application.HideHint; Application.CancelHint; end else begin Application.CancelHint; FGridHintFlag:=Self.Hint<>''; Self.Hint:=Hint; if Hint<>'' then begin //TWMMouse(Message).Pos:=PointToSmallPoint(ScreenToClient(Mouse.CursorPos)); Application.HintMouseMessage(Self, Message); end; end; end; Const PBM_SETBARCOLOR = (WM_USER + 9); Procedure initTabletmode; var aMessage: TMessage; begin //Application.HintColor := clAqua; // color of your choice Application.HintColor := $8deeed Application.HintMouseMessage(Self, aMessage) Application.HintPause := 250; // 250 mSec before hint is shown Application.HintHidePause := 13000; // hint disappears after 3 secs end; Procedure RegisterHiddenMenu; var Comp: TComponent; begin //Make a hidden menu item visible Comp := Application.MainForm.FindComponent('MenuItemName'); if Comp is TMenuItem then TMenuItem(Comp).Visible := True; end; procedure SetImageTemperatur(alistitem: Tlistitem); begin setDecimalSeparator('.') if wrec.temp <> '' then begin if trunc(strtofloat(wrec.temp)) < 5 then //if wrec.temp < '5' then //machine learning alistitem.imageindex:= random(1)+2; if trunc(strtofloat(wrec.temp)) < 2 then //if wrec.temp < '5' then alistitem.imageindex:= 3; if (trunc(strtofloat(wrec.temp)) >= 5) and (trunc(strtofloat(wrec.temp)) <= 10) then //if wrec.temp < '5' then alistitem.imageindex:= 1; if trunc(strtofloat(wrec.temp)) >= 11 then //if wrec.temp < '5' then alistitem.imageindex:= 0; if wrec.descript= 'Rain' then alistitem.imageindex:= 2; if wrec.descript= 'Thunderstorm' then alistitem.imageindex:= 2; if wrec.descript= 'Clouds' then alistitem.imageindex:= 1; if wrec.descript= 'Drizzle' then alistitem.imageindex:= 1; if wrec.descript= 'Mist' then alistitem.imageindex:= 1; if wrec.descript= 'Snow' then alistitem.imageindex:= 3; if wrec.descript= 'Haze' then alistitem.imageindex:= random(1)+1; end; end; procedure SetImageTemperaturPredict(alistitem: Tlistitem; aicon: string); begin setDecimalSeparator('.') (*if wrec.temp <> '' then begin if trunc(strtofloat(wrec.temp)) < 5 then //if wrec.temp < '5' then //machine learning alistitem.imageindex:= random(1)+2; if trunc(strtofloat(wrec.temp)) < 2 then //if wrec.temp < '5' then alistitem.imageindex:= 3; if (trunc(strtofloat(wrec.temp)) >= 5) and (trunc(strtofloat(wrec.temp)) <= 10) then //if wrec.temp < '5' then alistitem.imageindex:= 1; if trunc(strtofloat(wrec.temp)) >= 11 then //if wrec.temp < '5' then alistitem.imageindex:= 0; *) case aicon of '01d','01n': alistitem.imageindex:= 0; //clear '04d','04n','03n','02n','02d': alistitem.imageindex:= 1; //clouds '10n','10d': alistitem.imageindex:= 2; //rain '13d','13n': alistitem.imageindex:= 3; //snow else alistitem.imageindex:= random(1)+1; end; {if wrec.descript= 'Rain' then alistitem.imageindex:= 2; if wrec.descript= 'Thunderstorm' then alistitem.imageindex:= 2; if wrec.descript= 'Clouds' then alistitem.imageindex:= 1; if wrec.descript= 'Mist' then alistitem.imageindex:= 1; if wrec.descript= 'Haze' then alistitem.imageindex:= random(1)+1; } //end; end; //get a real server without async problems and lost file size! procedure CheckBitmapIcons; begin if not fileExists(exepath+'WeatherImageList.dat') then begin //wGet('http://www.softwareschule.ch/images/texturemap.jpg',PICPATH+'\texturemap.jpg'); // wGet2('http://www.softwareschule.ch/images/weatherimagelist.dat', // exepath+'WeatherImageList.dat'); //DownloadFile('http://www.softwareschule.ch/images/weatherimagelist.dat', // exepath+'WeatherImageList.dat') wGetX2('http://www.kleiner.ch/images/weatherimagelist.txt', exepath+'WeatherImageList.dat'); ShowmessageBig('second download starts..., please confirm!') wGetX2('http://www.kleiner.ch/images/weatherimagelist1.txt', exepath+'WeatherImageList1.dat'); {wGet('http://www.softwareschule.ch/images/WeatherImageList1.dat', exepath+'WeatherImageList1.dat'); } end; writeln('imagelist *.dat has been downloaded at: ' +exepath) end; //**************************Form Builder******************************* Procedure loadForm; var tB: TTrackBar; //statBar1: TStatusBar; NewColumn: TListColumn; atool: TToolBar; asr: AnsiString; //atool: TCoolBar; ListItem: TListItem; image, image1, image2, image3: TBitmap; sunr, suns: string; begin setupAnimation; aFrm:= TForm.Create(self); //mT:= TTimer.Create(self); //mt.onTimer:= @TFrm1_timerRedrawTimer; //mt.interval:= MILLISECONDS; //mt.free; in on close with aFrm do begin Caption:= '********** maXbox Weather Station7 Map: type new+york for 2 names find ***********'; //top:= 30; height:= 660; width:= 930; Position:= poScreenCenter; formstyle:= fsstayontop; Icon.LoadFromResourceName(HInstance,'MOON'); //NEWREPORT'); //Color:= clBlack; onClose:= @TFrm1_closeForm; //onPaint:= @TFrm1_FormPaint; Canvas.Pen.color:= clBlue; Canvas.Pen.Width:= 15; BorderIcons:= [biSystemMenu, biMinimize]; BorderStyle:= bsSingle; //borderWidth:= 4; scaled:= true; autoscroll:= true; onMouseDown:= @FormMouseDown; //Textheight('20'); //activecontrol Show; //canvas.brush.bitmap:= getBitmapObject(Exepath+'examples\images\bmp47.bmp'); //Canvas.FillRect(Rect(50,50,500,200)); //canvas.draw(0,200, getbitmap(Exepath+'\examples\citymax.bmp')); //Show; end; with TBitBtn.Create(aFrm) do begin Parent:= aFrm; setbounds(560,520,170,65); caption:= '&Update'; //flat font.size:= 15; glyph.LoadFromResourceName(getHINSTANCE,'CL_MPPAUSE'); mXButton(02,02,width, height,15,15,handle); //event handler onClick:= @TFrm_UpdateClick; end; with TBitBtn.Create(aFrm) do begin Parent:= aFrm; setbounds(380,520,170,65); caption:= '&Forecast'; //flat font.size:= 15; glyph.LoadFromResourceName(getHINSTANCE,'VPDOTS'); //TOPASSISTANT'); mXButton(02,02,width, height,15,15,handle); //event handler onClick:= @TFrm_ForecastClick; end; with TBitBtn.Create(aFrm) do begin Parent:= aFrm; setbounds(740,520,170,65); caption:= '&Close'; font.size:= 15; glyph.LoadFromResourceName(getHINSTANCE,'CL_MPSTOP'); mXButton(02,02,width, height,15,15,handle); onClick:= @TFrm1_CloseClick; end; tB:= TTrackBar.create(aFrm); with tB do begin parent:= aFrm; setBounds(40,515,230,70); Min:= 10; Max:= 100 Frequency:= 10 Position:= 1000 div 50; linesize:= 15; ThumbLength:= 55; SetFocus; OnChange:= @TFrm1_trackSpeedChange; end; statbar1:= TStatusBar.Create(aFrm); with statbar1 do begin parent:= aFrm; showhint:= true; parentcolor:= false; color:= clred; //panels.color:= clnavy; //sizeGrip hint:= 'this is a Weather LED BoX in maXcalc'; Panels.add; panels.items[0].width:= 200; panels.items[0].text:= DateTimeToInternetStr(Now, true); Panels.add; panels.items[1].width:= 150; panels.items[1].text:= '150 get the solution'; end; atool:= TToolBar.create(aFrm); //If owner is NIl it is not actually part of the main form. imagelist1:= TCustomImageList.Create(NIL); ReadComponentResFile(exepath+'WeatherImageList1.dat', imagelist1); {image:= getbitmap(exepath+picpath+'red1.bmp'); image1:= getbitmap(exepath+picpath+'green1.bmp'); image2:= getbitmap(exepath+picpath+'yellow1.bmp') } with imagelist1 do begin Height:= 39; Width:= 39; Add(image,NIL); Add(image1,NIL); Add(image2,NIL); end; //WriteComponentResFile(exepath+'WeatherImageList1.dat', imagelist1); imagelist2:= TCustomImageList.Create(aFrm); // deserialize object stream to imagelist ReadComponentResFile(exepath+'WeatherImageList.dat',imagelist2); {image:= getbitmap(exepath+picpath+'red1.bmp') image1:= getbitmap(exepath+picpath+'green1.bmp'); image2:= getbitmap(exepath+picpath+'yellow1.bmp'); } {image:= getbitmap(exepath+picpath+'sun1.bmp') image3:= getbitmap(exepath+picpath+'sun4.bmp'); } with imagelist2 do begin Height:= 39; Width:= 39; Add(image,NIL); Add(image1,NIL); Add(image2,NIL); Add(image3,NIL); end; //serialize imagelist object to object stream file //WriteComponentResFile('WeatherImageList.dat', imagelist2); with atool do begin setBounds(10,5,100,80) Parent:= aFrm; //Align:= altop; parentcolor:= false; ButtonHeight:= 50; ButtonWidth:= 90; EdgeInner:= esNone; EdgeOuter:= esNone; Flat:= True; HotImages:= ImageList1; Images:= ImageList2; ShowCaptions:= True; //TabOrder = 0 color:= clnavy; Transparent:= True; show; end; with TToolbutton.create(atool) do begin parent:= atool; //flat:= true; Caption:= '&Open'; ImageIndex:= 2; //ParentShowHint:= False ShowHint:= False OnClick:= @OpenWeatherList; end; with TToolbutton.create(atool) do begin parent:= atool; Caption:= '&Add'; ImageIndex:= 1; //ParentShowHint:= False ShowHint:= False OnClick:= @TFrm1_AddClick end; with TToolbutton.create(atool) do begin parent:= atool; Caption:= '&Scan'; ImageIndex:= 0; OnClick:= @tbtnScanClick end; myEdit:= TEdit.create(aFrm); with myEdit do begin parent:= afrm; text:= ' Klagenfurt'; borderstyle:= bsnone; setbounds(212,10,250,32); color:= clweblightblue; //$8deeed //clnavy font.color:= clwebdarkred; //$7dcced; //$0deeed; //clred; //font.style:= [fsbold] font.size:= 18; //onkeypreview:= true; //onenter:= @updateClick; onkeypress:= @Edit1KeyPress; show end; with TColorBox.create(self) do begin parent:= aFrm; top:= 10; left:= 488; width:= 263; height:= 50; items[16]; //autosize:= false; {selected:= 2 items[selected]; } font.size:= 14; onclick:= @TFrm_color1Click; Show; //free end; DecodeTime(now,hh,mm,ss,ms); //showmessage(floattostr(mtime)) progbar:= TProgressbar.create(afrm); with progbar do begin parent:= aFrm; Align:= albottom; {Min:= 0; Max:= 100; Step:= 10;} Max:= (24*60); //color:= clred; //TColor(random(65100)); position:= tb.position; Position:= (hh * 60)+mm; Brush.Color := clTeal; SendMessage(Handle, PBM_SETBARCOLOR, 0, clYellow); //onchange:= @TFrm1_progressChange; end; { with TTabbedNotebook.create(aFrm) do begin parent:= aFrm; setbounds(10,65,453,120) end; } view:= TListview.create(aFrm); with view do begin parent:= aFrm; setbounds(10,65,910,435) //columns:= listitem DoubleBuffered:= False FlatScrollBars:= True readonly:= false; gridLines:= true; RowSelect:= True; NewColumn:= Columns.Add; NewColumn.Caption:= 'City:Country'; newColumn.width:= 245; newcolumn.alignment:= taLeftJustify; //newcolumn.color //newColumn.autosize:= true; // newColumn.imageindex:= 1; NewColumn:= Columns.add; NewColumn.Caption:= 'Weather Sensor'; newColumn.width:= 420; //ListItem:= view.Items[1].rows.Add; //view.Items[1].caption:= 'sensor second'; NewColumn:= Columns.add; NewColumn.Caption:= 'Description'; newColumn.width:= 180; NewColumn:= Columns.add; NewColumn.Caption:= 'FCast'; newColumn.width:= 60; {sListItem:= view.Items.Add; slistitem.caption:= 'temp.name'; slistitem.subitems[1].caption:='temp.name' } {colums= < item AutoSize = True Caption = 'Content' ImageIndex = 3 end> } HotTrack:= True; HotTrackStyles:= [htHandPoint]; //IconOptions.AutoArrange = True RowSelect:= True; //ParentShowHint:= False; hint:= 'Dblclick for Satellite Map'; ShowHint:= True; font.size:= 14 SmallImages:= ImageList2; //StateImages: = ImageList2; //TabOrder = 4 //ListView_SetTextColor(View.Handle, $123ADA) //ListView_SetTextBkColor(view.handle, $ADA123) ListView_SetTextBkColor(view.handle, $8deeed) // $9cc123) ondblclick:= @listclick; onmousedown:= @listclick2; onkeypress:= @edit1KeyPress; //@test data {ViewStyle:= vsReport; for It:= Application.ComponentCount - 1 downto 0 do begin Temp:= application.Components[It]; begin ListItem:= view.Items.Add; ListItem.Caption:= Temp.Name; //listitem.subitems.add(temp.name) end; end;} viewstyle:= vsreport; readonly:= false; //ListItem:= view.Items.Add; ListItem:= view.Items.Add; ListItem.Caption:= '801 Cologne'; //ListItem.SubItems.Add(' Add a new city above '); ListItem.SubItems.Add('Add a new city or town to the list'); ListItem.SubItems.Add('mX 4.7.6.10'); items[0].EditCaption; // //EditColumn(listitem,0, 'maxbox') {ListItem:= view.Items.Add; ListItem.Caption:= '200 Bern city test4'; EditColumn(listitem,1, 'hot images on a coolbar') EditColumn(listitem,2, 'mX4.6.2.10') } //update test { listitem:= Items.Item[1]; listitem.Caption:='11'; //listitem.SubItems.ValueFromIndex[0]:='22'; //listitem.SubItems.ValueFromIndex[1]:='33'; listitem.SubItems.strings[0]:='22'; listitem.SubItems.strings[1]:='33'; } if isInternet then begin sr:= GetGeoWeather('kiruna', UrlWeatherReport25); //showmessage(sr) getMultipleWeather(sr) ListItem:= view.Items.Add; SetImageTemperatur(listitem) //listitem.imageindex:= 2 AddlistItem(listitem) {ListItem2:= view.Items.Add; SetImageTemperatur(listitem2) //listitem.imageindex:= 2 AddlistItem(listitem2) } writeln(sr) sr:= GetGeoWeather('trieste', UrlWeatherReport25); getMultipleWeather(sr) ListItem:= view.Items.Add; SetImageTemperatur(listitem) //listitem.imageindex:= 2 AddlistItem(listitem) writeln(sr) sr:= GetGeoWeather('koeln', UrlWeatherReport25); getMultipleWeather(sr) ListItem:= view.Items.Add; SetImageTemperatur(listitem) // listitem.imageindex:= 2 AddlistItem(listitem) writeln(sr) getMultipleWeather(GetGeoWeather('klagenfurt', UrlWeatherReport25)) ListItem:= view.Items.Add; SetImageTemperatur(listitem) AddlistItem(listitem) ListView_SetTextBkColor(view.handle, $7dcced) // $9cc123) 0dcced writeln(sr) getMultipleWeather(GetGeoWeather('paris', UrlWeatherReport25)) ListItem:= view.Items.Add; SetImageTemperatur(listitem) AddlistItem(listitem) sr:= GetGeoWeather('bern', UrlWeatherReport25); getMultipleWeather(GetGeoWeather('bern', UrlWeatherReport25)) ListItem:= view.Items.Add; SetImageTemperatur(listitem) AddlistItem(listitem) writeln('bern sunsettest: '+sr) writeln(copy(sr, pos('sunrise":',sr)+9,10)) sunr:= copy(sr, pos('sunrise":',sr)+9,10); writeln('bern sunrise: ' +datetimetostr(UnixDateTimeToDelphiDateTime(strtoint(sunr)))) suns:= copy(sr, pos('sunset":',sr)+8,10); writeln('bern sunset: ' +datetimetostr(UnixDateTimeToDelphiDateTime(strtoint(suns)))) getMultipleWeather(GetGeoWeather('stockholm', UrlWeatherReport25)) ListItem:= view.Items.Add; SetImageTemperatur(listitem) AddlistItem(listitem) getMultipleWeather(GetGeoWeather('havana', UrlWeatherReport25)) ListItem:= view.Items.Add; SetImageTemperatur(listitem) AddlistItem(listitem) getMultipleWeather(GetGeoWeather('brussels', UrlWeatherReport25)) ListItem:= view.Items.Add; SetImageTemperatur(listitem) AddlistItem(listitem) //listitem.imageindex:= 2 //ListItem:= view.Items.Add; statbar1.panels.items[1].text:= sr; statbar1.hint:= sr; end else begin getMultipleWeather(jsonstr) ListItem:= view.Items.Add; with ListItem do begin Caption:= wrec.id+' '+wrec.city; SubItems.Add(wrec.temp+' ° temp bar: '+wrec.bar+' of humid: '+wrec.humid+'%'); SubItems.Add(wrec.descript); imageindex:= 2 end; statbar1.panels.items[1].text:= jsonstr; statbar1.hint:= jsonstr; //AnsiInsert( var dst : AnsiString; const src : AnsiString; index : Integer) asr:= ansistring(getbigpi); end; //This Number: 176 is this ASCII ° //view.subItems[2].caption:= 'sensor second'; { for it:= 1 to 20 do begin ListItem:= view.Items.Add; ListItem.Caption:= getrandomString(40); end;} //ViewStyle:=vsReport; end; end; Procedure loadPredictForm; var //statBar1: TStatusBar; NewColumn: TListColumn; asr: AnsiString; //atool: TCoolBar; ListItem: TListItem; begin aPFrm:= TForm.Create(self); //mT:= TTimer.Create(self); //mt.onTimer:= @TFrm1_timerRedrawTimer; //mt.interval:= MILLISECONDS; //mt.free; in on close with aPFrm do begin Caption:= '********** maXbox Weather Station6 Forecaster ***********'; //top:= 30; height:= 730; width:= 980; Position:= poScreenCenter; formstyle:= fsstayontop; Icon.LoadFromResourceName(HInstance,'ZHISTOGRAM'); //NEWREPORT'); //Color:= clBlack; onClose:= @TFrm2_closeForm; //onPaint:= @TFrm1_FormPaint; Canvas.Pen.color:= clBlue; Canvas.Pen.Width:= 10; BorderIcons:= [biSystemMenu, biMinimize]; BorderStyle:= bsSingle; //borderWidth:= 4; scaled:= true; autoscroll:= true; Show; //canvas.brush.bitmap:= getBitmapObject(Exepath+'examples\images\bmp47.bmp'); //Canvas.FillRect(Rect(50,50,500,200)); //canvas.draw(0,200, getbitmap(Exepath+'\examples\citymax.bmp')); //Show; end; pview:= TListview.create(aFrm); with pview do begin parent:= aPFrm; setbounds(10,15,940,660) //columns:= listitem DoubleBuffered:= False FlatScrollBars:= True readonly:= false; gridLines:= true; RowSelect:= True; NewColumn:= Columns.Add; NewColumn.Caption:= 'City:Country'; newColumn.width:= 140; newcolumn.alignment:= taLeftJustify; //newcolumn.color //newColumn.autosize:= true; // newColumn.imageindex:= 1; NewColumn:= Columns.add; NewColumn.Caption:= 'Weather Forecast Sensor'; newColumn.width:= 515; //ListItem:= view.Items[1].rows.Add; //view.Items[1].caption:= 'sensor second'; NewColumn:= Columns.add; NewColumn.Caption:= 'Description'; newColumn.width:= 200; NewColumn:= Columns.add; NewColumn.Caption:= 'TFCast'; newColumn.width:= 60; {sListItem:= view.Items.Add; slistitem.caption:= 'temp.name'; slistitem.subitems[1].caption:='temp.name' } onmousedown:= @listclickpredict; HotTrack:= True; HotTrackStyles:= [htHandPoint]; //IconOptions.AutoArrange = True RowSelect:= True; //ParentShowHint:= False; hint:= 'Dblclick for Detail Map'; ShowHint:= True; font.size:= 10 SmallImages:= ImageList2; //StateImages: = ImageList2; //TabOrder = 4 //ListView_SetTextColor(View.Handle, $123ADA) //ListView_SetTextBkColor(view.handle, $ADA123) ListView_SetTextBkColor(pview.handle, $8deeed) // $9cc123) //@test data {ViewStyle:= vsReport; end;} viewstyle:= vsreport; readonly:= false; //ListItem:= view.Items.Add; ListItem:= pview.Items.Add; ListItem.Caption:= '801 Forecast List Line'; //ListItem.SubItems.Add(' Add a new city above '); ListItem.SubItems.Add('Add a new city or town to the list'); ListItem.SubItems.Add('mX 4.7.4.64'); items[0].EditCaption; // //EditColumn(listitem,0, 'maxbox') {ListItem:= view.Items.Add; ListItem.Caption:= '200 Bern city test4'; EditColumn(listitem,1, 'hot images on a coolbar') EditColumn(listitem,2, 'mX4.6.2.10') } end; statbar2:= TStatusBar.Create(apFrm); with statbar2 do begin simplepanel:= false; parent:= apFrm; showhint:= true; parentcolor:= false; color:= clred; //panels.color:= clnavy; //sizeGrip hint:= 'this is a Weather Forecast in maXcalc'; Panels.add; panels.items[0].width:= 200; panels.items[0].text:= DateTimeToInternetStr(Now, true); Panels.add; panels.items[1].width:= 150; panels.items[1].text:= '150 get the forecaster solution'; end; if isInternet then begin sr:= GetGeoWeather('kiruna', UrlWeatherReport25); //showmessage(sr) getMultipleWeather(sr) ListItem:= pview.Items.Add; SetImageTemperatur(listitem) //listitem.imageindex:= 2 AddlistItem(listitem) writeln(sr) sr:= GetGeoWeather('trieste', UrlWeatherReport25); getMultipleWeather(sr) ListItem:= pview.Items.Add; SetImageTemperatur(listitem) //listitem.imageindex:= 2 AddlistItem(listitem) writeln(sr) end else begin getMultipleWeather(jsonstr) ListItem:= pview.Items.Add; with ListItem do begin Caption:= wrec.id+' '+wrec.city; SubItems.Add(wrec.temp+' ° temp bar: '+wrec.bar+' of humid: '+wrec.humid+'%'); SubItems.Add(wrec.descript); imageindex:= 2 end; //statbar2.panels.items[1].text:= jsonstr; statbar2.hint:= pview.hint; //jsonstr; //AnsiInsert( var dst : AnsiString; const src : AnsiString; index : Integer) end; statbar2.hint:= pview.hint //This Number: 176 is this ASCII ° //view.subItems[2].caption:= 'sensor second'; //ViewStyle:=vsReport; //end; end; Procedure sunrisesetRouter(lon, lat: float); var rs: TSTRiseSetRec; UT: TSTDateTimeRec; iday: TDateTime; begin UT.D:= currentdate; UT.T:= currenttime; //UT.T:= incdays(UT.D,1); iday:= date; iday:= adddays(iday,1); writeln(sttimetotimestring('hh:mm',UT.T,false)) for it:= 0 to 25 do begin //iday:= adddays(iday,1); //UT.d:= iday; ut.d:= stincdate(ut.d, it,0,0); rs:= sunriseset(UT.d, lon, lat); with rs do begin if orise >-1 then writeln('sunrise of '+stdatetodatestring('dd.mm.yyyy',ut.d,false)+' : ' +#9+sttimetotimestring('hh:mm', orise, false)+#9+ ' sunSet: '+ sttimetotimestring('hh:mm', oset, false)); end; end; end; var UserSpaceAvail, TotalSpaceAvail, DiskSize: Comp; {disk size} begin //@main initTabletmode; CheckBitmapIcons; if not InitGraphics(950, 310) then { 640x480 16 color } begin Writeln('Unable to set stat graphic mode'); //Exit; end; //*) loadForm; //loadViewForm; if decimalseparator <> '.' then showmessageBig('you might have a decimal problem - we help you to switch to .'); writeln('decimalseparator: '+decimalseparator) setdecimalseparator('.') with maxform1 do begin with memo2 do begin color:= clblack; font.color:= clweborange; font.size:= 16; end; end; //TFrm_r1Click(self); //view.ViewStyle:=vsReport; //TFrm_r2Click(Self); //TFrm_T1Click(Self); if GetDiskSpace('C',UserSpaceAvail,TotalSpaceAvail,DiskSize) then printF('UserSpaceAvail: %d TotalSpaceAvail: %d DiskSize: %d', [UserSpaceAvail div 1024,TotalSpaceAvail div 1024,DiskSize div 1024]); // maxform1.statusbar1.showhint:= true; with TClientSocket.create(self) do begin //writeln(TClientSocket(socket).host); writeln('TCustomWinSocket host: '+TCustomWinSocket(Socket).remotehost); writeln('TCustomWinSocket port: '+intToStr(TCustomWinSocket(Socket).remoteport)); Free end; //progbar.Position:= (hh * 60)+mm; writeln(itoa((hh * 60)+mm)) //writeln(getASCII) //property Socket: TClientWinSocket read FClientSocket;} writeln('köln time: '+datetimetostr(UnixDateTimeToDelphiDateTime(1446127190))) writeln('havana time: '+datetimetostr(UnixDateTimeToDelphiDateTime(1446125586))) writeln('Sunriseset table of Bern, CH') sunrisesetRouter(7.45,46.95); //writeln(getascii) if isInternet then begin writeln('GetRealIP2_string: '+GetRealIP2) writeln('Weather Report date: '+DateTimeToInternetStr(now, true)) write('Local Weather Sensor: '+localcity+' '+localcountry) sr:= GetGeoWeather(localcity+','+localcountry, UrlWeatherReport25); getMultipleWeather(sr) if localcity <> '' then myedit.text:= localcity+','+localcountry else myedit.text:= ' Klagenfurt'; end; //init zoomf:= 16; raiselastwin32; print(getAscii) //8 ¦ 8 End. -------------------------------------------------------------------------------- Doc: var aFrm: TForm; mT: TTimer; tB: TTrackBar; statBar1: TStatusBar; http://www.whoishostingthis.com/resources/delphi/ //**************************Form Builder******************************* procedure loadForm; var tB: TTrackBar; begin aFrm:= TForm.Create(self); //mT:= TTimer.Create(self); //mt.onTimer:= @TFrm1_timerRedrawTimer; //mt.interval:= MILLISECONDS; //mt.free; in on close with aFrm do begin Caption:= '********** Form Template ***********'; height:= 510; width:= 700; Position:= poScreenCenter; //Color:= clBlack; onClose:= @TFrm1_closeForm; //onPaint:= @TFrm1_FormPaint; Canvas.Pen.color:= clBlue; Canvas.Pen.Width:= 15; BorderIcons = [biSystemMenu, biMinimize] BorderStyle = bsSingle Show; canvas.brush.bitmap:= getBitmapObject(Exepath+'examples\images\bmp47.bmp'); Canvas.FillRect(Rect(600,300,100,100)); end; with TBitBtn.Create(aFrm) do begin Parent:= aFrm; setbounds(310,390,150,55); caption:= 'Pause'; font.size:= 12; glyph.LoadFromResourceName(getHINSTANCE,'CL_MPPAUSE'); mXButton(05,05,width, height,12,12,handle); //event handler onClick:= @TFrm1_PauseClick; end; with TBitBtn.Create(aFrm) do begin Parent:= aFrm; setbounds(490,390,150, 55); caption:= 'Close'; font.size:= 12; glyph.LoadFromResourceName(getHINSTANCE,'CL_MPSTOP'); mXButton(05,05,width, height,12,12,handle); onClick:= @TFrm1_CloseClick; end; tB:= TTrackBar.create(aFrm); with tB do begin parent:= aFrm; setBounds(40,402,230,40); Min:= 10; Max:= 100 Frequency:= 10 Position:= 1000 div 50; linesize:= 4; ThumbLength:= 30; SetFocus; OnChange:= @TFrm1_trackSpeedChange; end; statbar1:= TStatusBar.Create(aFrm); with statbar1 do begin parent:= aFrm; showhint:= true; //sizegrip hint:= 'this is a LED BoX'; Panels.add; panels.items[0].width:= 200; panels.items[0].text:= '200'; Panels.add; panels.items[1].width:= 150; panels.items[1].text:= '150'; end; end; object mainForm1: TmainForm1 Left = 227 Top = 124 HelpContext = 1 BorderIcons = [biSystemMenu, biMinimize] BorderStyle = bsSingle BorderWidth = 1 Caption = 'maTRIx by maX' ClientHeight = 501 ClientWidth = 746 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] Menu = MainMenu1 OldCreateOrder = False Position = poDesktopCenter Scaled = False OnActivate = FormActivate OnCreate = FormCreate OnDestroy = FormDestroy PixelsPerInch = 96 TextHeight = 13 object Splitter1: TSplitter Left = 177 Top = 41 Width = 2 Height = 421 Cursor = crHSplit ResizeStyle = rsLine end object StatusBar1: TStatusBar Left = 0 Top = 482 Width = 746 Height = 19 Panels = <> SimplePanel = True SimpleText = 'StatusLine: OK' SizeGrip = False end object CoolBar1: TCoolBar Left = 0 Top = 0 Width = 746 Height = 41 Bands = < item object ToolBar1: TToolBar Left = 9 Top = 0 Width = 729 Height = 49 Align = alClient ButtonHeight = 36 ButtonWidth = 69 EdgeInner = esNone EdgeOuter = esNone Flat = True HotImages = ImageList1 Images = ImageList2 ShowCaptions = True TabOrder = 0 Transparent = True object tbtnClose: TToolButton Left = 0 Top = 0 Caption = '&Close' ImageIndex = 1 ParentShowHint = False ShowHint = False OnClick = tbtnCloseClick end object ToolButton2: TToolButton Left = 69 Top = 0 Width = 8 Caption = 'ToolButton2' ImageIndex = 1 Style = tbsSeparator end object tbtnGenerator: TToolButton Left = 77 Top = 0 Caption = '&Generator' ImageIndex = 2 OnClick = MovingAverage1Click end object tbtnOptions: TToolButton Left = 146 Top = 0 Caption = '&Options' ImageIndex = 3 Style = tbsCheck OnClick = tbtnOptionsClick end object tbtnTrans: TToolButton Left = 215 Top = 0 Caption = '&Transaction' ImageIndex = 0 OnClick = tbtnTransClick end object ToolButton5: TToolButton Left = 284 Top = 0 Width = 13 Caption = 'ToolButton5' ImageIndex = 3 Style = tbsSeparator end end end object progBar: TProgressBar Left = 0 Top = 462 Width = 746 Height = 20 Align = alBottom Min = 0 Max = 100 Smooth = True TabOrder = 2 Visible = False end object TreeView1: TTreeView Left = 0 Top = 41 Width = 177 Height = 421 Align = alLeft AutoExpand = True Images = ImageList4 Indent = 19 ReadOnly = True TabOrder = 3 OnChange = TreeView1Change end object view: TListView Left = 179 Top = 41 Width = 567 Height = 421 Align = alClient Columns = < item AutoSize = True Caption = 'Content' ImageIndex = 3 end> HotTrack = True HotTrackStyles = [htHandPoint] IconOptions.AutoArrange = True RowSelect = True ParentShowHint = False ShowHint = True SmallImages = ImageList5 StateImages = ImageList5 TabOrder = 4 ViewStyle = vsReport OnClick = viewClick end object MainMenu1: TMainMenu Left = 240 Top = 136 object Datei1: TMenuItem Caption = '&File' object mnOpentree: TMenuItem Caption = '&Open Tree' OnClick = mnOpentreeClick end object Beenden1: TMenuItem Caption = '&Close' OnClick = tbtnCloseClick end end object Registry1: TMenuItem Caption = '&Tools' object Fractals: TMenuItem Caption = 'Fractals...' OnClick = FractalsClick end object Generator: TMenuItem Caption = '&Chart Generator...' OnClick = MovingAverage1Click end object Verschlsseln1: TMenuItem Caption = '&Encrypt/ Decrypt' object mnEncrypt: TMenuItem Caption = '&Encrypt' OnClick = mnEncryptClick end object mnDecrypt: TMenuItem Caption = '&Decrypt' OnClick = mnDecryptClick end end object MATestCase1: TMenuItem Caption = 'MA TestCase' OnClick = MATestCase1Click end object mnSearch: TMenuItem Caption = '&Search in Memo' OnClick = mnSearchClick end object mnRegistryReader: TMenuItem Caption = '&Registry Reader' object r1: TMenuItem Caption = 'Run' OnClick = r1Click end object r2: TMenuItem Caption = 'RunOnce' OnClick = r2Click end object R3: TMenuItem Caption = 'RunOnceEX' OnClick = R3Click end object R4: TMenuItem Caption = 'RunServices' OnClick = R4Click end object R5: TMenuItem Caption = 'RunServicesOnce' OnClick = R5Click end object T1: TMenuItem Caption = 'TypedURLs' OnClick = T1Click end end end object info1: TMenuItem Caption = '&Info' OnClick = info1Click object options: TMenuItem Caption = '&Options' OnClick = tbtnOptionsClick end end end object ImageList1: TImageList Left = 504 Top = 72 object ImageList3: TImageList Left = 196 Top = 210 The set of APIs within a device family is broken down into subdivisions known as API contracts. See Device families. This reference topic enumerates for Windows 10 all of the API contracts and their versions, with links to the and the APIs within each, with links to topics with more info on each particular API contract. http://www.streamlineicons.com/img/preview/preview-free-pack.svg http://sm-artists.com/?page_id=925 https://thecattlecrew.wordpress.com/2014/10/31/analyse-der-software-qualitat-mit-sonarqube/ GetRealIP2_string: { "ip": "85.4.239.55", "hostname": "55.239.4.85.dynamic.wline.res.cust.swisscom.ch", "city": "Tann", "region": "Zurich", "country": "CH", "loc": "47.2682,8.8479", "org": "AS3303 Swisscom (Switzerland) Ltd", "postal": "8632" } Weather Report date: Fri, 18 Dec 2015 10:50:16 +0100 Local Weather Sensor: Tann CH Weather Id:802 is Clouds in: Tann at 6.35 of 1027 pressure with 100% humidity http://www.poertschach.at/de/wetter/detail#_webcams Havana, La Habana, Cuba | 23° 7' 48"N, 82° 23' 24"W coord of Havana :CU : -82.36 23.14 Cologne, North Rhine-Westphalia, Germany | 50.95°N, 6.97°E coord of Koeln :DE : 6.96 50.94 http://www.wolframalpha.com/input/?i=coordante+sydney,+au Klagenfurt, Carinthia, Austria | 46.62°N, 14.31°E coord of Klagenfurt :AT : 46.62 14.31 https://translate.google.com/?sl=de&tl=en&text=praktikum%20in%20zwei%20gruppen%20zusammen%0AGruppe%201%20OpenSSL%2C%20Signtool%20mit%20Python%2C%20Bj%C3%B6rn%0AGruppe%202%20OpenSSL%20im%20Tor%20Browser%20als%20Onion%2C%20Sandro%0A%0AGrundschutz%3A%0AVerf%C3%BCgbarkeit%0AVerl%C3%A4sslichkeit%20(Integrit%C3%A4t)%0AVertraulichkeit%0AVerbindlichkeit%0A%0ARisiko%20bei%20%20Password%20fischen%0AR%20%3D%2020%20*%2070%20%3D%2014%0AR%20RussRoul%20%20%3D%201%2F6%20*%20100%20%3D%201%2F6%20%3D%200%2C27%3F%0A%2B%20positive%205%2F6%20*%20100%20%3D%205%2F6%0ASicherheit%20%3D%201%20-%20Risiko%20%3D%2086%20%3D%20Schwellenwert%20%3E%2070%0ARestrisiko%20%3D%2014%0Aunpredictability%0A%0Aerstelle%20eine%20konfusionsmatrix%20mit%20den%205%20f%C3%A4llen%0A%20%20%20%20%20%200%20%20%20%20%20%20%20%20%20%20%201%0A0%20%20%20%20%20%20%20%20%20%20I%20%20%20%20%20%20%0A%20%20%20%20%20---------------%0A1%20%20%20%20%20%20%20%20%20%20I%20%20%20%20%200%0A%20&op=translate