ilalex

10

votes
2

answer
304

views

Python multiprocessing crashes docker container

There is simple python multiprocessing code that works like a charm, when I run it in console: # mp.py import multiprocessing as mp def do_smth(): print('something') if __name__ == '__main__': ctx = mp.get_context("spawn") p = ctx.Process(target=do_smth, args=tuple()) p.start() p.join() Result: > $...
ilalex
11

votes
7

answer
6.1k

views

Fastest method to generate big random string with lower Latin letters

I'm trying to solve this problem from Timus Online Judge. To solve this problem you need generate a sequence of 1 000 000 lowercase Latin letters and write it to stdin in 1 second. It is easy to solve this problem with C++ or Java. I have python solution here: import os from random import randint s...
ilalex
11

votes
2

answer
809

views

Overloading with Short and int

Why this code will print int? public static void main(String[] args) { short s = 5; A(s); } public static void A(int a){ System.out.println("int"); } public static void A(Short a){ System.out.println("short"); }
ilalex
4

votes
3

answer
2k

views

Set modification time in matlab

I can get modification time in matlab by: >> f = dir('my_filename.dat'); >> f.date But how can I change it?
ilalex
7

votes
4

answer
5k

views

How get the time in milliseconds in FreeBSD?

In Linux I can find the current time in milliseconds using the command: date +%s%N but on FreeBSD I get only [13:38 ]#date +%s%N 1299148740N How can I get the time in milliseconds (or nanoseconds) in FreeBSD?
ilalex