2012-01-25

Keno.

http://pastebin.com/YeM9nGrP
Keno gambling code. Written in python. Allows to simulate Keno winnings.

2012-01-24

Gasoline price charts, upgraded



Upgraded version of gasoline price charting.
Added two dropdown boxes, similarly like in gasoline price mapper.

Repaired the gasoline "extrapolation" from last date in the database till present moment.

Gasoline price charts



This is chart from the cheapest E95 station in Dārzciema iela 127. This one automatically takes data from my database where data is checked and updated every 4 hours.
1)Updating database - the new records are added to database only if they are different from previous, last data. Such approach allows to save database space.
2)But in the same time the data reconstructing is needed when the data is taken out of database. For example, if I have no value changes between five days, I would not interpolate the values between records, but in all these days between I make the value as it was in the day before this no-value gap.

Link to the source code.

2012-01-20

Top 10 gasoline prices in Riga, FINAL

Two changes here -
1) the functional one - another dropdown box added - now it is possible to get top10 exact brand addresses.
2)the design - background behind dropdown boxes is transparent.


2012-01-19

Top 10 gasoline prices in Riga, FINAL

Fully functional top10 gas price map.


Autocentered on all markers.
InfoWindow added.

Source code with some comments (mostly javascript google api) can be found here php highlighted and here javascript highlighted.

2012-01-17

2012-01-14

grass gis batch interpolation and statistics

This post continues the previous one. Using two loops I created a raster files for each month and made a text file with basic statistics about these raster files in it.

here`s the code - http://pastebin.com/RtXuaQKS

I was using "boolean" switches because if the script grows larger, sometimes it is unnecessary to do things multiple times. Such switches eliminates running unwanted code (yeah, commenting also works, but.. i hate commenting blocks).

In this example the challenge was to correctly make heading-monthName when statistics were generated. Using awk the month name was passed as a command line argument and written in the appending file before statistics were written.

grass gis batch rename

Usually I dont like to do similar things multiple times. Like file or any object renaming.
Current problem involves Grass GIS database binded to vector layer. multiple columns has name as ID which doesn`t give much sense what exactly is stored in the column. Yet I know, that I have 14 columns with name dbl_1, dbl_2 and so on till dbl_14. The first two represents coordinates, and other 12 - monthly values. I would like to rename existing ID representing names to month names.
For such manipulation I need an array with month names. Then it is possible to iterate through the loop and in each iteration rename exact column.
Example is here - http://pastebin.com/52fMqL9j

Firstly the month names are passed as a simple string delimited with semicol ";"
Secondly, the string is splitted creating an array echoing and pipelining created string to bash tr comand (translate)
And then comes a loop over an created array. Counter "i" starts from value=3 because in my case the first id which represents the first monthly value is dbl_3 and it represents an october
In the loop the iterator increments through pipeline to bc

2012-01-11

chart series isExists

Here are multiple approaches how to check if chart series exists in Visual Basic 2010 (.NET)
For me the best approach is to use error exception and try&catch method.
http://forums.asp.net/p/1609665/4778480.aspx/1?p=True&t=634619304634512242