1
2
3
4
import java.util.Scanner;

public class LeapYear {
...

Java On Leapyear

by Maciej Piechotka, October 16, 2008 19:05
1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
4
def cart(*lists):
    if not lists:
        for x in L:
...

Python On Permutation of values

by Maciej Piechotka, October 07, 2008 14:34 Star_fullStar_fullStar_fullStar_full

You looking for cartesian p...

1e8f141e7857d397d8020ed3b759e88a Talk

Ruby On Conditional Assignment

by Maciej Piechotka, September 21, 2008 23:45 Star_fullStar_fullStar_fullStar_fullStar_full

@danielharan:

Well - -100...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
4
#include <stdlib.h>
#include <string.h>

...

C On A Java-like function split

by Maciej Piechotka, September 16, 2008 10:42

YAR - it ommits the separat...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
4
#include <stdlib.h>
#include <string.h>

...

C On A Java-like function split

by Maciej Piechotka, September 16, 2008 10:06

May be something like that?...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
4
private static boolean areSame(File f1, File f2) throws IOException
{
  if(f1 == f2)
...

Java On fileContentsEquals

by Maciej Piechotka, August 19, 2008 08:14

I'm tring once more - I've ...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
def pluralize(string, length)
...

Ruby On simple pluralize

by Maciej Piechotka, August 19, 2008 08:09 Star_fullStar_fullStar_full

Only in the i18n/l10n frame...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
4
public static boolean fileContentsEquals(File file1, File file2) throws IOException {
  ByteBuffer buf1 = new FileInputStream(file1).getChannel().map(MapMode.READ_ONLY, 0, file1.length());
  ByteBuffer buf2 = new FileInputStream(file2).getChannel().map(MapMode.READ_ONLY, 0, file2.length());
...

Java On fileContentsEquals

by Maciej Piechotka, August 18, 2008 10:40

1. Yes. It will work on byt...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
4
require 'enumerator'

def fix_send_to_array(array)
...

Ruby On CSV turn in to an array of ...

by Maciej Piechotka, August 15, 2008 08:47 Star_fullStar_fullStar_fullStar_fullStar_full

May be something like that:

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
artists = [1, 2, 3]
column_1 = artists[0...(artists.size/2.0).ceil]
column_2 = artists[(artists.size/2.0).ceil...artists.size]

Ruby On Split an array into half

by Maciej Piechotka, August 14, 2008 13:45

The same rounding:

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
artists = [1, 2, 3]
column_1 = artists[0, artists.size/2]
column_2 = artists[artists.size/2...artists.size]

Ruby On Split an array into half

by Maciej Piechotka, August 14, 2008 13:41

Something like that (a bit ...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
def caesar(text, shift)
  text.split('').collect! {|letter| (letter[0] + shift).chr}.join
end

Ruby On Caesar Cipher

by Maciej Piechotka, August 10, 2008 18:43

Modification of Fabien Jaki...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
4
%w{user network thumbnail}.each do |obj|
  module_eval <<-"EOS", __FILE__, __LINE__
    def #{obj}_path(path)
...

Ruby On Same function repeated but ...

by Maciej Piechotka, August 08, 2008 21:39

May be something like that:...

1e8f141e7857d397d8020ed3b759e88a Talk

PHP On PHP5 Database Clas

by Maciej Piechotka, August 06, 2008 21:23 Star_fullStar_fullStar_fullStar_fullStar_full

Sorry for late response - s...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
class UsersController < ApplicationController

...

Ruby On showing records in Ascendin...

by Maciej Piechotka, August 06, 2008 14:00

Why you don't use JavaScrip...

1e8f141e7857d397d8020ed3b759e88a Talk

Ruby On showing records in Ascendin...

by Maciej Piechotka, August 06, 2008 13:54

Why you don't use JavaScrip...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
 require 'FileUtils'
...

Ruby On Rails - Multiple instances ...

by Maciej Piechotka, August 03, 2008 09:02 Star_fullStar_fullStar_fullStar_fullStar_full

May be something like that?...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
pools = {1 => [1,2,3], 2=> [3,4,5], 3=> [5,6,7]}
rej = Hash.new {0}
pools.values.flatten.reject! {|elem| rej[elem]++ != 1}

Ruby On Find the Intersection of Ar...

by Maciej Piechotka, August 01, 2008 07:03

The sort is unnecessary in ...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
pools = {1 => [1,2,3], 2=> [3,4,5], 3=> [5,6,7]}
rej = Hash.new {0}
pools.values.flatten.sort.reject! {|elem| rej[elem]++ != 1}

Ruby On Find the Intersection of Ar...

by Maciej Piechotka, July 31, 2008 22:03

May be something like that

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
4
# generate_bf.rb
# (copyleft) Matt Gauger 2008
# Randomly generates a brainfuck program
...

Ruby On Brainfuck Generator in Ruby

by Maciej Piechotka, July 31, 2008 20:31 Star_fullStar_fullStar_fullStar_fullStar_full

A little bit different work...

1e8f141e7857d397d8020ed3b759e88a Talk

Ruby On Exercise: Deaf Grandma

by Maciej Piechotka, July 30, 2008 18:55

@Wolfbyte - to keep the rub...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
class Invitation
  include Validatable
...

Ruby On Contoller refactoring

by Maciej Piechotka, July 30, 2008 11:46 Star_fullStar_fullStar_fullStar_full

Do it RESTful. Use fat mode...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
4
count_bye = 0
loop do
  word = gets.chomp
...

Ruby On Exercise: Deaf Grandma

by Maciej Piechotka, July 29, 2008 20:28

Only what within the task. ...

1e8f141e7857d397d8020ed3b759e88a Talk

PHP On PHP5 Database Clas

by Maciej Piechotka, July 21, 2008 19:24 Star_fullStar_fullStar_full

1. Why not PEAR DB?
2. Why ...

1e8f141e7857d397d8020ed3b759e88a Talk
1
2
3
4
.section .data
output:
	.asciz "Max = %d \n"
...

C On Find the max

by Maciej Piechotka, July 08, 2008 17:27

Modified version. May work ...

1e8f141e7857d397d8020ed3b759e88a Talk