[{"data":1,"prerenderedAt":52},["ShallowReactive",2],{"$f3ooqr7lnhbw7l":3,"recommended":21},{"title":4,"path":5,"date":6,"updated":7,"tags":8,"excerpt":10,"readingMinutes":11,"commentCount":12,"html":13,"comments":14,"next":15,"prev":18},"NS API: stationslijst naar een array","\u002F2011\u002F12\u002Fns-api-stationslijst-naar-een-array\u002F","2011-12-24T23:10:00.001Z","2011-12-24T23:11:40.589Z",[9],"SnelTrein","Om de lijst met stations direct uit het geheugen te kunnen gebruiken plaats ik twee arrays: codes[] en names[] in mijn code. Het converteren van de api xml output naar twee plaintext arrays was een aardige klus die…",1,0,"\u003Cp>Om de lijst met stations direct uit het geheugen te kunnen gebruiken plaats ik twee arrays: codes[] en names[] in mijn code.\u003C\u002Fp>\n\u003Cp>Het converteren van de api xml output naar twee plaintext arrays was een aardige klus die steeds vaker terugkwam, omdat de NS nieuwe stations bouwde. Ik besloot om een script te schrijven.\u003C\u002Fp>\n\u003Cp>Het was zonder twijfel veel mooier om een parser in een mooie programmeertaal te schrijven, maar de oefening met pipes en de commandos sed, awk, grep, paste en cut was leuk.\u003C\u002Fp>\n\u003Cp>Het script converteert uppercase stationscodes naar lowercase, internationale karakters (umlaut etc.) naar normale karakters en haalt enkele stations zoals &quot;Utrecht&quot; weg omdat er ook al een &quot;Utrecht Centraal&quot; bestaat. Ik besloot verder om namen als Munchen te schrijven als Munchen (zonder umlaut) om het typen te vergemakkelijken.\u003C\u002Fp>\n\u003Cp>\u003Ccode>   #!\u002Fbin\u002Fbash   cat ns_api_stations.xml | grep code | sed s\u002F\\&lt;[\\\u002Fa-z]*\\&gt;\u002F\u002Fg | sed 's\u002F^[ \\t]*\u002F\u002F' | awk '{print &quot;\\&quot;&quot; tolower($0) &quot;\\&quot;,&quot;}' &gt; codes.txt      cat ns_api_stations.xml | grep name | sed s\u002F\\&lt;[\\\u002Fa-z]*\\&gt;\u002F\u002Fg | sed 's\u002F^[ \\t]*\u002F\u002F' | sed 's\u002F[àâä]\u002Fa\u002Fg; s\u002F[ÀÂÄ]\u002FA\u002Fg; s\u002F[éèêë]\u002Fe\u002Fg; s\u002F[ÉÈÊË]\u002FE\u002Fg; s\u002F[îï]\u002Fi\u002Fg;   s\u002F[ÎÏ]\u002FI\u002Fg; s\u002F[ôö]\u002Fo\u002Fg; s\u002F[ÖÔ]\u002FO\u002Fg; s\u002F[ûüù]\u002Fu\u002Fg; s\u002F[ÛÜÙ]\u002FU\u002Fg; s\u002Fç\u002Fc\u002Fg; s\u002FÇ\u002FC\u002Fg' | awk '{print &quot;\\&quot;&quot; $0 &quot;\\&quot;,&quot;}' &gt; names.txt         paste codes.txt names.txt | grep -v '&quot;Amsterdam&quot;' | grep -v '&quot;Almere&quot;' | grep -v '&quot;Berlijn&quot;' | grep -v '&quot;Eschmarke&quot;' | grep -v '&quot;Den Haag&quot;' | grep -v '&quot;Utrecht&quot;' | grep -v '&quot;Leiden&quot;' | grep -v '&quot;Rotterdam&quot;' &gt; merged      cut -f1 &lt; merged &gt; codes.txt   cut -f2 &lt; merged &gt; names.txt   rm merged   \u003C\u002Fcode>\u003C\u002Fp>\n",[],{"title":16,"path":17},"java.lang.Thread considered harmful","\u002F2012\u002F04\u002Fjavalangthreadrun-considered-harmful\u002F",{"title":19,"path":20},"Moving to Google's App Engine","\u002F2011\u002F12\u002Fmoving-to-googles-app-engine\u002F",[22,27,32,35,39,42,45,49],{"title":23,"path":24,"note":25,"series":26},"Mapping out Dark Code","\u002F2026\u002F03\u002Fmapping-out-dark-code\u002F","2026",false,{"title":28,"path":29,"note":30,"series":31},"The software that I love","\u002F2022\u002F10\u002Fthe-software-that-i-love\u002F","Series · 36 posts",true,{"title":33,"path":34,"note":25,"series":26},"Navigating the Fog of War: Age of Empires, AI Agents, and the Rise of Dark Code","\u002F2026\u002F05\u002Fnavigating-fog-of-war-age-of-empires-ai\u002F",{"title":36,"path":37,"note":38,"series":26},"The Future of Programming Systems - four thoughts","\u002F2024\u002F09\u002Fthe-future-of-programming-systems-four\u002F","2024",{"title":40,"path":41,"note":38,"series":26},"Always Optimize the Feedback Loop","\u002F2024\u002F07\u002Falways-optimize-feedback-loop\u002F",{"title":43,"path":44,"note":38,"series":26},"\"Security Is Our Top Priority\" is BS","\u002F2024\u002F07\u002Fsecurity-is-our-top-priority-is-bs\u002F",{"title":46,"path":47,"note":48,"series":26},"10x teams","\u002F2025\u002F02\u002F10x-teams\u002F","2025",{"title":50,"path":51,"note":48,"series":26},"Hiring, from the Other Side","\u002F2025\u002F10\u002Fhiring-from-other-side\u002F",1792876809195]