Pages: 1 2 3 4 5 >>

Saturday, June 6th, 2009

i love jquery

Categories: Computers, Work, Website

this is the beginning of a beautiful relationship!

permalink 1:31am by Brandon //comment 396 views

Sunday, April 19th, 2009

ugh!

Categories: Computers, Website

This advertisement is ultra tricky.

ad

First of all, it's not blocked by adblock plus. Secondly, it's extremely deceptive to put my friends and my pictures in the ads. It made me think it was really an IQ challenge, because it actually was from some of my smarter friends. Lame lame lame facebook API. You shouldn't allow people to use you like that.

permalink 12:55am by Brandon //comment 690 views

Monday, April 6th, 2009

I Want My Django Path

Categories: Computers

I use Windows XP at work, and various Linux distributions at home. I started using Django at work, so I got accustomed to finding django in

C:\Python25\Lib\site-packages\django\

Now I recently started using git a lot, so I could do work from home without having to email zipped up files that make an application. Another thing to help keep my development environments extremely similar, I have a module called 'apps' where I keep frequently used 3rd party apps, like Eric's seamlessly put together django-pagination app. So in switching to Linux and finally getting my act together with using my non Windows boxes, I realize, I can't find django. First, in both Debian and Ubuntu when you install django with apt, it makes django-admin without the .py at the end. pretty confusing for Linux newbies.

Anyway, I finally located django in this path:

/var/lib/python-support/python2.5/django/

Can you see where I would be confused? Anyway, I threw this into the init.py within that django directory.

def get_path():
    import os
    return os.path.dirname( os.path.realpath( file ) )

Now since apt-get install python-django put all the right paths in all the right places, and everything points to where it needs to be, all you have to do to know where to explore django is open up a python terminal and type three easy lines.

brandon@dell:$ python
Python 2.5.2 (r252:60911, Jan  4 2009, 17:40:26) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.get_path()
'/var/lib/python-support/python2.5/django'
>>> 

I'm going to submit this to django at some point, but maybe someone can comment on this if there is a totally obvious way to find out the path to django modules that I don't know about already.

edit: After testing this in Windows, I see that it can only be used as a visual aid (which was the main purpose behind it anyway), because it imports the path with the escape characters '\\' instead of a single '\'

I am certain you can edit the script to join on the path separator, but I want to go to bed. I will update this script to work in BOTH OS (I have no way to test a Mac, but assume it works correctly as it would in Linux).

permalink 1:16am by Brandon //comment 363 views

Wednesday, April 1st, 2009

Thank you Linux Mint!!!

Categories: Life

I have a wireless card with an atheros chipset; therefore, connecting to wireless with Linux distributions can be a super pain in the ears (ears was the suggested spelling in Firefox when I typed 'arse,' and I thought ears was more funny).

however...

tonight, for the first time, I have been able to connect to wifi with WPA2 encryption using a Linux distribution. Before now, I was able to get fedora, ubuntu, puppy, eeZos, debian, and xubuntu to connect to wireless, but without encryption (and even some of them had WEP). My wireless network uses WPA2, so I was never satisfied with any of the distributions.

Tonight I completed an installation on my laptop of Linux which connected exactly the way I wanted it. All this time I've been searching for answers, and finally they have come. Linux Mint!

Linux Mint has two simple steps to get your Atheros Chipset Wireless Cards working on your Lenovo ThinkPads (there have been reports of some Atheros Chipset Wireless Cards on other computers, but not on Lenovo ThinkPads).

the two steps are as follows:

#go to windows wireless drivers
menu->administration->windows wireless drivers #(all the way at the bottom)

#next click +Install New Driver
#browse to location
/usr/lib/linuxmint/mintWifi/drivers/i386/Atheros_* (or your driver here)

Not only that, but I have put this all onto a USB pen drive. There are multiple bonuses here:

  1. No matter what computer I am using, all of my settings will be the same.
  2. I can use linux at work without having to change any of my work computers.
  3. The dorkness meter is through the roof.

