Programming

Cinepub pe Kodi

Posted by Strainu on December 12, 2015
Python, Society, Software / No Comments

Pentru amatorii de filme românești, Cinepub este locul unde pot urmări legal filme românești. Deși majoritatea nu sunt foarte cunoscute publicului larg, sunt și câteva din cele care au ajuns în sălile de cinema în ultimii ani.

Cum în ultima vreme am folosit numai Kodi pentru a urmări filme, am zis că n-ar strica să fac un plug-in care să-mi permită să urmăresc filmele pe TV. Cinepub folosește youtube pentru găzduirea filmelor, deci aș fi putut teoretic să fac un playlist ce conținea toate filmele, dar ar fi fost mai puțin interesant. 🙂 Codul e pe github, feel free to fork and improve.

Instalare

  1. Descărcați arhiva
  2. Deschieți Kodi și mergeti la System->Settings->Add-ons->Install from zip file și alegeți arhiva.
  3. Dacă instalarea a avut loc cu succes, găsiți filmele la Video->Add-ons->cinepub.ro

Asta-i tot, enjoy!

Share and Enjoy:
  • Facebook
  • Twitter
  • Identi.ca
  • LinkedIn
  • Reddit
  • Add to favorites

Downloading images to TI Tiva C Launchpad from Keil in Wine

Posted by Strainu on February 07, 2014
Embedded, My Projects / 2 Comments

I needed to run some programs on my Tiva C Launchpad board from Linux. Normally this is very simple, as shown in a previous post. However, I needed to use the ARM Keil IDE, in order to get credit for my work.

Keil runs fine under Wine, but Wine is not that good with unknown USB devices. However, I managed to find a way around that and download the image using lm4tools instead of the default flasher. The instructions were tested using Tiva C, but work just as well on Stellaris Launchpad.

1. First, we gotta be sure we can run it:

git clone https://github.com/utzig/lm4tools.git
cd lm4tools/lm4flash
make
sudo make install
echo 'ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", GROUP="users", MODE="0660"' | \
  sudo tee /etc/udev/rules.d/99-tiva-launchpad.rules

The last command is optional and ensures the command can be used as a regular user. The Vendor and Product id are obtained by running:

lsusb | grep Luminary

and are the same on Stellaris Launchpad and Tiva C

2. Then, we have to make the script callable from wine. This can be done by creating a shortcut in the fake C:\ drive used by wine:

ln -s /usr/bin/lm4flash ~/.wine/drive_c/windows/system/lm4flash.exe

To check if it works, just start cmd from wine:

$ wine cmd
c:> c:\windows\system\lm4flash.exe

3. lm4flash needs a bin file and Keil ony generates an axf file. To get the bin file, go to project options, user tab and paste the following in the “Run programs after Build/Rebuild” section:

C:\Keil\ARM\ARMCC\bin\fromelf.exe  --bin HelloLaunchPad.axf --output HelloLaunchPad.bin

Ofcourse, you need to customize the paths.

4. The final step is to use lm4flash to download the image. Go to the project options, Utilities tab and select the “Use External tool for Flash programming” radio button from the “Configure Flash Menu Command” section.

Command: C:\windows\system\lm4flash.exe
Argument: HelloLaunchPad.bin
Run Independent checked (this is so the IDE won’t block if the script fails for some reason)

5. That’s it, make a small change to the code (so you know if the new code is active) and click on Flash->Download. Hope this helps someone 🙂

Share and Enjoy:
  • Facebook
  • Twitter
  • Identi.ca
  • LinkedIn
  • Reddit
  • Add to favorites

Tags: , , , ,

IDEs for developing for the Tiva C board.

Posted by Strainu on February 05, 2014
Embedded / No Comments

Now that we have a working environment for the Tiva C, we might as well install some IDEs and make it easy to develop complex programs. The main options on Linux are:

  1. TI’s own Code Composer (an Eclipse IDE with some changes); it can also be installed within an existing Eclipse instance, but it only works with versions 3.8 to 4.0.
  2. Eclipse itself can be configured so it works with the Linux tools
  3. If for some reason you want to use Keil, the IDE from ARM itself, you will need to use Wine, as there is no Linux version.

In this post we will talk about the first to IDEs and leave Keil for another day, as the configuration is a little bit more complex in its case. If you want a step-by-step guide for Keil (and Code Composer), I recommend this excellent article.

Code Composer

Code Composer conveniently offers a dependency script the one can use to determine if all necessary packets are installed. I strongly suggest to run it first, as debugging afterwards can be difficult. You can find the full instructions below

