Valentin Strykalo at Aurora, March 2, 2013, video
I tried editing a short backstage clip from the soundcheck. I shot 10 minutes, but in the end cut everything down to one minute. Anton, our lighting designer, did a really cool light show at this concert.
Diablo Swing Orchestra at Aurora, February 23, 2013, video
The Diablo Swing Orchestra concert from Sweden at Aurora on February 23 was unexpectedly great. Based on the description «metal, operatic vocals, orchestral instruments», I expected some gloomy Scandinavian death metal with summoning Satan. But the band was a very pleasant surprise.
Something very strange happened with the sound, though. It recorded only into the left channel, so I had to fix it, although I checked the gear and everything seemed fine.
The Ghost Inside at Arktika, February 25, 2013, video
Today (well, already yesterday) I filmed The Ghost Inside from the States at Arktika. Surprisingly, the camera microphone held up. The sound on stage is of course completely different, but the result turned out dynamic.
Phuket Airport Schizophrenia
I got back from Thailand. On the way home I had to wait six hours at night at Phuket airport before check-in for my flight started. I was really counting on the Irish pub at the airport, but it turned out it was open only until 11 pm. As a result, everything at the airport was closed except the flight check-in counters. During those six hours I explored all three floors of the airport, shot some video, and even found a power outlet to recharge.
PHP script for building all views in CouchDB
I wrote this little script before New Year. It goes through all databases in CouchDB and builds all views one by one. Leaving it here.
<?php
set_time_limit( 0 );
// all dbs
$ch = prepareCurlResource();
curl_setopt( $ch, CURLOPT_URL, 'http://localhost:5984/_all_dbs' );
$data = curl_exec( $ch );
$dbs = json_decode( $data );
foreach ( $dbs as $db ) {
// skip _users and _replicator
if ( substr( $db, 0, 1 ) == '_' )
continue;
// getting all databases
$chCC = prepareCurlResource();
curl_setopt( $chCC, CURLOPT_URL, 'http://localhost:5984/' . $db . '/_all_docs?startkey="_design/"&endkey="_design0"&include_docs=true' );
$data = json_decode( curl_exec( $chCC ) );
if ( false === empty( $data->rows ) ) {
foreach( $data->rows as $design ) {
// creating views of design
if ( false === empty( $design->doc->views ) ) {
foreach( $design->doc->views as $viewName => $tmp ) {
echo 'Creating view: ' . $db . '/' . $design->id . '/_view/' . $viewName . "
";
$chCC = prepareCurlResource();
curl_setopt( $chCC, CURLOPT_URL, 'http://localhost:5984/' . $db . '/' . $design->id . '/_view/' . $viewName . '?limit=0' );
curl_exec( $chCC );
}
}
}
}
}
function prepareCurlResource() {
$ch = curl_init();
curl_setopt( $ch, CURLOPT_PORT, 5984 );
curl_setopt( $ch, CURLOPT_HEADER, false );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-type: application/json' ) );
return $ch;
}
2012 in review
The year was insane. Packed. With everything that follows from that.
Escaping image URLs with Russian filenames in Objective-C
Management at the office started uploading images with Russian filenames into news on the portal — things like Фото-Ресторана.jpg.
Images from news items are shown inside the app, so the app fetches them by these URLs.
The URL arrives in the app already percent-encoded, e.g.:
http://allcafe.ru/s/pic/news/!_2012/2012_12/%D0%A0%D0%B5%D1%81%D1%82%D0%BE%D1%80%D0%B0%D0%BD-Graf-in-%D0%A1%D0%B0%D0%BD%D0%BA%D1%82-%D0%9F%D0%B5%D1%82%D0%B5%D1%80%D0%B1%D1%83%D1%80%D0%B3-%D0%B7%D0%B8%D0%BC%D0%BD%D1%8F%D1%8F-%D1%82%D0%B5%D1%80%D1%80%D0%B0%D1%81%D0%B0.jpg
The app uses a class called AsynchronousUIImage that I found online about a year ago. It just loads the image asynchronously via NSURLConnection.
- (void)loadImageFromURL:(NSString *)anUrl {
anUrl = [anUrl stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:anUrl]
cachePolicy:NSURLRequestReturnCacheDataElseLoad
timeoutInterval:30.0
];
connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
}
The catch turned out to be in stringByAddingPercentEscapesUsingEncoding. Since the URLs come in already percent-encoded, it looks like double-encoding was happening and the image simply wouldn’t load. And if the NSURLConnectionDelegate method connection:didFailWithError: isn’t implemented, you get a crash — which is what hit me.
The funny conclusion: if you have URLs containing Cyrillic characters, you have to escape them either on the server before sending them to the client, or in the client. Doing it in both places — doesn’t work. Doing it nowhere — also doesn’t work :)
Luckily I fixed it on the server side without breaking anything and avoided shipping an emergency client update. By the way, on Android there is no such problem.