<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss version="2.0">
				<channel>
					<title>Reinhold Weber</title>
					<link>http://www.reinholdweber.com</link>
					<description>The life, work and thoughts of Reinhold Weber, a German new media designer and developer.</description>
					<language>en-us</language>
					<copyright>Reinhold Weber</copyright>	<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/ReinholdWeber" type="application/rss+xml" /><item>
					<title>Textmate editor for effective web development (HTML, CSS, PHP) workflow</title>    
					<description>&lt;p&gt;Like most developers I've used my fair share of IDE's and editors over the years. What stuck was Zend Studio, Eclipse with PDT, PHP Designer and lately Netbeans for PHP.&lt;/p&gt;

&lt;p&gt;Somehow, looking back there always was something not quite right and over time really annoying. Right now I've settled with my preferred text editor on the Mac - Textmate. While using a IDE does not make you a good and effective developer, mastering most of them will benefit you in ways you never thought of. I am by nature a lazy bastard, what I really want is an IDe or texteditor for almost eberything I do wih one set of commands to get effective. I do frontend stuff (HTML, CSS, JavaScript, XML) as well as backend stuff (PHP, Python, Ruby) and would like to use one program for all of them, this is where Textmate comes in and sweps all the others far far away&lt;/p&gt;

&lt;p&gt;Sometimes it's the little things, searching Google for that damn "lorem ipsum" generator website, just type &lt;span class="shortcut"&gt;lorem &amp;#x21E5&lt;/span&gt; and you get a whole pargraph of pseudo latin sample text, having several lines of text waiting to be turned into an HTML list, just select all the lines and type &lt;span class="shortcut"&gt;&amp;#x2303; &amp;#x21E7; command w&lt;/span&gt; and Textmate wraps each individual line in paragraph tags, type "li" and everything miraculously converts to an HTML list.&lt;/p&gt;

&lt;p&gt;Oh yeah, this is a work in progress and mostly for self-reference.&lt;/p&gt;

&lt;h3&gt;Backend Programming&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;PHP Bundle&lt;/li&gt;
&lt;li&gt;PHP Code Completion Bundle&lt;/li&gt;
&lt;li&gt;phpDoc Bundle&lt;/li&gt;
&lt;li&gt;Git Bundle&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;Frontend Development&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;Text Bundle&lt;/li&gt;
&lt;li&gt;HTML Bundle&lt;/li&gt;
&lt;li&gt;CSS Bundle&lt;/li&gt;&lt;/ul&gt;

&lt;h3&gt;CMS work&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;Joomla Bundle&lt;/li&gt;
&lt;li&gt;Drupal Bundle&lt;/li&gt;
&lt;li&gt;Wordpress bundle&lt;/li&gt;
&lt;li&gt;Typo3 Bundle &lt;/li&gt;&lt;/ul&gt;

&lt;h4&gt;CSS&lt;/h4&gt;
&lt;ul&gt;&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2303; + alt + q&lt;/span&gt; compress css&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2303; + q&lt;/span&gt; expanded format css&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x238B;&lt;/span&gt; code completion&lt;/li&gt;

&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2303; + &amp;#x21E7; + d&lt;/span&gt; duplicate line&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2303; w&lt;/span&gt; select word&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2318; &amp;#x21E7; l&lt;/span&gt; select line&lt;/li&gt;&lt;/ul&gt;

&lt;h4&gt;Text&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;ctrl shift k&lt;/span&gt; delete current line&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;ctrl shift j&lt;/span&gt; merge current line with next lines&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;ctrl esc&lt;/span&gt; shortcuts overview&lt;/li&gt;
&lt;/ul&gt;


&lt;h4&gt;HTML&lt;/h4&gt;
&lt;ul&gt;&lt;li&gt;&lt;span class="shortcut"&gt;lorem &amp;#x21E5&lt;/span&gt; generates one paragraph of sample "lorem ipsum" text&lt;/li&gt;

