While building up my own library for Telegram Bot API, I’ve run across the need to transmit files via multipart/form-data. Old established libraries like OkHttp or Apache Http Client already has classes for multipart data, but there is nothing like this in Java 11 new http client.

I’ve discovered a decent collection of recipes for Java 11 http client, and then I’ve used it as the foundation for this article.

Thus I choose to rewrite multipart/form-data method in Kotlin and adapt it to my project:

Here is code for Telegram bot, so you could replace token and try it yourself. Probably, it would be easier to adapt my code to your needs:

No, you can’t. I’ve got an example for you:

var a={},
b={key:'b'},
c={key:'c'};
a[b]=123;
a[c]=456;
console.log(a[b]);
console.log(a[c]);

Output of both console.log statements will be 456. To understand why it it so, we should use base Object method toString() on both objects. We will see following output:

> b.toString();
< "[object Object]"
> c.toString();
< "[object Object]"

So when you use object as a key of another object it internally converts to string with value [object Object]. So this is all equal calls:

a[b] === a[c] === a[{}] === a["[object Object]"]

But if you still want to use object as a key, you should use ES6 Maps.

Javascript Baseline pt. 1

Photo by Joshua Aragon on Unsplash

Recently I’ve dived into ECMA-262 (9th Edition / June 2018) specification and in this article I will try to explain variable hoisting using LexicalEnvironment and VariableEnvironment. This article mainly summarise answers to several StackOverflow questions and my understanding of the specification.

The difference between var and let declarations is scoping…

Story about inferential statistics project

This story won’t be a step by step guide to becoming Data Scientist, because I have no idea what should I do after completing following project. So I decide to write a story each time I have some accomplishments on my way.

Something about my…

Recently, I’ve encountered interesting task. I should create proxy with apache or nginx for weblogic application. So this article will be about it.

Overall configuration is following:

worker_processes  1;error_log  logs/error.log;  
error_log logs/error.log notice;
error_log logs/error.log info;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;

While waiting for the project from outsource company, I’ve started to investigate information about Java Play 2 Framework. And it’s really impressive modern tool, which can be used to create amazing web applications. It also has powerful tool to create REST services.

Outsourced application has Angular.js, Gulp, Node.js on front-end…

I need fast and effective method to get three count from one table for statistic on my current personal project. And then I’ve found easy and elegant way to do so:

select count(*) Total,  
sum(case when is_approved = 't' then 1 else 0 end) PendingCount,
sum(case when is_rejected = 't' then 1 else 0 end) RejectedCount
from project_project

You could add group by statement so this code will show you counts for groups. This code I’ve tested in PostgresSQL. I’ll try to test it with Oracle DB and will write an update.

Artem Dracontis

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store