Stefan Kecskes

Never stop learning, because life never stops teaching

Lifetimes in Rust functions

Lifetimes in Rust functions Lifetimes in Rust are a way for the Rust compiler to ensure that the references are always valid. They prevent dangling references or data races. The compiler is checking the lifetimes at compile time. If I am right, Rust is the only language that has this concept. In this post, I will show you how to use lifetimes in functions, what doesn’t work, what not to do and what are the best practices.

Concurrency vs Parallelism

Concurrency Single-threaded, multi-threaded, concurrency, parallel tasks, async task… These words are used by programmers on daily basis and while most of us understands them (fingers crossed), I believe we are using this lingo in presence of non-technical people to confuse them? or to give them more detail, with little success. Let’s recapitulate what this all is, in very high level. So that next time my Product Owner or Scrum master understands what we talk about.

Setting up XDebug for dev environment

Debugging PHP in editor I would like to describe how to set up xDebug to work in your phpStorm IDE. There are different options available depending on your preference - you can have xDebug always try to initiate a connection for your devbox, or you can use browser plugins and extensions to choose when xDebug should try to run. Requirements sudo access to virtual host config files Automatic connection This method means that you don’t need any browser extensions, cookies or bookmarklets, but may cause small performance issues because xDebug will try and initiate a connection to your computer on port 9000 every time you load a page on your dev.

Laravel validator for CSS selectors

Laravel 5.1 Validators Last week I was building a backend tool in Laravel, where you could create layout in bootstrap 3 and add CSS selectors like id or class to any container. You wanted to be able to enter more than one class name into input field. Let’s say that you want to add 2 classes: col-xs-6 infoBox_4. Laravel hasn’t validator for this type of string, so I decided to make one.

Image sprites using CSS only

What are image sprites and why should I use them? Web pages these days have many images. They are also called multimedia rich web pages. It may take a long time to load all of them. Each image means a server request from browser. Did you know that browsers these days download concurrently only 6 resources? That means that browser will start to download next resource only when one of the resources is fully downloaded and the slot is empty for next resource.