insomnihack

When sleep eludes, the keyboard beckons

Tracking followers with python-twitter

December 25, 2009 Dale 1 Comment

There are a lot of applications out there to help manage your twitter account. Much of what these applications have to offer can be achieved with very little python code. For example, say you want to find out who is following you that you’re not following. Alternately, say you want to find out who you’re following, but who isn’t following you in return. You can find this information out easily with python-twitter and a few lines of code.

[python]
#!/usr/bin/env python

import twitter

if __name__ == ‘__main__’:
api = twitter.Api(username=’username’, password=’password’)
i_follow = api.GetFriends()
follow_me = api.GetFollowers()
i = [u.name for u in i_follow]
f = [u.name for u in follow_me]
i_should_follow = [n for n in f if n not in i]
i_should_drop = [n for n in i if n not in f]

print ‘I follow:’
print ‘\n’.join(i)
print
print ‘Following me:’
print ‘\n’.join(f)
print
print ‘I should consider following:’
print ‘\n’.join(i_should_follow)
print
print ‘I should consider not following:’
print ‘\n’.join(i_should_drop)
print
[/python]

Replace the dummy user name and password and give it a go.

Programming Python, twitter

IPython Color Console Output

December 16, 2009 Dale 1 Comment

IPython does a decent job of providing console output in color on all the platforms I use it on. If you’re like me and you’ve wanted to use its coloring functionality for your own terminal output, here’s a snippet that should get you started.

[python]
from IPython import ColorANSI
from IPython.genutils import Term
tc = ColorANSI.TermColors()
red = tc.Red + "Red" + tc.Normal
print >> Term.cout, red
blue = tc.Blue + "Blue" + tc.Normal
print >> Term.cout, blue
[/python]

Assuming you have color output enabled (if you’re on Windows, you’ll need PyReadline), you should be able to %paste the plain text from the snippet above into IPython and see the output below.

Red
Blue

Programming IPython, Python

Upgrading Visual Studio Team System 2008 Trial on Windows 7

December 6, 2009 Dale 1 Comment

So I ran into my first major incompatibility issue with Windows 7. Somewhat ironically its with a Microsoft product. In the setup for the Visual Studio Team System 2008 Trial, there is typically a maintenance mode page with an Upgrade field for you to enter your update key when the trial ends. That is, its typically there for Windows XP or Vista. On Windows 7 (I’m using the 64-bit version), the upgrade fields are missing.

The issue has been reported to Microsoft, but despite subsequent posts by customers with identical problems, its been marked as unreproducible. However, the instructions on that page as listed did not work for me, at least not without uninstalling the main Visual Studio 2008 Team System application. Here’s exactly what I did.

Step 1: Uninstall Visual Studio 2008. I couldn’t get this process to work without uninstalling.

Visual Studio TS Uninstall

Step 2: Copy the installation files from the Visual Studio 2008 Team System setup disk.

Step 3: In the Setup folder, open setup.sbd in an editor.

Step 4: Change the temporary key under the [Product Key] tag to your upgrade key. Remove any spaces or dashes.

[text firstline=”127″ highlight=”137″]
[Error Log]
dd_error_VS_VSTSCORE_90.txt

[Event Log]
dd_install_VS_VSTSCORE_90.txt

[Suite Requirements]
vsbasereqs.dll, GFN_CID VS Baseline Requirements

[Product Key]
YOUR25CHARACTERSERIALHERE

[Dialog Page Order – AdminMaintenance]
[/text]

Step 5: Save the file and run the setup.exe at the root of the installation.

You should see the key you entered in the setup.sbd file in the read-only license key fields on the installation screen. If you encounter the screen and you uninstalled Visual Studio Team System 2008, you may have edited setup.sbd.

Visual Studio 2008 TS Setup Error

As a last resort, try copying the files over once more and try again. Hope this helps.

Programming Visual Studio

« Previous Page
Next Page »

About Me

Hi, my name's Dale, and this is my tech blog. Read More…

Search

Tags

blogging c# database Django documentation Email furniture git hacks htpc IPython Linux mac nas packaging PyCharm Python Roleplaying tools twitter unit tests virtualenv Visual Studio vmware Windows

Copyright © 2025 · Equilibre Theme on Genesis Framework · WordPress · Log in