Drag-n-drop file upload

As a continuation of previous article about new issues in html5, I found a demo where file upload is already working with usual drag and drop on to the browser Firefox 3.6. Mostly its all draft and hacks right now. If you look at the code, you can see browser-specific params like

event.dataTransfer.files
event.dataTransfer.mozTypesAt(0)
event.dataTransfer.files[0].getAsBinary()

A file is send with similar ajax method sendAsBinary (). Since there are no confirmation, it may be a bit dangerous because user can accidentally send entire C: \Windows directory. So it still needs all kinds of filters and validations as to what specifically can be uploaded and how deep.

Jquery dnd-upload

I wrote two jquery-plugins - one to support Firefox 3.6 (Namoroka) HTML5 upload, and one to support Google gears. You can use both together..

The easiest option for gears:

$('#drop_area').uploadg({gate:'http://somesite.com/upload_here_path/'});

Note that the key received from the server the file is "file" (in PHP its $ _FILES [ "file"] respectively ). And here is an extended example of code initialization..

var dragndropConfig={
beforeLoad:function(){
this.gate=some_dynamic_file_upload_url+'?parentID='+SomeOtherDynamicObject.ID;

if(SomeDisableReason){
this.can_proceed=false;
}
},

onProgress:function(event) {
if (event.lengthComputable) {
var percentage = Math.round((event.loaded * 100) / event.total);
if (percentage < 100) {
$('#some_progress_div').html('Uploading file..'+percentage+'%');
}
}
},

onComplete:function(event,txt) {
$('#some_progress_div').html('done');
}
};
if (window.google && google.gears){
$('#drop_area').uploadg(dragndropConfig);
}
else{
$('#drop_area').upload5(dragndropConfig);
}

Attention, Google gears still has bugs associated with such a load and has apparently halted development state because of upcoming html5 features.

See also plupload

Georgian-Ossetian conflict, russian opinion

Kill one person & it's murder; kill thousands & it's a foreign policy.
-modern black humor

On midnight of 08.08.2008, georgian artillery began to attack South Ossetian capital - Tshinvali as a part of military operation "Clean field". All western media was at that time kept quiet, and only after Russian intervension did the media start to shout about "russian aggression". So, being quite independent blogger, I have decided to share my thoughts on this topic.

No doubt that military advances in independent country region is bad. Still, what should you do, when heavy artillery is attacking and destroing hospitals? Israel when faced, decided to attack Lebanon gorillas when they took 2 israelis as hostages. USA no doubt had no trouble attacking Iraq and Afganistan, searching for weapons of mass destruction. So how is this diffrent? Are 1500 dead ossetians in the first day of war are too few?

Firstly - its peacekeeping forces that were attacked and some (15 men) killed. Secondly - South Ossetia and Abhkasia in the first place are de-facto not under Georgian rule. They never were. Administrative control of Tbilisi was created in USSR time because of geographical reasons. Ossetia by itself was far longer independent entity in Russian empire than Georgia.

Lastly - the conflict outgrows Georgia, becoming the point where unipolar world of USA wants to grab another bite and disrupt field of influence of Russia which grows steadily mainly because of natural gas and oil. And this region was valueable for its resources even half century ago - thats why Hitler turned south after loosing Moscow battle in 1940-1941.

Morality

Premier-minister Putin accused USA in cynism and unwillingness to reach peacefull regulation in the conflict area.

Its a pity that our partners don't help us, but try to confuse. I mean USA help in tranportation of dislocating in Iraq georgian troops to Georgia using airplanes.

What is astonishing is not the cynical politics, but its scale - to show white as black and black as white. Ability to craftly display aggressor as a victims of aggression.

Saddam Husein, no doubt was needed to hang because of shiite villages he destroyed. But georgian rulers, which in a matter of hours wiped of the face of the Earth 10 ossetian villages and who crushed children and old aged with tanks, burned alive peacefull population in barns - these  rulers of course must be taken under protection.

Cornering Russia

Mostly all of post-USSR republics are somehow ashamed of their past, not liking Russia and turning their faces west with "colorful revolutions". It is mainly caused by resentment of lost time, people, freedom and wealth that USSR took and because in their minds all fame went to Russia with all space programms and nuclear power...

Still, black heart cannot lead to glory in my opinion. It may give you wealth at first, because Europe and the west is interested in new members. But in time, I think new generation will realise that living with big neighbour must not cause fear and psychotic complexes in entire nations, because firstly it is not benefitial in business, secondly its bad for your health, and lastly - it doesn't make you safer, because as Roman emperors always said - divide et impera.

The perfect example of right nation psychology, I would propose Kazakhstan, which Sasha Baron Cohen did laugh about, but which stands constantly friendly with Russian politics.

I thing the following dialog explains big politics very well…

—Why, of course, the people don't want war. Why would some poor slob on a farm want to risk his life in a war when the best that he can get out of it is to come back to his farm in one piece. Naturally, the common people don't want war; neither in Russia nor in England nor in America, nor for that matter in Germany. That is understood. But, after all, it is the leaders of the country who determine the policy and it is always a simple matter to drag the people along, whether it is a democracy or a fascist dictatorship or a Parliament or a Communist dictatorship.
—There is one difference. In a democracy, the people have some say in the matter through their elected representatives, and in the United States only Congress can declare wars.
—Oh, that is all well and good, but, voice or no voice, the people can always be brought to the bidding of the leaders. That is easy. All you have to do is tell them they are being attacked and denounce the pacifists for lack of patriotism and exposing the country to danger. It works the same way in any country.

Herman G?ring, Nuremberg War Crimes Trials (18 April 1946)


See also:

Methods of clearing oil spills at sea

The purpose of this article is to overview existing methods of clearing oil spills at sea and to recommend the best solution.

Historically, clearing oil by burning was the most spread way, but it is not completeley successfull because it required special equipment, plus fires can be extinguished during storms in anaerobic conditions. That is why other solutions were found.

Fence booms, round or curtain booms and inflatable booms are one family of containment and control equipment that can be easily installed before more sophisticated equipment arrives. It also can minimize spill area and stop it from spreading, however it cannot deal with effective elimination, especially in rough conditions when oil escapes from underneath.

This is why heavy chemical "artillery" is needed. Two main categories of chemicals can be used. First one deal with increasing oil density and thus sinking it, polluting the shelf or ocean bottom. Second one breaks oil in several substances, making practically no harm to plant and marine life.

What can be recommended in case of emergency is to localize oil spills if it is possible with booms, if not - to burn it. After localization, oil should be treated with dispersants which would break it without any harm done.

See also:

Biography

My name is Artjom Kurapov and I was born in Tallinn. I spent my youth mostly in Ukraine. By fifth grade I returned, continued studying and received Estonian citizenship. I am a professional web-developer, which means that i do it for a living, not that i am guru. I specialize in php and relational databases (oracle, mysql, postgre) and javascript (ajax, prototype). I am amateur in photography, SciFi and blogging.

Out of memorial dates i would pick..

  • My birth on the 11 of january 1985 at 04:15, Capricorn.
  • My study before year 2002 in Tallinn Central Russian Gymnasium (thats what we call high school and college in one). Did some math olympics in 2000, visited Tartu.
  • During the summer of 2002 i have started studying in Tallinn Technical University with the chair of informatics, specializing in computer and system engineering.
  • On the summer of 2004 I received my driver's licence.
  • In december 2004 I have decided that working would also be nice, thats how I got to Mikare.net as web-developer.
  • 13 july 2005 after medical commission i started serving in the army, and after training in communications batalion,i have received drivers licence for driving trucks and military personell, later on i was directed to military support center.
  • 13 june 2006 I wase demobilized and on the next day I left Mikare baltic for a new place Web Expert with a position of senior web-developer.
  • 18 may 2007 I left Web Expert and went to Elitec
  • 11 january 2007 I finished my last exam
  • 11 june 2007 I got "B" in my bachelor's degree diploma on topic "Agile web crawler: Design and implementation".
  • 17 june 2007 I was baptised in Russian Orthodox P?htitsa Convent
  • 17 august 2007 I married a wonderful pianist, Dina.
  • As of september 2007 I am studying at the Tallinn Technical University to become a magister in infotechnology.

Agile web crawler : design and implementation. Artjom Kurapov BSc work.

Introduction

The Internet has over 90 million domains [1], over 70 million personal blogs [2] which are viewed by over 1 billion people around the world [3]. In this vast space of information it is important to create order even without global scale. This may be done either by building classification catalog or a search engine. Both of them require a web-crawling tool to ease the burden of manual data processing. How it can be built is a question this work raises.

Deciding architecture scale is the first step. Data management functions, such as link extraction, can be divided among system components – crawler, indexer, ranker, lexicon due to robustness requirements. For example Google has over 200 000 servers [4], and dividing processing and network loads is essential for building fast and reliable computation processes.

The way crawler interprets data and how it is used further leads to the following types:

  • Knowledge focused crawlers classify page by topic, extract only relevant data, use data mining filters and interact with data more like humans do.
  • Freshness crawlers extract data fast and regularly, analyze what has changed, adjust to update frequency. This is used by news and RSS feed crawlers.
  • Experience crawlers focus on making full document copy and storing it for a long time. A good example is Internet archive [5] and backup services.

In practical part of this thesis, a general crawler is designed, which incorporates basic methods from these types, but its main aspect is the agility if offers for the developers. This data extraction tool, can be used on most of modern hosting platforms. For source storage - a single MySQL database [6] is used and entire crawler application source is written in PHP [7] server-side language which is run in CLI mode on Apache server [8].

Although market offers many services that index, order and provide data, the author found few solutions that were available with open source and under LAMP. Data extraction tools are needed more than ever and not only with indexing a page, but with tracking changes, exporting data to other applications, analyzing an existing web-site. That is why the author has decided to make own program which would be available for changes to open public. Examining different algorithms should clear out its purposes and what is the most suitable for this work.


Some loss of fidelity can be seen because of reformat to Word 2003 version.