Щасливого нового року! — Frohes neues Jahr! — Happy new year!
Christmas 2024
Split GPX file
GPX-files are used to store planned and done routes, for example for cycling.
A lot of web sites and applications allow creating and editing such routes.
In practice it matters for a trip from A to B if there is one long route that covers the whole distance or many shorter routes. Long routes get hard to handle, because of the software gets slow or crashes when the data set is too big. And small routes are more difficult to use when wanting to have an overview and they require switching to another route during the day, which can be inconvenient.
In theory it is possible to just copy a long route and to delete parts of it to obtain shorter routes, but that does not work too well, if the route is already very long.
So one way to go is to make a long route with only rough planning, to have an overview and then split it into shorter routes that can then be modified to obtain a more accurate planning.
So the following program (written in Perl for Linux) will split a GPX file into n about equally long parts. It is quite simple, but I hope it will help to make this task a little bit easier.
License is GPL v3.
#!/usr/bin/perl -w # (C) Karl Brodowsky 2024-06-09 # Licence GPS v3.0 # (see https://www.gnu.org/licenses/gpl-3.0.de.html ) use strict; use utf8; use Encode qw(decode encode); binmode STDOUT, ":utf8"; binmode STDIN, ":utf8"; my $header =<<'EOH'; <?xml version='1.0' encoding='UTF-8'?> <gpx version="1.1" creator="https://www.komoot.de" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"> <metadata> <name><<TITLE>></name> <author> <link href="https://www.komoot.de"> <text>komoot</text> <type>text/html</type> </link> </author> </metadata> <trk> <name><<TITLE>></name> <trkseg> EOH my $footer =<<'EOF'; </trkseg> </trk> </gpx> EOF sub usage($) { my $msg = $_[0]; if ($msg) { chomp $msg; print $msg, "\n\n"; } print <<"EOU"; USAGE $0 <<FILE>> <<NAME>> <<NUMBER_OF_PARTS>> EOU if ($msg) { exit 1; } else { exit 0; } } if (scalar(@ARGV) == 0 || $ARGV[0] =~ m/^-{0,2}help/) { usage(""); } if (scalar(@ARGV) != 3) { usage("wrong number of arguments"); } my $file = $ARGV[0]; my $file_u = decode("utf-8", $file); unless (-f $file && -r $file) { usage("$file_u is not a readable file"); } unless ($file =~ m/.+\.gpx$/) { usage("$file_u is not a gpx-file"); } my $name = decode("utf-8", $ARGV[1]); $name =~ s/^\s+//; $name =~ s/\s+$//; $name =~ s/\r//g; unless (length($name) > 0) { usage("$name must be at least 1 character"); } if ($name =~ m/[<>"']/) { usage("$name contains illegal characters"); } print "name=$name\n"; my $number_of_parts = $ARGV[2]; if ($number_of_parts < 2) { usage("at least 2 parts are required"); } open INPUT, "<:utf8", $file || usage("cannot open $file_u"); my @points = (); my $point = ""; while (<INPUT>) { if (m/^\s*<trkpt/) { $point = $_; } elsif (m/^\s*<(ele|time)>/) { $point .= $_; } elsif (m/^\s*<\/trkpt>/) { $point .= $_; push @points, $point; $point = ""; } else { print; } } close INPUT; print "\n"; my $length = scalar(@points); sub part_length($$) { my ($remaining_length, $remaining_number_of_parts) = @_; ($remaining_length - 1) / $remaining_number_of_parts + 1; } my $part_length = part_length($length, $number_of_parts); print "length = $length part_length = $part_length number_of_parts = $number_of_parts\n"; if ($part_length < 2) { usage("too many parts part_length=$part_length"); } my $remaining_length; my $remaining_number_of_parts = $number_of_parts; my $i = 0; while ($remaining_number_of_parts > 0) { $remaining_length=scalar(@points); $part_length = int(part_length($remaining_length, $remaining_number_of_parts) + 0.5); my $header_i = $header; my $title_i = sprintf("%s (%d)", $name, $i); $header_i =~ s/<<TITLE>>/$title_i/g; my $file_i = $file; my $file_u_i = decode("utf-8", $file); $file_i =~ s/\.gpx$/_$i.gpx/; print "i=$i remaining_number_of_parts=$remaining_number_of_parts remaining_length=$remaining_length\n"; print "i=$i file_i=$file_u_i title_i=$title_i\n"; open OUTPUT, ">:utf8", $file_i; print OUTPUT $header_i; for (my $j = 0; $j < $part_length; $j++) { my $point = $points[0]; if ($j < $part_length -1) { shift @points; } print OUTPUT $point; } print OUTPUT $footer; close OUTPUT; $i++; $remaining_number_of_parts--; }
P.S. I plan to return to regular posts in this blog during this year.
New Numeric Type
Russian Informatics scientists have invented a new numeric type for computers. Russian made computer chips have it already implemented in hardware.
The numbers are expressed in the form
are each expressed by 6 bits. The exact encoding, which combination of bits have which meaning is a state secret, so it will be necessary to get the hardware and the software only from Russian quality suppliers, that are absolutely not assosicated with FSB or the fascist regime.
This will revolutionize computing world wide through higher efficiency and greener IT.
New Year 2024
Sala we ya nû pîroz be! — Srechno novo leto! — السنة الجديدة المبتهجة — Un an nou fericit! — Bun di bun an! — Happy New Year! — Gott nytt år! — Среќна нова година! — Sugeng warsa enggal! — ¡Próspero año nuevo! — Весёлого нового года! — Bonne année! — Щасливого нового року! — Καλή Χρονια! — Een gelukkig nieuwjaar! — Feliĉan novan jaron! — Sretna nova godina! — Cung chúc tân xuân! — Gelukkig nieuwjaar! — Boldog új évet! — Naya barsa ko hardik shuvakamana! — 새해 복 많이 받으세요 — Ath bhliain faoi mhaise! — Laimīgu Jauno gadu! — Nav varsh ki subhkamna! — うれしい新しい年 — Onnellista uutta vuotta! — Lokkich nijjier! — FELIX SIT ANNUS NOVUS! — Akemashite omedetô! — Frohes neues Jahr! — Felice Anno Nuovo! — Feliz año nuevo! — Shnorhavor nor tari! — Hääd uut aastat! — Срећна нова година! — Laimīgu jauno gadu! — عام سعيد — สวัสดีปีใหม่ — Godt Nyttår! — Gott nýggjár! — سال نو مبارک — Feliz ano novo! — Yeni yılınız kutlu olsun! — Šťastný nový rok! — Subho nababarsho! — Próspero ano novo! — Selamat tahun baru! — 新年好 — Честита нова година! — Szczęśliwego nowego roku! — Gleðilegt nýtt ár! — Godt nytår! — Laimingų naujųjų metų!
Christmas 2023
Bon nadal — Bella Festas daz Nadal — Fröhliche Weihnachten — Prettige Kerstdagen — کريسمس مبارک — Mutlu Noeller — 즐거운 성탄, 성탄 축하 — Sretan božić — Kellemes Karácsonyi Ünnepeket — God Jul! — Nollaig Shona Dhuit! — Vesele Vianoce — Buon Natale — Häid jõule — Priecîgus Ziemassvçtkus — Vesele bozicne praznike — Su Šventom Kalėdom — Veselé Vánoce — God Jul — Natale hilare — καλά Χριστούγεννα — Merry Christmas — Hyvää Joulua — クリスマスおめでとう ; メリークリスマス — Crăciun fericit — Joyeux Noël — Срећан Божић — Gëzuar Krishtlindjet — Feliĉan Kristnaskon — ميلاد مجيد — Zalig Kerstfeest — Selamat Hari Natal — 圣诞快乐 — Gleðileg jól — क्रिसमस मंगलमय हो — Feliz Navidad — Wesołych Świąt Bożego Narodzenia — Gledhilig jól — Glædelig Jul — Честита Коледа — Feliz Natal — З Рiздвом Христовим
Generated by the following Kotin program:
Element.kt
package net.itsky.xmas
data class Element(val key: Long, val text: String) {
override fun hashCode(): Int {
return key.hashCode();
}
override fun equals(other: Any?): Boolean {
if (other is Element) {
return this.key == other.key;
} else {
return false;
}
}
override fun toString(): String {
return text
}
}
Main.kt
package net.itsky.xmas
import java.security.SecureRandom
fun main() {
val texts: List
"Bella Festas daz Nadal", "Bon nadal", "Buon Natale", "Crăciun fericit",
"Feliz Natal", "Feliz Navidad", "Feliĉan Kristnaskon", "Fröhliche Weihnachten", "Gledhilig jól",
"Gleðileg jól", "Glædelig Jul", "God Jul!", "God Jul", "Gëzuar Krishtlindjet", "Hyvää Joulua", "Häid jõule",
"Joyeux Noël", "Kellemes Karácsonyi Ünnepeket", "Merry Christmas", "Mutlu Noeller", "Natale hilare",
"Nollaig Shona Dhuit!", "Prettige Kerstdagen", "Priecîgus Ziemassvçtkus", "Selamat Hari Natal", "Sretan božić",
"Su Šventom Kalėdom", "Vesele Vianoce", "Vesele bozicne praznike", "Veselé Vánoce",
"Wesołych Świąt Bożego Narodzenia", "Zalig Kerstfeest", "καλά Χριστούγεννα", "З Рiздвом Христовим",
"Срећан Божић", "Честита Коледа", "ميلاد مجيد", "کريسمس مبارک", "क्रिसमस मंगलमय हो",
"クリスマスおめでとう ; メリークリスマス", "圣诞快乐", "즐거운 성탄, 성탄 축하"
);
val random: SecureRandom = SecureRandom();
val elementsList: List
val elements: Set
var first = true
for (e in elements) {
if (first) {
first = false
} else {
print(" — ")
}
print(e)
}
println();
}
Russia introduces new character encoding to replace Unicode
Russian computer scientists have created a new character encoding that will replace Unicode.
The encoding looks like this:
.0 | .1 | .2 | .3 | .4 | .5 | .6 | .7 | .8 | .9 | .A | .B | .C | .D | .E | .F | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0. | NUL | SOH | STX | ETX | EOT | ENQ | ACK | BEL | BS | HT | LF | VT | FF | CR | SO | SI |
1. | DLE | DC1 | DC2 | DC3 | DC4 | NAK | SYN | ETB | CAN | EM | SUB | ESC | FS | GS | RS | DEL |
2. | SPC | ! | « | » | ₽ | % | Z | V | ( | ) | * | + | - | , | . | / |
3. | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | = | ? | @ | |
4. | А | Б | В | Г | Д | Е | Ё | Ј | Ж | З | И | Ӣ | К | Л | М | Н |
5. | О | П | Р | С | Т | У | Ф | Х | Ц | Ч | Ш | Щ | Ъ | Ы | Ь | Э |
6. | Ю | Я | Ӓ | Ђ | Ӥ | Љ | Њ | Ӧ | Ӱ | Ӟ | Ҧ | Ћ | Ѣ | Ә | Ѫ | Џ |
7. | а | б | в | г | д | е | ё | ј | ж | з | и | ӣ | к | л | м | н |
8. | о | п | р | с | т | у | ф | х | ц | ч | ш | щ | ъ | ы | ь | э |
9. | ю | я | ӓ | ђ | ӥ | љ | њ | ӧ | ӱ | ӟ | ҧ | ћ | ѣ | ә | ѫ | џ |
A. | & | { | | | } | ~ | - | З́ | з́ | Ѳ | ѳ | Ꙃ | ꙃ | Ꙁ | ꙁ | Ѻ | ѻ |
B. | Ҁ | ҁ | ѹ | Ѹ | Ꙋ | ꙋ | Ѡ | ѡ | Ѿ | ѿ | Ꙑ | ꙑ | Ѣ | ѣ | Ꙗ | ꙗ |
C. | Ѥ | ѥ | Ꙓ | ꙓ | Ѧ | ѧ | Ѩ | ѩ | Ѫ | ѫ | Ѭ | ѭ | Ѯ | ѯ | Ѱ | ѱ |
D. | Ѵ | Ѵ | Ѷ | ѷ | Α | α | Β | β | Γ | γ | Δ | δ | Ε | ε | Ζ | ζ |
E. | Η, | η | Θ | θ | Ι, | ι | Κ | κ | Λ, | λ | Μ | μ | Ν | ν | Ξ | ξ |
F. | Ο | ο | Π | π | Ρ | ρ | Σ | σ | Τ | Υ, | Υ | υ | Φ | φ | PREFIX-CN | PREFIX-OTHER |
For Chinese letter, a three-byte-sequence starting with PREFIX-CN can be used. For all other letters, that are not in the base set, an eight byte long sequence starting with PREFIX-OTHER can be used.
This encoding will be mandatory in Russia and all areas annexed by Russia after a transition period.
Programming langauges, internet protocols, databases, operating systems,… everything will be replaced or adapted to work with this new revolutionary encoding.
2023
Щасливого нового року! — Frohes neues Jahr! — Happy new year!
Christmas 2022
З Рiздвом Христовим − Merry Christmas − Frohe Weihnachten
Available for new Projects in 2023
I am available for new projects starting April 2023.
I can support you for SW-architecture, SW-development, Linux, databases and security.
See IT Sky Consulting to see for more details on what I can offer.