Skip to content

Instantly share code, notes, and snippets.

View retorillo's full-sized avatar

Retorillo retorillo

View GitHub Profile

GDI+

Gdiplus Namespace

GDI+ identifiers are defined inside Gdiplus namespace.

If compiler said "undefined identifier" error message, Check identifier's namespace, or consider to use using directive.

GdiplusStartup and GdiplusShutdown

Solution1: dir

dir X: > NULL && echo Successfully reconnected!

Solution2: net use /delete

net use X: /delete && net use X: \\target_computer\target_dir

On Windows, most distributions uses dos as default format, and note that set fileformat=unix on vimrc cannot affect with newly created buffer. Use fileformats rather than fileformat.

" ~/.vimrc or ~/_vimrc (depends on distribution)
set fileformats=unix,dos

Writing C++ Unit Test From Scratch (without Visual Studio IDE) for VS2015

This post provides super-simplified examples that describes how to write C++ unit test without any Visual Studio IDE assistant and template. (Tested on Visual Studio 2015 Community edition)

In fact unit test can be accomplished by only using cl and vstest.console commands. To use these, start with VS Tools Command Prompt, or load vcvarsall on vanilla-cmd.exe to configure. (manual enviromental configuration is too complex and not recommended)

How to write your own build script by using benefit from MSBuild environment variables configuration corresponding specified platform (C++)

The following XML enables to resolve this challenge. SetBuildDefaultEnvironmentVariables is key of this.

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="ManualBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <PlatformToolset>v140</PlatformToolset> <!-- (Optional) only if want to explicitly specify platform toolset version -->
 8.1 

MsBuild exploration for C++

Three key files

The following three XMLs are key, and I recommend to import them always to take benefit to pre-defined Visual Studio tasks.

  • $(VCTargetsPath)\Microsoft.Cpp.default.props
  • $(VCTargetsPath)\Microsoft.Cpp.props
  • $(VCTargetsPath)\Microsoft.Cpp.targets

Blender Memo

Blender v2.79

Add vs Assign to Vertex Group

Note that Add vertex group does only create EMPTY vertex group no matter which verticies were selected. You must do Assign to vertex group to assign selected vertices to current active vertex group, or Assign to new group to assign to newly created vertex group.

バッチでセミコロン区切りのPATHをループ処理する

これら以外の方法でも不可能ではないと思われますが記述が非常に複雑になると思います。 シンプルな方法としては以下の2つがあるようです。

セミコロンを引用符でくくる

@echo off
for %%A in ("%PATH:;=";"%") do (
@retorillo
retorillo / ctags-windows-include.md
Created February 28, 2018 09:55
%INCLUDE%フォルダ上のヘッダファイルに対してtagsを生成する(Windows/ctags)

%INCLUDE%フォルダ上のヘッダファイルに対してtagsを生成する(Windows/ctags)

目的

ctagsコマンドで%INCLUDE%フォルダ上のヘッダーの定義情報をファイル(デフォルト名 tags)に格納しVimなどからリファレンスとして活用できるようにします。

要件

  • Visual Studio 2017 CommunityなどでC++開発環境がインストールされていること
  • Universal CTAGSctagsおよびreadtagsコマンドのPATHが通ってること
@retorillo
retorillo / blender_dupl_background_images.py
Last active August 7, 2018 14:21
[Blender] Duplicate background images from first one
# Duplicate background images from first one
# Paste to Blender Python Console, and press ENTER twice
# Authored by Retorillo
# CC0 License, No Rights Reserved
# <START>
for a in bpy.data.screens['Default'].areas:
if a.spaces[0].type != 'VIEW_3D':
continue
bkg = a.spaces[0].background_images
if len(bkg) == 0: