Thursday, February 16, 2012

Unofficial ArcGIS 10 OMD for Python

Posted today in the ArcGIS forums is the unofficial ArcPy OMD.

Check it out here.

Enjoy

Friday, February 10, 2012

Python Tip: Format number with comma

Here is a good little tip for the client that wants to see those commas in there numbers: (for python 2.6)

>>> import locale
>>> locale.setlocale(locale.LC_ALL,"")
'English_United States.1252'
>>> y = locale.format('%d',1239811,True)
>>> print y
1,239,811


Enjoy

Wednesday, February 1, 2012

Killing Python.exe Processes Fast and Easy

When performing multiprocessing or subprocessing, sometimes you need to kill that script, and fast.  You can use task manager to do this, but that's too many clicks.

There is a great window's program called taskkill.exe.  To do this process, you need to create a link.  Once you have the link, enter in the following command: 'C:\Windows\System32\taskkill.exe /F /IM python.exe /T'

All processes will end quickly.

Wednesday, January 18, 2012

STOP SOPA AND PIPA

If you haven't been living under a rock, you should know what SOPA and PIPA are, if you were check out https://www.google.com/landing/takeaction/sopa-pipa/

I encourage everyone to tell congress to stop it.

Tuesday, January 10, 2012

Tip - Faster Update Cursors

There are many ways to limit the number of fields an update cursor can update.  The cursor object itself has a where clause option.  Another way, which seems at first glance to be faster than just a where clause on the cursor, is to use a Layer object with a definition query defined on the Layer object, then reference the object instead of the feature class or feature layer itself.

import arcpy
from arcpy import mapping
fclayer = "fclayer"
arcpy.MakeFeatureLayer_management(source, fclayer)
layer = mapping.Layer(fclayer)
layer.definitionQuery = "UIDField = 'unique'"
uRows = arcpy.UpdateCursor(layer)
row = None
for row in uRows:
    row.URL = url
    uRows.updateRow(row)
del row
del uRows
del layer
del fclayer

For more information check out the help page here.

Enjoy

Tuesday, January 3, 2012

I heart my Nook Color and Nook Tablet

For over a year now, I have had the Nook Color, and I am very pleased with the e-reader, so this year I upped the game and bought the tablet version of Nook.  The OS and feel is exactly the same except the hardware inside is vastly improved.  It's quicker and more responsive than the Nook Color and can do more with the applications that can be put on it.  The biggest improvement I see with the tablet version of the Nook is the anti-glare screen.  I know this can be achieved by buying an anti-glare screen guard, but who wants that on the Nook.  I sure don't.

Anyway this wasn't for me, it was for my wife and she loves it.  All the Nook needs is a better selection of apps.  As an e-reader, this is number 1, and Barnes and Noble seems to have more and more e-books daily.

In addition to using the bn website to buy books, you can go to site like ManyBooks, or if you are a sci-fi junkie try the Baen free library.  The thing I really like about my Nook, is that I can use it at my local library as well!  I can just check out my e-book from anywhere as long as I have my library card.

The issue I really do not like about any tablet/reader is the virtual keyboard, but that's even an issue for the sacred iPad.