Usable technology

Peter Kuhar

Adding a timecode/datecode/timestamp to a video

June 25th, 2009

I’m studying some sleep videos and I needed to timelapse them. The problem was adding a timecode to the video. There doesn’t seem to be any accesible program supporting this.

A solution that come out is to create a subtitle(.srt) file displaying the current time.

0
00:00:00,000 -> 00:00:00,999
00:00:00

1
00:00:01,000 -> 00:00:01,999
00:00:01

I wrote a simple python program that generates it.

speed = 10
endtime = 60*60*24/speed

for i in range(0,endtime):
t=i
s = t % 60
m = (t/60) % 60
h = (t/60/60) % 24
print “%d” % i
print “%02d:%02d:%02d,000 -> %02d:%02d:%02d,999 ” % (h,m,s,h,m,s)
t=i*speed
s = t % 60
m = (t/60) % 60
h = (t/60/60) % 24
print “%02d:%02d:%02d” % (h,m,s)
print “”

Using sed to color specific words in Unix consoles

June 2nd, 2009

I monitoring live logs bringing out some words is very helpfull. Implementing this in unix console is straightforward.

Let’s you monitor a log with tail

tail -f log.txt

You can color matched words with ANSI Console escape sequences.

tail -f log.txt | sed “s/was/”$(echo -e “\\033[32m”)”WAS”$(echo -e “\\033[0m”)”/g”

This for example translates “pero was here” into “pero WAS here”. Notice the green color.

How it works is that sed replaces every was with WAS + some escape sequences to change color to green and back. -e in echo command makes the \ sequences to work.

You can use this in almost any console.

Povprečne cene piva 1995-2009

March 2nd, 2009

Gibanje cene piva v letih 1995-2009.

Podatki za 1995-2008 so iz podatkov statističnega urada in normalizirani na eno dozo(0.5l). Podatek za 2009(2.3.2009) je cena Zlatoroga na www.mercator.si.

Gibanje cene piva

ps.: če se kdo spomni kakšne so bile cene piva v lokalih v tem obdobju, naj prosim komentira.

Sound problems with Ubuntu 8.10 and flash in firefox

December 18th, 2008

I recently had problems with sound in Ubuntu. Instead of playing there were just some popping/squeaking/clicking sounds from the speakers. The other side effect was that sometimes the flash video on sites like youtube etc. just stopped after 2-3s ( I guess becouse the audio buffer was full ).

I traced the problems down to pulseaudio sound server that is included in recent ubuntus. It was well hided behind ALSA( probably something like app->alsa->pulseaudio->alsa->soundcard )

The solution: disable pulseaudio

sudo gedit /usr/share/alsa/alsa.conf

and comment out the pulse stuff

files [
#”/usr/share/alsa/pulse.conf”
“/usr/share/alsa/bluetooth.conf”

I hope this helps.

BIO 21 - razstava industrijskega oblikovanja

October 26th, 2008

Oktober je mesec za oblikovalske dogodke po celem svetu (a kdo ve zakaj?), tako je tudi v ljubljani mesec oblikovanja. Ne vem sicer če je BIO del meseca oblikovanja, programsko pa vsekakor spada zraven.

Torej tokrat že tradicionalno na razstavi industrijskega oblikovanja BIO 21 na gradu fužine.

IMG_3294.JPGIMG_3296.JPGIMG_3299.JPGIMG_3300.JPGIMG_3301.JPGIMG_3302.JPGIMG_3303.JPGIMG_3306.JPGIMG_3307.JPGIMG_3308.JPGIMG_3310.JPGIMG_3311.JPGIMG_3312.JPGIMG_3313.JPGIMG_3314.JPGIMG_3315.JPGIMG_3317.JPGIMG_3318.JPGIMG_3319.JPGIMG_3320.JPGIMG_3321.JPGIMG_3323.JPGIMG_3325.JPGIMG_3326.JPGIMG_3327.JPGIMG_3329.JPGIMG_3332.JPGIMG_3333.JPG

3. Slovenski forum inovacij

October 26th, 2008

21. in 22. sem na forumu inovacij v cankarjevem domu predstavljal novo brezžično stikalo.

Več informacij bo na voljo na www.modula.si.

Hvala organizatorjem za dobro organiziran dogodek.

img_3074.jpgimg_3077.jpgimg_3081.jpgimg_3080.jpgimg_3088.jpgimg_3106.jpgimg_3112.jpgimg_3113.jpgimg_3126.jpgimg_3127.jpgimg_3128.jpgimg_3130.jpg

Converting mpeg/avi/… to flv flash movie under Ubuntu Linux

June 29th, 2008

1) Install ffmpeg in flvtool2 ( sudo apt-get install ffmpeg flvtool2 )

2) Create file avi2flv.sh with the following content(or download it here avi2flv.sh ):

#!/bin/bash
tempfile=$(tempfile).flv

ffmpeg -y -i "$1" -r 20 -s 360x288  -deinterlace -ar 22050 "$tempfile"
cat "$tempfile" | flvtool2 -U stdin "$2"
rm -rf "$tempfile"

3) Run bash avi2flv.sh input.avi output.flv