the above actually assumes that any computer that I use is able to boot from USB, but in theory, if it doesn't have a usb port, it likely has a floppy drive, so you could make a boot floppy to find the usb drive. there goes that dork meter again.

I was able to put the entire distribution, plus WINE and django and a couple other applications on a 2gb kingston usb drive, so being greedy, I sprung for an 8gb sandisk usb drive (a whopping $19.97--and you KNOW you can get them dirt cheap online). mind you linux mint already comes with open office (an entire suite of ms office replacement tools--as if anyone reading this wouldn't know that already), the GIMP, Thunderbird, Firefox, Python, and a multitude of other programs.

So much power. So little space.

Anyway I hope that works for anyone at all. If you are helped, let me know. I'm curious as to whether or not I should do more of these types of posts, or if everyone already knows this and I'm just the shop kid. Either way, I'm so giddy right now. I'm going to restart and make absolutely sure this newest distribution will be persistent, so i can spend all night updating and configuring.

permalink 11:55pm by Brandon //1 comment 368 views

Tuesday, March 31st, 2009

Fire Up Firefox

Categories: Computers, Work, Website

How many web developers are using FireFox and still writing apps that have to look good in IE? Almost all of you?! WHAT? This has to stop. Companies, when will you see that FireFox is the answer. Keep your employees organized and on task with tabbed browsing (screw IE 7 and 8).

Also, save your developers time so they don't have to design their apps multiple times. While I'm designing, if I go too long without checking how it looks in Internet Explorer, I have to retrace my footsteps to find out where the mysterious IE bugs are. Let's just write in standards compliant mode, and use standards compliant browsers!

please everyone visit this site whether you use firefox or not:
FireFox Tips

Also, if you are NOT a firefox user, get with it and go here:
Get FireFox

Thanks for listening.

permalink 2:44am by Brandon //comment 201 views

Tuesday, March 17th, 2009

HTML colors

Categories: Computers, Work

I know I could always just go to the Complete HTML True Color Chart which comes up when you feel lucky with the search term HTML Colors, but I was just playing with some loops in Python and made this short script.

html = open('colors.html','w')

html.write("<html><body><table style='width:100%;'>\n")

colors = ['00','33','66','99','cc','ff']

for r in colors:
	for g in colors:
		html.write("<tr>")
		for b in colors:
			html.write("<td style='background-color:#%s%s%s;'><span style='color:#%s%s%s;'>#%s%s%s</span></td>" % (r,g,b,r,g,b,r,g,b))
		html.write("</tr>")

html.write("</table></body></html>")
html.close()

If you put that in a text file called makecolors.py and then run it (assuming of course that you have python installed), you will get an html file with all the colors (browser safe). The reason I made the text the same color as the background is I specifically wanted to see the colors alone. Then I can just double click a cell and see what HTML color it is (or triple click if I want to get the '#' for easy copy and paste).

permalink 2:18pm by Brandon //comment 363 views

Monday, February 23rd, 2009

M2Crypto FTPS

Categories: Computers, Work

I have been trying a ton to find something about FTPS with python. I desperately need to automate a process that I have to manually do twice daily, and at very inconvenient hours. I finally came up with this:

from M2Crypto import ftpslib

def handleDownload(block):
    file.write(block)
    print ".",

f = ftpslib.FTP_TLS()
f.connect('ftp.server.com',21)
f.login('testaccount', 'testaccount')
f.auth_tls()
f.set_pasv(0)
file = open('localfile.txt', 'wb')
f.retrbinary('RETR test.txt', handleDownload)
file.close()
f.quit()

I'm not positive how secure it actually is, but it seems to me that M2Crypto should hold it's ground, since every internet search regarding FTPS with Python returns something about M2Crypto.

permalink 9:10pm by Brandon //comment 454 views

1 2 3 4 5 >>


©2009 by Brandon Contact design by brandonh

Credits: blogsoft | MySQL hosting | blog ads