It's relatively easy to scale out stateless web applications. You often only need a reverse proxy. But for those stateful web applications, especially those applications that embeds websocket services in them, it's always a pain to distribute them in a cluster. The traditional way is introducing some external services like Redis to handle pubsub, however, in such way, you often need to change your code. Can Erlang/Elixir, the "concurrency oriented programming languages", best other languages in this use case? Has Phoenix framework already integrated the solution of horizontally scaling websocket? I'll do an experiment to prove (or disprove) that.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require("http"); | |
const esbuild = require("esbuild"); | |
const serve = async (servedir, listen) => { | |
// Start esbuild's local web server. Random port will be chosen by esbuild. | |
const { host, port } = await esbuild.serve({ servedir }, {}); | |
// Create a second (proxy) server that will forward requests to esbuild. | |
const proxy = http.createServer((req, res) => { | |
// forwardRequest forwards an http request through to esbuid. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
Future<void> main() async { | |
// 1. | |
print('Что говорит собачка?'); | |
var value = await userInput(); | |
print('Введена строка $value'); | |
print('\nЧто говорит кошка?'); | |
userInput().then((value) => print('Введена строка $value')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. | |
class User { | |
User(this.name, this.surname); | |
String name; | |
String surname; | |
@override | |
String toString() { | |
return 'User(name: $name, surname: $surname)'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math'; | |
void main() { | |
// 1. | |
String text = 'hello world'; | |
revert(text); | |
// 2. | |
var ar = [1, 22, 3, 40, 12]; | |
var result = avg(ar); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
void main() { | |
// 1. | |
int monthCount = 3; | |
switch (monthCount) { | |
case 1: | |
print('Январь'); | |
break; | |
case 2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. | |
int a = 13; | |
// 2. | |
double b = 12.8; | |
// 3. | |
var text = 'moon'; | |
// Error: A value of type 'String' can't be assigned to a variable of type 'int'. |
Существует огромное количество VPN-сервисов. Вот два популярных варианта:
- https://nordvpn.com/ большие скидки при оплате за 2 и 3 года, возврат денег в течение 30 дней (если зайти на https://nordvpn.com/features/ и пролистать вниз, то появится попап со скидкой 77% — $99 за три года)
- https://www.privateinternetaccess.com/ старый, добротный
Таблица сравнения кучи VPN-сервисов https://thatoneprivacysite.net/vpn-comparison-chart/
См. также:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';?> | |
<? | |
\Bitrix\Main\Loader::includeModule('iblock'); | |
$arSelect = array( | |
'ID', | |
'NAME', | |
'DETAIL_TEXT', | |
'CREATED_DATE', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';?> | |
<? | |
\Bitrix\Main\Loader::includeModule('iblock'); | |
$arSelect = array( | |
'ID', | |
'IBLOCK_ID', | |
'DETAIL_PICTURE' | |
); |
NewerOlder