Friday, December 19, 2008
Babel: a set of languages
Thursday, December 18, 2008
We are sorry. Till the death (yours We mean). Sorry
Atsiprašome vartotojų, gavusių klaidingą sąskaitą
Šią savaitę dėl techninių nesklandumų dalis vartotojų gavo sąskaitą su eilute „Skola iki mirties". Eilutė atsirado dėl programinės klaidos sąskaitų formavimo metu.
Labai atsiprašome vartotojų, gavusių tokią sąskaitą.
VĮ „Visagino energija" administracija
Atsiprašome vartotojų, gavusių klaidingą sąskaitą
Šią savaitę dėl techninių nesklandumų dalis vartotojų gavo sąskaitą su eilute „Skola iki mirties". Eilutė atsirado dėl programinės klaidos sąskaitų formavimo metu.
Labai atsiprašome vartotojų, gavusių tokią sąskaitą.
VĮ „Visagino energija" administracija
Wednesday, December 17, 2008
Friday, December 12, 2008
Special characters in shell
When you use for example ^M in bash script - its not recognized, even if you edit it vith vi. I found the solution in perl forum.
grep ^D
(type ctrl-V ctrl-D)
perl -ne 'print if /\cD/'
Use \cx notation in shell scripting, where x is your desired character. Example:
less ubs.html | tr ',' '.' | sed 's/\cM/č/g' > ubs_normal.html
Thursday, December 11, 2008
Crawling AJAX in practice. Part 1
Traditionally, a web spider system is tasked with connecting to a server, pulling down the HTML document, scanning the document for anchor links to other HTTP URLs and repeating the same process on all of the discovered URLs. Each URL represents a different state of the traditional web site. In an AJAX application, much of the page content isn't contained in the HTML document, but is dynamically inserted by Javascript during page load. Furthermore, anchor links can trigger Javascript events instead of pointing to other documents. The state of the application is defined by the series of Javascript events that were triggered after page load. The result is that the traditional spider is only able to see a small fraction of the site's content and is unable to index any of the application's state information.
Some findings
I've googled around for a few days and have found various information about crawling tools. There are more, but some are forgotten to mention or haven't been tried. Here is a quick summary of tools for getting page source.
1) Right click, View page source. Well, a simple way to get page source, but you fall laughing when you see the dynamic page source. I was playing around with ubs.com -> quotes -> instruments.
2) Perl::Mechanize. It's a useful tool, i was happy using it, but the result is sadly though - static. It fills forms and follows links, but the final page source is static. It digs text, digs .css underneath, but avoids JavaScript. You can get a page source browsing only static version of webpage (which ubs.com has). This tools is useful for sabotage, for example you create disposable email accounts, vote online for a car of the year, read the passkey from you temp email, vote and repeat the loop again. No user interface needed, while testing use browser and
compare it to Mechanize agent->content.
3) Various Firefox extensions. Crap, the target was to build a GUI-less mechanism, these implementations though require user interaction. Extensions are based on tracking AJAX requests, recording user actions (like macros in Office). iMacros, ChickenFoot, Selenium. Here are the names. iMacros are error sensitive, for example first visit and getting a cookie differs from the subsequent visits. Mechanize for example is error proof for such actions. I haven't found use of other extensions, because most of them doesn't work on Minefield, nor RedHat's Firefox one point zero something.
4) Ruby + Watir. AJAX crawling after all! But there is a huge "but" - presenting IE. There are also Watir implementations on FF and Safari, haven't tested them. Ruby is also error proof, and i have achieved some progress, but the result is STATIC. Spent half a day looking for a way to save page content to file, spent one day more for looking how to get a full page source, but didn't manage that. Please inform me if i'm wrong, but anyways - skype has an emotion for coding on windows: (puke).
5) Yes you are right, saved the best for dessert. XULRunner + Crowbar. This stuff works and rocks and has an implementation, more about it in Part 2. Here is a quote: "...a server-side headless mozilla-based browser". It even sounds promising. It runs as a daemon, you can ask it, push it, get contents, and get AJAXed source. Its a browser based execution environment with a scraping tool on it. After you get your desired page source, its kinda trash: no newlines, bunch of HTML tags. Then there are few solutions - pass it to Lynx or process manually with a custom C code parser. At last we have the numbers, not a JavaScript function names.
Clarification
The purpose of this task is not to exactly crawl from one page to other, its only numbers that are pushed (AJAX'ed) via JavaScript that matters.
Part 2
Friday, December 5, 2008
MD create, overwrite question
does making software raid1 with mdadm overwrites the partition or at least garbages its superblock / partition table / file system, if someone bumps to this question one day in ones life, here is the answer: NO, it does not.
I took two sata partitions sda3 and sdb3, mkfs.ext3, copy some stuff to both of them.
In picture 1, you can see the contents.
Next i create md device using both partitions with command:
mdadm -Cv /dev/md1 -l1 -n2 /dev/sda3 /dev/sdb3
Mdadm kindly warns me, that partition, contains
file system with (probably) files in it. Thank you, i know what i'm doing. Just press "y".
Resync process starts, 1.5G takes a few seconds to resync.
Picture 3 below: resync in progress.
After process is done, i remount newly created md1 device, check its contents and VOILA - everything is in place.
New corner on the blog
#1. Authorized users should obtain the OSX files from Apple. It is illegal to obtain them from torrent sites by searching under the following keywords: “VMWare files for patched Mac OS X Tiger Intel”.
Thursday, November 13, 2008
Spam is yesterday?
Source: http://www.allspammedup.com/2008/11/source-of-75-of-sent-spam-forced-offline
If you watch the picture closer, you can see that there was no spam activity until local business hours, it shows the localization of the subject. We'll see the results tomorow.
And check out the yearly trend, of course there was some protection improvements, but the result is clear even to the horse. (Green=spam, blue (yes that invisible line at the bottom)=nospam).
Friday, October 31, 2008
Wednesday, October 29, 2008
Friday, October 17, 2008
noSPAM hits SPAM counter
Tuesday, October 14, 2008
Lithuania votes 2008
To vote or not to vote?
Wednesday, October 8, 2008
spamchk
Wednesday, September 10, 2008
PL/SQL digits to words in Lithuanian
select EBA_OLS_DIG_TO_WORD('Lt 999999,99') from dual;
Result:
devyni šimtai devyniasdešimt devyni tūkstančiai devyni šimtai devyniasdešimt devyni Lt. 99 ct.
Code:
create or replace function "EBA_OLS_DIG_TO_WORD"
(num in VARCHAR2)
return VARCHAR2
is
word VARCHAR2(1022); -- result variable
work VARCHAR2(20); -- given number converted to char
k NUMBER := 0; -- length
n1 VARCHAR2(20) := 'vienas'; -- digits
n2 VARCHAR2(20) := 'du';
n3 VARCHAR2(20) := 'trys';
n4 VARCHAR2(20) := 'keturi';
n5 VARCHAR2(20) := 'penki';
n6 VARCHAR2(20) := 'šeši';
n7 VARCHAR2(20) := 'septyni';
n8 VARCHAR2(20) := 'aštuoni';
n9 VARCHAR2(20) := 'devyni';
n0 VARCHAR2(20) := 'dešimt'; -- tens and thousands
nh VARCHAR2(20) := 'šimtas';
nhd VARCHAR2(20) := 'šimtai';
nt VARCHAR2(20) := 'tūkstantis';
ntd VARCHAR2(20) := 'tūkstančiai';
ntu VARCHAR2(20) := 'tūkstančių';
ty VARCHAR2(20) := 'asdešimt'; -- endings
c VARCHAR2(1); -- loop digit value
d VARCHAR2(1); -- 4th digit in 5 digit number (for ...teen numbers)
n NUMBER := 0; -- number variable, for other use cases
suf VARCHAR2(6) := ''; -- suffix value for cents (hundreds of money)
skip4 BOOLEAN := false; -- flag for skipping 4th digit in 5 digit number
BEGIN
work := substr(num,4); -- prefix "LT_" (3 digits, adjust if needed)
k := length(work); -- length
n := instr(work,','); -- looking for decimal
if (n > 0) then
suf := substr(work, n+1, k-n+1); -- reading cents
if (length(suf)=1) then -- ,8 to ,80 correction
suf:=suf'0';
end if;
work := substr(work, 1, n-1); -- number corection, skipping cents
k := length(work); -- length adjustment
end if;
FOR i IN 1..k -- loop
LOOP
c:=substr(work,i,1); -- next digit
if (skip4 = false) then -- skip this part for 4th digit in 5 digit number
case c
when '1' then if ((k-i+1 != 2)and(k-i+1 != 5)and(skip4 = false)) then word:=wordn1; end if;
when '2' then if ((k-i+1 != 2)and(k-i+1 != 5)) then word:=wordn2; else word:=word'dvi'; end if;
when '3' then if ((k-i+1 != 2)and(k-i+1 != 5)) then word:=wordn3; end if;
when '4' then word:=wordn4; -- gramma mess with 1,2 and 3 digits
when '5' then word:=wordn5;
when '6' then word:=wordn6;
when '7' then word:=wordn7;
when '8' then word:=wordn8;
when '9' then word:=wordn9;
--when '0' then word:=wordn0;
else null;
end case;
end if;
word:=word' '; -- space btw words
case (k-i+1) -- lets take a digits position
when 6 then begin -- X*****
if (c = 1) then -- singular
word:=wordnh' ';
elsif (c = 0) then -- nothing
null;
else
word:=wordnhd' '; -- plural
end if;
end;
when 5 then begin -- *X**** (difficult digit, may have teen numbers)
if (c = 1) then -- if its teen number (1*)
d := substr(work,i+1,1); -- next digit in teen numbers
case d
when '0' then word:=wordn0;
when '1' then word:=word'vienuolika';
when '2' then word:=word'dvylika';
when '3' then word:=word'trylika';
when '4' then word:=word'keturiolika';
when '5' then word:=word'penkiolika';
when '6' then word:=word'šešiolika';
when '7' then word:=word'septyniolika';
when '8' then word:=word'aštuoniolika';
when '9' then word:=word'devyniolika';
else null;
end case;
skip4:=true; -- skip 4th digit on the next loop
--exit; -- dont exit the loop
elsif (c = 0) then -- if its zero, do nothing
null;
elsif (c = 2) then -- gramma for "2*"
word:=trim(word);
word:=wordn0' ';
elsif (c = 3) then -- gramma for "3*"
word:=word'tris'n0' ';
else -- default thounsands
word:=trim(word);
word:=wordty' ';
end if;
end;
when 4 then begin -- **X***
if (skip4=true) then -- plural on teen numbers in 5th & 4th place
word:=wordntu' ';
elsif (c = 1) then -- singular
word:=wordnt' ';
elsif (c = 0) then -- plural
word:=wordntu' ';
else -- plural
word:=wordntd' ';
end if;
skip4:=false; -- stop skipping 4th digit
end;
when 3 then begin -- ***X**
if (c = 1) then -- singular
word:=wordnh' ';
elsif (c = 0) then -- nothing
null;
else -- plural
word:=wordnhd' ';
end if;
end;
when 2 then begin -- ****X* (same problem as with 5th digit)
if (c = 1) then -- if its teen number (1*)
d := substr(work,i+1,1); -- next digit in teen numbers
case d
when '0' then word:=wordn0;
when '1' then word:=word'vienuolika';
when '2' then word:=word'dvylika';
when '3' then word:=word'trylika';
when '4' then word:=word'keturiolika';
when '5' then word:=word'penkiolika';
when '6' then word:=word'šešiolika';
when '7' then word:=word'septyniolika';
when '8' then word:=word'aštuoniolika';
when '9' then word:=word'devyniolika';
else null;
end case;
exit; -- no more digits left, exit loop
elsif (c = 0) then -- nothing
null;
elsif (c = 2) then -- gramma with "2*"
word:=trim(word);
word:=wordn0' ';
elsif (c = 3) then -- gramma with "3*"
word:=word'tris'n0' ';
else
word:=trim(word); -- others
word:=wordty' ';
end if;
end;
else null;
end case;
END LOOP;
word:=word' Lt.'; -- add currency if needed
if (n > 0) then -- condition for suffix numbers
--word:=word' 'EBA_OLS_DIG_TO_WORD('ct 'suf)' ct.'; -- convert cents to words if preffered
word:=word' 'suf' ct.'; -- dont convert cents
end if;
return word; -- return
END;
Wednesday, September 3, 2008
Chrome vs Apex: old issues
Chrome myth
Thursday, June 19, 2008
Life v 1.1
Im a glider pilot now. Wohooooo. Yesterday received the Glider Pilot license from CAA.
Next week im going to Italy, wgc2008, im going as a crew member, but maybe some day you'll see me in the grid as a pilot :)
To get the license was much easier then pass Oracle exams, someday i'll post my Oracle license in a post Life v 1.2.
Lithuania rulez
Of course the final results look a bit unbelievable, i think its a small trick, you can write a 3 line code in shell to have a perfect downloader... I guess that some downloads from some IP addresses will be discarded. Anyways, world, can you be that cool like we are?
Anyways the FF3 isnt that good, and overall FF is not that user friendly. The best browser to work really intense is... ...Opera, the only feature that it lacks is page search toolbar the FF has. Opera has many fast tricks, like "g search", alt+space, quick dial, tabs on the side. I ussualy work with 20-30 pages, so to have the tabs on the side, its faster to find page you need. On a quick dial page i put MRTG pages of my servers. Opera is a better tool to do intensive work. The other FF problem is RAM usage... ...just checked: 114MB ram + 134MB swap. wtf ff?
Wednesday, May 7, 2008
Lost and Found
When people push themselves to risk on daily basis - its not so shocking to read in newspaper that some speed junkie, hill climber, sky diver or test pilot died. But this time, i was looking at man, to whom i spoke a week ago. He was just a good father, how risky can that be? Of course, you can say thats life, well it is!
When someone close dies, it takes away your time you spent doing something together. That feels empty. And today i feel empty too. Rest happily dear friend.
Sunday, March 2, 2008
Oil change
Anyways, missed my point. So i did an oil change, hurray, one more happy milestone towards becoming a decent man. What would be the tips for the future? Well.. 1) use a bigger funnel, first flow of motor oil will need at least 2-3 cm of pipe 2) prepare more light sources 3) don't use good shoes, this rule is common to all the garage work 4) think of some tool to remove an oil filter, this time few holes and a screw driver did the job 5) get some beer with you ;) burp.
And remembering to "The Earth" theme - i went to a gas station and put used oil to special containers they have for this purpose.
Wednesday, January 2, 2008
MOFO
Motorola (Motofone) F3! FINALLY. The engineers finally came to their minds. First, though small, sign was Win Server 2008 Core. And now, we have Motorola F3. "What functions does a decent phone should do" - i asked today my friend. "Em.. to call, not to call, text messaging, and em... oh, an alarm clock". Here you go i said - showed her the magical F3. I'll buy two more tomorow. A wonderfull thing. It also has free hands mode and vibro call, who turns in action on 0 volume and on 5+, so it can be fast found (on both sides). I prefer the speed of turning into virbo mode.
Some say that text messaging sux on this one, but its not so bad. Left/right Motorola style cursor, 5 special chars, no smilies - its enough. No dot sign though. But! - its Motorola, so it must have some secrets, and it does, wiki this phone and you'll find them. All functions like operator, pin, keysound change are in it, its just that they are kinda hidden. THANK YOU MOTOROLA.
It's definetely not the phone for 3rd world, its for everyone, this guy here does what a real phone should do - it has two buttons: red one and green one. What is your choice, Alisa?