Обзор типов индексов Oracle, MySQL, PostgreSQL, MS SQL

В одном из комментариев здесь была просьба рассказать подробнее об индексах, и так как, в рунете практически нет сводных данных о поддерживаемых индексах различных СУБД, в данном обзоре я рассмотрю, какие типы индексов поддерживаются в наиболее популярных СУБД B-Tree Семейство B-Tree индексов — это наиболее часто используемый тип индексов, организованных […]

Retrieving the coordinates of the MySQL point type

39 Let’s say you store GeomFromText(‘POINT(32 -122)’) as a column called MY_POINT in a table called MY_TABLE. Getting the X coordinate (will return 32 in this example): SELECT ST_X(MY_POINT) as latitude FROM MY_TABLE; Getting the Y coordinate (will return -122 in this example): SELECT ST_Y(MY_POINT) as longitude FROM MY_TABLE; Important: […]

Тип данных POINT в MySQL

Не так давно передо мной стояла задача о необходимости хранить географические координаты (долготу и широту) в БД. Для этих целей в MySQL есть замечательный тип данных —  POINT. Он представляет собой структуру из нескольких полей. Кроме того, к этому типу можно (и даже нужно) применять встроенные функции. Именно эти функции […]

Простое управление ролям в Laravel с помощью Pivot

Большинству из нас не нужна сложная система управления доступов в наших приложениях. Мы хотим простую и гибкую систему, без излишеств. Что мы подразумеваем под «простой» системой? Допустим у вас в проекте есть команды, у команд есть владелец и участники. Мы хотим знать: кто владелец, у кого есть раширенные права, а […]

Comparing model equality in Laravel

Dropping in Laravel 5.3 is an easy way to compare if two model instances you’ve got represent the same record in your database. The new is() method checks to see if the model keys, table and connection names match up. if (auth()->user()->is($post->author)) { // The currently authenicated user is the […]

Text editor to open big (giant, huge, large) text files

VS Code (Windows, macOS, Linux) — Free and Open Source with a nice GUI. Edited a 3.6 GB JSON file, loaded in a minute. You must have enough RAM to load the files. Free read-only viewers: glogg (Windows, macOS, Linux) – Confirmed to handle multi-GB files. Its main feature is […]

Bash For Loop Examples

How do I use bash for loop to repeat certain task under Linux / UNIX operating system? How do I set infinite loops using for statement? How do I use three-parameter for loop control expression?A ‘for loop’ is a bash programming language statement which allows code to be repeatedly executed. […]

How to delete a remote git tag?

You just need to push an ’empty’ reference to the remote tag name: git push origin :tagname Or, more expressively, use the —delete option (or -d if your git version is older than 1.8.0): git push —delete origin tagname Note that git has tag namespace and branch namespace so you […]

How to revert initial git commit?

You just need to delete the branch you are on. You can’t use git branch -D as this has a safety check against doing this. You can use update-ref to do this. git update-ref -d HEAD Do not use rm -rf .git or anything like this as this will completely wipe your entire repository including all other branches […]