Archive
Play with free MMORPGs in your browser
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:
- Végzetúr / Doomlord
- Nadirim
- Gal6
- A mágia mesterei (in Hungarian)
Useful links:
View .djvu files
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 &
PNG to EPS
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.
Random post on wordpress.com
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
- This tip was posted by timethief in this thread.
- Get Random
Extract Yahoo stock list
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…
Currencies of Yahoo exchanges
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 (https://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"),
);
?>
Download financial data using the Yahoo API
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.
Get file extension [PHP]
Problem
You have a filename and you want to get its file extension, i.e. you want to extract the substring after the last dot.
Solution
/**
* Return the file extension, i.e. take a string and return the
* substring after the last dot.
* If there is no extension, return an empty string.
*
* @return File extension (after the last dot) or empty string (if there is no extension).
*/
static public function get_extension($str)
{
$ext = substr(strrchr($str, '.'), 1);
return $ext;
}
Credits
I found this solution here. I chose this one because it’s simple enough and it returns an empty string if there is no file extension.
Autologin under Gnome
Problem
You want to allow autologin in Gnome. If you are the only person who uses a given machine, with this you can save some time at each boot.
Solution
Run gdmsetup as a normal user, unlock it, and allow autologin.
Update (20121020)
Newer versions of Ubuntu use lightdm instead of gdm. So edit the file /etc/lightdm/lightdm.conf and modify these lines under the section [SeatDefaults]:
autologin-user=<username> autologin-user-timeout=0
Tip from here.
Currency converters
Here I collect some links that are related to currency conversions.
- http://www.x-rates.com/calculator.html
- http://www.xe.com
- http://www.exchangerate-api.com (Up to 1500 queries/month, their service is free. You just need to ask for a key. However, I sent them an e-mail asking something and they didn’t reply. Hmm, not very professional…)
- Making the new Yahoo! Currency Converter accessible
- JS enabled: http://finance.yahoo.com/currency-converter/#from=CAD;to=HUF;amt=1
- JS disabled: http://finance.yahoo.com/currency/converter-results/20101209/1-cad-to-huf.html (notice that you need to specify the date here)
In another post I will explain how to get conversion rates from PHP using the Yahoo API.
You must be logged in to post a comment.