&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2303; &gt;&lt;/span&gt; insert open close tag (type something then apply)&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2303; &amp;#x21E7; w&lt;/span&gt;wrap selection in open close tags&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2303; &amp;#x21E7; command w&lt;/span&gt; wrap each selected line in open close tag&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2303; &amp;#x21E7; l&lt;/span&gt; wrap selected text with link from clipboard&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2303; &amp;#x21E7; k&lt;/span&gt; deletes current line&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2303; &amp;#x21E7; j&lt;/span&gt; merges current line with the next line&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2303; &amp;#x21E7; t&lt;/span&gt; to-do list. this feature scans your project for items labeled with 'FIXME:', 'TODO:', 'CHANGED:' and provides a list of them along with their comments and a link to that file and line.&lt;/li&gt;&lt;/ul&gt;

&lt;ul&gt;&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2318; + r&lt;/span&gt; run ruby/python script&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2318; + &amp;#x21E7; + r&lt;/span&gt; run php script&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2303; w&lt;/span&gt; select word&lt;/li&gt;

&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2318; t&lt;/span&gt; go to file&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2318; &amp;#x21E7; t&lt;/span&gt; go to symbol classes, methods ...&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2318; &amp;#x21E7; f&lt;/span&gt; find in project. useful for mass search and replace operations or just finding where a function is defined.&lt;/li&gt;

&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2318; &amp;#x21E7; 7&lt;/span&gt; convert any special chars to html entities&lt;/li&gt;&lt;/ul&gt;
	
&lt;h4&gt;PHP&lt;/h4&gt;
&lt;ul&gt;&lt;li&gt;&lt;span class="shortcut"&gt;def &amp;#x21E5&lt;/span&gt; define a constant&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;req &amp;#x21E5&lt;/span&gt; require a file&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;req1 &amp;#x21E5&lt;/span&gt; require_once&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;incl &amp;#x21E5&lt;/span&gt; include a file&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;incl1 &amp;#x21E5&lt;/span&gt; include_once&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;$_ &amp;#x21E5&lt;/span&gt; Chosse different globals ($_GET, $_POST, $_SESSION, $_SERVER, ...)&lt;/li&gt;
&lt;/ul&gt;
&lt;h5&gt;Arrays&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;array &amp;#x21E5&lt;/span&gt; new array&lt;/li&gt;
&lt;/ul&gt;


&lt;h5&gt;Control Structures&lt;/h5&gt;
&lt;ul&gt;&lt;li&gt;&lt;span class="shortcut"&gt;if &amp;#x21E5&lt;/span&gt; if conditional statement&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;ifelse &amp;#x21E5&lt;/span&gt; if else conditional statement&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;if? &amp;#x21E5&lt;/span&gt; if else conditional statement using the ternary operator&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;switch &amp;#x21E5&lt;/span&gt; switch conditional statement&lt;/li&gt;&lt;/ul&gt;

&lt;h5&gt;OOP&lt;/h5&gt;
&lt;ul&gt;&lt;li&gt;&lt;span class="shortcut"&gt;class &amp;#x21E5&lt;/span&gt; start a class with constructor&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;fun &amp;#x21E5&lt;/span&gt; public method&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;throw &amp;#x21E5&lt;/span&gt; throw new exception&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;try &amp;#x21E5&lt;/span&gt; wrap in try catch block&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;parent &amp;#x21E5&lt;/span&gt; insert call to parent&lt;/li&gt;&lt;/ul&gt;

