Be yourself; Everyone else is already taken.
— Oscar Wilde.
This is the first post on my new blog. I’m just getting this new blog going, so stay tuned for more. Subscribe below to get notified when I post new updates.
maXbox
Be yourself; Everyone else is already taken.
— Oscar Wilde.
This is the first post on my new blog. I’m just getting this new blog going, so stay tuned for more. Subscribe below to get notified when I post new updates.
When you travel Europe by train, you’ll discover that it’s a fascinating continent. It offers many different cultures, wonderful scenery, and world-renowned cities like the previously known Trans Europ Express TEE. All of this is well-connected by rail 7 days in one month with a digital global pass. Here’s my experience in four countries:
Find out where you can go and why exploring Europe by train with Eurail is the most flexible and unforgettable experience!
Innsbruck is the capital of Tyrol and the fifth-largest city in Austria. On the River Inn, at its junction with the Wipp Valley, which provides access to the Brenner Pass 30 km to the south, it had a population of 132,493 in 2018.
There are 12 bridges that connect Innsbruck’s 20 districts, but the most important and well-known this one called, Innbrücke which also appears on the city’s coat of arms.
Wondering what Innsbruck means? Well, it comes from two German words. Inn, means ‘a river’, and brücke, is ‘a bridge’. So, Innsbruck literally means “bridge over the (River) Inn”.
It was a fresh snow ride because it had snowed half a meter the night before!
Another reason to visit the Innbrücke is for the wonderful views and endless photo potential with the row of colorful buildings lining the river set directly below the towering mountains.
Munich’s Marienplatz with the New City Hall is the world-famous center of the Bavarian capital. The magnificent New City Hall on the north side dominates the square-shaped plaza In the tower of the city hall is a viewing platform, below which the historic carillon (glockenspiel) sounds twice a day.
At voco® Strasbourg Centre – The Garden, you’ll find contemporary style, an eco-friendly ethos, and a prestigious location in the near heart of the city 10. min. from Rail-station (be aware of the slippery shower).
Mannheim (German pronunciation: ; Palatine German: Mannem or Monnem), officially the University City of Mannheim (German: Universitätsstadt Mannheim), is the second-largest city in the German state of Baden-Württemberg after the state capital of Stuttgart, and Germany’s 21st-largest city, with a 2020 population of 309,119 inhabitants.
The train was overcrowded but interesting & ambient.
A remark about digital interrail and online connection: in my experience it is not necessary to be online on the train, it is better to take a screenshot (hardcopy) of the QR-code and then show it (the file) to the inspector. You can get a screenshot in Android by pressing volume and on/off switch at the same time. So you don’t have to rely on an online connection on the train.
Der Stachus, offiziell Karlsplatz, ist ein Platz im Zentrum Münchens. Er wird halbkreisförmig vom neobarocken Stachus-Rondell umgeben, das 1899–1901 nach Plänen von Gabriel von Seidl errichtet wurde. Der Stachus gehört zu den verkehrsreichsten Plätzen Europas.
The Isartor at the Isartorplatz in Munich is one of four main gates of the medieval city wall. It served as a fortification for the defence and is the most easterly of Munich’s three remaining gothic town gates. The gate is located close to the Isar and was named after the river.
Difficult Days at Cologne due the DB strike.
The Basilica church of St. Ursula is located in Cologne, North Rhine-Westphalia, Germany. It is built upon the ancient ruins of a Roman cemetery, where the 11,000 virgins associated with the legend of Saint Ursula are said to have been buried.
Cologne Cathedral, German Kölner Dom, Roman Catholic cathedral church, located in the city of Cologne, Germany. It is the largest Gothic church in northern Europe and features immense twin towers that stand 515 feet (157 metres) tall. The cathedral was designated a UNESCO World Heritage Site in 1996.
A large Saturn store has been located on the top floor of the Kaufhof department store on Hohe Strasse in Cologne since 1995. When Jacobi’s clothing store next door became vacant last year, this gave Saturn an opportunity to move into its own building in a prominent location. “The name Saturn is closely associated with the city of Cologne.
Köln Hbf is a important rail hub which is served by international Thalys, ICE and ÖBB Nightjet trains. Next the hi-speed train from Cologne to Frankfurt:
The Frankfurt Main Train Station is one of the largest train stations in Europe and is located just west of the city center. More than 350,000 travelers use this station every day. To be able to manage this great volume of traffic, the central station has more than 25 platforms in five departure halls.
For the trips we used an Android12 with maXbox4 scripts:
Electric locomotive E 10 1311 of the Deutsche Bundesbahn. In May 1962, the Deutsche Bundesbahn put six E 10 locomotives with special Henschel bogies and designed for a maximum speed of 160 km/h into service for the high-speed “Rheingold” and “Rheinpfeil” trains.
Electric locomotive CC 6574 of the French State Railways. The National French Railways (SNCF) put these electric locomotives, which were up until then the most powerful in French history, into service in 1969 as the CC 6500. A total of 74 locomotives were built in three series featuring different side wall designs. During their initial years of operation, these locomotives were used to draw renowned express trains such as the “Mistral” or the “Capitole” due to their maximum speed of 200 km/h.
Translated Description from PIKO: New for 2022: variant of the class 110.3 as class E 10 1270 of the DB in epoch III. The model of the E 10 impresses with the exact execution of the variant with front apron, buffer cladding and raised DB logo.
HN2585 SNCF, electric locomotive CC 21001 in silver livery, ep. IV
HN2586 SNCF, electric locomotive CC 21004 in beton grey livery with noodle logo, ep. IV-V
DB BR112 Electric Locomotive IV
Minitrix 16265 Gauge N Electric locomotive BR 114 of the DB, epoch IV-V
SBB Re 4/4 460 083-9 TEE Hag 280.34 Limitiert Lok Nummer; 460 083-9 ” TEE ” Lokname “Europa” – HAG 280.34 – Phantasiemodell von HAG – limitierte Auflage 350 Stück – ohne Zertifikat
{“lang”: “en”, “all_text”: “GIESINGER\nalc. 5.3% vol\ne 0,50\nGleSINGER\nNaturtrübes\nKellerbier\nplandtasch\nA\nDB”, “annotations”: [“GIESINGER”, “alc”, “.”, “5.3”, “%”, “vol”, “e”, “0,50”, “GleSINGER”, “Naturtrübes”, “Kellerbier”, “plandtasch”, “A”, “DB”]}
mX4 executed: 19/04/2023 08:45:13 Runtime: 0:0:5.583 Memload: 45% use
Culture Club are an English pop band formed in London in 1981 like Grauzone or G9. The band comprises Boy George (lead vocals), Roy Hay (guitar and keyboards), and Mikey Craig (bass guitar), and formerly included Jon Moss (drums and percussion). Emerging in the New Romantic scene, they are considered one of the most representative and influential groups of the 1980s..
Bahn Betriebs Labor Dübendorf
1 Wagen “Arbaléte” A8tu TEE, SNCF, RailTop, 31101
1 Wagen “Mistral” 69, A8tu TEE, SNCF, LS 41007
1 Personenwagen mit Gepäckabteil, “Mistral” 69 A4Dtux TEE, SNCF, LS 41003-3
1 Speisewagen, WRmh132 TEE, DB, Fleischmann
{“lang”: “fr”, “all_text”: “StarRail”\nModel Railways\nEUROP EXPRESS\nTEE\nRailTop-Modell HO\nSBB CFF\n101\nMade by Modern Gala\n41 007\nJahre/ans/anni/years\n1957-2007\n31101\nAstu 61 85 18-89 002-4\nEp. IV a\nINOX L’ARBALÈTE/CISALPIN\nSNCF\nEp. IVb\nVoiture Mistral 69 A8tu\nLivrée inox, bandeau TEE\n61 87 18-80 928 6 (couloir central, siges rouges)\nMade by Modern Gals\n41 003-3\nVoiture Mistral 69 A40x\nKANAL TEE\nSNCF\nEp. 1Vb”, “annotations”: [“StarRail”, “””, “Model”, “Railways”, “EUROP”, “EXPRESS”, “TEE”, “RailTop”, “-“, “Modell”, “HO”, “SBB”, “CFF”, “101”, “Made”, “by”, “Modern”, “Gala”, “41”, “007”, “Jahre”, “/”, “ans”, “/”, “anni”, “/”, “years”, “1957-2007”, “31101”, “Astu”, “61”, “85”, “18-89”, “002-4”, “Ep”, “.”, “IV”, “a”, “INOX”, “L’ARBALÈTE”, “/”, “CISALPIN”, “SNCF”, “Ep”, “.”, “IVb”, “Voiture”, “Mistral”, “69”, “A8tu”, “Livrée”, “inox”, “,”, “bandeau”, “TEE”, “61”, “87”, “18-80”, “928”, “6”, “(“, “couloir”, “central”, “,”, “siges”, “rouges”, “)”, “Made”, “by”, “Modern”, “Gals”, “41”, “003-3”, “Voiture”, “Mistral”, “69”, “A40x”, “KANAL”, “TEE”, “SNCF”, “Ep”, “.”, “1Vb”]}
{"lang": "de", "all_text": "A1 Frankreich\nSNCF Turbo\nAntrieb\nLeng\nRochschwindigke\nLange über Puffer\nC1\nFS TEX 442\nAmbleb\nLeshand\nHöchstgeschwindigkeit\nLange ober Puffer\nE1\nBLS 44\nAntrieb\nLeistung\nItalien\nSchweiz\nHochechwindigkeit\nLänge über Puter\nDB 119\nAntrieb\nLeng\nG1 Deutschland I\n450-1100 PS\n180 kw\nHechingeschwindigke\nLange über Puffer\nDewide\n87,10m\n16101\n\"\nDiesel\n1000 PS\n96,15m\n10001\n+\nElektro\n6240 P\n140 km\n15,1\n60.0\nEladro\n5500PS\n180 k\n16.\n11800\nA2 Frankreich\nSNCF CC 40100\nA\nCaistung\nHodgedwindigke\nLangeber Puer\nGewicht\nC2\nFS AL 601\nLeistung\nHachangeschwindigk\nLange über Puffer\nGewicht\nItalien\nE2 Schweiz\nBLS A\nAntrieb\nLeistung\nHochargeschwindigkeit\nLangeber Puffer\nDB 181 Europ\nAntrieb\nCCC\nG2 Deutschland It\n5000 PS\n240\nHochstgeschadig\nLange über Puffer\nGewicht\n12.30\n1080\nEleare\n1000\n180 km\n21,4m\n+\nElektro\nPS\n125 km\n30.33m\n160.01\nElektro\n4400 PS\nInd\n100Ah\n16,96\n8401\nA3 Frankreich A4 Frankreich\nSNCF B 9292\nAntrieb\nLeistung\nHöchstgeschwindigke\nLangeber Puffer\nGele\nC3\nFS E 444\nAntrieb\nLeting\nItalien\n588 A 66\nAnt\nLeistung\nGrt\nHochedwigkeit\nLinge über Puffer\nGew\nE3 Schweiz Il\nHochingeschwindigke\nLange über Puffer\nGewicht\nG3 Deutschland II\nDB 220\nArtrieb\nLeistung\nHida\nLange über Puffer\nGewicht\nDe\n5770 PB\n200 km\n18.20\n201\nElektro\n4150 P\n200 km\n104\n79.01\nElektro\n0000 PS\n125 km\n15,4m\n120.01\nDiesel\n2x 1100 PS\n140\n16.47 m\n81,01\nSNCF CC\nArtrab\nLetting\nHochgeschikt\nLange her Puffe\nC4\nFSE 646\n44\nAntrieb\nLeatuto\nHochgeschwindigke\nLange bar Puffer\nGewid\nE4\nItalien\nSchweiz II\nSEZ,Blauer Pla\nAsteb\nLeistung\nHochgeschwindigkeit\nLange über Puffer\nGewicht\nDB 218\nAntrieb\nLeistung\nG4 Deutschland II\nHodhetgeschwindigkeit\nLange über Puffer\nGewicht\nDato\n4000 PS\n220\n2019\nElektro\n5850 PS\n145\n18.39\n110,01\nElektro\n1000 PS\n125 km\n47.30m\n96,01\nB1\n2500 PS\n130 km/h\n16,4 m\n76.51\nDia 068 1401\nLading\nLang\nGede\nD1\n201\nGe\nLiv\n+F1\nSkandinavien T\nSBB TEERA\nAnteb\nLeistung\nHochetgeschwindigkeit\nLange über Puffer\nGewicht\nwirdigen\nSchweiz\nCP 2500\nAntrieb\nDeutschland I\nDB TEE-Intercity\nAntrieb\nLeitung\nHöchstgeschwindigkeit\nLangeber Puffer\nGewicht\nH1 Portugal\nLeutung\nHochstgeschwindigke\nLange über Puffer\nGewe\nDevel\n1000 P\n***\n11701\nDisse\n1500 PS\n140 k\n3 men\nDiesel\n2000 PS\n140 kmh\n211,01\nB2 Skandinavien\n+D2\nElektro\n2700 PS\n120 km/\n70.51\nNorwegen NSB EL 14\nA\nLeating\ngedig\nHe\nLangeber Puffer\nSOTEERA\nAnt\nLung\nSchweiz\nHöchstgeschwindigke\nLinge über Puffer\nGewicht\nF2 Deutschland!\nDB 110,Rheingold\nAntrieb\nLeistung\nHochgeschwindigkeit\nLange über Puffer\nGew\nH2\nCP 2514\nAntrieb\nLaatung\nPortugal\nHochetgeschwendigkeit\nLarge über Puffer\nExpo\nP\nElektro\n3140 PS\n160 km/h\n140m\n2000¬\n13\nSKAL\n+ D3\nElektro\n5000 P\n100 km/h\n16,49\nM461\n0\nB3 SkandinavienB4 Skandinavien 188\nElektro\n2700 P\n120 km\n15.35m\n7201\nFinland VR 5062\nAb\nSchweiz I\nSBB TEE 44\nArteb\nLeistung\nHöchteschwindigkeit:\nLange über Puller\nGewicht\nF3\nDeutschland I\nDB 112 heinple\nAngeb\nLeistung\nHöchstgeschwindigke\nLarge über Puffer\nH3\nPortugal\nCP 1607\nAntrieb\nLeistung\nHochgeschwindig\nLange über Puter\nGewe\nDie\n1000 PS\n78.70m\n03.01\nElektro\n6320 PB\n140\n15,4m\nElektro\n5000 PS\n100 km\n15:44 m\n86.01\nFinland V\n+D4\nDiesel\n235 PS\n140\n18,08\n110,31\nLung\nHochitgeschwindighet\nLange über Puffer\nSchweiz\nSBB RABO 12/12\nAnti\nLenneg\ngeschwindigke\nLange über Puffer\nGewicht\nF4 Deutschland I\nDB 103 TEE\nAntrieb\nLang\nHöchstgeschwindigkeit\nLangeber Puffer\nGewicht:\nH4 Portugal\nCP Bader Expre\nElektro\n3100 PB\n125 km\n13,3m\n166.01\nLasking\nElektro\n1170PS\n120\n53.52\n91,01\nHostgeschwindighet\nLinge über Puffer\nGewicht\nElektro\nARISOPS\n165m\n112.01\nDiesel\n1800 PS\n130 k\n16.99\n116", "annotations": ["A1", "Frankreich", "SNCF", "Turbo", "Antrieb", "Leng", "Rochschwindigke", "Lange", "über", "Puffer", "C1", "FS", "TEX", "442", "Ambleb", "Leshand", "Höchstgeschwindigkeit", "Lange", "ober", "Puffer", "E1", "BLS", "44", "Antrieb", "Leistung", "Italien", "Schweiz", "Hochechwindigkeit", "Länge", "über", "Puter", "DB", "119", "Antrieb", "Leng", "G1", "Deutschland", "I", "450-1100", "PS", "180", "kw", "Hechingeschwindigke", "Lange", "über", "Puffer", "Dewide", "87,10m", "16101", "\"", "Diesel", "1000", "PS", "96,15m", "10001", "+", "Elektro", "6240", "P", "140", "km", "15,1", "60.0", "Eladro", "5500PS", "180", "k", "16", ".", "11800", "A2", "Frankreich", "SNCF", "CC", "40100", "A", "Caistung", "Hodgedwindigke", "Langeber", "Puer", "Gewicht", "C2", "FS", "AL", "601", "Leistung", "Hachangeschwindigk", "Lange", "über", "Puffer", "Gewicht", "Italien", "E2", "Schweiz", "BLS", "A", "Antrieb", "Leistung", "Hochargeschwindigkeit", "Langeber", "Puffer", "DB", "181", "Europ", "Antrieb", "CCC", "G2", "Deutschland", "It", "5000", "PS", "240", "Hochstgeschadig", "Lange", "über", "Puffer", "Gewicht", "12.30", "1080", "Eleare", "1000", "180", "km", "21,4m", "+", "Elektro", "PS", "125", "km", "30.33m", "160.01", "Elektro", "4400", "PS", "Ind", "100Ah", "16,96", "8401", "A3", "Frankreich", "A4", "Frankreich", "SNCF", "B", "9292", "Antrieb", "Leistung", "Höchstgeschwindigke", "Langeber", "Puffer", "Gele", "C3", "FS", "E", "444", "Antrieb", "Leting", "Italien", "588", "A", "66", "Ant", "Leistung", "Grt", "Hochedwigkeit", "Linge", "über", "Puffer", "Gew", "E3", "Schweiz", "Il", "Hochingeschwindigke", "Lange", "über", "Puffer", "Gewicht", "G3", "Deutschland", "II", "DB", "220", "Artrieb", "Leistung", "Hida", "Lange", "über", "Puffer", "Gewicht", "De", "5770", "PB", "200", "km", "18.20", "201", "Elektro", "4150", "P", "200", "km", "104", "79.01", "Elektro", "0000", "PS", "125", "km", "15,4m", "120.01", "Diesel", "2x", "1100", "PS", "140", "16.47", "m", "81,01", "SNCF", "CC", "Artrab", "Letting", "Hochgeschikt", "Lange", "her", "Puffe", "C4", "FSE", "646", "44", "Antrieb", "Leatuto", "Hochgeschwindigke", "Lange", "bar", "Puffer", "Gewid", "E4", "Italien", "Schweiz", "II", "SEZ", ",", "Blauer", "Pla", "Asteb", "Leistung", "Hochgeschwindigkeit", "Lange", "über", "Puffer", "Gewicht", "DB", "218", "Antrieb", "Leistung", "G4", "Deutschland", "II", "Hodhetgeschwindigkeit", "Lange", "über", "Puffer", "Gewicht", "Dato", "4000", "PS", "220", "2019", "Elektro", "5850", "PS", "145", "18.39", "110,01", "Elektro", "1000", "PS", "125", "km", "47.30m", "96,01", "B1", "2500", "PS", "130", "km", "/", "h", "16,4", "m", "76.51", "Dia", "068", "1401", "Lading", "Lang", "Gede", "D1", "201", "Ge", "Liv", "+", "F1", "Skandinavien", "T", "SBB", "TEERA", "Anteb", "Leistung", "Hochetgeschwindigkeit", "Lange", "über", "Puffer", "Gewicht", "wirdigen", "Schweiz", "CP", "2500", "Antrieb", "Deutschland", "I", "DB", "TEE", "-", "Intercity", "Antrieb", "Leitung", "Höchstgeschwindigkeit", "Langeber", "Puffer", "Gewicht", "H1", "Portugal", "Leutung", "Hochstgeschwindigke", "Lange", "über", "Puffer", "Gewe", "Devel", "1000", "P", "***", "11701", "Disse", "1500", "PS", "140", "k", "3", "men", "Diesel", "2000", "PS", "140", "kmh", "211,01", "B2", "Skandinavien", "+", "D2", "Elektro", "2700", "PS", "120", "km", "/", "70.51", "Norwegen", "NSB", "EL", "14", "A", "Leating", "gedig", "He", "Langeber", "Puffer", "SOTEERA", "Ant", "Lung", "Schweiz", "Höchstgeschwindigke", "Linge", "über", "Puffer", "Gewicht", "F2", "Deutschland", "!", "DB", "110", ",", "Rheingold", "Antrieb", "Leistung", "Hochgeschwindigkeit", "Lange", "über", "Puffer", "Gew", "H2", "CP", "2514", "Antrieb", "Laatung", "Portugal", "Hochetgeschwendigkeit", "Large", "über", "Puffer", "Expo", "P", "Elektro", "3140", "PS", "160", "km", "/", "h", "140m", "2000", "¬", "13", "SKAL", "+", "D3", "Elektro", "5000", "P", "100", "km", "/", "h", "16,49", "M461", "0", "B3", "SkandinavienB4", "Skandinavien", "188", "Elektro", "2700", "P", "120", "km", "15.35m", "7201", "Finland", "VR", "5062", "Ab", "Schweiz", "I", "SBB", "TEE", "44", "Arteb", "Leistung", "Höchteschwindigkeit", ":", "Lange", "über", "Puller", "Gewicht", "F3", "Deutschland", "I", "DB", "112", "heinple", "Angeb", "Leistung", "Höchstgeschwindigke", "Large", "über", "Puffer", "H3", "Portugal", "CP", "1607", "Antrieb", "Leistung", "Hochgeschwindig", "Lange", "über", "Puter", "Gewe", "Die", "1000", "PS", "78.70m", "03.01", "Elektro", "6320", "PB", "140", "15,4m", "Elektro", "5000", "PS", "100", "km", "15:44", "m", "86.01", "Finland", "V", "+", "D4", "Diesel", "235", "PS", "140", "18,08", "110,31", "Lung", "Hochitgeschwindighet", "Lange", "über", "Puffer", "Schweiz", "SBB", "RABO", "12/12", "Anti", "Lenneg", "geschwindigke", "Lange", "über", "Puffer", "Gewicht", "F4", "Deutschland", "I", "DB", "103", "TEE", "Antrieb", "Lang", "Höchstgeschwindigkeit", "Langeber", "Puffer", "Gewicht", ":", "H4", "Portugal", "CP", "Bader", "Expre", "Elektro", "3100", "PB", "125", "km", "13,3m", "166.01", "Lasking", "Elektro", "1170PS", "120", "53.52", "91,01", "Hostgeschwindighet", "Linge", "über", "Puffer", "Gewicht", "Elektro", "ARISOPS", "165m", "112.01", "Diesel", "1800", "PS", "130", "k", "16.99", "116"]} mX4 executed: 11/05/2023 10:28:41 Runtime: 0:0:2.501 Memload: 62% use
Trans Europ Express “Cisalpin”
86101 SET TEE Arbalète/Cisalpin I: 3 SNCF TEE-Wagen “Mistral 69”, A8tu+A8u+A4Dtu
86102 SET TEE Cisalpin II: 3 TEE Wagen “Mistral 69”, SBB A8tu+SNCF A8u+VRu
86103 SET TEE Cisalpin III: 3 TEE Wagen “Mistral 69”, SBB A8tu+SNCF A4rux+A8u
Restaurant Vru SNCF immatriculé 61 87 88-89 062-1
Voiture A8u SNCF immatriculée 61 87 88-89 907-2
Voiture A8tu SBB/CFF immatriculée 61 85 18-89 000-8 Très rare voiture des CFF
Voiture A8u SNCF immatriculée 61 87 18-89 901-5
Voiture A8tu SBB/CFF immatriculée 61 85 18-89 004-0 Très rare voiture des CFF -Yes
Voiture A3rtux SNCF immatriculée 61 87 84-89 040-1
Voiture A8tu SBB/CFF immatriculée 61 85 18-89 002-4 Très rare voiture des CFF -Yes
Sauschwänzlebahn Pfingsten 2023
As part of a unit on Trigonometry, we review compass and true bearings before working with bearings in Trigonometry problems.
To start this review lesson, we looked at some images from Google Earth.
It is very important in aviation to have knowledge of the nearby airports at any time in flight. The task is the following:
Determine the distance and bearing from an Airplane to the 20 nearest Airports whenever requested. Use the non-commercial data from openflights.org airports.dat as reference.
A request comes from an airplane at position ( latitude, longitude ): ( 46.94797, 7.44745 ). This is the place where the famous Zytglogge Tower (Clock Tower) at Bern Capital of Switzerland is.
{"png":"https://mainfacts.com/media/images/coats_of_arms/ch.png","svg":"https://mainfacts.com/media/images/coats_of_arms/ch.svg"},"startOfWeek":"monday","capitalInfo":{"latlng":[46.92,7.47]},"postalCode":{"format":"####","regex":"^(\d{4})$"}}]
Latitude and Longitude are the units that represent the coordinates at geographic coordinate system.
Your report should contain the following information from table airports.dat (column shown in brackets below):
ICAO Distance Bearing Country Airport
LSZB 2.9 135 Switzerland Bern Belp Airport
//46.914100647,7.497149944309999
LSZP 10.6 323 Switzerland Biel-Kappelen Airport
LSZW 13.1 151 Switzerland Thun Airport
LSZG 14.1 355 Switzerland Grenchen Airport
//"ZHI","LSZG",47.181599,7.41719,1411,1,"E","Europe/Zurich",ts
LSGE 19.1 233 Switzerland Ecuvillens Airport
Name(2), Country(4), ICAO(6), Distance and Bearing calculated from Latitude(7) and Longitude(8).
procedure FindNearest(var testKoors:tDst_Bear;cntAirports,cntNearest:Integer);
var i: Int32;
begin
Init_MinSol(cntNearest);
For i:= 0 to cntAirports-1 do Begin
testKoors.Koor2:= AirPorts[i].Sol_Koor;
Calc_Dist_bear(testKoors);
Insert_Sol(testKoors,i);
end;
end;
Distance is measured in nautical miles (NM). Resolution is 0.1 NM.
Bearing is measured in degrees (°). 0° = 360° = north then clockwise 90° = east, 180° = south, 270° = west. Resolution is 1°.
procedure Out_MinSol;
var
i: integer;
begin
writeln(' ICAO Distance Bearing Country Airport');
writeln(' ---- -------- ------- -------------- ---------');
For i:= 0 to minSols.actidx do
with AirPorts[minSols.sols[i].AirportIdx] do
writeln(Format(' %4s %8.1f %7.0f %-14s %-35s',
[Sol_ICAO,
Sol_dist_dir.distance*DiaEarth,
Sol_dist_dir.bearing*cRadToDeg,
Sol_Country,Sol_Name]));
writeln('');
writeln(itoa(cntInserts)+' inserts to find them');
end;
The output shows distance and bearing from the point of view, in our example the Zytglogge-Tower. Bearing is the angle to the next airport:
3469 ms for reading airports.dat
30531 ms for searching 100 times of 20 nearest out of 7698 airports
202 inserts to find them
Nearest to latitude 46.94797,longitude 7.44745 degrees
Thats what the image detector sees:
URL_APILAY = ‘https://api.apilayer.com/image_to_text/url?url=%s’;
{“lang”: “und”, “all_text”: “Coordinates\n50 m\n605101, 195119\n46.90716, 7.50559\n32\nplatzstrasse\n\n…\nP”, “annotations”: [“Coordinates”, “50”, “m”, “605101”, “,”, “195119”, “46.90716”, “,”, “7.50559”, “32”, “platzstrasse”, “”, ““, “…”, “P”]}
On the other side of the runway you see 14 that means 32–18= 14 or 140° in the opposite direction (reciprocal calculation).
ICAO Distance Bearing Country Airport
LSZB 2.9 135 Switzerland Bern Belp Airport
LSZP 10.6 323 Switzerland Biel-Kappelen Airport
LSZW 13.1 151 Switzerland Thun Airport
LSZG 14.1 355 Switzerland Grenchen Airport
LSGE 19.1 233 Switzerland Ecuvillens Airport
LSZJ 20.3 314 Switzerland Courtelary Airport
LSGR 22.2 155 Switzerland Reichenbach Air Base
LSMP 22.7 254 Switzerland Payerne Air Base
LSGN 23.9 272 Switzerland Neuchatel Airport
LSMI 24.1 132 Switzerland Interlaken Air Base
LSTS 27.1 183 Switzerland St Stephan Airport
LSGC 28.0 287 Switzerland Les Eplatures Airport
LSGK 28.8 196 Switzerland Saanen Airport
LSMM 29.8 114 Switzerland Meiringen Airport
LSPO 29.9 37 Switzerland Olten Airport
LSPN 30.7 57 Switzerland Triengen Airport
LSZQ 31.7 328 Switzerland Bressaucourt Airport
LSZO 34.2 65 Switzerland Luzern-Beromunster Airport
LSMA 34.3 90 Switzerland Alpnach Air Base
LSGY 36.0 252 Switzerland Yverdon-les-Bains Airport
202 inserts to find them
mX4 executed: 23/02/2023 13:26:09 Runtime: 0:0:36.103 Memload: 44% use
OpenWeb('https://www.latlong.net/c/?lat='+flots(myKoor.lat/cDegToRad)+
'&long='+flots(myKoor.lon/cDegToRad));
Data: openflights.org/data: Airport, airline and route data
Source code of the app:
A good discussion to start thinking about bearings, how they fit into 360°, how standards are used around the world and why true bearings are often used rather than compass bearings and what’s the difference to heading.
[You might also want to read How Runways Are Designated
Max Kleiner, 23/02/2023
Dubendorf
{"lang": "en", "all_text": "search.ch\n0\nDB Delphi Basics x\n\nWebmail :: WelcX\n50 m\n¸search.ch, swisstopo, OpenStreetMap, others\nmaxbox news x\nDirectory\nWeather\nmXScriptasHTMX\nO8 https://map.search.ch/?q=Restaurant+Holding,+Dübendorf,+Ueberlandstr.+271&near=662000,190000&pos=692307,250\nÅ Restaurant Holding, Dübendorf, Ueberlandstr. 271\nIm grossen Stein\nMap / Route\nInbox (3) - max X\nTimetable\nX\nLeisure\nInterrail 2023 - X\nQ\nTV guide\nImage to Text A X S Map of Switzerl X\nkenweg\nCinema\nWeb search\nÖnikenweg\n+\nMore\n>\n|\nMap\nX\nEN 1\n=\n+1\nGue", "annotations": ["search.ch", "0", "DB", "Delphi", "Basics", "x", "", "Webmail", "::", "WelcX", "50", "m", "¸search.ch", ",", "swisstopo", ",", "OpenStreetMap", ",", "others", "maxbox", "news", "x", "Directory", "Weather", "mXScriptasHTMX", "O8", "https://map.search.ch/?q=Restaurant+Holding,+Dübendorf,+Ueberlandstr.+271&near=662000,190000&pos=692307,250", "Å", "Restaurant", "Holding", ",", "Dübendorf", ",", "Ueberlandstr", ".", "271", "Im", "grossen", "Stein", "Map", "/", "Route", "Inbox", "(", "3", ")", "-", "max", "X", "Timetable", "X", "Leisure", "Interrail", "2023", "-", "X", "Q", "TV", "guide", "Image", "to", "Text", "A", "X", "S", "Map", "of", "Switzerl", "X", "kenweg", "Cinema", "Web", "search", "Önikenweg", "+", "More", ">", "|", "Map", "X", "EN", "1", "=", "+1", "Gue"]}
mX4 executed: 19/04/2023 09:12:51 Runtime: 0:0:1.784 Memload: 45% use
As it can be seen the image2text API missed the 29 on the runway so I did a second screenshot with less information to get a second trial:
Nope, it cant see the angle on the runway:
{"lang": "und", "all_text": "Coordinates\n692113, 250204\n47.39621, 8.65879\nIm grossen Stein", "annotations": ["Coordinates", "692113", ",", "250204", "47.39621", ",", "8.65879", "Im", "grossen", "Stein"]}
mX4 executed: 19/04/2023 09:30:30 Runtime: 0:0:6.747 Memload: 49% use
The solution is to rotate the image to a better angle (but not find the runway marks, he still can’t find it ):
{"lang": "und", "all_text": "Coordinates\n692113, 250204\n47.39621, 8.65879\nIm grossen Stein\nWeg", "annotations": ["Coordinates", "692113", ",", "250204", "47.39621", ",", "8.65879", "Im", "grossen", "Stein", "Weg"]}
Nearest to latitude -6.08169,longitude 145.39198 degrees
ICAO Distance Bearing Country Airport
AYGA 0.0 0 Papua New Guinea Goroka Airport
AYCH 25.4 278 Papua New Guinea Chimbu Airport
AYMD 57.6 24 Papua New Guinea Madang Airport
AYMH 67.2 283 Papua New Guinea Mount Hagen Kagamuga Airport
AYNZ 84.8 110 Papua New Guinea Nadzab Airport
AYBA 91.5 202 Papua New Guinea Baimuru Airport
AYWD 93.1 286 Papua New Guinea Wapenamanda Airport
AYKT 93.3 156 Papua New Guinea Kaintiba Airport
AYBU 101.2 132 Papua New Guinea Bulolo Airport
AYMN 103.6 268 Papua New Guinea Mendi Airport
AYKK 105.4 220 Papua New Guinea Kikori Airport
AYKM 115.1 169 Papua New Guinea Kerema Airport
AYMR 129.6 262 Papua New Guinea Moro Airport
AYTA 146.5 275 Papua New Guinea Tari Airport
AYSS 176.5 238 Papua New Guinea Sasereme Airport
AYWK 181.9 325 Papua New Guinea Wewak International Airport
AYBM 188.1 231 Papua New Guinea Balimo Airport
AYDU 222.2 216 Papua New Guinea Daru Airport
AYBD 226.4 143 Papua New Guinea Bodinumu Airport
AYKQ 227.9 144 Papua New Guinea Kagi Airport
168 inserts to find them
mX4 executed: 25/04/2023 12:59:43 Runtime: 0:0:29.240 Memload: 53% use
Nearly all operating systems have a simple command to open up a file, directory, or URL from the command line. But what about to send data in a body to a URL with Http POST:
A sender that generates a message containing a payload body SHOULD generate a Content-Type header field in that message unless the intended media type of the enclosed representation is unknown to the sender. If a Content-Type header field is not present, the recipient MAY either assume a media type of “application/octet-stream” ([RFC2046], Section 4.5.1) or examine the data to determine its type.
It means that the Content-Type
HTTP header should be set only for PUT
and POST
requests.
procedure WebPostData(const UserAgent: string; const Server: string;
const Resource: string; const Data: AnsiString); overload;
var
hInet: HINTERNET;
hHTTP: HINTERNET;
hReq: HINTERNET;
const
accept: packed array[0..1] of LPWSTR = (PChar('*/*'), nil);
header: string = 'Content-Type: application/x-www-form-urlencoded';
begin
hInet:= InternetOpen(PChar(UserAgent), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
try
hHTTP:= InternetConnect(hInet,PChar(Server),INTERNET_DEFAULT_HTTP_PORT, nil, nil, INTERNET_SERVICE_HTTP, 0, 1);
try
hReq:= HttpOpenRequest(hHTTP, PChar('POST'),
PChar(Resource), nil, nil, @accept, 0, 1);
try
if not HttpSendRequest(hReq, PChar(header), length(header),
PChar(Data),length(Data)) then
raise Exception.Create('HttpOpenRequest failed. ' +
SysErrorMessage(GetLastError));
finally
InternetCloseHandle(hReq);
end;
finally
InternetCloseHandle(hHTTP);
end;
finally
InternetCloseHandle(hInet);
end;
end;
WebPostData('My UserAgent', 'www.rejbrand.se', 'mydir/myscript.asp', Data2)
WebPostData('My UserAgent', 'www.rejbrand.se', 'mydir/myscript.asp', 'value=5)
POST is an HTTP method designed to send data to the server from an HTTP client. The HTTP POST method requests the web server accept the data enclosed in the body of the POST message. HTTP POST method is often used when submitting login or contact forms or uploading files and images to the server.
V 4.7.6.10 August 2022
INTERNET_FLAG_SECURE
should be used in the flags for HttpOpenRequest
, not InternetConnect
.
This is explained in the MSDN documentation for WinINet API flags:
INTERNET_FLAG_SECURE
0x00800000
Uses secure transaction semantics. This translates to using Secure Sockets Layer/Private Communications Technology (SSL/PCT) and is only meaningful in HTTP requests. This flag is used by HttpOpenRequest and InternetOpenUrl, but this is redundant if
https://
appears in the URL. The InternetConnect function uses this flag for HTTP connections; all the request handles created under this connection will inherit this flag.
procedure WebPostData(const UserAgent: string; const Server: string;
const Resource: string; const Data: AnsiString);
//overload;
var
hInet: HINTERNET;
hHTTP: HINTERNET;
hReq: HINTERNET;
//const
//accept: packed array[0..1] of LPWSTR = (PChar('*/*'), nil);
//header: string = 'Content-Type: application/x-www-form-urlencoded';
begin
hInet:= InternetOpen(PChar(UserAgent), INTERNET_OPEN_TYPE_PRECONFIG, 'nil', 'nil', 0);
try
writeln('debug open: '+itoa(hinet));
hHTTP:= InternetConnect(hInet,PChar(Server),INTERNET_DEFAULT_HTTP_PORT,
'nil', 'nil', INTERNET_SERVICE_HTTP, 0, 1);
writeln('debug connect: '+itoa(hhttp));
try
hReq:= HttpOpenRequest(hHTTP, ('POST'),
//PChar(Resource), nil, nil, @accept, 0, 1);
PChar(Resource),'nil','nil','*/*',0,1);
writeln('debug request: '+itoa(hreq));
try
//HttpSendRequest(hRequest:HINTERNET; lpszHeaders:PChar;
//dwHeadersLength:DWORD;lpOptional:Tobject; dwOptionalLength:DWORD):BOOL;
if not HttpSendRequest(hReq,(header),length(header),nil {(Data)},
length(Data)) then
Xraise (Exception.Create('HttpOpenRequest failed. ' +
SysErrorMessage(GetLastError)));
writeln('debug send: '+SysErrorMessage(GetLastError));
finally
InternetCloseHandle(hReq);
end;
finally
InternetCloseHandle(hHTTP);
end;
finally
InternetCloseHandle(hInet);
end;
end;
A pointer to a null-terminated array of strings that indicates media types accepted by the client. Here is an example.
PCTSTR rgpszAcceptTypes[] = {_T("text/*"), NULL};
Failing to properly terminate the array with a NULL pointer will cause a crash.
If this parameter is NULL, no types are accepted by the client. Servers generally interpret a lack of accept types to indicate that the client accepts only documents of type “text/*” (that is, only text documents—no pictures or other binary files).
https://docs.microsoft.com/en-us/windows/win32/api/wininet/nf-wininet-httpopenrequesta
I think I am making some progress. I changed WebPostData into a function and copied some code from elsewhere to use SSL and to return a result. It now looks like this:
function WebPostData2(const UserAgent: string; const Server: string; const Resource: string; const Data: AnsiString): String;
var
hInet:HINTERNET;
hHTTP:HINTERNET;
hReq: HINTERNET;
BufStream: TMemoryStream;
BytesRead: Cardinal;
aBuffer :Array[0..4096] of Char;
flags :DWord;
const
accept:packed array[0..1] of LPWSTR = (('*/*'), nil);
header:string = 'Content-Type:text/plain';
begin
hInet:= InternetOpen(PChar(UserAgent),INTERNET_OPEN_TYPE_PRECONFIG,nil,nil,0);
try
hHTTP:= InternetConnect(hInet,PChar(Server),INTERNET_DEFAULT_HTTPS_PORT,nil,nil,INTERNET_SERVICE_HTTP,0,1);
try
flags:= INTERNET_FLAG_SECURE or INTERNET_FLAG_KEEP_CONNECTION;
hReq:= HttpOpenRequest(hHTTP,PChar('POST'),PChar(Resource),nil,nil,@accept,flags,1);
try
if not HttpSendRequest(hReq,PChar(header),length(header), PChar(Data), length(Data)) then begin
raise Exception.Create('HttpOpenRequest failed.'+ SysErrorMessage(GetLastError));
end else begin
BufStream:= TMemoryStream.Create;
try
while InternetReadFile(hReq,@aBuffer, SizeOf(aBuffer),BytesRead) do begin
if (BytesRead = 0) then Break;
BufStream.Write(aBuffer, BytesRead);
end;
aBuffer[0]:= #0;
BufStream.Write(aBuffer, 1);
Result:= PChar(BufStream.Memory);
finally
BufStream.Free;
end;
end;
finally
InternetCloseHandle(hReq);
end;
finally
InternetCloseHandle(hHTTP);
end;
finally
InternetCloseHandle(hInet);
end;
end;
{* Extended version of JclFileUtils.BuildFileList:
function parameter Path can include multiple FileMasks as:
c:\aaa*.pas; pro*.dpr; *.d??
FileMask Seperator = ‘;’
*}
function IsEmptyDirectory(const DirPath, ExcludeFile: String): Boolean;
var List: TStringList;
begin
List:= TStringList.Create;
try
BuildFileList(IncludeTrailingPathDelimiter(DirPath)+'*.*', List,faAnyFile,True,False);
Result:= (List.Count = 0) or ((List.Count = 1) and
(List.IndexOf(ExcludeTrailingPathDelimiter(ExcludeFile)) = 0));
finally
List.Free;
end;
end;
{"lang": "it", "all_text": "DS\nPODERE CAPACCIA\n1619\nLuggo deffo apacia\nQUERCIAGRANDE\nVino da tavola della Toscana\n1993\nProdotto e imbottigliato all'origine\nPodere Capaccia\nPacini Giampaolo & C. s.a.s.\nRadda in Chianti (SI) - Italia\nItalia", "annotations": ["DS", "PODERE", "CAPACCIA", "1619", "Luggo", "deffo", "apacia", "QUERCIAGRANDE", "Vino", "da", "tavola", "della", "Toscana", "1993", "Prodotto", "e", "imbottigliato", "all'origine", "Podere", "Capaccia", "Pacini", "Giampaolo", "&", "C.", "s.a.s.", "Radda", "in", "Chianti", "(", "SI", ")", "-", "Italia", "Italia"]}
{
"all_text": "PODERE CAPACCIA\nDS\n01\nLugo detto Capacia\nQUERCIAGRANDE\nVino da tavola della Toscana\n1993\nProdotto e imbottigliato all'origine\nPodere Capaccia\nPacini Giampaolo & C. s.a.s.\nRadda in Chianti (SI) - Italia\nItalia",
"annotations": [
"PODERE",
"CAPACCIA",
"DS",
"01",
"Lugo",
"detto",
"Capacia",
"QUERCIAGRANDE",
"Vino",
"da",
"tavola",
"della",
"Toscana",
"1993",
"Prodotto",
"e",
"imbottigliato",
"all'origine",
"Podere",
"Capaccia",
"Pacini",
"Giampaolo",
"&",
"C.",
"s.a.s.",
"Radda",
"in",
"Chianti",
"(",
"SI",
")",
"-",
"Italia",
"Italia"
],
"lang": "it"
}
14/01/2022 12:56 16,832 FindReplDlg.dcu
14/01/2022 13:12 479,472 fMain.dcu
14/01/2022 12:56 35,172 gsUtils.dcu
14/01/2022 12:56 194,228 IFSI_WinForm1puzzle.dcu
14/01/2022 13:48 317,040 uPSCompiler.dcu
14/01/2022 13:27 255,155 uPSI_ComCtrls.dcu
14/01/2022 12:57 145,655 uPSI_fMain.dcu
14/01/2022 12:57 10,780 uPSI_IdPOP3.dcu
14/01/2022 12:56 5,647 uPSI_JvParsing.dcu
14/01/2022 12:56 21,122 uPSI_uTPLb_AES.dcu
14/01/2022 13:49 257,656 uPSRuntime.dcu
14/01/2022 12:56 25,467 VListView.dcu
14/01/2022 12:56 70,849 WinForm1.dcu
14/01/2022 12:56 11,519 uPSI_SynEditMiscProcs.dcu
14/01/2022 12:57 105,299 AdoMain.dcu
14/01/2022 13:12 13,521 BlocksUnit.dcu
14/01/2022 12:56 11,790 frmExportMain.dcu
14/01/2022 14:20 30,846 MathsLib.dcu
14/01/2022 12:57 37,351 neuraldatasets.dcu
14/01/2022 12:57 50,128 neuralfit.dcu
14/01/2022 12:57 316,142 neuralnetworkCAI.dcu
14/01/2022 12:57 114,820 neuralvolume.dcu
14/01/2022 13:12 6,566 PXLTiming.dcu
14/01/2022 13:12 7,431 PythonAction.dcu
14/01/2022 13:12 278,955 PythonEngine.dcu
14/01/2022 13:12 6,446 SeSHA256.dcu
14/01/2022 12:57 3,879 simplecomport.dcu
14/01/2022 12:57 11,304 U_Splines.dcu
14/01/2022 13:12 20,496 uPSI_BlocksUnit.dcu
14/01/2022 12:57 16,019 uPSI_DFFUtils.dcu
14/01/2022 12:57 24,311 uPSI_neuraldatasets.dcu
14/01/2022 14:02 153,034 uPSI_NeuralNetworkCAI.dcu
14/01/2022 10:12 59,982 uPSI_OverbyteIcsUtils.dcu
14/01/2022 13:12 8,645 uPSI_PXLTiming.dcu
14/01/2022 13:12 175,131 uPSI_PythonEngine.dcu
14/01/2022 12:57 10,108 uPSI_SynHighlighterPython.dcu
14/01/2022 10:02 41,442 uPSI_U_Splines.dcu
14/01/2022 13:12 46,240 VarPyth.dcu
14/01/2022 12:56 19,478 ViewToDoFm.dcu
14/01/2022 10:12 40,887 OverbyteIcsMimeUtils.dcu
14/01/2022 13:12 77,146 OverbyteIcsUtils.dcu
14/01/2022 13:10 26,273 SynHighlighterPython.dcu
14/01/2022 13:48 317,040 uPSCompiler.dcu
14/01/2022 13:49 257,656 uPSRuntime.dcu
14/01/2022 17:46 317,056 uPSCompiler.dcu
14/01/2022 17:47 257,646 uPSRuntime.dcu
Now that the requests
module is installed let’s again open up a text editor and enter the following code:
import requests
url = "https://api.apilayer.com/image_to_text/url?url=http%3A%2F%2Fwww.kleiner.ch%2Fkleiner%2Fimages%2Fuml_buch.jpg"
payload = {}
headers= {
"apikey": "DNwCF9Rf6y1AmSSednjn8Zh.............."
}
response = requests.request("GET", url, headers=headers, data = payload)
status_code = response.status_code
result = response.text
12345678910111213 | import requests url = "https://api.apilayer.com/image_to_text/url?url=http%3A%2F%2Fwww.kleiner.ch%2Fkleiner%2Fimages%2Fuml_buch.jpg" payload = {} headers = { "apikey" : "DNwCF9Rf6y1AmSSednjn8Zh.............." } response = requests.request( "GET" , url, headers = headers, data = payload) status_code = response.status_code result = response.text |
Image to Text API uses a neural net (LSTM) based OCR engine which is focused on line recognition, but also supports recognizing the character patterns. It supports both handwriting and printed materials.
https://apilayer.com/marketplace/image_to_text-api?live_demo=show
Now the same code for Python4maXbox:
procedure PyAPICode(imgpath: string);
begin
with TPythonEngine.Create(Nil) do begin
pythonhome:= 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\';
try
loadDLL;
ExecString('import requests, json');
ExecStr('url= "https://api.apilayer.com/image_to_text/url?url='+imgpath+'"');
ExecStr('payload = {}');
ExecStr('headers= {"cache-control":"no-cache",'+
'"apikey":"DNwCF9Rf6y1AmSSednjn8Zh........."}');
Println(EvalStr('requests.request("GET",url,headers=headers,data=payload).text'));
except
raiseError;
finally
free;
end;
end;
end;
12345678910111213141516171819 | procedure PyAPICode(imgpath: string ); begin with TPythonEngine . Create( Nil ) do begin pythonhome:= 'C:\Users\max\AppData\Local\Programs\Python\Python36- 32 \'; try loadDLL; ExecString( 'import requests, json' ); ExecStr( 'url= "https://api.apilayer.com/image_to_text/url?url=' +imgpath+ '"' ); ExecStr( 'payload = {}' ); ExecStr( 'headers= {"cache-control":"no-cache",' + '"apikey":"DNwCF9Rf6y1AmSSednjn8Zh........."}' ); Println(EvalStr( 'requests.request("GET",url,headers=headers,data=payload).text' )); except raiseError; finally free; end ; end ; end ; |
The API will also work for handwritings. Even for non-English texts. The output is JSON data with all the text extracted and even the language is auto detected,
http://www.kleiner.ch/kleiner/images/uml_buch.jpg
{
"all_text": "ih \u00bb Der Entwickler\nFachwissen f\u00fcr Programmierer\nMax Kleiner\nUML\nmit Delphi\nObjektorientiert modellieren\nund entwickeln\nSoftware & Support",
"annotations": [
"ih",
"\u00bb",
"Der",
"Entwickler",
"Fachwissen",
"f\u00fcr",
"Programmierer",
"Max",
"Kleiner",
"UML",
"mit",
"Delphi",
"Objektorientiert",
"modellieren",
"und",
"entwickeln",
"Software",
"&",
"Support"
],
"lang": "de"
}
1234567891011121314151617181920212223242526 | http: //www.kleiner.ch/kleiner/images/uml_buch.jpg { "all_text" : "ih \u00bb Der Entwickler\nFachwissen f\u00fcr Programmierer\nMax Kleiner\nUML\nmit Delphi\nObjektorientiert modellieren\nund entwickeln\nSoftware & Support" , "annotations" : [ "ih" , "\u00bb" , "Der" , "Entwickler" , "Fachwissen" , "f\u00fcr" , "Programmierer" , "Max" , "Kleiner" , "UML" , "mit" , "Delphi" , "Objektorientiert" , "modellieren" , "und" , "entwickeln" , "Software" , "&" , "Support" ], "lang" : "de" } |
Also a compiled snippet from a WinInet class is available.
function Image_to_text_API2(AURL, url_imgpath, aApikey: string): string;
var httpq: THttpConnectionWinInet; rets: TStringStream;
heads: TStrings; iht: IHttpConnection2; //losthost:THTTPConnectionLostEvent;
begin
httpq:= THttpConnectionWinInet.Create(true);
rets:= TStringStream.create('');
heads:= TStringlist.create;
try
heads.add('apikey='+aAPIkey);
iht:= httpq.setHeaders(heads);
httpq.Get(Format(AURL,[url_imgpath]), rets);
if httpq.getresponsecode=200 Then result:= rets.datastring
else result:='Failed:'+
itoa(Httpq.getresponsecode)+Httpq.GetResponseHeader('message');
except
writeln('EWI_HTTP: '+ExceptiontoString(exceptiontype,exceptionparam));
finally
httpq:= Nil;
heads.Free;
rets.Free;
end;
end;
12345678910111213141516171819202122 | function Image_to_text_API2(AURL, url_imgpath, aApikey: string ): string ; var httpq: THttpConnectionWinInet; rets: TStringStream; heads: TStrings; iht: IHttpConnection2; //losthost:THTTPConnectionLostEvent; begin httpq:= THttpConnectionWinInet . Create( true ); rets:= TStringStream . create( '' ); heads:= TStringlist . create; try heads . add( 'apikey=' +aAPIkey); iht:= httpq . setHeaders(heads); httpq . Get(Format(AURL,[url_imgpath]), rets); if httpq . getresponsecode= 200 Then result:= rets . datastring else result:= 'Failed:' + itoa(Httpq . getresponsecode)+Httpq . GetResponseHeader( 'message' ); except writeln ( 'EWI_HTTP: ' +ExceptiontoString(exceptiontype,exceptionparam)); finally httpq:= Nil ; heads . Free; rets . Free; end ; end ; |
Proxies can be configured too: Pointer to a null-terminated string that specifies the name of the proxy server(s) to use when proxy access is specified by setting dwAccessType to INTERNET_OPEN_TYPE_PROXY. Do not use an empty string, because InternetOpen will use it as the proxy name. The WinINet functions recognize only CERN type proxies (HTTP only) and the TIS FTP gateway (FTP only). If Microsoft Internet Explorer is installed, these functions also support SOCKS proxies. FTP requests can be made through a CERN type proxy either by changing them to an HTTP request or by using InternetOpenUrl. If dwAccessType is not set to INTERNET_OPEN_TYPE_PROXY, this parameter is ignored and should be NULL. For more information about listing proxy servers, see the Listing Proxy Servers section of Enabling Internet Functionality.
When you make a POST request, you have to encode the data that forms the body of the request in some way. When you are writing client-side code:
multipart/form-data
when your form includes any <input type="file">
elementsmultipart/form-data
or application/x-www-form-urlencoded
but application/x-www-form-urlencoded
will be more efficient.application/x-www-form-urlencoded
is more or less the same as a query string on the end of the URL.
procedure PyCode2Post(imgpath, apikey: string);
begin
with TPythonEngine.Create(Nil) do begin
pythonhome:= 'C:\Users\max\AppData\Local\Programs\Python\Python36-32\';
try
loadDLL;
ExecString('import requests');
ExecStr('api_url= "https://api.api-ninjas.com/v1/imagetotext"');
ExecStr('image_file_descriptor = open(r"'+imgpath+'", "rb")');
ExecStr('files = {"image": image_file_descriptor}');
ExecStr('headers={"X-Api-Key":"'+apikey+'"}');
Println(EvalStr('requests.post(api_url,headers=headers,files=files).text'));
except
raiseError;
finally
unloadDLL;
free;
end;
end;
end;
function postRequest(const AUrl,AData:AnsiString; blnSSL:Boolean = True): AnsiString;
var
aBuffer : Array[0..4096] of Char;
Header : TStringStream;
BufStream : TMemoryStream;
sMethod : AnsiString;
BytesRead : Cardinal;
pSession : HINTERNET;
pConnection : HINTERNET;
pRequest : HINTERNET;
parsedURL : TStringArray;
port,hostport: Integer;
flags : DWord;
HostName,FileName,sHeader:String;
//begin
procedure ParseURL(URL:string;var HostName,FileName:string;var HostPort:Integer);
var
i,p,k: DWORD;
function StrToIntDef(const S:string; Default:Integer):Integer;
var
E: Integer;
begin
Val(S, Result, E);
if E <> 0 then Result := Default;
end;
begin
if lstrcmpi('http://',PChar(Copy(URL,1,7))) = 0 then System.Delete(URL, 1, 7);
HostName := URL;
FileName := '/';
HostPort := INTERNET_DEFAULT_HTTP_PORT;
i := Pos('/', URL);
if i <> 0 then begin
HostName:= Copy(URL, 1, i-1);
FileName:= Copy(URL, i, Length(URL) - i + 1);
end;
p:=pos(':',HostName);
if p <> 0 then begin
k:=Length(HostName)-p;
HostPort:=StrToIntDef(Copy(HostName,p+1,k),INTERNET_DEFAULT_HTTP_PORT);
Delete(HostName,p,k+1);
end;
end;
begin
//ParsedUrl :=
ParseUrl(AUrl, hostname, filename, hostport);
port:= hostport;
Result := '';
pSession:= InternetOpen(nil,INTERNET_OPEN_TYPE_PRECONFIG,nil, nil,0);
if Assigned(pSession) then
try
if blnSSL then
Port:= INTERNET_DEFAULT_HTTPS_PORT
else
Port:= INTERNET_DEFAULT_HTTP_PORT;
//pConnection:= InternetConnect(pSession,PChar(ParsedUrl[0]), port,nil,nil,INTERNET_SERVICE_HTTP,0,0);
pConnection:= InternetConnect(pSession,PChar(hostname),port, nil,nil,INTERNET_SERVICE_HTTP,0,0);
if Assigned(pConnection) then
try
if (AData = '') then
sMethod:= 'GET'
else
sMethod:= 'POST';
if blnSSL then
flags := INTERNET_FLAG_SECURE or INTERNET_FLAG_KEEP_CONNECTION
else
flags := INTERNET_SERVICE_HTTP;
pRequest:= HTTPOpenRequest(pConnection,PChar(sMethod), PChar(filename),nil,nil,nil,flags,0);
{hRequest:= HttpOpenRequest(hConnection, // Function original, see http://msdn.microsoft.com/zh-cn/library/aa917871
PChar(RequestMethod),
PChar(FileName),
HTTP_VERSION,
'', //Referrer
nil,//ACCEPTTYPES Accepted file type text / html * / *
INTERNET_FLAG_NO_CACHE_WRITE or
INTERNET_FLAG_RELOAD,
0 }
if Assigned(pRequest) then
try
Header:= TStringStream.Create('');
try
with Header do begin
//WriteString('Host: ' + ParsedUrl[0] + sLineBreak);
WriteString('Host: ' + hostname + sLineBreak);
WriteString('User-Agent: Custom program 1.0'+SLineBreak);
WriteString('Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'+SLineBreak);
WriteString('Accept-Language: en-us,en;q=0.5' + SLineBreak);
WriteString('Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7'+SLineBreak);
WriteString('Keep-Alive: 300'+ SLineBreak);
WriteString('Connection: keep-alive'+ SlineBreak);
WriteString('Content-Type: application/x-www-form-urlencoded'+ SlineBreak+SLineBreak);
//sHeader := 'Content-Type: application/x-www-form-urlencoded' + #13#10;
end;
HttpAddRequestHeaders(pRequest,PChar(Header.DataString), Length(Header.DataString),HTTP_ADDREQ_FLAG_ADD);
if HTTPSendRequest(pRequest,nil,0,Pointer(AData), Length(AData)) then begin
BufStream:= TMemoryStream.Create;
try
while InternetReadFile(pRequest,@aBuffer, SizeOf(aBuffer),BytesRead) do begin
if (BytesRead = 0) then Break;
BufStream.Write(aBuffer,BytesRead);
end;
aBuffer[0]:= #0;
BufStream.Write(aBuffer, 1);
Result:= PChar(BufStream.Memory);
finally
BufStream.Free;
end;
end;
finally
Header.Free;
end;
finally
InternetCloseHandle(pRequest);
end;
finally
InternetCloseHandle(pConnection);
end;
finally
InternetCloseHandle(pSession);
end;
end;
The first “killer app” was VisiCalc for the Apple II. Businessmen and accountants ran out and bought Apple IIs in droves because all of a sudden there was a software spreadsheet that calculated ledgers instantly, a task accountants normally spent days doing.
With the TWINT app, you can make payments easily and conveniently: in online shops, at supermarket cash registers, in canteens, and at vending machines. With TWINT, you can transfer money in real-time – easily from smartphone to smartphone. And you can also request and receive money from friends and family.
A solar power plant is an arrangement of various solar components including solar panel to absorb and convert sunlight into electricity, a solar inverter to convert the electricity from DC to AC while also monitoring the system, solar batteries and other solar accessories to set up a working system.
https://kenbrooksolar.com/solar-power-plants
Solar power plants utilize thermal energy from the sun, which is abundant, available, intermittent, yet cheap. This thermal energy is further transformed into electrical energy using photovoltaic panels. This is one type of solar power plants.
https://www.sciencedirect.com/topics/engineering/solar-power-plant
So a plant in Australia with 150km^2 would be enough to deliver the whole world with energy.
My solar energy: http://www.softwareschule.ch/examples/solarzertifikat.pdf
My solar energy2: http://www.softwareschule.ch/examples/solarzertifikat2.pdf
so for super solar we had to enlighten and amplify (filter) the sun source:
procedure contrastBitmap(bm: TBitmap; threshold: integer);
var jy, ix, cor: integer;
R,G,B: byte;
begin
for jy:= 0 to bm.Height do
for ix:= 0 to bm.Width do begin
cor:=bm.Canvas.Pixels[ix,jy];
R:=GetRValue(Cor);
G:=GetGValue(Cor);
B:=GetBValue(Cor);
if g>threshold then
bm.Canvas.Pixels[ix,jy]:=clWhite
else
bm.Canvas.Pixels[ix,jy]:=clBlack;
end;
end;
tbmp:= TBitmap.create;
//tbmp.loadfromfile(exepath+'examples\1138_bmp.bmp');
tbmp.loadfromfile(testmap);
processmessagesOFF;
contrastBitmap(tbmp,38);
processmessagesON;
tbmp.savetofile(exepath+'testmap2.bmp');
tbmp.free;
Complete Solar Energy Systems for Business and Public. Each component of our solar installations is built to interact flawlessly with the next, yielding dramatic efficiencies for long-term reliability and impressive returns. From hardware and electronics to energy management and storage.
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
this first line fine
person : 40.269359946250916
person : 95.28620839118958
person : 61.63168549537659
person : 71.69047594070435
integrate image detector compute ends…
Add 86 Units + 25 Tutorials
1441 unit uPSI_neuralgeneric.pas; CAI
1442 unit uPSI_neuralthread.pas; CAI
1443 unit uPSI_uSysTools; TuO
1444 unit upsi_neuralsets; mX4
1445 unit uPSI_uWinNT.pas mX4
1446 unit uPSI_URungeKutta4.pas ICS
1447 unit uPSI_UrlConIcs.pas ICS
1448 unit uPSI_OverbyteIcsUtils.pas ICS
1449 unit uPSI_Numedit2 mX4
1450 unit uPSI_PsAPI_3.pas mX4
1451 unit uPSI_SeSHA256.pas
1452 unit IdHashMessageDigest_max2;
1453 unit uPSI_BlocksUnit.pas
1454 unit uPSI_DelticsCommandLine.pas
1455 unit uPSI_DelticsStrUtils;
1456 unit uPSI_DelticsBitField;
1457 unit uPSI_DelticsSysUtils;
1458 unit uPSI_ALIniFiles2.pas
1459 unit uPSI_StarCalc2.pas
1460 unit uPSI_IdHashMessageDigest2.pas
1461 unit uPSI_U_Splines;
1462 unit uPSI_U_CoasterB.pas;
1463 U_SpringMass2.pas
1464 uPSI_MARSCoreUtils;
1465 unit uPSI_clJsonParser.pas
1466 unit uPSI_SynHighlighterPython.pas
1467 unit uPSI_DudsCommonDelphi;
1468 unit uPSI_AINNNeuron;
1469 unit uPSI_PJConsoleApp2;
1470 unit uPSI_PJPipeFilters2;
1471 unit uPSI_uHTMLBuilder;
1472 unit uPSI_PJPipe2;
1473 uPSI_WinApiDownload,
1474 uPSI_pxQRcode, //beta
1475 unit uPSI_neuralplanbuilder2
1476 unit uPSI_DelphiZXingQRCode;
1477 unit uPSI_RestJsonUtils;
1478 unit UtilsTimeCode;
1479 unit uPSC_classes2.pas; //TList
1480 unit uPSC_std2.pas
1481 unit uPSI_maxIniFiles.pas
1482 unit uROPSImports.pas
1483 unit uROPSServerLink.pas
1484 unit uPSI_KLibUtils;
1485 unit uPSI_PathFunc2; //inno setup
1486 unit KLibVC_Redist.pas;
1487 unit HTTPApp2.pas;
1488 unit uPSI_XCollection2;
1489 unit uPSI_KLibWindows;
1490 unit KlibConstants;
1491 unit uPSI_AzuliaUtils.pas
1492 unit uPSI_ALHttpClient2;
1493 unit uPSI_ALWininetHttpClient2;
1494 unit uPSI_UtilsMax41.pas
1495 unit uPSI_JclSysUtils1;
1496 unit uPSI_RestUtils;
1497 unit uPSI_TeEngine2.pas
1498 unit uPSI_Chart2.pas; (uPSI_TeCanvas2.pas)
1499 unit uPSI_PSResources.pas
1500 unit uPSI_TeCanvas2_1.pas
1501 unit uPSI_DataSetConverter4DUtil;
1502 unit uPSI_neuralfit2.pas;
1503 unit uPSI_SynCrtSock.pas
1504 uPSI_RunElevatedSupport.pas
1505 unit synTHttpRequest.pas;
1506 unit uPSI_VelthuisFloatUtils.pas
1507 unit HttpConnection.pas
1508 unit uPSI_HttpConnectionWinInet.pas
1509 unit UHexUtils.pas
1510 unit UExeFileType.pas
1511 unit uPSI_UConsoleApp.pas
1512 unit uPSI_CompilersURunner.pas
1513 unit uPSI_HttpConnection.pas
1514 unit uPSI_DataSetUtils.pas
1515 unit uPSI_HTTPSender.pas
1516 unit AES_Cryptobox4.pas
1517 unit uPSI_JsonConverter.pas
1518 unit uPSI_RestClient.pas
1519 unit JsonToDataSetConverter;
1520 unit JsonListAdapter; (superobject)
1521 unit uPSI_OpenApiUtils.pas;
1522 unit uPSI_WinHttp_TLB.pas;
1523 unit uPSI_NovusConsole;
1524 unit NovusShell.pas;
1525 unit NovusWebUtils.pas;
1526 unit NovusStreamUtils.pas;
Total of Function Calls: 36354
SHA1: 4.7.6.20 F60338A77B77F2032061BF72A545AFB727F6395F
CRC32: 48455EF8 32.8 MB (34,419,992 bytes)
Compilation Timestamp 2023-01-26 15:36:15 UTC Signtime 26 Jan. 2023 16:41:42
Entry Point 25033256 – Contained Sections 10
Docu: http://www.softwareschule.ch/maxbox_functions.txt
ZIP maxbox4.zip SHA1: CCFC28FE69E5F62590335C406171500ADDE08A9A
function WordFractal2Bitmap(n,x,y, width,height, arun: Integer): TBitmap;
begin
Result:= TBitmap.Create;
Result.SetSize(width, height);
DrawWordFractal2TurtleForm(n, Result, x, y, 1, 0, arun);
//result:= TurnBitmap(result, -90);
end;
var runidx: byte;
bmpname, pngname: string;
begin //@main
runidx:= 8
bmpname:= '1183_WordFractalanimate.bmp';
pngname:= '1183_WordFractalanimate'+itoa(runidx)+'.png';
with WordFractal2Bitmap(23,20,20,600,620, runidx) do begin //450*620
SaveToFile(exepath+bmpname);
Free;
end;
ConvertImage(Exepath+bmpname,Exepath+pngname)
openDoc(exepath+pngname);
writeln(Sha1(exepath+pngname));
End.
Agenda: Introduction to TensorFlow and Scikit Learn
We showed 4 building blocks and 8 discussion topics:
https://www.tensorflow.org/tutorials/
C:\maXbox\mX46210\DataScience\confusionlist\mnist_softmax21.py
http://cs231n.github.io/python-numpy-tutorial/
: X:\1_Public\Documents\Data Science Workshops
1.—————————————
CaseCrunch is proud to announce the results of the lawyer challenge. CaseCruncher Alpha scored an accuracy of 86.6%. The lawyers scored an accuracy of 62.3%.
Over 100 commercial London lawyers signed up for the competition and made over 750 predictions over the course of a week in an unsupervised environment.
The problems were real complaints about PPI mis-selling decided and published by the Financial Ombudsman Service under the FOIA.
The main reason for the large winning margin seems to be that the network had a better grasp of the importance of non-legal factors than lawyers.
2.———————————————-
Question about weights at the beginning
I know initializations define the probability distribution used to set the initial random weights of layers. The options gives are uniform lecun_uniform, normal, identity, orthogonal, zero, glorot_normal, glorot_uniform, he_normal, and he_uniform.
How does my selection here impact my end result or model? Shouldn’t it not matter because we are “training” whatever random model we start with and come up with a more optimal weighting of the layers anyways?
3.——————————————-
Is the learning rate related to the shape of the error gradient, as it dictates the rate of descent?
Yes >>>
3 optimize this loss with learn rate , e.g. 0.4
train_step = tf.train.GradientDescentOptimizer(0.4).minimize(cross_entropy)
4.—————————————-
There are three training modes for neural networks
stochastic gradient descent: Adjust the weights after every single training example
batch training: Adjust the weights after going through all data (an epoch)
mini-batch training: Adjust the weights after going through a mini-batch. This is
usually 128 training examples.
estimator.train(input_fn=train_input_fn, steps=1000);
5.——————————————————
I have tried using Naive bayes on a labeled data set of crime data but got really poor results (7% accuracy). Naive Bayes runs much faster than other alogorithms I’ve been using so I wanted to try finding out why the score was so low.best?
After reading I found that Naive bayes should be used with balanced datasets because it has a bias for classes with higher frequency. Since my data is unbalanced I wanted to try using the Complementary Naive Bayes since it is specifically made for dealing with data skews.
Note that if your algorithm returns everything, it will return every relevant result possible, and thus have high recall, but have very poor precision. On the other hand, if it returns only one element, the one that it is the most certain is relevant, it will have high precision but low recall.
In order to judge such algorithms, the common metric cost function is the F-score!
6.—————————————————————–
A: The sub-sample size is always the same as the original input sample size but the samples of a decision tree are drawn by random.
n_estimators=10 or n
Random forests or random decision forests are an ensemble learning method for classification, regression and other tasks, that operate by constructing a multitude of decision trees at training time and outputting the class that is the mode of the classes or mean prediction of the individual trees.
Also, you should be aware of the most amazing feature of random forests in Python:
instant parallelization! Those of us who started out doing this in R and then moved over are always amazed, especially when you get to work on a machine with a few dozen cores.
You can use decision tree methods, specifically Random Forests for calculating the most important attributes based on information gain if you have already found a way to identify how to label a person.
However, if you do not have any label information maybe you can use some expert view for preliminary attribute selection. After that you make unsupervised classification in order to retrieve your labels. Lastly, you can select the most important fields using Random Forest or other methods like Bayesian Belief Networks.
from sklearn.ensemble import RandomForestClassifier
y = df[“Relevance”]
X = df[features]
clf = tree.DecisionTreeClassifier()
clf = clf.fit(X,y)
clf = RandomForestClassifier(n_estimators=10)
clf = clf.fit(X, y)
Class Map Assume 25.5.2018
their domain or source decisions:
1 bad many 61 A small 1 Yes
2 good few 39 B medium 0 No
3 good few 82 A big 1 No
4 bad many 75 C medium 1 Yes
5 bad many 66 A big 1 Yes
6 good many 77 A small 0 Yes
7 good few 92 B big 0 No
I would recommend training on more balanced subsets of data. Training random forest on sets of randomly selected positive example with a similar number of negative samples. In particular if the discriminative features exhibit a lot of variance this will be fairly effective and avoid over-fitting.
7.——————————————————————–
Best classification algorithms store the knowledge implicitly. This means, that they are not able to convert this knowledge to rules, which could be expressed explicitly in the form of if-then sentences or decision trees. If an algorithm is able to express its knowledge in explicit form, it is called ‘a machine learning algorithm’. While extracting explicit rules from large databases may be interesting in some cases, the resulting classification success using these explicit rules is usually lower then when using classifiers, which store the knowledge implicitly.
Naive Bayes
The veteran of classification. It will furnish best classificaiton results, regardless of the many methods introduced, especially due to the use of m-estimate of probability and Laplace-law of propability. It is very fast in learning and classification. Natively handles only discrete attributes and requires a special discretization engine for real valued attributes. The algorithm will compute probability distributions for all attributes for each class and classify in to the most probable class.
K-NN or K nearest neighbors
Another veteran of classification. Gives best classification results especially with real valued attributes. Its biggest setback is performance. The learning phase is fast, but each classification requires that all the examples are read again. (Naive Bayes requires only that all the classes are read again.) As the name suggests, the algorithm will search up K nearest neighbors and then classify in to the majority class in this selection of K neighbors.
Linear Classifier
Specifically designed to address the problems of prior probabilities of classes and is prior probability invariant. (Solves problems of majority class prevalance and differences in probability distribution of classes between acquired and test examples). As fast as Naive bayesian and also able to handle real valued attributes. It is a compromise between the speed of naive bayesian and the ability of K-NN to handle real valued attributes.
The algorithm will compute probability distributions for all attributes for each class and classify to the most probable class. Main difference to the Naive Bayes: Training one class does affect the response of other classes. This allows the response of specific classes to be hand engineered (fuzzy logic design). The response of the class is interpreted as: Average probability across all attributes, that this new example belongs to this class. We classify to the class with the strongest response.
nums2 = list(range(20))
print([x ** 2 for x in nums2])
C:\maXbox\softwareschule\MT-HS12-05\BFH2018\Release\Release\EventsML\EventsML>jupyter nbconvert “C:\maXbox\mX46210\DataScience\confusionlist\tut-text-ml2\textanalyse2cassandra.ipynb” –to python
http://cls.corpora.uni-leipzig.de/
Decision trees can be thought as a collection of ‘if-then’ statements. They take an input data set and try to match the output data-set through a tree-like structure of if-then statements. Each node on the tree is known as a ‘leaf’ and each leaf assigns a value in a regression tree. The algorithm finds the best place to create a split in order to minimize the loss function (error) in the actual output vs. the output the decision tree creates. This is very similar to the game of 20 questions – you have to find the best questions in order to optimize the tree for new, unseen data
http://martinsiron.com/2017/11/25/using-tensorflows-cnn-vs-sklearns-decision-tree-regressor/
FUNCTION GetIDE_Editor2maXbox3 : HWnd;
VAR W : HWnd;
ClassName : string; //ARRAY[0..32] OF Char;
BEGIN
setLength(classname,32)
W := GetWindow(FindWindow('TMaxForm1', ''), GW_Child);
WHILE W <> 0 DO BEGIN
GetClassName(W, ClassName, 32); //fix
//IF StrComp(ClassName, 'TEditControl') = 0 THEN BEGIN
IF StrComp(ClassName, 'TMemo') = 0 THEN BEGIN //TSynMemo is here
Result := W;
writeln('subclass TMemo/memo2 found');
Exit;
END;
W:= GetWindow(W, GW_HWNDNext);
END; {WHILE}
Result := 0;
MessageBeep(mb_IconInformation);
END; {F }
PROCEDURE {tCodeWizard.}InsertMessageBeep3;
VAR
S : string; //ARRAY[0..255] OF Char;
itemindex: integer;
BEGIN
itemindex:= 1;
setlength(S, 255)
//CASE MBeeps_RG1.ItemIndex OF
CASE ItemIndex OF
0 : StrCopy(S, 'MessageBeep(mb_IconInformation);'#13#10);
1 : StrCopy(S, 'MessageBeep(mb_IconExclamation);'#13#10);
2 : StrCopy(S, 'MessageBeep(mb_IconQuestion);'#13#10);
3 : StrCopy(S, 'MessageBeep(mb_IconStop);'#13#10);
4 : StrCopy(S, 'MessageBeep(0);'#13#10);
5 : StrCopy(S, 'MessageBeep(65535);'#13#10);
END; {CASE}
Spaces(S, 2);
ClipBoard.SetTextBuf(S);
SendMessage(GetIDE_Editor2maXbox3, wm_Paste, 0, 0);
//writeln('debug strcopy: '+S);
END; {PROCEDURE tCodeWizard.InsertMessageBeep}
var teststring: string;
Begin //@main
teststring:= 'maXbox4 1123_CODEWIZU.PAS Compiled done';
writeln(itoa(length(teststring)));
setlength(teststring,30)
writeln(itoa(length(teststring)));
writeln(teststring)
maxform1.memo2.color:= clgreen;
//InsertSeparatorHeader;
MaxForm1.ReadOnly1click(self); //set menu/output/read_only_output false
InsertMessageBeep3;
MaxForm1.ReadOnly1click(self); // toogle back
//MaxForm1.Savescreenshotclick(self); //
MessageBeep(mb_IconExclamation);
END.
Sends the specified message to a window or windows. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message.
To send a message and return immediately, use the SendMessageCallback or SendNotifyMessage function. To post a message to a thread’s message queue and return immediately, use the PostMessage or PostThreadMessage function.
Remove unwanted registry app:
procedure RemoveFromRunKey(ApTitle: string);
var
Reg: TRegistry;
TheKey: string;
ListOfEntries: TStringList;
i: integer;
begin
Reg:= TRegistry.Create;
Reg.RootKey:= HKEY_LOCAL_MACHINE;
TheKey := 'Software\Microsoft\Windows\CurrentVersion\Run';
// Check if key exist...
// ...if yes, try to delete the entry for ApTitle
if not Reg.OpenKey(TheKey, False) then
ShowMessage('Key not found')
else begin
if Reg.DeleteValue(ApTitle) then
ShowMessage('Removed: ' + ApTitle)
else
ShowMessage('Not found: ' + ApTitle);
end;
Reg.CloseKey;
Reg.Free;
end;
MODULEENTRY32 structure
Describes an entry from a list of the modules belonging to the specified process.
C++
typedef struct tagMODULEENTRY32 {
DWORD dwSize;
DWORD th32ModuleID;
DWORD th32ProcessID;
DWORD GlblcntUsage;
DWORD ProccntUsage;
BYTE *modBaseAddr;
DWORD modBaseSize;
HMODULE hModule;
char szModule[MAX_MODULE_NAME32 + 1];
char szExePath[MAX_PATH];
} MODULEENTRY32;
//https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-module32first
function Module32First(HANDLE: THandle; var ModuleEntry: TModuleEntry32):boolean;
external 'Module32First@kernel32.dll stdcall';
function Module32Next(HANDLE: THandle; out ModuleEntry: TModuleEntry32): boolean;
external 'Module32Next@kernel32.dll stdcall';
procedure listofUsedDLL;
var
Handle: THandle; szMod: array[0..MAX_MODULE_NAME32 + 1] of char;
ModuleEntry: TModuleEntry32; cnt: integer; szmod1: string;
begin
Handle:= CreateToolHelp32SnapShot(TH32CS_SNAPMODULE, 0);
Win32Check(Handle <> INVALID_HANDLE_VALUE);
//setlength(szMod, MAX_MODULE_NAME32 + 1)
//setlength(szMod, 255)
try
ModuleEntry.dwSize:= Sizeof(ModuleEntry);
Win32Check(Module32First(Handle, ModuleEntry));
//((szMod:= ModuleEntry.szModule;
cnt:= 0;
repeat
szmod1:= '';
for it:= 3 to length(ModuleEntry.szModule) -1 do
szmod1:= szmod1 + ModuleEntry.szModule[it];
inc(cnt);
Writeln('mod: '+ itoa(cnt)+' '+szmod1);
//Writeln('procid: '+ itoa(cnt)+' '+GetModuleName(ModuleEntry.hmodule));
//GetModuleName( Module : HMODULE) :Str
until not Module32Next(Handle, ModuleEntry);
finally
CloseHandle(Handle);
end;
end;
The modBaseAddr and hModule members are valid only in the context of the process specified by th32ProcessID.
listofUsedDLL;
List:= TStringList.Create;
if LoadedModulesList(List, getProcessID, false) then
for I:= 0 to List.Count - 1 do
writeln(itoa(i)+' '+list[i]);
list.Free;
C++
BOOL Module32First(
[in] HANDLE hSnapshot,
[in, out] LPMODULEENTRY32 lpme
);
procedure ListDLLFunctions(DLLName: String; List: TStrings);
type
chararr = array [0..$FFFFFF] of Char;
var
H: THandle;
I, fc: integer;
st: string;
arr: Pointer;
ImageDebugInfo: PImageDebugInformation;
begin
List.Clear;
DLLName:= ExpandFileName(DLLName);
if FileExists(DLLName) then begin
H:= CreateFile(PChar(DLLName),GENERIC_READ,FILE_SHARE_READ or
FILE_SHARE_WRITE,nil,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
if H<>INVALID_HANDLE_VALUE then
try
ImageDebugInfo:= MapDebugInformation(H,PChar(DLLName),nil,0);
if ImageDebugInfo<>Nil then
try
arr:= ImageDebugInfo^.ExportedNames;
fc:= 0;
for I:= 0 to ImageDebugInfo^.ExportedNamesSize - 1 do
if chararr(arr^)[I]=#0 then begin
st:= PChar(@chararr(arr^)[fc]);
if Length(st)>0 then
List.Add(st);
if (I>0) and (chararr(arr^)[I-1]=#0) then
Break;
fc:= I + 1
end
finally
UnmapDebugInformation(ImageDebugInfo)
end
finally
CloseHandle(H)
end
end
end;
To retrieve information about other modules associated with the specified process, use the Module32Next function.
Sonar’s industry leading solution enables developers and development teams to write clean code and remediate existing code organically, so they can focus on the work they love and maximize the value they generate for businesses. Its open source and commercial solutions – SonarLint, SonarCloud, and SonarQube – support 29 programming languages. Trusted by more than 300,000 organizations globally, Sonar is considered integral to delivering better software.
SONARSOURCE – Zürich: Die Programmierplattform für Entwickler hat 412 Millionen Dollar frisches Kapital eingesammelt. Die Bewertung steige damit auf 4,7 Milliarden Dollar, wie die in Genf ansässige Firma mitteilte. Im Rahmen der Finanzierungsrunde stiegen die Finanzinvestoren Advent International und General Catalyst neu ein. Die Aktionäre Insight Partners und Permira beteiligten sich an der Geldspritze. Das Geld soll in den Ausbau des Vertriebs fließen. SonarSource-Chef Olivier Gaudin, einer der Gründer, erklärte, dass sich das Unternehmen auch auf einen Börsengang vorbereite. Das Unternehmen, zu dessen Kunden etwa IBM, Microsoft und die Google-Mutter Alphabet gehören, peilt einen Umsatz von einer Milliarde Dollar an.
How can we capture the unpredictable evolutionary and emergent properties of nature in software? How can understanding the mathematical principles behind our physical world help us to create digital worlds like an mondrian art generator?
procedure createBitmapsampleArtist(sender: TObject);
var
Bitmap: TBitmap;
I, X, Y, W, H: Integer;
aRed, aGreen, aBlue: Integer;
afrm: TForm;
begin
afrm:= getform2(700,500,123,'FastForm Draw Paint Perform Platform PPP Mondrian2');
afrm.ondblclick:= @createBitmapsampleArtist;
Bitmap:= TBitmap.Create;
Bitmap.Width:= 700;
Bitmap.Height:= 700;
for I:= 0 to 9 do begin
X:= Random(450);
Y:= Random(430);
W:= Random(150)+ 150;
H:= Random(150)+ 50;
aRed:= Random(255);
aGreen:= Random(255);
aBlue:= Random(255);
Bitmap.Canvas.Brush.Color:= RGB(aRed, aGreen, aBlue);
Bitmap.Canvas.Rectangle(X+20, Y+30, W, H);
end;
afrm.Canvas.Draw(0, 0, Bitmap);
for I:= 0 to 3 do begin
X:= Random(450)+220;
Y:= Random(210)+220;
W:= Random(300)+ 150;
H:= Random(100)+ 50;
aRed:= Random(255);
aGreen:= Random(255);
aBlue:= Random(255);
Bitmap.Canvas.Brush.Color:= RGB(aRed, aGreen, aBlue);
Bitmap.Canvas.Rectangle(X+10, Y+20, W, H);
end;
afrm.Canvas.Draw(0, 0, Bitmap);
SaveCanvas2(afrm.canvas,Exepath+'examples\727_mondrian_randomboxartist.png')
//openFile(Exepath+'examples\randomboxartist.png')
Bitmap.Free;
end;
function SolveNumericallyAngle(ANumericalEquation: TNumericalEquation;
ADesiredMaxError: Double; ADesiredMaxIterations: Integer {= 10}): Double;
var
lError, lErr1, lErr2, lErr3, lErr4: Double;
lParam1, lParam2: Double;
lCount: Integer;
begin
lErr1 := ANumericalEquation(0);
lErr2 := ANumericalEquation(Pi/2);
lErr3 := ANumericalEquation(Pi);
lErr4 := ANumericalEquation(3*Pi/2);
// Choose the place to start
if (lErr1 < lErr2) and (lErr1 < lErr3) and (lErr1 < lErr4) then begin
lParam1 := -Pi/2;
lParam2 := Pi/2;
end
else if (lErr2 < lErr3) and (lErr2 < lErr4) then begin
lParam1 := 0;
lParam2 := Pi;
end
else if (lErr2 < lErr3) and (lErr2 < lErr4) then begin // wp: same as above!
lParam1 := Pi/2;
lParam2 := 3*Pi/2;
end
else begin
lParam1 := Pi;
lParam2 := TWO_PI;
end;
// Iterate as many times necessary to get the best answer!
lCount := 0;
lError := $FFFFFFFF;
while ((ADesiredMaxError < 0 ) or (lError > ADesiredMaxError))
and (lParam1 <> lParam2)
and ((ADesiredMaxIterations < 0) or
(lCount < ADesiredMaxIterations)) do begin
lErr1 := ANumericalEquation(lParam1);
lErr2 := ANumericalEquation(lParam2);
if lErr1 < lErr2 then
lParam2 := (lParam1+lParam2)/2
else
lParam1 := (lParam1+lParam2)/2;
lError := MinFloat(lErr1, lErr2);
Inc(lCount);
end;
// Choose the best of the last two
if lErr1 < lErr2 then
Result := lParam1
else
Result := lParam2
end;
You have to define procedural types:
type TNumericalEquation= function(AParameter:Double):Double;
function numcalsin(AParameter: Double): Double;
begin
result:= sin(Aparameter);
end;
function numcalcos(AParameter: Double): Double;
begin
result:= cos(Aparameter);
end;
One can assign the following values to a procedural type variable: Nil, for both normal procedure pointers and method pointers. A variable reference of a procedural type, i. e. another variable of the same type. A global procedure or function address, with matching function or procedure header and calling convention.
writeln('cos test '+flots(numcalcos(0)));
writeln('cos test '+flots(numcalcos(120)));
writeln('cos test '+flots(numcalcos(3.141592653589793)));
writeln('sin test '+flots(numcalsin(6.283185307179586)));
writeln('sin test '+format('%2.16f ',[numcalsin(6.283185307179586)]));
writeln('solve num angle: '+flots(SolveNumericallyAngle(@numcalsin, 0.01, 10)));
writeln('solve num angle: '+flots(SolveNumericallyAngle(@numcalcos, 0.01, 10)));
writeln('solve num angle: '+flots(SolveNumericallyAngle(@numcalln, 0.01, 10)));
Output:
cos test 1
cos test 0.814180970526562
cos test -1
sin test -2.44921270764475E-16
sin test -0.0000000000000002
solve num angle: 6.283185307179586
solve num angle: 3.141592653589793
solve num angle: 0
mX4 executed: 13/05/2022 11:46:14 Runtime: 0:0:1.766 Memload: 46% use
https://drive.google.com/file/d/1hvHnsUL3hM2HpzGOoHrXKndYzMXHKGzW/view?usp=sharing
function GetBit(idx: Integer): Boolean;
var tmp: PChar;
begin
if idx >= size*8 then begin
Result:= False;
Exit;
end;
tmp:= PChar(data);
tmp:= tmp+(idx div 8);
Result:= (Ord(tmp^) and (1 shl (idx mod 8))) <> 0;
end;
In calculus there is a thing called Taylor Series which provides an easy way to calculate many irrational values to arbitrary precision. Pi/4 = 1 – 1/3 + 1/5 – 1/7 + …But this Taylor series is probably also one of the worst ways to generate PI on a computer. You have to have huge precision on your calculations and it’ll take many billions of iterations to get past 3.14159. Next try could be the use of atan, trouble is, the Taylor series for atan (PI/4 = atan(1) = 1 – 1/3 + 1/5 – 1/7 + 1/9… )converges very slowly for values of x near one, and it converges extremely slowly when x is equal to one.So how we did it: with the AGM calculation of Pi. In 1799, Gauss was startled to discover that his arithmetic-geometric mean connected, the half-circumference of a curve known as the lemniscate, with π, the half-circumference of a unit circle. procedure TBigFloat.PiConst(const MaxSig: TMaxSig);begin self.CheckPiPlaces(MaxSig);end; procedure TBigFloat.CheckPiPlaces(const MaxSig: TMaxSig);var localPrecision: word;begin localPrecision:= MaxSig+2; if localPrecision>zpi.sigdigits then calculate_PI_AGM(localPrecision+5) else begin self.Assign(zpi); self.RoundToPrec(MaxSig); end;end; Then we compare the result of the code with the wolfram alpha link above to make sure we get the right 1000 places in it: writeln(‘sha test1: ‘+sha1tohex(synsha1(tostring(normal)))); writeln(‘sha test2: ‘+sha1tohex(synsha1(PI1000))); >>> sha test1: b7805c4fb1662666d7741fa8f915daacf706cd01 >>> sha test2: b7805c4fb1662666d7741fa8f915daacf706cd01 Got it. So why doesn’t Pi have a 0 in its first 30 digits? 3.141592653589793238462643383279502884
Let’s assume (likely but is not proven at present) that Pi is a Normal Number1. Amongst other things, this means that the frequency of occurrence of any digit in its decimal range is precisely 1/10. This assumption is in accord with statistical analysis of many trillions of decimal places of Pi. We can use this to calculate the probability that there are no zeros in the first thirty digits of our π; In order for this to happen, zero cannot appear in the first place, a probability of 9/10 and also not in the second place, also a probability of 9/10 and so on. We get the overall probability to be: (9/10)^30 = ˜ 4.24% //4.23911 So it is unlikely that no zero (or another selected number) appears in the first thirty digits.Can we say there is even less of interest in the decimal digits as a particular transcendental number, except that so many people think there is something special about it, for example you find your birth date (as 8 digits) in it.What can we do? We can count the frequency of each digit of Pi to assume a uniform distribution and independence and non predictability of each digit:
Piconst(10000) writeln(‘zero count: ‘+ itoa(StrCharCount(toString(normal), ‘0’))); for it:= 0 to 9 do println(itoa(it)+‘count: ‘+ itoa(StrCount(toString(normal),+itoa(it)[1]))); ref: zero count: 9680 count: 9681 count: 10262 count: 10223 count: 9764 count: 10125 count: 10476 count: 10237 count: 9718 count: 9489 count: 1014 But wait a second. Why does zero lag behind in the count. It is a perfectly non number digit? Just had to ask, its a rhetorical question. Lets check it with only 1000 digits: zero count: 930 count: 931 count: 1162 count: 1033 count: 1034 count: 935 count: 976 count: 947 count: 958 count: 1009 count: 106 for it:= 0 to 9 do FormatF(‘%d count: %d’,[it,StrCount(toString(normal),+itoa(it)[1])]); Obviously, some digit will lag. Which digit has a reason to lag? None has a reason to lag. Zero is none. Therefore, zero lags. — Larry Hosken This means as said before that each number is equally likely to be the next number so each has a 1/10 chance. Therefore, the occurrence of each digit should be equal once we reach an infinite number of decimal places. http://www.eveandersson.com/pi/precalculated-frequencies But Pi is obviously going to look different if we calculate it in base 8 or base 12 or any base other than 10. I was also reading a recent blog post by Evelyn Lamb where she mentioned in passing that 314159 is a prime number and that made me curious how many such primes there are. https://www.johndcook.com/blog/2018/09/04/pi-primes/ Formulas for prime-counting functions come in two kinds: arithmetic formulas and analytic formulas, see appendix prime-counting.
def is_prime(n): if n>1: divs=[k for k in range(2,n) if n%k==0] return len(divs)==0 else: return False def nth_prime(n): primes=[p for p in range(n*n+2) if is_prime(p)] return primes[n-1] NativeWriteln(‘Start with maXbox4 Console Output—>’); for it:= 1 to 50 do if IsPrime(it) then NativeWriteln(IntToStr(it)+‘ is prime’); NativeWriteln(‘—–end—–‘); FreeConsole(); This is OK if you are just wanting to display output into the command line. But operations like redirecting output into a file for example are not working e.g.: start /wait Checker.exe > out.txt would still output into console and not into file out.txt. Different solution exists for PowerShell: If you are lost into the source code then you could easily add parameters to your app to write output to a file instead of the console: -o out.txt, since it’s your tool doing the writing, you can build wherever you want for example to start out of the shell and get output to the shell and in the end plot an image to another file output as a graphic like below: Call the script from the shell with>>> .\maxbox4.exe ..\examples\866_native_console.txt The script can be found: http://www.softwareschule.ch/examples/1093_XMLUtils_Tutor92tester.txt http://www.softwareschule.ch/examples/866_native_console.txt Author: Max Kleiner Ref: http://www.softwareschule.ch/box.htm https://scikit-learn.org/stable/modules/ Doc: https://maxbox4.wordpress.com >>> from geopy.geocoders import Nominatim>>> geolocator = Nominatim(‘maxbox-app’)>>> place,(lat,lng) = geolocator.geocode(“Breitenrainplatz 2 Bern”)>>> print (“%s: %.5f, %.5f” % (place, lat, lng)) Release Notes maXbox 4.7.6.10 IV Jan. 2022 mX476 ************************************************** Add 25 Units + 6 Tutorials Total of Function Calls: 35371 SHA1: of 4.7.6.10 A2B2B2D1596C6A5F3ACCED90D0C2246172A3DE2CCRC32: 285ACBCB 31.3 MB (32,921,928 bytes) ZIP file maxbox4.zip sha1 E267EB40AA945AD10B88EF8274C837F510DD96D4 https://www.virustotal.com/gui/file/3080a507b536ff12ec70e9a8df9eba27aca5c90709d73f42a5ad02211342bd64/details
How to produce an NFT (non fungible token) from an EXE:
2. Publish the PNG to opensea.io
maxboxexe4png – maxbox | OpenSea
3. Check the token in your wallet
OpenSea: OPENSTORE Token | 0x495f947276749ce646f68ac8c248420045cb7b5e (etherscan.io)
TokenID: 91607934750905988430739577239694576301564617410208701007294593060155848392705
MD5: 945a72002eb4608a94b5ddc5c79c6f6e
SHA-1: e9e4eb97fb2f65c8025f78e29df07cab0b61e740
SHA-256: 2649e7f1b49025a3ede32cc3b4f68b492155eb4aeb14b639ec71ebc41edc007e
SSDEEP: 786432:mUwaZjA3tneMUTWFuwH64NDYVqeUrpUVLUsk6oLq9uEV16ivG6MK/R8lvf9f94ii:rwae3tnemhaW9eW4LUtrqt19vGdKmpFQ
TLSH: T194B733D056EBFAC5B1563673B38270167102C9ABC5EF29A9563DDB1830CA040EE7F9E1
Magic: PNG image, 5749 x 5749, 8-bit/color RGB, non-interlaced
TrID_ Portable Network Graphics (100%)
File size: 47.89 MB (50213248 bytes)
In this report, I want to use model-driven to show you how to set up a persistent and object-oriented application with Delphi 2005 and ECO II. The automatisms of the MDD (model driven development) in ECO are an enormous support for business objects or data-intensive systems, especially since ASP.net pages or web services can also be generated with it.
1.1 Entry with class ECO (stands for Enterprise Core Objects) enables the implementation and control of an MVC (Model View Controller) architecture, i.e. a middle layer of control classes (presentation, mapping and handles) mediates between the business objects and the graphical representation. In addition, ECO offers sophisticated database handling that, in addition to “class to table mapping” in a relational database, will also allow cached updates and transaction handling in the future.
procedure TestTObjectList;
var objl: TObjectList; i: integer;
begin
objl:= TObjectList.Create1(True);
objl.OwnsObjects:=true;
writeln('capacity '+itoa(objl.capacity));
for i:=0 to 1500 do begin {o:= TObj.Create();}
//objl.Add(TStringStream.create('this is a smart stream')); end;
objl.Add(TStringStream.create(filetoString(exepath+'firstdemo.txt')));
end;
writeln('capacity '+itoa(objl.capacity));
writeln('count '+itoa(objl.count));
writeln('last func:'+objtostr(objl.last))
writeln('items last '+objtostr(objl.items[1500]))
//function IndexOf(AObject: TObject): Integer; inline;
writeln('idx of: '+itoa(objl.IndexOf(objl.last)));
objl.Clear;
objl.Free;
end;
capacity 0
capacity 1695
count 1501
last func:TStringStream@0AEE0130
items last TStringStream@0AEE0130
idx of: 1500
Now the same code without free of the objects. Use this one to specify if you want the list to own its content (means: it takes care of destroying an item when it is removed from the list or the list is destroyed) or not. The constructor without parameter (which you probably used) sets this to true
. Now we set it to false (objl.OwnsObjects:=true; )and compare.
This is due the filetoString(exepath+’firstdemo.txt’) so each file on the StringStream object allocates 15,914 bytes on the objectlist.
When I set the ‘OwnsObjects’ property to true and then attempt TObjectList.Free, sometimes (not always) I get an ‘invalid pointer | operation’ error.
| Any clue?
If you have already freed, but not nilled any of the items in the list, then
this will cause an AV when the list tries to free it a second time.
The main tourist attraction is the Abbey of Saint Gall, a UNESCO World Heritage Site. The Abbey’s (Stiftskirche) renowned library contains books from the 9th century. The official language of St. Gallen is (the Swiss variety of Standard) German, but the main spoken language is the local variant of the Alemannic Swiss German dialect (Erdbeertörtle).
TEE was a network jointly operated by the railways of West Germany ( DB ), France ( SNCF ), Switzerland ( SBB-CFF-FFS ), Italy ( FS) and the Netherlands. Although some trains passed through Belgium from the beginning, the Belgian national railway company ( NMBS/SNCB) joined the program only in 1964. Luxembourg ( CFL) also joined at a later date.
EKON 25 is the most traditional Delphi conference and offers a deep dive for the modern developer and architect aiming to transform technologies into valuable business solutions. We always focus on the big picture: Delphi innovations, Cross platforms, IoT, Data Bases, Frameworks, Tools, Delphi fundamentals, Web, maXbox and Cloud technologies, as well as professional insights into the very latest … like Python4Delphi.
During my stay I shot some photos as Pure Duesseldorf and Cologne.
Delphi and Lazarus is one of the programming world’s legendary languages, a cornerstone of the history of software development. New languages have come to the fore as new platforms and frameworks have emerged, but Delphi and FreePascal has stood its ground as development trends came and went because of its reliability and efficacy as a development path.