[{"content":" Warning! Page under construction! It may still not work properly! Welcome! #My name is Szymon. I am a software engineer, and this is my personal website. I created it to make it easy for potential employers to get in touch, and to share a bit about who I am and what I can do.\nHere, you’ll find my articles, travel photos, samples of my programming work, and my professional resume. Please note that only the most critical parts of the site have been translated into English. If you speak Polish (my native language), you can switch languages to access the full content (coming soon).\nEnjoy your visit!\nSzymon Wieloch\nHire Me as a Programmer # My skills are concentrated around software development in the areas of finance, networking, and real-time or low-latency systems. I specialize in low-level programming languages such as C/C++, Rust, and Zig. In addition, I build microservices in Go and handle automation, testing, and analytics using Python.\nI am currently seeking remote, B2B contract roles, primarily with companies based in the US, UK, and Western Europe. I have a proven 6+ year track record of delivering high-quality software remotely, working effectively in primarily English-speaking, multicultural environments. I am fully flexible to work in both American and European time zones.\nGet in touch Resume More Read My Articles # Throughout my technical and MBA studies, as well as my ongoing self-learning, I have written numerous articles. Most of these focus on low-level programming, trading, and quantitative finance—areas that perfectly match my professional interests. While only a fraction of these pieces have been translated from my native Polish into English, I hope you find them insightful. Enjoy the read!\nIT Finance Get to Know Me # While most of this site concentrates on the professional side of my life, I thought you might also like to get to know me on a personal level. Since sports have always been a huge part of my life, I have shared a bunch of sports-related articles, as well as a number of galleries from some important events in my life. Enjoy!\nGalleries Sport ","date":null,"permalink":"/","section":"","summary":"","title":""},{"content":"","date":null,"permalink":"/categories/","section":"Categories","summary":"","title":"Categories"},{"content":"","date":null,"permalink":"/categories/gallery/","section":"Categories","summary":"","title":"Gallery"},{"content":"A 3-day-long jeep trip to Uyuni, a famous salt flat.\n","date":null,"permalink":"/posts/galleries/jeeps/","section":"Posts","summary":"\u003cp\u003eA 3-day-long jeep trip to Uyuni, a famous salt flat.\u003c/p\u003e","title":"Jeep Trip to Uyuni"},{"content":"","date":null,"permalink":"/posts/","section":"Posts","summary":"","title":"Posts"},{"content":"My climb to Kilimanjaro – the highest mountain in Africa. Plus a few extra local trips in Tanzania.\n","date":null,"permalink":"/posts/galleries/tanzania/","section":"Posts","summary":"\u003cp\u003eMy climb to Kilimanjaro – the highest mountain in Africa. Plus a few extra local trips in Tanzania.\u003c/p\u003e","title":"Tanzania"},{"content":"Local culture and shamanic rituals in Bolivia.\n","date":null,"permalink":"/posts/galleries/bolivia/","section":"Posts","summary":"\u003cp\u003eLocal culture and shamanic rituals in Bolivia.\u003c/p\u003e","title":"Bolivia"},{"content":"Travel through Peru.\n","date":null,"permalink":"/posts/galleries/peru/","section":"Posts","summary":"\u003cp\u003eTravel through Peru.\u003c/p\u003e","title":"Peru"},{"content":"Long-distance running has been my passion for several years. I estimate that during this time I have run around 1,250 miles and completed two marathons.\nDuring my studies, I started running with my friend as a way to keep my body in shape. Back then, I only had a cheap pair of trainers and was able to run one mile at most. What started as an enjoyable way of spending time together and maintaining our friendship quickly turned into a much more extreme version of the sport.\nI started running regularly once a week, and the distance constantly increased. I had to replace my cheap sneakers with semi-professional running shoes to get better cushioning and improve my performance. Time quickly passed, and running a half marathon once a week became the norm. That was when I decided to run a full marathon. It took more time and effort than I had expected, mainly because I chose not to use any professional guidance. Instead, I simply kept increasing the distance I ran each week.\nOnce you start running more than 20 miles once a week, your body starts behaving in a strange way. You lose almost all fat from your body. Your body also tends to burn muscle, so you definitely do not look like a copy of Arnold Schwarzenegger. At the same time, however, your muscles develop extreme endurance. You also tend to spend two days after a run walking like a 90-year-old cripple with both legs broken. But you continue to do it because, at some point, running becomes an addiction. Research shows that during long endurance sports, your body releases a large amount of endorphins, which results in a moderate high.\nFinally, after almost three years of training, I ran two full marathons in Cracow, in an area known as Błonia — a great place for runners. By the time I was regularly running around 25 miles once a week, I had become familiar with the entire city of Cracow and most of the small roads, paths, and mountains within 13 miles of where I lived.\nBłonia — the place where I ran a marathon.\nAs it turns out, running is a great sport for building endurance and improving your heart and lungs, but not necessarily for your knees. My joints started protesting against running almost a marathon every week, and although consultations with specialists showed that my knees were still healthy, one physician explained clearly to me that running almost a marathon once a week, as I was doing back then, requires perfect genetic predispositions. And there is no reliable way to test for that. If you are unlucky, in the long term you may run into serious problems.\nAfter receiving this advice, I decided to diversify my training. I reduced my running, started martial arts training, and bought two bikes (one for mountain trails and one for paved roads). While I still run once in a while, cycling — which is much safer for the joints — replaced most of my endurance training and allowed me to increase my distances from 25 miles up to 125 miles.\nA mountain trip in Zakopane.\n","date":null,"permalink":"/posts/sport/running/","section":"Posts","summary":"\u003cp\u003eLong-distance running has been my passion for several years. I estimate that during this time I have run around 1,250 miles and completed two marathons.\u003c/p\u003e","title":"Long Distance Running"},{"content":"","date":null,"permalink":"/categories/sport/","section":"Categories","summary":"","title":"Sport"},{"content":"In 2018, after more than seven years of training, I finally passed the black belt exam and became one of the few Krav Maga instructors in Poland.\nKrav Maga is a military self-defense and fighting system developed for the Israel Defense Forces (IDF) and Israeli security agencies (Shin Bet and Mossad). It combines techniques sourced from boxing, wrestling, aikido, judo, karate, and several other martial arts. Krav Maga is known for its focus on real-world situations and extreme efficiency.\nThe system originated from the street-fighting experience of Hungarian-Israeli martial artist Imi Lichtenfeld, who used his training as a boxer and wrestler to defend the Jewish quarter against fascist groups in Bratislava, Czechoslovakia, during the mid-to-late 1930s. In the late 1940s, after emigrating to Israel, he began teaching combat training to what later became the IDF.\nKnife defense technique.\nFrom the outset, the original concept of Krav Maga was to take the simplest and most practical techniques from other fighting styles (primarily European boxing, wrestling, and street fighting) and make them quickly teachable to military conscripts. Krav Maga emphasizes aggression as well as simultaneous defensive and offensive maneuvers.\nKrav Maga has been used by Israeli special forces units, security services, and regular infantry units. Closely related variations have also been developed and adopted by Israeli law enforcement and intelligence organizations. Today, several organizations teach variations of Krav Maga internationally.\nTypical Krav Maga training.\nSome training sessions are conducted in realistic and unusual environments, such as trams. This gives students an opportunity to test their skills in a chaotic environment while the tram is moving during the training. Take a look at one of our training sessions in a tram:\nOccasionally, training sessions are also held on grass, in darkness, in everyday locations such as cloakrooms, in military buildings, and even in swimming pools.\nKrav Maga group after a training session in the tram.\nI started training Krav Maga as a way to stay in shape. Along the way, however, I discovered what almost all martial artists know: fighting is also a great way to sharpen your mind and attitude. Regular training requires a lot of discipline, high pain tolerance, and motivation.\nMost students quit after just a few training sessions, and around 90% stop within several months. Those who continue usually build strong bonds and friendships that extend beyond the training room.\nSparring — a frequent part of training.\nFortunately, throughout my entire Krav Maga journey, I have only had to use my skills once — when two much stronger men tried to rob me on my way home in Kraków. Still, it is reassuring to know that in a dangerous situation, you have the skills necessary to protect yourself.\nKnife defense seminar with Amnon Darsa in Kraków, 01/15/2011.\nAfter years of training, I finally completed an instructor course and started conducting both individual and group training sessions (including groups of more than 40 people) for those who want to learn self-defense quickly.\nFor me, Krav Maga is still primarily a hobby. The high market demand for software specialists makes changing professions financially impractical. At the same time, seeing young people learn their first Krav Maga techniques and progress along their martial arts journey is extremely rewarding.\n","date":null,"permalink":"/posts/sport/krav-maga/","section":"Posts","summary":"\u003cp\u003eIn 2018, after more than seven years of training, I finally passed the black belt exam and became one of the few Krav Maga instructors in Poland.\u003c/p\u003e","title":"Krav Maga"},{"content":"A parachute jump had always been one of my dreams. I was curious what it’s like to fall at high speed. It took me several years to find a good opportunity (and gather enough courage). But finally, I decided to do a so-called tandem jump, with an instructor attached to my back.\nSo, what’s it like to do a parachute jump? Contrary to common belief, you don’t need to be in great shape, have perfect health, or complete long courses. You also don’t need permission from your physician. Parachute jumps are relatively safe, and an average person can decide to do one without any previous preparation. You only need courage and some money (in Poland, around 200 USD).\nBefore the jump, you receive 10 minutes of theoretical training and a jumpsuit. Then you wait for your turn. In the airplane, your instructor straps you to his suit and parachute. Jumps usually take place at 13,000 feet (4,000 meters). It takes around 20 minutes of flight to reach that altitude. Once you get there, you simply open the door and jump.\nBut it’s not as easy as it looks. The stress is strongest just before the jump. I remember the moment when my instructor opened the door and I saw 13,000 feet of… well, nothing below me. That was the moment when I seriously considered quitting and cowardly going back home alive. Fortunately, my determination was stronger than the temporary fear, and we jumped.\nFifty seconds of free fall at 125 miles per hour makes you feel like a flying bird. The air pressure is so strong that it’s hard to breathe, so you are supposed to breathe through your nose. You can also help yourself by putting your hand in front of your face. The pressure was so intense that it pushed in my eardrums, and after landing I had to blow with my mouth and nose closed to return them to normal. While falling, you almost feel as if you are lying on a pillow made of air. The view of the distant earth getting closer and closer is amazing. It’s hard to describe. I think it’s best to watch the video — or even better, experience it yourself.\nAfter almost a minute, my instructor opened our parachute, and we spent another 10 minutes gliding through the air. My instructor handed me the steering handles, and for a minute I was able to direct our flight myself. He noticed that I actually enjoyed the flight and tolerated the speed well, so he directed the parachute into a spinning carousel maneuver. Eventually, we landed safely.\nI think this was the most extreme experience of my life. At the same time, I can genuinely recommend parachute jumping as an amazing experience for anyone brave enough to try it.\n","date":null,"permalink":"/posts/sport/skydiving/","section":"Posts","summary":"\u003cp\u003eA parachute jump had always been one of my dreams. I was curious what it’s like to fall at high speed. It took me several years to find a good opportunity (and gather enough courage). But finally, I decided to do a so-called tandem jump, with an instructor attached to my back.\u003c/p\u003e","title":"Skydiving"},{"content":"Certificates that I received after exams or during trainings in a variety of martial arts courses. Mainly Krav Maga.\n","date":null,"permalink":"/posts/sport/certificates/","section":"Posts","summary":"\u003cp\u003eCertificates that I received after exams or during trainings in a variety of martial arts courses. Mainly Krav Maga.\u003c/p\u003e","title":"My Trainer Certificates"},{"content":"Pictures from my parachute jump from 13,000 feet.\n","date":null,"permalink":"/posts/galleries/skydiving/","section":"Posts","summary":"\u003cp\u003ePictures from my parachute jump from 13,000 feet.\u003c/p\u003e","title":"Skydiving"},{"content":"A collection of pictures from my interpersonal training.\n","date":null,"permalink":"/posts/galleries/interpersonal/","section":"Posts","summary":"\u003cp\u003eA collection of pictures from my interpersonal training.\u003c/p\u003e","title":"Interpersonal"},{"content":"Pictures showing a weekend survival training in a harsh environment.\n","date":null,"permalink":"/posts/galleries/survival/","section":"Posts","summary":"\u003cp\u003ePictures showing a weekend survival training in a harsh environment.\u003c/p\u003e","title":"Survival"},{"content":"Pictures showing a graduation from the Master of Business Administration, National Louis University-Wyższa Szkoła Biznesu, Nowy Sącz.\n","date":null,"permalink":"/posts/galleries/mba/","section":"Posts","summary":"\u003cp\u003ePictures showing a graduation from the Master of Business Administration, National Louis University-Wyższa Szkoła Biznesu, Nowy Sącz.\u003c/p\u003e","title":"MBA Graduation"},{"content":"Pictures taken during a one-week trip to one of the most beautiful regions of Italy.\n","date":null,"permalink":"/posts/galleries/tuscany/","section":"Posts","summary":"\u003cp\u003ePictures taken during a one-week trip to one of the most beautiful regions of Italy.\u003c/p\u003e","title":"Gardens of Tuscany"},{"content":"Pictures come from a 2-day-long trip to the top of Panchase mountain in the Himalayas.\n","date":null,"permalink":"/posts/galleries/himalayas/","section":"Posts","summary":"\u003cp\u003ePictures come from a 2-day-long trip to the top of Panchase mountain in the Himalayas.\u003c/p\u003e","title":"Himalayas"},{"content":"Pictures taken in Nepal – a country in Asia. Mainly in the Chitwan National Park.\n","date":null,"permalink":"/posts/galleries/nepal/","section":"Posts","summary":"\u003cp\u003ePictures taken in Nepal – a country in Asia. Mainly in the Chitwan National Park.\u003c/p\u003e","title":"Nepal"},{"content":"Pictures from a trip to India lasting nearly a month.\n","date":null,"permalink":"/posts/galleries/india/","section":"Posts","summary":"\u003cp\u003ePictures from a trip to India lasting nearly a month.\u003c/p\u003e","title":"India"},{"content":"","date":null,"permalink":"/categories/job/","section":"Categories","summary":"","title":"Job"},{"content":"My up-to-date resume in the PDF format.\n","date":null,"permalink":"/posts/job/resume/","section":"Posts","summary":"\u003cp\u003eMy up-to-date resume in the PDF format.\u003c/p\u003e","title":"Resume"},{"content":"My Open Source Projects hosted on GitHub.\n","date":null,"permalink":"/posts/job/github/","section":"Posts","summary":"\u003cp\u003eMy Open Source Projects hosted on GitHub.\u003c/p\u003e","title":"My Open Source Projects"},{"content":"","date":null,"permalink":"/posts/job/certificates/","section":"Posts","summary":"","title":"Certificates"},{"content":"","date":null,"permalink":"/categories/finance/","section":"Categories","summary":"","title":"Finance"},{"content":"As a contractor, I\u0026rsquo;ve worked for many companies (contracts are typically short) and taken part in numerous projects. The following is a short summary of those companies and the most important and interesting projects I participated in.\nKraken (kraken.com) # A world-leading cryptocurrency exchange and Web3 pioneer known for its uncompromising commitment to security, engineering excellence, and financial freedom. As a developer-centric organization, Kraken fosters a high-performance culture that tackles complex distributed systems challenges, high-throughput trading engine optimization, and cutting-edge blockchain integrations to provide a seamless, secure experience for millions of global users.\nIntegration of Equities #Integration of the trading platform with third-party equity service providers, allowing Kraken users to trade regular stocks from the main platform and even pay for them using cryptocurrency.\nRe-architecture and Implementation of a Horizontally Scaling Trading Engine #A massive architectural redesign with one main goal in mind: making the core trading engine horizontally scalable while maintaining ultra-low latency requirements. A major part of the work involved providing alternative protocols and algorithms to maintain Kraken\u0026rsquo;s existing offerings while changing the internal implementation to allow it to scale. My initial estimates showed around 10x improvements, and an early prototype successfully validated the core flow.\nScope-Driven Configuration Service #A global service needs to maintain distinct sets of configurations for different countries, regions, client attributes, and even individual VIP clients. In a regulated market, every change must be approved by more than one person, and some values need to be dynamically calculated from live market data. Configuration changes must be delivered to all applications within milliseconds, maintaining strict transactional and ordering consistency.\nArdigen (ardigen.com) # A leading generative AI company at the intersection of biology and data science, dedicated to accelerating precision medicine. Ardigen provides a sophisticated environment for software engineers to build advanced platforms that leverage machine learning and bioinformatics to decode the complexity of the human immune system, directly contributing to the development of life-saving cancer therapies and personalized treatments.\nBiological Pipelines #Researching cancer using genetic information requires processing enormous amounts of data. Typical calculations would require months or even years of processing on a single machine. To shorten this timeline, hardware virtualization systems (such as AWS Batch) are paired with tools that automate jobs on those virtual machines. The most popular tool at the moment is Nextflow, which allows you to define pipelines as directed acyclic graphs (DAGs) of jobs that can be run across a variety of virtualization technologies. The purpose of my project was to develop several medical pipelines designed to help scientists test immunological vaccines, microbiological treatments, and classic pharmacological drugs.\nGlobalLogic (globallogic.com) # A Hitachi Group Company and leader in digital product engineering that helps brands design and build innovative software for the modern economy. For programmers, GlobalLogic offers a dynamic, multi-industry environment where engineering teams solve large-scale challenges in cloud platforms, embedded systems, and experience design, enabling the digital transformation of world-class businesses through high-quality code and agile methodologies.\nAutomotive Message Router #In the old days, mechanics checked cars using their eyes, hands, and sometimes even their noses. These days, however, cars are essentially computers with an accidental ability to drive. Most diagnostics therefore happen via electronic interfaces using self-reflective software. In order to test numerous internal chips, a high volume of messages is sent over an internal network to check if a given device responds, collect metrics, and diagnose any detected deviations. Mechanics simply connect to the car and download all the necessary data.\nCollective Sense (collective-sense.com) # An innovative, US-based cybersecurity startup (later acquired by Sumo Logic) that specialized in building advanced, machine learning-driven network security and threat-hunting platforms. For a programmer, Collective Sense offered a fast-paced R\u0026amp;D environment focused on big data analytics, custom SIEM/IDS (Security Information and Event Management / Intrusion Detection System) software engineering, and high-performance backend systems designed to detect and neutralize complex cyber threats in real time.\nNetwork Topology Discovery #A network discovery tool that performed active network scans to search for hosts and network devices, and was capable of iterating over connected routers to map the entire network. This was a heavy R\u0026amp;D project because there are virtually no standard methods for discovering network topology, and networks were never designed with providing metadata in mind. The application was partially based on algorithms found in OpenNMS (the only major open-source application with the same goal), but that tool offered only basic functionality. New algorithms and methods had to be created from scratch based on the limited information provided by the specific device models used by our clients.\nThe basic approach behind network discovery is to obtain information from devices using the SNMP protocol, command-line consoles, open ports, or by parsing their management websites (as with some Cisco devices). This yields small pieces of information about the network, which you must then combine into a big picture using custom algorithms. Sometimes, clever hacks and guessing have to replace solid information. The algorithms also need to correctly handle cases where there isn\u0026rsquo;t enough information available, leaving the system to choose the most likely connection patterns.\nUnfortunately, there are thousands of different device models, hundreds of existing network protocols, hundreds of standards describing how devices should exchange data, and each device model has thousands of bugs. This made it impossible to create an application that would work flawlessly in any existing network, so we settled for a simpler solution capable of correctly discovering around 95% of typical network schemas.\nDelphi (delphi.com) # Aptiv (formerly Delphi Automotive) is a global technology leader and automotive pioneer that renamed itself Aptiv following a strategic evolution to focus purely on the future of mobility. For software engineers, Aptiv provides a world-class platform to develop advanced safety systems, autonomous driving technologies, and vehicle-to-everything (V2X) connectivity. Programmers here work at the absolute cutting edge of embedded systems, real-time sensor fusion, and high-performance computing to redefine how the world moves.\nHTML Remote Car Radio Manager #During development, car radios do not have a built-in user interface. To test them during test drives, a temporary interface is required. The purpose of this project was to create an HTML interface that connects to the radio via WebSockets to send control messages. The interface also displayed information about available stations, signal quality, and real-time debug data.\ni2a Solutions (i2asolutions.com) # An agile software development studio and digital consulting agency focused on building high-performance web and mobile applications. For a programmer, i2a Solutions provides an interactive, full-stack environment centered on clean architecture, responsive user experiences, and tailored digital solutions—ranging from ad delivery engines to augmented reality (AR) and virtual reality (VR) integrations—enabling engineers to turn creative concepts into scalable, market-ready software products.\nScalable Real-Time Bidding Platform (moasis.com) #This was my biggest commercial success—an application that generated around $20,000,000 USD over several years. Its main purpose was to run real-time advertising auctions, allowing clients to display ads on mobile phones and websites. When I started working for Moasis (an i2a Solutions client), their solution could only handle around 200 auctions per second. I became the sole developer and, consequently, the architect of the entire underlying system. There were two main challenges: the company wanted to drastically increase processing capabilities, and response times were incredibly critical—anything above 50 milliseconds would make the system unusable due to third-party requirements.\nThe new version was fully scalable and easily handled 80,000 requests per second, with the ability to scale further to cover all available ad traffic. The average response time was around 1 ms, with a maximum response time of about 5 ms. The core challenges revolved around scaling, ultra-low latency, and implementing algorithms that distributed ad spending smoothly across different geographical locations and time zones.\nDreamLab/Onet (onet.pl) # Poland\u0026rsquo;s flagship online portal and largest digital news platform, reaching millions of active users daily. For web developers and software engineers, Onet offers a high-stakes, massive-scale environment centered on high-availability system architecture, real-time content delivery networks (CDNs), and complex ad-tech integrations. Programmers here work on highly optimized backend frameworks and performance-critical frontend systems designed to process heavy traffic loads smoothly while driving digital media innovation.\nContent Management Platform #Onet maintains hundreds of thousands of articles, millions of photos, and a massive library of videos, with new content added daily. Additionally, these articles serve as a vehicle for advertisements, meaning they must integrate with tools that measure and boost ad effectiveness. The main content management system at Onet is essentially WordPress on steroids, featuring a custom format and hundreds of features tailored specifically for company workflows and task automation.\nPart of my job also included migrating legacy articles into the new format, combined with a massive data cleanup.\nIBM (ibm.com) # A global technology titan and R\u0026amp;D powerhouse that has continuously redefined the computing industry for over a century. For software engineers, IBM offers an elite environment to work on foundational technologies, pushing the boundaries of hybrid cloud architecture, enterprise open-source systems, and trailblazing developments in enterprise artificial intelligence (watsonx) and quantum computing. Programmers here design robust, secure, and massive-scale infrastructure that powers the world\u0026rsquo;s most critical financial, healthcare, and enterprise networks.\nScalable Agent Network #A fully scalable agent network capable of handling several million connected devices while providing bidirectional message exchange between subservices and subagents.\nRemote Computer Scanner #A subagent utilizing the previously mentioned scalable agent network. Its purpose was to perform scans on connected devices and inventory installed software.\nNetezza Database Management Component #Netezza was acquired by IBM due to its phenomenally fast databases built for business analytics. The system takes the form of a massive hardware rack packed with dozens of hard drives, CPUs, FPGAs, network components, and power units. This project involved maintaining and extending a management component—for example, implementing features to extract detailed hard drive health data via the SMART protocol, and preventing false positives by delaying alerts using several configurable metrics.\nQnective (qnective.com) # A Swiss-based cybersecurity and secure telecommunications company specializing in high-grade encrypted communication platforms for governments, defense sectors, and public safety organizations. For a programmer, Qnective offers an elite, R\u0026amp;D-driven workspace centered on advanced cryptography, secure VoIP architectures, and multi-layer network infrastructure. Developers here solve sophisticated challenges in data confidentiality and wireless networking to build tap-proof mobile frameworks that protect critical global communications.\nSymbian VoIP Client #A seamless Symbian VoIP client that integrated with the phone\u0026rsquo;s native calling features and streamed audio over an IP stack using proprietary protocols. The main goal of the project was to define the communication protocol between servers and clients, and to implement a SIP server running on localhost directly on the Symbian device (which was the only way to seamlessly force all calls through the VoIP channel instead of the standard mobile network).\nBlackBerry VoIP Client #Maintenance and improvement of a BlackBerry VoIP client. This project primarily involved R\u0026amp;D regarding playing real-time audio from an incoming RTP stream—something BlackBerry devices did not support out of the box.\nWindMobile (windmobile.pl) # Ailleron (formerly Wind Mobile) is an innovative, Kraków-based technology pioneer that rebranded as Ailleron following its successful expansion and merger with Software Mind. Originally starting as a high-growth startup, the company became famous as the premier creator of Value-Added Services (VAS) for major telecom operators, building massive-scale mobile platforms like \u0026ldquo;Granie na Czekanie\u0026rdquo; (T-Mobile) and \u0026ldquo;Czasoumilacz\u0026rdquo; (Plus). For software engineers, it provided a dynamic, high-load R\u0026amp;D environment to develop heavy-traffic audio-streaming systems, mobile marketing engines, and complex cellular network integrations.\nNaviVoice #This application handled phone signaling and media using specialized network cards from Dialogic. Its main purpose was to provide a much simpler, protocol-independent API for business-layer applications. It supported several analog protocols, SS7, ISDN, SIP, and various less common telecom protocols. Its typical use case was running ringback tone playbacks (the music played to a caller before you answer). The project involved maintenance, bug fixing, migrating from Windows to a cross-platform solution (primarily Windows and Linux), and implementing the BICC protocol (part of the SS7 protocol stack).\nVideo Streaming Platform for Mobile Phones #An R\u0026amp;D project focused on streaming MPEG-4 video over 3G networks (video calls). The application was capable of displaying multiple video streams and interactive menus, reacting in real time to user button presses on their mobile phones. The project utilized hardware network cards manufactured by Dialogic, working directly with their drivers and APIs.\n","date":null,"permalink":"/posts/job/companies/","section":"Posts","summary":"\u003cp\u003eAs a contractor, I\u0026rsquo;ve worked for many companies (contracts are typically short) and taken part in numerous projects. The following is a short summary of those companies and the most important and interesting projects I participated in.\u003c/p\u003e","title":"My Companies And Projects"},{"content":"This article explores the concept, causes, and impacts of informal employee behaviors in the workplace, ultimately arguing that instead of strictly forbidding these natural tendencies, companies should strategically manage or leverage them to boost morale and long-term effectiveness.\nInformal Behavior: What Is It? For the purpose of this article, let’s define informal behaviors as all behaviors that are not a result of formal requirements stated by managers. Some of them may be related to professional purposes, while others may result from laziness or selfishness.\nEmployees in a company with no informal behaviors at all would spend their time doing the exact tasks assigned to them by their superiors. The purpose of all tasks would be to bring the company closer to its main goals. On the other hand, employees in a company with a high level of informal behaviors would spend a significant part of their time talking, entertaining themselves, building social relations, drinking coffee, or gossiping. Some of their activities would be related to forming good relations within the company; for example, one employee’s task could be organizing a darts competition.\nExamples of Informal Behaviors #During my work in software development companies, I have seen many behaviors that did not seem to be related to the formal responsibilities of employees:\nProgrammers, who spend 80% of their working time at computers, tend to spend every free minute socializing. One of the most common excuses is making a cup of tea. Programmers usually use text communicators (for example, Slack) to synchronize with their friends from different rooms. Then they go to the kitchen and spend about 20–30 minutes there waiting for coffee or tea to get ready and chatting. The consequence of such behavior is a reduced amount of time spent developing software.\nPeople spend part of their time surfing the Internet.\nWhen new decisions about the future of the company are announced, rooms turn into brainstorming sessions where all possible consequences of these decisions are discussed.\nWhen there are two groups developing two parts of a system that must cooperate with each other, a common behavior is a simple game: people try to find as many bugs as possible in the “opponent’s” code.\nSince there was no canteen in one company I worked for, the staff organized themselves and created a system for ordering food.\nIn every company there are informal groups of friends or people with similar interests. They spend more time together and cooperate more often with one another, even if their responsibilities do not require any contact at all.\nReasons for Forming Informal Behaviors #People can be considered selfish creatures. We tend to do what is profitable for us, not necessarily what is profitable for the group or company. Most employees perceive work as something less interesting than forming relationships with colleagues, drinking, eating, or playing games with them. It is no wonder that, if not controlled, they tend to spend much of their working time doing something different from what they are expected to do.\nThere are several common needs that people try to fulfill through informal behaviors:\nNeed for a social network – People tend to build relationships with colleagues instead of working. This includes speaking, playing games, exchanging messages (Facebook, emails, etc.), and discussing work-related problems.\nNeed for fun – Many jobs are extremely boring, and people try to do something more interesting to improve their mood.\nNeed to understand the current situation in the company – People want to understand relationships within the company and the rules by which it operates. They also want information about the company’s financial situation and future changes that managers plan to introduce.\nImpact on Effectiveness #It is easy to notice that many of the aforementioned behaviors can negatively affect a company’s effectiveness. If not controlled, people may spend the majority of their time doing something different from what is expected of them.\nHowever, informal behaviors also have advantages. One important effect is the creation of informal relationships within the group. People become friends, learn more about one another’s skills, and build stronger bonds with the company. The atmosphere becomes more pleasant and fulfills employees’ need to belong to a larger group. As a result, they may be less willing to change jobs.\nOne of the most important side effects of taking tea breaks is that programming requires a fresh mind. Breaks allow programmers to rest, discuss problems with more experienced colleagues, and find even more creative solutions. It is not entirely clear whether such behaviors actually decrease efficiency.\nI have heard several times about companies that tried to forbid all forms of informal behavior in order to increase the amount of time employees spend working. The side effect was a strong negative impact on employee morale. After a while, a significant number of employees decided to quit.\nIn the long term, every company creates an image in the minds of potential employees, and over time it becomes more difficult to continue forbidding informal behaviors while still attracting new talent. The cost of changing a company’s image is extremely high.\nOn the other hand, we have all seen that governmental departments do not usually work as effectively as they should. One reason for this situation is ineffective work habits among employees who feel little pressure to speed up their work, and therefore spend much of their time surfing the Internet and speaking with colleagues.\nHow to Deal With Informal Behaviors #As shown earlier, many informal behaviors can actually increase the efficiency of a company. The most important factor when dealing with informal behaviors is determining their real impact on effectiveness. If a behavior is actually positive or neutral, it is probably better to leave things as they are.\nHowever, if you notice that a particular behavior has a strongly negative impact on your company, then you generally have three options:\nForbid the behavior. Change its structure to reduce its negative impact. Change its structure and use it to the company’s advantage. Forbidding Behaviors #When forbidding a behavior, it is important to remember that people tend to try to break limitations and rules. I know of a company where the time employees spent making tea was considered too long. The general director decided to reduce it by ensuring that hot water was always ready in a kettle. What happened instead was that the first thing employees did when going to the kitchen was pour out the water and replace it with fresh water. The additional effort to keep hot water available at all times was wasted.\nA good idea is to provide an alternative way of achieving a similar benefit. For example, reading websites could be replaced with reading magazines related to work topics.\nEven when efforts to reduce informal behaviors encounter resistance, they may still be worthwhile. A good example is restricting Internet access among clerks. In one department that I personally know, employees do not have direct Internet access. They may use only the local network. If they need information unavailable on the local network, they must use a separate computer that provides Internet access. This solution significantly reduced the time wasted surfing the Internet.\nChanging Structure to Reduce Impact #Smoking gives people an excuse to go out and spend time chatting. Smokers usually go outside multiple times a day. The time spent reaching a location where smoking is allowed can actually be greater than the time spent smoking itself. One possible solution is to provide a special room for smokers inside the building.\nAnother common issue in companies is the need for employees to handle private matters during work hours. For some people, it is necessary to take breaks during the workday. Such behavior conflicts with the need to monitor whether employees spend enough time working.\nSome companies address this issue by introducing flexible working arrangements. In such an approach, employees are not expected to show up at fixed hours but rather to work an average of 40 hours per week.\nThanks to modern technology, it is relatively easy to monitor the time spent on one’s computer. Flexible forms of work are becoming more and more popular these days.\nA common need during work is the need for fun. In all the companies I worked for, people exchanged jokes through email. A popular approach is to print short comics and place them on walls, usually in kitchens or other areas where employees spend their free time. Employees who read jokes and comics while waiting for coffee may become less interested in exchanging jokes through email. Humor also makes the atmosphere more relaxing and enjoyable.\nUsing Behavior to the Company’s Advantage #Instead of fighting against the natural needs of employees, some companies decide to use those needs to their advantage. One example is using the natural tendency to build relationships by organizing regular training sessions in small groups. Such training not only allows people to improve their skills, but also gives them an opportunity to do something different from their daily work, meet new people, and form friendships.\nIn programming, a common way of reframing application testing is to introduce elements of competition. Two groups working on different applications try to find bugs in each other’s software. The group that finds more bugs wins the game and receives some form of reward.\nSome companies that require a high level of creativity from employees even allow games during work hours. For example, some departments at Google provide billiard tables for employees because it is believed that movement and games stimulate the mind.\nSummary #Informal behaviors in companies have always existed and likely always will, since work is a part of our lives. Only a few employees are willing to exchange a full eight hours a day solely for a good salary. Others prefer to earn a little less while having a fulfilling job that provides meaningful relationships and enjoyment.\nInstead of fighting against natural human needs, it is often better to use them creatively and redefine work as something more engaging — a place where social networks are built, friendships are formed, and collaboration becomes more enjoyable.\n","date":null,"permalink":"/posts/finance/informal-behaviours/","section":"Posts","summary":"\u003cp\u003eThis article explores the concept, causes, and impacts of informal employee behaviors in the workplace, ultimately arguing that instead of strictly forbidding these natural tendencies, companies should strategically manage or leverage them to boost morale and long-term effectiveness.\u003c/p\u003e","title":"The Phenomenon of Arising Informal Behaviors among Employees"},{"content":"Direct contact # +48 694 169 087\nSocial media # GitHub\nLinkedIn\nFacebook\nMy company #Szymon Wieloch Consulting\nOpolska Street 27/171\n31-276 Kraków\nPOLAND\nPolish tax identification number(NIP):7343251797\nBank account (PLN): 04 1140 2017 0000 4302 0873 0626\nMailing address #Śląska Street 82\n32-080 Zabierzów\nPOLAND\n","date":null,"permalink":"/posts/contact/","section":"Posts","summary":"","title":"Contact"},{"content":"This article describes a simple investment strategy designed for people who do not have much experience with investing but would like to optimize their gain-to-risk ratio and prevent high losses during potential global crises (as observed around 2012).\nIntroduction #The purpose of this article is to create a simple but effective investment strategy using tools such as diversification and hedging. The strategy is intended for inexperienced investors with limited knowledge of financial markets. The profile of the investor is that of an average risk taker. Part of the money should be invested in stocks, while the other part should be invested in bonds.\nThe currency used to evaluate the strategy will be the Polish zloty. One of the characteristics of human economic behavior is that a person’s utility function tends not to be linear. Because of its shape, a loss of 70% is perceived differently than an equivalent gain. A large loss is felt more strongly than a large gain. A good strategy should therefore maximize utility rather than gain alone, and for this reason this work concentrates on preventing an investor’s nightmare — a global crisis causing multiple assets to lose their value. The strategy will be tested using economic data from the previous five years. During this period, two economic crises occurred one after another.\nTypical utility function.\nShould We Trust Specialists? #We will begin building the strategy by asking a very simple question: shouldn’t we pass our money to financial specialists instead of investing it ourselves? At first, it seems crazy to try to compete on the market with banks and funds that spend billions of dollars each year on market analysis. Isn’t it better to trust a fund and leave the main decisions to professionals? Our intuition suggests that this should be a better idea than using our own limited skills to find and buy good stocks.\nHowever, practice shows something very different. The Stockwatch.pl portal analyzed stock funds and found that the majority of them (more than 70%) achieved worse results than the WIG index. Furthermore, the risk analysis showed that the Sharpe ratio calculated for most funds was usually below what the market itself had to offer.\nStock fund Sharpe ratio Average annual gain (%) Arka BZWK Akcji 0.20 11.49 Legg Mason Akcji 0.20 11.14 UniKorona Akcje 0.17 10.84 Skarbiec Akcja 0.14 10.09 BPH Akcji 0.11 9.48 ING Akcji 0.02 7.72 PZU Akcji Krakowiak 0.00 7.42 Novo Akcji -0.02 6.90 PKO Akcji -0.11 5.24 DWS Akcji D.S -0.11 5.11 Pioneer Akcji Polskich -0.10 5.09 Average 0.05 8.23 WIG index 0.13 10.36 Selected Polish stock funds, data from the last 10 years.\nThese counterintuitive results can be explained using the efficient market hypothesis. There are many different stocks available on the market. Some are better than others, but because many investors are constantly searching for undervalued stocks, the real difference in attractiveness between the best and worst stocks is usually not significant. Even skilled professionals who try to identify the best stocks cannot consistently achieve returns far above the market average.\nAt the same time, each stock fund has many internal costs. It must pay for marketing, office buildings, and employee salaries. The fund covers these expenses using management fees. In Poland, the average fee is around 4% per year and is approximately twice as high as in the United States. As a result, the average gain obtained with the help of a specialist is often lower than the cost of that assistance.\nA very similar phenomenon has been observed in the United States and has contributed to the popularity of index funds. A better strategy than investing in a stock fund may therefore be direct investment in the market. One can simply buy stocks independently, even if this means choosing companies more or less at random.\nDirect investment provides attractive expected returns. Unfortunately, buying a single stock also involves a very high standard deviation, resulting in high risk (and therefore a low Sharpe ratio). To eliminate the risk specific to a single company, it is necessary to buy a large number of different stocks. It is estimated that effective diversification requires purchasing around 30–40 different stocks.\nIt is also worth mentioning that good diversification requires an analysis of interdependencies between stocks. For example, Lotos and Orlen are both strongly dependent on oil prices, so their stock prices are highly correlated. The best solution is to create a portfolio of companies operating in different sectors of the economy.\nHow to Prevent Losses During a Global Crisis? #The nightmare of an investor is a global crisis that can cause losses of 50–80% within a short period of time. Recently, there were two such crises: the first was related to the bankruptcy of Lehman Brothers in 2008, and the second to the financial problems of Greece around 2011.\nUnfortunately, the WIG index tends to decline dramatically during such periods, resulting in high volatility and substantial losses. One way to reduce such losses is to use a hedging strategy. Part of the money should be invested in Polish stocks, while another part should be invested in assets negatively correlated with the WIG index.\nThere are many assets that behave in this way. A classic example is gold, because its price often rises during crises. However, since this strategy assumes partial investment in bonds, the best assets meeting our criteria are government bonds issued by countries with strong currencies.\nFrom the perspective of a Polish investor, the best currencies for investment are the US dollar, euro, Swiss franc, and pound sterling. The dollar and euro are the two main international trading currencies, while the franc and pound are considered relatively stable local currencies. Therefore, any local crisis affecting the WIG index may also influence exchange rates. For the sake of simplicity, this document will focus on the dollar and euro.\nThe following charts show that there is at least some correlation between the WIG index and currency exchange rates.\nBuilding the Strategy #We already know the basic structure of the strategy. It is based on investment in stocks of many Polish companies combined with investments in foreign government bonds denominated in US dollars and euros. What remains unclear are the proportions of these investments. How much should be invested in US or European bonds, and how much in Polish stocks?\nThe answer can only be based on past behavior of exchange rates and the WIG index. By analyzing data from the previous five years, we can calculate the proportions that minimize risk. Since the primary purpose of the strategy is to reduce risk during crises, the annual standard deviation of returns was used as the risk metric for different combinations of investments. The calculations are attached to this document in the form of a spreadsheet.\nAssumptions of the calculations # The value of the portion invested in Polish stocks changes in the same way as the WIG index. The value of the portion invested in foreign government bonds changes because of exchange-rate fluctuations and bond interest rates — 3% for US bonds and 4% for average European bonds. The metric used to evaluate the strategy is the standard deviation of the portfolio. The lower the standard deviation, the safer the investment. High returns are not expected during a crisis. The cost of exchanging currencies is negligible. The values of the WIG index and exchange rates were checked once a month. (The calculations could be improved by checking values daily, but for the sake of simplicity monthly observations were used.) No debt (leverage) is allowed. It is possible to determine the proportions through numerical analysis. Because most common applications do not allow simultaneous optimization of two variables, the solution can be found manually by modifying the percentage invested in euros until the smallest standard deviation is identified. Later, the percentage invested in dollars can be adjusted in a similar way. By repeating this process until any further change increases the risk metric, it is possible to find the optimal solution.\nFinal Strategy #The simulation showed that the best investment proportions were 28% Polish stocks, 72% European bonds, and 0% American bonds. The last value is particularly interesting. Negative values were not tested because the strategy assumes no leverage, but it might theoretically be profitable to borrow dollars and invest more money in euros and Polish stocks.\nUnfortunately, these proportions are based on historical data, and there is no guarantee that they will remain optimal during future crises.\nBest investment proportions.\nIt appears that the euro is a better hedging currency than the US dollar. During the crisis period, the investment achieved an attractive return of 3.53% per year. Considering the 4% interest rate on euro-denominated bonds and the fact that this return was measured during two crises, the result is quite impressive.\nAt the same time, the investment also had an attractive standard deviation — only 8.99% at its worst. This value is small compared to the WIG index, which at one point lost 67% of its value.\nIt is also interesting to estimate the expected return outside periods of crisis. Assuming that exchange rates remain unchanged, the expected gain can be calculated as follows:\nEG = 28% \\cdot 10.36% + 0% \\cdot 3% + 72% \\cdot 4% = 5.79%\nThe final chart shows how combining three different types of investments reduces overall portfolio volatility.\n","date":null,"permalink":"/posts/finance/simple-investment/","section":"Posts","summary":"\u003cp\u003eThis article describes a simple investment strategy designed for people who do not have much experience with investing but would like to optimize their gain-to-risk ratio and prevent high losses during potential global crises (as observed around 2012).\u003c/p\u003e","title":"Simple Investment Strategy During a Global Crisis"},{"content":"","date":null,"permalink":"/categories/it/","section":"Categories","summary":"","title":"IT"},{"content":"Modern IT world has created hundreds of programming languages. Each of them has its own pros and cons. If you have a job to do – what language should you choose?\nThe short answer to this question is: it depends, because depending on the kind of functionality that you need, a different language may be optimal. In this article I’ll try to describe the most popular kinds of languages, their advantages and disadvantages as well as the kinds of applications that you should use them for.\nHigh or low level? #A useful distinction for us will be whether the language is high-level or low-level. Low-level languages directly describe operations that need to be performed by the underlying hardware. The higher-level the language is, the more abstract it gets (for example, it can be run on a variety of processors) and the more functionality is automated (for example, memory management). Unfortunately, high abstraction and automation come with a price. The biggest problem is the overhead of the layer that translates high-level commands into hardware operations. In the case of scripting languages, the overhead makes the application run around 100 times slower than a similar application written in a low-level language. Somebody could now think that high-level languages do not make sense if they slow down your system to this level. But it’s a mistake. In the modern world, the cost of a processor is relatively low compared to the cost of writing software. High-level languages can greatly decrease the time needed to finish your projects and limit potential problems. This is why the modern world generally tends to move in the direction of high-level languages.\nIf you want to write an application, you can usually choose to either use a low-level language and slowly build fast-running software, or use a high-level language and quickly build a slow-running solution.\nDifferent tasks may require different choices. For example, websites are usually built using high-level scripting languages. But embedded devices (that are mass-produced in as many as millions of pieces) are commonly built using low-level C, and this makes it possible to use cheaper processors and lower the unit cost.\nAssembler #Assembler is a class of languages that represents the lowest possible level. A characteristic feature of those languages is that each existing processor has its own assembler language, and an application written for one processor cannot be run on another processor.\nCurrently, assembler is relatively rarely used. It is sometimes a language of choice for programming microcontrollers and – of course – compilers. Its organization makes it difficult to write any large software because the code quickly becomes hard to maintain.\nC #C is currently the most popular procedural language. This means that its syntax is based on procedures and data structures. A disadvantage of C is its lack of full portability between platforms. Although code written for one processor can be compiled for another, in practice there are differences in details between microprocessors and C does not always hide the complexity. For example, an integer variable (int) has different sizes depending on the microprocessor used. A similar problem is caused by the so-called endianness – the order of bytes in larger structures. Different processors organize their memory in different ways, and this sometimes causes problems when code gets migrated from one platform to another. To write a multiplatform application in C, you need to hire really good programmers who are aware of the challenges of running C code on multiple processors and know how to handle them.\nCurrently C language is mostly used to write embedded software and operating systems.\nC++ #C++ is a younger cousin of C. Actually, it is an object-oriented extension to C. C++ is replacing C because of its ability to create object-oriented design that makes building complex applications much easier. At the same time, object-oriented design does not introduce significant overhead. If your platform supports a C++ compiler, you should probably use it instead of C.\nC and C++ (and a recent, not yet fully developed, Rust language) are the only languages that can be used to build real-time solutions, for example audio streaming in Skype. For a long time, C++ was also used in desktop applications and, although it has been superseded by C# and Java, it is still quite popular because of market inertia. Another area of popularity is game development, where C++ has definitely been the most popular choice for many years.\nJava/C# #Java and C# belong to the first generation of languages that are 100% independent of the processors they run on. Thanks to this, each application written in Java should (at least in theory) work on every operating system and on every microprocessor. Practice sometimes shows that there are small differences between platforms that do cause some problems, but contrary to C and C++, those problems are rather uncommon.\nJava and C# introduced one more very important mechanism that solved an age-old programming problem – memory leaks. A C or C++ programmer needs to remember to free previously allocated memory when it is no longer needed. C# and Java detect when a given object is no longer referenced and free it for you. They eliminate hundreds of difficult problems and reduce programmers’ work. A disadvantage of garbage collection is its unpredictability, which makes Java and C# unsuitable for writing real-time solutions.\nJava and C# are frequently used to create office software (for example, Word) and business web services. There was research conducted on productivity in C++ and Java, and according to it, you need only half as much time to write the same application in Java compared to C++. Unfortunately, it then runs between 1.4 and 5 times slower.\nScripting languages #The last category of programming languages is scripting languages. Frequently, they are also called dynamically typed (formally this is not the same, but most often scripting languages are also dynamically typed). What is characteristic of those languages is that objects do not have predefined types, and only when you perform a given operation on them is it checked whether this operation is possible. To state this in a more metaphorical way, scripting languages allow you to add five carrots to a car and, during this operation, raise an exception. Statically typed languages such as C++ or Java do not let you add incompatible types at all, and they report an error during compilation.\nThere are many scripting languages, with JavaScript, Python, Perl, and PHP being among the most popular ones. Because of the lack of static code checking, dynamic languages require a huge number of automatic tests, especially unit tests. They are not the best choice for writing one big application, but a great choice for writing complex microservice architectures that consist of multiple small and independent services.\nScripting languages are commonly used in a web context for generating and maintaining websites, applications running in the cloud, and for automation and writing short programs on desktop computers. Scripting languages are also frequently used to perform integration tests of applications written in other languages.\n","date":null,"permalink":"/posts/it/programming-languages/","section":"Posts","summary":"\u003cp\u003eModern IT world has created hundreds of programming languages. Each of them has its own pros and cons. If you have a job to do – what language should you choose?\u003c/p\u003e","title":"What Programming Language Should You Choose?"},{"content":"More and more programmers are becoming interested in so-called agile project management methodologies. And there is a good reason for that — research done in the USA showed that projects using this approach get better ROI.\nThe most popular of the agile methodologies is Scrum — an approach created by Ken Schwaber in 1995. Schwaber is also the co-founder of Scrum.org, an organization that teaches companies how to do agile and tries to standardize knowledge of Scrum. It was at Scrum.org where I had the pleasure to start my journey with agile methodologies and where I received my Professional Scrum Master certificate.\nTwo main features of Scrum are iterative and incremental approaches towards code creation. Iterativity means that the work is done in cycles that usually take between 1 and 4 weeks. Each of them consists of:\nPlanning Actual work (design, implementation, testing) Demonstration, or in short: Demo Retrospective that helps the team to learn from previous mistakes The incremental approach means that after each cycle there is a ready and working product with new features. In Scrum you never start something that you can’t complete and show at the end of the cycle.\nIn Scrum there is a concept of a Backlog — a list of all features that you would like to have in your product. In each cycle some of those features get selected and implemented.\nA huge advantage of Scrum is providing quick feedback to people responsible for the business side of the project. The progress is clearly visible and measurable, so it’s easy to control spending and organize other activities in the company. Each functionality that gets implemented is instantly ready for testing and checking whether it meets business requirements as expected. In case it doesn’t, there’s still plenty of time to introduce changes.\nThe advantages of Scrum are clearly visible when you compare it to the previous methodology — Waterfall. This approach had its roots in classical project management thought and assumed designing the whole application before writing the first line of code, implementing the whole application right from the start, and testing assumptions only at the end of the project when you could finally run the code. Until the project was finished, you could not run anything — in a similar way, a car is not functional with only two wheels. The effects were sometimes very harsh. Waterfall led many projects to an epic disaster by showing problems in assumptions way too late in the project, generating additional costs, creating low-quality applications and sometimes falling prey to contractual penalties when the deadline was not met.\n","date":null,"permalink":"/posts/it/scrum/","section":"Posts","summary":"\u003cp\u003eMore and more programmers are becoming interested in so-called agile project management methodologies. And there is a good reason for that — research done in the USA showed that projects using this approach get better ROI.\u003c/p\u003e","title":"Scrum – Agile Project Management"},{"content":"When HTML5 appeared on the programming scene, a new trend emerged – computer games running in a browser (and not using Flash). Maybe those games constitute the future of modern entertainment?…\nMost computer games created in HTML5 are two-dimensional and use a new HTML element introduced in the fifth version: the canvas. Canvas is almost like a Paint application running in your browser, and your JavaScript code can freely draw on it. It’s enough to draw 25 frames per second to achieve the illusion of smooth movement.\nAn exemplary use of the canvas and a comparison with its alternative – the Microsoft Silverlight plugin – is shown above.\nUnfortunately, JavaScript is not a very fast programming language, and the canvas does introduce additional overhead. To achieve smooth movement, you frequently need to employ many tricks. For example, you can redraw only a part of the screen; create layers such as objects and background, where you only modify the first one; and many others. It is also necessary to periodically profile your game to make sure you haven’t exceeded the browser’s capabilities.\nOne of the problems with JavaScript is that it is, by design, single-threaded and asynchronous. This approach works perfectly well with normal text-based websites. However, this is currently a limitation because it doesn’t use modern multi-core processors effectively. To bypass this limitation, a new “Worker” object was introduced in the JavaScript standard. It allows offloading some work to another thread (for example, a time-consuming search for a path on the board can be executed in a worker while the main thread is busy rendering graphics).\nAnother new HTML5 component used by games is the “audio” tag. It embeds sounds in the website, and later those sounds can be controlled by JavaScript and played when an event takes place (for example, an explosion sound is played when the player succeeds in hitting an object with their gun).\nAn alternative to canvas is the use of the “WebGL” library, which is unfortunately not yet supported by all browsers. However, it allows creating three-dimensional computer games with quality comparable to commercial games using DirectX.\nExamples of Great Games #This article would be of little worth without some excellent game examples. The following is a short list of HTML5 games in a variety of genres that I personally find amusing.\nCommand \u0026amp; Conquer # One fan of the classic game Command \u0026amp; Conquer decided to convert this game from its original DOS environment into a browser. To my surprise, this project became a huge success, and the result is one of the best computer games ever made, available right in your browser.\nhttp://www.adityaravishankar.com/projects/games/command-and-conquer\nEntanglement # Something for puzzle game fans. Entanglement offers great graphics and an opportunity to sadistically torment our brain cells. It’s perfect for a short 10-minute break from work.\nhttp://entanglement.gopherwoodstudios.com\nGame of Bombs # Game of Bombs is the only multiplayer game on this list. A player connects to a server where they compete with other players on large boards. Players try to destroy one another by placing bombs and detonating them, and of course, avoid getting killed themselves. A good piece of entertainment.\nhttp://gameofbombs.com\nBananabread # Bananabread is a game created by the Mozilla team, and its main purpose is to test the effectiveness of their Firefox browser. The game is fully three-dimensional with great graphics – the result of using the WebGL library. Bananabread is a great first-person shooter where you can compete against computer-controlled players. Unfortunately, the game may not work in Internet Explorer because – as usual – this browser is highly delayed when it comes to implementing modern browser standards.\nhttps://developer.cdn.mozilla.net/media/uploads/demos/a/z/azakai/3baf4ad7e600cbda06ec46efec5ec3b8/bananabread_1424465008_demo_package/index.html\nBiolab Disaster # Biolab Disaster is a classic two-dimensional platform shooter. You can finish it in 15 minutes.\nhttp://playbiolab.com\n","date":null,"permalink":"/posts/it/html5-games/","section":"Posts","summary":"\u003cp\u003eWhen HTML5 appeared on the programming scene, a new trend emerged – computer games running in a browser (and not using Flash). Maybe those games constitute the future of modern entertainment?…\u003c/p\u003e","title":"Computer Games in HTML5"},{"content":"Exploring how over-simplified abstractions can decimate software performance, this article contrasts the high resource overhead of thread-heavy synchronous I/O with the efficiency and architectural challenges of managing multiple data streams within a single asynchronous thread.\nDue to a growing complexity of software systems, there is a natural tendency towards simpler methods that achieve similar (although not identical) results. Examples include Java or C# language. This process highly relies on removing the need for understanding complex operations that take place inside your operating system kernel. A programmer is only supposed to combine prebuilt components into his application. These \u0026ldquo;idiot-friendly\u0026rdquo; solutions often lead to dramatic decrease in your application performance.\nWhat can threads do to your application? #A good example is an application written by two colleagues of mine from one of my past employers. In order to handle database connections they created a new thread with a new socket per each connection. This approach is very simple and very common for example in Java (and this was the language used for the database). Unfortunately it turned out that the overhead of creating a new thread and maintaining multiple connections was so huge that the application was not working effectively at all. To prevent creating a new thread whenever they wanted to put something into the database (usually hundreds times per second) they eventually created a pool of threads. But with a growing number of parallel requests, the database slowed down and each thread had to wait a long time before it could finish its work. It turned out that this application required 3000 threads in the pool to be able to queue all requests. This is hardly a typical solution. The application could not run on Windows platform because this operating system could not handle such an uncommon number of threads. Finally, the application was run on Solaris platform because only this operating system was capable of running such a poorly written code.\nI suspect that in this situation most programmers would blame Windows for such a low capacity for maintaining threads but, frankly speaking, this is not Bill G.’s fault. It is not normal to create such a huge amount of threads in one application. The reason for it is the cost of the so-called context switching. Each operating system assigns each thread a time slice when the given thread is running using 100% of one CPU core, then the processing power is passed to another thread. Although it seems that two applications are running in parallel on your computer, in fact only one of them is running at a time but your operating system is switching them so often, that you do not notice (this gets a little more complex in case of modern multicore processors but it’s outside of scope of this article). In order to switch between threads, your operating system needs to replace values of multiple processor registers and part of its memory. Context switching is normally not very costly but it needs to take place so frequently that a user experiences the illusion of parallel processing. If you create too many threads, this forces the operating system to switch context frequently and therefore to waste a lot of its processing power.\nI used to work with phone cards from Dialogic company. Their documentation recommends to use their API in asynchronous mode because creation of for example 120 threads needed for the synchronous mode is way too much. Further recommendations state that the synchronous mode was introduced only as a framework for easy tests (for example as a demo for clients). In this situation you may wonder – what the consequences are of using 3000 threads? Nothing good can come out of that.\nTwo approaches to IO operations #If threads and synchronous mode are not good for handling multiple parallel IO operations, then what is? It turns out that much more effective is using asynchronous operations in one single thread. Let’s just look at some examples.\nSynchronous operations #Synchronous operations are very easy to understand. They are used by 95% of all “new-age” programmers (this often explains why modern applications run so slowly and why you need to buy new hardware once in a while). Synchronous IO operations are called blocking because the thread gets stopped until new data arrives. I have decided to use C/C++ language to give you some examples.\n//This example uses standard C++ library. #include \u0026lt;fstream\u0026gt; #include \u0026lt;string\u0026gt; using namespace std; int main() { ifstream file(\u0026#34;filename.txt\u0026#34;); // Here a file stream is created. string line; getline(file, line); // Here a synchronous function gets called and it blocks the thread. /*You can reach this point only when the previous operation finishes. You need to keep in mind that IO operations are relatively slow compared to the speed of microprocessors. This means that your CPU processing power will get wasted until new data arrives. */ file.close(); // The file gets closed and operating system resources get freed. } In the example of an application with 3000 threads my colleagues of course used a blocking synchronous function to perform operation on the database. The function was finishing only when data was exchanged between the application and the database and the database reported end of its work. Because it was quite a time consuming operation, they had to have 3000 threads and the overhead of such a huge number of threads was killing performance of their application.\nAsynchronous operations #Asynchronous operations work in a different way. The thread gets blocked too but contrary to synchronous operations you can wait for multiple sources of data just in one thread. Control comes back to your thread as soon as one of the sources reports arrival of data. Instead of 3000 threads you can create only one thread and wait inside of it for 3000 sources of data. Once the data arrives, you can process received data and continue waiting for signals. This approach removes most overhead of the previous operations, can run on greater number of platforms and highly improves performance. Asynchronous operations are operating-system-specific and, depending on a platform, they need to be handled in a different way. But in reality most of programming languages provide their platform independent wrappers around OS native API. For example in Java you can use the java.nio.channels package. But since such libraries only wrap the internal OS functionality, let’s concentrate on what is actually going on below the surface.\nOn Windows platform the function to wait for multiple sources of IO data is WaitForMultipleObjects(). On platforms based on the POSIX standard its equivalent is the select() function (modern platforms also support epoll()). All those functions work in a similar way. First you need to open streams that represent the given socket or file (depending on platform other IO types may be available, for example unix sockets are popular on unix-like operating systems including Linux). When opening the given stream you receive a unique (within the process) ID of the stream. On Windows it’s a HANDLE structure (that is internally implemented as a pointer). POSIX-compatible platforms use common integer number (int). Then all those IDs are collected into a set and are passed to the previously mentioned function. Call to this function always blocks the thread. When the call finishes it returns identification of the source that does have data to be handled. Then it’s up to the programmer to handle this call and perform operations that perform business logic of his application.\nThe following example shows a use of two COM ports on Linux:\n#include \u0026lt;sys/time.h\u0026gt; #include \u0026lt;sys/types.h\u0026gt; #include \u0026lt;unistd.h\u0026gt; int main() { int fd1, fd2; /* Two new IDs are allocated. */ fd_set readfs; /* A collection of IDs is allocated. */ int maxfd; /* Maximum number of used IDs. */ int loop=1; /* loop runs in a cycle till its value equals 0. */ /* open_input_source opens device, configures port and returns ID of the stream. */ fd1 = open_input_source(\u0026#34;/dev/ttyS1\u0026#34;); /* COM1 */ if (fd1\u0026lt;0) exit(0); fd2 = open_input_source(\u0026#34;/dev/ttyS2\u0026#34;); /* COM2 */ if (fd2\u0026lt;0) exit(0); maxfd = MAX (fd1, fd2)+1; /*Maximum value of ID that needs to be checked by select() function. */ /* The main loop. */ while (loop) { FD_SET(fd1, \u0026amp;readfs); /* Add fd1 to the collection. */ FD_SET(fd2, \u0026amp;readfs); /* Add fd2 to the collection. */ /* Block the thread till new data is available. */ select(maxfd, \u0026amp;readfs, NULL, NULL, NULL); if (FD_ISSET(fd1, \u0026amp;readfs)) /* If there is data available on port COM1, handle it somehow. */ handle_input_from_source1(); if (FD_ISSET(fd2, \u0026amp;readfs)) /* if there is data available on port COM2, handle it somehow */ handle_input_from_source2(); } } Limitations of asynchronous operations #It is obvious that creators of operating systems like to make our lives miserable by adding unnecessary complexity. Some operating systems have certain limitations on asynchronous operations. The most important factor is the highest possible number of data sources. In case of POSIX-compatible systems this value highly depends on the concrete OS but usually it is huge, something between hundreds and thousands. Real issues programmers have with Windows, which limits the number of asynchronous data sources to only 64. And 64 includes also timers, waiting for other threads to finish and synchronization primitives. It’s because of those limitations that writing multithreaded applications is more common on Windows and writing asynchronous applications is more common among Linux programmers.\nAdditionally, writing asynchronous applications tends to be more complex and requires greater programming skills. It’s even more difficult when you want to create a multiplatform application because APIs of operating systems differ. To handle the last problem it’s best to use one of existing C++ multiplatform libraries such as ACE (Adaptive Communication Environment) or Boost.Asio. But it remains a topic for yet another article.\n","date":null,"permalink":"/posts/it/sync-async/","section":"Posts","summary":"\u003cp\u003eExploring how over-simplified abstractions can decimate software performance, this article contrasts the high resource overhead of thread-heavy synchronous I/O with the efficiency and architectural challenges of managing multiple data streams within a single asynchronous thread.\u003c/p\u003e","title":"Synchronous vs Asynchronous IO Operations"},{"content":"How to easily implement asynchronous operations using a friendly object-oriented design?\nIn one of my previous articles, I described the idea of asynchronous operations. Apart from many advantages, asynchronous operations do have some disadvantages as well – they are complicated. It is relatively complicated to implement a big, multiplatform application. Of course, it is possible to wrap native functions from your operating system with classes that will greatly simplify the use of this complicated approach, and they can also hide the inter-platform differences. Correct encapsulation and abstraction can result in a much more user-friendly interface.\nBasic Object-Oriented Framework #Let’s start by thinking about what the core of such wrappers would look like. We definitely need to wrap select() or WaitForMultipleObjects() (depending on the platform). This class should contain a collection of IDs of the previously created I/O streams. When data arrives, it should automatically invoke a callback and then return to waiting for other events. Let’s call this class Reactor because it reacts to events reported by the operating system.\nCertainly, the Reactor class doesn’t “know” what to do with the data received. The decision belongs to business logic that should be placed outside the wrapper. As I have already mentioned, we need a callback. Since there are multiple signals that can be received from a stream (data, error, notification about a closed socket, etc.), it’s best to create a generic interface — or rather, because C++ does not support the interface concept directly, an abstract class with several purely virtual methods. Implementations of this abstract class can then be registered as callbacks for handling I/O events. Let’s call this abstract class EventHandler because it handles the events.\nLet’s try to write a simple piece of code that shows what we are aiming at:\nclass EventHandler { friend class Reactor; private: virtual void handleInput() = 0; virtual void handleOutput() = 0; virtual void handleClose() = 0; virtual void handleError(int err) = 0; }; The Reactor class cooperates with the EventHandler class. It needs to contain a collection of registered pairs: a stream ID and a callback for handling events. It also needs methods for adding, removing, and manipulating callbacks and handlers — and, of course, for starting and stopping the asynchronous loop. An exemplary Reactor interface is shown below. Handle represents an OS-specific stream ID — int on POSIX platforms and HANDLE on Windows (such types are usually defined as typedefs in platform-specific C++ headers):\n// Brief overview of the Reactor class class Reactor { public: void registerHandler(Handle handle, EventHandler* eventHandler); // adds new pair void removeHandler(Handle handle); // removes pair void startEventLoop(); // blocks the thread and waits for asynchronous events void stopEventLoop(); // ends the loop and unblocks the thread }; Now we can create, for example, a class that handles data coming from a socket. It should inherit from the EventHandler class and provide implementations of its purely virtual methods. Once we have this class, we can create several instances and open several sockets. Then, pairs consisting of a socket and a handler can be registered in Reactor to handle several connections within a single thread.\nUsually you create only one Reactor instance per thread. There can be several threads, each running its own internal event loop using Reactor. A common pattern is, therefore, to use thread-specific storage. Instead of passing a Reactor reference to each object that uses it, it is much simpler to create a function like Reactor\u0026amp; giveMeThisThreadReactor().\nMore Advanced Functionality #We already have everything we need to handle I/O operations correctly, but it turns out there\u0026rsquo;s more that can be achieved with Reactor. Let\u0026rsquo;s look at cross-thread notifications, timers, and OS signals.\nCross-Thread Notification System #Let\u0026rsquo;s imagine that you have several threads in your application. Each of those threads has its own Reactor, and each thread maintains several sockets, files, and other asynchronous I/O sources. Let\u0026rsquo;s say that one of your threads needs to send a message to another thread. How would you do that? Of course, the solution is to use synchronized message queues. It\u0026rsquo;s a very elegant solution commonly used in the majority of mature systems. The problem, though, is that the thread handling I/O operations gets blocked and won\u0026rsquo;t check the queue until some I/O data arrives. To avoid that, we not only need a queue but also a way to wake up the receiving thread.\nTimers #Another feature commonly used by applications is timers. For example, when you perform an HTTP GET request, you always want to make sure that your application won\u0026rsquo;t hang forever if the other party stops responding. To achieve that, you have to set a time limit and simply end the request after the given time. Since the receiving thread is blocked on I/O operations, it can\u0026rsquo;t check the time. It\u0026rsquo;s a very similar situation to the one with a synchronized queue – your thread is blocked, unresponsive, and waiting for some I/O data. Fortunately, both select() and WaitForMultipleObjects() allow you to pass a timeout value. If you wrap this functionality correctly, you can have a solid timer framework with the ability to add and cancel asynchronous timers.\nSignals #Signals are very short messages passed from your operating system to the application you are running. For example, if you press Ctrl+C, your operating system sends SIGINT to your application. If the application does not provide a handler for this signal, the operating system will kill it. If it does, it handles the signal in the way implemented by the programmer. Of course, signals are asynchronous in their nature, so they fit naturally into our Reactor/EventHandler framework.\nComplexity Problem #After this analysis, you have surely noticed that our framework becomes a little complex. It gets even more complex if you want to create a multiplatform solution, because then you need to hide all the platform-specific details inside the Reactor, write duplicated platform-specific code, use a lot of C++ #ifdef directives, and test your code on all platforms. This framework grows even further when you notice that signals, asynchronous notifications, and timers are implemented differently in each operating system, and your code will differ significantly for each platform. It would probably take months to implement it on your own. Fortunately, there are ready-to-use libraries where all that work has already been done.\nLibraries for Handling Asynchronous I/O #Asio from Boost #There are actually two main libraries commonly used in the C++ world to handle asynchronous I/O operations. The first one is Asio, which comes from Boost (https://boost.org). Boost is one of the most solid and widely-used libraries for system programming in C++. Unfortunately, this library does not support signals or cross-thread notifications. You could probably implement them on your own, but what\u0026rsquo;s the point of using a library then?\nAdaptive Communication Environment #A very solid alternative is the Adaptive Communication Environment (http://www.cs.wustl.edu/~schmidt/ACE.html). Contrary to Boost, it provides all the mentioned functionality. Its API consists of the ACE_Reactor and ACE_Event_Handler classes. As you can guess, they almost precisely match what I have described earlier as Reactor and EventHandler. Additionally, ACE allows you to use operating system handles directly; it has its own wrappers around sockets, file servers, etc. that make I/O much simpler, and it is suitable for real-time solutions.\nA Real-Life Example #While working for Wind Mobile, I had the opportunity to maintain the NaviVoice application. NaviVoice is a layer of a phone card management stack, and it is purely asynchronous due to speed requirements. Since it was supposed to be migrated from Windows to Linux (but was using direct operating system calls), ACE and the Reactor framework were a perfect solution for that. Not only did this framework prove to be useful, but it also saved me months of slow implementation and writing multiplatform code. A huge advantage of using an external library is that you don’t have to write more code. In fact, you need to delete much of your own code and therefore make your product much easier to maintain. You can also limit the number of tests, because such libraries tend to be heavily covered with tests and are already used by thousands of companies around the world. You can skip part of the documentation too – ACE is, of course, very well documented.\nThe final result was an application that had less code, could work on several platforms, and was much easier to maintain. Simply – an almost perfect success story.\n","date":null,"permalink":"/posts/it/oo-async/","section":"Posts","summary":"\u003cp\u003eHow to easily implement asynchronous operations using a friendly object-oriented design?\u003c/p\u003e","title":"Object Oriented Approach to Asynchronous Operations"},{"content":"For many years the C++ language was the only reasonable option for writing real-time or embedded software. But during recent years a new technology has emerged — a technology that has the potential to take the crown of low-level programming in several years. It\u0026rsquo;s called Rust.\nWhy not Java, Python, Go or D? #There are many alternative languages to C++. Somebody could wonder – what’s the point of creating a new one? Why don’t you simply use Java, C#, Go, Python or any of the currently popular languages? It turns out that for many use cases those languages are solid substitutes. Actually they can be much better than C++ (have you ever seen any website written in C++?). But there are cases where C++ did not have any real alternatives. Let’s look at them:\nReal-time software – Java, Go, C#, Python and almost all modern languages rely on a garbage collector. This memory management method is perfect for writing an average application but it\u0026rsquo;s definitely not suitable for real-time systems because the garbage collector tends to stop the running application at random moments for random periods of time. Therefore you can\u0026rsquo;t force any time-related guarantees using those languages. If the ABS system of your car was written in Java it could stop at some moment and refuse to work for several seconds. If this happened during a difficult situation, this could end in a serious crash. Operating systems – the garbage collector and other mechanisms used in modern languages require a pre-existing operating system that provides several services. It is therefore not possible to use Java or Python to write your operating system. The C language is commonly used for this purpose. High load systems – computer games are a good example of applications where the speed is hugely important. Games compete on having best graphics. Other languages do not get compiled to binary processor commands and therefore are much slower. For example Java is 1.4 to 5 times slower than C++ and Python is around 100 times slower. There are only two other languages that compile to binary representation without any overhead: D and Go. Unfortunately the Go language has a garbage collector and it has still some overhead compared to C++. D language will be discussed later. Embedded software – by embedded software I mean software created for devices that are produced in millions of copies. C++ requires much slower CPUs than other languages and therefore can highly reduce the price of the device. Just one dollar difference multiplied by 10 million devices gives you 10 million dollars in savings – money that is worth the extra effort needed to create software in C++. Why don’t we stick to C++? #You could wonder – why to change something that has been successfully used for decades? Because C++ is a really old language and it has many flaws. Many, many, many flaws. Let’s just look at a few of them:\nIt’s not multiplatform by design – although C++ can be used for multiplatform programming, it requires extra effort and sometimes generates unpredictable behavior. For example the integer “int” type has different size depending on CPU and even operating system. It uses preprocessor – even Bjarne Stroustrup, the creator of C++, thinks that the preprocessor is a totally out-of-date solution and should not be used in modern languages. But C++ cannot drop backwards compatibility and still allows the use of something so ridiculously error prone. It is not safe – this is probably the biggest disadvantage of C++. It is so easy to shoot yourself in the foot using C++ that you may wonder how all the big applications are actually built. In C++ you can easily write out of bounds of an array and corrupt your memory. Then you get what is thought to be one of the most difficult bugs to find and fix. Memory leaks – C++ doesn\u0026rsquo;t have any built-in mechanism to prevent memory leaks and it\u0026rsquo;s a common problem that many complex applications consume more and more and more resources by never freeing part of allocated memory. While there are memory debuggers that help you with finding such problems, they often generate thousands of false positives and require a lot — and I mean — a lot of effort to find such bugs. Many small design flaws – C++ was one of the first object-oriented languages and many of its features were experimental. Not all of them are thought to be right choices. For example a default copy constructor very often causes unpredictable bugs. Lack of standard for naming C++ symbols makes it impossible to link pieces of code compiled by two different compilers. Automatic conversion between numeric types often removes part of the information. Lack of built-in synchronization methods makes multithreading programming a real challenge. There are no standard building methods and no packaging system – while all modern languages provide what you could call a meta information format for projects, C++ can be built with many tools including Make, CMake, Microsoft internal solution format and many more. Without any standard for building a project it is impossible to introduce packages – small “bundles” of code that can be downloaded from a central repository. Such packages were successfully introduced for example in Java and Python. What then? #After the success of C++ there were several attempts to introduce another language that could possibly replace C++. One of them was the “D” language. But it did not stick. It is thought that D language – although better than its predecessor – was simply not good enough. The value that it provided was not enough to switch from C++ to it. As a result, D quickly stopped being used and has only minimal support in the Internet.\nRust is just another approach. But contrary to previous languages it’s the one that truly has potential to become something greater than C++. Let’s look at several of its main features that make it a solid proposal as a C++ replacement.\nRust is multiplatform. Since the beginning Rust was thought to be a platform independent language with types of constant size and the operating system API hidden after a multiplatform Rust standard library. This allows you to write your code once and run it everywhere. Rust is safe. By \u0026ldquo;safe\u0026rdquo; I mean that it is not possible to corrupt process memory, write code with random bugs or compile something that obviously would not work. The Rust compiler is very rigid. It strictly analyzes your code and reports errors whenever there is any potential for a mistake (sometimes it even forbids you to run perfectly valid code if it can\u0026rsquo;t understand its validity). It\u0026rsquo;s not possible to write outside of arrays, it\u0026rsquo;s not possible to modify read-only data, and it\u0026rsquo;s not possible to create any cross-thread hazards because Rust won\u0026rsquo;t allow you to modify the same variable from two threads without a mutex. From the beginning to the end Rust was designed to be 100% safe. Rust has a unique memory management approach. What makes Rust different from both Go and C++ is that it does not allow memory leaks but at the same time it does not have any garbage collector. This memory management system is a little similar to C++ smart pointers (programmers are not allowed to allocate memory with smart pointer assigned to it). Rust is fast. The comparison of languages showed no reasonable differences between C++ and Rust. Rust has a standard build system and packages. https://crates.io is a central repository of all free Rust packages (also known as crates). Rust links with C. From Rust language it is possible to run C functions directly (although they need to be separately declared). It is also possible to create a Rust library with a C compatible API. This makes it easy to combine those two languages and reuse a lot of existing code. Are there any disadvantages? #As with all existing technologies, Rust is not perfect. But contrary to other languages most of the problems are not technical but rather caused by its relatively fresh release.\nRust is new. And as a new language it is not yet finished. Many people in the world are working on making Rust better but at the moment the language lacks several important features (such as templates with constant numbers) and there are not as many libraries as in C++. Rust is difficult. While still being probably less complicated than C++, it requires quite a long time to achieve high level of competency. What makes Rust especially difficult are its two features: lifetimes and the borrow checker that work together to prevent memory corruption and memory leaks. In more complicated scenarios it is sometimes difficult to write the right combination of lifetimes to prove to your compiler that the code is safe. There are almost no Rust programmers. This is a huge business blocker. Companies rarely start new projects in Rust because there are no workers in the market and they need to hire C++ programmers and spend a lot of resources on teaching them Rust. Summary #While Rust may not be perfect, it’s the only language that differentiates itself from C++ enough to create a potential for becoming a replacement for C++. There is still a lot to do but interest in Rust seems to grow. The first place on Stack Overflow when it comes to the most asked questions is a sure sign that people started learning Rust seriously. Hopefully the initial market resistance will be short-lived and Rust will conquer the world of low-level programming.\nYou can learn more about the language at https://www.rust-lang.org\n","date":null,"permalink":"/posts/it/rust/","section":"Posts","summary":"\u003cp\u003eFor many years the C++ language was the only reasonable option for writing real-time or embedded software. But during recent years a new technology has emerged — a technology that has the potential to take the crown of low-level programming in several years. It\u0026rsquo;s called Rust.\u003c/p\u003e","title":"Rust – Modern Alternative to C++"},{"content":"When you work as a network administrator, there are few more useful tools than an application that discovers your network topology and is capable of drawing it to you and providing all the information about the network.\nLet\u0026rsquo;s look at several ways to find devices in our network and build connections between them.\nComponents of all networks #As you may know, all networks consist of similar components. There are end devices (like the one that you use to read this article), there are switches that connect devices within one IP network and there are routers that connect networks. Devices are connected using cables or WiFi – let’s call these edges. This is how a typical network looks like:\nIf you want to build that kind of view, first you need to find devices in your network, then you need to obtain information about those devices and finally you need to find edges between them.\nFinding devices #There are two main ways to find devices. The first one is pinging them. For example, if your network is 192.168.0.0/24, then there are 254 possible IP addresses in it. You can ping them one by one. Of course some operating systems by default disable ICMP ping responses and this may be a problem (the same happens when devices have a firewall). But if a device has at least one port open, then it is possible to find it using port scanning. Port scanning is a popular method of sending fake TCP SYN messages and waiting for response. Open ports will send an answer. Fortunately, there are several applications that can handle both pinging and scanning ports. Nmap and masscan are the two most popular ones with nmap being the most reliable and masscan being the fastest (so most suitable for big networks). But even those applications do not have any chance of finding an IPv6 device in a network simply because IPv6 local networks have much more addresses than the whole IPv4 Internet. And this is where we need to use the second method.\nThe second method is obtaining information from network devices. Almost all network devices support the SNMP protocol. And it gives you an ability to download information about the network if you know the password of your router (if you are a network administrator, then you do). There are also several other ways how you can obtain the same data. For example Windows machines support WMI protocol, most devices support console management (telnet or ssh protocols) and some devices (such as Cisco Meraki) have web management consoles. Regardless of the way, you can download the same information:\nARP tables with IPs of devices in the network. MAC forwarding tables (some devices do not have IPs, for example switches. But you can find their MAC addresses in the MAC forwarding table. A device with MAC address and without IP is probably a layer-2 device such as a switch or repeater). IPs of other routers (thanks to routing protocols such as OSPF). Devices discovered using Cisco Discovery Protocol or Link Layer Discovery Protocol. Sometimes a device can be also discovered by analyzing network connections, for example if one interface of a router is connected to three computers, then there is probably a switch in the middle.\nObtaining device information #Devices that support SNMP and similar protocols allow you to obtain information about them. A set of available information depends highly on the protocol and concrete model, but usually you can obtain:\nVendor Model Hostname (or some other name) Operating system and its version Device type (such as printer, laptop, mobile phone, router) Information about hardware List of interfaces with assigned IPs In case of virtual machine servers – list of running virtual machines But what about devices that do not support SNMP or any other similar protocol? There are still some ways to learn more about it. Running devices have open ports. By checking what ports are open and sometimes obtaining information from those ports (for example Windows devices commonly run Samba servers with open NetBIOS port that you can connect to and obtain information about the system). For example printers have open printing server ports. Routers have open routing protocol ports etc.\nDiscovering edges #Once you know the devices in the network, it’s time to discover the edges between them. This is one of the most difficult parts of the discovery process because there are many different approaches that give you pieces of information about the network and it’s difficult to combine them. Nevertheless let’s look at common methods of discovering links in the network:\nARP tables and MAC forwarding tables give you layer-2 information about location of devices in the network. By applying quite a complicated algorithm you should be able to find most of those connections. CDP and LLDP protocols were specifically designed to discover neighboring devices. If your devices support one of those protocols, they should discover themselves and report the edge via SNMP. STP protocol can be used to retrieve information about the tree-like structure of the spanning tree of layer-2 devices and to retrieve at least part of the network. Routing protocols such as OSPF contain a representation of a network and know how they are connected to their neighbor routers. Routing tables can be used to locate the interface where the given IP may be connected. There are also several methods that depend on the underlying protocol. For example serial layer-2 links are almost always direct connections, so if you have only two such interfaces running in one IP network, it’s almost always an edge. Let’s try it #The described algorithms eventually get very complex, so implementing them on your own may not be the wisest choice. Fortunately there is an open source project called OpenNMS that is relatively good at discovering a network. It’s free and comes with additional monitoring functionality allowing to check what is currently going on with your devices. You can try it at https://opennms.org.\nExemplary screenshot of OpenNMS.\n","date":null,"permalink":"/posts/it/discovering-network/","section":"Posts","summary":"\u003cp\u003eWhen you work as a network administrator, there are few more useful tools than an application that discovers your network topology and is capable of drawing it to you and providing all the information about the network.\u003c/p\u003e","title":"Discovering Network Topologies"},{"content":"Almost all modern language are by design multi-platform. However C++ is not\u0026hellip;\nIn the age of multiple available operating systems, a programmer often faces the problem of choosing the platform for their project. This choice is often not trivial. Sometimes certain functionality is available only on selected platforms, sometimes user preferences change and they migrate from one platform to another (for example Symbian was dropped because of huge interest in Android), and many applications are written for multiple platforms from the beginning. It is often best to write code that is platform-independent, and if that is not possible – to somehow manage the existence of multiple platforms in the simplest way.\nTwo approaches to multiplatform programming #There are two main approaches to multiplatform programming. The first assumes that you know all target platforms and in your code you perform the right calls to your operating system API depending on the platform. The second approach assumes that instead of directly using your operating system you should rather use a multiplatform library that hides the complexity of using the operating system. In the second case the library creates a unified and consistent API for all supported operating systems.\nYour implementation #If you want to handle the complexity of multiple platforms on your own, then you need to use preprocessor directives to perform calls to the right OS API in your code. A good example is the function that loads dynamic link libraries (the \u0026ldquo;so\u0026rdquo;, \u0026ldquo;dll\u0026rdquo; or \u0026ldquo;dynlib\u0026rdquo; files – the extension is specific to your platform). To load a dynamic link library you need to write something like this:\n//Define a dynamic link library handle specific to the given platform: //Windows version #ifdef WIN32 #define SHLIB_HANDLE HMODULE #define INVALID_SHLIB_HANDLE NULL #endif //WIN32 //Unix, Linux and OSX version #ifdef __unix #define SHLIB_HANDLE (void *) #define INVALID_SHLIB_HANDLE NULL #endif //__unix inline SHLIB_HANDLE load_dynamic_library(const char * fileName) { #ifdef WIN32 return LoadLibrary(fileName); #endif //WIN32 #ifdef __unix return dlopen(fileName, 0); #endif //__unix } The code above was simplified to highlight the most important elements. Preprocessor directives were used to define universal data types such as the dynamic link library handle and the invalid value of that handle. Then the load_dynamic_library() function is defined. Depending on the operating system, it performs calls to a specific OS API function. An application using only the SHLIB_HANDLE type, the load_dynamic_library() function and the INVALID_SHLIB_HANDLE value is going to be multiplatform. Of course in practice you may want to support a large number of platforms. Thanks to the POSIX standard, the majority of operating systems provide a similar API and the above code should work well with them. If you want to use a non-standard operating system or if you want to handle functionality that is not within the scope of POSIX, you have to implement multiple versions of your functions. Unfortunately you also need to test your code on multiple platforms.\nUse of libraries #Another option is the use of multiplatform libraries. An example of such a library is the standard C++ library. In the modern C++ 14 version it wraps functionality such as file streams, threads and signals. The C++ standard library is actually only a definition of an interface. All platforms provide their own implementation of those interfaces. This approach allows you to use the library on all platforms in exactly the same way. In the case of other libraries, the implementation for the most typical platforms is provided by creators of the library.\nUnfortunately the scope of the standard library is very limited. If you want to implement anything that is outside of C++ std, you need to do your own research on libraries that cover the functionality that you need.\nComparison of the Two Methods #Each of the aforementioned approaches has its pros and cons. The main advantages of your own implementation are full control over the code and the ability to optimize the implementation according to your needs. However, using libraries tends to be a better solution in most cases because of ease of use and much lower effort required. The advantages of using libraries include:\nYou don\u0026rsquo;t need to learn about all operating systems, you only need to learn how to use the library. Using libraries does not require writing your own code that wraps the behavior of operating systems. Popular libraries tend to be very well designed. Usually they are created by large groups of developers and architects. It\u0026rsquo;s hard to achieve the same level of quality on your own. Libraries are usually very well tested. Your own code would be new and prone to many potential issues. Libraries tend to be very well optimized. Libraries are usually very well documented. If the library is popular, there may be programmers on the market who already know it very well. In this case you save time needed for research and learning. Libraries usually support a much broader range of operating systems than you need, and therefore give you the potential for migrating your product to more platforms in the future. Example Libraries #Many such libraries already exist. Here is a short list of libraries that I have worked with and can recommend for usage in certain scenarios:\nApache Portability Runtime – this is the only C library on this list. APR is a simple C library that concentrates on optimizing your memory allocation by doing it in big chunks. https://apr.apache.org Boost – at the moment of writing, Boost is the most popular and widely accepted C++ library. Its many sub-libraries allow you to access your operating system API indirectly. For example, the Asio library allows you to use asynchronous input-output operations (highly specific to your operating system) using a multiplatform API. You can learn more about Boost at http://www.boost.org. Adaptive Communication Environment – a solid wrapper around the operating system API. What distinguishes ACE from Boost is that Boost tries to mimic the OS API very closely, while ACE provides several components that – while having the same external functionality on all platforms – work in a totally different way internally depending on the platform. http://www.cs.wustl.edu/~schmidt/ACE.html. POCO – a set of libraries created mainly to simplify the creation of web-related services. https://pocoproject.org. ","date":null,"permalink":"/posts/it/multiplatform-programming/","section":"Posts","summary":"\u003cp\u003eAlmost all modern language are by design multi-platform. However C++ is not\u0026hellip;\u003c/p\u003e","title":"Multiplatform Programming in C++"},{"content":"","date":null,"permalink":"/tags/","section":"Tags","summary":"","title":"Tags"}]