Archive

Archive for December, 2010

Play with free MMORPGs in your browser

December 30, 2010 2 comments

I just read an article about some free MMORPGs that you can play in your browser. I haven’t played much in the recent years but maybe I will try one of them. I like the idea that they run in the browser, so no installation is required, they can be played on any platform, and they are free. What’s more, they are developed by Hungarians :)

Let’s see the games:

Useful links:

Categories: games Tags: , , ,

View .djvu files

December 25, 2010 Leave a comment

Problem

You want to open .djvu files. Maybe you’d like to convert them in PDF format too.

“DjVu (pronounced like déjà vu) is a computer file format designed primarily to store scanned documents, especially those containing a combination of text, line drawings, and photographs. It uses technologies such as image layer separation of text and background/images, progressive loading, arithmetic coding, and lossy compression for bitonal (monochrome) images. This allows for high-quality, readable images to be stored in a minimum of space, so that they can be made available on the web.” (source)

Solution

The default document viewer of Gnome (evince) can open these files, but it’s quite slow. There is a better program for this format called djview4.

sudo apt-get install djview4

This program can also export .djvu files in PDF format (however, it’ll take some while, the conversion is quite slow).

To open .djvu files with Midnight Commander, add these lines to ~/.mc/bindings:

regex/\.djvu$
   Open=djview4 %f &
Categories: ubuntu Tags: , , , ,

PNG to EPS

December 22, 2010 5 comments

Problem

You use “latex” and you want to convert a PNG file to EPS format. Using Gimp, for instance, produces an ugly output.

Solution

Try the png2eps script of Henlich. Works fine :)

Under Ubuntu 10.10, I had to install the following package:

sudo apt-get install pngcheck

Plus, I had to remove the -indexbits=… option from the script.

Credits

Thanks Mehdi for the tip.

Categories: bash Tags: , , ,

Random post on wordpress.com

December 21, 2010 Leave a comment

Problem

On the right side, I’d like to have a list of random posts (with titles, of course). Unfortunately, I don’t find such a widget…

Partial solution

Until I find out how to get a “Random Posts” widget, I have a partial solution. Insert a “Text Widget”, and add the following HTML code to the widget:

<a title="Click here for random post" href="http://NAMEOFYOURBLOGHERE.wordpress.com/?random">Click here for random post</a>

Credits

Categories: wordpress Tags: ,

Extract Yahoo stock list

December 17, 2010 6 comments

Use Case

In this post I explain how I managed to download the stock list of Yahoo.

