Как я могу увидеть изменения в приложении c #, запущенном в Docker-контейнере?

Swift 3

В Swift 3 есть addingPercentEncoding

var originalString = "test/test"
var escapedString = originalString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)
print(escapedString!)

Выход:

test% 2Ftest

< / blockquote>

Swift 1

В iOS 7 и выше есть stringByAddingPercentEncodingWithAllowedCharacters

var originalString = "test/test"
var escapedString = originalString.stringByAddingPercentEncodingWithAllowedCharacters(.URLHostAllowedCharacterSet())
println("escapedString: \(escapedString)")

Выход:

test% 2Ftest

Следующие полезные (инвертированные) наборы символов:

URLFragmentAllowedCharacterSet  "#%<>[\]^`{|}
URLHostAllowedCharacterSet      "#%/<>?@\^`{|}
URLPasswordAllowedCharacterSet  "#%/:<>?@[\]^`{|}
URLPathAllowedCharacterSet      "#%;<>?[\]^`{|}
URLQueryAllowedCharacterSet     "#%<>[\]^`{|}
URLUserAllowedCharacterSet      "#%/:<>?@[\]^`

Если вы хотите, чтобы другой набор символов был экранирован, создайте набор: Пример с добавлением " = "character:

var originalString = "test/test=42"
var customAllowedSet =  NSCharacterSet(charactersInString:"=\"#%/<>?@\\^`{|}").invertedSet
var escapedString = originalString.stringByAddingPercentEncodingWithAllowedCharacters(customAllowedSet)
println("escapedString: \(escapedString)")

Выход:

test% 2Ftest% 3D42

Пример проверки символов ascii не в set:

func printCharactersInSet(set: NSCharacterSet) {
    var characters = ""
    let iSet = set.invertedSet
    for i: UInt32 in 32..<127 {
        let c = Character(UnicodeScalar(i))
        if iSet.longCharacterIsMember(i) {
            characters = characters + String(c)
        }
    }
    print("characters not in set: \'\(characters)\'")
}
1
задан user2017341 16 January 2019 в 16:05
поделиться

1 ответ

Вы должны перестроить свой контейнер

docker-compose up –d --build

Вы можете перестроить определенные контейнеры в docker-compose, как показано ниже

docker-compose up –d --build service_name_1 service_name_2

из этого источника https: //docs.docker .com / compose / reference / build /

docker-compose build
Estimated reading time: 1 minute

Usage: build [options] [--build-arg key=val...] [SERVICE...]

Options:
    --compress              Compress the build context using gzip.
    --force-rm              Always remove intermediate containers.
    --no-cache              Do not use cache when building the image.
    --pull                  Always attempt to pull a newer version of the image.
    -m, --memory MEM        Sets memory limit for the build container.
    --build-arg key=val     Set build-time variables for services.
    --parallel              Build images in parallel.

Services are built once and then tagged, by default as project_service. For example, composetest_db. If the Compose file specifies an image name, the image is tagged with that name, substituting any variables beforehand. See variable substitution.

If you change a service’s Dockerfile or the contents of its build directory, run docker-compose build to rebuild it.
0
ответ дан frankegoesdown 16 January 2019 в 16:05
поделиться
Другие вопросы по тегам:

Похожие вопросы: