Archive Page 2

09
Sep
09

[update] PyMouse

Today I spend my day trying to improve PyMouse.

  • I added some suggested changes to the Windows part, please test them.
  • I modified the Mac part according to a comment on this blog. [Currently broken under Snow Leopard!]
  • Unix part unchanged…

Please let me know if and how it works. Especially if you know something about PyObjc…

Advertisements
05
Sep
09

[Update] PyMouse

Remember the post a few weeks ago about my Python mouse control library? If not, this is the link: https://metapep.wordpress.com/2009/07/10/control-the-mouse-on-mac-with-python/ and this the Google project: http://code.google.com/p/pymouse/

It has been added to Softpedia! I just received a mail about it. It’s listed under Mac products, but it’s cool anyway and it encourages me to continue to work on it.(just as much as it encourages me to see reactions and patches from people!)

http://mac.softpedia.com/get/Developer-Tools/pymouse.shtml

03
Sep
09

pepijndevos.nl

This is just a short notice that I’ve started up another blog about WordPress and PHP in Dutch. I’ll continue to post my Python stuff in English here. so that means:

  • My English Python stuff: right here
  • My Dutch WordPress stuff: pepijndevos.nl
  • English WordPress stuff: there’s enough on the internet about that, right?
23
Aug
09

About __main__

I think most Python programmers have written it a thousand times:

if __name__ == '__main__':
    #some code

I also assume you know what the result is of the following code:

class test(object):
    pass

print test.__name__
#test

So lets assume the __name__ variable contains the current class name, what would the __main__ class be? It’s the invisible main class of course! But there’s something strange going on:

print test
#<class '__main__.test'>

print __main__
#NameError: name '__main__' is not defined

So… the test function is a member of __main__, but main itself does not exist? Strange… When I was frustrated by this I experimented some, lets check the following piece of code:

import __main__

print __main__
#<module '__main__' (built-in)> 

print dir(__main__)
#['__builtins__', '__doc__', '__main__', '__name__', 'test']

__main__.test2 = 'Hello world!!!'
print test2
#Hello world!!!

Isn’t that amazing? We imported __main__, saw it had the test class assigned to it, we assigned a new variable and saw the module scope updated!

This might sound quite pointless, but you can do a lot of dirty tricks with it, for example assign variables by strings:

name = raw_input('Enter a variable name: ')
setattr(__main__, name, 'Dirty trick')
print dir(__main__)
#['__builtins__', '__doc__', '__main__', '__name__', 'test', 'test2', '<your input here>']

This method is used in my xhtml generator to assign partitial functions for xhtml tags to the module scope(to have a(href=”test”) instead of SomeClass.a(href=”test”) or even SomeClass.html(‘a’, href=”test”).

01
Aug
09

Kill those spam followers! – BETA

It happens to everyone on Twitter: spam/fake followers. Do you want to get rid of them?

Inspired on this post I started working on a anti-spam app to block these spammers. My app checks your followers list on the 3 points explained in that post, being:

  1. Names with a number
  2. A 10/1 ratio of friends/followers
  3. Posts via the API

The app is currently in the testing phase, and I need your help! I tested it on my own little followers list, but who knows what happens when you try it on your followers!

Currently the app only checks your followers and gives some output. I need you to run the app and report false positives/negatives. I’ll explain you how you can try this in a moment. The output looks like this:

Username (-- SPAM) <-- name and if it's spam or not
63 <-- percentage of spaminess
{'individual': 23, 'test: 0, 'results': 40} <-- results per test

Instructions for testing my anti-spam app:

  1. If you don’t have a Python environment set up, roughly follow this howto and another one. (and google for PYTHONPATH afterwards)
  2. Open a terminal and type: easy_install simplesjon
  3. Download antispam.py from the box.net widget
  4. Get back to your terminal and type: cd /the/dir/where/my/app/is
  5. Open antispam.py in a text editor and replace USERNAME and PASSWORD at the bottom with your Twitter username and password
  6. Get back to your terminal and type: python antispam.py
  7. Watch the output roll over your screen…

If you get stuck somewhere, just leave a comment. If you found a false positive/negative, also leave a comment including a part of the output.

If you’re realy confident of the workings of the app you can remove the # sign before user.tag_as_spam and user.block_user at the bottom of the file, now my app is realy going to block and report people!

If enough people tested this version I’ll make an easy to use exe with a graphical user interface(which would eliminate the four toughest steps). The Python version will still be available for Mac and Linux users.

30
Jul
09

Get the overview on what is happening on Twitter visually!

example

Now available as a web service!

Have you lost who is saying what to who? Do you think one image(graph) says more than a thousand words(tweets)? Are you tired of clicking back and forth to see conversations?

I’ve made a new Twitter solutions that shows all your tweets and your friends tweets in one graph. It connects your tweets to the people you @refer to and to #tags!

To try this great application download it from my Box.net widget as usual. The usage is:

$ python tweetograph.py USERNAME:PASSWORD[ dot|neato|twopi|circo|fdp]

Requires Python-Twitter and PyDot to run. You can optionally specify the Graphviz tool you want to use for layout(default is dot), see Wikipedia.

Known bugs:

  • Dot is really picky on characters entered, so currently some characters get stripped

Update: Now it even draws dotted lines from ReTweets to their original, so you can actually see where that RT came from!

Update: here is a PDF of my network, so you can see how it works: bobdebvlinder(rendered using neato)

Update: Replies now get a dashed line between them so you can really follow conversations!

28
Jul
09

Frustrated by your mouse? Try the keyboard!

Back in 1979 Apple introduced the first computer mouse. It was a great breakthrough. So why get back to the old way of dong things? The point is, you’re not doing that. The mouse is a great invention for manipulating visual data.

But if you want to speed up your work, think twice before moving your hand away from the keyboard. It’s faster to use the keyboard for most things while you have your hands at it for typing.

But there is a problem… This is your mission: Close all your applications and hide the mouse. Try how far you can get without it! (wipe the dust of that tab key and use it!)

Here is what happens when I try this on my Mac: tab tab tab… cmd+o (HD) tab tab tab tab cmd+o (Applications) s tab tab cmd+o (I’m in Safari now) tab tab(search box) enter shift+tab shift+tab shift+tab shift+tab shift+tab shift+tab shift+tab shift+tab shift+tab enter(finally reached the site I wanted to)

Can we speed up this process? Yes we can!(don’t say a word about this president person) The first part can be solved using applications like Quicksilver or Google Quick Search Box. These are applications for quickly opening files and applications and much more(moving files, play iTunes, etc.). But how about the second part(Safari, or any other browser)?

The second part is up to people like me(who make websites) For examples, look here(tab index) and here(keyboard shortcuts)(login with demo/demo).




My blog has moved!

My blog has permanently moved to a self hosted Wordpress at http://pepijndevos.nl

This blog will stay around for accidental search engine visitors.

Me

This is me

Blog Stats

  • 22,629 hits

@PepijnDeVos