Problem: I wanted to have a list of Yahoo stocks. More precisely, I only needed the stock IDs and the corresponding company names, e.g. “MSFT => Microsoft Corporation”. I was looking for such a list, but I didn’t find anything useful. So after a few hours I said to myself: “I will have to solve this problem by myself :(“.

Solution

Fortunately, Yahoo has a page that lists the industries. So the problem is actually extracting data from a bunch of HTML pages. Let’s see the steps that lead to the solution.
Read more…

Categories: finance, python Tags: , , ,

Currencies of Yahoo exchanges

December 17, 2010 Leave a comment

Problem

Using Yahoo! Finance, we can ask info about a given stock, e.g. MSFT. The current price is, for instance, 27.98. But it is given in what currency? USD, EUR, CAD? Unfortunately it’s not indicated…

Solution

As I figured it out, these values are given in local currencies. Thus, we need to know in which country the exchange is located. Using Yahoo! Finance, the exchanges are indicated with a suffix. See http://finance.yahoo.com/exchanges for a list of all suffixes.

Example: let’s take the stock name “UG.PA” with value 30.04. “.PA” stands for “Paris Stock Exchange”, thus 30.04 is given in euro (EUR).

To facilitate life, using the page http://finance.yahoo.com/exchanges, I collected all the necessary information in an array structure. I also added the currencies. So, using this structure, you can easily figure out the currency, once you have the suffix of the exchange. If there is no suffix, we can suppose it’s in USD.

<?php
# id  => description, country, currency
# source: http://finance.yahoo.com/exchanges
# collected by Jabba Laci (http://ubuntuincident.wordpress.com/2010/12/17/currencies-of-yahoo-exchanges/)
$financeSymbolMoney = array(
".CBT" => array("Chicago Board of Trade", "United States of America", "USD"),
".CME" => array("Chicago Mercantile Exchange", "United States of America", "USD"),
".NYB" => array("New York Board of Trade", "United States of America", "USD"),
".CMX" => array("New York Commodities Exchange", "United States of America", "USD"),
".NYM" => array("New York Mercantile Exchange", "United States of America", "USD"),
".OB"  => array("OTC Bulletin Board Market", "United States of America", "USD"),
".PK"  => array("Pink Sheets", "United States of America", "USD"),
".BA"  => array("Buenos Aires Stock Exchange", "Argentina", "ARS"),
".VI"  => array("Vienna Stock Exchange", "Austria", "EUR"),
".AX"  => array("Australian Stock Exchange", "Australia", "AUD"),
".SA"  => array("BOVESPA - Sao Paolo Stock Exchange", "Brazil", "BRL"),
".TO"  => array("Toronto Stock Exchange", "Canada", "CAD"),
".V"   => array("TSX Venture Exchange", "Canada", "CAD"),
".SN"  => array("Santiago Stock Exchange", "Chile", "CLP"),
".SS"  => array("Shanghai Stock Exchange", "China", "CNY"),
".SZ"  => array("Shenzhen Stock Exchange", "China", "CNY"),
".CO"  => array("Copenhagen Stock Exchange", "Denmark", "DKK"),
".NX"  => array("Euronext", "France", "EUR"),
".PA"  => array("Paris Stock Exchange", "France", "EUR"),
".BE"  => array("Berlin Stock Exchange", "Germany", "EUR"),
".BM"  => array("Bremen Stock Exchange", "Germany", "EUR"),
".DU"  => array("Dusseldorf Stock Exchange", "Germany", "EUR"),
".F"   => array("Frankfurt Stock Exchange", "Germany", "EUR"),
".HM"  => array("Hamburg Stock Exchange", "Germany", "EUR"),
".HA"  => array("Hanover Stock Exchange", "Germany", "EUR"),
".MU"  => array("Munich Stock Exchange", "Germany", "EUR"),
".SG"  => array("Stuttgart Stock Exchange", "Germany", "EUR"),
".DE"  => array("XETRA Stock Exchange", "Germany", "EUR"),
".HK"  => array("Hong Kong Stock Exchange", "Hong Kong", "HKD"),
".BO"  => array("Bombay Stock Exchange", "India", "INR"),
".NS"  => array("National Stock Exchange of India", "India", "INR"),
".JK"  => array("Jakarta Stock Exchange", "Indonesia", "IDR"),
".TA"  => array("Tel Aviv Stock Exchange", "Israel", "ILS"),
".MI"  => array("Milan Stock Exchange", "Italy", "EUR"),
".MX"  => array("Mexico Stock Exchange", "Mexico", "MXN"),
".AS"  => array("Amsterdam Stock Exchange", "Netherlands", "EUR"),
".NZ"  => array("New Zealand Stock Exchange", "New Zealand", "NZD"),
".OL"  => array("Oslo Stock Exchange", "Norway", "NOK"),
".SI"  => array("Singapore Stock Exchange", "Singapore", "SGD"),
".KS"  => array("Korea Stock Exchange", "South Korea", "KRW"),
".KQ"  => array("KOSDAQ", "South Korea", "KRW"),
".BC"  => array("Barcelona Stock Exchange", "Spain", "EUR"),
".BI"  => array("Bilbao Stock Exchange", "Spain", "EUR"),
".MF"  => array("Madrid Fixed Income Market", "Spain", "EUR"),
".MC"  => array("Madrid SE C.A.T.S.", "Spain", "EUR"),
".MA"  => array("Madrid Stock Exchange", "Spain", "EUR"),
".ST"  => array("Stockholm Stock Exchange", "Sweden", "SEK"),
".SW"  => array("Swiss Exchange", "Switzerland", "CHF"),
".TWO" => array("Taiwan OTC Exchange", "Taiwan", "TWD"),
".TW"  => array("Taiwan Stock Exchange", "Taiwan", "TWD"),
".L"   => array("London Stock Exchange", "United Kingdom", "GBP"),
);
?>
Categories: finance, php Tags: , ,

Download financial data using the Yahoo API

December 13, 2010 1 comment

Problem

If you want to consult financial information, Yahoo! Finance is a good site for that. For instance, to get info about Microsoft’s shares, just visit http://finance.yahoo.com/q?s=msft&ql=1. There, in the bottom right corner in the Toolbox section, you can find a link “Download Data”.

But is there another way to get financial data? Is there a Yahoo API for this?

Solution

The answer to the previous question is: yes, there is. Visit http://www.gummy-stuff.org/Yahoo-data.htm for a detailed presentation of the API.

Example:


http://finance.yahoo.com/d/quotes.csv?s=MSFT&f=nl1px

Here we ask stock information about the shares of Microsoft. Their stock code is “MSFT”. We pass four parameters: n – stock name, l1 – current price, p – price at the previous close, x – stock exchange. The data is returned as a text file in .csv format:

"Microsoft Corpora",27.245,27.34,"NasdaqNM"

Special tags:

At http://www.gummy-stuff.org/Yahoo-data.htm, you can find a table with all the special tags. I collected them here, in a single link: copy link (see the link in the status bar).

This can help you to choose the parameters that you really need.

Categories: finance Tags: , , , ,
Follow

Get every new post delivered to your Inbox.

Join 73 other followers