<?xml version="1.0" encoding="UTF-8" ?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
    <title>Posteet</title> 
    <link>http://www.posteet.com/</link> 
    <description>Recent posteets posted to Posteet</description>
    <ttl>60</ttl>

    
    <item>
        <title>Sacar imagenes de un video con ffmpeg</title>
        <link>http://www.posteet.com/view/2058</link>
        <description>
        <![CDATA[<pre>import commands
import os

def execute():
        cmd = 'c:/ffmpeg/ffmpeg.exe -y -itsoffset -4 -i c:/input.mpg -vframes 1 -s 100x90 -f image2 c:/uploads/img_gen.jpg'
        #c = commands.getoutput(cmd) # linux
        c = os.system(self.cmd) #windows
        return c</pre> <a href="http://www.posteet.com/tags/django">[django]</a>  <a href="http://www.posteet.com/tags/ffmpeg">[ffmpeg]</a>  <a href="http://www.posteet.com/tags/librerias">[librerias]</a>  <a href="http://www.posteet.com/tags/python">[python]</a>  <a href="http://www.posteet.com/tags/soluciones">[soluciones]</a>  <a href="http://www.posteet.com/tags/tests">[tests]</a> ]]>        </description>
        <dc:creator>macks</dc:creator>
        <pubDate>Fri, 12 Mar 2010 18:15:50 +0100</pubDate>

            <category>django</category>
            <category>ffmpeg</category>
            <category>librerias</category>
            <category>python</category>
            <category>soluciones</category>
            <category>tests</category>
    
    </item>

  
    <item>
        <title>Generar miniaturas con PIL</title>
        <link>http://www.posteet.com/view/2057</link>
        <description>
        <![CDATA[<pre>def testImages(request):
    from PIL import Image
    path = ('c:/images/soluciones__1.jpg')
    #content = 'c:/images/soluciones1.jpg'
    content = 'c:/images/image.gif'
    image = Image.open(content)
    image.thumbnail((200,150), Image.ANTIALIAS)
    image.save(path, image.format)
    savelog(image.format)
    del image</pre> <a href="http://www.posteet.com/tags/django">[django]</a>  <a href="http://www.posteet.com/tags/PIL">[PIL]</a>  <a href="http://www.posteet.com/tags/python">[python]</a>  <a href="http://www.posteet.com/tags/tests">[tests]</a> ]]>        </description>
        <dc:creator>macks</dc:creator>
        <pubDate>Fri, 12 Mar 2010 18:12:44 +0100</pubDate>

            <category>django</category>
            <category>PIL</category>
            <category>python</category>
            <category>tests</category>
    
    </item>

  
    <item>
        <title>manipular datos de una bd externa con django</title>
        <link>http://www.posteet.com/view/2056</link>
        <description>
        <![CDATA[<pre>from django.db import load_backend, transaction, connection

#manipular datos de una bd externa

def sincronizeDB(self):
        myBackend = load_backend('mysql') # or 'mysql', 'sqlite3', 'oracle'
        myConnection = myBackend.DatabaseWrapper({
            'DATABASE_HOST': '192.168.1.11',
            'DATABASE_NAME': 'agenciaperu_local',
            'DATABASE_OPTIONS': {},
            'DATABASE_PASSWORD': &quot;&quot;,
            'DATABASE_PORT': &quot;&quot;,
            'DATABASE_USER': &quot;root&quot;,})
        # Now we can do all the standard raw sql stuff with myConnection.
        myCursor = myConnection.cursor()        
        id = 22
        name = &quot;tecnologia para jos&quot;
        slug = &quot;tecnologia_para_jos&quot;
        row = myCursor.execute(&quot;INSERT INTO category(name, slug )  values(%s,%s);&quot;, [name, slug])
        row = myConnection._commit()
        #row = transaction.rollback_unless_managed()  -----&gt; sería cuando trabajamos en local

# select simple
        #row = myCursor.execute(&quot;select *from category where id = %s and highlight = %s;&quot;,[id,0])
        myCursor.fetchall()</pre> <a href="http://www.posteet.com/tags/django">[django]</a>  <a href="http://www.posteet.com/tags/mysql">[mysql]</a>  <a href="http://www.posteet.com/tags/python">[python]</a>  <a href="http://www.posteet.com/tags/soluciones">[soluciones]</a> ]]>        </description>
        <dc:creator>macks</dc:creator>
        <pubDate>Thu, 04 Mar 2010 21:19:49 +0100</pubDate>

            <category>django</category>
            <category>mysql</category>
            <category>python</category>
            <category>soluciones</category>
    
    </item>

  
    <item>
        <title>operar listas</title>
        <link>http://www.posteet.com/view/2055</link>
        <description>
        <![CDATA[<pre>values = ['Enero','Enero','Enero','Febrero']
print  [(x,values.count(x)) for x in set(values)]

====&gt;&gt;[('Enero', 3), ('Febrero', 1)]</pre> <a href="http://www.posteet.com/tags/boocle">[boocle]</a>  <a href="http://www.posteet.com/tags/django">[django]</a>  <a href="http://www.posteet.com/tags/python">[python]</a> ]]>        </description>
        <dc:creator>macks</dc:creator>
        <pubDate>Thu, 25 Feb 2010 00:32:37 +0100</pubDate>

            <category>boocle</category>
            <category>django</category>
            <category>python</category>
    
    </item>

  
    <item>
        <title>Import RSS</title>
        <link>http://www.posteet.com/view/2054</link>
        <description>
        <![CDATA[<pre>&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;

&lt;title&gt;Blog Posts&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
&lt;!--
.rss{
width:200px;
display:block;
float:left;}

.rss h3 a{
color:#89b81d}

--&gt;
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h2&gt;Foo&lt;/h2&gt;
&lt;?php

$insideitem = false;
$tag = &quot;&quot;;
$title = &quot;&quot;;
$description = &quot;&quot;;
$link = &quot;&quot;;
$i = 0;


function startElement($parser, $name, $attrs) {
	global $insideitem, $tag, $title, $description, $link;
	if ($insideitem) {
		$tag = $name;
	} elseif ($name == &quot;ITEM&quot;) {
		$insideitem = true;
	}
}

function endElement($parser, $name) {
	global $insideitem, $tag, $title, $description, $link,$i;
	
		if ($name == &quot;ITEM&quot; &amp;&amp; $i &lt; 1) {
		printf(&quot;&lt;div class=&quot;rss&quot;&gt;&lt;h3 class=&quot;rssHeader&quot;&gt;&lt;a href='%s'&gt;%s&lt;/a&gt;&lt;/h3&gt;&quot;, trim($link),utf8_decode(htmlspecialchars(trim($title))));
		
		//Ohne Beschränkung
		//printf(&quot;&lt;p&gt;%s&lt;/p&gt;&lt;/div&gt;&quot;,utf8_decode(htmlspecialchars(trim($description))));
		
		//Mit Beschränkung
		$short = explode(&quot;n&quot;, wordwrap($description, 150, &quot;n&quot;)); //Ausgabe auf n Zeichen kürzen
		printf(&quot;&lt;p&gt;%s ...&lt;/p&gt;&lt;a href='&quot;.trim($link).&quot;'&gt;mehr&lt;/a&gt;&lt;/div&gt;&quot;,htmlspecialchars(trim($short[0])));
		
		$title = &quot;&quot;;
		$description = &quot;&quot;;
		$link = &quot;&quot;;
		$insideitem = false;
		$i++;
	}
}


function characterData($parser, $data) {
	global $insideitem, $tag, $title, $description, $link;
	if ($insideitem) {
	switch ($tag) {
		case &quot;TITLE&quot;:
		$title .= $data;
		break;
		case &quot;DESCRIPTION&quot;:
		$description .= $data;
		break;
		case &quot;LINK&quot;:
		$link .= $data;
		break;
	}
	}
}

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, &quot;startElement&quot;, &quot;endElement&quot;);
xml_set_character_data_handler($xml_parser, &quot;characterData&quot;);
$fp = fopen(&quot;http://blogurl.com/rss.php&quot;,&quot;r&quot;)
	or die(&quot;Error reading RSS data.&quot;);
while ($data = fread($fp, 4096))
	xml_parse($xml_parser, $data, feof($fp))
		or die(sprintf(&quot;XML error: %s at line %d&quot;, 
			xml_error_string(xml_get_error_code($xml_parser)), 
			xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);

?&gt;
&lt;/body&gt;
&lt;/html&gt;</pre> <a href="http://www.posteet.com/tags/rss">[rss]</a> ]]>        </description>
        <dc:creator>sm0k1nggnu</dc:creator>
        <pubDate>Mon, 22 Feb 2010 12:23:26 +0100</pubDate>

            <category>rss</category>
    
    </item>

  
    <item>
        <title>Récupérer la durée d'une vidéo avec ffmpeg depuis PHP</title>
        <link>http://www.posteet.com/view/2052</link>
        <description>
        <![CDATA[<pre>$videofile = &quot;fichier.flv&quot;;

ob_start();
passthru(&quot;ffmpeg -i &quot;{$videofile}&quot; 2&gt;&amp;1&quot;);
$duration = ob_get_contents();
ob_end_clean();

$search='/Duration: (.*?),/';
$duration=preg_match($search, $duration, $matches, PREG_OFFSET_CAPTURE, 3);

echo $matches[1][0];


Pour récupérer la durée, en seconde, on peut utiliser cette fonction :

echo hms2sec($matches[1][0]);


function hms2sec ($hms) {
	list($h, $m, $s) = explode (&quot;:&quot;, $hms);
	$seconds = 0;
	$seconds += (intval($h) * 3600);
	$seconds += (intval($m) * 60);
	$seconds += (intval($s));
	return $seconds;
}</pre> <a href="http://www.posteet.com/tags/dos">[dos]</a>  <a href="http://www.posteet.com/tags/durée">[durée]</a>  <a href="http://www.posteet.com/tags/ffmpeg">[ffmpeg]</a>  <a href="http://www.posteet.com/tags/fichier">[fichier]</a>  <a href="http://www.posteet.com/tags/php">[php]</a>  <a href="http://www.posteet.com/tags/vidéo">[vidéo]</a> ]]>        </description>
        <dc:creator>cyo</dc:creator>
        <pubDate>Sat, 20 Feb 2010 12:29:36 +0100</pubDate>

            <category>dos</category>
            <category>durée</category>
            <category>ffmpeg</category>
            <category>fichier</category>
            <category>php</category>
            <category>vidéo</category>
    
    </item>

  
    <item>
        <title>Syntaxe à utiliser pour exclurer certains répertoires lors de la création d'une archive avec tar</title>
        <link>http://www.posteet.com/view/2049</link>
        <description>
        <![CDATA[<pre>tar cvfz myproject.tgz --exclude='path/dir_to_exclude1' --exclude='path/dir_to_exclude2' myproject</pre> <a href="http://www.posteet.com/tags/archive">[archive]</a>  <a href="http://www.posteet.com/tags/compression">[compression]</a>  <a href="http://www.posteet.com/tags/exclusion">[exclusion]</a>  <a href="http://www.posteet.com/tags/répertoire">[répertoire]</a>  <a href="http://www.posteet.com/tags/shell">[shell]</a>  <a href="http://www.posteet.com/tags/tar">[tar]</a> ]]>        </description>
        <dc:creator>cyo</dc:creator>
        <pubDate>Tue, 16 Feb 2010 20:11:23 +0100</pubDate>

            <category>archive</category>
            <category>compression</category>
            <category>exclusion</category>
            <category>répertoire</category>
            <category>shell</category>
            <category>tar</category>
    
    </item>

  
    <item>
        <title>Dernier jour du mois</title>
        <link>http://www.posteet.com/view/2048</link>
        <description>
        <![CDATA[<pre># Pour une raison ou pour une autre, on peut avoir besoin de vérifier si la date du jour est le dernier jour du mois. Sauf que le dernier jour du mois peut être un 28, un 29, un 30 ou un 31.

# La commande date du projet GNU (ne fonctionne pas sur Solaris) permet de retourner une date autre que celle du jour. Il suffit alors de vérifier si &quot;demain&quot; sera le premier, et d'exécuter la commande de son choix en conséquence...

test `date +'%d' -d '1 day'` -eq &quot;1&quot; &amp;&amp; echo &quot;hello world&quot;</pre> <a href="http://www.posteet.com/tags/bash">[bash]</a>  <a href="http://www.posteet.com/tags/date">[date]</a>  <a href="http://www.posteet.com/tags/GNU">[GNU]</a> ]]>        </description>
        <dc:creator>benoitbalon</dc:creator>
        <pubDate>Mon, 15 Feb 2010 16:00:52 +0100</pubDate>

            <category>bash</category>
            <category>date</category>
            <category>GNU</category>
    
    </item>

  
    <item>
        <title>Go Beyond Web-Safe Fonts with CSS3 - Inspect Element</title>
        <link>http://www.posteet.com/view/2047</link>
        <description>
        <![CDATA[<pre>@font-face {

     font-family: Anivers;

     src: url(../fonts/Anivers.otf) format(&quot;opentype&quot;);

}</pre> <a href="http://www.posteet.com/tags/css3">[css3]</a>  <a href="http://www.posteet.com/tags/font-face">[font-face]</a> ]]>        </description>
        <dc:creator>stephanzr</dc:creator>
        <pubDate>Sat, 13 Feb 2010 23:08:32 +0100</pubDate>

            <category>css3</category>
            <category>font-face</category>
    
    </item>

  
    <item>
        <title>separador de comas desde el template</title>
        <link>http://www.posteet.com/view/2046</link>
        <description>
        <![CDATA[<pre>#template
{% load humanize %}
{{ my_num|intcomma }}</pre> <a href="http://www.posteet.com/tags/django">[django]</a>  <a href="http://www.posteet.com/tags/python">[python]</a>  <a href="http://www.posteet.com/tags/soluciones">[soluciones]</a>  <a href="http://www.posteet.com/tags/templates">[templates]</a> ]]>        </description>
        <dc:creator>macks</dc:creator>
        <pubDate>Fri, 12 Feb 2010 23:04:52 +0100</pubDate>

            <category>django</category>
            <category>python</category>
            <category>soluciones</category>
            <category>templates</category>
    
    </item>

  
    <item>
        <title>reemplazar, cortar, y convertir de lista a cadena en una sola linea</title>
        <link>http://www.posteet.com/view/2045</link>
        <description>
        <![CDATA[<pre>#form.cleaned_data['videoPath'] = C:Apacheuploadsvideosvideo_test.flv

path = form.cleaned_data['videoPath'].replace(&quot;\&quot;,&quot;/&quot;)
            vName = ''.join(path.split(&quot;/&quot;)[-1:])

#result = 'video_test.flv'</pre> <a href="http://www.posteet.com/tags/django">[django]</a>  <a href="http://www.posteet.com/tags/python">[python]</a>  <a href="http://www.posteet.com/tags/tips">[tips]</a> ]]>        </description>
        <dc:creator>macks</dc:creator>
        <pubDate>Wed, 10 Feb 2010 17:54:28 +0100</pubDate>

            <category>django</category>
            <category>python</category>
            <category>tips</category>
    
    </item>

  
    <item>
        <title>Greasemonkey Scrip Gmail Signatures</title>
        <link>http://www.posteet.com/view/2042</link>
        <description>
        <![CDATA[<pre>// ==UserScript==
// @name           Gmail Signature
// @namespace      http*://mail.google.com*
// @description    Añade automaticamente una firma a gmail
// @include        http*://mail.google.com*
// ==/UserScript==

//window._window = document.getElementById(&quot;canvas_frame&quot;).contentWindow;
window.__change = function(data){

	if( data == &quot;#compose&quot; ){
		var canvasWindow = unsafeWindow.document.getElementById(&quot;canvas_frame&quot;).contentWindow;
		var composeWindow = canvasWindow.document.getElementsByTagName('iframe')[0].contentWindow;
		var composeBody = composeWindow.document.body;
		var currentValue = ( composeBody.innerHTML ) ? composeBody.innerHTML : &quot;&quot;;
		
		composeBody.innerHTML = 'MI TEXTO' + currentValue;
	}
	unsafeWindow.console.log(data);

};
window.__check = function(){
	try{
		if( unsafeWindow.__hash != unsafeWindow.location.hash ){
			unsafeWindow.__hash = unsafeWindow.location.hash;
			__change( unsafeWindow.__hash );
		}
	}catch(e){};
};
window.__iniciar = function(){
	try{
		if( unsafeWindow.gmonkey ){
			try{
				if( document.getElementById(&quot;canvas_frame&quot;) ){
					unsafeWindow.__hash = &quot;&quot;;
					//unsafeWindow.console.log( unsafeWindow.__hash  );
					window.setInterval( function(){ __check(unsafeWindow);}, 1000 );
				}
			}catch(e){};	
		} else {
			window.setTimeout( __iniciar, 1400 );
		}

	}catch(e){};
};
document.addEventListener(&quot;load&quot;, function(){
	window.setTimeout(function(){
		__iniciar();
	}, 1000);
}, true);</pre>]]>        </description>
        <dc:creator>joserobleda</dc:creator>
        <pubDate>Tue, 02 Feb 2010 22:58:20 +0100</pubDate>

    
    </item>

  
    <item>
        <title>Preventing Cron Job Collision</title>
        <link>http://www.posteet.com/view/2040</link>
        <description>
        <![CDATA[<pre>$fp = fopen('/tmp/lock.txt', 'r+');  
  
if(!flock($fp, LOCK_EX | LOCK_NB)) {  
   echo 'Unable to obtain lock';  
   exit(-1);  
}  
   
/* ... */  

fclose($fp);</pre> <a href="http://www.posteet.com/tags/collision">[collision]</a>  <a href="http://www.posteet.com/tags/cron">[cron]</a>  <a href="http://www.posteet.com/tags/php">[php]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Wed, 27 Jan 2010 22:18:00 +0100</pubDate>

            <category>collision</category>
            <category>cron</category>
            <category>php</category>
    
    </item>

  
    <item>
        <title>Blocking Web Access to Cron Jobs</title>
        <link>http://www.posteet.com/view/2039</link>
        <description>
        <![CDATA[<pre>if (isset($_SERVER['REMOTE_ADDR'])) die('Permission denied.');</pre> <a href="http://www.posteet.com/tags/apache">[apache]</a>  <a href="http://www.posteet.com/tags/cron">[cron]</a>  <a href="http://www.posteet.com/tags/htaccess">[htaccess]</a>  <a href="http://www.posteet.com/tags/php">[php]</a>  <a href="http://www.posteet.com/tags/security">[security]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Wed, 27 Jan 2010 22:15:50 +0100</pubDate>

            <category>apache</category>
            <category>cron</category>
            <category>htaccess</category>
            <category>php</category>
            <category>security</category>
    
    </item>

  
    <item>
        <title>get extension of file</title>
        <link>http://www.posteet.com/view/2038</link>
        <description>
        <![CDATA[<pre>echo substr($filename, strripos($filename, '.'),strlen($filename));</pre> <a href="http://www.posteet.com/tags/php">[php]</a> ]]>        </description>
        <dc:creator>sx</dc:creator>
        <pubDate>Mon, 25 Jan 2010 22:40:16 +0100</pubDate>

            <category>php</category>
    
    </item>


</channel>
</rss>