#precheck
wget http://software-dl.ti.com/dsps/dsps_public_sw/sdo_ccstudio/scratchpad/depends_0.2.tar.gz
mkdir ticheck
cd ticheck
tar -xzvf ../depends_0.2.tar.gz
./check_depends.sh
#install anything needed
#download the CCS
./ccs_setup_5.5.0.00077.bin

You will need to choose the following options: Custom-> Tiva C Series ARM MCUs -> Select All -> Select All

If you could not install the drivers from the installer, you need to run another script: sudo /opt/ti/ccsv5/install_scripts/install_drivers.sh

You are now ready to start Code Composer. If you are familiar with Eclipse development, you should have no problem compiling, downloading and debugging code for the Tiva board.

Eclipse

In order to use Eclipse itself, you need to configure it to use the arm compiler and OpenOcd debugger. You can find an excellent tutorial on this page, so I won’t go into further details here.

Similar approaches can be taken with other IDEs, like Netbeans. If you are using another IDEs, do leave a comment and let us know how it’s been working for you.

Share and Enjoy:
  • Facebook
  • Twitter
  • Identi.ca
  • LinkedIn
  • Reddit
  • Add to favorites

Tags: , , , ,

Programming for the Tiva C Launchpad on Linux

Posted by Strainu on February 04, 2014
Embedded / 3 Comments

I’ve recently acquired a Tiva C launchpad from Texas Instruments, that I plan to use to complete an online course much like PM was during my faculty years. However, unlike 7 years ago, my only OS is now openSUSE, which meant having an additional (although small) challenge in creating a development environment.

Below is a checklist of what you will need. Prerequisites include being able to download and compile programs from source code (but you probably know that if you’re trying to program an embedded board, right?).

1. First and foremost, you will need a toolchain for compiling the code you write. Tiva C has an ARM Cotex-M processor, making it relatively easy to find a great number of toolchains.

Many people on the internet recommend Summon-arm, but this toolchain is no longer maintained. Instead, the author recommends GNU Tools For ARM Embedded Processors (AKA GCC ARM Embedded), so I went with that one. You can download either a precompiled archive, or the sources and do the compiling yourself. As my computer is fairly old, I decided on the binary archive:

wget https://launchpad.net/gcc-arm-embedded/4.8/4.8-2013-q4-major/+download/gcc-arm-none-eabi-4_8-2013q4-20131204-linux.tar.bz2
tar -xvf gcc-arm-none-eabi-4_8-2013q4-20131204-linux.tar.bz2
sudo cp -r * /usr

2. Then, you need the Texas Instruments libraries and headers. You will not find any Linux kit on the TI website, but fear not: the Windows installer is just a zip file that contains a working Makefile. The kit can be downloaded from this page (or direct link). You will need a TI account to download – the same one used to order the Launchpad. Compiling it is also a breeze:

mkdir tilib
cd tilib
unzip ../SW-EK-TM4C123GXL-2.0.1.11577.exe
make

3. You will also need something to download the binaries on the device. lm4flash is the recommended way of doing this on Linux. This is also compiled easily and quickly:

git clone https://github.com/utzig/lm4tools.git
cd lm4tools/lm4flash
make
sudo make install

echo 'ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", GROUP="users", MODE="0660"' | \
sudo tee /etc/udev/rules.d/99-stellaris-launchpad.rules

The last command is optional and ensures the lm4flash command can be used as a regular user. The Vendor and Product id are obtained by running:

lsusb | grep Luminary

and are the same on Stellaris Launchpad and Tiva C

You can check that lm4flash works by downloding one of the examples included in the TI archive (see step 2). After a successful download, the link should blick while the color varies.

cd tilib/examples/boards/ek-tm4c123gxl/blinky/sourcerygxx
lm4flash blinky.bin

4. Debugger – a must if you write more than very simple programs for the Tiva C. The OpenOcd package is the way to go.

If you want to fetch the source on a Deb-based Linux (Debian, Ubuntu etc.) using git, here is what you must do:

sudo apt-get install git-core libtool autoconf texinfo libusb-dev libusb-1.0 screen
git clone http://git.code.sf.net/p/openocd/cod

On my openSUSE, I prefered to download the tarball:

sudo zypper in git-core libtool autoconf texinfo libusb-dev libusb-1_0-0 libusb-1_0-devel
wget http://downloads.sourceforge.net/project/openocd/openocd/0.7.0/openocd-0.7.0.tar.bz2

In both cases, compiling is the same:

./configure –enable-maintainer-mode –enable-ti-icdi
make
sudo make install

