Archive for the ‘Uncategorized’ Category

Ultimate SEO URLs 5 small bugfix

Tuesday, July 27th, 2010

I noticed that some stores with multiple languages were behaving strange: If you click a given link, the store changed it’s display language.

Examining this problem further, I found that the culprit was in the “Main” link, which had to open the store’s main page, but it was switching the active language as well.

So, to duplicate the error, you have to create a link to any page, with some parameters. Then you create a new link to index.php WITHOUT ANY PARAMETERS.

The result is that the parameters from the first link are DUPLICATED in the second link.
You can reproduce the error by adding this code to any page:

echo tep_href_link('index.php', 'param1=xx&amp;param2=xy').'< br />';
echo tep_href_link('index.php');

It will show something like:

http://domain.tld/index.php?param1=xx&amp;param2=xy
http://domain.tld/index.php?param1=xx&amp;param2=xy

These parameters in the latter shouldn’t be here, correct?

The solution is quite simple, and involves adding 2 lines to the file includes/modules/ultimate_seo_urls5/classes/usu.php, in the function public function href_link.

I will let you think about it a little. Contact me if you need help in fixing this ;-)

About PHP 5.3 x oscommerce (deprecated functions)

Wednesday, June 16th, 2010

If you’re planning to upgrade your PHP5.2 to 5.3, I’d suggest you to review your web apps beforehand. Today I was testing this new version, and some of the deprecated functions -  which were to be removed only in PHP6 – are already launching error messages: At first, it is necessary to substitute all ocurrences of “<?” for it’s official equivalent “<?php“. And of course, the shorthand “<?=” must be turned into “<?php echo” The other problem is ereg* and eregi*, the deprecated regex functions, which should be replaced with their preg* equivalents. I will try to list here some of the equivalences and when possible, the regex conversion shortcuts, if any. (There’s a good article on converting these functions at http://brownfox.org/ebooks/webP/pcook/ch13_02.htm)

Conversion table for ereg* to preg* functions:

ereg* perl regex (preg*.)
ereg / eregi preg_match

Como imprimir um livro em frente e verso

Sunday, June 6th, 2010

De vez em quando eu preciso imprimir um livro em frente e verso em minha impressora e tenho um problema com a ordem de impressão. Para não perder mais (muitas) folhas, aqui estão as dicas:

  • ANTES DE IMPRIMIR, checar se a impressora está configurada para pular as páginas em branco. No driver da Canon laser, fica em Finishing > Finishing details > Skip Blank Pages Mode
  • imprimir as páginas ímpares, na ordem normal (1, 3, 5, etc);
  • imprimir as páginas pares na ordem inversa (2,4,6, etc – marcando o botão reverse order)

Só isso.  Porém tome cuidado ao imprimir o reverso, pois às vezes a impressora alimenta duas folhas ao mesmo tempo e a ordem das páginas fica trocada.

Se alguém tiver alguma outra idéia, por favor comente ;-)

Windows explorer error not running at startup

Saturday, May 8th, 2010

Run regedit from the start/search line, go to this key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

Locate the shell entry in the right pane and double click it. Replace the
contents with just:

explorer.exe

Click ok, then close the registry editor and restart the system.

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?

Edit: Mudei de idéia. Não deu para aguentar todas as animações e frescuras do Windows 7 – apesar de ser possível remover, meu novo projeto é colocar os aplicativos que uso no Linux Mint ou no Ubuntu

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)