<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lecciones Prácticas</title>
	<atom:link href="http://www.leccionespracticas.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.leccionespracticas.com</link>
	<description>informática y bibliotecas 2.0</description>
	<lastBuildDate>Sat, 18 May 2013 19:19:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Drupal 7: display language switcher in template [SOLVED]</title>
		<link>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-language-switcher-in-template-solved/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-language-switcher-in-template-solved/#comments</comments>
		<pubDate>Sat, 18 May 2013 19:16:08 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[internationalization]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[switcher]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2284</guid>
		<description><![CDATA[Some days ago we learnt to display a search box in Drupal template files, and according to that post and <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-language-switcher-in-template-solved/" class="more-link"><span>Continue Reading &#8594;</span></a></span><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-styling-language-switcher/' rel='bookmark' title='Drupal 7: Styling language switcher'>Drupal 7: Styling language switcher</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-search-box-in-page-tpl-php-or-other-template-files-solved/' rel='bookmark' title='Drupal 7: Display search box in page.tpl.php or other template files [SOLVED]'>Drupal 7: Display search box in page.tpl.php or other template files [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-customize-language-switcher-block/' rel='bookmark' title='Drupal: customize language switcher block'>Drupal: customize language switcher block</a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Some days ago we learnt to <a href="http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-search-box-in-page-tpl-php-or-other-template-files-solved/" title="Drupal 7: Display search box in page.tpl.php or other template files [SOLVED]" target="_blank">display a search box in Drupal template files</a>, and according to that post and the <a href="http://drupal.org/node/26502" title="Drupal handbook: embed a block in template" target="_blank">Drupal handbook</a> rendering a language switcher block in your theme templates should be easy.</p>
<p>This should work:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$block</span> <span style="color: #339933;">=</span> module_invoke<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'locale'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'block_view'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'language'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> render<span style="color: #009900;">&#40;</span><span style="color: #000088;">$block</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Unfortunately, in my D7 it does not. What does work is this:</p>
<p>Add to <code>template.php</code>:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> block_render<span style="color: #009900;">&#40;</span><span style="color: #000088;">$module</span><span style="color: #339933;">,</span> <span style="color: #000088;">$block_id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$block</span> <span style="color: #339933;">=</span> block_load<span style="color: #009900;">&#40;</span><span style="color: #000088;">$module</span><span style="color: #339933;">,</span> <span style="color: #000088;">$block_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$block_content</span> <span style="color: #339933;">=</span> _block_render_blocks<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$block</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$build</span> <span style="color: #339933;">=</span> _block_get_renderable_array<span style="color: #009900;">&#40;</span><span style="color: #000088;">$block_content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$block_rendered</span> <span style="color: #339933;">=</span> drupal_render<span style="color: #009900;">&#40;</span><span style="color: #000088;">$build</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$block_rendered</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Add to <code>page.tpl.php</code></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
  <span style="color: #b1b100;">print</span> block_render<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'locale'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'language'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Now that the language switcher is rendering, you might want to <a href="http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-styling-language-switcher/" title="Drupal 7: Styling language switcher">customize its appeareance</a> <img src='http://www.leccionespracticas.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-styling-language-switcher/' rel='bookmark' title='Drupal 7: Styling language switcher'>Drupal 7: Styling language switcher</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-search-box-in-page-tpl-php-or-other-template-files-solved/' rel='bookmark' title='Drupal 7: Display search box in page.tpl.php or other template files [SOLVED]'>Drupal 7: Display search box in page.tpl.php or other template files [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-customize-language-switcher-block/' rel='bookmark' title='Drupal: customize language switcher block'>Drupal: customize language switcher block</a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-language-switcher-in-template-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal 7: Styling language switcher</title>
		<link>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-styling-language-switcher/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-styling-language-switcher/#comments</comments>
		<pubDate>Sun, 12 May 2013 12:04:21 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[internationalization]]></category>
		<category><![CDATA[language switcher]]></category>
		<category><![CDATA[module]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2281</guid>
		<description><![CDATA[Language switcher is a Drupal module which allows to display a block that allows visitors to choose between the languages <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-styling-language-switcher/" class="more-link"><span>Continue Reading &#8594;</span></a></span><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-customize-language-switcher-block/' rel='bookmark' title='Drupal: customize language switcher block'>Drupal: customize language switcher block</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-not-showing-contact-form-menu-item-solved/' rel='bookmark' title='Drupal not showing contact form menu item [solved]'>Drupal not showing contact form menu item [solved]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/translate-contact-form-module-drupal-solved/' rel='bookmark' title='Translate &#8220;Contact form&#8221; module Drupal [SOLVED]'>Translate &#8220;Contact form&#8221; module Drupal [SOLVED]</a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p><a href="http://drupal.org/project/language_switcher">Language switcher</a> is a Drupal module which allows to display a block that allows visitors to choose between the languages in which your site is available (check /admin/config/regional/language to list the available languages in your Drupal site).</p>
<p>By default, it produces an unordered list with each item in a new line and a bullet before each item. Not a big fan of this look.</p>
<p>With the following CSS code you&#8217;ll have an inline language switcher, with li items separed by &#8220;/&#8221;.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* language switcher */</span>
ul.language-switcher-locale-url<span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">list-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
ul<span style="color: #6666ff;">.language-switcher-locale-url</span> li<span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
ul<span style="color: #6666ff;">.language-switcher-locale-url</span> li<span style="color: #3333ff;">:after</span><span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;/&quot;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
ul<span style="color: #6666ff;">.language-switcher-locale-url</span> li<span style="color: #3333ff;">:last-child</span><span style="color: #3333ff;">:after</span><span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>For more advanced styling options, check <a href="http://drupal.org/node/245466">this link</a>.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-customize-language-switcher-block/' rel='bookmark' title='Drupal: customize language switcher block'>Drupal: customize language switcher block</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-not-showing-contact-form-menu-item-solved/' rel='bookmark' title='Drupal not showing contact form menu item [solved]'>Drupal not showing contact form menu item [solved]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/translate-contact-form-module-drupal-solved/' rel='bookmark' title='Translate &#8220;Contact form&#8221; module Drupal [SOLVED]'>Translate &#8220;Contact form&#8221; module Drupal [SOLVED]</a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-styling-language-switcher/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle: guess the query of a view [SOLVED]</title>
		<link>http://www.leccionespracticas.com/uncategorized/oracle-guess-the-query-of-a-view-solved/</link>
		<comments>http://www.leccionespracticas.com/uncategorized/oracle-guess-the-query-of-a-view-solved/#comments</comments>
		<pubDate>Thu, 02 May 2013 12:38:49 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[all_views]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[solved]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sqlplus]]></category>
		<category><![CDATA[view]]></category>
		<category><![CDATA[views]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2278</guid>
		<description><![CDATA[Some time ago, someone at my work created a new View in our Oracle database called AUTORESUZ (notice the capitals!) <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.leccionespracticas.com/uncategorized/oracle-guess-the-query-of-a-view-solved/" class="more-link"><span>Continue Reading &#8594;</span></a></span><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/cds-invenio/cds-invenio-0-99-x-inveniogc-error-solved/' rel='bookmark' title='CDS Invenio 0.99.X: inveniogc ERROR [SOLVED]'>CDS Invenio 0.99.X: inveniogc ERROR [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/uncategorized/joomla-know-the-section-solved/' rel='bookmark' title='Joomla: know the section [SOLVED]'>Joomla: know the section [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/uncategorized/how-to-install-oracle-instantclient-windows-xp-sp3-32bits/' rel='bookmark' title='How to install oracle instantclient (windows xp sp3 32bits)'>How to install oracle instantclient (windows xp sp3 32bits)</a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Some time ago, someone at my work created a new View in our Oracle database called <code>AUTORESUZ</code> (notice the capitals!) and I wanted to know how this view was defined, this is, the query that lies under it.</p>
<p>You can list all the views defined at your Oracle database by having a look at <code>all_views</code> table which stores the following information of each view:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">DESC</span> all_views;
 Name					   <span style="color: #993333; font-weight: bold;">NULL</span>?    <span style="color: #993333; font-weight: bold;">TYPE</span>
 <span style="color: #808080; font-style: italic;">----------------------------------------- -------- ----------------------------</span>
 OWNER					   <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> VARCHAR2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">30</span><span style="color: #66cc66;">&#41;</span>
 VIEW_NAME				   <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> VARCHAR2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">30</span><span style="color: #66cc66;">&#41;</span>
 TEXT_LENGTH					    <span style="color: #993333; font-weight: bold;">NUMBER</span>
 TEXT						    LONG
 TYPE_TEXT_LENGTH				    <span style="color: #993333; font-weight: bold;">NUMBER</span>
 TYPE_TEXT					    VARCHAR2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4000</span><span style="color: #66cc66;">&#41;</span>
 OID_TEXT_LENGTH				    <span style="color: #993333; font-weight: bold;">NUMBER</span>
 OID_TEXT					    VARCHAR2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4000</span><span style="color: #66cc66;">&#41;</span>
 VIEW_TYPE_OWNER				    VARCHAR2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">30</span><span style="color: #66cc66;">&#41;</span>
 VIEW_TYPE					    VARCHAR2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">30</span><span style="color: #66cc66;">&#41;</span>
 SUPERVIEW_NAME 				    VARCHAR2<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">30</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>The query information is stored in &#8220;text&#8221; row. So, let&#8217;s retrieve the query that our AUTORESUZ has defined:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> text <span style="color: #993333; font-weight: bold;">FROM</span> all_views <span style="color: #993333; font-weight: bold;">WHERE</span> view_name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'AUTORESUZ'</span>;
&nbsp;
TEXT
<span style="color: #808080; font-style: italic;">----------</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> a1<span style="color: #66cc66;">.</span></pre></td></tr></table></div>

<p>OMFG! The query seems to be there, but it is truncated&#8230;</p>
<p>In order to view the full query, you must set long with a value greater that text&#8217;s length. Like this:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="sql" style="font-family:monospace;">SQL<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> text_length <span style="color: #993333; font-weight: bold;">FROM</span> all_views <span style="color: #993333; font-weight: bold;">WHERE</span> view_name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'AUTORESUZ'</span>;
&nbsp;
TEXT_LENGTH
<span style="color: #808080; font-style: italic;">-----------</span>
	<span style="color: #cc66cc;">369</span>
&nbsp;
SQL<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> text <span style="color: #993333; font-weight: bold;">FROM</span> all_views <span style="color: #993333; font-weight: bold;">WHERE</span> view_name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'AUTORESUZ'</span>;
&nbsp;
TEXT
<span style="color: #808080; font-style: italic;">----------</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> a1<span style="color: #66cc66;">.</span>
&nbsp;
SQL<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SET</span> long <span style="color: #cc66cc;">369</span>
SQL<span style="color: #66cc66;">&gt;</span> <span style="color: #993333; font-weight: bold;">SELECT</span> text <span style="color: #993333; font-weight: bold;">FROM</span> all_views <span style="color: #993333; font-weight: bold;">WHERE</span> view_name <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'AUTORESUZ'</span>;         
&nbsp;
TEXT
<span style="color: #808080; font-style: italic;">--------------------------------------------------------------------------------</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> a1<span style="color: #66cc66;">.</span>rec_key <span style="color: #993333; font-weight: bold;">AS</span> arecord<span style="color: #66cc66;">,</span>
  REGEXP_REPLACE<span style="color: #66cc66;">&#40;</span>a2<span style="color: #66cc66;">.</span>rec_data<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'^<span style="color: #000099; font-weight: bold;">\|</span>a(.*)'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\1</span>'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> nipuz<span style="color: #66cc66;">,</span>
  REGEXP_REPLACE<span style="color: #66cc66;">&#40;</span>REGEXP_REPLACE<span style="color: #66cc66;">&#40;</span>REGEXP_REPLACE<span style="color: #66cc66;">&#40;</span>a1<span style="color: #66cc66;">.</span>rec_data<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'^<span style="color: #000099; font-weight: bold;">\|</span>a(.*)<span style="color: #000099; font-weight: bold;">\|</span>6<span style="color: #000099; font-weight: bold;">\(</span>UZ.*'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'
<span style="color: #000099; font-weight: bold;">\1</span>'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'(.*)<span style="color: #000099; font-weight: bold;">\|</span>c(.*)'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\1</span>'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'(.*),<span style="color: #000099; font-weight: bold;">\|</span>d(.*)'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\1</span>'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> autoruz
&nbsp;
 <span style="color: #993333; font-weight: bold;">FROM</span> var_fields2 a1<span style="color: #66cc66;">,</span>  var_fields2 a2
 <span style="color: #993333; font-weight: bold;">WHERE</span> a1<span style="color: #66cc66;">.</span>rec_key <span style="color: #993333; font-weight: bold;">LIKE</span> <span style="color: #ff0000;">'a%'</span> <span style="color: #993333; font-weight: bold;">AND</span> a1<span style="color: #66cc66;">.</span>MARC_TAG<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'100'</span> <span style="color: #993333; font-weight: bold;">AND</span>
  <span style="color: #66cc66;">&#40;</span>a1<span style="color: #66cc66;">.</span>rec_key<span style="color: #66cc66;">=</span>a2<span style="color: #66cc66;">.</span>rec_key <span style="color: #993333; font-weight: bold;">AND</span> a2<span style="color: #66cc66;">.</span>MARC_TAG<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'090'</span><span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/cds-invenio/cds-invenio-0-99-x-inveniogc-error-solved/' rel='bookmark' title='CDS Invenio 0.99.X: inveniogc ERROR [SOLVED]'>CDS Invenio 0.99.X: inveniogc ERROR [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/uncategorized/joomla-know-the-section-solved/' rel='bookmark' title='Joomla: know the section [SOLVED]'>Joomla: know the section [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/uncategorized/how-to-install-oracle-instantclient-windows-xp-sp3-32bits/' rel='bookmark' title='How to install oracle instantclient (windows xp sp3 32bits)'>How to install oracle instantclient (windows xp sp3 32bits)</a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/uncategorized/oracle-guess-the-query-of-a-view-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal 7: Path breadcrumbs in Views page [SOLVED]</title>
		<link>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-path-breadcrumbs-in-views-page-solved/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-path-breadcrumbs-in-views-page-solved/#comments</comments>
		<pubDate>Wed, 01 May 2013 18:43:59 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[breadcrumbs]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[path]]></category>
		<category><![CDATA[views]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2272</guid>
		<description><![CDATA[Path breadcrumbs module allows you to easily add breadcrumbs to your Drupal site. The module lacks of documentation, but they <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-path-breadcrumbs-in-views-page-solved/" class="more-link"><span>Continue Reading &#8594;</span></a></span><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-search-box-in-page-tpl-php-or-other-template-files-solved/' rel='bookmark' title='Drupal 7: Display search box in page.tpl.php or other template files [SOLVED]'>Drupal 7: Display search box in page.tpl.php or other template files [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-pathauto-url-pattern-page-is-empty-solved/' rel='bookmark' title='Drupal 7: Pathauto url pattern page is empty [SOLVED]'>Drupal 7: Pathauto url pattern page is empty [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-6-pathauto-missing-in-administer-site-configuration-solved/' rel='bookmark' title='Drupal 6: pathauto missing in Administer -&gt; Site Configuration [SOLVED]'>Drupal 6: pathauto missing in Administer -> Site Configuration [SOLVED]</a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p><a href="http://drupal.org/project/path_breadcrumbs">Path breadcrumbs module</a> allows you to easily add breadcrumbs to your Drupal site. The module lacks of documentation, but they offer this image as an example:</p>
<p><a href="http://www.leccionespracticas.com/wp-content/uploads/2013/05/path_breadcrumbs.jpg"><img src="http://www.leccionespracticas.com/wp-content/uploads/2013/05/path_breadcrumbs.jpg" alt="path_breadcrumbs" width="970" height="1984" class="alignnone size-full wp-image-2273" /></a></p>
<p>And there is a <a href="http://www.youtube.com/watch?v=0RebulQsp9s">videotutorial</a> as well.</p>
<p>The above show how to configure breadcrumbs in nodes, but&#8230;<strong> how to display breadcrumbs in Views pages</strong>?</p>
<p>This struggled me for a while, because I was taking the (limited) instructions too literally.</p>
<p><strong>To create a breadcrumb to a views page display</strong> that has a path like &#8220;/path/to/my-view&#8221; just use that as the path (<strong>as it isn&#8217;t an alias</strong>). To know the path, go to your view and edit it (<code>admin/structure/views/view/VIEWNAME/edit</code>) and refer to the <strong>Page Settings &#8211; Path</strong> value.</p>
<p>Also, leave the &#8220;Arguments&#8221; and &#8220;Selection rules&#8221; empty, then setup your breadcrumbs as you did with nodes.</p>
<p>Let&#8217;s see an example. First, the path to the view:</p>
<div id="attachment_2274" class="wp-caption alignnone" style="width: 1259px"><a href="http://www.leccionespracticas.com/wp-content/uploads/2013/05/path_breadcrumbs_in_views_page_0.jpg"><img src="http://www.leccionespracticas.com/wp-content/uploads/2013/05/path_breadcrumbs_in_views_page_0.jpg" alt="Path breadcrumbs in views" width="1249" height="632" class="size-full wp-image-2274" /></a><p class="wp-caption-text">Path breadcrumbs in views</p></div>
<p>And the path breadcrumbs configuration:<br />
<div id="attachment_2275" class="wp-caption alignnone" style="width: 1022px"><a href="http://www.leccionespracticas.com/wp-content/uploads/2013/05/path_breadcrumbs_in_views_page.jpg"><img src="http://www.leccionespracticas.com/wp-content/uploads/2013/05/path_breadcrumbs_in_views_page.jpg" alt="drupal 7 Path breadcrumbs in views" width="1012" height="1264" class="size-full wp-image-2275" /></a><p class="wp-caption-text">drupal 7 Path breadcrumbs in views</p></div></p>
<p>And here is the resulting breadcrumb. Remember that your theme&#8217;s page.tpl.php must <code>print $breadcrumb</code> or you will not see breadcrumbs at all&#8230;</p>
<p><a href="http://www.leccionespracticas.com/wp-content/uploads/2013/05/path_breadcrumbs_in_views_page_2.jpg"><img src="http://www.leccionespracticas.com/wp-content/uploads/2013/05/path_breadcrumbs_in_views_page_2.jpg" alt="path_breadcrumbs_in_views_page_2" width="1129" height="513" class="alignnone size-full wp-image-2276" /></a></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-search-box-in-page-tpl-php-or-other-template-files-solved/' rel='bookmark' title='Drupal 7: Display search box in page.tpl.php or other template files [SOLVED]'>Drupal 7: Display search box in page.tpl.php or other template files [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-pathauto-url-pattern-page-is-empty-solved/' rel='bookmark' title='Drupal 7: Pathauto url pattern page is empty [SOLVED]'>Drupal 7: Pathauto url pattern page is empty [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-6-pathauto-missing-in-administer-site-configuration-solved/' rel='bookmark' title='Drupal 6: pathauto missing in Administer -&gt; Site Configuration [SOLVED]'>Drupal 6: pathauto missing in Administer -> Site Configuration [SOLVED]</a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-path-breadcrumbs-in-views-page-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal 7 &#8220;500 &#8211; Internal server error&#8221; [SOLVED]</title>
		<link>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-500-internal-server-error-solved/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-500-internal-server-error-solved/#comments</comments>
		<pubDate>Wed, 01 May 2013 13:10:55 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[500]]></category>
		<category><![CDATA[d7]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[drupal7]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[followsymlinks]]></category>
		<category><![CDATA[internal server error]]></category>
		<category><![CDATA[options]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[solved]]></category>
		<category><![CDATA[symlinksifownermatch]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2270</guid>
		<description><![CDATA[When you want to install a new Drupal 7 in a shared server or some web hosts, specially those concerned <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-500-internal-server-error-solved/" class="more-link"><span>Continue Reading &#8594;</span></a></span><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-how-to-change-imagecache-temp-directory-solved/' rel='bookmark' title='Drupal: how to change ImageCache Temp Directory [SOLVED]'>Drupal: how to change ImageCache Temp Directory [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-6-pathauto-missing-in-administer-site-configuration-solved/' rel='bookmark' title='Drupal 6: pathauto missing in Administer -&gt; Site Configuration [SOLVED]'>Drupal 6: pathauto missing in Administer -> Site Configuration [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-and-wamp-enable-clean-url-using-mod_rewrite-solved/' rel='bookmark' title='DRUPAL and WAMP: enable &#8216;Clean URL&#8217; using mod_rewrite [SOLVED]'>DRUPAL and WAMP: enable &#8216;Clean URL&#8217; using mod_rewrite [SOLVED]</a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>When you want to install a new Drupal 7 in a shared server or some web hosts, specially those concerned with security settings, there is a good chance that all you get is a &#8220;500 internal server error&#8221;. This is usually due to the <code>.htaccess</code> file included with the installation, and more precisely to these lines:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Follow symbolic links in this directory.</span>
Options +FollowSymLinks</pre></td></tr></table></div>

<p>Some web hosts tighten up security settings and now forbid +FollowSymLinks option in .htaccess. This causes an 500 error when accesing the site. </p>
<p>The fix is quite simple. Just replace +FollowSymLinks with +SymLinksIfOwnerMatch. So edit the lines above to this:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Follow symbolic links in this directory.</span>
<span style="color: #666666; font-style: italic;"># comment this one...</span>
<span style="color: #666666; font-style: italic;"># Options +FollowSymLinks</span>
<span style="color: #666666; font-style: italic;"># add this new line...</span>
Options +SymLinksIfOwnerMatch</pre></td></tr></table></div>

<p>The issue should be fixed.</p>
<p>Please note that there is not just one .htacess file in your Drupal 7 site. There is one in <code>/</code> and usually there are other <code>.htaccess</code> files that must be modified too, for instance in <code>sites/default/files</code>. You must change that one too or every image that you upload to your Drupal 7 site won&#8217;t be rendered&#8230;</p>
<p>Discussion about this topic available here: http://drupal.org/node/1269780</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-how-to-change-imagecache-temp-directory-solved/' rel='bookmark' title='Drupal: how to change ImageCache Temp Directory [SOLVED]'>Drupal: how to change ImageCache Temp Directory [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-6-pathauto-missing-in-administer-site-configuration-solved/' rel='bookmark' title='Drupal 6: pathauto missing in Administer -&gt; Site Configuration [SOLVED]'>Drupal 6: pathauto missing in Administer -> Site Configuration [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-and-wamp-enable-clean-url-using-mod_rewrite-solved/' rel='bookmark' title='DRUPAL and WAMP: enable &#8216;Clean URL&#8217; using mod_rewrite [SOLVED]'>DRUPAL and WAMP: enable &#8216;Clean URL&#8217; using mod_rewrite [SOLVED]</a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-500-internal-server-error-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python: truncate string to n words [SOLVED]</title>
		<link>http://www.leccionespracticas.com/python/python-truncate-string-to-n-words-solved/</link>
		<comments>http://www.leccionespracticas.com/python/python-truncate-string-to-n-words-solved/#comments</comments>
		<pubDate>Fri, 19 Apr 2013 06:12:43 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[count]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[truncate]]></category>
		<category><![CDATA[word]]></category>
		<category><![CDATA[words]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2264</guid>
		<description><![CDATA[A friend of mine asked how to implement a python function to truncate a string to the first n words. <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.leccionespracticas.com/python/python-truncate-string-to-n-words-solved/" class="more-link"><span>Continue Reading &#8594;</span></a></span><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-sistemas-y-servidores/know-mod_python-running-version-solved/' rel='bookmark' title='Know mod_python running version [SOLVED]'>Know mod_python running version [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/python-how-do-i-check-the-variable-type-solved/' rel='bookmark' title='Python: how do I check the variable type? [solved]'>Python: how do I check the variable type? [solved]</a></li>
<li><a href='http://www.leccionespracticas.com/python/python-with-mysql-special-characters-issues-tildes-etc-solved/' rel='bookmark' title='Python with MySQL special characters issues (tildes, etc) [SOLVED]'>Python with MySQL special characters issues (tildes, etc) [SOLVED]</a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>A friend of mine asked how to implement a python function to truncate a string to the first n words. Easy!</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> truncate_string<span style="color: black;">&#40;</span>mystring<span style="color: #66cc66;">,</span> numberofwords<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #483d8b;">' '</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>mystring.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span>:numberofwords<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>An example of use:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #66cc66;">&gt;&gt;&gt;</span> sample_string <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">&quot;hello world this is a string&quot;</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">print</span> truncate_string<span style="color: black;">&#40;</span>sample_string<span style="color: #66cc66;">,</span><span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>
hello world</pre></td></tr></table></div>

<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-sistemas-y-servidores/know-mod_python-running-version-solved/' rel='bookmark' title='Know mod_python running version [SOLVED]'>Know mod_python running version [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/python-how-do-i-check-the-variable-type-solved/' rel='bookmark' title='Python: how do I check the variable type? [solved]'>Python: how do I check the variable type? [solved]</a></li>
<li><a href='http://www.leccionespracticas.com/python/python-with-mysql-special-characters-issues-tildes-etc-solved/' rel='bookmark' title='Python with MySQL special characters issues (tildes, etc) [SOLVED]'>Python with MySQL special characters issues (tildes, etc) [SOLVED]</a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/python/python-truncate-string-to-n-words-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CDS Invenio 0.99.X: inveniogc ERROR [SOLVED]</title>
		<link>http://www.leccionespracticas.com/cds-invenio/cds-invenio-0-99-x-inveniogc-error-solved/</link>
		<comments>http://www.leccionespracticas.com/cds-invenio/cds-invenio-0-99-x-inveniogc-error-solved/#comments</comments>
		<pubDate>Wed, 17 Apr 2013 06:52:50 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[CDS Invenio]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[invenio]]></category>
		<category><![CDATA[inveniogc]]></category>
		<category><![CDATA[query]]></category>
		<category><![CDATA[solved]]></category>
		<category><![CDATA[user query]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2261</guid>
		<description><![CDATA[Some days ago I noticed there was something wrong with inveniogc. Every time I run inveniogc -a I was getting <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.leccionespracticas.com/cds-invenio/cds-invenio-0-99-x-inveniogc-error-solved/" class="more-link"><span>Continue Reading &#8594;</span></a></span><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/cds-invenio/cds-invenio-bibtask-error-log/' rel='bookmark' title='CDS-Invenio: bibtask error log'>CDS-Invenio: bibtask error log</a></li>
<li><a href='http://www.leccionespracticas.com/cds-invenio/cds-invenio-garbage-recolector/' rel='bookmark' title='CDS Invenio: garbage recolector'>CDS Invenio: garbage recolector</a></li>
<li><a href='http://www.leccionespracticas.com/cds-invenio/cds-invenio-implementing-autocomplete-for-authors-with-jquery-and-php-solved/' rel='bookmark' title='CDS-Invenio: implementing autocomplete for authors with jQuery and php [SOLVED]'>CDS-Invenio: implementing autocomplete for authors with jQuery and php [SOLVED]</a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Some days ago I noticed there was something wrong with inveniogc. Every time I run <code>inveniogc -a</code> I was getting errors like:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">2013</span>-04-<span style="color: #000000;">17</span> 08:<span style="color: #000000;">31</span>:<span style="color: #000000;">30</span> --<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000;">2013</span>-04-<span style="color: #000000;">17</span> 08:<span style="color: #000000;">31</span>:<span style="color: #000000;">30</span> --<span style="color: #000000; font-weight: bold;">&gt;</span> Updating task status to ERROR.
<span style="color: #000000;">2013</span>-04-<span style="color: #000000;">17</span> 08:<span style="color: #000000;">31</span>:<span style="color: #000000;">30</span> --<span style="color: #000000; font-weight: bold;">&gt;</span> Task <span style="color: #666666; font-style: italic;">#21731 finished. [ERROR]</span></pre></td></tr></table></div>

<p>Calling inveniogc with verbose level = 9 I got some more information (<code>var/log/bibsched_task_XXXX.log</code> and <code>.err</code> files):</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">2013</span>-04-<span style="color: #000000;">17</span> 08:<span style="color: #000000;">29</span>:<span style="color: #000000;">51</span> --<span style="color: #000000; font-weight: bold;">&gt;</span> - deleting queries not attached to any user
&nbsp;
<span style="color: #000000;">2013</span>-04-<span style="color: #000000;">17</span> 08:<span style="color: #000000;">29</span>:<span style="color: #000000;">51</span> --<span style="color: #000000; font-weight: bold;">&gt;</span>   SELECT DISTINCT q.id
  FROM query AS q LEFT JOIN user_query AS uq
  ON uq.id_query = q.id
  WHERE uq.id_query IS NULL AND
  q.type <span style="color: #000000; font-weight: bold;">&lt;&gt;</span> <span style="color: #ff0000;">'p'</span> 
&nbsp;
<span style="color: #000000;">2013</span>-04-<span style="color: #000000;">17</span> 08:<span style="color: #000000;">31</span>:<span style="color: #000000;">30</span> --<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000;">2013</span>-04-<span style="color: #000000;">17</span> 08:<span style="color: #000000;">31</span>:<span style="color: #000000;">30</span> --<span style="color: #000000; font-weight: bold;">&gt;</span> Updating task status to ERROR.
<span style="color: #000000;">2013</span>-04-<span style="color: #000000;">17</span> 08:<span style="color: #000000;">31</span>:<span style="color: #000000;">30</span> --<span style="color: #000000; font-weight: bold;">&gt;</span> Task <span style="color: #666666; font-style: italic;">#21731 finished. [ERROR]</span></pre></td></tr></table></div>

<p>The issue arised when <code>inveniogc</code> tried to delete user queries not attached to any user. I edited <code>lib/python/invenioinveniogc.py</code> and noticed the error was being produced by the output of a query result being printed. Just commented that out and inveniogc works again:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="python" style="font-family:monospace;">write_message<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&quot;&quot;  SELECT DISTINCT q.id<span style="color: #000099; font-weight: bold;">\n</span>  FROM query AS q LEFT JOIN user_query AS uq<span style="color: #000099; font-weight: bold;">\n</span>  ON uq.id_query = q.id<span style="color: #000099; font-weight: bold;">\n</span>  WHERE uq.id_query IS NULL AND<span style="color: #000099; font-weight: bold;">\n</span>  q.type &lt;&gt; 'p' &quot;&quot;&quot;</span><span style="color: #66cc66;">,</span> verbose<span style="color: #66cc66;">=</span><span style="color: #ff4500;">9</span><span style="color: black;">&#41;</span>
result <span style="color: #66cc66;">=</span> run_sql<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&quot;&quot;SELECT DISTINCT q.id
                    FROM query AS q LEFT JOIN user_query AS uq
                    ON uq.id_query = q.id
                    WHERE uq.id_query IS NULL AND
                          q.type &lt;&gt; 'p'&quot;&quot;&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># write_message(result, verbose=9)</span></pre></td></tr></table></div>

<p>Why is this? It seems that the output buffer that write_message is using is too small to store the result of the previous query, so it fails&#8230;</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/cds-invenio/cds-invenio-bibtask-error-log/' rel='bookmark' title='CDS-Invenio: bibtask error log'>CDS-Invenio: bibtask error log</a></li>
<li><a href='http://www.leccionespracticas.com/cds-invenio/cds-invenio-garbage-recolector/' rel='bookmark' title='CDS Invenio: garbage recolector'>CDS Invenio: garbage recolector</a></li>
<li><a href='http://www.leccionespracticas.com/cds-invenio/cds-invenio-implementing-autocomplete-for-authors-with-jquery-and-php-solved/' rel='bookmark' title='CDS-Invenio: implementing autocomplete for authors with jQuery and php [SOLVED]'>CDS-Invenio: implementing autocomplete for authors with jQuery and php [SOLVED]</a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/cds-invenio/cds-invenio-0-99-x-inveniogc-error-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal 7: Display search box in page.tpl.php or other template files [SOLVED]</title>
		<link>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-search-box-in-page-tpl-php-or-other-template-files-solved/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-search-box-in-page-tpl-php-or-other-template-files-solved/#comments</comments>
		<pubDate>Fri, 05 Apr 2013 20:33:39 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[drupal7]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[page.tpl.php]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[template.php]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2250</guid>
		<description><![CDATA[Let&#8217;s assume you want to display a search box in your Drupal 7 theme. You can do it several ways: <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-search-box-in-page-tpl-php-or-other-template-files-solved/" class="more-link"><span>Continue Reading &#8594;</span></a></span><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-override-node-tpl-php-using-zen-theme-solved/' rel='bookmark' title='Drupal: Override node.tpl.php using Zen theme [solved]'>Drupal: Override node.tpl.php using Zen theme [solved]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-pathauto-url-pattern-page-is-empty-solved/' rel='bookmark' title='Drupal 7: Pathauto url pattern page is empty [SOLVED]'>Drupal 7: Pathauto url pattern page is empty [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-path-breadcrumbs-in-views-page-solved/' rel='bookmark' title='Drupal 7: Path breadcrumbs in Views page [SOLVED]'>Drupal 7: Path breadcrumbs in Views page [SOLVED]</a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Let&#8217;s assume you want to display a <strong>search box</strong> in your <strong>Drupal 7</strong> <strong>theme</strong>. You can do it several ways: rendering the <strong>search form</strong>, rendering a <strong>block</strong> which contains it, using <code>template.php</code> or <code>page.tpl.php</code>.</p>
<h2>Thirty-second intro to Drupal theming</h2>
<p>If you are new to Drupal, let me explain how the themes work. </p>
<p>Each theme is a directory (under <code>sites/all/themes/yourthemename</code>) with at least three files:</p>
<p>* The first one, the <code>.info</code> file, called <code>yourthemename.info</code>, describes the theme (regions, path to stylesheet, javascript files, blablabla). </p>
<p>* The second one, which contains the logic (php code) is called <code>template.php</code>, and </p>
<p>* the third one is the html markup file (ideally, with just some php print&#8217;s) called <code>page.tpl.php</code>. </p>
<p>The concept is quite simple: you generate some variables in <code>template.php</code> and print them in <code>page.tpl.php</code>.</p>
<p>Now that we understand the basics, you will find this examples quite self-explaining:</p>
<h2>The dirty way: display Drupal form in page.tpl.php</h2>
<p>First way to show a search box in your Drupal theme works as expected, but it is not the way you are supposed to implement it. </p>
<p>This adds the logic to show a <strong>search form</strong> directly in your <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">View</a> file (<code>page.tpl.php</code>). </p>
<p>This practice should be avoided, as there must not be any logic inside <code>.tpl.php</code> files&#8230; Anyway, Drupal allows it, so:</p>
<p>Edit <code>page.tpl.php</code> (in your theme folder, in <code>/sites/default/MYTHEME</code>) and add these two lines, which will render a block containing a search form:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// this is page.tpl.php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// insert a search_form here...</span>
<span style="color: #000088;">$block</span> <span style="color: #339933;">=</span> module_invoke<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'search'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'block_view'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'form'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//  'search' is the module invoking the block. </span>
<span style="color: #666666; font-style: italic;">//  'block_view' is the operation we want to call, that is, we want to view the block, and </span>
<span style="color: #666666; font-style: italic;">//  'form' is the machine name of the block you want to print.</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// You can get this information by hovering over the edit link on the block overview page at admin/structure/block</span>
<span style="color: #666666; font-style: italic;">// Edit links will be in the form</span>
<span style="color: #666666; font-style: italic;">//       /admin/structure/block/manage/MODULENAME/BLOCK_MACHINENAME/configure</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">// now we print the block...</span>
<span style="color: #b1b100;">print</span> render<span style="color: #009900;">&#40;</span><span style="color: #000088;">$block</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>You can <a href="http://api.drupal.org/api/drupal/includes!module.inc/function/module_invoke/7" target="_blank">read more about module_invoke</a> and <a href="http://api.drupal.org/api/drupal/includes!common.inc/function/render/7" target="_blank">render function</a> in drupal documentation.</p>
<h2>The right way: show a search block in your Drupal 7 theme</h2>
<p>We can set a variable containing a search block in <code>template.php</code>:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>?php
<span style="color: #000000; font-weight: bold;">//</span> this is template.php, where the logic goes...
<span style="color: #000000; font-weight: bold;">//</span> replace MYTHEME with your theme name <span style="color: #7a0874; font-weight: bold;">&#40;</span>like the theme folder containing the theme<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">function</span> MYTHEME_preprocess_page<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #007800;">$variables</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #007800;">$block</span> = module_invoke<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'search'</span>,<span style="color: #ff0000;">'block_view'</span>,<span style="color: #ff0000;">'search'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
    <span style="color: #007800;">$rendered_block</span> = render<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$block</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
    <span style="color: #007800;">$variables</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">'mysearchblock'</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> = <span style="color: #007800;">$rendered_block</span>;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
?<span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>And then print that variable in your <code>page.tpl.php</code> file:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>?php
<span style="color: #000000; font-weight: bold;">//</span> this is page.tpl.php, where the presentation <span style="color: #7a0874; font-weight: bold;">&#40;</span>view<span style="color: #7a0874; font-weight: bold;">&#41;</span> is generated:
   <span style="color: #000000; font-weight: bold;">//</span> ... custom html stuff ...
&nbsp;
   <span style="color: #000000; font-weight: bold;">//</span> print our rendered search block...
   print <span style="color: #007800;">$mysearchblock</span>;
?<span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<h2>The right way: display Drupal 7 search form in theme</h2>
<p>Instead of rendering the block, we will be rendering the form (not a block, but the full search form instead):</p>
<p>Let&#8217;s put the logic where it should be, in <code>template.php</code>:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// this is template.php, where the logic goes...</span>
<span style="color: #666666; font-style: italic;">// replace MYTHEME with your theme name </span>
<span style="color: #000000; font-weight: bold;">function</span> MYTHEME_preprocess_page<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$variables</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$search_box</span> <span style="color: #339933;">=</span> drupal_render<span style="color: #009900;">&#40;</span>drupal_get_form<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'search_form'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$variables</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'my_search_box'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$search_box</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>And then, in our <code>page.tpl.php</code>, just print that <code>$my_search_box</code> variable we just set earlier&#8230;</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>php
<span style="color: #666666; font-style: italic;">// this is page.tpl.php</span>
<span style="color: #b1b100;">print</span> <span style="color: #000088;">$my_search_box</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>If done like so, it will work and render the search form, but it will spit out something like<br />
<em>Strict warning: Only variables should be passed by reference in</em></p>
<p>This has to be with variables being passed as reference, and not creating an instance for those first. <a href="http://www.php.net/manual/en/language.references.pass.php" target="_blank">Read this for further information</a>.</p>
<p>So, let&#8217;s fix it.</p>
<p>In template.php:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// this is template.php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> MYTHEME_preprocess_page<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$variables</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// para poder usar una caja de búsqueda en los templates .tpl.php de Drupal 7...	</span>
  <span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> drupal_get_form<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'search_form'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$cajabusqueda</span> <span style="color: #339933;">=</span> drupal_render<span style="color: #009900;">&#40;</span><span style="color: #000088;">$form</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$variables</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cajabusqueda'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cajabusqueda</span><span style="color: #339933;">;</span>   
<span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-override-node-tpl-php-using-zen-theme-solved/' rel='bookmark' title='Drupal: Override node.tpl.php using Zen theme [solved]'>Drupal: Override node.tpl.php using Zen theme [solved]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-pathauto-url-pattern-page-is-empty-solved/' rel='bookmark' title='Drupal 7: Pathauto url pattern page is empty [SOLVED]'>Drupal 7: Pathauto url pattern page is empty [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-path-breadcrumbs-in-views-page-solved/' rel='bookmark' title='Drupal 7: Path breadcrumbs in Views page [SOLVED]'>Drupal 7: Path breadcrumbs in Views page [SOLVED]</a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-search-box-in-page-tpl-php-or-other-template-files-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal 7: Pathauto url pattern page is empty [SOLVED]</title>
		<link>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-pathauto-url-pattern-page-is-empty-solved/</link>
		<comments>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-pathauto-url-pattern-page-is-empty-solved/#comments</comments>
		<pubDate>Wed, 03 Apr 2013 17:14:51 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[d7]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[drupal7]]></category>
		<category><![CDATA[memory_limit]]></category>
		<category><![CDATA[path]]></category>
		<category><![CDATA[pathauto]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[php.ini]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2246</guid>
		<description><![CDATA[If you install Pathauto 7.x-1.2 in the last Drupal stable version (7.21) and try to define some new url patterns <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-pathauto-url-pattern-page-is-empty-solved/" class="more-link"><span>Continue Reading &#8594;</span></a></span><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-6-pathauto-missing-in-administer-site-configuration-solved/' rel='bookmark' title='Drupal 6: pathauto missing in Administer -&gt; Site Configuration [SOLVED]'>Drupal 6: pathauto missing in Administer -> Site Configuration [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-search-box-in-page-tpl-php-or-other-template-files-solved/' rel='bookmark' title='Drupal 7: Display search box in page.tpl.php or other template files [SOLVED]'>Drupal 7: Display search box in page.tpl.php or other template files [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-and-wamp-enable-clean-url-using-mod_rewrite-solved/' rel='bookmark' title='DRUPAL and WAMP: enable &#8216;Clean URL&#8217; using mod_rewrite [SOLVED]'>DRUPAL and WAMP: enable &#8216;Clean URL&#8217; using mod_rewrite [SOLVED]</a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>If you install <a href="http://ftp.drupal.org/files/projects/pathauto-7.x-1.2.tar.gz">Pathauto 7.x-1.2</a> in the last Drupal stable version (7.21) and try to define some new url patterns for your content type&#8217;s (under <code>?q=admin/config/search/path/patterns</code> or <code>Administration > Search and metadata > Url aliases > Pattern</code> tab) it is likely that an <strong>empty</strong> &#8220;ugly&#8221; page shows up&#8230; </p>
<p>This was driving me nuts but I finally found how to make it work.</p>
<p><strong>Scenario:</strong><br />
Drupal 7.21<br />
Token 7.x-1.5<br />
Pathauto 7.x-1.2<br />
Admin theme: Seven</p>
<p><strong>The fix</strong><br />
It seems that <strong>Seven theme</strong> is responsible for this. This theme has some issues with js/jQuery and won&#8217;t show (out of the box) the Pathauto pattern&#8217;s.</p>
<p>To fix it, just go to <code>Appearance</code>, scroll down to the bottom of the page and select &#8220;Bartik&#8221; or &#8220;<code>Garland</code>&#8221; instead of &#8220;<code>Seven</code>&#8220;. </p>
<p>Now save, and reload <code>?q=admin/config/search/path/patterns</code>. The pattern tab info should be nicely displayed now.</p>
<p>If it works, you can try to activate Seven theme for admin again. In my case, it worked.</p>
<p>*** UPDATE 20130427***<br />
If the steps above won&#8217;t fix the issue, then edit your <code>php.ini</code> field and try to increase <code>memory_limit</code> to a higher value. For instance, in my case I changed from:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">memory_limit = 32M</pre></td></tr></table></div>

<p>To:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">memory_limit = 64M</pre></td></tr></table></div>

<p>After updating <code>php.ini</code> do not forget to restart your web server!</p>
<p>Further information: http://drupal.org/node/1267966</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-6-pathauto-missing-in-administer-site-configuration-solved/' rel='bookmark' title='Drupal 6: pathauto missing in Administer -&gt; Site Configuration [SOLVED]'>Drupal 6: pathauto missing in Administer -> Site Configuration [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-display-search-box-in-page-tpl-php-or-other-template-files-solved/' rel='bookmark' title='Drupal 7: Display search box in page.tpl.php or other template files [SOLVED]'>Drupal 7: Display search box in page.tpl.php or other template files [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-and-wamp-enable-clean-url-using-mod_rewrite-solved/' rel='bookmark' title='DRUPAL and WAMP: enable &#8216;Clean URL&#8217; using mod_rewrite [SOLVED]'>DRUPAL and WAMP: enable &#8216;Clean URL&#8217; using mod_rewrite [SOLVED]</a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/informatica-web/drupal-informatica-web/drupal-7-pathauto-url-pattern-page-is-empty-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python with MySQL special characters issues (tildes, etc) [SOLVED]</title>
		<link>http://www.leccionespracticas.com/python/python-with-mysql-special-characters-issues-tildes-etc-solved/</link>
		<comments>http://www.leccionespracticas.com/python/python-with-mysql-special-characters-issues-tildes-etc-solved/#comments</comments>
		<pubDate>Wed, 06 Mar 2013 07:41:49 +0000</pubDate>
		<dc:creator>Miguel</dc:creator>
				<category><![CDATA[python]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqldb]]></category>
		<category><![CDATA[unicode]]></category>
		<category><![CDATA[utf-8]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://www.leccionespracticas.com/?p=2243</guid>
		<description><![CDATA[Some days ago a friend of mine who is learning python asked for my help. He was experimenting issues with <span class="ellipsis">&#8230;</span> <span class="more-link-wrap"><a href="http://www.leccionespracticas.com/python/python-with-mysql-special-characters-issues-tildes-etc-solved/" class="more-link"><span>Continue Reading &#8594;</span></a></span><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/uncategorized/mysql-select-distinct-y-tildes-en-utf8-resuelto/' rel='bookmark' title='Mysql SELECT DISTINCT y tildes en utf8 [RESUELTO]'>Mysql SELECT DISTINCT y tildes en utf8 [RESUELTO]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/errno-13-permission-denied-root-python-eggs-solved/' rel='bookmark' title='[Errno 13] Permission denied: &#8216;/root/.python-eggs&#8217; [SOLVED]'>[Errno 13] Permission denied: &#8216;/root/.python-eggs&#8217; [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-sistemas-y-servidores/mysql-how-to-rename-a-database-solved/' rel='bookmark' title='Mysql: how to rename a database [solved]'>Mysql: how to rename a database [solved]</a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Some days ago a friend of mine who is learning python asked for my help. He was experimenting issues with spanish special characters (such as tildes -á,é,í,ó,ú- and -ñ-) when retrieving data from a MySQL database.</p>
<p>When I looked at the code, I saw he was connecting to MySQL using MySQLdb connect function as in:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> MySQLdb <span style="color: #ff7700;font-weight:bold;">as</span> mdb
con <span style="color: #66cc66;">=</span> mdb.<span style="color: black;">connect</span><span style="color: black;">&#40;</span>host<span style="color: #66cc66;">=</span><span style="color: #483d8b;">'localhost'</span><span style="color: #66cc66;">,</span><span style="color: #dc143c;">user</span><span style="color: #66cc66;">=</span><span style="color: #483d8b;">'myuser'</span><span style="color: #66cc66;">,</span>passwd<span style="color: #66cc66;">=</span><span style="color: #483d8b;">'mypassword'</span><span style="color: #66cc66;">,</span>db<span style="color: #66cc66;">=</span><span style="color: #483d8b;">'mydatabase'</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>And he was astonished because I was able to solve his problems just by changing that to:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> MySQLdb <span style="color: #ff7700;font-weight:bold;">as</span> mdb
con <span style="color: #66cc66;">=</span> mdb.<span style="color: black;">connect</span><span style="color: black;">&#40;</span>host<span style="color: #66cc66;">=</span><span style="color: #483d8b;">'localhost'</span><span style="color: #66cc66;">,</span><span style="color: #dc143c;">user</span><span style="color: #66cc66;">=</span><span style="color: #483d8b;">'myuser'</span><span style="color: #66cc66;">,</span>passwd<span style="color: #66cc66;">=</span><span style="color: #483d8b;">'mypassword'</span><span style="color: #66cc66;">,</span>db<span style="color: #66cc66;">=</span><span style="color: #483d8b;">'mydatabase'</span><span style="color: #66cc66;">,</span> charset<span style="color: #66cc66;">=</span><span style="color: #483d8b;">'utf8'</span><span style="color: #66cc66;">,</span> use_unicode<span style="color: #66cc66;">=</span><span style="color: #008000;">False</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>So don&#8217;t underestimate the power of <a href="http://mysql-python.sourceforge.net/MySQLdb.html#id8" title="MySQLdb connect function" target="_blank">official documentation</a> and please, RTFM!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href='http://www.leccionespracticas.com/uncategorized/mysql-select-distinct-y-tildes-en-utf8-resuelto/' rel='bookmark' title='Mysql SELECT DISTINCT y tildes en utf8 [RESUELTO]'>Mysql SELECT DISTINCT y tildes en utf8 [RESUELTO]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-web/errno-13-permission-denied-root-python-eggs-solved/' rel='bookmark' title='[Errno 13] Permission denied: &#8216;/root/.python-eggs&#8217; [SOLVED]'>[Errno 13] Permission denied: &#8216;/root/.python-eggs&#8217; [SOLVED]</a></li>
<li><a href='http://www.leccionespracticas.com/informatica-sistemas-y-servidores/mysql-how-to-rename-a-database-solved/' rel='bookmark' title='Mysql: how to rename a database [solved]'>Mysql: how to rename a database [solved]</a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.leccionespracticas.com/python/python-with-mysql-special-characters-issues-tildes-etc-solved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
