Like all APIs, C++ REST APIs need to be documented. If the documentation can be written together with the code, and maybe even generated from the code, that would be ideal.
This article will explain how one can generate C++ REST documentation from code.
Sunday, October 8, 2017
Friday, October 6, 2017
Profiling C++ applications on Ubuntu
Sometimes it is necessary to check the performance of applications at function level, in order to see what are the functions that consume the most time during program execution. I'm going to go through two methods of profiling and exploring the results in a graphical manner.
Sunday, September 4, 2016
HTTP chunked encoding using C++ and libcurl
HTTP chunked encoding is the way to transfer large amounts of data via HTTP. It is pretty easy to use with libcurl, if you have all the data in advance. In case you don't have all the data available when uploading, things get a bit tricky. This latter scenario is what this post will be focused on.
Labels:
c,
c++,
chunked transfer,
curl,
http,
http chunked encoding,
libcurl
Saturday, September 3, 2016
Replacing legacy C-style buffers
Since I've been working lately on legacy projects, filled with C-style buffer containers like void*, char*, byte*, I've started replacing these types of buffers with something a bit more safe and modern, if I might say so.
Sunday, June 12, 2016
iOS push notifications with sound from Amazon SNS
When sending push notifications from Amazon SNS, to iOS endpoints, with the default JSON format, they are received without sound.
The default format would look like this:
In order to get sound for push notifications on iOS, the JSON payload should look like this:
Why does the payload look like this? I have no idea. The point is that it works at the moment this article was written. I've found it somewhere on stackoverflow, but I can't find it again, so I'm just posting it here for whomever needs this information.
The default format would look like this:
{
"default" : "Message"
}
In order to get sound for push notifications on iOS, the JSON payload should look like this:
{
"default" : "Message",
{ "APNS":"{\"aps\":{\"alert\":{\"loc-key\":\"%@\", \"loc-args\":[\"Message\"]}, \"sound\":\"default\"} }" }
}
Why does the payload look like this? I have no idea. The point is that it works at the moment this article was written. I've found it somewhere on stackoverflow, but I can't find it again, so I'm just posting it here for whomever needs this information.
Saturday, January 23, 2016
Creating thumbnails for remote videos
You have some video files stored on some remote storage (dropbox, google drive) and you want to create thumbnails without downloading the whole file.
Labels:
avconv,
https,
libav,
mp4,
remote storage,
thumbnails,
video
Tuesday, January 12, 2016
Configuring ssh keys for git access on Ubuntu
To be able to connect to a git repository with ssh access (ssh://) use the following steps:
- copy your private key file to ~/.ssh
- create (if it doesn't exist) the file ~/.ssh/config and add the following content:
Host my_githost.com
HostName my_githost.com
User my_username
IdentityFile ~/.ssh/my_private_key_file
- change the permissions to the private key file:
chmod 400 ~/.ssh/my_private_key_file
Now you can clone your repository.
Monday, January 11, 2016
Migrating a svn repository to git
I realize there are a ton of articles about migrating from svn to git, but this is mostly a note so I don't forget the steps. My situation is a bit particular since I need to import an svn folder to git.
Sunday, December 27, 2015
An opinion on TDD
TDD (Test Driven Development) seems to be used a lot in technical and management circles, together with "CI", "scrum" and other agile-ish buzzwords. Since I've got an internet connection and the ability to throw my opinion into the wild, I think I'll do just that.
Saturday, December 26, 2015
Reusing std::thread objects
Sometimes it's useful to reuse a std::thread object - from a resource and design point of view. This would seem trivial, but since the std::thread was designed as a single use object, there are a few tricks to reusing it.
Sunday, December 13, 2015
Running a stand alone child process from a parent process
Sometimes it is necessary to start a process from within another process, whether it is for executing a command line utility or to create a peer process with which the parent process will need to communicate.
Detaching a process from the terminal
Sometimes it is useful to detach your application from the console terminal. It may be because you're building a daemon or simply because you don't want the application closing when the user ends his terminal session.
Sunday, November 8, 2015
C++: splitting strings
There are multiple ways of splitting or tokenizing strings in C++. I'll enumerate below four types that seem most used and/or useful.
Saturday, October 3, 2015
Uploading files with unknown size using the Google Drive API
The Drive API documentation is not very straight forward when it comes to uploading files when you don't know the size of the file. In this post I'll explain a way to do a chunked file upload when the file length is unknown.
Sunday, September 27, 2015
Uploading a file with the Google Drive API
This post describes how to upload a file in Google Drive using the REST API from C++, with cURL.
Sunday, September 6, 2015
Sending a custom video stream through WebRTC
WebRTC is used to create video call enabled p2p applications. By default it supports only local webcam and audio input to be sent to a peer. However, it might be useful to send a remote video stream to a peer - for example a RTSP stream from an IP camera.
In this post I'll focus on modifying the peerconnection_client example to send a remote RTSP stream to another peer.
In this post I'll focus on modifying the peerconnection_client example to send a remote RTSP stream to another peer.
Saturday, September 5, 2015
Building libjingle for Android
Libjingle is a C++ library used to create peer-to-peer connections for voice-chat applications. It is included in WebRTC and bundled inside the Chromium source repository.
There are a couple of web pages with instructions out there about how to build the library for Android, but none of them seem complete.
This is where this post comes in.
There are a couple of web pages with instructions out there about how to build the library for Android, but none of them seem complete.
This is where this post comes in.
Friday, July 17, 2015
Unit tests: How to access private members in C++
In order to write unit tests sometimes one needs to access private class members or methods.
Tuesday, July 14, 2015
Building GStreamer-1.0-SDK for Android MIPS
GStreamer is a nice SDK with which you can create multimedia applications for a multitude of systems. My concern is primarily Android with RTSP and video playback.
The SDK is already available for Android for a couple of architectures (arm, armv7a and x86). No MIPS support though.
In this post I'll describe the steps needed to get a GStreamer-1.0 SDK for Android MIPS.
The SDK is already available for Android for a couple of architectures (arm, armv7a and x86). No MIPS support though.
In this post I'll describe the steps needed to get a GStreamer-1.0 SDK for Android MIPS.
Tuesday, June 16, 2015
Integration with Amazon SNS for push notifications
Pseudocode for Android integration with Amazon SNS:
This should work for iOS-SNS integration, but I haven't had the chance to test.
server call to register for push notifications with registration token and DeviceId
if DeviceId is already stored then
call DeleteEndpoint
else
call CreatePlatformEndpoint to create new ARN for this device
store new ARN, Token and DeviceId
endif
I know there are other algorithms for working with Amazon’s SNS (like this one) but this seems to be the simplest, and it also solves the problem with Amazon not disabling the ARNs when applications are re-installed.This should work for iOS-SNS integration, but I haven't had the chance to test.
Subscribe to:
Posts (Atom)