Sep 262012
 

If you are running a transparent HTTP proxy on your network, you may have trouble with running Internet Recovery and Apple Hardware Test on Macs that support it.  You’ll see a “-4403D” or “-4403F” error.  For some reason, Apple’s servers return a 403 when they see the “via” header that many proxy servers send.  Here’s the configuration I used in Squid to turn off that header.  I also disabled the “forwarded-for” header – essentially, this makes it impossible for servers to determine that the request is coming through a proxy server:

# Be more anonymous
forwarded_for transparent
via off
visible_hostname proxy.local
httpd_suppress_version_string on
Aug 112012
 

I’ve been trying to install Mountain Lion in as a guest in Parallels 7, and I kept getting stuck at the initial grey Apple logo.

To fix it, I just changed the number of CPUs to 2, and it booted right up.  Other documents I’ve seen have indicated that you need to increase the video memory.  I did not need to do that, but it would probably help with performance.

Aug 032012
 

 

Eclipse Juno looks terrible in Linux Mint 13 with the MATE desktop environment. Here’s an example of part of the screen:

Everything is big and bulky, the tool bar’s style doesn’t really match the theme’s style.

Here are the steps I’ve taken so far to correct this:

  • Create a file called gtkrc, I’ve created one in my ~/eclipse directory:
    gtk-color-scheme = "selected_text_color:#000000"
    style "compact"
    {
      GtkButton::default_border={0,0,0,0}
      GtkButton::default_outside_border={0,0,0,0}
      GtkButtonBox::child_min_width=0
      GtkButtonBox::child_min_heigth=0
      GtkButtonBox::child_internal_pad_x=0
      GtkButtonBox::child_internal_pad_y=0
      GtkMenu::vertical-padding=1
      GtkMenuBar::internal_padding=1
      GtkMenuItem::horizontal_padding=4
      GtkToolbar::internal-padding=1
      GtkToolbar::space-size=1
      GtkOptionMenu::indicator_size=0
      GtkOptionMenu::indicator_spacing=0
      GtkPaned::handle_size=4
      GtkRange::trough_border=0
      GtkRange::stepper_spacing=0
      GtkScale::value_spacing=0
      GtkScrolledWindow::scrollbar_spacing=0
      GtkExpander::expander_size=10
      GtkExpander::expander_spacing=0
      GtkTreeView::vertical-separator=0
      GtkTreeView::horizontal-separator=0
      GtkTreeView::expander-size=12
      GtkTreeView::fixed-height-mode=TRUE 
      GtkWidget::focus_padding=0 
      font_name="Liberation Sans,Sans Regular 8"
      text[SELECTED] = @selected_text_color
    }
    class "GtkWidget" style "compact"
    style "compact2"
    {
      xthickness=1
      ythickness=1
    }
    class "GtkButton" style "compact2"
    class "GtkToolbar" style "compact2"
    class "GtkPaned" style "compact2"
  • Next, in Eclipse, go to Window -> Preferences -> General -> Appearance, and under Theme, make sure GTK is selected.
  • Run eclipse like this:
    GTK2_RC_FILES=$GTK2_RC_FILES:~/eclipse/gtkrc ~/eclipse/eclipse

This ought to improve it a bit:

More to come as I figure out how to further improve this.

References:

http://xmemory.tompium.com/2012/01/make-eclipse-look-better-on-ubuntu.html

 

 

May 252012
 

I can’t believe it’s taken me this long to learn this: Python’s default argument values are only evaluated once during runtime. I’ve never encountered this before because I don’t use default arguments very often, and when I do, it’s often to set something to a static value.

Today, I encountered a function definition where I wanted to default an argument to the current date/time:

def do_something(self, entry, date_time = datetime.datetime.now()):

Every time I ran the function, the value of date_time was the same: Whatever the date/time was when the method first ran. So, instead, I did something like this:

def do_something(self, entry, date_time = None):
    if date_time is None:
        date_time = datetime.datetime.now()

This is actually mentioned in the Python documentation.

May 252012
 

Install Visual Studio 2008 SP1 Express Edition.

Go to the command prompt.

First, I had to set the following variable:

C:\>set VS90COMNTOOLS=C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\

Note the trailing backslash – that needs to be there. The value must also NOT be in quotes.

C:\>cd "\Program Files\Microsoft Visual Studio 9.0\vc\bin"
C:\Program Files\Microsoft Visual Studio 9.0\VC\bin>vcvars32
Setting environment for using Microsoft Visual Studio 2008 x86 tools.

Then, from your PyCrypto directory, run:

python setup.py install

And it should install with no problem.