topics:  main-page   everything   99things   things-to-do   software   space   future   exercise & health   faith  
  thought   web   movies+TV   music   mymusic   food   curiosity   tidbits   I remember   wishlist   misc   links

This section lists all blog posts, regardless of topic.

Vimscript: How to URL Encode a String
January 25, 2017

" URL encode a string. ie. Percent-encode characters as necessary.
function! UrlEncode(string)

    let result = ""

    let characters = split(a:string, '.\zs')
    for character in characters
        if character == " "
            let result = result . "+"
        elseif CharacterRequiresUrlEncoding(character)
            let i = 0
            while i < strlen(character)
                let byte = strpart(character, i, 1)
                let decimal = char2nr(byte)
                let result = result . "%" . printf("%02x", decimal)
                let i += 1
            let result = result . character

    return result


" Returns 1 if the given character should be percent-encoded in a URL encoded
" string.
function! CharacterRequiresUrlEncoding(character)

    let ascii_code = char2nr(a:character)
    if ascii_code >= 48 && ascii_code <= 57
        return 0
    elseif ascii_code >= 65 && ascii_code <= 90
        return 0
    elseif ascii_code >= 97 && ascii_code <= 122
        return 0
    elseif a:character == "-" || a:character == "_" || a:character == "." || a:character == "~"
        return 0

    return 1


Search terms:

url encoding a string in vimscript
url encoding a string in vim
url encoding a string in vi
url encode a string in vimscript
url encode a string in vim
url encoding data in vimscript
url encoding data in vim
url encoding data in vi
vimscript: url encode
vim: url encode
vi: url encode

Draw Giraffe, See a Movie
October 8, 2016

It struck me today as I was drawing giraffes with 4 year old Hazel that within a few years it should be possible for a child to draw an animal, whether it be a giraffe or a dog, and have the computer use that as a style blueprint.

It should then be able to take the pre-rendered model for a short movie involving that animal and use the stylized version of the animal when rendering a new cut of that movie.

It might also be possible for the child to give some direction about what should happen in the movie, such as the giraffe running from a lion and then escaping by jumping over a river, and have the movie include those components.

How far away are we from that? Could a compelling prototype be built within 10 years perhaps?

Graph-powered Machine Learning at Google
October 7, 2016

This looks very promising and fits very well with the way I tend to think about things.

older >>