jQuery File Upload – asynchronous, mass files upload

Sorry, this entry is only available in Polski.

Posted in JavaScript, jQuery, Technical | Leave a comment

Lazy loading

Sorry, this entry is only available in Polski.

Posted in Google Maps, JavaScript, PHP, Technical, Design patterns | Leave a comment

Adding reversed numbers

Introduction

In this post, I will show my proposal of adding reversed numbers algorithm.

Problem is described on the website: http://www.spoj.pl/problems/ADDREV/ and appeared during the ACM Central European Programming Contest, Prague 1998.

General description of the problem

Input

The input consists of N cases (equal to about 10000). The first line of the input contains only positive integer N. Then follow the cases. Each case consists of exactly one line with two positive integers separated by space. These are the reversed numbers you are to add.

Output

For each case, print exactly one line containing only one integer – the reversed sum of two reversed numbers. Omit any leading zeros in the output.

Example

Sample input:

3
24 1
4358 754
305 794

Sample output:

34
1998
1

Shortly, program should work as follows:

  1. In the first line, we give the information, how many lines we will be processing.
  2. In the next lines, we have numbers separated with space. We should reverse digits in these numbers and add them together.
  3. In the next step, we should reverse digits in the generated results and display them in the consecutive lines in the output.

Proposal of the solution of the problem in the Ruby language

def addrev(n)
	b = 0
	n.split(' ').each do |a|
		b+= a.to_s.reverse.to_i
	end
	return b.to_s.reverse.to_i
end

a = true
i = j = 0
out = []

$stdin.each_line do |line|
	if(a) then
		i = line.to_i
		a = false
	else
		if(j != i)
			out.push(addrev(line.to_s))
			j += 1
		else
			break
		end
	end
end

out.each do |b|
	$stdout << b << "\n"
end
Posted in Algorithms, Ruby, Technical | Leave a comment

Reverse Polish Notation

Sorry, this entry is only available in Polski.

Posted in Algorithms, Ruby, Technical | Tagged | Leave a comment

Beginning

I was planning to create a blog some time ago, but I didn’t have enough time and motivation. This time, I’ve decided to finally create some kind of my e-notebook. I’m going to put here my ideas, experiments and inspirations connected with IT. I’m not sure yet about concrete topics of the articles, but I have some ideas about that. I’ll see how it works in practice and if anybody is interested in content presented by me. I assume, that when I teach somebody, I also teach myself. That’s why I will try to present here some solutions to different problems and description of interesting stuff. Maybe some posts will touch also non-technical topics. I’ll see. Blog consists of two language versions: Polish and English. I am not English native speaker, so I apologize for all my mistakes in advance. If you find some mistakes in my posts, please notify me about that in comments or send me an e-mail.

Technical stuff

During creating this blog, I used Pareto Principle and deployed free open-source software WordPress. I’ve installed plugin for responsive web design dedicated for current template, so you can browse this blog on various devices (netbooks, mobile phones with Android OS, iOS, tablets), plugin for multi-language website, Latex and syntax highlighter. Of course, I could spend a lot of time on writing my own blog software and probably it would be faster, but achieving such a great functionality like in WordPress would take me half of a year or even longer and final user wouldn’t see the big difference. Due to the fact, that content is going to be main value of this blog, that choice is justifiable.

Posted in No-category | Leave a comment