5. While TI offers its own startup libraries, some people prefer a totally free (as in FLOSS) linker. Instructions on installing such a linker on the Stellaris Launchpad (the forerunner of Tiva C) can be found on this page. I have not tried it, as for my requirements the TI libraries are enough, but due to la similarities between the platforms, this should also work just fine on the Tiva.

This is it, you can now compile and download your own programs on your new board. However, if you’re not a vim-or-emacs person, you might want to install an IDE.

Share and Enjoy:
  • Facebook
  • Twitter
  • Identi.ca
  • LinkedIn
  • Reddit
  • Add to favorites

Tags: , ,

Python library for working with the SIRUTA database

Posted by Strainu on November 19, 2012
Python / No Comments

For those of you who don’t know, SIRUTA is the official classification of the Romanian towns and villages. It is maintained by the National Statistics Institute.

Many of the projects I work on for OSM or Wikipedia are centered around location, which means I was writing similar code many times over. To simplify my life, I made a python library that offers a simple interface to the SIRUTA database. Called SIRUTAlib, you can find its homepage here.

As you can expect, it is open-source, licensed under the 3-clause BSD license. The source code is available on Github.

As always, all feedback is appreciated. If you find bugs or want to submit a patch, please use the issue tracker and the pull request system from Github.

Share and Enjoy:
  • Facebook
  • Twitter
  • Identi.ca
  • LinkedIn
  • Reddit
  • Add to favorites

Romanian Postal Codes in OpenStreetMap

Posted by Strainu on October 11, 2010
Cool webpages, Open Content, Python / 2 Comments

After a short discussion on the Romanian OSM mailing list, I decided to write a small Python script to import the postal code data from SIRUTA into OSM, cited as demanded by law 542/2008, art. 32. As cities have multiple postal codes, I had to settle for importing data for villages, hamlets and towns. Still, over 12.000 new entries were added to OpenStreetMap. I will surely be an important resource for people wanting to use coordinates – postal codes association freely.

For people wanting to peek at the code, you can find it here. It uses the OsmApi library and a stripped version of the dbf fron INSSE (converted to CSV), containing the following fields: siruta_code, village_name, postcode, postocde_source.

Share and Enjoy:
  • Facebook
  • Twitter
  • Identi.ca
  • LinkedIn
  • Reddit
  • Add to favorites

Tags: , , , , ,

Romanian Funds prices in GNUCash

Posted by Strainu on November 21, 2009
My Projects, Perl, Software / No Comments
The "Add security" Window
Fig. 1: The Add Security window in GNUCash

After the Bucharest Stock Exchage Module for Finance::Quote, I made another module, to retrieve the values of the Romanian Mutual Funds. The data is extracted from the Kmarket website which prooved to be a useful resource.

Here is how you can add this package to your own system:

  1. Install Perl. If you’re using Linux, you probably already have it. Write perl -v to find out the version you have. If you’re using Windows, ActivePerl or Strawberry Perl should do the trick.
  2. Install Finance::Quote. GNUCash offers an automated program to do that.
    1. Make sure GNUCash is not running.
    2. In Linux, open a root shell and write update-finance-quote. In Windows, go to the start menu and you will find a shortcut to a BAT file called “Install Online Price Retreival”.
  3. For now, the script is not yet included in Finance::Quote and must be installed separately.
    1. Download the provided archive and extract it along with the rest of the Perl scripts for Finance::Quote (you will see the download path during the installation). Make sure the Finance folder overwrites the current folder.
    2. In the Finance folder you will find 2 files named Quotes.pm and Quotes.pm.patch. You can apply the patch by using the command
      patch Quotes.pm Quotes.pm.patch

      On Windows, just open the Quotes.pm file in Notepad, search for a line that begins with @modules = and add ROFunds to the list of modules.

  4. Start GNUCash and go the the Tools->Security Editor menu. You will see a window similar to the one on the left side of Fig. 1.
  5. Click on the Add button. A new window, just like the one on the right side of Fig. 1 will appear. Let’s say that you want to get the stock price for BT Index (a fund from Banca Transilvania Asset Management). You add the following information in that window:
    1. Full Name: BT Index
    2. Symbol: BT Index (this is very important, as this is the search criteria – you need to put the full name of the fund, without diacritics, as there are no symbols)
    3. Type: Funds (or whatever you want)
    4. Check the Get Online Quotes checkbox. Three new options will be activated.
    5. Automatic price retreival
      Fig.2: Automatic price retreival

      Choose Type of quote source: Unknown

    6. From the drop-down choose rofunds.
    7. Click OK twice and you’re ready to test it.
  6. Go to the Tools->Price Editor menu. You will see the dialog in Fig. 2. Click the Get Quotes button and you should see a new price appearing. You can notice the source is “Finance::Quote” and the price is the correct one for that date. If you wish, you can check it on the K-market website.
