SELECT id,
( 6371 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) )
AS distance
FROM markers
HAVING distance < 25 ORDER BY distance LIMIT 0 , 20;
Tools
Записки программиста, обо всем и ни о чем. Но, наверное, больше профессионального.
2013-11-29
loxodrome
Posted by
Valentin
at
12:30
0
comments
Labels: GIS
2013-11-28
Был JBoss Application Server, стал WildFly
Posted by
Valentin
at
12:30
0
comments
Labels: Java
2013-11-27
Nvidia GeForce 560
Posted by
Valentin
at
12:30
0
comments
2013-11-26
И так тоже бывает
Posted by
Valentin
at
12:30
2
comments
Labels: бытовуха, купи/продай
2013-11-25
Idiocracy
Posted by
Valentin
at
12:30
0
comments
2013-11-22
Whole thing in memory
I decided to use Terracotta's BigMemory to hold the data in the "off-heap" and use its EHCache query capability to aggregate and fetch the data. Now despite the name, I used the cache "eternal" capabilities to forever hold the data elements.
Posted by
Valentin
at
12:30
0
comments
2013-11-21
Коды для управления переадресацией в GSM
Переадресация вызова при неответе в течение определённого времени: *#61# запросить текущие настройки у оператора ##61# отключить переадресацию **61*номер#через сколько секунд# включить переадресацию на указанный номер, если вызов не принят в течение указанного количества секунд (кратного 5, максимум 30) Переадресация вызова при недоступности абонента: *#62# запросить текущие настройки у оператора #62# отключить переадресацию **62*номер# включить переадресацию на указанный номер Переадресация вызова, если номер занят: *#67# запросить текущие настройки у оператора ##67# отключить переадресацию **67*номер# включить переадресацию на указанный номер Безусловная переадресация всех входящих вызовов: *#21# запросить текущие настройки у оператора ##21# отключить переадресацию **21*номер# включить переадресацию на указанный номер Отключить всю переадресацию: ##002# На самом деле, можно это всё ещё настраивать отдельно по типам входящих вызовов, еcли кто-то этим пользуется.. Для этого надо после команды (но до времени) вписать тип звонка: *11 – голосовые *13 – факс *25 – данные *89 – вторая линия Переадресация факсовых вызовов на номер 1234567 после 30 секунд неответа будет выглядеть так: **61*1234567*13*30# |
Posted by
Valentin
at
12:30
0
comments
Labels: telephony
2013-11-20
Patching
Posted by
Valentin
at
12:30
0
comments
Labels: python
2013-11-19
Multithreaded Python Tutorial
Posted by
Valentin
at
12:30
0
comments
Labels: python
2013-11-18
The Ashley Book of Knots
Posted by
Valentin
at
12:30
0
comments
Labels: Book
2013-11-15
Больше языков
Posted by
Valentin
at
12:30
0
comments
Labels: LISP
2013-11-14
Ремонт паруса
Posted by
Valentin
at
12:30
0
comments
Labels: windsurfing
2013-11-13
Фордак от Дашер
Posted by
Valentin
at
12:30
0
comments
Labels: windsurfing
2013-11-12
PCL
Posted by
Valentin
at
12:30
0
comments
Labels: LISP
2013-11-11
Фордак от Гая Крибба
Posted by
Valentin
at
12:30
0
comments
Labels: windsurfing
2013-11-08
Pro secrets. Start to finish 9/9
Posted by
Valentin
at
12:30
0
comments
Labels: windsurfing
2013-11-07
Pro secrets. Start to finish 8/9
Posted by
Valentin
at
12:30
0
comments
Labels: windsurfing
2013-11-06
Headless Selenium WebDriver
#!/usr/bin/env python
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://www.ubuntu.com/')
browser.save_screenshot('screenie.png')
browser.quit()
#!/usr/bin/env python
from pyvirtualdisplay import Display
from selenium import webdriver
display = Display(visible=0, size=(800, 600))
display.start()
# now Firefox will run in a virtual display.
# you will not see the browser.
browser = webdriver.Firefox()
browser.get('http://www.google.com')
print browser.title
browser.quit()
display.stop()
Posted by
Valentin
at
12:30
0
comments
Labels: python, web-browser
2013-11-05
ashx include
<%@ WebHandler Language="C#" Class="load" Debug="true" %>
using System;
using System.IO;
using System.Web;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.Web.Caching;
public class load: IHttpHandler {
// Override the ProcessRequest method.
public void ProcessRequest(HttpContext context) {
var saveid = String.Empty;
// only for GET method
saveid = context.Request.QueryString["map"];
var path =
VUtils.storeconfFromJson(
VUtils.loadConfig(
VUtils.storageConfigFilename(context))
).fileStoragePath;
var fname = String.Format(@"{1}/map.{0}.js", saveid, path);
context.Response.ContentType = "application/json";
context.Response.ContentEncoding = Encoding.UTF8;
context.Response.Write(string.Format("{{file: '{0}'}}", fname));
}
// Override the IsReusable property.
public bool IsReusable {
get { return false; }
}
}
using System;
using System.IO;
using System.Web;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.Web.Caching;
public class VUtils {
public class VStoreConfig {
public string fileStoragePath { get; set; }
}
public static string computeSHA1Hash(string val) {
if(val.Equals("")) { return ""; }
byte[] data = System.Text.Encoding.UTF8.GetBytes(val);
System.Security.Cryptography.SHA1 sha = new System.Security.Cryptography.SHA1Managed();
byte[] res = sha.ComputeHash(data);
return System.BitConverter.ToString(res).Replace("-", "").ToUpper();
}
public static string storageConfigFilename(HttpContext context) {
return context.Server.MapPath("~/store.config");
}
private static object _lockobject = new object();
public static string loadConfig(string fileName) {
string config = string.Empty;
lock(_lockobject) {
if(System.IO.File.Exists(fileName)) {
using(System.IO.StreamReader file = new System.IO.StreamReader(fileName)) {
config = file.ReadToEnd();
}
}
}
return config;
}
public static VStoreConfig storeconfFromJson(string confJson) {
var jss = new System.Web.Script.Serialization.JavaScriptSerializer();
var cnf = jss.Deserialize<VStoreConfig>(confJson);
return cnf;
}
}
<%@ WebHandler Language="C#" Class="load" Debug="true" CodeBehind="lib.cs" CompilerOptions="c:\Inetpub\wwwroot\miniportal\store\lib.cs" %>
...
public class load: IHttpHandler {
...
var path =
VUtils.storeconfFromJson(
VUtils.loadConfig(
VUtils.storageConfigFilename(context))
).fileStoragePath;
...
<%@ WebHandler Language="C#" Class="store" Debug="true" CodeBehind="lib.cs" CompilerOptions="c:\Inetpub\wwwroot\miniportal\store\lib.cs" %>
using System;
using System.IO;
using System.Web;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.Web.Caching;
public class store: IHttpHandler {
// Override the ProcessRequest method.
public void ProcessRequest(HttpContext context) {
var jsonString = String.Empty;
// only for POST method
jsonString = context.Request.Form["map"];
if(jsonString == null) { jsonString = ""; }
var hash = VUtils.computeSHA1Hash(jsonString);
var path =
VUtils.storeconfFromJson(
VUtils.loadConfig(
VUtils.storageConfigFilename(context))
).fileStoragePath;
var fname = String.Format(@"{1}/map.{0}.js", hash, path);
System.IO.File.WriteAllText(fname, jsonString);
context.Response.ContentType = "application/json";
context.Response.ContentEncoding = Encoding.UTF8;
context.Response.Write(string.Format("{{sha1: '{0}'}}", hash));
}
// Override the IsReusable property.
public bool IsReusable {
get { return false; }
}
}
Posted by
Valentin
at
12:30
0
comments
Labels: Microsoft, web-develop
2013-11-04
Pidgin
Posted by
Valentin
at
12:30
0
comments
Labels: im
2013-11-01
Лохуин
Posted by
Valentin
at
12:30
0
comments
Labels: gov.ru
Архив блога
-
▼
2013
(240)
-
▼
ноября
(21)
- loxodrome
- Был JBoss Application Server, стал WildFly
- Nvidia GeForce 560
- И так тоже бывает
- Idiocracy
- Whole thing in memory
- Коды для управления переадресацией в GSM
- Patching
- Multithreaded Python Tutorial
- The Ashley Book of Knots
- Больше языков
- Ремонт паруса
- Фордак от Дашер
- PCL
- Фордак от Гая Крибба
- Pro secrets. Start to finish 9/9
- Pro secrets. Start to finish 8/9
- Headless Selenium WebDriver
- ashx include
- Pidgin
- Лохуин
-
▼
ноября
(21)

