2 days ago
usando la libreria ffmpeg
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
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2058"></script>
2 days ago
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
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2057"></script>
1 week ago
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': "",
'DATABASE_PORT': "",
'DATABASE_USER': "root",})
# Now we can do all the standard raw sql stuff with myConnection.
myCursor = myConnection.cursor()
id = 22
name = "tecnologia para jos"
slug = "tecnologia_para_jos"
row = myCursor.execute("INSERT INTO category(name, slug ) values(%s,%s);", [name, slug])
row = myConnection._commit()
#row = transaction.rollback_unless_managed() -----> serĂa cuando trabajamos en local
# select simple
#row = myCursor.execute("select *from category where id = %s and highlight = %s;",[id,0])
myCursor.fetchall()
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2056"></script>
2 weeks ago
values = ['Enero','Enero','Enero','Febrero']
print [(x,values.count(x)) for x in set(values)]
====>>[('Enero', 3), ('Febrero', 1)]
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2055"></script>
4 weeks ago
#template
{% load humanize %}
{{ my_num|intcomma }}
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2046"></script>
1 month ago
#form.cleaned_data['videoPath'] = C:Apacheuploadsvideosvideo_test.flv
path = form.cleaned_data['videoPath'].replace("\","/")
vName = ''.join(path.split("/")[-1:])
#result = 'video_test.flv'
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2045"></script>
1 month ago
cName = ['funciton','bcp','interbank','sheraton']
cPhone = ['65465465','4546545','56465465','545454545']
cRuc = [5465463545,546546546,5245454,9898998]
store = [cName,cPhone,cRuc]
l = []
i = 0
for s in store:
cname = store[0][i]
cphone = store[1][i]
cruc = store[2][i]
l.append({'cname': cname, 'phone':cphone, 'ruc':cruc})
i = i+1
savelog(l)
[{
'phone': '65465465',
'cname': 'funciton',
'ruc': 5465463545L
},
{
'phone': '4546545',
'cname': 'bcp',
'ruc': 546546546
},
{
'phone': '56465465',
'cname': 'interbank',
'ruc': 5245454
}]
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2035"></script>
2 months ago
from django.utils.encoding import iri_to_uri, smart_str, smart_unicode
from django.utils.http import urlquote
url = iri_to_uri('%s?query=%s' % (urlresolvers.reverse('search_home_index'), urlquote(query)))
return HttpResponseRedirect(url)
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2014"></script>
2 months ago
public static function blocks_arrays
($array,
$pieces){
if ($pieces < 2 ){
}
$b = Utiles::
blocks_arrays(array_slice($array,
$newCount),
$pieces-1);
}
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2011"></script>
3 months ago
#if simple
u.is_active = True if is_active == 'on' else False
Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2005"></script>