Ye Old Cue - Visualizando multiples posts
September 13, 2007 at 09:08 AM | categories: python, oldblog | View CommentsRuby Based Kamaelia Core (miniaxon.rb)
September 10, 2007 at 11:07 PM | categories: python, oldblog | View Commentsclass Producer < Component(yes, I bought 2 ruby books at pycon uk, so shoot me :-) )
@@name = "Producer"
def initialize(message)
super
@message = message
end
def main
loop do
yield 1
send @message, "outbox"
showboxes if $debug
end
end
end
class Consumer < Component
@@name = "Consumer"
def main
count = 0
loop do
yield 1
count = count +1
if dataReady("inbox")
data = recv("inbox")
print data, " ", count, "\n"
end
end
end
end
p = Producer.new("Hello World")
c = Consumer.new()
postie = Postman.new(p, "outbox", c, "inbox")
myscheduler = Scheduler.new()
myscheduler.activateMicroprocess(p)
myscheduler.activateMicroprocess(c)
myscheduler.activateMicroprocess(postie)
run(myscheduler)
This compares fairly well with the equivalent python mini-axon code:
class Producer(component):The code for this miniaxon is here in subversion:
def __init__(self, message):
super(Producer, self).__init__()
self.message = message
def main(self):
while 1:
yield 1
self.send(self.message, "outbox")
class Consumer(component):
def main(self):
count = 0
while 1:
yield 1
count += 1 # This is to show our data is changing :-)
if self.dataReady("inbox"):
data = self.recv("inbox")
print data, count
p = Producer("Hello World")
c = Consumer()
postie = postman(p, "outbox", c, "inbox")
myscheduler = scheduler()
myscheduler.activateMicroprocess(p)
myscheduler.activateMicroprocess(c)
myscheduler.activateMicroprocess(postie)
for _ in myscheduler.main():
pass
The first class in that file (Coroutine) and first utility function there come from this entry:
What's next for this? Don't know really. As a proof of concept, it's interesting - its *as* capable an equivalent python based mini-axon, and could in theory give ruby developers the same boost that we get in python. I've no intention on doing a massive rewrite of existing python kamaelia code into Ruby, but it does open up some interesting options.
Language agnosticism is something I've always wanted for Kamaelia and this, along with Michael Barker's Java based experiments (and the fact that jython can run mini axon too), imply to me that the approach really can be language agnostic as was always intended :-)
Erlang vs Stackless
August 02, 2007 at 12:16 AM | categories: python, oldblog | View CommentsMore People on Facebook than live in Iraq
July 31, 2007 at 11:08 AM | categories: python, oldblog | View CommentsGreylisting for non-techies
July 31, 2007 at 12:03 AM | categories: python, oldblog | View CommentsNow greylisting is like magical glass that can recognise real flies from mystical flies because it can see that this sort of fly (since flies are all numbered as we all know) is willing to bang its head against the glass repeatedly. As a result the first time it sees a new sort of fly it tests the fly - does it bang its head repeatedly to get through or does it give up. If it gives up, it will never let that fly deliver its message. However if it proves its worth as a real fly and retries, then the magical glass will, from that day forward always allow that fly (they're all numbered remember) through to deliver the real email it carries.
Now obviously, the first time a new fly is seen this also means the magical glass has to check to see if the fly is a real fly or a mystical fly. This takes a little while, so the first time this happens this can cause the email the fly is delivering to be delayed, but does reduce the spam you recieve, so its not all bad :-)
Design Thinking Links
July 20, 2007 at 10:38 AM | categories: python, oldblog | View Comments- Getting Schooled In Design
- Designing a New OSI
- Redhat Magazine - Design Thinking special
- Intro to design thinking
- Stanford's new d.School
- The Empathy Economy
- Thinking design: A pencil, a ruler, and a cup of coffee (Part 1,Part 2)
- The Power of Design
- Better Linux release notes through design thinking
- Design Gets Its Due in Davos
- Design books that inspire us
- The Business of Design
It also matches with the way I tend to manage development in Kamaelia's SVN - it's set up to encourage a high diversity of ideas, large amounts of checkins, and rigourously stable and clean code in releases. Design is crucial in making something new. Taking that design and moving it to engineering is just as vital however, and there are some very important steps to bear in mind how that happens. (not least that the skill set can be extremely different and many people need to learn at least one of those sets of skills)
Python, Nokia Mobiles, Easy control from linux; Sync of profile/blog picture with facebook
July 19, 2007 at 01:41 AM | categories: python, oldblog | View Comments# sdptool add-channel=27 SPAlso, facebook image syncing:
# rfcomm listen /dev/rfcomm0 27
Waiting for connection on channel 27
Connection from 00:11:22:33:44:55 to /dev/rfcomm0
Press CTRL-C for hangup
connect using btconsole.py on phone
on different console on linux
minicom -s -m (set device to /dev/rfcomm0 )
curl 2>/dev/null -O -A "Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1) Gecko/2006102
3 SUSE/2.0-30 Firefox/2.0" http://www.facebook.com/p/Michael_Sparks/747770380
F=`grep profileimage 747770380|sed -e "s/^.*http:/http:/"|sed -e "s/\.jpg.*/\.jpg/"`
G=`grep profileimage 747770380|sed -e "s/^.*http:/http:/"|sed -e "s/\.jpg.*/\.jpg/"|sed
"s#.*/##"`
curl 2>/dev/null -O $F
mv $G michael.jpg
cp michael.jpg /usr/local/httpd/sites/com.yeoldeclue/docs/michael.jpg
Configuring Exim to block email to all except specified addresses
May 20, 2007 at 05:41 PM | categories: python, oldblog | View CommentsBlocking email to all addresses except specific ones using exim is pretty easy. First of all create one file /etc/blocked_emails.list, and add to it a list of email addresses which are blocked:
foo@bar.comNext step is to create a list of addresses those emails can send to. Put these into a file called /etc/exceptions.list and list one local part per line - for example:
bibble@bar.com
etc@bar.com
johnYou then have two possible modes here. You can either defer accepting email so it takes a while to bounce, or have it deny delivery immediately. The former is in many cases actually preferable because someone will assume its been delivered and only find out its bounced, with a relatively innocuous error message some days later. Given you only tend to block people because they're being OTT, this gives them a chance to cool off and for any nasty messages to be lost, unread, in the ether.
bob
rita
To have the mail system defer delivery of email from any of the blocked_emails, to any address other than any of the emails in the exceptions, put the following in your exim ACL's rules for rcpt checking:
begin acl
acl_check_rcpt:
accept local_parts = /etc/exceptions.list
senders = /etc/blocked_emails.list
defer message = Mailbox full, retry later
senders = /etc/blocked_emails.list
The message is deliberately innocuous. However if the person (or persons) ramps up their antisocial behaviour and doesn't take the hint, you can change this to instantly deny access and send a message back immediately rather than 4-24 hours later by changing defer to deny:
begin aclIt's really sad when things come to this. There is an advantage to using config files like this however in that you only need to edit the contents then of blocked_emails and exceptions in order to re-allow emails through, or to block access completely to all emails.
acl_check_rcpt:
accept local_parts = /etc/exceptions.list
senders = /etc/blocked_emails.list
deny message = Your email has not been and will not be delivered - it has been blocked
senders = /etc/blocked_emails.list
In case anyone is wondering why I know these rules and why I'm writing it up - it's because I'm in the situation where I'm having to use this right now.
Come to PyCon UK - September 8th&9th !
April 20, 2007 at 11:26 PM | categories: python, oldblog | View CommentsWhy am I posting about this? I'd personally like to invite UK pythonistas to come, share their knowledge with others, learn new things and hang out. It's a community conference, which means it has the following characteristics:
- You can help make it amazing, by participating & speaking, by helping, by attending!
- It is cheap
- It will be fun, and accessible. We (I'm helping organise this :) ) really want the conference to be accessible to all, from those who have no idea of what python is, let alone coded in it, through to those who are working on their upteenth bytecode hack/compiler.
One Laptop Per Child Project Looking For Pygame Devs
April 07, 2007 at 09:48 AM | categories: python, oldblog | View CommentsFrom: Noah Kantrowitz [ check pygame archives for email (don't want to cause spammage) ]If you know and enjoy pygame and are looking for something good and fun, it'd be well worth getting in touch.
Subject: [pygame] Calling all game developersCalling all game developers! The One Laptop Per Child project needs
talented game developers to work on software for the XO laptops. Thanks
to a few awesome developers, PyGame is now up and running under Sugar
(the OLPC graphical environment) and should be included in the build
system shortly. What we need now is games geared towards children in
developing areas. Information about PyGame on the XO can be found at
http://mailman.laptop.org/pipermail/games/2007-April/000036.html. I
would ask anyone interested in either building new games or porting
existing ones to join the OLPC games list
(http://mailman.laptop.org/mailman/listinfo/games) and discuss your
ideas there. This is a chance to have a major impact on the lives of
millions of children, as well as work on a unique platform. If you have
any questions please don't hesitate to email me, or ask on the games list.--Noah Kantrowitz
OLPC Evangelist
« Previous Page -- Next Page »