Shorthand CSS: Estilos CSS en modo acortado para fondos, espacios, bordes, tipografia, listados

30/01/2013

background: color url (repeat|repeat-x|repeat-y|no-repeat) (top,right,left,bottom) (scroll|fixed);

margin/pading/border: (all | vertical horitzontal | top right bottom left);

border: width (none|solid|dashed|dotted|double) color;

font: (normal|italic|oblique) (normal|bold|100-900) size/line-height font-family);

list-style: (disc|square|circle) (outside|inside) url;

 

How to get a url to another urk key in current Magento store

29/01/2013

Don’t use:

<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB).’cms-or-catalog-url’; ?>

Use instead:

<? echo Mage::app()->getStore()->getUrl(‘cms-or-catalog-url’) ?>;

Things I learned by pretending to be blind for a week | Silktide blog

28/01/2013

1. A screen reader reads the entire desktop, not just the browser.

Somehow in my ignorance I assumed the screen reader was just the browser, but it???s not, it???s the entire operating system experience. From turning your computer on, you need to navigate using keyboard commands to the browser and open it.

If anyone tells you that a good way to experience websites as a blind user is to use obscure browsers like lynx or w3m (as someone tried to tell us on our Facebook page), just remember that it???s unlikely you???re getting the same experience as the majority of blind users.

2. It???s difficult

The learning curve is steep! Getting to know the keyboard shortcuts just to move around the page is difficult, as is remembering where those keys are on your own keyboard when you???re blindfolded! Oh yes, I did blindfold myself for the full experience, not at first, but gradually once I became more confident I knew what I was doing. Often I would navigate myself into a corner or option that I was unfamiliar with though, and had to take a peek to discover what had gone wrong.

Here???s a sample of what happens when you navigate to a page using a screen reader, it starts to read out every piece of content on the page, and I mean EVERY piece of content, and doesn???t stop until it???s melted your brain and the words merge together into a sea of electronic voice. If you want, you can listen to the entire page, but I learned from this screencast by visually-impaired user Robert William that it???s actually much better to wrestle for the control and navigate through the content yourself. Be prepared though to be baffled by hundreds of links and headings before you even get to the page content, or the link you want.

3. It???s different between browsers

The most popular browsers for blind users (according to WebAIM in May 2012) in Internet Explorer 8 (30.4%) and 9 (28.5) and Firefox (20%). My favourite browser is Chrome, which I started using, but soon realised the experience was very different between browsers, so switched to Firefox which actually does a very good job of accessible navigation.

It was when I viewed a page created by accessibility researcher Sina Bahram to demonstrate good accessibility that I discovered that Firefox automatically adds a landmark HTML5 elements without having to specify an ARIA role. I asked Sina why he didn???t add a role=???navigation??? to the element, which I thought was standard practice, and he replied:

???when there???s an actual HTML5 element to do the same thing, I tend to use the element. More semantic.???

He???s right, but of all the browsers I tested, this only created a landmark in Firefox.

There???s a video of Sina demonstrating accessing the web using a screenreader here.

4. You have to learn to listen fast

I once realised when watching a DVD on my Playstation 3 that you can set the speed to 1.5x. Which means you can finish watching a 2 hour movie in only 1hour 30 mins and still understand what???s going on. ???That gives me 30 minutes of life back!??? I said excitedly at the time, and started to fry my brain listening to their speeded up chipmunk voices. Of course I couldn???t take the unnatural high speed pace, and changed it back to normal pretty quickly. But that???s nothing compared to the speed Sina Bahram listens to his screen reader (see the first 40 seconds of the video linked above).

Even at a relatively casual pace though, it???s a lot of information to take in at once and often I would have to go back and listen again to the page options I???m given.

5. Some popular websites are very difficult to use

I was trying to use my screenreader to browse to the websites I use on a daily basis. Facebook, forget it. Despite articles telling me how accessible Facebook is in theory, the JavaScript and infinite scrolling page caused my screenreader to slow my computer to a crawl before I???d even started. In visually-impaired user Robert William???s screencast, he has issues with Facebook too, so uses the much more accessible mobile site.

I also tried Amazon.co.uk, but couldn???t get off the homepage which had over??? wait for it???. 1000 links! But it was very difficult to navigate to the main search box to search for an item (I actually thought it was impossible for the first few times I listened to the page, before finding it nestled between two other options), and had absolutely no ARIA landmarks. Very disappointing. A quick chat though with a blind friend of mine convinced me to use the much more accessible mobile site which worked much better. Still, a very aggravating experience that I had to find and use the mobile site instead, something I wouldn???t have done without experienced user knowledge.

6. Link titles aren???t helpful

This is one of the most surprising things I found actually. I???d always assumed text added to a link using the ???title??? attribute was read aloud by a screen reader instead of the link???s normal anchor text, allowing you to write useful information about the link???s destination. But it turns out, it???s not used at all. Ever. Except the rare time there???s no link anchor text at all. So any supposed ???useful??? text written in a link???s title attribute is completely inaccessible to a screen reader.

So don???t assume you can get away with plain links like ???click here??? or ???read more???, and provide descriptive title text, because it???ll never be heard.

System.xml and Magento System Configuration

26/01/2013

and

These tags allow you to set end-user facing text for your System Configuration field.

A label appears to the left of your form field, while a comment will appear directly under the field.

A label appears to the left of your form field, while a comment will appear directly under the field.

, ,

These are boolean fields with a value of 1 or 0. They indicate if the field will show up when viewing the System Configuration in the default view, the website view, or the store view.

The implicit assumption is that they also control what options are configurable at each level. However, there???s nothing on the backend enforcing this assumption. That is, a field may be configured to with the following

0

but it will still be possible (although not advisable) to set and retrieve this field???s value at the store level via programatic means.

The is a numerical value that???s used to determine the order of the fields within their group container. The higher the number, the lower the field will sort on the screen.

determines the type of field that will be used to collect the configuration value. Values supported in Magento 1.4 Community Edition are

  1. allowspecific
  2. export
  3. image
  4. import
  5. label
  6. multiselect
  7. obscure
  8. password
  9. select
  10. text
  11. textarea
  12. time

Basic attributes to define your admin fields in your Magento module.

Tip to debug objects in Magento development environment

25/01/2013

Change $_item with the object you want to debug and see methods and attributes:

$var=$_item;echo 'Class '.get_class($var).':';echo ''.implode("() ",get_class_methods($var));foreach($var->getData() as $k=>$v){        echo 'getData(''.$k.'')';}

 

Howto check if Magento core code has been modified

25/01/2013

Your magento is working weird, but there are no third-party extensions actived on the store?

Use standard *nix diff command to compare all current Magento files with corresponding files of default Magento.

$ diff -qrbB cleanmagento/app/code/core shop/app/code/core

Windows tip: Use WinMerge instead

 

Sort Matrix by Name In PHP

24/01/2013

$data = array(    array("firstname" => "Mary", "lastname" => "Johnson", "age" => 25),    array("firstname" => "Amanda", "lastname" => "Miller", "age" => 18),    array("firstname" => "James", "lastname" => "Brown", "age" => 31),    array("firstname" => "Patricia", "lastname" => "Williams", "age" => 7),    array("firstname" => "Michael", "lastname" => "Davis", "age" => 43),    array("firstname" => "Sarah", "lastname" => "Miller", "age" => 24),    array("firstname" => "Patrick", "lastname" => "Miller", "age" => 27)  );function compare_row($a, $b){  return strnatcmp($a['lastname'], $b['lastname']);}// sort alphabetically by nameusort($data , 'compare_row');

What is bad science/pseudoscience? (TEDx and bad science)

07/12/2012
What is bad science/pseudoscience?
There is no bright and shining line between pseudoscience and real science, and purveyors of false wisdom typically share their theories with as much sincerity and earnestness as legitimate researchers. Needless to say, this makes it all terribly hard to detect and define.
   
But here are some basic guidelines.
   
Marks of good science:
  • It makes claims that can be tested and falsified

  • It has been published in a peer reviewed journal (but beware… there are some dodgy journals out there that seem credible, but aren’t.)

  • It is based on theories that are discussed and argued for by many experts in the field

  • It is backed up by experiments that have generated enough data to convince other experts of its legitimacy

  • Its proponents are secure enough to accept areas of doubt and need for further investigation

  • It does not fly in the face of the broad existing body of scientific knowledge

  • The proposed speaker works for a university and/or has a phD or other bona fide high level scientific qualification

   
Marks of bad science:
  • Has failed to convince many mainstream scientists of its truth

  • Is not based on experiments that can be reproduced by others

  • Contains experimental flaws or is based on data that does not convincingly corroborate the experimenter’s theoretical claims

  • Comes from overconfident fringe experts

  • Uses over-simplified interpretations of legitimate studies and may combine with imprecise, spiritual or new age vocabulary, to form new, completely untested theories.

  • Speaks dismissively of mainstream science

  • Includes some of the red flags listed in the two sections below

Red flag topics:
Food science: anti or pro Genetically modified foods, Food as medicine.
Causes of and cures for autism hoaxes
“Healing,” including reiki, energy fields, alternative health and placebos, crystals, pyramid power
“Free energy” and perpetual motion machines, alchemy, time travel
The neuroscience of [fill in the blank] — not saying this will all be non-legitimate, but that it’s a field where a lot of goofballs are right now
The fusion of science and spirituality. Be especially careful of anyone trying to prove the validity of their religious beliefs and practices by using science

5 Ways To Ensure Google Analytics Is Running Perfectly – Analytics Blog

30/11/2012

Know What Your Site Sends To Google Analytics

The Google Analytics team built a Chrome extension that is intended to help you debug your implementation. Here is what you will be able to do using the extension and a screenshot of how you will see the data:
This extension loads the debug version of the Google Analytics Javascript for all sites you browse using Google Chrome. It prints useful information to the Javascript console. These messages include error messages and warnings which can tell you when your analytics tracking code is set up incorrectly. In addition, it provides a detailed breakdown of each tracking beacon sent to Google Analytics.

Important tip: this extension can also be used for competitive analysis. If you use it while browsing your competitors’ websites you will learn how they are tracking their customers.

Protecci?? htaccess amb contrasenya htpasswd

27/11/2012

$ cd /home/usuario/

$ htpasswd -c .htpasswd usuario
New password:
Re-type new password:

# vi public/.htaccess

 

AuthUserFile /home/usuario/.htpasswdAuthType BasicAuthName "Private Folder"<LimitExcept POST>    Require valid-user</LimitExcept>