2012-12-31

Battle City Tank noise (chipNoise) VSTi

Another VSTi based on chip created tune. This one created from famous Nintendo NES game "Battle City". Thats why the GUI is made based on the theme of this game. During the game these tanks has a two noise profiles. I recorded one, looped it and found that it has powerful bass and lead sound. Chaining such VSTi with different audio plugins possibilities are endless.



2012-12-30

Super Mario VST sampler

During the Christmas holidays I made this sampler dedicated to Super Mario from NES console game. This sampler actually has 3 versions.
The first one V1 was created as light edition consisting only parts from surface level (level 1-1, 1-3, etc), subsurface level (1-2, and similar) and dragon level (1-4, boss levels). All versions still misses water level theme (2-2). I hope to make them soon and put in all versions. It has almost all effects (getting coin, both jump sounds, etc).
The second version V2 was created as full library splitting smaller song parts by half and one measures. It also has effects and three rhythm loops. I found out that using full library is inconvenient and I made the last version - V3
This version has the same parts divided only by 2 measures. It also have 2 octaves long bassy chip generated tones, almost all of them extracted directly from raw song. Only few tones which were not able to get manually are realtime created altering pitch from closest sample.

Only for few - 3 or 4 raw samples the post-processing were made removing some chip (emulator) created noise which was annoying after sound normalization.

While it has no real purpose for this sampler, its still fun and nostalgic to play around with it.
I should make a exe version of it.

2012-12-21

VST sampler - "Whooper"

Kinda bass VSTi sampler. Experimental work with Maize Sampler. Two layers where one of them responds half of velocity thus giving spectral differences respectively to velocity. Silent and distort snare sound in far background gives extra ambient feeling. Its free to use and soon can be downloaded here as a VST for both - Windows and Mac users and as an AU.

2012-12-18

Bash + awk + grass = csv

Small bash script with two loops iterating two arrays (pseudo 2D array). It helps to automatize standart interpolation with Grass GIS v.surf.rst default parameters and returns r.univar calculated raster maximum in appending text file which actually is comma seperated file and can be later for postprocessing.

2012-12-07

6 samples VSTi

About a year ago one of my friends was tinkering with arduino and how to make a drummachine. The hardest part was to think about how to connect it with a computer or telephone. Well.. i still dont know about telephone, but connecting such external devices with computer needs an understanding about how the communication will be. As my friend was working with arduino, there is a small problem for him - in easiest and cheapest circuit arduino works only through serial communication.
I started wondering around and found something similar to arduino called - Teensy. It has usb implemented in itself, even better - through ide it is possible to set the type of the device. In our case the device should be... super simple midi device. As I knew something about synthesizers (actually I dont but he thought so) and I was encouraging him to try to find a way make that arduino speak "in MIDI", knowing that such thing will allow connect it with any sampler or specifically build synthesizer for it.
As I was tinkering before with Outsim Synthmaker, I offered to build a software demo version of such a sampler (download here exe and dll version). I never worked with samples in Synthmaker before, so this task was kind a challenge for me. After he defined what he wanted, I made little 6 sample midi sampler starting with C3 key. It has implemented release - so it will sound 30% after after releasing a key.
It can load samples and it shows loaded samples in GUI. It has 3 classes of loudness which are adjustable with two knobs for each sample. Each sample is testable directly in GUI and for each there is main volume and pan option.

2012-12-06

Time difference calculator v.2 and copy multiple cells in dataGridView

This is another small tool (download here) which can be used in accounting calculating time difference in hours and minutes to decimal hours, giving a rate for such a difference and finally obtaining the product of rate and decimal time difference; the result can describe daily wage.

Additionally I made a table which is actually is Visual Basic 2010 gridDataView object, invented direct paste (by right mouse button or just press a button) for bulk time-data import, which could be copied from spreadsheet documents, and a possibility to copy out multiple selected cells. Rate can be set directly in table, then there is only need for recalculation for changes.

Otherwise, it is possible to fill the table manually.


The short story behind creating this software.

2012-11-26

Custom Colormaps in QGIS

QGIS Colormap view
QGIS (version 1.8 and before) lacks built in predefined colormaps . The only default possibility to create a colormap is to classify by equal intervals and with red-blue colors. While it is still possible to manually edit automatically created colormap, I found it completely unhandy. Firstly, because most of my raster data I would like to represent with certain step within chosen amplitude, secondly, I would like to represent the raster in different color scale and thirdly - I would like to use more color scales than one.

Interface of my Colormapping tool. Two color
scales used here - from black to white and from
white to green.
When someone creates the colormap for chosen raster, it is possible to save that custom colormap as a plain text file. That gives an opportunity to prepare such a text file outside of QGIS, no matter where and how. As my working environment is Windows and I know some Visual Basic  stuff, I wrote a little helper program, where I am able to set start value, count of the categories, step of the value and combine or put together multiple colormap scales. 

Important notice: the first and default color scale can be obtained pushing button "Classify". For other scales click right mouse button on a chosen category and menu will appear.

The program is written in Visual Basic 2010 and is dependent of Microsoft .NET 4 framework. It will not be able to run while that framework has not been installed.
Short overview about program usage can be seen in following video.




ColorMapper for QGIS - download

2012-11-20

Array to string in python

Converting chosen dimension from pseudo 2D  array (list within a list) to string in Python can be done written at least in 4 lines. "for" loop together with "string" functionality to join or "implode" an array element.

Code can be seen here- http://pastebin.com/y1kQ2kpe

2012-11-14

Find median or any statistic parameter in loop by array key


Suppose you have multiple lists with the same length and key:

key----value1----value2
1          35           33
2          40           20
3          23           23
..
12        60           70


and you would like to calculate medians by the key -
result should look like:

key----median
1          34
2          30
3          23
..
12        65
Why?
If you have raw tabular data, of course, this can be done fast in any spreadsheet. but if your results are intermediate results generated in large script, then it would be good if they have a structure and in such case they can be put together and passed to function.

What was before?
Previously in my script I invented superduper basic simple data structure for my data - long term monthly mean pairs. The month number is a key and it has its corresponding calculated value. It is kinda pseudo 2D array, where each element is a small array containing respective key (month number) and value, altogether 12 elements.

Why again?
So, what happens if you run such long term monthly mean function in loop (each time changing something in previous calculations to get different long term monthly mean values, of course, otherwise there would have no meaning of it..)? You get multiple arrays with similar structure.
..
What can be done with such arrays? Well.. different things, of course, any statistics.. in my case, 50th percentile, called median (or vice versa). The next thing is practical - how to pass all these arrays to the specific function? Wrap them together.

How?
What is wrapping here? Superduper basic simple thing, actually - I created an "outer" array, I call it wrapper array, which I am appending with "long term monthly mean" pseudo 2D array and such an "outer array"
 is what I passed to the function.

What function does? Function takes apart such an "outer array" and reconfigures it by keys allowing to make a median calculation over the created reconfigured lists. Reconfigured array consists of number of keys of lists - list count is equal to key count - and each list consists of all values corresponding to the key. Then statistics can be done over each list and the result can passed to the function return (I prefer to return array with the similar structure like "long term monthly mean" structure - with pairs consisting of key and corresponding statistical value).

The full sample script can be seen here.

2012-11-12

another "long term monthly mean" script


I always try to simplify and optimize things when I write my scripts. When I firstly started to write some scripts which iterated over a dates, I didnt realize the importance of splitted datetime objects by its parts and I wrote these scripts complicated with different inner conditions and so on. This one is very basic and simple one - it takes apart the "datetime" and stores the value accordingly by the month in a 2D temporary array, where in the one dimension there are 12 months and in the another dimension - appended values. Then in another loop the values are averaged within each month and result is given as 2D array as a month-averaged value pair.

The function can be seen here - http://pastebin.com/YZEtkKh6

2012-09-24

24 min interval for Cron Job and cycling through file

 Simple approach, how to make cron job iterating over a list of a variables. Firstly, it is necessary store the list somewhere permanently. In simpliest case it can be text document and here the trick is to take only information from first line and then to put it on the end of file as a last element. array_push copies the first line of file $farray[0] as a last element of $farray, and then array_shift removes this first element.
$farray=file("file.txt");
$thisIsWhatINeed=$farray[0];
array_push($farray,$farray[0]);
array_shift($farray);
file_put_contents('file.txt', implode("",$farray));
I added a condition, because in my case there could be, that some part of cron job should not be executed at certain times. I have 54 runs per 24 hours; I calculated that cron job must run every 24 minutes. In 24 hours there are 1440 minutes; 54 runs could take maximum interval 26.666 minutes, but for convenience creating cron jobs (which is another aspect, written a little bit later) I set interval for 24 minutes between cron jobs and add 6 empty runs, which were taken in account using condition. Finally I had 60 runs for 24 hours, so i have 24 minutes as a equal interval between cron job runs.
And here comes another aspect - it is impossible to set intervals in cron, only set times. Thus i had to create 5 cron jobs with each defining (with 24 min step) when to start and run after 2 hours (because in 2 hours there can be 5x24 min intervals)

Two ways of defining upbeat bar length in Sibelius 7

Lately I had to give crash-course in music scores writing program Sibelus (version 7) and after that course I got telephone calls twice asking and precising some of very basic common tasks in the software. Despite I got the main problem - how to put an upbeat, I ended up struggling about how far and what exactly my student was doing working with Sibelius, because there are two ways how to do it.
Ok, so much for introduction, here go my solutions:

1) Easy way. Creating upbeat at quick start. When score writer has chosen what type of writer want to create, next thing is to choose different properties for scores, like time signature, tempo, key, etc. Under the Time signature setup there is option to create Pick-up bar with different length than it is defined by time signature. Easy as pie, but often forgettable.

2) Not so easy way. But, if score writer forgot to create upbeat at quick start, then it is still possible to make upbeat later. Here, writer have to select "Notations" tab to access "Time signature" dropdown selector. In dropdown selector there are common signatures, and under them there is button "More Options". And upbeat creation can be found there. Checkbox at "start with bar of length", choose length and press OK. After such manipulation mouse cursor becomes active and now it will create a bar with previously defined length in the place where score writer will click. So, because upbeat needs to be in the beginning of scores, score writer must click somewhere on the first bar or, better, on the key.


2012-08-13

Listen the difference

Try to find differences!
This is from movie Kick-Ass, 2010


And this is from one of my favorite horror movies - 28 weeks later, 2007

And this - this is The One which was in the beggining. 28 days later (2002

Between 28 days/months sequel and KickAss the answer is two note offset in main theme. Could it be called composer plagiated himself?

2012-07-19

Proper homepage representation inside facebook.

Ok, here it goes.
There are two, TWO things what must be done to properly represent blog through "like" or just using hyperlink in facebook or whatever you are doing.

Firstly, must be sure about does the blog have meta keyword with content description
read here - http://www.bloggerplugins.org/2012/03/add-meta-description-tags-to-blogger.html

Secondly, must insert facebook code snippet in blogger source.
could be done in different ways. read here - http://blog.xmlgadgets.com/blogger/facebook-like-button-for-blogger/ and also read comments.

Also check the source of this page, try to find that damn meta tag.

Guess, what!


decode with webcam here

2012-07-17

Repairing KAWAI MP4 audio jack

Lately I had problem with my left audio jack loosing sound sometimes. Got it fixed by myself today. Here are some pics and hints how to disassemble and make such repair as well as can be perceived as excursion inside in this beast.
So, here we go, step by step.
1)Firstly, there are seven small black screws almost all around the synth. Opening five of them on the right side in picture and removing that metal rail, we can access almost nothing but instead see some electronic parts.

Continue to next pictures.

2012-07-10


Divi aspekti, ko redzu AES par/pret diskusijā.
1)Ekonomiskais. Īsumā - Latvijā vienmēr būs kādi, kas meklēs no projekta iebāzt sev kabatā. Kā jauns projekts, tā drāžams no visiem galiem. +1 "pret". Kapitālisma štelle. Caurcaurēm kontrolējot iepirkumus un projekta izmaksas versus projekta vērtību kaut kas varētu arī pozitīvi sanākt, bet gan jau būs kādi, kas mierā nepaliks. AES ir fantastiska naudas iegūšanas štelle to radot un pēc tam uzturot zema IQ valdībai.

2)Drošības. Īsumā - Kādi ir riska faktori AES kļūmēm? Nu, piemēram, nolaubīts Boeing 777? Zemestrīces? Cunami? Cilvēciskais faktors.

Vai, nodrošinot kvalitatīvas ģeoloģiska un militāra rakstura "early warning" sistēmas šie riska faktori netiek samazināti līdz bezgalīgi mazai varbūtībai? Kāda ir iespēja rasties zemestrīcei mūsu platuma grādos? Fenoskandijas jeb Baltijas vairogs ir ģeoloģiska formācija, uz kuras atrodās Baltijas valstis. Īpašs tas ir ar to, ka tas ir biezs nogulumslānis un noslāpē kustības. Un pašas agresīvākās zemestrīces notiek tur, kur ir plātņu robežas, kā, piemēram, Japānā, Vidusjūras vidū, Kalifornijas tuvumā..



Otra - saistītā lieta - cunami. Cunami lielums atkarīgs no jūras dziļuma. Cunami ir vilnis un vilnim ir periods; ūdens masa veic rotācijas kustību. Cunami periods ir ārkārtīgi liels, un tas nozīmē, ka "netraucēts" vilnis ir ar lielu diametru.

Gultnei kļūstot seklākai, rotācija ieņem elipsveidīgu kustību un tiek bremzēta. Baltijas jūra ir sekla jūra un tā a priori jau bremzē šādu lielu viļņu rašanos, ja tāds arī rastos kādu nezināmu tektonisku procesu rezultātā. Līdz krastam nokļūtu lieli viļņi un postījumi būtu standarta vētras radītā apjomā.


Lai arī Fukušimas reaktori tika apturēti (neitronus absorbējošie kontroles stieņi nolaisti serdē - starp citu, tie sakarst un vislaik ir jādzesē), dzesēšana bija tā, kas nofeiloja.
Labi, izskatās, ka daba Baltijā tā kā atļautu kādu AES uzturēt.


Bet ja kāds ar nolaupītu Boingu kustēsies virzienā uz AES, tad... cik minūtes ir NATO gaisa spēkiem, kas bāzējušies Lietuvā, Šauļos, vajadzīgs, lai paceltos un notriektu šādas draudošās briesmas?



Skatīt lielāku karti

Bet vai mēs, austrumeiropieši, esam kārtīgi saimnieki? Spētu uzturēt ko tādu? Nu, šis ir retorisks jautājums.




2012-03-02

Canoscan 8400f error 2 178 0

Bad FAU (film adapter unit) cable.
The scanner worked fine while scanning some documents and stuff. When I tried to scan some diapositive films, i got an error 2 178 0. In some forums people say it is because of cable. Tried to find some schemes, but unsuccessfully. Got another, working cable and additionally I made the scheme of the cable.

In my case the wires 8 and 9 was broken. The interesting part was that it was possible to avoid the error by putting the FAU in the start position manually by hand. When I launched preview, the error was gone and i got a preview of my diapositive. And then it stuck in the end - servo motor didn`t put the FAU in the start position. I realized that something is wrong with 1)electronics or 2)cable. With other cable scanner worked fine, so it is not electronics. And here it is - the wire 8 which eventually was broken is FAU (go) HOME. But still I have another wire - 9, which is FAU (gives) POWER. Could it be that FAU doesn`t get the power from it and takes power from wire 10? It seems possible, because I got it working with broken cable when I manually put the FAU in start position. The lamp was shining and the unit worked ... till it had to "go home" :D


2012-02-09

2012-02-06

populārzinātniskas piezīmes

Stāsts, šķiet, sākās ar to - vai ģeomagnētiska vētra iespaido cilvēku? Jautājums laikmetīgs, aizķēra arī mani. kā nekā, 2012 gads ir 11 gadu solārā cikla maksimums vai kāviņtur. Balstoties uz iepriekšējām zināšanām par fiziku un... neiroloģiju, kas iegūtas .... fizmatos, optometrijas un redzes zinātņu nodaļā, pirmais, kas ienāca prātā - nē, noteikti nē. Taču varbūt, ej nu sazin, ir kādi izņēmumi. Turpinot diskusiju nolēmu paskatīt dziļāk tēmu.
Lai vieglāk būtu gan lasītājam, gan man sevi saprast un izsekot, izveidoju pseidointerviju ar sevi.

-Kā tad īsti ir? Vai ģeomagnētiskā vētra iespaido cilvēku?
-Jā un nē. Pārāk plašs jautājums, patiesībā. Ir dažādi aspekti un elementi. tāpēc - mazliet pirms gala atbildes - par elementiem atsevišķi. Kā arī varbūt kāda diskusija un papildus jautājumi radīsies. Tātad - iesākumā bija nervu šūna.

Pati par sevi tā ir šūna ar konkrētu funkciju. Galvenie uzdevumi - saņemt un padot. Nu, un arī parēķināt.
-Parēķināt - ko īsti?
-Par to vēlāk. Tātad šūna, kas saņem... Ķīmiju.
-Ķīmiju?! No kurienes? 
-No citas šūnas...
-Pa taisno?
-Nē. Starp divām nervu šūnām ir... sprauga. Sinapse...

-Nu un kur tad elektriskie nervu impulsi spēlē lomu?
-Ne tik ātri. Tātad - iedomājies tādu situāciju - trīs šūnas pēc kārtas. Pirmā šūna ir receptors, kas spēj sajust.. nu, piemēram, gaismu. Savukārt nākamās divas pēc kārtas - divas nervu šūnas. Receptors, pēc būtības ir sensors. Sensors saņem informāciju ārējā formā (mehāniskā, termiskā, elektromagnētiskā- piemēram acī nūjiņas un vālītes).

Tātad - receptors, kurš spēj sajust gaismu darbojas pēc principa: receptorā ienākošā gaisma paveic ķīmisku reakciju. Viena viela pārtop par citu vielu, tādā veidā iedarbinot receptoru - tas ir izveidojis elektroķīmisku Signālu. Receptors ir savienots ar nervu šūnas aksonu. Savienojuma vietu sauc par sinapsi. Sinapse patiesībā ir telpa, kur notiek ķīmiska reakcija. Nosacīti, nervu šūnas sinapsēs nav savienotas.
-Ķīmija, ķīmija.. bet kur tad "nervi pārvada elektrisko impulsu"?
-Tieši šeit arī rodas neirālā signāla elektriskā daba. Sensors sinapsē izdala ķīmiju - neirotransmiterus, mediatorus.

Savukārt nervu šūnas aksons šo "ķīmiju" monitorē un uztver. Sinapses ir bezgala sarežģītas un ķīmiskās reakcijas dažādas, bet galvenā ideja - nervu šūnas aksonam, uztverot "ķīmiju", šajā nervu šūnas galā izmainās elektriskais potenciāls...
-ēm.. pret ko? elektriskais potenciāls jau nevar būt viens pats... tāpat kā baterijai ir pluss un mīnuss..
-Jā, tieši tā. Šajā nervu šūnas galā ienākošā "ķīmija" ir radījusi atšķirīgu vidi, nekā otrā nervu šūnas galā - dendrītā. Šī elektriskā potenciāla atšķirība dendrītam "ieslēgties" un... atbrīvot ķīmiju nākošajā sinapsē.

-Skaidrs. Tātad ķīmija ar elektrību smadzenēs iet roku rokā.
-Ne tikai smadzenēs. Visā organismā.
-Bet kā ar kalkulāciju? Kā nervu šūnas zina, ko uz kurini sūtīt?
-Nu, tas ir smags jautājums šim brīdim. Ir vairākas lietas, kam nepieciešams pievērst uzmanību - nervu šūnu veidi - vienkārši un īsi sakot - pelēkās un baltās šūnas. Baltajās ir gari aksoni un dendrīti, galvenokārt nodarbojas ar signālu pārvadīšanu, pelēkās - tajās ir īsi aksoni un dendrīti, kas ļauj tām atrasties vienkopus veidojot sarežģītus tīklus. Pēc šīm īpašībām arī ir šie klasiskie nosaukumi - "kustini pelēkās šūniņas". Nu redzi, smadzenes lielos vilcienos ir "pelēkas".

Taču nākamā lieta - kā šīs šūnas grupējas smadzeņu ietvaros......

-Nu skaidrs, cik saprotu, tad lai šito apgūtu, jāiet studēt medicīna. Izskatās arī, ka kopumā esam pamatīgi novirzījušies no tēmas - ģeomagnētiskās vētras iespaids uz cilvēka organismu.
-...Otrā lieta, kam vēlētos pieskarties - kas īsti ir ģeomagnētiska vētra. Nu, tu zini, ka zemei apkārt ir magnētiskais lauks, vai ne? Magnetosfēra. Principā, šī ģeomagnētiska vētra ir zemes magnētiskā lauka normālas pastāvēšanas traucējumi.

Zemi nepārtraukti apspīd Saule. Bet Saule ne tikai uz zemi sūta gaismu, bet arī elektronus un protonus, kas ietekmē magnētisko lauku. Vispazīstamākā parādība - ziemeļblāzma. Šīs daļiņas magnetosfēras klātbūtnē jonizē atmosfēras augšējos slāņos atrodamos skābekļa un slāpekļa savienojumus, un tie, saņemot enerģiju no protona, izstaro gaismas daļiņu - kvantu... Tāpēc ģeomagnētiskās vētras laikā novērojama pastiprināta ziemeļblāzma, jo no Saules tie elektroni un protoni mazliet vairāk, nekā vajadzētu, atnāk. Attēlā pievērs uzmanību, kādā virzienā nāk daļiņas. "Along magnetic lines in the polar regions"

-Vai tam ir kāds sakars ar kosmisko starojumu?
-Jā. Saules vējš - protoni un elektroni, neitrino un visādas citādas kodoldaļiņas ir tiešs kosmiskais starojums.

-Kāds spektrs ir kosmiskajam starojumam?
-Nu, te nu nevajadzētu jaukt kosmisko starojumu ar elektromagnētisko starojumu. Neesmu nekāds tur astrofiziķis, bet cik sanācis atrast - kosmiskais starojums kādreiz ir ticis uzskatīts par elektromagnētisko starojumu, taču tā kā tās ir daļiņas, tad drīzāk ir jārunā par enerģijas daudzumu, ko šāds kosmiskais starojums (kurš pēc būtības nav starojums) pārnes.