&lt;h5&gt;PHPDoc&lt;/h5&gt;
&lt;ul&gt;&lt;li&gt;&lt;span class="shortcut"&gt;/** + &amp;#x21E5&lt;/span&gt; start docblock&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;doc + &amp;#x21E5&lt;/span&gt; post-doc&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;doc_c + &amp;#x21E5&lt;/span&gt; class&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;doc_d + &amp;#x21E5&lt;/span&gt; constant&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;doc_f + &amp;#x21E5&lt;/span&gt; function&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;doc_s + &amp;#x21E5&lt;/span&gt; function signature&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Git Version Control&lt;/h4&gt;

&lt;h5&gt;Version control with Git/Subversion&lt;/h5&gt;
&lt;ul&gt;&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2303; &amp;#x21E7; G&lt;/span&gt; Git commands menu&lt;/li&gt;
&lt;li&gt;&lt;span class="shortcut"&gt;&amp;#x2303; &amp;#x21E7; A&lt;/span&gt; Subversion commands menu&lt;/li&gt;&lt;/ul&gt;

</description>
					<link>http://www.reinholdweber.com?p=52</link> 
				</item>	<item>
					<title>OOP example with inheritance in PHP, Ruby and Python</title>    
					<description>&lt;p&gt;Note to self for future reference, I'm learning Python and Ruby this year, this is just a 10 minute comparison I made today and I know I will loose the files somewhere soon.&lt;/p&gt;

&lt;p&gt;Without a doubt the Ruby and Python snippets are more aesthetically pleasing to the eye and although they look almost the same for the untrained eye, the approach is fundamentally different.&lt;/p&gt;

&lt;h3&gt;Example with PHP&lt;h3&gt;

&lt;pre&gt;
class Species {
	private $_type;
	private $_name;
	
	public function __construct($type, $name) {
		$this-&gt;_type = $type;
		$this-&gt;_name = $name;
	}
	
	public function __get($fieldName) {
		switch ($fieldName) {
	      case "type":
	        return $this-&gt;_type;
	      case "name":
	        return $this-&gt;_name;
	      default:
	        throw new Exception("Attempted to access invalid property: ".$fieldName);
	    }
	}
}

class Human extends Species
{

	public function getLegs() {
		return 2;
	}
}


$person1 = new Human('Neanderthal', 'Reinhold Weber');
echo $person1-&gt;name;
echo ' has '.$person1-&gt;getLegs().' legs.';
&lt;/pre&gt;

&lt;h3&gt;Example with Ruby&lt;h3&gt;

&lt;pre&gt;
class Species
  attr_accessor :type, :name  
  def initialize(type, name)
    @type = type
    @name = name
  end
end

class Human &lt; Species
  def getLegs
    return 2
  end
end

person1 = Human.new 'Neandethal', 'Reinhold Weber'
print person1.name
print " has #{person1.getLegs} legs."
&lt;/pre&gt;

&lt;h3&gt;Example with Python&lt;h3&gt;

&lt;pre&gt;
class Species:
	def __init__(self, type, name):
		self.__type = type
		self.__name = name
	def get_name(self):
		return self.__name

class Human(Species):
	def get_legs(self):
	  return 2
		
person1 = Human("Neanderthal", "Reinhold Weber")
print person1.get_name()
print ' has ' + str(person1.get_legs()) + ' legs.'
&lt;/pre&gt;

</description>
					<link>http://www.reinholdweber.com?p=50</link> 
				</item>	<item>
					<title>Overwrite evil &lt;em&gt;inline styles&lt;/em&gt; with external CSS</title>    
					<description>&lt;p&gt;Note to self for future reference, damn CMS modules.&lt;/p&gt;
&lt;pre&gt;
div[style]{ color: inherit !important; font-size: inherit !important; }
&lt;/pre&gt;</description>
					<link>http://www.reinholdweber.com?p=49</link> 
				</item>	<item>
					<title>Evolution of a &lt;em&gt;PHP programmer&lt;/em&gt; scribble</title>    
					<description>&lt;p&gt;The following code snippet is from a conversation I had today with an intern describing the different stages of a PHP programmer's evolution as he finds new methods of connecting to a database.&lt;/p&gt;

&lt;p&gt;This is very rudamentary and could be expanded using prepared statements, filtering user input etc., but as for now I just wanted to put this up for future reference with the intention to expand it somewhere soon.&lt;/p&gt;

&lt;p&gt;I will also add detailed explanations to the various approaches&lt;/p&gt;

&lt;pre&gt;
/* 1 found &amp; copied from somewhere on the internets */
$mysql = mysql_connect('localhost', 'reinhold', 'secret_hash');
mysql_select_db('wordpress') or die("cannot select DB");

