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.


Image for post
Image for post
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. var is scoped to the nearest function block and let is scoped to the nearest enclosing block, which can be smaller than a function block. Both are global if outside any block. Also, variables declared with let are not accessible before they are declared in their enclosing block.

Let’s review following interview…


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 background: I’m full-stack software developer in banking sector, so my primary tech is Java 8, Oracle SQL and modern front-end frameworks like React/Vue. I’ve also finished bachelor’s degree in Applied Mathematics and master’s in Computer Science, so I have some math background, but I need some time to remember concepts as my current work does not include advanced math and algorithms. …


Image for post
Image for post
by rawpixel on Unsplash

When I was a student, I’ve got first acquaintance with banking sector and it was awful experience. A lot of software developers sit in narrow open space and they’ve got only one point to access Internet — laptop with mobile wi-fi. I was scared of banks since then.

Several years later I’ve got job offer from bank with high-end tech and agile development process. I was really impressed by that, as I could never imagine modern tech in such solid and conservative companies. As I see now, banks on the edge of agile and lean techniques as they should faster adapt to changes in modern world. …


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;
sendfile on;
keepalive_timeout 65;
# 1
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
# Redirect all http to https
server {
listen 80;
server_name example.com;
# 2
return 301 https://$server_name$request_uri;
}
# SSL configuration
server {
#3
listen 443 ssl;
server_name example.com;
ssl_certificate certs/example.com.cer;
ssl_certificate_key certs/example.com.key;
# Default SSL configuration
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#4
ssl_ciphers "EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA256:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EDH+aRSA+AESGCM:EDH+aRSA+SHA256:EDH+aRSA:EECDH:!aNULL:!eNULL:!MEDIUM:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SEED"; …


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 and Java Play 2 Framework on the backend. So I’ve decided to learn how to retrieve information from database and pass it to JavaScript frameworks, so I’ve decide to write an application that will get data from database and convert it into json.

I’ve got several applications and I think I could convert them into PhoneGap application for Android. So I need to connect Ebean ORM framework of Play 2 with existing tables. This could be achieved using special converters from database schema to JPA classes, but it quite complex task and I doubt that Ebean will connect generated class with existing table. …


This is very important question, because it take a lot of time when you met Django for first time. This guide is for setting up Django MEDIA and STATIC files for development environment and it will be more compact then official guide, though I'll give a reference to it.

Configuration of settings.py and urls.py

First you should consult official documentation and be sure that you’ve setup proper middleware classes. If you create new project with manage.pyor using PyCharm then this classes is already in there, but you should check it anyway.

Then you should specify MEDIA_ROOT and STATIC_ROOT:

STATIC_URL = '/static/'  
STATIC_ROOT = os.path.join(BASE_DIR, …

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.


In this article I’ll describe how to create to remote Oracle database, because there are no clear description for that. There are two ways to achieve it: throught link, i.e. you will be able to execute query like select * from table@db or directly connecting to remote database with sqlplus command sqlplus l/p@db.

This article is for Windows Server 2012, but it could works with other Windows versions and with Linux, if you could locate files on your own.

Note: even if you want to create link @db for SQL you should follow both steps, because links are using SID from tnsnames.ora. …

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