original post http://vasnake.blogspot.com/2012/10/blog-post_31.html
Tools
Записки программиста, обо всем и ни о чем. Но, наверное, больше профессионального.
2012-10-31
Микробы
original post http://vasnake.blogspot.com/2012/10/blog-post_31.html
Posted by Valentin at 16:56 0 comments
Labels: Book
2012-10-30
XMPP bot
original post http://vasnake.blogspot.com/2012/10/xmpp-bot.html
Posted by Valentin at 19:14 0 comments
Labels: im, programming, python
2012-10-29
Великие свершения
Posted by Valentin at 18:42 0 comments
Labels: Book
2012-10-26
Webplatform
Posted by Valentin at 14:51 0 comments
Labels: web-develop
2012-10-25
Энергетика
Posted by Valentin at 23:28 0 comments
Labels: citation
2012-10-24
JPype
import jpype jpype.startJVM(jpype.getDefaultJVMPath()) # you can then access to the basic java functions jpype.java.lang.System.out.println("hello world") # and you have to shutdown the VM at the end jpype.shutdownJVM()
import jpype # start the JVM with the good classpaths classpath = "dist/boilerpipe-1.1-dev.jar:lib/nekohtml-1.9.13.jar:lib/xerces-2.9.1.jar" jpype.startJVM(jpype.getDefaultJVMPath(), "-Djava.class.path=%s" % classpath) # get the Java classes we want to use DefaultExtractor = jpype.JPackage("de").l3s.boilerpipe.extractors.DefaultExtractor # call them ! print DefaultExtractor.INSTANCE.getText(jpype.java.net.URL("http://blog.notmyidea.org"))
Posted by Valentin at 16:54 0 comments
2012-10-23
IPython
original post http://vasnake.blogspot.com/2012/10/ipython.html
Posted by Valentin at 17:23 0 comments
Labels: python
XMPP
Posted by Valentin at 01:58 0 comments
Labels: im, programming, python
2012-10-19
Tornado
StaticFileHandler
загружает
весь файл целиком в память
перед тем как отдать его клиенту
(пруфлинк).
Помимо этого, занятая память не
освобождается, если клиент разорвал
подключение не скачав весь файл целиком.original post http://vasnake.blogspot.com/2012/10/tornado.html
Posted by Valentin at 16:49 0 comments
Labels: hiload, python, web-develop
2012-10-18
Очередная практика
Соседняя очередь всегда быстрее
http://gexxx.livejournal.com/771878.html
http://otecsergiy.livejournal.com/538505.html
Это была практика очередей.
А это теория очередей.
original post http://vasnake.blogspot.com/2012/10/blog-post_18.html
Posted by Valentin at 22:46 0 comments
2012-10-17
My own cloud
Posted by Valentin at 18:12 0 comments
Labels: DBMS, opensource, web-develop
2012-10-16
Кино снимать это вам не мешки ворочать
original post http://vasnake.blogspot.com/2012/10/blog-post_16.html
Posted by Valentin at 21:58 2 comments
Labels: 3D, opensource, video
2012-10-15
Reverse SSH Tunnels
Posted by Valentin at 18:20 0 comments
2012-10-12
SQL queries using ArcSDE
import arcpy sdeConn = arcpy.ArcSDESQLExecute("data\Connection to GPSERVER3.sde") sdeReturn = sdeConn.execute(sql) if isinstance(sdeReturn, list): for row in sdeReturn: print row else: if sdeReturn == True: print "SQL statement: " + sql + " ran sucessfully." else: print "SQL statement: " + sql + " FAILED." |
sdeReturn = sdeConn.execute(sql) log.info("arcpyStuff, ora result '%s', resType '%s'" % (sdeReturn, type(sdeReturn).__name__)) if isinstance(sdeReturn, str) or type(sdeReturn) == unicode: log.info("arcpyStuff, ora return string '%s'" % (sdeReturn.strip())) elif isinstance(sdeReturn, list): log.info("arcpyStuff, ora return %s rows" % (len(sdeReturn))) for row in sdeReturn: log.info("arcpyStuff, row '%s'" % (row)) else: if sdeReturn == True: # DDL? log.info("arcpyStuff, sql statement ran successfully") else: log.info("arcpyStuff, error, sql statement FAILED or resType is unknown") |
original post http://vasnake.blogspot.com/2012/10/sql-queries-using-arcsde.html
Posted by Valentin at 17:44 0 comments
Labels: ArcGIS, development, Oracle, python, SQL
2012-10-11
Нету, нету интернету
original post http://vasnake.blogspot.com/2012/10/blog-post_11.html
Posted by Valentin at 23:07 0 comments
2012-10-10
spatialReference
- Где я нахожусь?
- В корзине воздушного шара.
private void evtDrawComplete(object sender, DrawEventArgs e) { currGeom = e.Geometry; draw.DrawMode = DrawMode.None; draw.IsEnabled = false; try { var gl = getRLLayer(); var graphic = new ESRI.ArcGIS.Client.Graphic() { Geometry = currGeom, Symbol = polySymbol }; gl.Graphics.Add(graphic); var geometryService = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/"+ "Geometry/GeometryServer"); var graphicList = new List<Graphic>(); graphicList.Add(graphic); geometryService.SimplifyCompleted += (sndr, args) => { gl.Graphics.Remove(graphic); graphic.Geometry = args.Results[0].Geometry; gl.Graphics.Add(graphic); askGeoprocessor(graphic.Geometry); // send good polygon to geoprocessor }; geometryService.Failed += (sndr, args) => { MessageBox.Show("Сбой нормализации полигона: " + args.Error); }; geometryService.SimplifyAsync(graphicList); } catch(Exception ex) { string msg = string.Format("Сбой отправки запроса: \n [{0}]", ex.Message); MessageBox.Show(msg); } } |
inputPolygon={ "geometryType":"esriGeometryPolygon", "spatialReference":{"wkid":102100}, "features":[{ "geometry":{ "spatialReference":{"wkid":102100}, "rings":[[[7592337.47835702,9803507.48815798],[7924991.42545401,10312272.348424],[8277213.25179201,9979618.40132698],[7592337.47835702,9803507.48815798]]] }, "attributes":{} }]} |
import arcpy from arcpy import env fsetObj = arcpy.GetParameter(0) fsetDesc = arcpy.Describe(fsetObj) if hasattr(fsetDesc, 'spatialReference'): log.info("arcpyStuff, input fset spatialReference '%s'" % fsetDesc.spatialReference) # haven't WKID = 4326 # WGS-1984 http://anothergisblog.blogspot.com/2011/05/spatial-reference-class.html sr = arcpy.SpatialReference() sr.factoryCode = WKID sr.create() # env.outputCoordinateSystem = sr # или возьмем spatialreference из заранее подготовленного featureclass gdbPath = r'''\\cache\MXD\seismo\Seis_button.gdb''' seisFCName = r'''APP_GP_SEISM2D_L''' seisDesc = arcpy.Describe(os.path.join(gdbPath, seisFCName)) log.info("arcpyStuff, seismoprofiles WKID '%s'" % (seisDesc.spatialReference.factoryCode)) rows = arcpy.SearchCursor(fsetObj, '', sr) # decimal degree # rows = arcpy.SearchCursor(fsetObj, '', seisDesc.spatialReference) # meters for row in rows: geom = row.shape log.info("arcpyStuff searchcursor, geometry geojson '%s'" % (geom.__geo_interface__)) # {'type': 'Polygon', 'coordinates': []} if hasattr(geom, 'spatialReference'): log.info("arcpyStuff searchcursor, geometry spatialReference '%s'" % (geom.spatialReference)) # haven't if geom.partCount <= 0 or geom.area <=0: raise NameError("Wrong input polygon, you should send no selfintersected clockwise drawed single ring") for part in geom: log.info("arcpyStuff searchcursor, geometry part, len '%s'" % (len(part))) for pnt in part: log.info("arcpyStuff searchcursor, point x '%s', y '%s'" % (pnt.X, pnt.Y)) |
rows = arcpy.SearchCursor(fsetObj, '', sr) # decimal degree
WKID = 102100 geometry geojson '{'type': 'Polygon', 'coordinates': [[(7924991.4255000018, 10390543.865400001), (8257645.3726000004, 9803507.4882000014), (7631473.2368000001, 9901346.8844000027), (7924991.4255000018, 10390543.865400001)]]}'
WKID = 4326 geometry geojson '{'type': 'Polygon', 'coordinates': [[(71.191409240428044, 67.809244466732096), (74.17969049045422, 65.730626450487776), (68.554690489665163, 66.089364228422752), (71.191409240428044, 67.809244466732096)]]}'
original post http://vasnake.blogspot.com/2012/10/spatialreference.html
Posted by Valentin at 19:00 0 comments
Labels: ArcGIS, development, python
2012-10-09
Колбасой вниз
import arcpy fsetObj = arcpy.GetParameter(0) log.info("arcpyStuff, input polygons obj '%s'" % (fsetObj)) # geoprocessing record set object (FeatureSet) rows = arcpy.SearchCursor(fsetObj) for row in rows: geom = row.shape log.info("arcpyStuff searchcursor, geometry type '%s', area '%s', parts '%s'" % (geom.type, geom.area, geom.partCount)) log.info("arcpyStuff searchcursor, geometry geojson '%s'" % (geom.__geo_interface__)) for part in geom: for pnt in part: log.info("arcpyStuff searchcursor, point x '%s', y '%s'" % (pnt.X, pnt.Y)) |
arcpyStuff, input polygons obj '<geoprocessing record set object object at 0x0B88D320>' arcpyStuff searchcursor, geometry type 'polygon', area '162541855691.0', parts '1' arcpyStuff searchcursor, geometry geojson '{'type': 'Polygon', 'coordinates': [[(7631473.2368000001, 9783939.6089000031), (7807584.1499999985, 10370975.986100003), (8238077.4932999983, 9960050.5221000016), (7631473.2368000001, 9783939.6089000031)]]}' arcpyStuff searchcursor, point x '7631473.2368', y '9783939.6089' arcpyStuff searchcursor, point x '7807584.15', y '10370975.9861' arcpyStuff searchcursor, point x '8238077.4933', y '9960050.5221' arcpyStuff searchcursor, point x '7631473.2368', y '9783939.6089' |
arcpyStuff, input polygons obj '<geoprocessing record set object object at 0x0B88D1A0>' arcpyStuff searchcursor, geometry type 'polygon', area '-124443116821.0', parts '0' arcpyStuff searchcursor, geometry geojson '{'type': 'Polygon', 'coordinates': []}' |
inputPolygon={ "geometryType":"esriGeometryPolygon", "spatialReference":{"wkid":102100}, "features":[{ "geometry":{ "spatialReference":{"wkid":102100}, "rings":[[[7592337.47835702,9803507.48815798],[7924991.42545401,10312272.348424],[8277213.25179201,9979618.40132698],[7592337.47835702,9803507.48815798]]] }, "attributes":{} }]} |
inputPolygon={ "geometryType" : "esriGeometryPolygon", "spatialReference" : {"wkid" : 4326}, "fields": [ { "name": "Name", "type": "esriFieldTypeString", "alias": "Name" } ], "features" : [{ "geometry" : { "rings" : [[ [-97.06326,32.759], [-97.06298,32.755], [-97.06153,32.749], [-97.06326,32.759] ]], "spatialReference" : {"wkid" : 4326} }, "attributes" : {"Name" : "Feature 1"} }]} |
original post http://vasnake.blogspot.com/2012/10/blog-post_9.html
Posted by Valentin at 18:29 2 comments
Labels: ArcGIS, development, python
2012-10-08
Выйти из окружения
import logging logFilename = '//cache/MXD/seismo/seismodensity.geoproc.log' log = logging.getLogger('seismodens') # http://docs.python.org/library/logging.html def setLogger(log): log.setLevel(logging.DEBUG) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') if not hasattr(log, 'vFHandle'): fh = logging.FileHandler(logFilename) fh.setLevel(logging.DEBUG) fh.setFormatter(formatter) log.addHandler(fh) log.vFHandle = fh print 'Log configured. Look file [%s] for messages' % logFilename def main(note=''): setLogger(log) log.info('start, argv: %s, note "%s"' % (argv, note)) import arcpy try: arcpyStuff() except Exception, e: arcpy.AddError(e) if type(e).__name__ == 'COMError': log.error('main, COM error, msg [%s]' % e) else: log.exception('main program failed') raise finally: log.info('logging shutdown') logging.shutdown() if __name__ == "__main__": try: main() except Exception, e: if type(e).__name__ == 'COMError': print 'COM error, msg [%s]' % e else: print 'Error, program failed:' traceback.print_exc(file=sys.stderr) |
if not hasattr(log, 'vFHandle'):
original post http://vasnake.blogspot.com/2012/10/blog-post_8.html
Posted by Valentin at 20:13 0 comments
Labels: ArcGIS, development, python
2012-10-05
Доверие и требовательность
Posted by Valentin at 17:43 0 comments
Labels: development, howto
2012-10-04
Ликбез
original post http://vasnake.blogspot.com/2012/10/blog-post_4.html
Posted by Valentin at 18:40 5 comments
Labels: web-develop
2012-10-03
Лучше знать, чем нет
Posted by Valentin at 16:42 0 comments
Labels: health
2012-10-02
Религиозность
original post http://vasnake.blogspot.com/2012/10/blog-post_2.html
Posted by Valentin at 15:28 0 comments
2012-10-01
Есть что почитать
original post http://vasnake.blogspot.com/2012/10/blog-post.html
Posted by Valentin at 18:26 0 comments
Архив блога
-
▼
2012
(275)
-
▼
октября
(23)
- Микробы
- XMPP bot
- Великие свершения
- Webplatform
- Энергетика
- JPype
- IPython
- XMPP
- Tornado
- Очередная практика
- My own cloud
- Кино снимать это вам не мешки ворочать
- Reverse SSH Tunnels
- SQL queries using ArcSDE
- Нету, нету интернету
- spatialReference
- Колбасой вниз
- Выйти из окружения
- Доверие и требовательность
- Ликбез
- Лучше знать, чем нет
- Религиозность
- Есть что почитать
-
▼
октября
(23)