/* 1.1 trying the DRY approach */
$db_host = 'localhost';
$db_user = 'reinhold';
$db_password = 'secret_hash';
$db_database = 'wordpress';

$mysql = mysql_connect($db_host, $db_user, $db_password);
mysql_select_db($db_database);

/* 1.2 oh yeah, if the values don't change you can also use constants */
define('DB_HOST', 'localhost');
define('DB_USER', 'reinhold');
define('DB_PASSWORD', 'secret_hash');
define('DB_DATABASE', 'wordpress');

$mysql = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
mysql_select_db(DB_DATABASE);

/* 1.3 after 3 years of changing the values every time you uplaod something to the live server */
define('LIVE_ENV', true);

if(LIVE_ENV) {
	define('DB_HOST', 'localhost');
	define('DB_USER', 'reinhold');
	define('DB_PASSWORD', 'secret_hash');
	define('DB_DATABASE', 'wordpress');
} else {
	define('DB_HOST', 'testserver.com');
	define('DB_USER', 'reinhold');
	define('DB_PASSWORD', 'secret_hash');
	define('DB_DATABASE', 'wordpress');	
}

$mysql = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
mysql_select_db(DB_DATABASE);


/* 2  PHP5 procedural approach using the new mysqli extension */
$link = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);

if (!$link) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

printf("Host information: %s\n", mysqli_get_host_info($link));
mysqli_close($link);

/* 3 PHP5 OOP style baby */
$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);

if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

printf("Host information: %s\n", $mysqli-&gt;host_info);

$mysqli-&gt;close();
&lt;/pre&gt; </description>
					<link>http://www.reinholdweber.com?p=48</link> 
				</item>	<item>
					<title>Kick print design's ass - big time</title>    
					<description>&lt;blockquote&gt;If they give you ruled paper, write the other way. &lt;cite&gt;Juan Ramon Jimenez&lt;/cite&gt;&lt;/blockquote&gt;

&lt;p&gt;The pink swirl design was getting old. Time for a redesign. This time I want to try something new and experiment a little bit, first and foremost I wanted to do something to leverage the endless possibilities of publishing on the web. While I redesigned another &lt;a href="http://ainews.org/" target="_blank"&gt;personal project&lt;/a&gt; wich uses randomly generated color schemes last week I thought about expanding on this train of thought. Partly inspired by &lt;a href="http://jasonsantamaria.com/" target="_blank"&gt;Jason Santa Maria's&lt;/a&gt; custom and interesting "unique design per article" approach which has gained praise from all over the design community,  my blog will randomly choose a new unique design each time you will reload the site.&lt;/p&gt;

&lt;p&gt;I've always loved simple designs without much fuzz and a general lack of attention to detail, the technique I use the most is setting the mood with a large background image and extracting the colors for the CSS from this image. With this stark approach to webdesign it should be a no-brainer to have at least 1-3 new designs a week which would cumulate to a good hundred designs in the next 12 months - this should keep things fresh for a while.&lt;/p&gt;

&lt;p&gt;Surfing through the net I see a lot of new and cool stuff every day where up until now I always wished I could keep cool design parts and snips by making screenshots and collecting them somewhere. That concept didn't really work for me as I never revisited these collections and if I did I didn't quite use them for something. So now woth this new approach whereever I see something cool I can let it inspire me and incorporate what I like into a quick new design and upload it for the world to see. I've been dying to see a few CSS3 features out in the wild, so I will use a lot of experimental stuff which you'll probably won't see anyway too.&lt;/p&gt;</description>
					<link>http://www.reinholdweber.com?p=47</link> 
				</item>	<item>
					<title>Refactoring your CSS styles to comply with the DRY principle</title>    
					<description>&lt;blockquote&gt;
