Donate to support Ukraine's independence.

22 Mar'15

Programming Arduino Pro Mini with USBasp V2.0

UPD 2016-05-14: Arduino Nano with CH340 ships from Aliexpress for less than $2 – I recommend you buy it instead (unless you know what you’re doing).

Do you really need to pay $25 for an Arduino? Many of my friends have the original Arduino and they work great, but I wanted to see how cheap I can go. Initially, I purchased the SunFounder Starter Kit and it worked 100% as advertised. Today we’ll see if we can get a fully featured Arduino under $5.

Recently, I came across the dirt cheap Arduino Pro Mini clones and decided to buy …

Continue reading

02 Apr'13

Grave accent in C# class names

For generic interfaces, the name parameter is the mangled name, ending with a grave accent (`) and the number of type parameters. This is true for both generic interface definitions and constructed generic interfaces. For example, to find IExample<T> (IExample(Of T) in Visual Basic) or IExample<string> (IExample(Of String) in Visual Basic), search for “IExample`1”.

From Type.GetInterface Method (String) MSDN reference page

Continue reading

05 Mar'13

Algolists

https://sites.google.com/site/indy256/

http://algolist.manual.ru/

Introduction to the Design and Analysis of Algorithms (3rd Edition)

Algorithms (4th Edition)

The Algorithm Design Manual

Algorithms in a Nutshell

Continue reading

08 Feb'12

Nonblocking console input in Python

By Nemesis Fixx:

import sys
import select
import tty
import termios
from threading import Thread

program_run = True
input_thread_timeout = 0.005 #seconds
quit_key = '\x1b' # x1b is ESC

#check stdin for input...
def isData():
        return select.select([sys.stdin], [], [], 0) == ([sys.stdin], [], [])

#check n terminate program on terminal condition,
#from a separate thread
class waitOnInput(Thread):
    def run(self):
        old_settings = termios.tcgetattr(sys.stdin)
        try:
            tty.setcbreak(sys.stdin.fileno())
            global program_run
            thread_run = True
            while thread_run:
                if isData():
                    c = sys.stdin.read(1)
                    if c == quit_key:
                        break
                        thread_run = False
                        program_run = False
        finally:
            termios.tcsetattr(sys.stdin, termios.TCSADRAIN, old_settings)
            thread_run = False


t …

Continue reading

11 Jan'12

PyOpenCl on x64 system

UPD: I found unofficial binary builds here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopencl, use x86 builds.

Do not forget to install pytools.

I’ve been into some difficulties since i began installing that software, even with help of http://wiki.tiker.net/PyOpenCL/Installation/Windows.

First, easy_install won’t work on x64 systems if installed by executable installer. Instead, use ez_setup.py which will determine the correct version of the software.

Next, install numpy.

finally, i’ve got a problem with module compilation. Let’s split it into two problems:

  1. wrong path to vcvarsall.bat (try to add …

Continue reading