Archive for the ‘Uncategorized’ Category

Windows 7: Finalmente vou trocar meu sistema!

Friday, January 29th, 2010

Todos que me conhecem sabem disso: eu sou totalmente averso a instalar o Windows Vista em meu computador de trabalho, devido a vários problemas, sendo o maior deles a falta de responsividade do sistema.
Entretanto, após algumas semanas usando o Windows 7 em uma máquina de testes, acredito que é hora de efetuar o upgrade aqui ;-)

(para quem quer saber por que não usar Linux: Topstyle passou a ser atualizado após vários anos.)

Alguém me acompanha?

Antivírus (Avast4Home) novo serial

Sunday, October 25th, 2009

Para os usuários do Avast que têm preguiça de efetuar o registro no site do Avast, o serial abaixo foi registrado este mês (out/2009):

W2275589H1400A0911-WTXY9SBD

O procedimento é clicar com botão direito no ícone do Avast > “Sobre o Avast” > “Chave de licença” > cole o serial.
Clique em OK e já poderá atualizar o programa por mais algum tempo. :-)

oscommerce SEO URLs x shared SSL

Tuesday, August 4th, 2009

Today I faced a weird problem with some stores using SEO URLs and also using shared SSL.

Background: shared SSLs are popular among hosting providers, where the users can use both http://www.mydomain/myfile.html AND https://ssl.myhosting.com/users/mydomain/myfile.html

This situation is quite useful for ecommerce sites, because you won’t have to purchase a SSL certificate (at least, not while you’re trying to setup your store) and still benefit from using encrypted transmission of data to/from your server.

osCommerce has the ability of jumping back and forth from both URL formats, e.g. in a moment you are in the home of the store, in http://www.mydomain.com/index.php and in the other, you click in my account and move to https://sss.myhosting.com/users/mydomain/account.php, all transparently to the user, besides the info in the address bar.

That’s good for users of the standard osCommerce script, but I’d say that many the stores use a contribution named SEO URLs, which rewrites the standard url of a product (example: product_info.php?product_id=XX) into a more readable format: my_products_title-p-XX.html), which helps a LOT in Search Engine Optimization (hence SEO URLs ;-)).

All the problem arises from two facts:

  • SEO URLs relies upon using mod_rewrite in Apache servers, which need a statement in .htaccess like
    “rewritebase /mystore/” to work, along with some rewrite rules.
  • The RewriteBase statement is not conditional, i.e., it cannot be differently for SSL or nonssl addresses.

It’s not a really big deal, since all rewritten urls *should*  be pointing to http addresses, and so any https addresses are not rewritten.

In other words: the links to products in your store are all pointing to http://www.mydomain.com/myproduct-p-xx.html and the a “rewrite base /” will suffice.

BUT, you cannot underestimate Murphy’s law. If a user sees https://sss.myhosting.com/users/mydomain/account.php, there’s a good chance that they can try to append the product’s URL in the address, just to check if they’re not being fouled into a phishing website. Something like:

https://sss.myhosting.com/users/mydomain/my_products_title-p-XX.html.

As the .htaccess file is set by the standard configuration, the above URL will return a 404 error, and your visitor may think it’s not the same website. So, what can we do?

I modified my .htaccess to create 2 sets of rewrite rules, one for http and other for https accesses, like these:

RewriteCond %{HTTP_HOST} ^ssl\.myhost\.com$ [NC]
RewriteRule ^(.*)-p-([0-9]+).html$ users/mydomain.com/product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-([0-9_]+).html$ users/mydomain.com/index.php?cPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-m-([0-9]+).html$ users/mydomain.com/index.php?manufacturers_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pi-([0-9]+).html$ users/mydomain.com/popup_image.php?pID=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pr-([0-9]+).html$ users/mydomain.com/product_reviews.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pri-([0-9]+).html$ users/mydomain.com/product_reviews_info.php?products_id=$2&%{QUERY_STRING} [L]

RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$ [NC]
RewriteRule ^(.*)-p-([0-9]+).html$ product_info.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-c-([0-9_]+).html$ index.php?cPath=$2&%{QUERY_STRING}
RewriteRule ^(.*)-m-([0-9]+).html$ index.php?manufacturers_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pi-([0-9]+).html$ popup_image.php?pID=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pr-([0-9]+).html$ product_reviews.php?products_id=$2&%{QUERY_STRING}
RewriteRule ^(.*)-pri-([0-9]+).html$ product_reviews_info.php?products_id=$2&%{QUERY_STRING} [L]

What are we doing here?
Those RewriteCond statements will limit the scope of each rewriterule block, so that one will work for https and the other will be OK for http accesses. Pretty straightforward, huh?

Neuroscience: How to explain music for the masses :)

Saturday, August 1st, 2009

“esta página pode conter um risco de segurança não especificado. deseja continuar?”

Sunday, May 17th, 2009

O erro do título aparece frequentemente quando preciso dar um clique direito, copiar arquivos ou outras ações em uma pasta de rede. A solução está no link abaixo:

http://www.howtogeek.com/howto/windows-vista/disable-the-annoying-this-page-has-an-unspecified-potential-security-risk-when-using-files-on-a-network-share/

Antivírus (Avast4Home)

Saturday, April 11th, 2009

Sempre me perguntam qual o melhor antivírus. Para não me extender muito, geralmente digo o antivírus que estou usando no momento, o que pode mudar de uma hora para outra.

Explicando melhor:

Um antivírus deve ser eficiente, atualizar constantemente e de preferência, usar poucos recursos de seu computador. Segundo esses princípios, o antivírus de minha preferência desde 2005 é o Avast4Home, que além das razões acime, é gratuito para uso não comercial.

É possível baixar uma versão para seu idioma em http://www.avast.com/eng/download-avast-home.html, procure na lista no final da página.

Para usar a versão gratuita é necessário efetuar um registro no site da Alwil, que pode sser acessada em http://www.avast.com/por/home-registration.php. Mude o idioma do site para potuguês usando o botão no topo da página.

Caso você não queira fazer o registro, pode simplesmente pedar o serial aqui: W83324142H1400A0211-1ZMK9XCY (válido até 1/jun/2010)

How to change the upload limit for an HTML form in PHP?

Friday, February 27th, 2009

I created an upload function for one of my scripts, and had a problem with the maximum size.So the steps to fix this situation are:

Change the .htaccess for the directory containing the upload script, adding the lines:

# Change upload setting to allow larger uploads
php_value upload_max_filesize 41M
php_value post_max_size 42M
php_value max_execution_time 400
php_value max_input_time 400

Important: the php_value post_max_size must be greater than php_value upload_max_filesize, since any upload will be part of the post variables.

In case you get an “Error 500: Internal server error” after placing the above lines in the .htaccess, it probably means that you server’s configuration is too restrictive.

Open your httpd.conf (or apache2.conf), look for a section such as

  ...
    AllowOverride Indexes AuthConfig Limit FileInfo
  ...
 
    Deny from all

and add “Options” to the allow override directive, as:

  AllowOverride Indexes AuthConfig Limit FileInfo Options

Also, if you don’t have it, add:

    Deny from all

to the same section. This will prevent the possibility of any file beginning with .ht* to be served o the browser, even if you forget to change it’s permissions.

Setting up a webserver with a ISP Control Panel

Sunday, February 1st, 2009

Setting up a webserver
I use to set my servers following the instructions from howtoforge, but there are a few missing settings due to my language:

Criando um “progress meter” com PHP 5.2 e APC

Monday, January 19th, 2009

Encontrei vários tutoriais sobre métodos de instalação de um progress meter a ser implementado em PHP. Como meu servidor roda Debian, aqui estão alguns passos necessários para a instalação:

Usando o APC (Alternative PHP Cache):

Instalar os pacotes necessários:

apt-get update
apt-get install apache-dev php4-dev

Instalar o pacote APC:

pecl install apc

Adicione as linhas ao seu php.ini (/etc/php5/apache2/php.ini)

extension=apc.so
apc.rfc1867 = 1

Nota importante: APC é incompatível com o Zend Optimizer, o que significa que o servidor não pode ser usando com vários pacotes comerciais que dependem do ZO…