-Tātad, kosmiskais starojums var ietekmēt Zemes magnētisko lauku?
-Jā. Un tas to arī nepārtraukti dara.
-Un Zemes magnētiskā lauka izmaiņas var ietekmēt cilvēka nervu sistēmu?
-Pētījumi saka, ka slimam cilvēkam var ietekmēt. Pie tam riska grupā atrodas tādi cilvēki, kuriem ir kardiovaskulāras - sirds un asinsvadu slimības.
-Un kāpēc veselu cilvēku tas neietekmē?
-To es nezinu. Pētījumi nav atraduši būtisku ietekmi uz nervu sistēmu. Kā arī ir aizdomas, ka patiesībā šīs kardiovaskulārās problēmas izraisa pati ziņa, ka būs gaidāma magnētiskā vētra. Cilvēks satraucas un patiesībā sacepj pats sevi. Cik nu tas ir patiesi, neņemos spriest, bet tādas idejas arī virmo gaisā.
-Bet pats kosmiskais starojums pēc būtības ir bīstams cilvēkam?
-Jā, protams. Jebkurš starojums attiecīgās devās ir bīstams cilvēkam. Mobīlie telefoni, dažādas iekārtas, kas izstaro elektromagnētisko starojumu. Links. Vēlviens links. Un, piemēram, kosmosā kosmonautiem/astronautiem pastāv augsts risks saslimt ar vēzi, jo starojums atklātā kosmosā ir intensīvs. Mūs uz Zemes aizsargā.... atmosfēra roku rokā ar magnetosfēru. Ultravioletie stari pazūd ozona slānī, nu.. vismaz tur, kur vēl nav caurumi, jau pieminētie elektroni un protoni enerģiju atdod, veidojot, piemēram, ziemeļblāzmu. Nē, nu, pašlaik gaišā dienas laikā arī notiek enerģijas atdeve atmosfērā un magnetosfērā. Sīkumos neiedziļināšos jo neesmu tik gudrs, bet to, ka tas notiek, to varu droši galvot. Vien neitrino tāda jancīga daļiņa-  viņai viss vienalga, skrien visam cauri...
-Miljons dolāru jautājums - vai elektromagnētiskais starojums ietekmē cilvēka veselību?
-Jā, protams. Kā jau minēju, jebkurš starojums kaut kādā frekvenču diapazonā attiecīgās devās ietekmē cilvēku. Bet atkal - ir jāizšķir divas lietas - ietekmē cilvēku izmainot tā fizioloģisko struktūru, vai ietekmē cilvēku interferējot ar cilvēkā novērotajiem elektromagnētiskajiem procesiem, piemēram, smadzeņu neirālo oscilāciju. Pēc kārtas un tātad pirmais variants - izmainot fizioloģisko struktūru. Tikai aklam no dzimšanas nav priekšstata, kas ir gaisma. Gaisma ir elektromagnētiskais (EM) starojums. Vai gaisma mums var izdarīt kaut ko ļaunu? Un aizverot acis un neskatoties virsū? Nē? Nu un kā ar lāzeru? Daudzi zin lāzera pointerīšus - redzamā gaisma. Bet ar lāzeru var griezt metālu un operēt un ko tik vēl visu ne. Tātad - brutāli sakot - ar redzamo gaismu pareizos apstākļos cilvēku uz pusēm šodien pārgriezt  nogalināt var, pat ar konkrētu izdalītu redzamās gaismas viļņa garumu. Viss slēpjas enerģijā, intensitātē, ko šī gaisma nes. Pie tam, jo mazāks viļņa garums - augstāka frekvence - jo mazāk enerģijas vajadzīgs, lai izdarītu ļaunumu. Kāpēc Malaizijā cilvēki peldēties iet peldkostīmos, kas apsedz daudz ķermeni? Daudz saulītes skaistā vasaras dienā nevajag, lai nākošajā dienā mocītos ar sūrstošu ādu. Vēl tālāk uz mazāku viļņa garumu - rengena starojums - slimnīcās svina plāksnes un.. pie zobārsta apkaklītes un kas tik vēl ne. Gamma stari - Fukušima un Černobiļa. Pat nav nekas jādara, no tiem vaļā tik viegli netikt. Nu un uz otru pusi - frekvence mazāka, viļņa garums lielāks - siltumstarojums (infrasarkanais), mikroviļņi... esi kādreiz jaucis mikroviļņu krāsni? Tur iekšā mežonīgi liels transformators. Un jo tālāk uz šo otru galu, jo vairāk enerģijas nepieciešams. Nu un otra lieta- interference. Pēc manas saprašanas nekāds elektromagnētisks starojums netraucē un neiespaido cilvēka neirālo darbību caur interferenci.
-Nu, paga paga, jau pašā sākumā stāstīji, ka nervos ir elektroķīmisks signāla pārvades veids... Ir taču izpētīti alfa, beta, gamma, delta, theta un mju smadzeņu oscilāciju tipi....

-Jā, tieši tā. Ir tādi svārstību tipi. Pie tam visi tipi ietilpst ar frekvenci 0-100 Hz robežās. Taču - kas tās ir par svārstībām? Vai tās ir elektromagnētiskas svārstības? Patiesībā tās ir neironu (nervu šūnu) elektroķīmisko svārstību svārstības... Jā, neirālās oscilācijas - alfa, beta un pārējie viļņi ir centrālās nervu sistēmas aktivitātes ritmiskas un atkārtotas svārstības. Beigās atgriežoties pie tā, kur sākām - signāls jeb neirālā aktivitāte tiek radīta elektroķīmiskā ceļā. Bioķīmija ir neirālās aktivitātes cēlonis, savukārt elektriskie impulsi - neirālās aktivitātes manifestācija.
 -Tātad vienā teikumā atbildot uz šo pseidointervijas galveno jautājumu tu saki, ka ģeomagnētiskā vētra ietekmē neirālās aktivitātes mērījuma rezultātus, nevis pašu neirālo darbību.
-Jā. Tu (es) pareizi esi mani (esmu sevi) sapratis.


Iespējams, ka ir dažādas nekorektas nianses šajā pseidoStāstā. Komentāri atvērti piezīmēm, niansēm, labojumiem, ieteikumiem, norādēm uz kļūdām.

//Sveiciens Viesturam.

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