• Home
  • About Me
  • Contact

kanorben.net - blog

My personal blog on technology, programming, life, and the random

 

October 2008
M T W T F S S
« Aug    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Blogroll

  • Boing Boing
  • BorjaNet
  • Brian Mayer
  • Dean Armstrong’s Blog
  • Ellen Smith’s blog
  • Faraocious
  • Gross or Awesome?
  • Marcus Westin’s Blog
  • Nightmares of David Bowie’s Package
  • Paul Mantz’s Blog
  • Slashdot
  • Tomorrow with Alex Beinstein
  • Valleywag

Personal Sites

  • DOIT Fortune Database
  • My bookmark’s on del.icio.us
  • My CS account page
  • My Facebook Profile
  • My LinkedIn Page
  • My Picasa Albums
  • My Twitter
  • pyXSD
  • The SUCCESS Blog
  • UofC ACM Site

webcomics

  • Questionable Content
  • Saturday Morning Breakfast Cereal
  • The Perry Bible Fellowship
  • Welcome To The Future
  • xkcd

Meta

  • Register
  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
Add to Google Add to My Yahoo! Subscribe with Bloglines
Bloggers' Rights at EFF

Twitter Updates

    RSS My Del.icio.us

    • ledger
    • Git User's Manual (for version 1.5.3 or newer)
    • Don’t overuse classes in Python | The GITS Blog
    • BBC NEWS | UK | Magazine | The rival to the Bible
    • Elite Officer Recalls Bin Laden Hunt, Delta Force Commander Says The Best Plan To Kill The Al Qaeda Leader In 2001 Was Nixed - CBS News
    • How Laser TVs work at BrainStuff
    • uMac | University of Utah | Xhooks

    RSS My Facebook Posted Items

    • Elite Officer Recalls Bin Laden Hunt, Delta Force Commander Says The Best Plan To Kill The Al Qaeda
    • Language Fail
    • Safety Fail
    • Gnarls Barkley Crazy Theremin Jam
    • Domino's Scientists Test Limits Of What Humans Will Eat | The Onion - America's Finest News Source

    Fixing Facebook with userContent.css

    August 5th, 2008 by knorby

    I posted something previously on blocking social ads in facebook with greasemonkey, where I came to the conclusion incorrectly it could not be done with css. I apparently remembered what “! important” did in userContent.css and userChrome.css; I read “! important” as “not important,” but it aparently means the opposite, and overrides any webpages css. I corrected my post on userContent.css and userChrome.css customization as well. Stupid logic. Anyway, if you add the following block into your userContent.css file, you should be able to block most annoying stuff on both the new facebook design and old.

    @-moz-document url-prefix(http://www.new.facebook.com/) {
    .sponsor, .invitefriends, .findfriends, .gifts_received, .pymk, .social_ad, .adcolumn{
    display: none ! important;
    }
    }

    @-moz-document url-prefix(http://www.facebook.com/) {
    .sponsor, .invitefriends, .findfriends, .gifts_received, .pymk, .social_ad, .adcolumn{
    display: none ! important;
    }
    }

    There may be a way to combine these two, but I don’t know the more mozilla-internal css well enough to know. If you use facebook, most of these should be clear. I blocked gifts, as I find them annoying, and I am glad to just not be aware of them. I also blocked the person finding features like “people you may know” (’.pmyk’) or the email search things. I also blocked ads of course. Facebook seems to have to idea that everyone will love ads if they are more specifically targeted at you, based on data they have on file. I can’t stop them from doing that (other than by closing and deleting my account), but I shouldn’t have to see ads if I don’t want to IMHO. Also notice that the new facebook design and the old one use the same css classes for everything; the redesign isn’t that extensive apparently.

    Posted in coding, css, facebook, firefox | 1 Comment

    I’m on the Google Open Source Blog!

    June 6th, 2008 by knorby

    It’s true! Borja wrote up a summary of the GSoC lightening talk event, including pictures. If you don’t know what I look like, I am in both the GSoC student one and the ACM officer one. I really wish I got a haircut before this thing….

    Borja linked to our website, which hopefully won’t get too much traffic. It is currently at 359 days of uptime, and I have shooting for a year of uptime before upgrading to the latest and greatest version of OpenBSD.

    Posted in ACM, Chicago, GSoC, OpenBSD, blogs, coding, globus, google, personal, uchicago | 1 Comment

    The Last Little Bit

    April 22nd, 2008 by knorby

    I haven’t been posting a lot recently, so I thought I would just kind of outline a little of what has been going on recently.

    Some members of the RAS installed the weather station on the roof of Ryerson today (I wasn’t involved in the efforts today unfortunately). In addition, the web view now works (not me again), which I started on. It is still temporary, but it is currently up. I will be assembling a better website, which will be more permanent. I was fearing we wouldn’t be able to get it onto a POSIX operating system, but then wview came to the rescue. I will put up some pictures soon. It was really great to see it finally on the roof. It was some random idea I had a while ago, and it finally materialized.

    The biggest news for me today is that I was accepted to Google Summer of Code on the Globus Toolkit. I will be working on a diagnostic administrator interface framework; essentially, it is more Python+XML work, but with Globus. This will also be the third summer in a row that I have done XML work with people based at a national lab (Globus is based at Argonne–not the same as actually working there for the summer, but I will be visiting soon). I will also be working at the Maclab, which should be fun and a chance to do some real work on projects there.

    A lot of people are leaving the maclab at the end of the quarter, so I will end up with quite a bit more on my plate it looks like. After the last two weeks or so, I look foreword to that less. Over the last break, I converted many of the servers to Leopard Server, Apple’s latest rendition in bloated bad design. From that experience alone, I lost all respect for Apple (there wasn’t much there in the first place). What kind of upgrade on a server edition of the Operating System overwrites the most basic of configuration and files on upgrade? This last week, our web/dhcp server went down at the same time as our print system, our two most vital systems. From what it looks like now, DirectoryService, the LDAPesque utility that Apple now uses for local accounts as well. epically failed, and I do mean epic. There are some other problems as well; the actual cause is still allusive, but we at first presumed hackers, which can’t be ruled out. The print system? As far as we can tell, the problem is that Leopard is a horrid piece of shit that ruins every piece of software it touches. The implementation of CUPS on it is horribly broken (to a vast extent), despite the fact Apple owns it! I will spend more time in the short future on a series of posts that outlines my points of hatred for it. Dealing with the problems rated pretty high on my rankings of stressful events, and there is still work to be done.

    Together with another failure, this time from NSIT, I think I know fully grasp an important life lesson: assume incompetence. NSIT made a pathetic effort to announce that they were going to switch the LDAP server from OpenLDAP to a Sun-based implementation . Apparently, they had a test server, but they neglected to give the address out, or test it on their own machines. NSITE/USITE has its own Macs, even another Maclab (I think of it as the bazarro Maclab; the imaging work is handled remotely, the none of staff know much computers from what I hear, there are few users, and the software is up to date), of which at least some run Tiger. No one tested these to see if logins would, you know, work. Anyways, all our tigers failed to login after the switch. It turned out to be some check box on some security page (in fact the only check box on the security page), for which it took 7 people 48 hours (I think that’s with few breaks in it) to find the fix. We decided to let them deal with it as it was their problem. Incompetence really explains this whole thing well. When we were switching to Leopard on the servers, the ServerAdmin presented us with a catch-22; it was impossible to save setting on one page without saving the settings on another, but it was impossible to save settings on the other one without first saving the changes on the first. What accounts for this flagrant error in the GUI? Why incompetence of course! I experienced a similar sort of situation on a Sun box I work on; everything program I used seemed broken. I e-mailed the sysadmins for a while at which point this golden rule struck me. I ended up compiling any program that failed to work on something. For example, there was some weird error with make. so I compiled and installed gmake to my home directory, and it solved all my problems. I suppose it is not fair to just call this incompetence; laziness should be added in there somewhere.

    Some other stuff has been happening, but that makes for a decent mind-purge. It’s nice out again! I can where sandals and shorts comfortably!

    Posted in Apple, Solaris, coding, google, personal, rants, uchicago | No Comments

    Playing With Ctypes and Ghostscript

    March 25th, 2008 by knorby

    I have been playing around with the ctypes library in python recently. It is a foreign function interface for dynamic linked libraries(DLL)/shared libraries. It works back to python 2.3, and it was added into the standard library in python 2.5. Anyway, it provides a much nicer way to access C libraries then using one of the various methods to create a C extension, though it is a bit slower. As I learned at pycon, one of the benefits is that PyPy (one of the craziest things I have ever seen) can use ctypes. I was thinking of staying for the PyPy sprint at pycon, but I think they were going to work on a pure python implementation of the library, which was far too intimidating to me. I will post about pycon at some point soon.
    I guess I find ctypes so special just because it is the first thing in recent history with python where I was really amazed. I first saw it with µTidylib, which is a python wrapper around the HTML tidy library. What got me was just playing with it on the interpreter:

    >>> from ctypes import *
    >>> libc = CDLL("libc.so.6")
    >>> libc.printf("Hello, World!\n")
    Hello, World!
    14
    >>>

    Obviously, it is a lot more powerful than this example illustrates, but you get the idea. I have been fixing up some of the filters in the print system at the Maclab over spring break, so I have been working with ghostscript a bit. There is an API for ghostscript, so I have started writing a wrapper library for it in my free time to practice using ctypes, and, well, because one doesn’t exist. I am trying to think of a name that somehow combines ghosts, snakes, and desktop publishing….

    Posted in C, Python, coding, postscript | No Comments

    Removing Social Ads from Facebook Feeds

    March 3rd, 2008 by knorby

    Update: see my post “Fixing Facebook with userContent.css” for a corrected and more extensive way to go about this. There are some stupid errors in this post that lead me to use a bad approach, but the greasemonkey script should still work.

    I am not a huge fan of ads. I say that somewhat hypocritically as adSense proudly barfs somewhat random ads out on this page, none of which I really expect will ever click on, but that is besides the point ;). Anyway, I can normally block ads with adBlock, but social ads are trickier. Every social ad div has for a class:
    feed_item clearfix social_ad
    Each one is a seperate class. They do some trick so it is hard to override with a page wide css that doesn’t take out everything, so userContent.css and similar tricks are out. I ended up brute forcing it and writing a greasemonkey that does the job.

    Download it here: hidefacebookfeedadsuser.js

    Update: There is another class used as well. If I remember correctly, instead of social_ads, its ad_capsule with everything else the same.

    Posted in coding, css, facebook, firefox, internet, javascript | 1 Comment

    Creating Interfaces in Python

    February 9th, 2008 by knorby

    While working on our project for software construction today, my partner and I started to work out an implementation of interfaces in Python. Fortunately, we didn’t end up needing to go to this extreme (it’s a weekend assignment). Interfaces have been proposed for python before, but the changes were never made. Anyway, we worked out a basic strategy to implement interfaces in python. The most common approach for this sort of thing is to just make a base class with methods that raise the NotImplementedError if they should be overridden. For the most basic implementation of an interface, this approach works, but what if we want to put contracts or a docstring test on this method? There is essentially no way to go about such an implementation with standard methods in python. Instead of using the traditional syntax to express inheritance, some function would be needed to implement interfaces. Really, most of we want to get from the interface could be considered “shell” around another function. We just want to put in the guts part of the method, and if the guts are not put in, python should raise an error. The easiest way to implement something like that would be to just maintain two methods. So, for every method foobar(self, arg1, arg2, …), there would also be a function __foobar(self, arg1, arg2, ….). Perhaps a different convention, such as __Interface_foobar(self, arg1, arg2, …), would be appropriate as to not interfere with one’s ability to assign __foobar to something else, but these are points are trivial. Ideally, I will come up with some sort of nice interface metaclass or base class and a set of function decorators that would take care of much of the work involved, but written out if full, it would look like

    class Foobar(Interface):
        #===============================================================================
        def __init__(self):
            raise NotImplementedError, "__init__ must be implemented by a subclass"
        #===============================================================================
        def foobar(self, aArg):
            """
            This is a function is the shell of an interface method
            """
            if not isinstance(aArg, BarType):
                raise TypeError, "aArg must be a BarType"
            return self.__Interface_foobar(aArg)
        #===============================================================================
        def spam(self):
            """
            Just some regular method.
            """
            return 3

    Then after defining some class that implements this interface Foobar, do something like this


    Foobar.implementedBy(eggs)

    I will probably have to make some changes once I start banging away at python. I know python well, but I don’t know every bit of trivia.

    One of the consequences of this setup is that everything is done at runtime, and some external testing procedure would be needed to verify that everything follows the interface. On the plus side, these would be something unique from interfaces as well; these thing really could be used for a whole bunch of things beyond the scope of normal interface. Also, everything needed to implement this sort of thing could be done without any changes to the language itself or use of modules outside of the python standard library. So, I will work on this thing sometime when I have time, which is never…

    Posted in Python, coding, design | No Comments

    It’s a Startup!

    February 1st, 2008 by knorby

    Some friends of mine from the maclab and I are planning to go into a startup of great hilarity. We just got the domain names, so hopefully we will have something we can be more public about soon.

    Posted in coding, internet, personal, uchicago | No Comments

    Explorations of Hello World Perversion

    January 10th, 2008 by knorby

    What follows is probably the most perverse shell script I have ever written. I decided to write a script that somehow implemented Hello World for a bunch of languages. I didn’t include Java, because the installation of java on the machine I wrote this script on was somehow messed up. Plus, Java sucks hard. I didn’t do any javascript either as Rhino was messed up (see last sentence), and spidermonkey wasn’t installed. I included far too many, but I will gladly add more if someone bothers to write some. You can also download the file. Wordpress messed a few things up, which I tried to correct, so download the file copy if you actually want to try thing thing out. Also, you might need to install some stuff unless you are in the UofC CS department Linux clusters. I apologize to the world for what my boredom can cause…


    #!/usr/bin/env bash
    #====================================
    echo "Bash:"
    bash << EOF
    echo "Hello World!"
    EOF
    #====================================
    echo "Python:"
    python << EOF
    print "Hello World!"
    EOF
    #====================================
    echo "C:"
    TMPFILE="/tmp/stupidgcc.c"
    TMPOUTPUT="/tmp/stupidgcc"
    touch $TMPFILE
    cat > $TMPFILE << EOF
    #include <stdio.h>
    int main(){
    printf("Hello World!\n");
    return 0;
    };
    EOF
    gcc -o $TMPOUTPUT $TMPFILE
    $TMPOUTPUT
    rm $TMPFILE $TMPOUTPUT
    #====================================
    echo "Ruby:"
    ruby << EOF
    puts "Hello World!\n"
    EOF
    #====================================
    echo "Perl:"
    perl << EOF
    print "Hello World!\n"
    EOF
    #====================================
    echo "C++:"
    TMPFILE="/tmp/stupidg++.cpp"
    TMPOUTPUT="/tmp/stupidg++"
    touch $TMPFILE
    cat > $TMPFILE << EOF
    #include <iostream>
    using namespace std;
    int main()
    {
    cout << "Hello World!" << endl;
    return 0;
    }
    EOF
    g++ -o $TMPOUTPUT $TMPFILE
    $TMPOUTPUT
    rm $TMPFILE $TMPOUTPUT
    #================================
    echo "Haskell:"
    ghci -e 'print "Hello World!"'
    #================================
    echo "Awk:"
    echo '' |awk '{ print "Hello World!" }'
    #================================
    echo "Fortran77:"
    TMPFILE="/tmp/stupidFortran.f"
    TMPOUTPUT="/tmp/stupidFortran"
    touch $TMPFILE
    #http://www.roesler-ac.de/wolfram/hello.htm#Fortran77
    cat > $TMPFILE << EOF
    C Hello World in Fortran 77
    PROGRAM HELLO
    PRINT*, 'Hello World!'
    END
    EOF
    f77 -o $TMPOUTPUT $TMPFILE
    $TMPOUTPUT
    rm $TMPFILE $TMPOUTPUT
    #=======================================
    echo "Tcl:"
    tclsh << EOF
    puts "Hello World!"
    EOF
    #=======================================
    echo "Octave:"
    octave -q << EOF
    printf("Hello World!\n");
    EOF

    Posted in Linux, Python, coding, humor, javascript | 6 Comments

    « Previous Entries

     
    Add to Technorati Favorites - Creative Commons License - © 2007 Karl Norby