tag:blogger.com,1999:blog-23799131162791010582024-03-13T14:26:00.881-07:00be útilaerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.comBlogger52125tag:blogger.com,1999:blog-2379913116279101058.post-73159910910003466932016-09-12T14:39:00.001-07:002016-09-12T14:40:16.806-07:00Introducció a les bases de dadesJa disponible el llibre '<a href="https://uf.ctrl-alt-d.net/material/mostra/225/introduccio-a-les-bases-de-dades">Introducció a les bases de dades'</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://uf.ctrl-alt-d.net/material/mostra/225/introduccio-a-les-bases-de-dades"><img border="0" height="320" src="https://4.bp.blogspot.com/-3vgdU6apinI/V9cgX8VB6lI/AAAAAAAAAgw/sqMQuTIK-KQ-jXjkDq0sRZGiM6ylIgi-QCLcB/s320/portada.jpg" width="224" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<br />
<br />aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-81481853086962385522014-03-01T14:27:00.002-08:002014-03-01T14:27:39.004-08:00Stack Overflow, número de consultes sobre Java, PHP, Python i .NETTot programador coneix <a href="http://stackoverflow.com/">StackOverflow</a>, és una web gamificada de preguntes i respostes per a desenvolupadors d'aplicacions. Totes les dades del portal són públiques excepte els vots que emeten els usuaris entre si. Amb les dades de la web he elaborat aquestes estadístiques:<br />
<br />
1) Número de consultes mensuals dels llenguatges Java, PHP, Python i .NET<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-qXDfnmtBj84/UxJYeT6h1rI/AAAAAAAAAUk/_GDNjQ5f_k4/s1600/4bigs.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-qXDfnmtBj84/UxJYeT6h1rI/AAAAAAAAAUk/_GDNjQ5f_k4/s1600/4bigs.png" /></a></div>
<br />
<span style="font-size: xx-small;"><i>Nota: He englobat dins de cada llenguatge els següents tags:</i></span><br />
<i><span style="font-size: xx-small;">Java: 'java', 'java-me', 'java-ee', 'javafx', 'javafx-2'</span><br /><span style="font-size: xx-small;">PHP: 'php%', 'zend-framework', 'codeigniter' </span><br /><span style="font-size: xx-small;">Python: like 'python%', 'django'</span><br /><span style="font-size: xx-small;">.NET: '.net%', 'C#' , 'linq', 'VB%NET'</span></i><br />
<br />
Sobta veure que .NET rep molt poques consultes, però hem de pensar que disposen del seu propi forum ( <a href="http://social.msdn.microsoft.com/Forums/en-US/home">MSDN</a> ). També cal notar com al 2010 el número de preguntes mensuals sobre aquests 4 llenguatges era de unes 5k mentre que al 2014 ja ens apropem a les 20K preguntes mensuals per Java i PHP.<br />
<br />
2) Estacionalitat de les consultes.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-JJxKzB5kfiM/UxJYeLe2hxI/AAAAAAAAAUg/BfjQ4JU5nQI/s1600/4big-stationary.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-JJxKzB5kfiM/UxJYeLe2hxI/AAAAAAAAAUg/BfjQ4JU5nQI/s1600/4big-stationary.png" /></a></div>
<br />
Es curiós comprovar com l'estacionalitat de PHP i Java és tant semblant. Què passa al juny amb aquests programadors?<br />
<br />
3) Frameworks django vs RoR:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-C3KxvdDqyvI/UxJYe9OikpI/AAAAAAAAAUs/yfrAMHXDMPs/s1600/RvsD.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-C3KxvdDqyvI/UxJYe9OikpI/AAAAAAAAAUs/yfrAMHXDMPs/s1600/RvsD.png" height="249" width="320" /></a></div>
Aquest gràfic em diu que potser hauria d'haver triat RoR en comptes de django com a llenguatge de capcelera, però no ho puc evitar, el python és genial.<br />
<br />
4) Evolució Entity Framework<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-TY9siqACbDQ/UxJYebQUIKI/AAAAAAAAAUo/K_7vRjKhC5I/s1600/EF.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-TY9siqACbDQ/UxJYebQUIKI/AAAAAAAAAUo/K_7vRjKhC5I/s1600/EF.png" height="254" width="320" /></a></div>
<br />
Aquesta és l'evolució del número de preguntes d'EF. L'he inclòs a l'estadística perquè a l'agost del 2012 <a href="http://romiller.com/">Rowan Miller</a>, gurú d'EF, va demanar que les preguntes d'aquest producte es realitzessin a SO:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-YObxxKvbJcw/UxJa4sdothI/AAAAAAAAAU8/oC-lamr03XM/s1600/ef-ms.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-YObxxKvbJcw/UxJa4sdothI/AAAAAAAAAU8/oC-lamr03XM/s1600/ef-ms.png" /></a></div>
Val a dir que aquestes estadístiques no serveixen massa per comparar un llenguatge amb un altre. Per exemple al cas de .NET apareixen 'poques' preguntes a SO, això és degut a que disposa del seu propi foro de programadors i és molt actiu. La conclusió graciosa a la que he arribat és que els programadors de Java i PHP s'en van de vacances junts al juny, mentre que els de python les agafen al setembre. I la seriosa és que StackOverflow és una història de win-win, fan una grandíssima aportació a la comunitat de programadors i a canvi ofereixen a les empreses la base de dades d'usuaris del portal (els que reben invitació per ser-hi i l'accepten) per a les operacions de fixatges.<br />
<br />
Qualsevol proposta per explorar dades de l'SO serà benvinguda.<br />
<br />
<br />
<br />
<br />
<br />aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-901195237780431392013-11-25T12:44:00.002-08:002013-11-25T12:53:21.831-08:00Avaluació de la docència de la Unitat Formativa 3: Desenvolupament web en entorn servidor - Tècniques d’accés a dades.Aquest és el resultat de l'enquesta sobre assoliment de resultats de la UF3, Desenvolupament web en entorn servidor - Tècniques d’accés a dades. Hem treballat l'accés a dades amb PHP mitjançant <a href="http://uf.ctrl-alt-d.net/material/mostra/50/php-acces-a-dades-amb-pdo">PDO (+SQL)</a>, <a href="http://uf.ctrl-alt-d.net/material/mostra/53/ef-acces-a-dades-amb-lorm-de-microsoft">Entity Framework 6</a> i <a href="http://uf.ctrl-alt-d.net/material/mostra/97/django-definint-models">models django</a>.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://public.tableausoftware.com/views/DAW-MP7-UF32013-14/Hoja1?:embed=y&:display_count=no"><img border="0" src="http://3.bp.blogspot.com/-mQLMwlZgUCs/UpO2E33VtbI/AAAAAAAAATQ/MrzNlGtW7hw/s1600/uf3mp7.png" /></a></div>
Del punt 1.7 ( i A.7) només s'ha fet teoria, no exercicis. És destacable com els exercicis són bàsics per a l'assoliment de la materia en aquest cicle.aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-7666319417396253812013-11-14T13:19:00.002-08:002013-11-14T23:33:22.375-08:00Com fer el deploy d'app django actualitzat a dinahosting<br />
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
Dinahosting suporta aplicacions django, per defecte django1.4 i python2.6.5 (nov 2013). </div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<br /></div>
<div style="color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<span style="background-color: yellow;">Nosaltres actualitzarem el django a la darrera versió usant un virtualenv.</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
Cal que la teva imatge de hosting sigui python / node.js, si no ho és, has d'anar a la eina storm i canviar-ho ( Hosting / Administrar / STORM ). T'ha de quedar així:</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-epg_20RCRXc/UoVEh04uZLI/AAAAAAAAAS0/GZGAW_l6bY0/s1600/i1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-epg_20RCRXc/UoVEh04uZLI/AAAAAAAAAS0/GZGAW_l6bY0/s1600/i1.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #222222; font-size: 13px;">
<div style="font-family: arial, sans-serif;">
Ara cal entrar per ssh:</div>
<div style="font-family: arial, sans-serif;">
<br /></div>
<div style="font-size: small;">
<span style="font-family: Courier New, Courier, monospace;">1) Crear usuari ftp i posar-li password.</span></div>
<div style="font-size: small;">
<span style="font-family: Courier New, Courier, monospace;">2) ssh -p 22 nomUsuariFtp@www.dominiQueSigui.cat</span></div>
<div style="font-family: arial; font-size: small;">
<br /></div>
<div style="font-family: arial, sans-serif;">
Pots posar l'aplicació allà on vulguis, jo l'he posat sota de www, de manera que m'ha quedat un arbre com aquest:</div>
</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<br /></div>
<blockquote style="background-color: white; border: none; color: #222222; font-family: arial, sans-serif; font-size: 13px; margin: 0px 0px 0px 40px; padding: 0px;">
<span style="font-family: courier new, monospace; font-size: xx-small;"><b>home</b></span></blockquote>
<blockquote style="background-color: white; border: none; color: #222222; font-family: arial, sans-serif; font-size: 13px; margin: 0px 0px 0px 40px; padding: 0px;">
<b style="font-family: 'courier new', monospace; font-size: x-small;"> gratia</b><span style="background-color: transparent;"> </span></blockquote>
<blockquote style="background-color: white; border: none; color: #222222; font-family: arial, sans-serif; font-size: 13px; margin: 0px 0px 0px 40px; padding: 0px;">
<b style="font-family: 'courier new', monospace; font-size: x-small;"> django16p27</b></blockquote>
<blockquote style="background-color: white; border: none; color: #222222; font-family: arial, sans-serif; font-size: 13px; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
<blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
</div>
</blockquote>
<span style="font-family: courier new, monospace; font-size: xx-small;"> .htaccess (1)</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><b> www</b></span></div>
<div>
<span style="font-family: 'courier new', monospace;"><span style="font-size: xx-small;"> .htaccess (2)</span></span></div>
<div>
<span style="font-family: 'courier new', monospace;"><span style="font-size: xx-small;"> ping2u.wsgi</span></span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><b> ping2u</b></span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><b> </b>manage.py</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><b> ping2u</b></span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><b> </b>settings.py</span><b style="font-family: 'courier new', monospace;"> </b></div>
</blockquote>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #222222; font-size: 13px;">
<ul>
<li><b style="font-family: 'courier new', monospace;">django16p27 </b><span style="font-family: Arial, Helvetica, sans-serif;">és un virtualenv amb el django 1.6 instal·lat, mira al final del manual si no saps com crear-lo.</span></li>
<li style="font-family: arial, sans-serif;"><b>gratia</b> és el meu usuari</li>
<li style="font-family: arial, sans-serif;"><b>ping2u</b> és la aplicació que vols fer rodar (mira el final del document si no saps crear-la)</li>
<li style="font-family: arial, sans-serif;">El primer .htaccess l'he deixat tal com ve.</li>
<li style="font-family: arial, sans-serif;">El segon .htaccess és el que cal adaptar, ha de quedar com aquest:</li>
</ul>
</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<br /></div>
<blockquote style="background-color: white; border: none; color: #222222; font-family: arial, sans-serif; font-size: 13px; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">RewriteEngine On</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">RewriteCond %{REQUEST_FILENAME} !-f</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">RewriteRule ^(.*)$ /<b>ping2u.wsgi</b>/$1 [QSA,L]</span></div>
</blockquote>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<ul>
<li>El fitxer 'ping2u.wsgi' t'ha de quedar com aquest:</li>
</ul>
</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<br /></div>
<blockquote style="background-color: white; border: none; color: #222222; font-family: arial, sans-serif; font-size: 13px; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">import os, sys</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">import site</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><br /></span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"># Remember original sys.path.</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">prev_sys_path = list(sys.path)</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><br /></span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">site.addsitedir('/home/gratia/<wbr></wbr>django16py27/lib/python2.6/<wbr></wbr>site-packages/')</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">sys.path.append('/home/gratia/<wbr></wbr>www/ping2u')</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><br /></span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"># Posar els paths de l'entorn virtual davant dels per defecte.</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">new_sys_path = [] </span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">for item in list(sys.path): </span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"> if item not in prev_sys_path: </span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"> new_sys_path.append(item) </span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"> sys.path.remove(item) </span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">sys.path[:0] = new_sys_path </span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><br /></span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">os.environ['DJANGO_SETTINGS_<wbr></wbr>MODULE'] = 'ping2u.settings'</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">from django.core.handlers.wsgi import WSGIHandler</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">application = WSGIHandler()</span></div>
</blockquote>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<ul>
<li><span style="font-family: arial, helvetica, sans-serif;">Creació del virtualenv:</span></li>
</ul>
</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<span style="font-family: arial, helvetica, sans-serif;"><br /></span></div>
<blockquote style="background-color: white; border: none; color: #222222; font-family: arial, sans-serif; font-size: 13px; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">cd ~</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">virtualenv <b>django16p27</b></span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">source ~/django16p27/bin/activate</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">pip install django</span></div>
</blockquote>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<span style="font-family: arial, helvetica, sans-serif;"><br /></span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<ul>
<li><span style="font-family: arial, helvetica, sans-serif;">Per crear l'aplicació de test </span><b style="font-family: 'courier new', monospace;">ping2u</b><span style="font-family: arial, helvetica, sans-serif;">:</span></li>
</ul>
</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<span style="font-family: arial, helvetica, sans-serif;"><br /></span></div>
<blockquote style="background-color: white; border: none; color: #222222; font-family: arial, sans-serif; font-size: 13px; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">cd www</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">django-admin.py startproject ping2u</span></div>
</blockquote>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<span style="font-family: arial, helvetica, sans-serif;"><br /></span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
A l'aplicació he provocat un error (divisió per 0) per veure si està rodant realment amb 1.6:</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-d58sjYHn4EI/UoVEh0tYX-I/AAAAAAAAAS4/EXEc-cgvIzw/s1600/i2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="181" src="http://3.bp.blogspot.com/-d58sjYHn4EI/UoVEh0tYX-I/AAAAAAAAAS4/EXEc-cgvIzw/s400/i2.png" width="400" /></a></div>
<br /></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<span style="font-family: arial, helvetica, sans-serif;"><br /></span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<span style="font-family: arial, helvetica, sans-serif;">L'.htaccess (1) és aquest:</span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<span style="font-family: arial, helvetica, sans-serif;"><br /></span></div>
<blockquote style="background-color: white; border: none; color: #222222; font-family: arial, sans-serif; font-size: 13px; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">##</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">## DHGENERATED</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">## NO EDITAR MANUALMENTE!!!!</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;">##</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><ifmodule mod_python.c=""></ifmodule></span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><span style="white-space: pre-wrap;"> </span>AddHandler mod_python .py</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><span style="white-space: pre-wrap;"> </span>PythonHandler mod_python.publisher</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><span style="white-space: pre-wrap;"> </span>PythonDebug On</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><span style="white-space: pre-wrap;"> </span>Options +ExecCGI</span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><span style="white-space: pre-wrap;"> </span>AddHandler wsgi-script .wsgi</span></div>
</blockquote>
<br />
<blockquote style="background-color: white; border: none; color: #222222; font-family: arial, sans-serif; font-size: 13px; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
<span style="background-color: transparent; font-family: 'courier new', monospace; font-size: xx-small; white-space: pre-wrap;"> </span><span style="background-color: transparent; font-family: 'courier new', monospace; font-size: xx-small;">RewriteEngine On</span></div>
</blockquote>
<br />
<blockquote style="background-color: white; border: none; color: #222222; font-family: arial, sans-serif; font-size: 13px; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
<span style="background-color: transparent; font-family: 'courier new', monospace; font-size: xx-small;">##REGLAS_NODE##</span></div>
</blockquote>
<br />
<blockquote style="background-color: white; border: none; color: #222222; font-family: arial, sans-serif; font-size: 13px; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
<span style="background-color: transparent; font-family: 'courier new', monospace; font-size: xx-small;">##FIN_REGLAS_NODE##</span></div>
</blockquote>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"><br /></span></div>
<div>
<span style="font-family: courier new, monospace; font-size: xx-small;"></span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<div style="font-family: arial, helvetica, sans-serif;">
<br /></div>
</div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<span style="font-family: arial, helvetica, sans-serif;"><br /></span></div>
<div style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px;">
<a href="http://1.bp.blogspot.com/-xLoKMIDq3vc/UoVGqjP_vEI/AAAAAAAAATA/pyDIRe7yC_c/s1600/i3.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="http://1.bp.blogspot.com/-xLoKMIDq3vc/UoVGqjP_vEI/AAAAAAAAATA/pyDIRe7yC_c/s320/i3.png" width="169" /></a><span style="font-family: arial, helvetica, sans-serif;">I això és tot. <b>Agraïr a la gent de suport de dinahosting, en especial a A.A. </b>l'ajuda que m'han prestat per poder posar en marxa l'aplicació, els fitxers .htaccess són seus. Una llàstima la versió de python, tant de bo la canviin aviat.</span><br />
<span style="font-family: arial, helvetica, sans-serif;"><br /></span>
<span style="font-family: arial, helvetica, sans-serif;">Després de tot plegat, aquí la meva aplicació (que encara no sé per a que em serveix) funcionant.</span><br />
<br />
<span style="font-family: arial, helvetica, sans-serif;">Disclaimer: aquesta guia no és oficial de dinahosting, utilitza-la al teu risc.</span><br />
<span style="font-family: arial, helvetica, sans-serif;"><br /></span></div>
aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-91612730276653349142013-11-09T06:18:00.000-08:002013-11-09T06:25:07.464-08:00Quaderns Exercicis FP - Correu del divendres 8 de Novembre<div dir="ltr">
Novetats de <a href="http://uf.ctrl-alt-d.net/social/intro/">Quaderns d'Exercicis FP</a>.<br />
<div>
<br /></div>
<div>
<span style="font-size: x-large;">Ja tenim 92 exercicis al portal i pujant!</span></div>
<div>
<br /></div>
<div>
<a href="http://3.bp.blogspot.com/-_FE8GUkmgzM/Un5EVNsaXMI/AAAAAAAAARg/fiiIekSAjxw/s1600/image-740253.png"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5944263689419513026" src="http://3.bp.blogspot.com/-_FE8GUkmgzM/Un5EVNsaXMI/AAAAAAAAARg/fiiIekSAjxw/s320/image-740253.png" /></a></div>
<div>
<br /></div>
<div>
Per UF el total d'exercicis són els següents ( hi ha UF's equivalents que comparteixen exercicis ):</div>
<div>
<br /></div>
<div>
<a href="http://4.bp.blogspot.com/-2pX_f2YhiOw/Un5EV3ZALRI/AAAAAAAAARs/fbrwJ3Hb8OQ/s1600/image-743115.png"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5944263700612394258" src="http://4.bp.blogspot.com/-2pX_f2YhiOw/Un5EV3ZALRI/AAAAAAAAARs/fbrwJ3Hb8OQ/s320/image-743115.png" /></a></div>
<div>
<br /></div>
<div>
<b><span style="font-size: x-large;"><br /></span></b>
<b>Xavier Sala, </b><b>Carles Caño, </b><b>Isaac Muro, </b><b>Marc Nicolau, </b><b>Juaky</b><br />
<b><span style="font-size: large;">Gràcies per compartir!</span></b></div>
<blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;">
<div>
<br /></div>
<div>
<br /></div>
<div>
<span style="font-size: medium;">Com <b>donar les gràcies</b> als companys? Marcar com a útil:</span></div>
<div>
<span style="font-size: medium;"> <a href="http://2.bp.blogspot.com/-_RJXv9worgk/Un5EWmV_WRI/AAAAAAAAAR4/BWAm6xwv4-w/s1600/image-745972.png"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5944263713216223506" src="http://2.bp.blogspot.com/-_RJXv9worgk/Un5EWmV_WRI/AAAAAAAAAR4/BWAm6xwv4-w/s320/image-745972.png" /></a></span></div>
<div>
<br /></div>
</blockquote>
<div>
<blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
</div>
</blockquote>
</div>
<div>
<br /></div>
<div>
<span style="font-size: x-large;">Novetats tècniques</span></div>
<blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;">
<div>
<span style="font-size: x-large;"><br /></span></div>
<div>
<span style="font-size: medium;">El codi queda resaltat ( merci dani h.):</span></div>
<div>
<span style="font-size: medium;"><br /></span></div>
<div>
<blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
<a href="http://3.bp.blogspot.com/-7JJGtXXD6Hs/Un5EXK0eJhI/AAAAAAAAASE/ywPLdthdMMM/s1600/image-748420.png"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5944263723007747602" src="http://3.bp.blogspot.com/-7JJGtXXD6Hs/Un5EXK0eJhI/AAAAAAAAASE/ywPLdthdMMM/s320/image-748420.png" /></a></div>
</blockquote>
</div>
<div>
<span style="font-size: medium;"><br /></span></div>
<div>
<span style="font-size: medium;">Es poden fer taules ( merci xavi s.):</span></div>
<div>
<span style="font-size: medium;"><br /> </span></div>
<div>
<blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
<a href="http://4.bp.blogspot.com/-8hyqyu3uHGE/Un5EXjVVq0I/AAAAAAAAASQ/IpCOTHi4Rv0/s1600/image-750139.png"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5944263729588054850" src="http://4.bp.blogspot.com/-8hyqyu3uHGE/Un5EXjVVq0I/AAAAAAAAASQ/IpCOTHi4Rv0/s320/image-750139.png" /></a></div>
</blockquote>
</div>
<div>
<span style="font-size: medium;"><br /> </span></div>
<div>
<span style="font-size: medium;">Les imatges responsives (merci carles c.):</span></div>
<div>
<blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
<br /></div>
</blockquote>
</div>
<div>
<blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;">
<div>
<a href="http://1.bp.blogspot.com/-Fo1sa0u2r68/Un5EYMZ8DxI/AAAAAAAAASc/rhuLNTJrjhg/s1600/image-752247.png"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5944263740613201682" src="http://1.bp.blogspot.com/-Fo1sa0u2r68/Un5EYMZ8DxI/AAAAAAAAASc/rhuLNTJrjhg/s320/image-752247.png" /></a></div>
<div>
<br /></div>
</blockquote>
</div>
</blockquote>
<blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;">
<div>
Nota: la manera més fàcil per saber com es fan aquests recursos amb MarkDown és editar l'exercici d'un company que ho hagi fet servir i copiar ;)</div>
</blockquote>
<div>
<br /></div>
<div>
<span style="font-size: medium;">Us animo a seguir compartint i disfrutant dels exercicis dels companys i a fer divulgació del portal <a href="http://uf.ctrl-alt-d.net/social/intro/">Quaderns d'Exercicis FP</a></span></div>
<div>
Tots els suggeriments són benvinguts ... una altre cosa és el temps que tingui per poder-los implementar ;)</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<span style="font-size: x-small;"><br /></span></div>
<div>
<span style="font-size: x-small;"><br /></span></div>
<div>
<span style="font-size: x-small;"><br /></span></div>
</div>
aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-47958518429869286762013-10-29T04:10:00.000-07:002013-10-29T04:10:51.965-07:00Com fer-te el teu propi notificador disponibilitat de Nexus 5Proliferen pàgines on et pots subscriure a<b> avisos de disponibilitat de productes</b>. Aquí t'explico com fer-te el teu propi notificador Nexus 5 amb unes poques línies de codi.<br />
<br />
Necessitarem:<br />
<br />
- Una màquina linux connectada a internet les 24h i amb el correu configurat<br />
- Un dispositiu que pugui rebre correu electrònic per rebre l'alerta.<br />
<br />
Primer crees una carpeta per al projecte:<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">mkdir /directori_de/disponibiliatatNexus</span><br />
<br />
Després et baixes la pàgina de Google on encara no apareix el Nexus 5:<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/usr/bin/wget -o /dev/null -O - https://play.google.com/store/devices \</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">| grep -v page-load-indicator > no.html</span><br />
<br />
I ara escrius aquest script, li direm comprova.sh:<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">#!/bin/bash</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">cd /directori_de/disponibiliatatNexus</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/usr/bin/wget -o /dev/null -O - https://play.google.com/store/devices \</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">| grep -v page-load-indicator > potser.html</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">diff no.html potser.html > /dev/null</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">if [ -a nomore ]</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">then</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> exit</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">fi</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">if [ $? -eq 1 ]</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">then</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> touch nomore</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> echo "Subject:Comprova diponibilitat nexus" | /usr/bin/sendmail el_teu@correu.cat</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">fi</span><br />
<br />
Poses l'script al cron:<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">3,altres minuts,57 * * * * \</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/directori_de/disponibiliatatNexus/comprova.sh 2>> \</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/directori_de/disponibiliatatNexus/errors.log</span><br />
<br />
<span style="font-size: large;">I t'esperes a rebre l'avís.</span><br />
<br />
That's all!aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-13775541764848734642013-10-26T07:10:00.001-07:002013-11-25T12:45:10.702-08:00Autoavaluació MÒDUL 7: DESENVOLUPAMENT WEB EN ENTORN SERVIDOR
<h1>Autoavaluació</h1>
<h2>MÒDUL 7: DESENVOLUPAMENT WEB EN ENTORN SERVIDOR</h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-jamewCoWvOw/UmvXqE6837I/AAAAAAAAARE/jehY6Hs3Wmo/s1600/uf1-mitjana.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="243" src="http://4.bp.blogspot.com/-jamewCoWvOw/UmvXqE6837I/AAAAAAAAARE/jehY6Hs3Wmo/s400/uf1-mitjana.png" width="400" />
</a>
</div>
<p>Aquest és el resultat de l'autoavaluació anònima dels alumnes a la primera unitat formativa del mòdul professional <a href="http://uf.ctrl-alt-d.net/material/favorit/daw-mp07-uf1/?sort=resultats_aprenentatge_txt">DESENVOLUPAMENT WEB EN ENTORN SERVIDOR</a></p>
<p>La valoració de cada ítem és del 1 al 5, essent 5 perfecte i 1 molt malament. A la representació gràfica la puntuació 3 ( corresponent a la nota de 'un 5' ) és considerada negativa i li assigno el color groc. La puntuació 4 i 5, són possitives i els assigno el color verd. El taronja i el vermell representen les pitjors puntuacions, el 4 i el 5.</p>
<p>Les conclusions al llegir els resultats és que la UF ha anat prou bé. No haver modificat cap CMS ha fet baixar molt la valoració del resultat d'aprenentatge 4. Els alumnes estan contents de l'esforç que han realitzat durant aquesta unitat formatica i, al marge de l'autoavaluació, jo també estic satisfet de l'interés que han mostrat a classe i el treball que han realitzat.</p>
<p>Hi ha hagut un despistat que ha valorat molt possitivament el resultat d'aprenentatge 4.6. Ho podeu veure en detall punxant a la pestanya 'D.Detall'</p>
<p>Espero que aquesta UF hagi servit per assentar els conceptes bàsics de la programació web: session-less, cookies, POST, GET, etc.</p>
<script type='text/javascript' src='http://public.tableausoftware.com/javascripts/api/viz_v1.js'></script><div class='tableauPlaceholder' style='width: 1004px; height: 895px;'><noscript><a href='#'><img alt=' ' src='http://public.tableausoftware.com/static/images/DA/DAW-MP7-UF1/Dashboard/1_rss.png' style='border: none' /></a></noscript><object class='tableauViz' width='690' height='995' style='display:none;'><param name='host_url' value='http%3A%2F%2Fpublic.tableausoftware.com%2F' /> <param name='site_root' value='' /><param name='name' value='DAW-MP7-UF1/Dashboard' /><param name='tabs' value='yes' /><param name='toolbar' value='yes' /><param name='static_image' value='http://public.tableausoftware.com/static/images/DA/DAW-MP7-UF1/Dashboard/1.png' / > <param name='animate_transition' value='yes' /><param name='display_static_image' value='yes' /><param name='display_spinner' value='yes' /><param name='display_overlay' value='yes' /><param name='display_count' value='yes' /></object></div><div style='width:1004px;height:22px;padding:0px 10px 0px 0px;color:black;font:normal 8pt verdana,helvetica,arial,sans-serif;'><div style='float:right; padding-right:8px;'><a href='http://www.tableausoftware.com/public/about-tableau-products?ref=http://public.tableausoftware.com/views/DAW-MP7-UF1/Dashboard' target='_blank'>Learn About Tableau</a></div></div>
Visualutzació de dades amb la tècnica <a href="http://www.organizationview.com/net-stacked-distribution-a-better-way-to-visualize-likert-data">Net stacked distribution – a better way to visualize Likert data</a>aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-58079560651950561172013-08-12T07:53:00.001-07:002013-08-12T07:53:57.041-07:00Retention VisualizationL'indicador 'Retention' ens explica la quantitat de persones que repeteixen un servei. Per calcular l'indicador 'retention' cal anar als logs d'accés i 'cuinar' les dades. En aquesta pregunta de l'stackoverflow precissament demanen com fer aquest càlcul amb una consulta de mySql:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-U6Y0er_M6mo/Ugjs_wmrICI/AAAAAAAAAQM/IleTW08Ecqo/s1600/so-retention.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="555" src="http://2.bp.blogspot.com/-U6Y0er_M6mo/Ugjs_wmrICI/AAAAAAAAAQM/IleTW08Ecqo/s640/so-retention.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><h1 itemprop="name" style="background-color: white; border: 0px; font-family: 'Trebuchet MS', 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 1.3; margin: 0px 0px 7px; padding: 0px; text-align: center; vertical-align: baseline;">
<a class="question-hyperlink" href="http://stackoverflow.com/questions/18171952/mysql-user-retention-and-day-to-day" style="background-color: transparent; border: 0px; color: black; cursor: pointer; margin: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;"><span style="font-size: xx-small;">MySQL user retention and day to day</span></a></h1>
</td></tr>
</tbody></table>
El principal problema per a cuinar aquestes dades és que el MySQL té una sèrie de limitacions respecte els seus competidors:<br />
<br />
<ul>
<li>No disposa de taules de pivotació ( per transposar les dates a columnes tal com es veu a la imatge)</li>
<li>No disposa de funcions analítiques.</li>
<li>No disposa de generadors de dates ( ni tans sols generadors d'enters )</li>
<li>No disposa de CTE per poder trencar la consulta en consultes més fàcils.</li>
</ul>
<div>
Amb tot això aquesta és la solució proposada i les dades resultants:</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-gw01mTi4128/Ugjt_15Bc7I/AAAAAAAAAQc/3lcFKBwHJf8/s1600/so-retention2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="http://1.bp.blogspot.com/-gw01mTi4128/Ugjt_15Bc7I/AAAAAAAAAQc/3lcFKBwHJf8/s640/so-retention2.png" width="588" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
Per a escriure la select he hagut de sacrificar qualsevol rastre d'elegancia en una consulta sql:<br />
<br />
<ul>
<li>Subqueries de subqueries.</li>
<li>Passar format datetime a date com string.</li>
<li>Generador d'enters fet a mà</li>
</ul>
<div>
el cas és que la select funciona i obté els resultats desitjats. </div>
<div>
<br /></div>
<div>
Però la gràcia de l'indicador és que serveixi per ajudar a prendre millors decissions. Això no és senzill de fer sense una bona visualització dels resultats. Mitjançant un petit programet python he generat resultats aleatòris per disposar d'una mostra més àmplia que serveixi d'exemple de visualització, i aquí la tenim:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-chzvAy0L-Mc/Ugjt_lcfMSI/AAAAAAAAAQg/Lo31lA9_-CU/s1600/retention-visualization.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="196" src="http://2.bp.blogspot.com/-chzvAy0L-Mc/Ugjt_lcfMSI/AAAAAAAAAQg/Lo31lA9_-CU/s640/retention-visualization.png" width="640" /></a></div>
<div>
<br /></div>
<div>
Assenyalat en vermell els diumenges. Cada dada deixa una estela que va decrementant-se. El punt més elevat representa el número de persónes que ha utlitzat el suposat servei i, l'estela, serien les persones que han repetit l'experiència el dia posterior, dos dies més tart i així fins a 7 dies, tal com demanava l'autor de la pregunta.</div>
<div>
<br /></div>
<div>
Una altre visualització de les mateixes dades, intercanviant fileres per columnes, seria aquesta:</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-jhHENzKO3Us/UgjuAEw-EcI/AAAAAAAAAQs/-anvcnBv1mY/s1600/retention-visualization2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="472" src="http://1.bp.blogspot.com/-jhHENzKO3Us/UgjuAEw-EcI/AAAAAAAAAQs/-anvcnBv1mY/s640/retention-visualization2.png" width="640" /></a></div>
<div>
<br /></div>
<div>
Veiem per exemple que el dia 21 de juliol s'hi van connectar 486 persones, d'aquestes, el dia 22, es van tornar a connectar la majoria, no totes, i així seguiriem l'estela fins arribar a 7 dies més tart on veiem que van fer 'retention' unes 75.</div>
<div>
<br /></div>
<div>
Aquí el codi del programa pyton que genera les dades aleatòries:</div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">from datetime import date, timedelta</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">import random</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">dia = date.today()</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">for n in range(50):</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> dia = dia - timedelta( days = 1 )</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> inicial = random.randint( 300, 500 )</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> print ( dia, dia, 0, inicial, sep=",")</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> for r in range( 1, 8 ):</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> resta = random.randint( 20, 100 )</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> inicial -= resta</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> if inicial > 0:</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;"> print ( dia, dia - timedelta( days = r ), r, inicial, sep="," )</span></div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<br />
<br />
<br />
<br />
<br />
<h1 itemprop="name" style="background-color: white; border: 0px; font-family: 'Trebuchet MS', 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 23px; line-height: 1.3; margin: 0px 0px 7px; padding: 0px; vertical-align: baseline;">
<br /></h1>
aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-61956445406462725782013-08-07T11:04:00.002-07:002013-08-08T05:21:22.067-07:00Google Trends: Recerques sobre estudis superiors.<h2>
<u style="font-family: Verdana, sans-serif;">Indicador</u><span style="font-family: Verdana, sans-serif;">: </span></h2>
<span style="color: #4c1130;">
</span>
<br />
<div style="text-align: center;">
<span style="font-family: Verdana, sans-serif;">Quantitat de recerques a Google ( territori 'spain' ) dels termes</span></div>
<span style="color: #0c343d;"><span style="font-family: Verdana, sans-serif;"><b><br /></b></span>
</span><br />
<div style="text-align: center;">
<span style="color: #0c343d; font-family: Verdana, sans-serif; font-size: large;"><b>'Grado Superior' v.s 'Universidad'</b></span></div>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">He assenyalat en <span style="color: orange;">taronja</span> els mesos de maig i juny que són els mesos en que els alumnes busquen informació per a la matrícula. També el setembre en <span style="color: #274e13;">verd</span>. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-s7QkjxPARa4/UgKLNArxb1I/AAAAAAAAAOw/kb04QQpem6c/s1600/GSvsUni.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="http://4.bp.blogspot.com/-s7QkjxPARa4/UgKLNArxb1I/AAAAAAAAAOw/kb04QQpem6c/s400/GSvsUni.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://public.tableausoftware.com/views/FPGSvsUniv/GSvsUni"><span style="font-family: Verdana, sans-serif;">Anar al gràfic interactiu</span></a></div>
<br />
<br />
<u><span style="font-family: Verdana, sans-serif;">Interpretació:</span></u><br />
<span style="font-family: Verdana, sans-serif;"><br /></span><span style="font-family: Verdana, sans-serif;">La meva pregunta sobre el gràfic és per què al setembre hi ha més recerques que al juny (o maig) sent aquestes dates quan els alumnes decideixen els estudis que faran. D'altre banda, no sembla que el gràfic tingui relació amb l'interés o matriculacions dels alumnes a la Universitat (no he buscat dades comparatives) però seria interessant saber per què hi ha aquest descens de les cerques sobre el terme 'Universitat'. D'altre banda, queda clar que el pitjor moment per invertir en una campanya publicitària online seria el Nadal.</span><br />
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><u>Gràfic al google trends:</u></span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-9M2kf4bFQ-o/UgKL_7-lWaI/AAAAAAAAAO8/b1O33xbI8cY/s1600/Screenshot+-+08072013+-+08:02:50+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="143" src="http://3.bp.blogspot.com/-9M2kf4bFQ-o/UgKL_7-lWaI/AAAAAAAAAO8/b1O33xbI8cY/s400/Screenshot+-+08072013+-+08:02:50+PM.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div>
<span style="font-family: Verdana, sans-serif;"><u>Actualització de l'article</u></span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">He descarregat de l'INE les dades de presentats i aprovats de les PAU. Sembla un bon indicador per a comparar-ho amb les recerques a google de la paraula 'Universitat'. Observem que no hi ha una correlació entre les recerques entre el mot 'Universitat' i la gent que es prepara per als estudis universitatis:</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-ZsVWt3WPmc8/UgOLSDhiX0I/AAAAAAAAAPM/cRZuXraEpbo/s1600/PAUvsGoogle.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="360" src="http://3.bp.blogspot.com/-ZsVWt3WPmc8/UgOLSDhiX0I/AAAAAAAAAPM/cRZuXraEpbo/s640/PAUvsGoogle.png" width="640" /></a></div>
<span style="font-family: Verdana, sans-serif;"><br /></span><span style="font-family: Verdana, sans-serif;"><span style="font-size: x-small;">Nota: L'any 2013 no és comparable doncs hi ha dades només fins agost.</span></span>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-80701880319767895132013-05-14T12:27:00.000-07:002013-05-15T01:32:22.705-07:00GHAP-BI: OLAP project with only open source tools<span style="font-family: Verdana, sans-serif;">At this time, we are finishing the second course that <a href="https://code.google.com/p/ghap/">GHAP</a> is running. GHAP is an attendance control software and plus.
</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Previous GHAP feature was the ability to <a href="http://beutil.blogspot.com.es/2013/04/em-sento-afortunat-arbres-de-decissio.html">predict students attendance</a>, a mix of Knime decision tree model and python lxml module to read resulting PMML. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">
</span><br />
<div style="float: left; margin-left: -30px;">
<span style="font-family: Verdana, sans-serif;"><a href="http://4.bp.blogspot.com/-X8Bnr_0WYRE/UZJtBDHBOrI/AAAAAAAAAOI/FSRC6N3jfNU/s1600/Selection_027.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;">
<img border="0" height="206" src="http://4.bp.blogspot.com/-X8Bnr_0WYRE/UZJtBDHBOrI/AAAAAAAAAOI/FSRC6N3jfNU/s320/Selection_027.png" width="320" />
</a>
</span></div>
<span style="font-family: Verdana, sans-serif;">
The new GHAP big feature is the Business Intelligence module. GHAP is for public schools, for this (and other) reason only free software tools should be included. I'm used to develop BI projects but this is my first one with open software tools. In this post I explain GHAP-BI software components and experience.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">As any BI solution GHAP-BI incorporates ETL and Data Analysis and visualization software. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">ETL is splitted as E+TL. The Extraction phase is made directly by GHAP application (django) and Transform and Load is made with <a href="http://www.pygrametl.org/">pygrametl</a>. This tool, pygrametl is praiseworthy: it is easy, fast and powerful and also clear documentation is available. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">I prefer OLAP solutions over Reporting solutions, I appreciate metadata layer with measures and dimensions, for this reason I have included <a href="http://analytical-labs.com/">Saiku</a> software as viz software. I found Saiku through a <a href="http://stackoverflow.com/a/13366726/842935">post in stackoverflow</a>.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-C_fBFkFrDDI/UZJtA9CbcGI/AAAAAAAAAOQ/7M1p-AiGFt8/s1600/Selection_025.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: Verdana, sans-serif;"><img border="0" height="177" src="http://4.bp.blogspot.com/-C_fBFkFrDDI/UZJtA9CbcGI/AAAAAAAAAOQ/7M1p-AiGFt8/s400/Selection_025.png" width="400" /></span></a></div>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>ETL development</b>: GHAP generates each night a 91MB text file (>500K lines), it takes over 4 hours to complete export. This file contains 1 course attendance controls full detailed. Then, a little python code load this data into Warehouse database. In 2 minutes all data is imported over 5 tables in snow-flock design. pygrametl is the piece that makes this possible combining dimension cache with bulk facts import. Notice that pygrametl could reduce drastically also export time avoiding database lookups, but I prefer to generate first text file.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>Viz</b>: Saiku is the front end for the users. You can learn about <a href="http://stackoverflow.com/a/13366726/842935">Saiku Pros and Cons reading @twn08 post</a>, but this is my experience: I send GHAP-BI url, user and passwd to manager, 20 minutes later I move to manager's office to know if connection was successful and my surprise was to see Saiku page with a combination on filters, dimensions and measures and also with some sorted data! When user see me the question was: "how can I export this viz?" I realized than Saiku is a very friendly tool. Install Saiku is easy, I have apt-get installed tomcat6 and copy Saiku "binary" files into tomcat webapps folder, then change connections and schema.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>DataWarehouse backend</b>: Saiku perform MDX queries to Mondrian and Mondrian translate it to Relational Database. I have test with both MySQL and Postgres, this one, Postgres, is definitely the option adopted. Postgres serves in seconds queries that run forever in MySQL.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>Cubes</b>: I have wrote cube schema initially with Pentaho Schema Workbench, but I have left it when I have transformed dimensions to shared dimensions.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-sPSeLjiPZ8E/UZJtA-MavpI/AAAAAAAAAOM/rdWdh2jpv2o/s1600/Selection_026.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: Verdana, sans-serif;"><img border="0" height="177" src="http://3.bp.blogspot.com/-sPSeLjiPZ8E/UZJtA-MavpI/AAAAAAAAAOM/rdWdh2jpv2o/s400/Selection_026.png" width="400" /></span></a></div>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Summarizing, In 20 hours my open software BI solution was successfully running, thanks to: python, django, <a href="http://analytical-labs.com/">Saiku</a>, Postgres and <a href="http://www.pygrametl.org/">pygrametl</a>.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><br /></span>
aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-10336493985033398742013-04-06T10:31:00.001-07:002013-04-07T07:05:05.933-07:00Em sento afortunat - Arbres de decisió<div style="border-bottom: 1px solid; border-top: 1px solid; float: left; font-size: 130%; margin-left: -20px; margin-right: 10px; text-align: center; width: 200px;">
484mil controls d'assistència fins a l'abril
</div>
Amb data abril de 2013 es porten realitzats més de 484mil controls d'assistència a l'Institut mitjançant el programa <a href="http://code.google.com/p/ghap/">GHAP</a>. Un control d'assistència és determinar si un alumne assisteix a una hora de classe. És a dir, a un mateix alumne se li realitzen uns 6 controls d'assistència diari.
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-HWg_gk8RmOU/UWBRbwW0_hI/AAAAAAAAAM8/SwAe3C9g34U/s1600/ghap-em-sento-afortunat.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="167" src="http://2.bp.blogspot.com/-HWg_gk8RmOU/UWBRbwW0_hI/AAAAAAAAAM8/SwAe3C9g34U/s320/ghap-em-sento-afortunat.png" width="320" /></a></div>
Per facilitar la tasca del professor a l'hora de passar llista l'aplicatiu disposa de l'opció <b><span style="color: #783f04;">'copiar assistència de l'hora anterior'</span></b>. Aquesta opció funciona molt bé però depen de que el professor anterior hagi passat llista.<br />
<br />
Amb l'esperit de facilitar la tasca del professorat, i d'entretenir-me jo mateix, he afegit la opció <span style="color: #783f04;"><b>'Em sento afortunat'</b></span>. Triant aquesta opció l'aplicatiu fa una proposta de passar llista (a partir de la seva predicció).<br />
<div style="clear: both;">
</div>
<div style="border-bottom: 1px solid; border-top: 1px solid; float: left; font-size: 130%; margin-bottom: 20px; margin-left: 200px; margin-right: 10px; text-align: center; width: 200px;">
Nova opció per passar llista: 'Em sento afortunat'
</div>
<div style="clear: both;">
</div>
<div><h2>
Però, quina lògica hi ha d'arrera d'aquesta opció?</h2></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-o-AqOie5c1E/UWBRb9CcPOI/AAAAAAAAANA/8x7krhtO21U/s1600/knime-mining.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="188" src="http://2.bp.blogspot.com/-o-AqOie5c1E/UWBRb9CcPOI/AAAAAAAAANA/8x7krhtO21U/s200/knime-mining.png" width="200" /></a></div>
<div>
Per a formular una predicció de control d'assistència l'aplicatiu utilitza una tècnica de mineria de dades, bé realment d' <a href="http://ca.wikipedia.org/wiki/Aprenentatge_autom%C3%A0tic">'Aprenentatge Automàtic'</a>. En concret, la tècnica que fa servir és la de predicció mitjançant <a href="http://en.wikipedia.org/wiki/Decision_tree_learning">'arbre de decisió'.</a> </div>
<div>
<br /></div>
<div>
Per construir l'arbre de decisions he fet servir el programari <a href="http://www.knime.org/">Knime</a>. I una exportació de dades dissociades de la base de dades del programari GHAP.</div>
<div>
<br /></div>
<div>
Les dades que he triat i que serveixen per a construir el model són les següents:</div>
<div>
<br /></div>
<div class="separator" style="float: left; text-align: center;">
<a href="http://4.bp.blogspot.com/-MIIi4z8l1JI/UWBRctZJjTI/AAAAAAAAANc/FpgoQEIgjWI/s1600/prediccio-variables.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="86" src="http://4.bp.blogspot.com/-MIIi4z8l1JI/UWBRctZJjTI/AAAAAAAAANc/FpgoQEIgjWI/s200/prediccio-variables.png" width="200" /></a></div>
<div class="separator" style="float: left; text-align: center;">
<a href="http://3.bp.blogspot.com/-twVPDvyjTUI/UWBRcFxS9HI/AAAAAAAAANg/eR9rIxaRJmQ/s1600/prediccio-dades.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="171" src="http://3.bp.blogspot.com/-twVPDvyjTUI/UWBRcFxS9HI/AAAAAAAAANg/eR9rIxaRJmQ/s320/prediccio-dades.png" width="320" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
I en aquesta captura de pantalla es veu el procés de construcció del model:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-NGNh1pek0WY/UWBRb-LzGTI/AAAAAAAAAMw/FkI20J235E4/s1600/knime-learning.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="122" src="http://3.bp.blogspot.com/-NGNh1pek0WY/UWBRb-LzGTI/AAAAAAAAAMw/FkI20J235E4/s320/knime-learning.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="clear: both;">
</div>
<div style="border-bottom: 1px solid; border-top: 1px solid; float: left; font-size: 130%; margin-bottom: 20px; margin-left: 200px; margin-right: 10px; text-align: center; width: 200px;">
El sistema de predicció utilitza tècnica de mineria de dades.
</div>
<div style="clear: both;">
</div>
<div class="separator" style="clear: both; text-align: left;">
Un cop processat tenim un model informàtic en un format estandaritzat anomenat <a href="http://en.wikipedia.org/wiki/Predictive_Model_Markup_Language">PMML</a> (Predictive Model Markup Language). És un fitxer en XML d'un pes de mig mega. No he trobat cap utilitat python que a partir dels valors i el model em calculi la predicció, per això he escrit el meu propi algorisme, que he anomenat <a href="https://github.com/ctrl-alt-d/lightpmmlpredictor">lightPMMLpredictor</a>, i l'he integrat al GHAP. Si teniu interès podeu trobar una mostra de les dades utilitzades dins el propi projecte.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
La representació gràfica d'aquest model és aquesta:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-r-Uecet7ryU/UWBRc8acPfI/AAAAAAAAANU/GHmupUiw1Zc/s1600/presencia-tree.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="408" src="http://3.bp.blogspot.com/-r-Uecet7ryU/UWBRc8acPfI/AAAAAAAAANU/GHmupUiw1Zc/s640/presencia-tree.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div style="border-bottom: 1px solid; border-top: 1px solid; float: left; font-size: 130%; margin-left: -20px; margin-right: 10px; text-align: center; width: 200px;">
El factor principal determinat pel sistema és l'assistència a l'hora anterior.
</div>
La lectura d'aquest model seria: un 85.4% dels controls els marquem a 'Present', per tant, si haguès de fer una previsió diria 'Present'. Però, si tenim en compte l'<span style="background-color: #ffe599;">assistència a l'hora anterior</span> ens trobem que, si l'alumne era absent l'hora anterior el % de presencia a la següent hora es redueix fins un 14%. L'arbre no finalitza en aquest nivell sino que segueix afegint paràmetres a la decisió:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-Lhv1U-Tslu0/UWBRc-_sw7I/AAAAAAAAANY/ev9kjADjz4k/s1600/presencia-tree-simple.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="636" src="http://1.bp.blogspot.com/-Lhv1U-Tslu0/UWBRc-_sw7I/AAAAAAAAANY/ev9kjADjz4k/s640/presencia-tree-simple.png" width="640" /></a></div>
<br />
<br />
<div style="border-bottom: 1px solid; border-top: 1px solid; float: left; font-size: 130%; margin-left: -20px; margin-right: 10px; text-align: center; width: 200px;">
Tot i estar present l'hora anterior, el sistema prediu que faltarà un alumne de GS Admin. si ha faltat a la mateixa hora les tres setmana anteriors i és l'hora següent al pati.
</div>
Aquest esquema ens diu que un alumne que l'hora anterior hagi estat present, però, hagi faltat a la mateixa hora les tres setmana anterior, l'hora sigui les 18:05 (després del pati) i l'alumne sigui del grau superior d'administratiu, llavors el model aposta per que aquest alumne sigui absent ( 9 casos sobre 19).<br />
<br />
<br />
Els models cal contrastar-los per saber si estan funcionant correctament. Normalment es reserva un 20% de les mostres per, en comptes de donar de menjar al programa que apren, s'utilitzin per contrastar el model. Jo aquest pas no l'he fet, però procuraré, d'aquí tres setmanes, comprovar la bondat del model amb els nous controls que es realitzin. Mentrestant <b>animo als companys a sentir-se afortunats</b>.<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-82321596846079870192013-01-28T14:12:00.002-08:002013-01-29T06:40:00.149-08:00Corva epidèmica de la grip v.s. assistència a l'Institut<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-rhBllEyEOOQ/UQb3g9P9RII/AAAAAAAAAMM/NiqugMbQcIs/s1600/grip-girona.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="Corba epidèmica" border="0" height="200" src="http://2.bp.blogspot.com/-rhBllEyEOOQ/UQb3g9P9RII/AAAAAAAAAMM/NiqugMbQcIs/s200/grip-girona.png" title="Corba epidèmica" width="194" /></a></div>
Fa dos cursos tenim en marxa a l'Institut Cendrassos el programa de control d'assistència d'alumnes anomenat <a href="http://code.google.com/p/ghap/">GHAP</a>.<br />
<br />
Ara que estem a 3 setmanes del pic màxim de grip, he volgut mirar com ens afectarà l'epidèmia en relació a l'assistència dels alumnes a les aules tot comparant-ho amb pics històrics.<br />
<br />
Utilitzant les <a href="http://www.ics.gencat.cat/sisap/diagnosticat/principal?lang=ct&patologia=Grip">dades obertes</a> i les <a href="https://ghap.iescendrassos.net/">dades tencades</a> he elaborat el següent gràfic. En <span style="color: blue;">blau</span> representat el número de faltes per setmana i en <span style="color: #990000;">vermell</span> les taxes setmanals de grip. Les puntes d'absència en blau segurament són vagues.<br />
<br />
Obviament una sèrie de un curs acadèmic no ens aporta gran informació,<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-Xg1bRsf7Y4g/UQb0zU3H64I/AAAAAAAAALk/NXWB3Zh27eI/s1600/grip.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="449" src="http://1.bp.blogspot.com/-Xg1bRsf7Y4g/UQb0zU3H64I/AAAAAAAAALk/NXWB3Zh27eI/s640/grip.png" width="640" /></a></div>
<br />
La sorpresa ha estat observar com <b>les absències dels alumnes són inversament proporcionals a les taxes de grip</b>.<br />
<br />
Aquesta priàmide de taxa de grip per edats ens pot argumentar en part els resultats observats:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-FnTIt0DTEt8/UQb1_5xxoLI/AAAAAAAAAL0/Mzz5uzRhfI8/s1600/pir%C3%A0mide-grip.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://3.bp.blogspot.com/-FnTIt0DTEt8/UQb1_5xxoLI/AAAAAAAAAL0/Mzz5uzRhfI8/s320/pir%C3%A0mide-grip.png" width="306" /></a></div>
<br />
La segona explicació a la correlació inversa és que els professors de guardia no passen llista. <br />
<br />
Per últim un gràfic incloent la temporada 2010-2011 en la que vam fer servir el programari de l'Institut Brugulat per a dur el control de presència. En aquella temporada el pic de grip va caure a la setmana 2.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-FU618KV80ys/UQb7VU_5DPI/AAAAAAAAAMc/aBqYH1IyFHg/s1600/grip-3T.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="449" src="http://3.bp.blogspot.com/-FU618KV80ys/UQb7VU_5DPI/AAAAAAAAAMc/aBqYH1IyFHg/s640/grip-3T.png" width="640" /></a></div>
<br />
<br />
<br />
<br />
<br />aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com2tag:blogger.com,1999:blog-2379913116279101058.post-67580093132958228062012-12-31T04:55:00.000-08:002012-12-31T05:00:46.636-08:00Exercicis de Primària amb Python VAquest és un exercici de Grafs extret del llibre <a href="http://www.editorialteide.es/cat/fitxa_llibre.asp?IdLibro=7026">Nou i Mig 8 de l'editorial Teide</a>:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-iyvClhaoLh0/UOGJq0qYpUI/AAAAAAAAALQ/A-UsHcGrUCA/s1600/vertex.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-iyvClhaoLh0/UOGJq0qYpUI/AAAAAAAAALQ/A-UsHcGrUCA/s1600/vertex.png" /></a></div>
<br />
<h4>
Plantejament</h4>
<br />
<ul>
<li>Identifiquem cada vertex amb una lletra.</li>
<li>Construim un diccionari python amb una 'cassella' per a cada vertex.</li>
<li>Fem una 'llista' (és una tupla en realitat) amb els parells de nodes adjacents.</li>
<li>Provem totes les permutacions de digits tot imprimint les que compleixen amb els requeriments de l'enunciat.</li>
</ul>
<h4>
El codi del programa</h4>
<br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">from itertools import permutations, combinations_with_replacement</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">vertex = {}</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">for identificador in ( 'A','B','C','D','E','F' ):</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> vertex[identificador] = None</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">adjacents = (</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> ( 'A', 'B' ), ( 'A', 'D' ), ( 'A', 'E' ), ( 'A', 'F' ),</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> ( 'B', 'A' ), ( 'B', 'D' ), ( 'B', 'C' ),</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> ( 'C', 'B' ), ( 'C', 'D' ), ( 'C', 'F' ),</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> ( 'D', 'A' ), ( 'D', 'B' ), ( 'D', 'C' ), ('D', 'E'),</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> ( 'E', 'A' ), ( 'E', 'D' ), ( 'E', 'F' ),</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> ( 'F', 'A' ), ( 'F', 'C' ), ( 'F', 'E' ),</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">)</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">digits = ( 5,6,7,8,9,10 )</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">for (vertex['A'], vertex['B'], vertex['C'], </span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> vertex['D'], vertex['E'], vertex['F'], ) in permutations ( digits ):</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> if all( vertex[ v1 ] - vertex[v2] != 1 for ( v1, v2) in adjacents ):</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> print ( 'A:', vertex['A'], 'B:', vertex['B'], 'C:', vertex['C'], </span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> 'D:', vertex['D'], 'E:', vertex['E'], 'F:', vertex['F'] )</span> <br />
<div>
<br /></div>
<br />
<h4>
El resultat</h4>
<br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">dani@egg-v3:~/tmp/llu$ python vertexs.py </span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">('A:', 5, 'B:', 8, 'C:', 6, 'D:', 10, 'E:', 7, 'F:', 9)</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">('A:', 10, 'B:', 7, 'C:', 9, 'D:', 5, 'E:', 8, 'F:', 6)</span><br />
<br />
<h4>
Altres Exercicis</h4>
<a href="http://beutil.blogspot.com.es/search/label/python_i_exercicis_mates">http://beutil.blogspot.com.es/search/label/python_i_exercicis_mates</a><br />
<br />
<br />
<br />aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-45837624215423707212012-12-30T11:34:00.003-08:002012-12-31T04:58:51.167-08:00Exercicis de Primària amb Python IV<h4>
Enunciat</h4>
Aquest exercici no té enunciat. Nomès apareix aquesta imatge:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-gcVzU4Fwliw/UOCWQl5uF1I/AAAAAAAAALA/bzyMcemPbT4/s1600/DSC_0556.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-gcVzU4Fwliw/UOCWQl5uF1I/AAAAAAAAALA/bzyMcemPbT4/s1600/DSC_0556.JPG" /></a></div>
<br />
<br />
Entenc que és un exercici tipus 'xifres i lletres' i cal obtenir el resultat indicat amb una combinació d'operacions amb tots els dígits disponibles.<br />
<br />
Recordo que aquests exercicis són de <span style="background-color: white; color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px;"><a href="http://www.editorialteide.es/cat/fitxa_llibre.asp?IdLibro=7026">Nou i mig 8</a> és un llibre de l'editorial Teide.</span><br />
<h4>
</h4>
<h4>
Resolució:</h4>
<br />
<ul>
<li>Creo les operacions com diccionaris per tal de tenir el nom i la operació.</li>
<li>Faig una tupla amb les operacions que intervenen.</li>
<li>Faig una llista amb els dígits disponibles.</li>
<li>Poso en una variable el resultat desitjat.</li>
<li>Per últim, busco totes les possibles combinacions d'operacions preses de 4 en 4. Per a cada combinació busco totes les seves permutacions i les combino amb totes les permutacions dels dígits disponibles.</li>
<li>El resultat el comparo amb el resultat desitjat</li>
</ul>
<br />
<br />
<h4>
El programa:</h4>
<br />
<br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">from itertools import permutations, combinations_with_replacement</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">operacions = {}</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">operacions['+'] = lambda x,y: x+y</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">operacions['-'] = lambda x,y: x-y</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">operacions['*'] = lambda x,y: x*y</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">operacions['/'] = lambda x,y: x/y</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">numeros = ( 22, 2, 10, 6, 11 )</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">resultat_desitjat = 201</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"><br /></span>
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;">for (A, B, C, D, E ) in permutations ( numeros ):</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> for combinacio_operacio in combinations_with_replacement( operacions, 4 ):</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> for ( op1, op2, op3, op4 ) in permutations( combinacio_operacio ):</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> r1 = operacions[op1]( float( A ), float( B ) )</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> r2 = operacions[op2]( float( r1 ), float( C ) )</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> r3 = operacions[op3]( float( r2 ), float( D ) )</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> r4 = operacions[op4]( float( r3 ), float( E ) )</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> if r4 == resultat_desitjat and r1 > 0 and r2 > 0 and r3 > 0 and r4 > 0:</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: xx-small;"> print A, op1, B, op2, C, op3, D, op4, E</span><br />
<br />
<br />
<br />
<h4>
Els resultats:</h4>
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">dani@egg-v3:~/tmp/llu$ python batedora.py | more</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">22 * 10 - 2 - 6 - 11</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">22 * 10 - 2 - 6 - 11</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">22 * 10 - 2 - 6 - 11</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">22 * 10 - 2 - 6 - 11</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">22 * 10 - 2 - 6 - 11</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: xx-small;">22 * 10 - 2 - 6 - 11</span><br />
<div>
<br /></div>
<br />
<br />
<br />
<h4>
</h4>
<h4>
Altres Exercicis</h4>
<div style="font-weight: normal;">
<a href="http://beutil.blogspot.com.es/search/label/python_i_exercicis_mates">http://beutil.blogspot.com.es/search/label/python_i_exercicis_mates</a></div>
<div>
<br /></div>
<br />
<br />
<br />aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com1tag:blogger.com,1999:blog-2379913116279101058.post-16559064663550306862012-12-29T15:04:00.001-08:002012-12-29T15:04:22.457-08:00Sala Polivalent Ara:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-UwI1A43-L6Y/UN92APoRLrI/AAAAAAAAAKw/1-AOX_yoaQs/s1600/salapolivalentexterior.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="211" src="http://4.bp.blogspot.com/-UwI1A43-L6Y/UN92APoRLrI/AAAAAAAAAKw/1-AOX_yoaQs/s320/salapolivalentexterior.png" width="320" /></a></div>
<br />
<br />
Sala Polivalent fa 1700 anys:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-2JB-ZRIzGPs/UN919wRngEI/AAAAAAAAAKg/A8rnlJ6IbNE/s1600/Reconstruccio-parcial-de-l-ambulacre-del-forum_imagelarge.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://3.bp.blogspot.com/-2JB-ZRIzGPs/UN919wRngEI/AAAAAAAAAKg/A8rnlJ6IbNE/s320/Reconstruccio-parcial-de-l-ambulacre-del-forum_imagelarge.jpg" width="301" /></a></div>
<br />aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-62411457132477676352012-12-29T15:03:00.001-08:002012-12-29T15:03:25.287-08:00Central Nuclear a Garona:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-_NxEr9tegrk/UN91-stAoAI/AAAAAAAAAKk/w_RSHlqGbI0/s1600/central.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="120" src="http://1.bp.blogspot.com/-_NxEr9tegrk/UN91-stAoAI/AAAAAAAAAKk/w_RSHlqGbI0/s320/central.jpg" width="320" /></a></div>
<br />
Sala Polivalent a L'Escala:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-UwI1A43-L6Y/UN92APoRLrI/AAAAAAAAAKw/1-AOX_yoaQs/s1600/salapolivalentexterior.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="211" src="http://4.bp.blogspot.com/-UwI1A43-L6Y/UN92APoRLrI/AAAAAAAAAKw/1-AOX_yoaQs/s320/salapolivalentexterior.png" width="320" /></a></div>
<br />
<br />
<br />aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-7073557026518022252012-12-29T03:37:00.000-08:002012-12-31T04:58:56.677-08:00Exercicis de Primària amb Python III<h2>
Enunciat: </h2>
<br />
<ul>
<li>Quant sumen els punts de les 28 fitxes del dòmino?</li>
</ul>
<br />
<h2>
Plantejament:</h2>
<br />
<ul>
<li>Anomenarè família a totes les fitxes que tenen en comú una mateixa puntuació. Per exemple, la família del 0 (blanc) serà: 0:0, 0:1, 0:2, ... 0:6</li>
<li>Hem de tenir en compte que la fixa 1:0 i la fitxa 0:1 és la mateixa. Per tant, si a la família del 0 hem inclòs el 0:1, a la família de l'1 no podem incloure el 1:0. </li>
<li>Per a solucionar el punt anterior, cada família es combinarà amb els punts començant pel seu doble:</li>
</ul>
<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">0:0 0:1 0:2 0:3 0:4 ... 0:6</span><br />
<span style="font-family: Courier New, Courier, monospace;"> 1:1 1:2 1:3 1:4 ... 1:6</span><br />
<span style="font-family: Courier New, Courier, monospace;"> 2:2 2:3 2:4 ... 2:6</span><br />
<span style="font-family: Courier New, Courier, monospace;"> ...</span><br />
<span style="font-family: Courier New, Courier, monospace;"> 6:6</span><br />
<br />
<br />
<ul>
<li>Per últim, fem servir un acumulador per tal de saber quant punts portem.</li>
</ul>
<h2>
Solució:</h2>
<div>
<span style="font-family: 'Courier New', Courier, monospace;">acumulador = 0</span></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">for familia in range(0,7):</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> for n in range(familia,7): #No comencem des de 0</span><br />
<span style="font-family: Courier New, Courier, monospace;"> #comencem des del doble X:X</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> print familia,n</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> acumulador += familia+n</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">print 'Total:', acumulador</span></div>
</div>
<div>
<br /></div>
<h2>
Resultat:</h2>
<div>
<span style="font-family: 'Courier New', Courier, monospace;">$ python domino.py </span></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">0 0</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">0 1</span></div>
</div>
<div>
<span style="font-family: Courier New, Courier, monospace;">...</span></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">4 6</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">5 5</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">5 6</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">6 6</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">Total: 168</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<br />
<h4>
</h4>
<h4>
Altres Exercicis</h4>
<div style="font-weight: normal;">
<a href="http://beutil.blogspot.com.es/search/label/python_i_exercicis_mates">http://beutil.blogspot.com.es/search/label/python_i_exercicis_mates</a></div>
</div>
</div>
<div>
<br /></div>
aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-16270261400232231902012-12-18T01:14:00.000-08:002012-12-31T04:59:02.354-08:00Exercicis de primària amb Python IIA la mateixa pàgina que l'<a href="http://beutil.blogspot.com.es/2012/12/python-i-els-exercicis-de-mates.html">exercici anterior</a> trobem aquest exercici altre exercici ('<a href="http://www.editorialteide.es/cat/fitxa_llibre.asp?IdLibro=7026">Nou i mig 8</a>', editorial teide):<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-SWZYbmE09DY/UM4bpLD0acI/AAAAAAAAAKM/1hrVbDL29Ac/s1600/i_mig_ex_11bis.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-SWZYbmE09DY/UM4bpLD0acI/AAAAAAAAAKM/1hrVbDL29Ac/s1600/i_mig_ex_11bis.png" /></a></div>
<br />
<br />
Com es pot veure no necessita enunciat.<br />
<br />
Per resoldre'l utilitzem diferents recursos del llenguatge, destaco els <a href="http://docs.python.org/2/tutorial/datastructures.html#dictionaries">diccionaris</a>, els <a href="http://wiki.python.org/moin/ForLoop">bucles niuats</a> i les <a href="http://docs.python.org/2/reference/expressions.html#lambda">expressions lambda</a>:<br />
<br />
<br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;">from itertools import combinations</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;">suma = { 'operacio': lambda x,y: x+y, 'nom':'suma' }</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;">resta = { 'operacio': lambda x,y: x-y, 'nom':'resta' }</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;">operacions = ( suma, resta )</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;">for op1 in operacions:</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;"> for op2 in operacions:</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;"> for op3 in operacions:</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;"> for op4 in operacions:</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;"> r1 = op1['operacio']( 10, 9)</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;"> r2 = op2['operacio']( r1, 15)</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;"> r3 = op3['operacio']( r2, 7 )</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;"> r4 = op4['operacio']( r3, 4 )</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;"> if r4 == 19:</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;"> print op1['nom'], op2['nom'], op3['nom'], op4['nom']</span><br />
<br />
<br />
Resultat:<br />
<br />
<div style="border: 1px solid; padding: 10px; text-align: center;">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><b>resta suma suma resta</b></span></div>
<br />
Cal dir que les itertools ens permeten substituir els bucles niuats per un sol bucle:<br />
<br />
<a href="http://stackoverflow.com/questions/1280667/in-python-is-there-an-easier-way-to-write-6-nested-for-loops">http://stackoverflow.com/questions/1280667/in-python-is-there-an-easier-way-to-write-6-nested-for-loops</a><br />
<br />
<br />
<br />
<br />
<h4>
</h4>
<h4>
Altres Exercicis</h4>
<div style="font-weight: normal;">
<a href="http://beutil.blogspot.com.es/search/label/python_i_exercicis_mates">http://beutil.blogspot.com.es/search/label/python_i_exercicis_mates</a></div>
<br />
<br />aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-14187804726444496182012-12-16T07:00:00.000-08:002012-12-31T04:59:08.123-08:00Python i els exercicis de Mates<a href="http://www.python.org/">Python</a> és un llenguatge de programació d'alt nivell. El codi escrit amb Python és de fàcil lectura, això forma part de la filosofia del llenguatge. És per això que recomano aquest llenguatge a qui vulgui iniciar-se al món de la programació d'una manera autodidàcta.<br />
<br />
<a href="http://www.editorialteide.es/cat/fitxa_llibre.asp?IdLibro=7026">Nou i mig 8</a> és un llibre de l'editorial Teide. Els problemes d'aquest llibre són molt gràfics i divertits.<br />
<br />
Resoldre els problemes del Nou i mig amb Python és encara més divertit.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-2-0QfxFiWJE/UM3fkmINDSI/AAAAAAAAAJ8/Ky8lAHBfayI/s1600/nou_i_mig_p11.JPG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-2-0QfxFiWJE/UM3fkmINDSI/AAAAAAAAAJ8/Ky8lAHBfayI/s1600/nou_i_mig_p11.JPG" /></a></div>
Aquest problema apareix a la pàgina 11 del llibre. Ens donen una figura en forma d'estrella, cada línia de la figura conté tres caselles, una al mig i una a cada extrem. Cal repartir els dígits de l'1 al 9 dins d'aquestes caselles de manera que els dígits de totes les línies sumin el mateix.<br />
<br />
És a dir que A + B + C ha de sumar el mateix que C + D + E i així per totes les línies.<br />
<br />
Per solucionar aquest problema amb python utilitzo la llibreria itertools, allà hi ha una funció que ella sola em fabricarà totes les possibles permutacions dels digits de l'1 al 9.<br />
<br />
Provarem cada permutació per comprovar si cumpleix els requeriments de l'enunciat.<br />
<br />
L'operador per a comparar és == per això apareix aquest operador dins la sentència 'if'.<br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">from itertools import permutations</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">digits = ( 1, 2, 3, 4, 5, 6, 7, 8, 9)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">for (A, B, C, D, E, F, G, H, I ) in permutations( digits ):</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> if ( A + B + C == </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> C + D + E ==</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> E + F + G ==</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> G + B + H ==</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> H + D + I ):</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> print 'Solucio: ', A, B, C, D, E, F, G, H, I</span><br />
<br />
<span style="font-family: inherit;">El resultat:</span><br />
<br />
<br />
Solucio: 1 5 9 2 4 8 3 7 6<br />
Solucio: 1 5 9 4 2 6 7 3 8<br />
Solucio: 1 6 8 3 4 9 2 7 5<br />
Solucio: 1 6 8 4 ...<br />
<br />
<br />
<br />
<h4>
</h4>
<h4>
Altres Exercicis</h4>
<div style="font-weight: normal;">
<a href="http://beutil.blogspot.com.es/search/label/python_i_exercicis_mates">http://beutil.blogspot.com.es/search/label/python_i_exercicis_mates</a></div>
<br />
<br />
<br />
<br />aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-16799710931348623442012-08-20T06:32:00.002-07:002012-08-20T06:32:29.607-07:00El ministre Soria ens convida a infringir la llei?<b>Noticia d'Intereconomia (Europa Press):</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-pUieufu_pFI/UDI4vv0nnDI/AAAAAAAAAJQ/LTei3JC_fWA/s1600/soria.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="601" src="http://1.bp.blogspot.com/-pUieufu_pFI/UDI4vv0nnDI/AAAAAAAAAJQ/LTei3JC_fWA/s640/soria.png" width="640" /></a></div>
<br />
<b>El que diu la llei:</b><br />
<br />
<div style="text-align: center;">
<span style="font-family: Times, Times New Roman, serif;"><i>"deberá aplicarse el tipo vigente en el momento del devengo" </i></span></div>
<div style="text-align: center;">
<span style="font-family: Times, Times New Roman, serif;"><i>(<a href="http://www.aeat.es/static_files/AEAT/Contenidos_Comunes/La_Agencia_Tributaria/Segmentos_Usuarios/Empresas_y_profesionales/Empresario_individuales_y_profesionales/I.V.A./Manual_IVA_2011.pdf">Manual práctico del Iva 2011, web agència tributària, pàg 65</a>)</i></span></div>
<br />
<div style="text-align: center;">
<span style="color: #333333; font-size: 13px; text-align: justify;"><span style="font-family: Times, Times New Roman, serif;"><i>"Por sus ventas o prestaciones de servicios, repercuten a los adquirentes las cuotas de IVA que correspondan, con obligación de ingresarlas en el Tesoro."</i></span></span></div>
<div style="text-align: center;">
<span style="color: #333333; font-size: 13px; text-align: justify;"><span style="font-family: Times, Times New Roman, serif;"><i>(<a href="http://www.aeat.es/AEAT.internet/Inicio_es_ES/_Segmentos_/Empresas_y_profesionales/Empresas/IVA/Funcionamiento_general_del_Impuesto.shtml">Agència Tributària, Funcionament general de l'IVA</a>)</i></span></span></div>
<span style="color: #333333; font-family: Arial, helvetica, sans-serif; font-size: 13px; text-align: justify;"><br /></span>
<b>Les preguntes:</b><br />
<span style="text-align: center;">- Quina </span><span style="text-align: center;">repercussió</span><span style="text-align: center;"> hauria de tenir una declaració d'aquest tipus sobre el ministre?</span><br />
<span style="text-align: center;">- A quina "tentació" es refereix el ministre? </span><br />
<span style="text-align: center;">- M'estic tornant jo boix? M'estic perdent alguna cosa? Hi ha càmera oculta?</span><br />
<br />aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-76048647812220460752012-08-15T16:21:00.001-07:002012-08-15T16:21:51.364-07:00Efectes i motius de la crisi<p class="mobile-photo"><a href="http://2.bp.blogspot.com/-3d1SskGq2eQ/UCwvELaPu1I/AAAAAAAAAI8/tPjyFeTjcIc/s1600/foto-711365.PNG"><img src="http://2.bp.blogspot.com/-3d1SskGq2eQ/UCwvELaPu1I/AAAAAAAAAI8/tPjyFeTjcIc/s320/foto-711365.PNG" border="0" alt="" id="BLOGGER_PHOTO_ID_5777044170838358866" /></a></p>aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-1915221577263577892012-07-07T07:36:00.002-07:002012-12-29T15:05:01.781-08:00La web de Bankinter dia 7 de juliol a les 16:30:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/--lKwHVnGBJk/T_hJSe4j4DI/AAAAAAAAAIs/O5knF6-pQLY/s1600/captura-54.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="376" src="http://1.bp.blogspot.com/--lKwHVnGBJk/T_hJSe4j4DI/AAAAAAAAAIs/O5knF6-pQLY/s640/captura-54.png" width="640" /></a></div>
<br />
<br />
<strong>Answer: </strong> The <em>oerr</em> utility says this about the ORA-00257 error:<br />
<div class="style21">
<strong>ORA-00257</strong>: archiver error. Connect internal only, until freed.<br />
<br />
<strong>Cause:</strong> The archiver process received an error while trying to archive a redo log. If the problem is not resolved soon, the database will stop executing transactions. The most likely cause of this message is the destination device is out of space to store the redo log file.</div>
aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-1895546842899878102012-06-08T00:29:00.001-07:002012-12-29T15:05:10.782-08:00Càrrega i anàlisi datamart de la despesa<div style="text-align: center;">
Captures de pantalla projecte datamart econòmic de comptabilitat pressupostària<br />
<br />
Càrrega amb <a href="http://msdn.microsoft.com/en-us/library/ms141026.aspx">SSIS</a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-v9JvlUbcrm4/T9GpUhrK5sI/AAAAAAAAAIQ/cpG1HzyOBDw/s1600/captura-52.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="246" src="http://2.bp.blogspot.com/-v9JvlUbcrm4/T9GpUhrK5sI/AAAAAAAAAIQ/cpG1HzyOBDw/s320/captura-52.png" width="320" /></a></div>
<br />
<div style="text-align: center;">
Anàlisi amb <a href="http://www.tableausoftware.com/">Tableau</a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-fM5TiVcoKM4/T9GphnUfYzI/AAAAAAAAAIg/-LprW0JCVRo/s1600/captura-53.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://3.bp.blogspot.com/-fM5TiVcoKM4/T9GphnUfYzI/AAAAAAAAAIg/-LprW0JCVRo/s320/captura-53.png" width="313" /></a></div>
<br />
<br />aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-54647020546344004362012-04-15T14:28:00.001-07:002012-12-29T15:05:18.607-08:00Pujar aplicació MVC 3 a DinahostingConservo un compte a dinahosting degut al concurs webs al punt. Avui he pujat una BDD i una Aplicació Web (MVC 3). El procediment no és complicat:<br />
<br />
<ul>
<li>La base de dades es crea des del taulell de control de dinahosting, dresprés t'hi pots connectar a ella des de l'SQLServer Management Studio. Cap problema. El nom de servidor me'l van dir des de dinahosting pel chat de suport.</li>
<li>Per pujar l'aplicació primer has de declarar una aplicació ASP.NET (des del taulell de control), després puges l'aplicació des del propi assistent de visual studio via FTP (cal haver fet un compte FTP).</li>
</ul>
<br />
Aquí està l'aplicació <a href="http://www.joincar.cat/a/search/go">http://www.joincar.cat/a/search/go</a> :<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-gtVSb1G47CA/T4s8aminjjI/AAAAAAAAAHg/wdX0Nq5e2xM/s1600/Screenshot-68.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-gtVSb1G47CA/T4s8aminjjI/AAAAAAAAAHg/wdX0Nq5e2xM/s1600/Screenshot-68.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
De pas publico la caxonda consulta LINQ per obtenir les dades i el model de dades:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-PDCjcSA4L80/T4s9PJfRMfI/AAAAAAAAAHw/JV_govRuoBI/s1600/Screenshot-70.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-PDCjcSA4L80/T4s9PJfRMfI/AAAAAAAAAHw/JV_govRuoBI/s1600/Screenshot-70.png" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-pO1xtcv77Qw/T4s9N50zwOI/AAAAAAAAAHo/R0HilqGIw-M/s1600/Screenshot-69.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-pO1xtcv77Qw/T4s9N50zwOI/AAAAAAAAAHo/R0HilqGIw-M/s1600/Screenshot-69.png" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com0tag:blogger.com,1999:blog-2379913116279101058.post-61009112717888839592012-04-05T14:27:00.001-07:002012-12-29T15:05:27.657-08:00LightSwitch Custom Control: Tree lookup OperationsHere the second part of treeview custom control. This include lookup operations:<br />
<br />
<iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/uQ-TQPlXB-I" width="420"></iframe>
<br />
See also:<br />
<br />
<ul>
<li><a href="http://beutil.blogspot.com.es/2012/04/lightswitch-custom-control-tree-crud.html">First part of this topic</a></li>
<li><a href="http://youtu.be/9nPvesAYKn8">Custom Control managing 2.5milions rows</a> (video) </li>
<li><a href="http://dl.dropbox.com/u/24354976/treeScreen/testingTreesV1.zip">Lightswitch treeview custom control source code ready to download</a>.</li>
</ul>
aerolitoshttp://www.blogger.com/profile/14879089580154666963noreply@blogger.com2