Почему строке или числу нельзя изменить значение?
net.bindIp
Type: string
Default: All interfaces. .. versionchanged:: 2.6.0 The deb and rpm packages include a default configuration file that sets {{role}} to 127.0.0.1.
Specifies the IP address that mongos or mongod binds to in order to listen for connections from applications. You may attach mongos or mongod to any interface. When attaching mongos or mongod to a publicly accessible interface, ensure that you have implemented proper authentication and firewall restrictions to protect the integrity of your database.
To bind to multiple IP addresses, enter a list of comma separated values.
Лень тратить много времени на поиск продукта с помощью которого она была упакована
library.zip <--- тут лежат питоновские библиотеки
писать playbook-и, роли
Playbooks are expressed in YAML format (see YAML Syntax) and have a minimum of syntax, which intentionally tries to not be a programming language or script, but rather a model of a configuration or a process.
работать с API
D:\MongoDB>mongo --verbose
MongoDB shell version: 2.6.3
...
> db.test.insert({_id:1, key1:"value1"})
WriteResult({ "nInserted" : 1 })
> db.test.update({_id:1}, {$set:{key1:"value1"}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 0 })
> db.test.update({_id:1}, {$set:{key1:"value2"}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
var
out: TFileStream;
in: TMemoryStream;
i: Integer;
begin
in := TMemoryStream.Create;
out := TFileStream.Create(...);
try
for i := 0 to files_count - 1 do begin
in.Clear;
in.LoadFromFile(....);
out.WriteBuffer(in.Memory^, in.Size);
end;
finally
in.Free;
out.Free;
end;
end;
Считаю, что Pascal я уже познал.
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> a = [10, 15]
>>> b = a
>>> b[0] = 25
>>> b
[25, 15]
>>> a
[25, 15]
>>>
#!/usr/bin/python
# -*- coding: utf-8 -*-
import osr
import gdal
import numpy
from PIL import Image
from StringIO import StringIO
def reproject_vrt(src_epsg, src_gt, src_size, dst_epsg):
src_proj = osr.SpatialReference()
src_proj.ImportFromEPSG(src_epsg)
driver = gdal.GetDriverByName('VRT')
src_ds = driver.Create('', src_size[0], src_size[1])
src_ds.SetGeoTransform(src_gt)
src_ds.SetProjection(src_proj.ExportToWkt())
dst_proj = osr.SpatialReference()
dst_proj.ImportFromEPSG(dst_epsg)
dst_ds = gdal.AutoCreateWarpedVRT(
src_ds,
src_proj.ExportToWkt(),
dst_proj.ExportToWkt())
return dst_ds.GetGeoTransform(), dst_ds.RasterXSize, dst_ds.RasterYSize
def reproject_band(band, src_epsg, src_gt, dst_epsg, dst_gt, dst_width, dst_height):
src_height, src_width = band.shape
driver = gdal.GetDriverByName('MEM')
src_ds = driver.Create('', src_width, src_height)
src_ds.GetRasterBand(1).WriteArray(band)
src_proj = osr.SpatialReference()
src_proj.ImportFromEPSG(src_epsg)
src_ds.SetGeoTransform(src_gt)
src_ds.SetProjection(src_proj.ExportToWkt())
dst_ds = driver.Create('', dst_width, dst_height)
dst_proj = osr.SpatialReference()
dst_proj.ImportFromEPSG(dst_epsg)
dst_ds.SetGeoTransform(dst_gt)
dst_ds.SetProjection(dst_proj.ExportToWkt())
gdal.ReprojectImage(src_ds, dst_ds, None, None, gdal.GRA_Bilinear)
return dst_ds.ReadAsArray()
def reproject_raster(raster, src_epsg, src_gt, dst_epsg):
src_img = Image.open(StringIO(raster))
dst_gt, dst_width, dst_height = reproject_vrt(src_epsg, src_gt, src_img.size, dst_epsg)
src_array = numpy.array(src_img)
if src_array.ndim == 3:
dst_array_shape = (dst_height, dst_width, src_array.shape[2])
dst_array = numpy.zeros(dst_array_shape, src_array.dtype)
for i in range(0, src_array.shape[2]):
band = src_array[:, :, i]
band = reproject_band(band, src_epsg, src_gt, dst_epsg, dst_gt, dst_width, dst_height)
dst_array[:, :, i] = band
elif src_array.ndim == 2:
dst_array = reproject_band(src_array, src_epsg, src_gt, dst_epsg, dst_gt, dst_width, dst_height)
else:
raise Exception('Unexpected array geometry!')
dst_img = Image.frombytes(src_img.mode, (dst_width, dst_height), dst_array.data)
raster = StringIO()
dst_img.save(raster, format=src_img.format)
return raster.getvalue()