Why you only need to know 3 (or 4) programming languages

Why do I think you only need 3 or 4 programming languages? Because I think that with 4 different languages represents big enough array of programming techniques to complete (almost) any project. It’s not about the languages itself, but rather the way of thinking and working which helps us become better as software developers and cover large area of projects which you may encounter. But the main point of it is that it gives you wide array of skills, presumably enough to learn any other language and easily get you a job. ...

March 16, 2018 · 4 min · Zbigniew

How to preview image before uploading using Javascript

It’s an interesting feature. In some cases it’s better when users can preview image before uploading it, e.g. when you want to let users trim the image or process it in any way. As you’ll see it’s pretty easy to do. After reading this article you will know how to add this feature to your web app using Javascript. Step by step guide to creating preview image We’ll start off with a simple HTML page with a form and and input element which accepts only image files. Notice that we have an img element with empty src attribute, which we’ll use to display selected image. ...

March 13, 2018 · 3 min · Zbigniew

.NET reflection - theory, security and all the snippets you need in C#

Reflection code snippets tested under .NET Core 2. What is reflection and how can you benefit from it Reflection allows a program to inspect or modify itself during runtime. In practice it means that you can do all sorts of stuff on objects/properties including checking type of an object at runtime (typeof), listing all fields of an object without knowing variable names (including private members), modifying properties of an object (also including private members), instantiating object by class name and ivoking its methods dynamically, inspecting attributes attached to objects/properties, finding all classes implementing given interface in an assembly and so on. ...

March 9, 2018 · 6 min · Zbigniew

How to prevent mass assignment in ASP.NET Core

One of the many security risks which you should consider is a mass assignment vulnerability (cheatsheet) also know as overposting. While it’s not in OWASP Top 10 it’s still considered important. Read on to understand the issue and find out possible ways of fixing it. Mass assignment explained ASP.NET Core allows automatic model binding of request parameters into variables or objects to make developers life easier. It can be as simple as binding id parameter via route: ...

March 2, 2018 · 7 min · Zbigniew

Easy way to understand Big O notation

Many beginners struggle with understanding the Big O notation. I’ll show you a simple way to understand it with examples. It’s not mathematical, professional or academic, but hopefully it will help you understand it. What is Big O You’re writing your code and suddenly you come up with a problem which you can solve using several different algorithms. You have to pick one and you’re interested in the fastest one. How would you determine which one is the best in this case? Technically you could just run your app and track execution time, but that would be dependand on hardware or compiler version (etc), so performance can differ on different computers. You need a way to describe algorithm performance in relative units, that’s why we have Big O. ...

February 23, 2018 · 5 min · Zbigniew