Archive for category I am half a robot

Įspūdžiai iš LOGIN 2010

Žodžiu pranešimai buvo cool (kai kurie nebuvo), konferencija smagi, viskas oki, ties tuo per daug nesiplėsiu. Tačiau apibendrinus – likau maloniai nustebintas :)

O aš tiesiog noriu paminėt porą projektų iš barcamp:

AdTaily.com

Awesome projektas, kurio pagrindinė esmė – kontekstinė reklama tavo puslapyje.

Turi blogą? Jėga! Užsiregistruoji pas juos, įdedi widgetą pas save ir lauki.

Kažkas užsuka pas tave į blogą ir sumąsto, kad būtų šaunu turėti savo reklamą čia. Spaudžia “Add advertisment”, įkelia bannerį, susimoka, tu patvirtini reklamą, pinigai įkrenta į tavo sąskaitą, užsakovo reklama sukasi.

Labai šaunus ir lengvas būdas reklamai. Plojimai kolegoms iš Lenkijos. Eikit ir bandykit!

Zooma.lt

Nekilnojamo turto skelbimų portalas su paprasta ir genialia mintimi. Skelbimus pateikti ne sąrašuose, o ant žemėlapio.

Turi gražią vartotojo sąsają ir įvairius žemėlapinius pokštus. Cool!

Tai va tiek šiam kartui :)

4 Comments

Fujitsu Amilo Pi 1505 squeaking, crackling, scratchy sound

I installed Ubuntu 9.10 into my Fujitsu-Siemens Amilo Pi 1505. It has Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller. I had this horrible squeaking, crackling sound which would get worse when CD was accessed.

It would even play when I muted the PCM input.

The solution was to install gnome-alsamixer and mute the CD channel.

  1. sudo apt-get install gnome-alsamixer
  2. Applications -> Sound & Video -> GNOME Alsa mixed
  3. Mute the CD channel

Here you go! No more crackling sound!

Hope this helps someone.

1 Comment

Getting Hash keys exchanged with values (PHP’s array_flip)

In PHP there is a nifty function that exchanges Hash keys with values: array_flip.

You can have it in Ruby easily too:

hash = {:a => 1, :b => 2, :c => 3}
> pp hash.to_a
[[:c, 3], [:a, 1], [:b, 2]]
>  pp Hash[*hash.to_a.flatten.reverse]
{1=>:a, 2=>:b, 3=>:c}

You can define it as a method of Hash:

class Hash
  def flip
     self.class[*self.to_a.flatten.reverse]
  end
end

>  pp {:a => 1, :b => 2, :c => 3}.flip
{1=>:a, 2=>:b, 3=>:c}

Beware this only works on simple scalar hashes. Check out this proposal for better way.

1 Comment

Laiko sukiojimai

Hm, čia tik man vienam taip, ar ir kitiems Omnitel vartotojams? Po laiko pasukimo SMS’ai iki šiol ateina 1 valanda iš ateities. Nice? :D

No Comments

PHP5 vs Ruby

<?php

class Base {
  static function create() {
    return new self;
  }
}

class Child extends Base {}

var_dump(Child::create());

?>

vs

class Base
  def self.create
    new
  end
end

class Child < Base
end

puts Child.create

What do we get?

In PHP (PHP 5.2.9-2 (cli) (built: Apr 9 2009 08:23:19)): object(Base)#1 (0) {}
In Ruby (ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]): #<Child:0x2880610>

Hopes that PHP6 fixes this.

2 Comments

Funny Ruby

a = a

You would imagine it would raise NameError if a was not defined, right? Not! It would just set a to nil :) Evil…

No Comments

Internet Explorer (IE) doesn’t show JPEG images with CMYK profile

Fun fact: IE doesn’t show CMYK jpeg images. So if you’re wondering some day why your image doesn’t show in IE, but works fine eveywhere else – checks it’s color profile (IrfanView might do the trick)

No Comments

Man patinka Ruby dokumentacija :))

------------------------------------------- Object#instance_variable_set
     obj.instance_variable_set(symbol, obj)    => obj
------------------------------------------------------------------------
     Sets the instance variable names by _symbol_ to _object_, thereby
     frustrating the efforts of the class's author to attempt to provide
     proper encapsulation. The variable did not have to exist prior to
     this call.

No Comments

Featureful ieškok.lt

Šiaip visai patogiai padaryta, bet vieno dalyko nepadarė. Nėra kaip pažiūrėti ar tu žiūrėjai anketa, ar ne. Na ką gi, dėka Firefox ir Greasemonkey – dabar jau yra ;)

Prašom: http://userscripts.org/scripts/show/49966

No Comments

RubyConf 2009.2 video medžiaga

http://distance.ktu.lt/vips/join.php?sr=547

Matoma tik su IE ir WMP :(

No Comments