String interpolation is a useful feature in many programming languages which helps the developers to generate formatted messages easier. An example from C# 6 could read like:
Scrapy is a nice python environment for web scraping, i.e. extracting information from web sites automatically by crawling them. It works best with anonymous data discovery, but nothing stops you from having active sessions as well. In fact, scrapy transparently manages cookies, which are usually used to track user sessions. Unfortunately, the sessions don't survive between runs. This, however, can be fixed quite easily by adding custom cookie middleware. Here is an example:
Google provides APIs to access its data using various languages. You can manipulate Google calendars, contacts, documents etc. Most of the time the usage is pretty straightforward, but sometimes it is not clear how to achieve a specific goal. For example, it took me some time to figure out how to download all events for a given calendar. The main reason behind the difficulty is the upper limit Google places on the number of calendar entries returned by a single query. There are API calls, which help you to overcome this constraint. Below is the relevant code for your enjoyment.
I have released a new product: Event Importer for Google calendar. It allows importing iCalendar files (.ics), downloaded via browser quickly and easily. Possible use cases: event export from Facebook, Meetup, other online services, e-mailed .ics files etc. Please give it a try and let me know what you think.
If you want to right-align the "Help" (or any other) menu entry in your menu bar in a WPF application, you can use the following example:
Sometimes you would like to use a standard Windows system icon, such as error, warning, question etc. in your WPF program. The main reason is usually consistent look with the rest of the system. While you could have extracted the desired icon from one of the system resource files, there is a much better technique for doing it. First, add a reference to System.Drawing to your project. Then you can use this sample code to get the desired icon quickly:
WPF allows you to create localized applications with relatively little effort. The localized strings are put into resource files (.resx), one per target language, and maintained as needed. The editing facilities of Visual Studio, however, are not designed to help the localization efforts, however. The GUI can only show one resource file at a time.
Apparently, Microsoft allows users of Visual Studio to include some icons, supplied with the product. For example, to look at available icons in Visual Studio 2010, locate the file
VS2010ImageLibrary.zip in the installation directory of your copy of VS (i.e.
C:\Program Files\Microsoft Visual Studio 10.0\Common7\VS2010ImageLibrary\1033) and extract the .png files you need. You can extract the necessary sub-images from them.