When the DRY principle is applied successfully, a modification of any single element of a system does not change other logically-unrelated elements
&lt;/blockquote&gt;
&lt;p&gt;Every half-decent PHP, Ruby, Python or Java programmer knows and hopefully uses software design principles to design software, Software design principles and design patterns. While design patterns apply mostly to OOP languages and provide programmers with a general reusable solution to common mostly architectural problems software principles like the aforementioned DRY principle can and should be used on a broader scope.&lt;/p&gt;

&lt;p&gt;CSS, in contrary to those mentioned languages is mostly used by designers instead of programmers, hence the lack of formal principles.&lt;/p&gt;

&lt;p&gt;I think that being a css developer, you can benefit a lot from knowing certain software principles and incorporating them into your daily workflow and enrich your knowledge and abilities beyond random "best practices" lists.&lt;/p&gt;

&lt;h3&gt;What is DRY about?&lt;/h3&gt;
&lt;p&gt;The DRY code philosophy is stated as:&lt;/p&gt; 
&lt;blockquote&gt;Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.&lt;/blockquote&gt;

&lt;h3&gt;Why should you care?&lt;/h3&gt;
&lt;p&gt;CSS is per definition and design a complete violation of the DRY principle: Don't Repeat Yourself, in CSS repetition and redundancy are volitionally built in and encouraged from the start. When writing code of any kind one of the most important and fundamental principles of software design is trying to avoid repetition and redundancy. When the same piece of information appears in more than one place it is bound to get out of sync sometime. Changing or fixing something requires you to fix it in ALL instances which, if you have ever coded anything, a major source for future bugs and malfunction.&lt;/p&gt;

&lt;blockquote&gt;If you find yourself doing a copy/paste while you're coding, you're likely doing something wrong&lt;/blockquote&gt;

&lt;p&gt;Imagine a website with 100.000 visitors/month, assuming you can save only 5kb by DRYing up your css this will result in 5.8Gb less traffic a year.&lt;/p&gt;

&lt;p&gt;Programming languages like PHP, Ruby, Python or Java provide a wide array of mechanisms to avoid code repetitions - variables, constants, classes, methods, functions, control structures - good luck emulating those in CSS.&lt;/p&gt;

