Форум сайта python.su
<ValCurs Date="19.04.2011" name="Ratele oficiale de schimb">
<Valute ID="47">
<NumCode>978</NumCode>
<CharCode>EUR</CharCode>
<Nominal>1</Nominal>
<Name>Euro</Name>
<Value>16.5370</Value>
</Valute>
<Valute ID="44">
<NumCode>840</NumCode>
<CharCode>USD</CharCode>
<Nominal>1</Nominal>
<Name>Dolar S.U.A.</Name>
<Value>11.5676</Value>
</Valute>
</ValCurs>
val_list=xml_t.xpath('/ValCurs/Valute/CharCode')
val_list=xml_t.xpath('/ValCurs/Valute/CharCode="USD"')
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import User
class UserProfile(models.Model):
# This is the only required field
user = models.ForeignKey(User, unique=True)
# The rest is completely up to you...
avatar = models.ImageField(upload_to='static', verbose_name=(u'Фото'), null=True, blank=True,)
birthday = models.DateField(verbose_name=(u'Дата рождения'), null=True, blank=True,)
UserProfileFormSet = inlineformset_factory(User, UserProfile, can_delete=False)
formset = UserProfileFormSet(instance=user)
Alias /app/ "C:/djcode/vctasks/apache/django.fcgi"
<Directory "C:/djcode/vctasks/apache/">
SetHandler fastcgi-script
Options +ExecCGI
Order deny,allow
Allow from all
</Directory>
FastCgiServer /app/django.fcgi
Syntax error on line 259 of C:/Program Files (x86)/Apache Software Foundation/Apache2.2/conf/httpd.conf:
Invalid command 'FastCgiServer', perhaps misspelled or defined by a module not included in the server configuration
from scapy.all import *
a = sniff()
send(IP(dst = '192.168.0.1')/ICMP())
print a
# -*- coding: utf-8 -*-
import sys
import pygame
class Tetris(object):
size = width, height = 210 , 300
speed_default = [0, 1]
speed_right = [20, 0]
speed_left = [-20, 0]
black = 0, 0, 0
def movement(self, course):
"""Метод передвигает фигуру в указанном направлении.
Направления передвижения:
1 - влево
2 - вправо
3 - вниз с начальной скоростью
4 - вниз моментально
"""
if course == 1:
speed = self.speed_left
if self.imagerect.left > 0:
self.imagerect = self.imagerect.move(self.speed_left)
elif course == 2:
if self.imagerect.right < self.width:
self.imagerect = self.imagerect.move(self.speed_right)
elif course == 3:
if self.imagerect.bottom < self.height:
self.imagerect = self.imagerect.move(self.speed_default)
elif course == 4:
self.speed_increased = [0, self.height - self.imagerect.bottom]
self.imagerect = self.imagerect.move(self.speed_increased)
self.screen.fill(self.black)
self.screen.blit(self.image, self.imagerect)
pygame.display.flip()
def screen(self):
self.screen = pygame.display.set_mode(self.size)
pygame.display.set_caption('Какая-то игра')
self.image = pygame.image.load('data/1.bmp')
self.imagerect = self.image.get_rect()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
self.movement(1)
elif keys[pygame.K_RIGHT]:
self.movement(2)
elif keys[pygame.K_DOWN]:
self.movement(4)
clock = pygame.time.Clock()
clock.tick(30)
self.movement(3)
if __name__ == '__main__':
pygame.init()
tetris = Tetris()
tetris.screen()
class Posts(models.Model):
name = models.CharField(max_length=255)
class Meta:
db_table = u'posts'
def __unicode__(self):
return self.name
class Privileges(models.Model):
name = models.CharField(unique=True, max_length=255)
obj = models.ForeignKey(Objects, db_column='id_object')
class Meta:
db_table = u'privileges'
def __unicode__(self):
return self.name
class PostPrivileges(models.Model):
post = models.ForeignKey(Posts, db_column='id_post')
priv = models.ForeignKey(Privileges, db_column='id_priv')
class Meta:
db_table = u'post_privileges'
def __unicode__(self):
return u'%s %s' % (self.post, self.priv)
class PrivilegesForm(forms.ModelForm):
class Meta:
model = PostPrivileges