4) Upload to web and use some free flv player like  http://pyg.keonox.com/tests/flash_flv_player/flvplayer.html to display it.

The most anoying programming mistakes

May 22nd, 2008

In c:
‘/n’ instead of ‘\n’: gcc will warn you, sdcc will not. ( cost 4 hours of staring into wireshark. )

In JavaScript:
string.chatAt(0) -> Unknown method: Since javascript is not a strongly typed language -> 30 minutes of figuring why javascript thinks that the give object is not a string.

tusb3410/ez430-f2013 and company on kernel 2.6.24 ( ubuntu 8.04 ) patching

April 28th, 2008

Update: Kernel 2.6.25, has this problem fixed. Unfortunately this is not the version that Ubuntu 8.04 uses

After updating to 8.04 the tusb3410 devices stopped working. There is a patch but it requires a new kernel version( not available for ubuntu jet ).
It basically requires a change in a structure in the ti_usb_3410_5052 driver ( see the above patch link ).

I’ve compiled the patched ti_usb_3410_5052.ko for kernel version 2.6.24-16-generic ( ubuntu 8.04 )
ti_usb_3410_5052.ko.gz

You still need the udev rules for switching the configuration.

For vanilla TUSB3420:

#TI USB 3410
SUBSYSTEM==”usb”, ACTION==”add”, \
ATTR{idVendor}==”0451″, ATTR{idProduct}==”3410″, \
ATTR{bNumConfigurations}==”2″, \
ATTR{bConfigurationValue}==”1″, \
RUN+=”/bin/sh -c ‘echo 2 > /sys%p/device/bConfigurationValue’”, \
SYSMLINK+=”ttyModulaTalker”

For ez430

#TI ez430
SUBSYSTEM==”usb”, ACTION==”add”, \
ATTR{idVendor}==”0451″, ATTR{idProduct}==”F430″, \
ATTR{bNumConfigurations}==”2″, \
ATTR{bConfigurationValue}==”1″, \
RUN+=”/bin/sh -c ‘echo 2 > /sys%p/device/bConfigurationValue’”, \
SYSMLINK+=”ttyEZ430”


I’ve been informed that the download link was not working. The problem is now solved.

With the new updates of the kernel on 8.04, this module/driver will stop working. I don’t have the time to rebuild it again, but you can use my original one and load it with:

modprobe -f  ti_usb_3410_5052

Ustanovitev podjetja v 4 dneh na e.VEM preko interneta. 2.

March 27th, 2008

- 18.3.2008 - Dopoldne sem grem(zasnežene ceste, pada k svina) na OOZ Sevnica s potrdilom o depozitu. Še zdej mi ni jasno, kam bodo ta depozit pripeli, glede na to da ga v sistemu ne vidjo.
No izkazal se je, da ga zdej vidjo. Čudežno se je pojavil ravno takrat, ko sem prišel. ( še vedno sumim, da je vloga cel ta čas bila vidna, ampak referent ni niti pogledal na e-VEM pod gospodarske družbe, ampak samo pod s.p., moja vloga je sicer bila edina ). Poskenira potrdilo, pravi da zdej bo vredu, da bo vnesu in da lahko grem.
- nekaj ur kasneje - Grem pogledat na e-VEM, vloga še kr ni potrjena. Spet kličem na OOZ Sevnica. Pravi da je mel stranke in da bo zdele. Ok žez 15 minut je bila stvar potrjena in je romala na Ajpes.

-19.3.2008 - Sodišče je potrdilo vlogo, dobil sem sklep o vpisu( digitalen seveda) matično in davčno.

Modula, inovacije v elektroniki in informacijskih tehnologijah, d.o.o. je registrana :)

Torej hitr overview:
Greš na e-VEM( za kar rabiš kvalificirano digitalno potrdilo )
- izpolniš podatke,
- Seveda izbereš sebi bližjo VEM točko, za katero sumiš, da bi lahko imeli kaj izkušenj s tem.
- digitalno podpišeš. Stiskaš akt o ustanovitni
- greš na banko, odpreš depozitni račun, vplačaš ustanovni kapital
- neseš potrdilo o vplačilu na VEM točko, kje ga skenirajo, vnesejo v sistem ter arhivirajo.
- čakaš na rezultat s sodišča

Pomoje, če začneš zgodaj zjutraj in maš srečo, bi znala bi zadeva končana v enem dnevu.

Svetla točka celega podviga, je da je večina ljudi, ki sem jih v postopki klical bila pripravljena pomagat in jim to ni bilo odveč.( razen 2 izjem, katere ne bom omenjal ).

http://www.pkuhar.com © 2006 Peter Kuhar peter@pkuhar.com