&lt;h3&gt;How do I keep my stylesheets DRY?&lt;/h3&gt;
&lt;p&gt;These are a few random guidelines I use to keep my CSS DRY&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Rely on inheritance, don't redeclare inherited values, don't overspecify, let it flow down the document tree - try setting important XHTML selectors like font and a for your entire site ONCE at the very top of your style sheet and letting them flow through the whole site&lt;a href="http://www.w3.org/TR/CSS21/cascade.html" title="Assigning property values, Cascading, and Inheritance" target="_blank"&gt;W3C Reference on Inheritance&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;Don't declare default (called "initial" in &lt;a href="http://www.w3.org/TR/CSS21/about.html#initial-value" title="About the CSS&amp;nbsp;2.1 Specification" target="_blank"&gt;the specification&lt;/a&gt;) values.&lt;/li&gt;
	&lt;li&gt;Group selectors with the same declarations and declarations with the same selectors.&lt;/li&gt;
	&lt;li&gt;Browser hacks always bring redundancy, try to avoid as much as possible.&lt;/li&gt;
	&lt;li&gt;Define everything as globally (as high up the document tree) as possible, assign your classes and IDs at the highest level possible&lt;/li&gt;
	&lt;li&gt;You can assign multiple class names to a given element&lt;/li&gt;
	&lt;li&gt;Reduce redundancy by using shorthand declarations - &lt;a href="http://reference.sitepoint.com/css/shorthandproperties" title="Shorthand Properties" target="_blank"&gt;Sitepoint CSS Reference&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;Use descendant selectors to get specific without class or id selectors. Learn about all the CSS3 selectors, it's almost like XPath :-) - &lt;a href="http://www.w3.org/TR/css3-selectors/" title="Selectors Level 3" target="_blank"&gt;Selectors Level 3&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;If you don't/can't use php for variables you can maintain a color scheme reference, change colors with "search &amp; replace"&lt;/li&gt;
	&lt;li&gt;Learn to exploit the cascading nature of CSS - &lt;a href="http://www.w3.org/TR/CSS21/cascade.html" title="Assigning property values, Cascading, and Inheritance" target="_blank"&gt;W3C Reference on Cascading&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;Learn about &lt;a href="http://www.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/" title="CSS Specificity: Things You Should Know | CSS | Smashing Magazine" target="_blank"&gt;CSS Specificity&lt;/a&gt; and how you can calculate the weight of your selectors, this is usually the reason why your CSS-rules don't apply to some elements, although you think they should have. Generally try to avoid &lt;a href="http://css-tricks.com/specifics-on-css-specificity/" title="Specifics on CSS Specificity"&gt;inline styles&lt;/a&gt;.&lt;/li&gt;
	&lt;li&gt;You can change capitalisation using CSS&lt;/li&gt;
	&lt;li&gt;Emulate css variables with php - &lt;a href="http://www.digital-web.com/articles/generating_dynamic_css_with_php/" title="Digital Web Magazine	 - Generating Dynamic CSS with PHP" target="_blank"&gt;Generating Dynamic CSS with PHP&lt;/a&gt; by Douglas Clifton&lt;/li&gt;
	&lt;li&gt;Use a &lt;a href="#preprocessors"&gt;css preprocessor&lt;/a&gt; to nest css rules within each other&lt;/li&gt;
	&lt;li&gt;Favor built-in HTML elements before using divs and spans - &lt;a href="http://www.w3.org/TR/html5-diff/#new-elements" title="HTML&amp;nbsp;5 differences from HTML&amp;nbsp;4" target="_blank"&gt;HTML5 elements&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;Nest css blocks - for details see this article by &lt;a href="http://blog.outofhanwell.com/2005/09/19/nested-css-blocks/" title="Nested CSS Blocks &amp;laquo; Out of Hanwell" target="_blank"&gt;Matthias Miller&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While there is a recommendation for &lt;a href="http://disruptive-innovations.com/zoo/cssvariables/" title="CSS Variables" target="_blank"&gt;css variables&lt;/a&gt; by Daniel Glazman and David Hyatt of Apple, Inc. until this will be available to use in the real world years will pass by. Fortunately there is a way to use all that cool stuff right here right now - with the help of php, ruby and/or css preprocessors&lt;/p&gt;

&lt;h3 id="preprocessors"&gt;CSS preprocessors - PHP/Ruby&lt;/h3&gt;
&lt;p&gt;There are a lot of very good css preprocessors out there which can assist you in DRYing up your css workflow. &lt;/p&gt;
	
&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.machete.ca/2009/02/less-annoying-css-using-php-preprocessing/" title="Less annoying CSS using PHP Preprocessing | Blog - Allain Lalonde" target="_blank"&gt;Allain Lallonde's&lt;/a&gt; excellent php snippet which besides allowing you to nest CSS rules within each other gives you the ability to use // for comments.&lt;/li&gt;

		&lt;li&gt;&lt;a href="http://www.shauninman.com/archive/2008/05/30/check_out_css_cacheer" title="CSS Server-side Pre-processor // ShaunInman.com" target="_blank"&gt;CSS Cacheer&lt;/a&gt; a CSS server-side pre-processsor written in PHP by Shaun Inman.&lt;/li&gt;
			&lt;li&gt;&lt;a href="http://blog.airbladesoftware.com/2006/12/11/cssdryer-dry-up-your-css" title="AirBlog &amp;mdash; css_dryer: DRY Up Your CSS" target="_blank"&gt;css_dryer&lt;/a&gt;, a Ruby script by Andrew Stuart, which not only allows you to use nested declarations and css variables but also implements caching.&lt;/li&gt;
		&lt;li&gt;Also for Ruby is &lt;a href="http://haml.hamptoncatlin.com/docs/rdoc/classes/Sass.html" target="_blank"&gt;SASS (Syntactically Awesome StyleSheets)&lt;/a&gt;, a meta-language on top of CSS that's used to describe the style of a document cleanly and structurally, with more power than flat CSS allows. Sass both provides a simpler, more elegant syntax for CSS and implements various features that are useful for creating manageable stylesheets.&lt;/li&gt;
		&lt;/ul&gt;