Share and Enjoy:
  • Facebook
  • Twitter
  • Identi.ca
  • LinkedIn
  • Reddit
  • Add to favorites

Tags: , , , , , ,

Submit Word – Ajutor pentru dicţionarele româneşti

Posted by Strainu on October 03, 2009
JavaScript, Open Content, Romana / No Comments

Dacă folosiţi Firefox, Flock sau Thunderbird, puteţi acum contribui la dezvoltarea dicţionarelor româneşti de la Firefox sau OpenOffice.org.

Pentru asta, trebuie să descărcaţi extensia Submit Word şi să adăugaţi cuvintele noi în dicţionarul personal (vezi imaginea de mai jos). Submit Word va încărca pe situl i18n.ro toate cuvintele pe care le adăugaţi în dicționarul dvs. personal. Dacă mai multe persoane vor sugera acelaşi cuvânt, el va fi adăugat în dicționarele româneşti.

Extensia e activată de optiunea "Adaugă în dicţionar"

Extensia e activată de optiunea "Adaugă în dicţionar"

Share and Enjoy:
  • Facebook
  • Twitter
  • Identi.ca
  • LinkedIn
  • Reddit
  • Add to favorites

Tags: , , , ,

MediaWiki Contributor

Posted by Strainu on June 03, 2009
PHP, Programming, Wikipedia / No Comments

A while ago I submitted a patch to the New User Message extension of MediaWiki. The code was submitted in r51297, so I guess you could say I’m now a MediaWiki Contributor 😛

Hopefully, pretty soon this extension will be activated on the Romanian Wikipedia.

Share and Enjoy:
  • Facebook
  • Twitter
  • Identi.ca
  • LinkedIn
  • Reddit
  • Add to favorites

Tags: , , , , ,

BSE stock prices in GNUCash

Posted by Strainu on April 06, 2009
My Projects, Perl, Software / 4 Comments
The "Add security" Window

Fig. 1: The Add Security window in GNUCash

GNUCash has a very good automatic price retreival utility, based on the Perl Finance::Quote library. Unfortunately, the sites it is using to get the data from don’t have any quotes from the Romanian markets.

Therefore, I decided to write my own modules, and I started with the Bucharest Stock Exchange, since their data was reliable and available in a accessible format.

Here is how you can add this package to your own system:

  1. Install Perl. If you’re using Linux, you probably already have it. Write perl -v to find out the version you have. If you’re using Windows, ActivePerl or Strawberry Perl should do the trick.
  2. Install Finance::Quote. GNUCash offers an automated program to do that.
    1. Make sure GNUCash is not running.
    2. In Linux, open a root shell and write update-finance-quote. In Windows, go to the start menu and you will find a shortcut to a BAT file called “Install Online Price Retreival”.
  3. For now, the script is not yet included in Finance::Quote and must be installed separately.
    1. Download the provided archive and extract it along with the rest of the Perl scripts for Finance::Quote (you will see the download path during the installation). Make sure the Finance folder overwrites the current folder.
    2. In the Finance folder you will find 2 files named Quotes.pm and Quotes.pm.patch. You can apply the patch by using the command
      patch Quotes.pm Quotes.pm.patch

      On Windows, just open the Quotes.pm file in Notepad, search for a line that begins with @modules = and add BSERO to the list of modules.

  4. Start GNUCash and go the the Tools->Security Editor menu. You will see a window similar to the one on the left side of Fig. 1.
  5. Click on the Add button. A new window, just like the one on the right side of Fig. 1 will appear. Let’s say that you want to get the stock price for Banca Românâ pentru Dezvoltare (symbol: BRD). You add the following information in that window:
    1. Full Name: Banca Română pentru Dezvoltare
    2. Symbol: BRD (this is very important, as this is the search criteria)
    3. Type: BSE (or BVB, or whatever you want)
    4. Check the Get Online Quotes checkbox. Three new options will be activated.
    5. Automatic price retreival

      Fig.2: Automatic price retreival

      Choose Type of quote source: Unknown

    6. From the drop-down choose bsero.
    7. Click OK twice and you’re ready to test it.
  6. Go to the Tools->Price Editor menu. You will see the dialog in Fig. 2. Click the Get Quotes button and you should see a new price appearing. You can notice the source is “Finance::Quote” and the price is the correct one for that date. If you wish, you can check it on the BSE website.
Share and Enjoy:
  • Facebook
  • Twitter
  • Identi.ca
  • LinkedIn
  • Reddit
  • Add to favorites

Tags: , , , , ,