Friday, December 19, 2008

Babel: a set of languages

While browsing Metalink you may find yourself surprised with such a Language selector. Wow i thought, maybe this is the next best thing. Soon we will be typing translate.google.com/ibmpower_to_linux64.

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

Wednesday, December 17, 2008

Cool name


#2. Hangman Utility – The Hang Manager (hangman) utility is a new 11g tool to detect database bottlenecks.

Friday, December 12, 2008

Special characters in shell

If you seeing some special characters using less, then you are in the right place. Bumped into this problem last evening, when i was trying to parse an utf8 coded html. You may write special characters in shell using (ctrl+v) (ctrl+x), where x is your desired character.
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

Wednesday, December 10, 2008

Crawling AJAX in practice. Part 1

Some theory

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

We had an argue today with my friend DeepM,
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

Quote from an unspecified source:

#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?

A web hosting company allegedly responsible for at least 75% of the daily spam volume worldwide has been forced offline, thanks to evidence gathered by security experts. Experts say the company hosts a vast community of cyber criminals including spammers, phishers, malware distributors and even peddlers of child porn. But will the move really take a bite out of cybercrime? Probably not. The criminals will in all likelihood move their operations elsewhere, most likely to an overseas host. As long as there are webhosting firms willing to look the other way, these shutdowns will only be temporary obstacles rather than permanent solutions.
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).

Thursday, October 30, 2008

Wednesday, October 29, 2008

Gliding season 2008

The whole season of 2008 can be rendered into this movie of my friends. nJoy!

noSPAM hits SPAM counter

more evidence on financial problems in spam market.


Friday, October 17, 2008

noSPAM hits SPAM counter

Im really happy to announce, that today for the first time in three years my spam counter reversed upside down, its possibly related to "World’s largest spammer nabbed". Of course the dynamic firewall filter i added a few months ago began to give results too. Anyways, server has nothin to do anymore ;)

Tuesday, October 14, 2008

Lithuania votes 2008


To vote or not to vote?
Voting sucks, the whole political circus sucks. Im myself absolutely politically apathetic and happily introduce you to "Lithuania votes parliament 2008".

Tuesday, October 7, 2008

spamchk

The original spamchk filter used by postfix is described on http://www.akadia.com/services/postfix_spamassassin.html. Remebered to post some advanced settings i made, you find it usefull if you want to split email to spam, nospam and inbetween (lightspam).

#!/bin/sh
# -----------------------------------------------------------------
# File:        spamchk
# Purpose:     SPAMASSASIN shell-based filter
# Location:    /usr/local/bin
# Usage:       Call this script from master.cf (Postfix)
# Certified:   GENTOO Linux, Spamassassin 3.0, Postfix
# -----------------------------------------------------------------

# Variables
#SENDMAIL="/usr/local/postfix/sendmail/sendmail -i"
SENDMAIL="/usr/sbin/sendmail -i"
EGREP=/bin/egrep

# Exit codes from
EX_UNAVAILABLE=69

# Number of *'s in X-Spam-level header needed to sideline message:
# (Eg. Score of 5.5 = "*****" )
SPAMLIMIT=4.5
SPAMLIMITKILL=6.1

# Clean up when done or when aborting.
trap "rm -f /var/tempfs/out.$$" 0 1 2 3 15

# Pipe message to spamc
cat | /usr/bin/spamc -s 1024000 -u filter > /var/tempfs/out.$$

#----- advanced AWK filter by simakas --------------------------------
# 050915 AWK part and splitting method to light_spam & spam

STATUS=`more /var/tempfs/out.$$ | grep -m 1 X-Spam-Status | awk '{print $3}' | awk -F= '{print $2}'`
warn=$(LC_ALL=C  awk 'BEGIN{if('$STATUS'>='$SPAMLIMIT')print "SPAM";else print "NOSPAM"}')
kill=$(LC_ALL=C  awk 'BEGIN{if('$STATUS'>='$SPAMLIMITKILL')print "SPAM";else print "NOSPAM"}')

# Are there more than $SPAMLIMIT stars in X-Spam-Level header? :
#if $EGREP -q "^X-Spam-Level: \*{$SPAMLIMIT,}" < /var/tempfs/out.$$
if [ "$warn" = "SPAM" ]
then
  # Option 1: Move high scoring messages to sideline dir so
  # a human can look at them later:
  # mv out.$$ $SIDELINE_DIR/`date +%Y-%m-%d_%R`-$$
  # Option 2: Divert to an alternate e-mail address:
  # 050915 Drop mail if SPAMLIMITKILL is reached or deliver it to human recheck
  #  if $EGREP -q "^X-Spam-Level: \*{$SPAMLIMITKILL,}" < /var/tempfs/out.$$
     if [ "$kill" = "SPAM" ]
     then
       #Drop it like its hot
       #cp /var/tempfs/out.$$ /tmp/`date +%Y-%m-%d_%R`-$$
       rm -f /var/tempfs/out.$$
     else
       #Or deliver to trashbox for human action
       $SENDMAIL trash@svelita.lt  < /var/tempfs/out.$$
     fi
  # Option 3: Delete the message
  #rm -f /var/tempfs/out.$$
else
  $SENDMAIL "$@" < /var/tempfs/out.$$
fi
# Postfix returns the exit status of the Postfix sendmail command.
exit $?

Wednesday, September 10, 2008

PL/SQL digits to words in Lithuanian

A PL/SQL function to convert numbers to words in Lithuanian, may be adjusted to your language rules. Maximum number 999999,99; decimal sign is ",". Execution example:

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

When first popular Oracle ApEx versions (like 1.6, 2.0) came out, they had problems with displaying SQL Workshop Object Browser windows on some FF versions, just dont remember which exactly (imho 2.2). Here we are again having the same problem: red screen. This time its new Google browser Chrome. The same problem can be found on ApEx versions 3.0, 3.1 and 3.1.2, havent tested this on others. The common solution back then was to add a few directives to Oracle HTTP_Server's configuration file httpd.conf:
AddType text/xml xbl
AddType text/x-component htc
No luck this time. Anyway, Chrome is just beta, hoping to have a better functionality soon.

Chrome myth

Just downloaded new fancy G browser Chrome. It actualy uses more memory than FF does. Chrome just divides it between processess. My FF has 48 tabs opened, it uses 148M RAM, get your calculator and calc this image below, only 24 tabs...

Wednesday, June 18, 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

Hi guys, you know, i'm proud to be Lithuanian, because we download Firefox and we download it gooooooooooooood. When the day started, i downloaded FF3 to all my PCs in the office (7), and didnt use the same copy to install, just downloaded a new one each time. Spread the news to many of my friends in messaging lists. And when i came home, i pushed it to all my PCs at home (4).
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

Haven't been in funeral for more than 18 years. Just successfully no one that i know died. But today i said goodbye to my ex-coworker. I young man just had a heart attack, and thats it. I was looking at him, he was like alive, his lips where smiling. He left two boys and loving wife.
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

Yo! Did an oil change today. Have you seen IT administrator doing that? Oh, what the hell, its an adventure. There is a show on Discovery - a man tries to find tough jobs and try them out. Ok. Very funny retardation. If you are normal human, you can do any job like being a soldier, builder, maker, drawer, constructor, designer, stunt man. Well you do need some knowledge, but these jobs are intuitive. Hey man, try to be a scientist, surgeon or at least an IT admin (doh). There are jobs that can be made only by trained human beings that spent 10-30 years trying to understand how stuff works.
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?