&lt;h3&gt;Beware of DRYitis&lt;/h3&gt;
&lt;p&gt;Aside from the fact that DRYitis is not a real word and I totally made that up after a little while you feel inclined to DRY up everything.&lt;/p&gt;		
&lt;p&gt;Besides all the benefits of a DRY approach one word of caution should be mentioned nevertheless. Adhering to DRY, the potential for taking it too far and sacrificing maintainability is not far away. Sometimes it just makes sense to keep seemingly identical things separated for the sake of maintainability. It might not be a bad idea to put a comment in the code to let future maintainers know that there's similar code elsewhere that they should fix.&lt;/p&gt;</description>
					<link>http://www.reinholdweber.com?p=46</link> 
				</item>	<item>
					<title>The 48 hour CMS experiment</title>    
					<description>&lt;p&gt;This is the plan: 48 hours in April, one web developer and several bottles of wine - what hopefully comes out is something new and exciting. Requirements are done, waiting for a good wine :-)&lt;/p&gt;

&lt;blockquote&gt;
"The good thing about reinventing the wheel is that you can get a round one."

&lt;cite&gt;Douglas Crockford's response about JSON as reinventing XML's wheel.&lt;/cite&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the last year I've been working with a lot of Open Source CMS, from creating templates/themes to extending standard functionality with custom built modules and plugins, it has been a wild ride with short deadlines and steep learning curves.&lt;/p&gt;

&lt;p&gt;I have had the pleasure &amp;amp; pain to work with most of the trendy cms greats, from the swiss army knife that is Drupal to the horrific mess that comes with Typo3.&lt;/p&gt;
&lt;p&gt;All have something unique and sometimes disturbing, their own agenda &amp;amp; strong opinions and philosophies that inevitably come with every open source project. As the months went on and the projects got more demanding I found myself extending, changing, overwriting and most of all cursing.&lt;/p&gt; 

&lt;p&gt;So now I have my own way of doing things and wanting things and keep changing the standard stuff to adapt to my needs instead of the other way around.&lt;/p&gt;

&lt;p&gt;While it has been quite over here, partly due to the book I'm trying to write this 100% custom coded from scratch cms will hopefully be one of the highlights of my year.&lt;/p&gt;

&lt;p&gt;My CMS borrows features heavily from the industry leaders like Drupal and WordPress, but also has some unique features, first and foremost a 100% "NO JavaScript/Ajax Crap" policy.&lt;/p&gt;

&lt;p&gt;Due to the somewhat limited timeframe it also lacks a lot of things like for example ACLs, the scope of the project is however small websites which won't need granular access control anyway.&lt;/p&gt;

&lt;p&gt;I'll keep you posted...&lt;/p&gt;</description>
					<link>http://www.reinholdweber.com?p=45</link> 
				</item>	<item>
					<title>My new php IDE of choice with a new milestone release</title>    
					<description>&lt;p&gt;Get it while it's hot&lt;/p&gt;
&lt;p&gt;It's free as in beer and better than ever - &lt;a href="http://bits.netbeans.org/download/6.7/m2/" target="blank"&gt;NetBeans IDE 6.7 M2&lt;/a&gt;&lt;/p&gt;</description>
					<link>http://www.reinholdweber.com?p=44</link> 
				</item>	<item>
					<title>CSS PHP &lt;em&gt;Country Codes of the World&lt;/em&gt; Visualisation</title>    
					<description>&lt;p&gt;&lt;img src="images/CC2.jpg" alt="World Color Codes Map" style="float: left; margin: 0 20px 20px 0"&gt;&lt;/p&gt;
