# Despite the odds

A blog by Andrew Khmylov

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Random Things I Liked, Mar 2023

DevFeed: [Random Things I Liked, Mar 2023](<https://devfeed.tech/articles/random-things-i-liked-mar-2023-38431.md>)

Original publisher: [Read original article](<https://khmylov.com/2023/03/random-things-i-liked-mar-2023/>)

Author: Andrew Khmylov

Published: 2023-03-27T00:00:00Z

Content type: opinion

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [LLMs](<https://devfeed.tech/topics/llms.md>), [AsyncAPI Specification](<https://devfeed.tech/topics/asyncapi.md>), [diffusion-transformers](<https://devfeed.tech/topics/diffusion-transformers.md>), [Concurrent Programming](<https://devfeed.tech/topics/concurrent-programming.md>), [Prompt Engineering](<https://devfeed.tech/topics/prompt-engineering.md>), [OCaml](<https://devfeed.tech/topics/ocaml.md>), [OpenAPI Specification](<https://devfeed.tech/topics/openapi.md>)

Tags: [diffusion](<https://devfeed.tech/tags/diffusion.md>), [language-models](<https://devfeed.tech/tags/language-models.md>), [ocaml](<https://devfeed.tech/tags/ocaml.md>), [openapi](<https://devfeed.tech/tags/openapi.md>), [programming](<https://devfeed.tech/tags/programming.md>), [reasoning](<https://devfeed.tech/tags/reasoning.md>)

### AI overview

A personal roundup of developer topics and papers the author liked in March 2023, covering Automerge 2.0, AsyncAPI for event-based architecture, using external tools with large language models, diffusion-based image reconstruction from brain activity, effect handlers in OCaml, and prompt-based perspectives on LLM behavior.

### Source excerpt

Automerge 2.0 https://automerge.org/blog/automerge-2/ The complete rewrite of Automerge dropped right after discussing CRDTs optimizations the last time, addressing performance concerns. AsyncAPI https://www.asyncapi.com/docs It's like Swagger/OpenAPI, but for event-based architecture. I've been working with events and messages for quite a long time now, and tried some approaches to spec description, like Protocol Buffers, but it just didn't feel right. Too much hassle and not so much benefits. I'm eager to try this one though. LLMs + external tools = 🔥 As of today, large language models are trained on "static" data sets, they don't have a memory, and don't know about the world around them. However, if the only thing they do and do so extremely well is predicting next token, it's only natural to wonder "why can't we teach the model to predict some API call when it needs external data?". There have been a couple of papers on that topic: Toolformer: Language Models Can Teach Themselves to Use Tools ReAct: Synergizing Reasoning and Acting in Language Models Reading your mind with diffusion models I've already noticed multiple times that casual news headlines today sound exactly like futuristic imaginations from the original Deus Ex game, but this paper, "High-resolution image reconstruction with latent diffusion models from human brain activity", takes it to the next level. The research behind this has been going on for more than a decade, and the recent advances in computational capabilities and diffusion models accelerated the progress. Concurrent Programming with Effect Handlers https://github.com/ocaml-multicore/ocaml-effects-tutorial Every developer is familiar with exceptions. Algebraic effects take them to the next level of abstraction, and expose the manipulation of control flow as a first-class citizen. This is a nice write-up and a collection of examples of various effects implementations in OCaml. The Waluigi Effect https://www.lesswrong.com/posts/D7PumeYTDP

## Gradient descent: back to basics with F# and C#

DevFeed: [Gradient descent: back to basics with F# and C#](<https://devfeed.tech/articles/gradient-descent-back-to-basics-with-f-and-c-38430.md>)

Original publisher: [Read original article](<https://khmylov.com/2023/02/gradient-descent-engine/>)

Author: Andrew Khmylov

Published: 2023-02-02T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [C#](<https://devfeed.tech/topics/csharp.md>), [F#](<https://devfeed.tech/topics/fsharp.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [Artificial Intelligence](<https://devfeed.tech/topics/ai.md>), [Deep neural networks](<https://devfeed.tech/topics/deep-neural-networks.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [code](<https://devfeed.tech/tags/code.md>), [f-sharp](<https://devfeed.tech/tags/f-sharp.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [neural-networks](<https://devfeed.tech/tags/neural-networks.md>)

### AI overview

An overview of building a gradient descent engine from scratch, with discussion of using F# and C# and a simplified explanation of neural network training.

### Source excerpt

After dabbling with high-level AI tools recently, I wanted to revisit the basics and look under the hood. As they say, the best way to learn something is to build it. I've been following wonderful "from scratch" videos from Andrej Karpathy, where he starts with the essence of all modern AI architectures: gradient descent engine. So, I decided to keep along and build my own engine at https://github.com/khmylov/dumb-gradient, and this article is an overview of its implementation, and some thoughts on using F# and C# for a task like that. Side note: look back at university I completely forgot that one of my university projects back in 2010 was actually about building an image recognition neural network! It was funny to look back at the source code from that era. Turns out, the core ideas are still relevant, it's just computational advances, new modelling discoveries and infrastructure around them that allowed so much progress in the last decade. I'm not going to recite all the details here, the main (much simplified) ideas to comprehend are as follows (I recommend Deep Learning with PyTorch, fast.ai course, and Huggingface course to get a much deeper dive into this) We can represent most real-world data, like text, images, sounds, as vast arrays of numbers Turns out, we can model a lot of "intelligence" tasks (natural language processing, image recognition, etc.) with sophisticated mathematical functions operating on our numeric representation of real-world data Universal approximation theorem was a break-through postulating that even most sophisticated functions can be actually modeled by combining only primitive linear f(x) = a * x + b and basic non-linear functions such as tanh into some inter-connected network (here come the inevitable neuron models and neural networks), we just need a huge number of them to do that, and some computation power to figure out the arguments for those functions "Training" such networks is figuring out how to tweak randomly initialized

## January 2023 Digest: CRDT Optimization, ML Data Ethics, and Prompt Engineering

DevFeed: [January 2023 Digest: CRDT Optimization, ML Data Ethics, and Prompt Engineering](<https://devfeed.tech/articles/random-things-i-liked-jan-2023-38429.md>)

Original publisher: [Read original article](<https://khmylov.com/2023/01/random-things-i-liked-jan-2023/>)

Author: Andrew Khmylov

Published: 2023-01-30T00:00:00Z

Content type: opinion

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [distributed-systems](<https://devfeed.tech/topics/distributed-systems.md>), [Optimization](<https://devfeed.tech/topics/optimization.md>), [Prompt Engineering](<https://devfeed.tech/topics/prompt-engineering.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [Machine learning](<https://devfeed.tech/topics/machine-learning.md>), [Benchmark](<https://devfeed.tech/topics/benchmark.md>), [stable-diffusion](<https://devfeed.tech/topics/stable-diffusion.md>)

Tags: [benchmark](<https://devfeed.tech/tags/benchmark.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [diffusion](<https://devfeed.tech/tags/diffusion.md>), [distributed-systems](<https://devfeed.tech/tags/distributed-systems.md>), [ml](<https://devfeed.tech/tags/ml.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [prompt-engineering](<https://devfeed.tech/tags/prompt-engineering.md>)

### AI overview

A personal digest discussing CRDT performance improvements through better data structures and hardware-specific techniques, concerns about the ethics and copyright implications of training large ML models on web data, and skepticism about prompt engineering as a durable discipline. It argues that prompt behavior depends on model implementation and version rather than magical intelligence hacks.

### Source excerpt

Keeping on the challenge, here's a digest of things which got my attention recently. CRDTs optimization https://josephg.com/blog/crdts-go-brrr/ I am long time fan of collaborative editing and distributed systems in general. The author makes a great overview of existing approaches to CRDTs, taking a special hint on Mr Kleppmann's Automerge. It is a great theoretical proof-of-concept (I actually had an idea to use it for several work projects), but it lags behind in terms of performance. The author reaches the astonishing 5000x improvement by utilizing better data structures and some hardware specifics. Nice side idea: Kleppmann keeping a trace of keyboard events while writing a paper, which then can be used as a real-world benchmark test data! Have I been trained? https://haveibeentrained.com/ The recent rise of huge ML models trained on the data scrapped over the web raises a lot of concerns around copyrights and ethics. On the one hand, if you share something on the web, you should assume that it'll stay there forever, with possible malicious uses. On the other, is it appropriate for the companies to use your data without any consent from your side, to make a profit for them? Critique of prompt engineering Remember 2022? Everyone was crazy about "hacking" prompts for the recently released models. Adding "critically acclaimed" or "artstation trending" to the image generation prompts; Twitter influencers claiming "prompt engineering" to be the future, replacing traditional software jobs. I was skeptical on that, it immediately felt like super niche implementation details of each particular model, that's why prompt hacking guides were not gonna work in the long run. I guess it comes from not understanding the implementation details: there is no magical intelligence hacks, just massive amout of weights. People try random stuff on prompts, and then try to make some sense and assumptions about them. What works for one model version may not even work on another version of

## On being mediocre

DevFeed: [On being mediocre](<https://devfeed.tech/articles/on-being-mediocre-38428.md>)

Original publisher: [Read original article](<https://khmylov.com/2023/01/on-being-mediocre/>)

Author: Andrew Khmylov

Published: 2023-01-25T00:00:00Z

Content type: opinion

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [Learning](<https://devfeed.tech/topics/learning.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Advent of Code](<https://devfeed.tech/topics/advent-of-code.md>)

Tags: [advent-of-code](<https://devfeed.tech/tags/advent-of-code.md>), [learning](<https://devfeed.tech/tags/learning.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

An introspective essay about feeling mediocre despite sustained efforts across programming, music, machine learning, mathematics, and hardware projects. The author considers whether dissatisfaction comes from being stuck within a limited range of achievement.

### Source excerpt

I've never been special and I've always struggled to achieve. Whenever I pick up any programming challenge, it takes me too long to complete it, and then I see folks doing it much faster and/or better. I try solving Advent of Code every year, and then some task takes too much time and I start hating myself for not being smart enough. I dwell into music practice, learning theory and production, but still after a decade I don't play any instrument well enough, and don't have any decent completed records. I take practical courses on machine learning and still fail to apply it to real-world problems (building just another classifier doesn't count, it's real-world yes but not practical for my needs). I spent 5 years studying various high math disciplines but I fail to do even the basic pen-and-paper trigonometry or linear algebra now. I am not a master of any tool. My knowledge is spread wide, but I lack guru skills in any of them. Hell, my Raspberry Pi and the weather sensor have been lying around for several years now, and I can't build the automated data collector and a dashboard for them. I hoped I'd be something special in life, but I'm mediocre at best. Despite that, for some reason I'm okay. I've always been considered a top performer, got promoted fast at every place I worked (ok, welcome 2023). I don't get why, but people around me also seem to think I'm doing fine, even though there is nothing worse any prase from my point of view. I guess I just stick around doing basic things. I get obsessed easily, and then go into hyper-focus for a long time. I'm a trickster with a handful tiny literacy cheat under my belt. But where does that unnerving unsatisfactory feeling come from? Could it be that I'm stuck in some local maximum? Maybe I'm doing well enough in this local range, and yet I'm struggling because I must aim for a wider one? Let's fuck around and find out.

## Why Writing Still Matters in the Age of Generative AI

DevFeed: [Why Writing Still Matters in the Age of Generative AI](<https://devfeed.tech/articles/what-s-the-point-38427.md>)

Original publisher: [Read original article](<https://khmylov.com/2022/12/whats-the-point/>)

Author: Andrew Khmylov

Published: 2022-12-28T00:00:00Z

Content type: opinion

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [Generative AI](<https://devfeed.tech/topics/generative-ai.md>), [ChatGPT](<https://devfeed.tech/topics/chatgpt.md>), [RSS](<https://devfeed.tech/topics/rss.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [blog](<https://devfeed.tech/tags/blog.md>), [chatgpt](<https://devfeed.tech/tags/chatgpt.md>), [generative-ai](<https://devfeed.tech/tags/generative-ai.md>), [writing](<https://devfeed.tech/tags/writing.md>)

### AI overview

This personal essay considers whether blogging still has value amid social media, short attention spans, and generative AI. The author concludes that writing remains valuable for organizing thoughts, supporting well-being, managing anxiety, and reflecting on life and career.

### Source excerpt

It has occurred to me this week that I haven't written anything here for almost 2 years now. Why's that? Don't I have anything important to say anymore? Is blogging still a thing today? Back in 2010 and a few years afterwards having a blog was almost mandatory. Most of my friends and acquaintances with some online presence did that, everyone was fighting over the best blog platform, static generators were evolving like crazy, and then everything just fell off, perhaps with RSS tragedy, and the shift of content platforms into walled gardens of social media platforms. With major life-changing events happening around, political crisis, war, economic downturn, giving up on blogging is the easiest thing to do, as also noted by others. Besides, the average reader (myself included) has such a short attention span these days that expecting anyone to read a few paragraphs of your text is setting up yourself for disappointment. Finally, the recent advances in generative AI, like ChatGPT make you wonder "what's the point to write anything?" even more. We may already live in the world imagined in MGS2. High chance that the content you consume is auto-generated and you don't even notice. The machine would've generated this particular text much faster than me[1]. The value of any new human-made text is close to zero, and nobody will spend their time reading your stupid blog posts anymore[2]. That's all valid thoughts, but they are focused on the outside world. If I look inside my personal needs, I still find enormous value in writing. To me it's probably one of the most important well-being techniques. Taking memory dump notes and transferring the rushing half-formed and sometimes irrational thoughts from my head into a structured physical medium cleans up my polluted brain cache and helps me fight the anxiety. I've also been thinking about my career and previous life path in general recently, and I suspect that methodical and rigorous writing is one of the most significant reaso

## A no-code experiment shows the limits of trigger-based automation tools

DevFeed: [A no-code experiment shows the limits of trigger-based automation tools](<https://devfeed.tech/articles/no-code-38425.md>)

Original publisher: [Read original article](<https://khmylov.com/2020/05/nocode/>)

Author: Andrew Khmylov

Published: 2020-05-25T00:00:00Z

Content type: opinion

Language: ru

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [No-code](<https://devfeed.tech/topics/no-code.md>), [API](<https://devfeed.tech/topics/api.md>), [web applications](<https://devfeed.tech/topics/web-applications.md>), [HTTP](<https://devfeed.tech/topics/http.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [http](<https://devfeed.tech/tags/http.md>), [no-code](<https://devfeed.tech/tags/no-code.md>), [programming](<https://devfeed.tech/tags/programming.md>)

### AI overview

The author describes building a Telegram bot to send a daily calendar agenda and uses the experiment to argue that no-code automation tools can be too restrictive. IFTTT and Zapier limit users to predefined triggers and actions, while more flexible tools may still replace simple programming with constrained function builders.

### Source excerpt

Волны хайпа вокруг no-code выросли до невероятных масштабов, и недавняя отличная статья vas3k по этой теме заставила меня вновь направить туда вектор внимания. К тому же самые бросающиеся в глаза атрибуты no-code вроде визуального программирования и data-enhanced programming были где-то в зоне моих рабочих интересов последние пару лет. Нагло укравВдохновившись идеей, я решил создать себе бота, который бы каждое утро нежно встречал меня приветствием, списком дел на сегодня и интересными метриками. Такой персональный ассистент, но для бедных. Создать бота в телеграме и начать отправлять себе сообщения через HTTP API заняло 2 минуты, и это была самая лёгкая часть пути. Для MVF я поставил цель хотя бы присылать список событий из календаря на день. Потом добавить эмоджи -- и можно жить. Попробую на примере этого конкретного сценария рассказать, почему я не очень верю в no-code в том виде, в котором нам его сегодня продают. Сразу сделаю ремарку: дальше по тексту это всё не критика конкретных инструментов и и людей их создающих, а вопросы о подходах и концепциях. Проблемки Я уже был немного знаком с IFTTT и Zapier, так что решил начать эксперимент с них. Здесь мы сразу натыкаемся на одну из главных проблем no-code продуктов: ты ограничен триггерами и действиями, добавленными разработчиками тулов. Ни Zapier ни IFTTT не дают тебе возможности взять все события из календаря за день. Тут работает классика нашей индустрии: продакт оунеры подумали за тебя и решили что тебе это не нужно, пользователям наверное надо в основном реагировать на добавление событий в календарь. От упомянутого в статье integromat.io больше отдаёт духом "сделано программистами", и в данном контексте это хорошо. Тут уже есть нужный мне триггер "найди все события в календаре за период времени", отлично. К сожалению, дальше мы натыкаемся на вторую проблему no-code тулов: они пытаются всеми силами защитить пользователей от написания любого кода, даже там, где он уместен. А вместо этого предлагают накликивать н

## Why Many Business Applications Need Fewer High-Level Abstractions

DevFeed: [Why Many Business Applications Need Fewer High-Level Abstractions](<https://devfeed.tech/articles/abstract-enough-38423.md>)

Original publisher: [Read original article](<https://khmylov.com/2015/10/abstract-enough/>)

Author: Andrew Khmylov

Published: 2015-10-06T00:00:00Z

Content type: opinion

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [Code](<https://devfeed.tech/topics/code.md>), [Automation](<https://devfeed.tech/topics/automation.md>), [business logic](<https://devfeed.tech/topics/business-logic.md>), [CRUD](<https://devfeed.tech/topics/crud.md>), [Development](<https://devfeed.tech/topics/development.md>), [Software](<https://devfeed.tech/topics/software.md>), [Database](<https://devfeed.tech/topics/database.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [Category Theory](<https://devfeed.tech/topics/category-theory.md>)

Tags: [architecture](<https://devfeed.tech/tags/architecture.md>), [automation](<https://devfeed.tech/tags/automation.md>), [business-logic](<https://devfeed.tech/tags/business-logic.md>), [category-theory](<https://devfeed.tech/tags/category-theory.md>), [code](<https://devfeed.tech/tags/code.md>), [crud](<https://devfeed.tech/tags/crud.md>), [data](<https://devfeed.tech/tags/data.md>), [development](<https://devfeed.tech/tags/development.md>), [functional](<https://devfeed.tech/tags/functional.md>)

### AI overview

The article argues that many IT products are primarily business automation systems built around stateful data manipulation. It suggests that developers should focus on resource constraints, maintainability, and correctness instead of adding unnecessary high-level abstractions.

### Source excerpt

Programmers tend to think there is something special about them. However, a vast amount of IT jobs out there is mostly about business automation and solving auxiliary tasks, with client software being just a tool to help specialists do their real-world jobs--track the state of component research and development, automate status reporting, control the operating hardware mechanism. The so called "business logic" of your product is probably just a bloated mess on top of the huge state machine. If you ever put some "entities" in the database, then you are probably building a state machine, with the only varying parameter being its size and the number of moving parts. But it seems that building "state machine"-ish entity manipulation applications (CRUD, anyone?) is kind of an already researched area with a long history. Of course every product is different, but what I'm trying to say here is that there is a high chance that you actually don't need that many concepts and high-level abstractions to make your product happen. What's more likely is that you will face three types of challenges: How can I make my data manipulation fit into the resource constraints, like time, storage, memory, latency, etc.? How can I make the product to be easy to change and adapt to the new requirements? I'd say that the task of ensuring that newcomers can easily grab the project's source code base and get familiar with it falls in this category as well, because if the code and architecture is easy to grasp, then there is a high chance that it will be easy to modify as well. How can I achieve the highest possible correctness? I want the product to be stable and have no errors whatsoever. The first point (resource constraints) doesn't favor the high abstractions that much. Another level of indirection is probably going to add up some overhead on top of your existing resource consumption. The second one also doesn't play well. If your codebase is bursting with obscure category theory concepts or

## How we build Targetprocess

DevFeed: [How we build Targetprocess](<https://devfeed.tech/articles/how-we-build-targetprocess-38422.md>)

Original publisher: [Read original article](<https://khmylov.com/2015/06/how-we-build-targetprocess/>)

Author: Andrew Khmylov

Published: 2015-06-18T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [Web Development](<https://devfeed.tech/topics/web-development.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Single-page application (SPA)](<https://devfeed.tech/topics/spa.md>), [ASP.NET](<https://devfeed.tech/topics/aspnet.md>), [C#](<https://devfeed.tech/topics/csharp.md>), [Authentication](<https://devfeed.tech/topics/authentication.md>), [Authorization](<https://devfeed.tech/topics/authorization.md>), [Routing (disambiguation)](<https://devfeed.tech/topics/routing.md>), [Back end](<https://devfeed.tech/topics/backend.md>)

Tags: [asp-net](<https://devfeed.tech/tags/asp-net.md>), [authorization](<https://devfeed.tech/tags/authorization.md>), [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [client](<https://devfeed.tech/tags/client.md>), [frontend](<https://devfeed.tech/tags/frontend.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [routing](<https://devfeed.tech/tags/routing.md>)

### AI overview

A developer explains how Targetprocess is built as a large single-page web application, focusing on its JavaScript frontend, C# server APIs, and ASP.NET application startup. The article introduces authentication, authorization, routing, and ASPX-generated configuration.

### Source excerpt

Preface For the last 2 years my professional career have been diverging further and further away from the path it was set on early. I've started as a desktop application developer a long time ago, occasionally building web APIs on the server-side and doing some mobile app development, and then slowly getting into the frontend web development. Nowadays, working at Targetprocess, I think I'm spending roughly 70% of the time on the frontend (mostly general presentation logic and client-side business rules, not the crazy HTML markup/positioning/styling stuff) and 30% on server-side APIs. This is not a marketing post, but I'd like to give you some context on the things I'll be talking about. Targetprocess is an agile and visual project management tool [1], so you may expect it to be a fairly sophisticated on the visual interface side. Indeed, it's a massive single page web application written mostly in JavaScript on the client-side and C# on the server. At the same time, I see that some fellow developers still don't believe that it's possible to build anything beyond a simple product promotion website or a landing page with a toy language with JavaScript, which is only good for document animation. That's a common misconception I hear quite often from the friends doing mostly server-side and mobile things, and I'd like them (and any other reader) to see how the things look from my point of view. I also think that the details on how we build a large product may be interesting for anyone in the web development business. [2] With no further delay, let's dive right into the technical details! Application startup The entry point to the client app is a usual ASP.NET web application, which handles authentication, authorization and a top-level routing. Those things should be of no surprise for anyone familiar with building web applications with ASP.NET or any similar technology, so I won't go into details here. The authorized user is redirected to the main ASPX file. If you're no

## Setting Up a Bare-Bones JavaScript Web App with React, Webpack, and Scaffolding Tools

DevFeed: [Setting Up a Bare-Bones JavaScript Web App with React, Webpack, and Scaffolding Tools](<https://devfeed.tech/articles/how-to-set-up-a-modern-web-app-and-stay-sane-38420.md>)

Original publisher: [Read original article](<https://khmylov.com/2015/02/build-web-app-and-survive/>)

Author: Andrew Khmylov

Published: 2015-02-17T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [Web Development](<https://devfeed.tech/topics/web-development.md>), [React](<https://devfeed.tech/topics/react.md>), [Webpack](<https://devfeed.tech/topics/webpack.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Dependency management](<https://devfeed.tech/topics/dependency-management.md>), [Boilerplate](<https://devfeed.tech/topics/boilerplate.md>)

Tags: [boilerplate](<https://devfeed.tech/tags/boilerplate.md>), [dependency-management](<https://devfeed.tech/tags/dependency-management.md>), [guide](<https://devfeed.tech/tags/guide.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [react](<https://devfeed.tech/tags/react.md>)

### AI overview

A practical guide to setting up a bare-bones JavaScript web app on Windows. It discusses using React for interactive interfaces, module systems and dependency management, webpack for bundling code and assets, and scaffolding tools such as Yeoman.

### Source excerpt

Long story short, I had to create a modern web app. Actually, it was an HTML page prototype for our new feature. Basic layout and a fairly complex JavaScript to check our design and interaction ideas. I've been doing a lot of web development during the last 2 years, but it was mostly about extending the existing long-running project. The opportunity to learn how to set up a completely new solution sounded too tempting too miss it. Side note: I was going to write a rant-like blogpost initially. However, the final text turned out to be more like a guide than a bunch of complaints. So you actually may think about it as a from-zero-to-infinity guide to setting up a bare-bones JavaScript web app and its accompanying infrastructure on Windows. Baby steps I start with a simple index.html. Since it's going to be mostly about interactive interfaces, and I don't want to spend that much time thinking about boilerplate markup and event handling, I'm going to build it with React.js. Even though the codebase is not going to be that huge, I probably also want a proper module system. OK, we've been using Require.js for quite a long time now, so it looks like a reasonable choice. Just put a <script> with the reference to the main JS file into index.html. Obviously, I don't want to download the libraries manually, so I'm going to pick Bower for dependency management. Ask the colleague whether I'm doing everything right, just in case. Maybe there is a better way, you know.. Well, actually, it turns out that the cool guys use webpack these days. All right, let's check it out. Webpack is an advanced module bundling system which takes your code modules and assets and bundles them together with 3rd party libraries, transforming them on the way (for example, from one language to another) and packing for the optimal performance. Sounds good. But don't rush to nail the getting start guide--the cool guys don't do that nowadays. Why write any bootstrapping code at all when you can reuse the boi

## Are you ashamed of your API?

DevFeed: [Are you ashamed of your API?](<https://devfeed.tech/articles/are-you-ashamed-of-your-api-38419.md>)

Original publisher: [Read original article](<https://khmylov.com/2015/02/are-you-ashamed-of-your-api/>)

Author: Andrew Khmylov

Published: 2015-02-10T00:00:00Z

Content type: opinion

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [Development](<https://devfeed.tech/topics/development.md>), [modules](<https://devfeed.tech/topics/modules.md>), [legacy](<https://devfeed.tech/topics/legacy.md>)

Tags: [build](<https://devfeed.tech/tags/build.md>), [development](<https://devfeed.tech/tags/development.md>), [feature](<https://devfeed.tech/tags/feature.md>), [legacy](<https://devfeed.tech/tags/legacy.md>), [modules](<https://devfeed.tech/tags/modules.md>), [quality](<https://devfeed.tech/tags/quality.md>), [speed](<https://devfeed.tech/tags/speed.md>), [workflow](<https://devfeed.tech/tags/workflow.md>)

### AI overview

This opinion piece reflects on why developers may view their own software negatively after making tradeoffs involving delivery speed, quality, available resources, and legacy constraints. It argues that imperfect but sufficiently good solutions are not shameful, while suggesting that considering future regret can improve new development decisions.

### Source excerpt

I've been integrating some older modules of our codebase into a new one recently, which naturally involved finding the colleagues with the respective knowledge of those modules and asking them questions. It's a natural workflow in our imperfect world of leaky abstractions with the lack of true black-boxes, so there is nothing to get mad about. However, one particular thing did strike me on my journey for the knowledge and made me wonder. Most of the times my question "Hey, did you remember that %feature% thing?" was followed by the immediate "oh, damn, yeah, that thing definitely sucks" reaction. It was funny because I hadn't even mentioned any issues with that module (and I actually hadn't had any) but the reaction was clearly negative. Why do some developers have an automatic negative attitude towards the things they have built? Is it because they move towards the feature delivery speed instead of the quality sometimes? Is it because of the heart-breaking tradeoffs and the legacy they had to accommodate to during the development stage? The natural tradeoffs are nothing to be ashamed off. In the end of the day our primary goal is to create a good enough solution for a given problem considering resources available at the moment. There is nothing wrong with not being able to create the single ultimately perfect solution. However, keeping that "will you be ashamed of it in several months?" question in mind may be quite helpful the next time you build something new.

## Accept Imperfect Code and Use Code Review to Improve It

DevFeed: [Accept Imperfect Code and Use Code Review to Improve It](<https://devfeed.tech/articles/your-code-sucks-38418.md>)

Original publisher: [Read original article](<https://khmylov.com/2014/03/your-code-sucks/>)

Author: Andrew Khmylov

Published: 2014-03-17T00:00:00Z

Content type: opinion

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [Code](<https://devfeed.tech/topics/code.md>), [Code review](<https://devfeed.tech/topics/code-review.md>), [engineering-culture](<https://devfeed.tech/topics/engineering-culture.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [code-review](<https://devfeed.tech/tags/code-review.md>), [defects](<https://devfeed.tech/tags/defects.md>), [developers](<https://devfeed.tech/tags/developers.md>), [formatting](<https://devfeed.tech/tags/formatting.md>), [knowledge-sharing](<https://devfeed.tech/tags/knowledge-sharing.md>), [requirements](<https://devfeed.tech/tags/requirements.md>)

### AI overview

This opinion article argues that developers should accept that code is often imperfect without settling for poor quality or endlessly pursuing a perfect solution. It recommends code review to catch formatting, minor code issues, design pitfalls, and to share implementation knowledge.

### Source excerpt

So you are sitting at your desk wondering how come your beautifully- and carefully-thought abstractions have turned into an ugly monster, and why your precious codebase smells like a giant mess. You may be not the smartest guy around but you are not that stupid or unqualified after all. Well, just accept that your code sucks and stop worrying about it. Even the most brilliant programmers I know come up with the messy code or leaky abstractions sometimes. To fail is human. The business requirements come and go, the product evolves, you are growing as a professional. Don't be OK with it, just stop torturing yourself trying to find the 100% perfect solution. If it works for now and it looks easy enough to be changed later, then it's probably fine. On a side note, I would rather wonder why you are OK with any code at all. If you can't spot an issue here or there then you are probably just not skilled enough to see the defects. I'm not talking about some 'forget the code, WE ARE SHIPPING THE PRODUCT HERE, BEATCH!' management bullshit. The beautiful code and design is what makes your product easy to maintain and improve in the long run. The more skilled and experienced you become, the more likely you are to fall into "disappointed in everything" mental trap. Try to think about it rationally - you've been around for quite some time, you've built some great stuff, your projects haven't fallen apart due to awful technical decisions. And though your code sucks from your point of view, perhaps it's not that bad on the absolute scale of code awesomeness. What can we do make it less painful? Code review really helps a lot. Some developers complain about code review not being effective enough, i.e. it only helps you find the most basic formatting and code issues. I was a bit skeptical myself not so long time ago, but even if it helps to fix the formatting and minor code issues, than it's a great improvement! I would say it's a matter of trying and figuring out for yourself. From

## On flat design

DevFeed: [On flat design](<https://devfeed.tech/articles/on-flat-design-38417.md>)

Original publisher: [Read original article](<https://khmylov.com/2013/11/on-flat-design/>)

Author: Andrew Khmylov

Published: 2013-11-05T00:00:00Z

Content type: opinion

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [web design](<https://devfeed.tech/topics/web-design.md>), [User experience (UX)](<https://devfeed.tech/topics/ux.md>), [Mobile](<https://devfeed.tech/topics/mobile.md>), [Windows](<https://devfeed.tech/topics/windows.md>), [iphone](<https://devfeed.tech/topics/iphone.md>)

Tags: [apple](<https://devfeed.tech/tags/apple.md>), [article](<https://devfeed.tech/tags/article.md>), [design](<https://devfeed.tech/tags/design.md>), [flat](<https://devfeed.tech/tags/flat.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [web](<https://devfeed.tech/tags/web.md>), [web-design](<https://devfeed.tech/tags/web-design.md>)

### AI overview

An opinion article argues that flat design is a set of design principles rather than a fixed visual implementation. It distinguishes those principles from how products such as Windows 8, Windows Phone, and iOS 7 applied them, and emphasizes preserving creativity and usability instead of copying platform patterns blindly.

### Source excerpt

The flat is the new black. You've probably noticed that the flat is the most trendy thing in the mobile and web design topic these days (however, the true hipster may tell you that it's too mainstream, so he has moved to something drastically new). Pushing the content, promoting the simple visual choices and borrowing the inspiration from the good old Swiss design may sound so easy for a casual reader who doesn't think too much about it. The most striking example is what the people often say about Microsoft design experiments, namely Windows Phone and Windows 8. I've heard these "just remove gradients, shadows, and the rounded boarders, add some tiles - and you are good to go" ramblings so many times. Sometimes it makes me sad that the users confuse an abstract idea (design principles) with its specific implementation (design patterns, solutions or even controls). Apple has pushed it even further with iOS7. Well, not actually Apple but the journalists, writers and users. They've built a simple mental model, associating the word "flat" with the recent Microsoft and Apple products, effectively destroying the original principles standing behind the flat design. This random article which popped up in my feed recently is a nice example - the author tells you that flat design may not be that great, because some basic principles are poorly implemented in iOS7 and Windows 8. Well, that's the problem with these specific products, it doesn't mean the flat design is flawed in general! Some Pinterest boards on mobile and web design are the good examples of how great the flat may work and how easy it is to fail with unwise solutions trying to mimic it. On the side note - try to find any devices out there besides iPhone. Damn that marketing. Microsoft community has recently realized that blindly following the platform guidelines gets in the way of the creativity. They have declared the guidelines as some basic patterns to get you up and running, so that you can quickly build the

## Windows 8 - How to automatically save screenshots to Dropbox

DevFeed: [Windows 8 - How to automatically save screenshots to Dropbox](<https://devfeed.tech/articles/windows-8-how-to-automatically-save-screenshots-to-dropbox-38416.md>)

Original publisher: [Read original article](<https://khmylov.com/2012/10/automatic-screenshots-with-windows-8-and-dropbox/>)

Author: Andrew Khmylov

Published: 2012-10-19T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [Windows](<https://devfeed.tech/topics/windows.md>), [dropbox](<https://devfeed.tech/topics/dropbox.md>), [save](<https://devfeed.tech/topics/save.md>), [Image](<https://devfeed.tech/topics/image.md>), [screen](<https://devfeed.tech/topics/screen.md>)

Tags: [automatically](<https://devfeed.tech/tags/automatically.md>), [dropbox](<https://devfeed.tech/tags/dropbox.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [save](<https://devfeed.tech/tags/save.md>), [screenshots](<https://devfeed.tech/tags/screenshots.md>), [windows](<https://devfeed.tech/tags/windows.md>)

### AI overview

A tutorial explains how Windows 8 can automatically save screenshots to a public Dropbox folder by changing the Screenshots folder location in the Windows registry and restarting the computer.

### Source excerpt

I have always been frustrated by sharing screenshots taken on my PC. Back to the old days, I had to follow the "Press the Prt Scr, open the image editor, press Ctrl+V, Ctrl+S, choose the save destination, open that directory, drag-n-drop the file to messenger/Word/whatever". Sharing was painful. Then there were tons of advanced screenshot capturing applications that I just couldn't get used to. Most of them were the typical shareware trying to install all sorts of toolbars and extensions. If you were a good boy who didn't want to bloat his system, you would probably keep away from such a piece of software. (Not trying to insult anyone here - I am pretty sure there were decent apps). Years later, Windows 7 introduced the 'Snipping tool' that I instantly felt in love with. It was integrated, fast and much easier to use than anything I've tried before. The only thing still itching me was sharing the screenshots. I've been actively using Dropbox, and its sharing features, especially 'Public folder' allowed me to quickly save a screenshot, grab a link and send it to someone. Not bad, but not perfect yet. Recently I've found out that Windows 8 gives you even better screen capture facilities. Pressing Win+PrtScr automatically takes a screenshot (you will see the screen dim for a second) and saves it to Screenshots inside your personal Pictures directory. What if I could save it directly to public Dropbox folder? That would be super-awesome! Hit a keystroke, locate the file in the folder (you don't even have to open Explorer manually - just right-click the Dropbox icon in system tray, and open the 'Recently changed files' menu), right-click it and copy the public link. Unfortunatelly, you won't find an option to change the default screenshots folder. But registry editor is your life saver when it comes to tweaking Windows. So open up the regedit.exe and go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions{b7bede81-df94-4682-a7d8-57a

## Silverlight Unit Testing NuGet package

DevFeed: [Silverlight Unit Testing NuGet package](<https://devfeed.tech/articles/silverlight-unit-testing-nuget-package-38415.md>)

Original publisher: [Read original article](<https://khmylov.com/2012/06/silverlight-unit-testing-nuget-package/>)

Author: Andrew Khmylov

Published: 2012-06-26T00:00:00Z

Content type: release

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [NuGet](<https://devfeed.tech/topics/nuget.md>), [Unit testing](<https://devfeed.tech/topics/unit-testing.md>), [Package manager](<https://devfeed.tech/topics/package-manager.md>)

Tags: [binaries](<https://devfeed.tech/tags/binaries.md>), [bloat](<https://devfeed.tech/tags/bloat.md>), [manager](<https://devfeed.tech/tags/manager.md>), [microsoft](<https://devfeed.tech/tags/microsoft.md>), [nuget](<https://devfeed.tech/tags/nuget.md>), [nuget-package](<https://devfeed.tech/tags/nuget-package.md>), [packages](<https://devfeed.tech/tags/packages.md>), [testing](<https://devfeed.tech/tags/testing.md>), [unit-testing](<https://devfeed.tech/tags/unit-testing.md>)

### AI overview

The Silverlight Toolkit Unit Testing Framework is now available as the SilverlightToolkit-Testing NuGet package. Installing it adds the required testing assembly references without requiring the full toolkit or adding unnecessary binaries to version control.

### Source excerpt

Silverlight Toolkit has several NuGet packages (Core, Input, Theming, etc.). Unfortunately, Unit Testing Framework, which comes as a part of downloadable toolkit version, was not available for the fellow NuGet users. Until now. You can easily install it by typing 'Install-Package SilverlightToolkit-Testing' in the Package Manager console. Details here. The package just adds references to Microsoft.Silverlight.Testing.dll and Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll assemblies, so that you don't have to install toolkit or bloat your VCS with unnecessary binaries.

## Async sequential workflows

DevFeed: [Async sequential workflows](<https://devfeed.tech/articles/async-sequential-workflows-38412.md>)

Original publisher: [Read original article](<https://khmylov.com/2012/04/async-sequential-workflows/>)

Author: Andrew Khmylov

Published: 2012-04-26T00:00:00Z

Content type: tutorial

Language: ru

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [async](<https://devfeed.tech/topics/async.md>), [async/await](<https://devfeed.tech/topics/async-await.md>), [client](<https://devfeed.tech/topics/client.md>), [.NET](<https://devfeed.tech/topics/net.md>)

Tags: [async](<https://devfeed.tech/tags/async.md>), [await](<https://devfeed.tech/tags/await.md>), [client](<https://devfeed.tech/tags/client.md>), [concurrent](<https://devfeed.tech/tags/concurrent.md>), [foreach](<https://devfeed.tech/tags/foreach.md>), [observable](<https://devfeed.tech/tags/observable.md>), [request](<https://devfeed.tech/tags/request.md>), [yield](<https://devfeed.tech/tags/yield.md>)

### AI overview

This tutorial compares synchronous and asynchronous implementations of sequential workflows for downloading files with .NET WebClient. It explains how sequential requests can be represented with observables and how async/await can reduce the work needed to describe the control flow.

### Source excerpt

В последнее время всё чаще приходится сталкиваться с задачами, требующими выполнения последовательных асинхронных операций. Примером может служить загрузка файлов на мобильном устройстве. Учитывая что телефон может работать на слабом мобильном соединении, нам вряд ли удастся получить прирост производительности от параллельной загрузки. Да и стандартный класс WebClient, представленный в BCL не очень дружит с concurrent operations (точнее вообще не дружит). Создавать новый экземпляр на каждый запрос кажется идейно неправильным, так что попробуем обойтись одним веб-клиентом, обрабатывающим множество последовательных запросов. Для начала - тривиальная синхронная реализация (которая конечно же не будет работать на WP7 из-за отсутствия синхронных методов у WebClient'а): public IEnumerable<string> Handle(IEnumerable<Uri> requests) { var client = new WebClient(); foreach (var request in requests) { yield return client.DownloadString(request); } } Разработчику, использующему асинхронную версии, скорее всего захочется узнать о моменте завершении загрузок. Не будем плохими мальчиками/девочками и отбросим мысли о EAP и ручном CPS. Довольно очевидным решением будет представить наши ожидающие загрузки файлы в виде потока событий при помощи observables. К сожалению, WebClient использует EAP для своих асинхронных операций, поэтому код становится чуть более неопрятным: public IObservable<string> HandleAsync(IList<Uri> requests) { var client = new WebClient(); var subject = new Subject<string>(); var enumerator = requests.GetEnumerator(); Action takeNext = () => { if (enumerator.MoveNext()) { client.DownloadStringAsync(enumerator.Current); } else { subject.OnCompleted(); } }; client.DownloadStringCompleted += (s, e) => { if (e.Error != null) { subject.OnError(e.Error); } else { subject.OnNext(e.Result); takeNext(); } }; takeNext(); return subject; } В обоих случаях мы по сути описываем корутины, передающие управление в момент окончания обработки запроса. В синхронной реализации компи

## How to generate error log from nested exceptions.

DevFeed: [How to generate error log from nested exceptions.](<https://devfeed.tech/articles/how-to-generate-error-log-from-nested-exceptions-38414.md>)

Original publisher: [Read original article](<https://khmylov.com/2012/04/how-to-generate-error-log-from-nested-exceptions/>)

Author: Andrew Khmylov

Published: 2012-04-24T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [Exception](<https://devfeed.tech/topics/exception.md>), [exceptions](<https://devfeed.tech/topics/exceptions.md>), [Code](<https://devfeed.tech/topics/code.md>), [Logging](<https://devfeed.tech/topics/logging.md>), [console](<https://devfeed.tech/topics/console.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [error](<https://devfeed.tech/tags/error.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [gist](<https://devfeed.tech/tags/gist.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [logging](<https://devfeed.tech/tags/logging.md>), [simple](<https://devfeed.tech/tags/simple.md>)

### AI overview

This code-focused tutorial demonstrates how to generate readable error logs from nested exceptions in C#. It recursively traverses inner exceptions and handles AggregateException by flattening its InnerExceptions collection.

### Source excerpt

Working on error logging for my new application I've realized that I always use the same pattern when it comes to converting actual exceptions into a text form. And since I started posting rare code snippets that I write down all the time on Gist recently, there will be a number of 'sharing code' blog posts in the foreseeable future. The code is rather simple, it traverses down the entire nested exception hierarchy and populates StringBuilder with the appropriate error information. There is a slightly different workflow for AggregateException - we want to flatten its InnerExceptions collection. public string GetExceptionLog(Exception exception) { return UnwrapExceptionTextLoop(new StringBuilder(), 0, exception); } private string UnwrapExceptionTextLoop(StringBuilder sb, int level, Exception e) { if (e == null) { return sb.ToString(); } for (int i = 0; i < level; i++) { sb.Append(">>"); } var aggregate = e as AggregateException; sb.AppendFormat("{0} - {1} [{2}] {3}", e.GetType(), aggregate == null ? e.Message : String.Empty, e.StackTrace, Environment.NewLine); if (aggregate != null) { return String.Join(Environment.NewLine, aggregate.InnerExceptions.Select(inner => UnwrapExceptionTextLoop(sb, level + 1, inner))); } return UnwrapExceptionTextLoop(sb, level + 1, e.InnerException); } Let's put on a simple method that throws several exceptions: public void TestMethod() { try { try { throw new Exception("Inner exception"); } catch (Exception ex) { throw new Exception("Outer exception"); } } catch (Exception ex) { Console.WriteLine(ErrorHelper.GetExceptionLog(ex)); } } And here is the result (I've omitted the large stack trace information): System.Exception - Outer exception [ at Client.App.TestMethod()..] >>System.Exception - Inner exception [ at Client.App.TestMethod()..]

## How to extract version number for your WP7 app from assembly information

DevFeed: [How to extract version number for your WP7 app from assembly information](<https://devfeed.tech/articles/how-to-extract-version-number-for-your-wp7-app-from-assembly-information-38413.md>)

Original publisher: [Read original article](<https://khmylov.com/2012/04/how-to-extract-version-number-for-your-wp7-app-from-assembly-information/>)

Published: 2012-04-23T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [App](<https://devfeed.tech/topics/app.md>), [Assembly](<https://devfeed.tech/topics/assembly.md>)

Tags: [app](<https://devfeed.tech/tags/app.md>), [assembly](<https://devfeed.tech/tags/assembly.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [snippet](<https://devfeed.tech/tags/snippet.md>), [version](<https://devfeed.tech/tags/version.md>)

### AI overview

A short tutorial presents a C# snippet that extracts the first three components of a WP7 app's version number from assembly information.

### Source excerpt

Pretty straightforward, but just in case.. Here is the snippet: public string GetAppVersion() { var assembly = Assembly.GetExecutingAssembly(); var name = assembly.FullName; var nameComponents = name.Split(','); if (nameComponents.Length >= 2) { var versionComponent = nameComponents[1]; var keyAndValue = versionComponent.Split('='); if (keyAndValue.Length == 2) { var value = keyAndValue[1]; var versionBits = value.Split('.'); if (versionBits.Length >= 3) { return String.Format("{0}.{1}.{2}", versionBits[0], versionBits[1], versionBits[2]); } } } return String.Empty; }

## Task Commands revisited

DevFeed: [Task Commands revisited](<https://devfeed.tech/articles/task-commands-revisited-38411.md>)

Original publisher: [Read original article](<https://khmylov.com/2012/02/task-commands-revisited/>)

Author: Andrew Khmylov

Published: 2012-02-23T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [MVVM](<https://devfeed.tech/topics/mvvm.md>), [async](<https://devfeed.tech/topics/async.md>), [Code](<https://devfeed.tech/topics/code.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [test](<https://devfeed.tech/topics/test.md>), [WPF](<https://devfeed.tech/topics/wpf.md>)

Tags: [async](<https://devfeed.tech/tags/async.md>), [bitbucket](<https://devfeed.tech/tags/bitbucket.md>), [code](<https://devfeed.tech/tags/code.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [mvvm](<https://devfeed.tech/tags/mvvm.md>), [test](<https://devfeed.tech/tags/test.md>), [zip](<https://devfeed.tech/tags/zip.md>)

### AI overview

The article revisits an earlier TPL and MVVM command implementation, replacing its event-based asynchronous completion notification with an ExecuteAsync method that returns a Task. It presents an updated generic AsyncRelayCommand and explains its inner command, asynchronous execution, explicit ICommand.Execute implementation, and CanExecute handling.

### Source excerpt

Half a year ago I blogged about using TPL with MVVM in a test-friendly way. My solution turned out to be pretty handy, though it was far from being perfect. In this post I will describe what was wrong with the initial implementation and can we slightly improve it. Looking at that solution right now, I wonder why did I decide to use event async pattern (providing the ExecuteCompleted event) in the first place. The intention was to notify the caller about completion of the asynchronous operation. That is what System.Threading.Task is used for this days, isn't it? So the obvious solution is to expose the ExecuteAsync() method returning the Task instance on the command class. Here is the source of the updated AsyncRelayCommand: public class AsyncRelayCommand<T> : ICommand { private readonly RelayCommand<T> _internalCommand; private readonly Func<T, Task> _executeMethod; public event EventHandler CanExecuteChanged { add { _internalCommand.CanExecuteChanged += value; } remove { _internalCommand.CanExecuteChanged -= value; } } public AsyncRelayCommand(Func<T, Task> executeMethod, Predicate<T> canExecuteMethod) { if (executeMethod == null) { throw new ArgumentNullException("executeMethod"); } _executeMethod = executeMethod; _internalCommand = new RelayCommand<T>(_ => { }, canExecuteMethod); } public AsyncRelayCommand(Func<T, Task> executeMethod) : this(executeMethod, _ => true) { } void ICommand.Execute(object parameter) { if (parameter is T) { ExecuteAsync((T)parameter); } else throw new ArgumentException("Parameter should be of type " + typeof(T)); } public Task ExecuteAsync(T parameter) { return _executeMethod(parameter); } public bool CanExecute(object parameter) { return _internalCommand.CanExecute((T)parameter); } public void RaiseCanExecuteChanged() { _internalCommand.RaiseCanExecuteChanged(); } } The code is pretty straightforward, here are the key points: Create an inner command that responds to CanExecute, RaiseCanExecute calls and handles subscriptions to CanExec

## Saving your time: how to work with large reference databases on WP7

DevFeed: [Saving your time: how to work with large reference databases on WP7](<https://devfeed.tech/articles/saving-your-time-how-to-work-with-large-reference-databases-on-wp7-38410.md>)

Original publisher: [Read original article](<https://khmylov.com/2011/11/saving-your-time-how-to-work-with-large/>)

Author: Andrew Khmylov

Published: 2011-11-16T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [Development](<https://devfeed.tech/topics/development.md>), [Batch file](<https://devfeed.tech/topics/batch-file.md>), [Script](<https://devfeed.tech/topics/script.md>), [debugging](<https://devfeed.tech/topics/debugging.md>), [configuration](<https://devfeed.tech/topics/configuration.md>), [Visual Studio](<https://devfeed.tech/topics/visual-studio.md>)

Tags: [batch](<https://devfeed.tech/tags/batch.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [databases](<https://devfeed.tech/tags/databases.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [development](<https://devfeed.tech/tags/development.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [saving](<https://devfeed.tech/tags/saving.md>), [script](<https://devfeed.tech/tags/script.md>), [sql-server](<https://devfeed.tech/tags/sql-server.md>)

### AI overview

This tutorial explains how to speed up development deployments of a large read-only SQL Server CE reference database on Windows Phone 7. It compares isolated storage with packaging the database in the XAP file, then presents a batch-script approach for uploading the database to an emulator and configuring different debug and release behaviors.

### Source excerpt

In the previous post I showed how to load the large SQL Server CE database on WP7. However, if you are working with a read-only reference database, deploying it to the phone or emulator may take up to several minutes. In this post I will try to explain how to save your nerves and time, making the regular development and debugging easier. So for now, there are 2 options for deploying the database with your app: Use Isolated Storage. Upload the database to the device with the help of ISETool. For ~50 mb database it takes 4 minutes on my laptop. Pack it as the application content (setting Build Action to Content). In that case, the database is packed into the XAP file on your machine and then unpacked back on the device. While this approach is a bit faster then the first one, it still takes something about 1 minute to deploy your app, which I find unacceptable. Note that the 1st option should be used only for Debug configurations. The only way to include the reference database when delivering the app to the users is by packing it into the XAP (you may, however, copy it to Isolated Storage upon the first launch, but I don't see any sense why should you do so). So I can't fasten the packaging process, but I can upload my database to the Isolated Storage once and it will be preserved between the application deploys when debugging. When I need to release the application build, I will include the database to XAP file content. Sounds easy. Being lazy motivates me to script the uploading routine. Here is a batch file that takes the IS snapshot with ISETool, adds the database file and restores the snapshot on the emulator: set isePath="C:Program Files (x86)Microsoft SDKsWindows Phonev7.1ToolsIsolatedStorageExplorerToolISETool.exe" set tempPath="C:TempDatabaseIS" set dbPath="your_db_path" set appId=your_app_id %isePath% ts de %appId% %tempPath% copy %dbPath% %tempPath% %isePath% rs de %appId% %tempPath% In the snippet above you need to replace your_db_path with the path to your

## Loading large SQL Server CE databases on WP7

DevFeed: [Loading large SQL Server CE databases on WP7](<https://devfeed.tech/articles/loading-large-sql-server-ce-databases-on-wp7-38409.md>)

Original publisher: [Read original article](<https://khmylov.com/2011/11/loading-large-sql-server-ce-databases/>)

Author: Andrew Khmylov

Published: 2011-11-15T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [sql-server](<https://devfeed.tech/topics/sql-server.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [App](<https://devfeed.tech/topics/app.md>)

Tags: [app](<https://devfeed.tech/tags/app.md>), [data](<https://devfeed.tech/tags/data.md>), [databases](<https://devfeed.tech/tags/databases.md>), [file](<https://devfeed.tech/tags/file.md>), [init](<https://devfeed.tech/tags/init.md>), [issue](<https://devfeed.tech/tags/issue.md>), [loading](<https://devfeed.tech/tags/loading.md>), [parameter](<https://devfeed.tech/tags/parameter.md>), [query](<https://devfeed.tech/tags/query.md>), [sql-server](<https://devfeed.tech/tags/sql-server.md>)

### AI overview

This article explains how to load a large SQL Server Compact database from isolated storage in a Windows Phone 7 application. It describes the maximum database size error and shows how to add Max Database Size to the connection string.

### Source excerpt

Recently I ran into an issue when trying to load the large database (approx. 50 mb) from isolated storage on WP7. Whenever I tried to query the Data Context, I got the following SqlCeException: The database file is larger than the configured maximum database size. This setting takes effect on the first concurrent database connection only. [ Required Max Database Size (in MB; 0 if unknown) = 0 ] After some searching over the web, I found this blog post covering some details of that parameter. The general work-around is adding 'Max Database Size' value (in megabytes) to the connection string, so it looks like: var connectionString = "Data Source='isostore:DB.sdf'; Max Database Size = 60"; Now your app should be able to init the data context.

## Building Animated Tiles with Rx

DevFeed: [Building Animated Tiles with Rx](<https://devfeed.tech/articles/building-cool-animated-tiles-with-rx-38408.md>)

Original publisher: [Read original article](<https://khmylov.com/2011/11/building-cool-animated-tiles-with-rx/>)

Author: Andrew Khmylov

Published: 2011-11-15T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [Code](<https://devfeed.tech/topics/code.md>), [markup](<https://devfeed.tech/topics/markup.md>), [ui](<https://devfeed.tech/topics/ui.md>), [App](<https://devfeed.tech/topics/app.md>), [procedural flowers](<https://devfeed.tech/topics/procedural-flowers.md>)

Tags: [animation](<https://devfeed.tech/tags/animation.md>), [app](<https://devfeed.tech/tags/app.md>), [code](<https://devfeed.tech/tags/code.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [math](<https://devfeed.tech/tags/math.md>), [xaml](<https://devfeed.tech/tags/xaml.md>)

### AI overview

This tutorial explains how to build animated tiles for a Windows Phone 7 project using XAML, a TileControl, and a storyboard. It also shows how an observable sequence creates tiles at intervals and how DispatcherObservable.ObserveOnDispatcher schedules collection updates on the runtime dispatcher.

### Source excerpt

I have a small WP7 project called Summarize. It is a fun math-based game (check it out for free). It has a nice effect of loading tiles. Several people has asked me how I have done it, so in this post I will cover how to build something similar on your own. Let's start with building the UI. We have the toolkit's WrapPanel inside the ItemsControl and a simple TileControl with TextBlock displaying the tile number. TileControl.xaml markup: <UserControl x:Name="UserControl" x:Class="AnimatedTilesSample.TileControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" Loaded="OnLoaded" Width="76" Height="76"> <UserControl.Projection> <PlaneProjection RotationY="-180" /> </UserControl.Projection> <UserControl.Resources> <Storyboard x:Key="LoadedStoryboard"> <DoubleAnimation Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="UserControl" To="0" Duration="0:0:0.2" /> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="UIElement.Visibility" Storyboard.TargetName="Text"> <DiscreteObjectKeyFrame KeyTime="0:0:0.1"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}"> <TextBlock x:Name="Text" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed" Style="{StaticResource PhoneTextTitle2Style}" Text="{Binding ., Mode=OneTime}" /> </Grid> </UserControl> In the code-behind we start the animation when the tile is loaded: private void OnLoaded(object sender, RoutedEventArgs e) { var sb = Resources["LoadedStoryboard"] as Storyboard; if (sb != null) { sb.Begin(); } } MainPage.xaml m

## MVVM + TPL + Unit tests

DevFeed: [MVVM + TPL + Unit tests](<https://devfeed.tech/articles/mvvm-tpl-unit-tests-38407.md>)

Original publisher: [Read original article](<https://khmylov.com/2011/09/mvvm-tpl-unit-tests/>)

Author: Andrew Khmylov

Published: 2011-09-27T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [MVVM](<https://devfeed.tech/topics/mvvm.md>), [unit tests](<https://devfeed.tech/topics/unit-tests.md>), [async](<https://devfeed.tech/topics/async.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>), [Web](<https://devfeed.tech/topics/web.md>), [WPF](<https://devfeed.tech/topics/wpf.md>)

Tags: [async](<https://devfeed.tech/tags/async.md>), [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [callback](<https://devfeed.tech/tags/callback.md>), [mvvm](<https://devfeed.tech/tags/mvvm.md>), [tdd](<https://devfeed.tech/tags/tdd.md>), [testing](<https://devfeed.tech/tags/testing.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>)

### AI overview

The article discusses testing MVVM view-model commands that use the Task Parallel Library for asynchronous operations. It critiques static task creation for making dependencies difficult to mock and presents an ICommand wrapper that signals completion, allowing tests to synchronize with the asynchronous task.

### Source excerpt

UPD: This implementation didn't work as well as expected, please read the follow-up article. Recently I've faced an issue with writing unit tests for view model commands that use Task Parallel Library for asynchronous operations. Searching over the web was not really helpful, so I spent some time designing the approach to handle such cases. The most common way to start tasks with TPL is by using one of the static Task.Factory.StartNew(...) methods. If you are mockist TDD guy, this should already raise an alert in your head. Static members are not test-friendly and do not allow you to inject mock dependencies into your module. One may say that using tasks is just an implementation details and should not be concerned when testing the behavior. I would agree if we were speaking about a regular async method that allows you to perform some action when its execution completes (in a form of callback or event, doesn't really matter). That simply doesn't work for me because the asynchrony is used inside the command handler, so there is no way to specify the continuation outside of the view model. My first (and probably the bad one) idea was to create a service for running the tasks. Then it would be easy to mock it and run tasks synchronously. Hopefully, I rejected this solution - creating another dependency just didn't sound right. I decided to create a special ICommand implementation instead that would notify me when the execution completes. This should do the trick because you can always use the thread sync primitives in the test environment to wait on the asynchronous task. For simplicity's sake I just created the wrapper around RelayCommand from MVVM Light Toolkit (you could use your favorite library or implement the command from scratch yourself). public class AsyncDelegateCommand: ICommand { private readonly RelayCommand _innerCommand; public event EventHandler ExecuteCompleted; public event EventHandler CanExecuteChanged { add { _innerCommand.CanExecuteChanged += value

## Tip for 1-click indentation settings changes in Visual Studio

DevFeed: [Tip for 1-click indentation settings changes in Visual Studio](<https://devfeed.tech/articles/tip-for-1-click-indentation-settings-changes-in-visual-studio-38406.md>)

Original publisher: [Read original article](<https://khmylov.com/2011/02/tip-for-1-click-indentation-settings-changes-in-visual-studio/>)

Author: Andrew Khmylov

Published: 2011-02-27T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [Visual Studio](<https://devfeed.tech/topics/visual-studio.md>), [code style](<https://devfeed.tech/topics/code-style.md>), [Automation](<https://devfeed.tech/topics/automation.md>), [ide](<https://devfeed.tech/topics/ide.md>), [C#](<https://devfeed.tech/topics/csharp.md>)

Tags: [automation](<https://devfeed.tech/tags/automation.md>), [change](<https://devfeed.tech/tags/change.md>), [code](<https://devfeed.tech/tags/code.md>), [code-style](<https://devfeed.tech/tags/code-style.md>), [csharp](<https://devfeed.tech/tags/csharp.md>), [ide](<https://devfeed.tech/tags/ide.md>), [macros](<https://devfeed.tech/tags/macros.md>), [spaces](<https://devfeed.tech/tags/spaces.md>), [style](<https://devfeed.tech/tags/style.md>), [visual-studio](<https://devfeed.tech/tags/visual-studio.md>)

### AI overview

A tutorial explains how to create a Visual Studio macro that toggles the C# indentation setting between tabs and spaces. It uses the DTE TextEditor CSharp InsertTabs property and provides keyboard-accessible macro commands.

### Source excerpt

I work at several projects at a time, and I have different settings/requirements concerning the code style for each of them. The main issue is 'Tabs vs. Spaces' option - the first project requires using tabs, the second - spaces. It's obvious that going Tools -> Settings -> ... is not an option for everyday use. Sounds like a good task for the automation macros, right? Navigate to Tools -> Macros -> Macros IDE (or use Alt+F11) Create new macros in Project Explorer (Project - Add Module) Write a method that changes the indentation settings: Public Module TabsModule Public Sub ToggleTabs() Dim currentSetting As Boolean = DTE.Properties("TextEditor", "CSharp").Item("InsertTabs").Value DTE.Properties("TextEditor", "CSharp").Item("InsertTabs").Value = Not currentSetting End Sub End Module Now you can use Macros Explorer (Alt+F8, also you can dock it as one of your panels) to quickly change settings (by double-clicking on the corresponding item name in the macros tree)

## Building advanced MVVM commands, Part 1

DevFeed: [Building advanced MVVM commands, Part 1](<https://devfeed.tech/articles/building-advanced-mvvm-commands-part-1-38403.md>)

Original publisher: [Read original article](<https://khmylov.com/2010/11/building-advanced-mvvm-commands-part-1/>)

Author: Andrew Khmylov

Published: 2010-11-24T00:00:00Z

Content type: tutorial

Language: en

Sources: [Despite the odds](<https://devfeed.tech/sources/despite-the-odds.md>)

Topics: [MVVM](<https://devfeed.tech/topics/mvvm.md>), [WPF](<https://devfeed.tech/topics/wpf.md>), [async](<https://devfeed.tech/topics/async.md>), [cancellation](<https://devfeed.tech/topics/cancellation.md>), [Exception](<https://devfeed.tech/topics/exception.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [applications](<https://devfeed.tech/tags/applications.md>), [async](<https://devfeed.tech/tags/async.md>), [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [cancellation](<https://devfeed.tech/tags/cancellation.md>), [exception-handling](<https://devfeed.tech/tags/exception-handling.md>), [mvvm](<https://devfeed.tech/tags/mvvm.md>), [thread](<https://devfeed.tech/tags/thread.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

This tutorial presents an advanced DelegateCommand implementation for WPF and Silverlight applications using the MVVM pattern. It covers asynchronous execution, command states, cancellation, progress tracking, exception handling, UI updates through Dispatcher, and helper support for property-change notifications.

### Source excerpt

If you follow the MVVM pattern while developing your WPF/Silverlight applications, then you are probably familiar with DelegateCommand (or RelayCommand, as it is called sometimes) model. In brief: it is an implementation of WPF/Silverlight ICommand that allows you to specify what the command should do by passing some delegate that performs execution logic (instead of using CommandBindings). Pretty simple, but powerful pattern. Dealing with MVVM a lot, I've build my own implementation of this pattern that lets you simplify its usage. Here are some common features, that you have to handle on your own by using classic DelegateCommand: Support for asynchronous execution (usually solved by generating additional code in ViewModel that handles async calls and free/busy indicator). Different command states (Free/Busy/Failed with exception) + UI reactions for those states. Support for execution cancellation and progress tracking (required for asynchronous commands) Before we start, I offer you to imagine a common command execution timeline. In my opinion it looks like: Initialize some data (generally, UI settings - clear collections, set some indicators,...) Perform main execution logic (can be synchronous or asynchronous) Perform some actions after execution (update UI based on execution result) And don't forget about exception handling and correct cross-thread calls for asynchronous commands (all UI changes have to be performed through Dispatcher). Let's start with a little helper class, that I called PropertyChangedNotifier. It's just a wrapper around IPropertyChangedNotifier that has OnPropertyChanged(string propertyName) method. This method raises underlying IPropertyChangedNotifier.PropertyChanged event. Also this class has VerifyPropertyName method that verifies if specified string corresponds to the actual property (this method is marked with [Conditional("DEBUG")] attribute and is only used while debugging your applications to find out possible bugs with invalid prope

[Next page](<https://devfeed.tech/sources/despite-the-odds.md?cursor=WyIyMDEwLTExLTI0VDAwOjAwOjAwKzAwOjAwIiwgIjI1NTcwNzlhLTUwOWItNGI1YS04ZTRkLWZmZmIzNmU1ZjU1MiJd>)