Working with date and time in Java (russian)

Часть 1: https://habrahabr.ru/post/274811/ Часть 2: https://habrahabr.ru/post/274905/

June 1, 2016 · SergeM

pypy with numpy

Looks like pypy now can build numpy. Well, a slightly modified numpy. Get default branch of pypy. be careful cause the developers don’t maintain default branch compilable. Revision 84341 (c86b42dd7613) works for me. compile using ./rpython/bin/rpython -O2 ./pypy/goal/targetpypystandalone.py --withoutmod-micronumpy Create package and vitual environment. Something like this: ./pypy/tool/release/package.py --targetdir ./my_builds/build.tar.bz2 --builddir ./tmp/ --nostrip --archive-name pypy_84341 Needed to copy pypy-c and libpypy to pypy/goal beforehand. Clone and follow instructions from https://github.com/pypy/numpy/commits/cpyext-ext Revision 3299d0d76fdb831fbcb4429a89c1f53bb36ea07f worked for me...

May 16, 2016 · SergeM

About python

Production Database helpers for sqlalchemy Backend-agnostic database creation (CREATE IF NOT EXISTS): 1 2 if not database_exists('postgres://postgres@localhost/name'): create_database('postgres://postgres@localhost/name') Possible with SQLAlchemy-Utils library. See docs Infrastructure with Python http://dustinrcollins.com/infrastructure-with-python – list of tools for python development Retry libraries for python tenacity - a fork of retrying. Seems alive and powerful. retrying - abandoned but popular project. backoff Language Cheat Sheet: Writing Python 2-3 compatible code http://python-future.org/compatible_idioms.html Google Python Guidelines https://google.github.io/styleguide/pyguide.html Inheritance https://rhettinger....

May 1, 2016 · SergeM

Dropbox in linux mint

Hmm. It doesn’t work. I see the icon when i do dropbox stop dropbox start but I cannot click on it. Installed nemo-dropbox. At least now I have “Copy dropbox link” command in menu. Don’t forget to do $ killall nemo after installation to make it work. Final Solution source Use dropbox stop && dbus-launch dropbox start Or Do: opening ‘Preferences’ -> ‘Startup Applications’ and editing the dropbox entry so the command now reads:...

April 10, 2016 · SergeM

C++ IDE for linux

UPD: It seems that the current solution (2019) is VSCode. It’s free and powerful. There is a plenty of plugins. VSCode How to see content of std::string in the debugger You have to enable pretty printing by default for gdb, Add the following to your launch.json: "setupCommands": [ { "text": "-enable-pretty-printing" } ] Using CMake in VSCode See C++ and CMake Clion CLion is awesome but expensive. Codelite Found Codelite on http://stackoverflow....

April 5, 2016 · SergeM

Debugging numpy (any C code of Python) using gdb

I created a tiny python script that executes some python code, that executes some C code: # contents of dbg_broadcast.py import numpy print list(numpy.broadcast([[1,2]],[[3],[4]])) Running in console: > gdb python GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. .................. bla bla bla .................................................. # Adding breakpoint to function "arraymultiter_new" (example): (gdb) break arraymultiter_new # There is name completition by Tab....

April 4, 2016 · SergeM

Scipy in pypy

Looks like it is too early for using scipy in Pypy. There is a plenty of dependencies on C-code there. I was able to install scipy 0.17 in pypy. I disabled all failed dependencies. Unfortunately it is completely useless. Almost everything doesn’t work. link

March 22, 2016 · SergeM

Building Pypy

Pypy builds faster if using -O2 option. To build faster (according to pypy documentation) use prebuilt pypy from link Using virtualenv to create virtual environment for it. Build script (to be placed in pypy source directory): #!/bin/bash cd pypy/goal || exit 1 source <path to existing pypy environment>/bin/activate || exit 2 pypy ../../rpython/bin/rpython --batch -O2 targetpypystandalone

March 22, 2016 · SergeM

TIL about PyPy

Building from source root using command pypy_src$ rpython/bin/rpython -Ojit pypy/goal/targetpypystandalone.py produces structure with obsolete pypy-c and libpypy-c.so in /tmp/usession-release-4.0.1-XXXX/build/pypy-nightly/bin/ Probably pypy compiler places there files integrated in the src distribution. To get fresh versions I had to use pypy-c and libpypy-c.so from sources root. UPDATE: Probably I was completely wrong. pypy/tool/release/package.py has an option for (not) stripping resulting binary file: “–nostrip”. By default it is enabled. Looks like it removed something unused from binaries....

January 8, 2016 · SergeM

convert video to jpeg with good quality

convert video to jpeg with good quality: 1 avconv -i input_video.mp4 -qmax 1 -qmin 1 images_%05d.jpg crop video: 1 avconv -i input.avi -vf crop=<width>:<height>:<x>:<y> output_%05d.png create gif using http://gifmaker.me/

December 14, 2015 · SergeM