&lt;p&gt;Another of my data visualisation experiments with PHP and CSS. Inspired by this poster from &lt;a href="http://www.historyshots.com/OtherArtists/4015.cfm" target="_blank"&gt;historyshots.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;List with worldwide country codes for MySQL available from &lt;a href="http://27.org/isocountrylist/" target="_blank"&gt;27.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;View the live example at &lt;a href="http://reinholdweber.com/get_countries_map.php" target="_blank"&gt;http://reinholdweber.com/get_countries_map.php&lt;/a&gt;&lt;p&gt;
&lt;p&gt;Hover with your mouse over the ISO codes to see the CSS effect and view the full country name. Almost everything in this visualisation is generated randomly - the size of the ISO codes, the placement on the screen and the individual colors. Refresh to see the "randomness".&lt;/p&gt;

&lt;p&gt;Excerpt from the source file - for the HTML stuff see the Live Demo, what I left out here is the database connection.&lt;/p&gt;
&lt;pre&gt;
&amp;lt;?php
function get_countries() {
	$query  = 'SELECT iso, name FROM country_codes';
	$result = mysql_query($query) OR die(mysql_error());
	
	$items = array();
	while($row = mysql_fetch_object($result)) {
		$countries[] = $row;
	}
	return $countries;
}

function display_map($countries) {
	echo '&amp;lt;ul&amp;gt;';
	foreach($countries as $country) {
		$left = rand(5,90);
		$top = rand(5,90);
		$color = dechex(rand(0,16777215)); // 167777215 is the decimal equivalent to to the hexidecimal ffffff
		$size = random_float(0.6, 2.5);

		echo '&amp;lt;span class="c" style="left:'.$left.'%; top:'.$top.'%; color: #'.$color.'; font-size: '.$size.'em"&amp;gt;'.$country-&amp;gt;iso.' &amp;lt;span class="name"&amp;gt;'.$country-&amp;gt;name.'&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;'."\n";

	}	
	echo '&amp;lt;/ul&amp;gt;';
}

function random_float ($min,$max) {
   return ($min+lcg_value()*(abs($max-$min)));
}

?&amp;gt;

&amp;lt;style type="text/css"&amp;gt;
body {background: #fff; font: 70% times, georgia, serif;}
.c {position: absolute;}

span span.name {display: none}
span:hover span.name {display: block; font-size: 40px;}
&amp;lt;/style&amp;gt;

&amp;lt;?php
$countries = get_countries();
display_map($countries);
?&amp;gt;
&lt;/pre&gt;</description>
					<link>http://www.reinholdweber.com?p=43</link> 
				</item>	<item>
					<title>CSS &lt;em&gt;deployment revisited&lt;/em&gt; - php snippet to combine all css files in a given folder</title>    
					<description>&lt;p&gt;As a follow-up to my first post on &lt;a href="http://reinholdweber.com/?p=37" target="_blank"&gt;css deployment&lt;/a&gt; here is a handy script which reads a directory with css files and combines them automatically into one master stylesheet. No matter how many files you add while developing, before launch you can use a build script that merges them all so you can save HTTP requests.&lt;/p&gt;

&lt;p&gt;This is just the snippet who combines the files, if you want to (and you definitely should) compress your styles, strip out all of the comments and whitespace etc. please refer to my first article on css deployment with a php snippet which lets you &lt;a href="http://reinholdweber.com/?p=37" target="_blank"&gt;compress your styles on the fly&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;All you have to do is change the path to the folder all your css files are located in.&lt;/p&gt;

&lt;pre&gt;
&amp;lt;?php
header('Content-type: text/css');

$path_to_css = '../assets/css';

function get_files($dir = '.', $sort = 0) {
	$files = scandir($dir, $sort);
	$files = array_diff($files, array('.', '..'));
	return $files;
}

$files = get_files($path_to_css, 1);
	
	foreach($files as $file) {
		include_once($path_to_css.'/'.$file);
	}
?&amp;gt;
&lt;/pre&gt;
</description>
					<link>http://www.reinholdweber.com?p=42</link> 
				</item>		</channel>
			</rss>
