profile picture

14 pages tagged with "programming"

Mermaid support for Go Archer

March 26, 2025
Added to Go Archer an option to output dependency graphs in mermaid format instead of DOT. Just add --format mermaid option. It has certain issues, in particular, styles only look good with the light theme. I might add an option to remove the styles altogether. read more

Go Archer

January 04, 2025
For a long time I have been using github.com/loov/goda whenever I wanted to build a graph of dependencies for a Go project. It is an excelent tool, but I wanted some additional functionality. Usually I use the graph to identify problematic dependencies; for example, if there is a dependency on a dat… read more

Compiling picoprobe

March 17, 2024
Made myself picoprobe. Official debug probe for pico costs 12€, pico board costs 4€, so it is cheaper and more fun to make. Wiring provided in Appendix A in "Getting started with Raspberry Pi Pico", all you need is to solder seven wires to pico and crimp some connectors on the other end of them. And… read more

Error handling in defer

October 07, 2023
I see periodically people handling errors in deferred calls like this: func Do() (r Result, err error) { // ... defer func() { err = multierr.Append(err, f.Close()) }() // ... } or another variant: func Do() (err error) { // ... defer func() { err1 = f.Close(… read more

Sorting Chinese characters

December 28, 2013
<p>Recently we decided to localize country selection list at work and there was some confusion about how to sort Chinese characters. I asked my wife and she told me that sorting by pinyin is seems most reasonable to her. So here's how to do it in Perl&hellip; </p> read more

ZeroMQ Rant

April 03, 2013
<p>Today deployed at work a new service that based on <a href="http://www.zeromq.org">zeromq</a>. I never liked zeromq because it does not provide any feedback about what is going on, and this is exactly what caused problems.&hellip; </p> read more

Packing timeval

December 05, 2012
<p>Recently I got a lot of failures from CPAN Testers for RedisDB on NetBSD i386. After investigating a bit I've found that <a href="http://www.netbsd.org/releases/formal-6/NetBSD-6.0.html">NetBSD 6.0</a> comes now with 64-bit <code>time_t</code> on all architectures. It means that the way I used to pack <code>struct timeval</code> value to set timeout on socket, didn't work anymore. Previously it was the same as <code>long, long</code> on all systems and pack looked like this&hellip; </p> read more

Memory leaks

October 08, 2012
<p>Spent the whole day looking for sources of memory leaks. One of them was because I decided to use named captures. It so happened that perl leaks some memory if named capture doesn't match.&hellip; </p> read more

RedisDB 1.03

March 19, 2012
Just uploaded RedisDB-1.03 to CPAN. In this version I extracted parser code into a separate module and cleaned it up a bit, I have in plans writing XS version of the parser. Another significant change is that I dropped Module::Install and switched to plain ExtUtils::MakeMaker. The size of the distri… read more

RedisDB 0.16

July 13, 2011
Just uploaded RedisDB 0.16 to CPAN. Hopefully now it will work on Windows. The problem is that Windows don't support MSG_DONTWAIT flag for recv, so I have to switch socket into non-blocking mode before checking for data. And I got just a single test report for MSWin32 for three months, apparently it… read more

Creating preforking server with POE::Component::Daemon

November 28, 2009
<p>After upgrading Perl to 5.10.1 at Friday I found that POE::Component::Server::PreforkTCP, which we use in one of our products, doesn't pass its tests anymore. Perhaps it's possible to fix, I don't know yet (it was Friday evening...), but as the module hasn't been updated since 2002 I decided to check if there's some replacement for it. I found <a href="http://search.cpan.org/dist/POE-Component-Daemon/">POE::Component::Daemon</a>, it looks very promising for now and I really like it. Here's TCP echo service that I wrote as example while playing with it&hellip; </p> read more

Catching a Leap Second

January 01, 2009
<p>As you may know there is such a thing as <a href="https://en.wikipedia.org/wiki/Leap_second">a leap second</a>, and Dec 31 2008 is a day with a leap second. A couple of hours before New Year I got an idea to catch this leap second.</p> <p>The problem is that Linux uses Unix time and thus ignores leap seconds. Hence if you use time(2) or gettimeofday(2), the leap second is just a repetition of the previous second. Here's the program I used to catch the leap second&hellip; </p> read more

More about UTF-8

August 02, 2008
<p>Now suppose you want to rid string of malformed utf-8 characters.</p> <p>Here is an example that checks an utf-8 string and replaces all malformed characters with '?'. The same idea as in the previous post. Note, that it checks only encoding, it is possible that encoding is correct, but the symbol doesn't exist.&hellip; </p> read more

How to truncate UTF-8 string

July 16, 2008
<p>Suppose you need to put UTF-8 string into a fixed length buffer. Actually I was in need to do this. Problem is that the last symbol may be incomplete, so here is the example how to do this&hellip; </p> read more