### Blog

Clang - Automate C Google Style format using Clang-Format
Clang - Automate C++ Google Style format using Clang-Format

The main goal of the Clang project is to create create a new C, C++, etc front-end for the LLVM compiler. Clang is an open source project and you can download it here. You even have a clang-format plugin for Visual Studio on that page, however I do not recommend use the Visual Studio plugin once in my tests, at least at the time I did it, it did not work properly with the most current versions of Visual Studio. If you use the executable, you will be able to integrate it anyways by following the information of this post....

WindRiver Workbench - Setting a Global Variable Path
WindRiver Workbench - Setting a Global Variable Path

Go to Window » Preferences » Linked Ressouces » New Enter you variable name and location Note that the location needs to be an absolute path Now you can use it in your project with the following syntax: $(VariableName) Read More TFS - Power tools TFS - Power tools Microsoft Visual Studio Team Foundation Server Power Tools Using the TFS Power tools you can control the files that are under your TFS Workspace directly on the Windows Explorer by just right clicking on the desired file or folder. You can download the Microsoft Visual Studio Team Foundation Server Power Tools for Visual Studio 2013 on the following here. Read More Linux - Display CPU information Linux - Display CPU information To know the CPU information can be extremely utile when you want to install a third party software that does not distribute it software using Personal Package Archives (“PPAs”) and therefore to be able to install it using the command “apt-get”. On those cases, usually the installation process will require you to copy a file to your linux device that should be selected among different processors and distributions information. The CPU information is located on the “/proc/cpuinfo” file. You can visualize this file content by executing the following command on your Linux Terminal:$ more /proc/cpuinfo Note: This information was...

Synergy - Share your Keyboard and Mouse on several platforms
Synergy - Share your Keyboard and Mouse on several platforms

Introduction Synergy is a VKM (Virtual Keyboard and Mouse) software that allows you to share your keyboard and mouse with computers running different operational systems (E.g.: Linux, Windows, etc..). There are alternative softwares that can replace Synergy if you would like to share your keyboard and mouse with devices that use the same operational system (E.g.: Mouse Without Frontier for Microsoft Windows). However, the attractiveness of Synergy is the fact it is an open source software and can run in multiple operational system platforms. The following walkthrough will demonstrate on how to install the Synergy software and share your Windows...

Linux - Disable Sleep
Linux - Disable Sleep

To disable the option of your device turn off the monitor and go to sleep after an amount of time, you can follow the steps below: Edit the “/etc/lightdm/lightdm.conf” file adding the following lines to the [SeatDefaults] section: # don't sleep the screen xserver-command=X -s 0 dpms Tip: To edit the file you can use the nano software by typing the following on the linux terminal: sudo nano /etc/lightdm/lightdm.conf Note: This solution was tested with Raspberry Pi

VxWorks
Network access on VxWorks Simulator hosted by a Windows 8 machine

Installation for Windows 8 WindRiver does not support Windows 8 for VxWorks 6.9. They have not tested this environment for the simulator. Windows 7, 64-bit, is the latest Windows OS supported by this platform. However, within the 6.9 installation should contain a 32-bit and 64-bit WRTAP driver (C:\WindRiver\vxworks-6.9\host\x86-win32\bin\wrtapInstaller.exe or C:\WindRiver\vxworks-6.9\host\x86-win32\bin\x86_64\wrtapInstaller.exe). This driver can be used for the simulator be able to have a TCP/IP communication with your computer. Below is an image of my network properties after the installation and configuration. Note: The connection should be Active to get the simulator to work with network, however, if you are not...

Visual Studio 2013
Package failed to load on Visual Studio 2013

If you face this message: Open the Visual Studio Command Prompt (C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts\Developer Command Prompt for VS2013) with Administrator rights and execute the following command: devenv /Setup This will fix the problem.

StackEdit
StackEdit Tutorial and Model

VxWorks
VxWorks RTP project link when using file system functions

The VxWorks version 7.0 is not compiling when a program uses files system functions as mkdir, rmdir, etc. This is caused by bug on this version of VxWorks and affects all the file system functions that uses the usrFsLib library. This is a bug reported on the following link: https://knowledge.windriver.com/en-us/000Products/000/020/000/080/000/000_V7STO-226%3A_mkdir()_no_more_available_in_RTP_libc To solve the problem you do not need to change the makefile as suggested by the proposed solution link. Just add the library on your project (Build Properties » Libraries » Add fsapiUsr library):

VxWorks
Compile Google Test for VxWorks

Introduction On the time I wrote this article, VxWorks was not yet supported by Google test (Gtest). This article describe the procedure to port the Google test to be used on VxWorks RTP Projects. Procedure Create a RTP project on VxWorks Set the Project to be a library (Build Properties » Target » Build tool = Librarian) Define the variable GTEST_ROOT variable to be the path where the Google test folder is (Build Properties » Target » Variable » New): Note: The Google Test folder is the folder where is located the scr, include, script folders. Define the entries GTEST_HAS_POSIX_RE, GTEST_HAS_TR1_TUPLE and GTEST_HAS_STREAM_REDIRECTION to be...

Telnet
Telnet on Windows 8.1

By default the Telnet is not enabled on Windows 8.1. You can enable it by going into: Control Panel » Program and Features » Turn Windows features on or off » Telnet Client

PowerShell - Find String into files
Windows PowerShell

To find string into several files, you can use the Windows Powershell and the Get-ChildItem (Dir) command-let as following: dir <<v>base_directory> -I <<v>file_extensions[]> -R | Select-String <<v>strings_to_search[]> E.g.: dir dir c:\fso -I *.txt, *.log -R | Select-String fail, success, pending This command looks for the string “success” and “pending” into all sub directory of the folder “c:\fso”

C/C++ Interoperability
Call C++ code from a C code

Introduction Several times you are required to call an C++ code from a C code. One example where you want to have such interoperability is when you use an operational system, as for example VxWorks realtime program, where the program executions requires an entry-point in C code. On this article it is proposed a 3 step procedure that will allow you to execute such interoperability. Step 1 - Create an Interoperability Header (CodeInteroperability.h) This header will contain your entry point class and 3 additional global functions to Create, Run and Destroy your entry point class. Step 2 - Codify your...

Link Problem on GTest projects migrated from Visual Studio Tests

Google Test Framework (GTest) requires your project to be an executable. When using Visual Studio, it is common for you to create a flavor of project from the Visual Studio Test framework. In this way you might have your units tests available on both frameworks. To do it you create the new flavor and them change the project properties to be an executable and properly link with the GTest libraries. Them when you compile your new project flavor you receive the following link error: Error: _winmain@16 executable link error This error happens when you are linking an executable without an...

Compiler
C++ On-line compilers

Below you can find a series of on-line C++ compilers. Those compilers can be very useful when you want to do a quick test as well share snippets. You can embedded the code in your website easily using those tools. Site List Live Workspace - Clang 3.2, GCC 4.6.3 - 4.7.2 Gcc GodBolt - Clang 3.0, GCC 4.5.3 - 4.8.0 prerelease, Intel ICC 13.0.1 Rise4Fun - Microsoft VC++ 2012 and November 2012 CTP Coliru - GCC 4.7 Ideone - GCC 4.3.4 and 4.5.1

C++ Programming
C++ Template - Fast Guide Example

Function Template .H File template<class ValueType> std::wstring MyFunction(uint parameter, ValueType template_parameter); .Cpp File template<class ValueType> std::wstring MyClass::MyFunction(uint parameter, ValueType template_parameter) { return (boost::wformat(L"%1%") % template_parameter).str()); } //Specialization to allow the template to be used in other files template std::wstring MyClass::MyFunction<bool>(uint parameter, bool template_parameter); template std::wstring MyClass::MyFunction<int>(uint parameter, int template_parameter);

Markdown
Quick Markdown Syntax Guide

See the Pen Markdown Fast Guide by Rogerio dos Santos (@roger_santos) on CodePen.

MathJax
MathJax on your Postach.io website

You can use MathJax on your Postach.io website as the example below: When , there are two solutions to and they are: Another example: When or or or or or or we will have the following result: The examples above has the following code:

CodePen
JavaScript front end demonstration with CodePen

You can easily demonstrate a JavaScript code and its result using CodePen CodePen. This site is also a great source for examples. [codepen url=”http://codepen.io/bvbrandon/pen/Hvqes” height=”700” type=”result”] See the Pen Lonely Worker by Rogerio dos Santos (@roger_santos) on CodePen.

STL
Debuging STL Vector on Visual Studio

You cannot access directly STL vector index on Visual Studio, however, there is a way to access vector value in debug mode though a RawView: ((< vector_name >)._Myfirst)[< vector_index >] E.g.: ((my_vector)._Myfirst)[10] - Access the index 10 of the vector my_vector

COM/DCOM
Memory Leak on OLE Strings

When investigating memory leaks problems that involves OLE Strings (E.x.: BSTR, CComVariant, etc…), be aware that by default Windows caches strings created by SysAllocString and freed by SysFreeString functions to increase the overall COM/DCOM performance. This makes false leaks on memory leaks tools (E.g.: DebugDiag). To disable the cache of the OLE strings, you can introduce following Environment variable. OANOCACHE=1 If you are running the tests over a Windows service (E.g.: IIS), be sure you restart the computer for the changes to take effect.

Fedora Linux
Access Fedora Linux (Version 13) using Windows Remote Desktop

Install the Remote Desktop on Fedora Linux (Version 13) Open the Terminal (Applications » System Tools » Terminal) Become a super user (su -) Install XRDP (yum install tigervnc-server xrdp) Start XRDP Server (/etc/init.d/xrdp start) Get your IP Address (ifconfig) Now connect with the Remote Desktop and use User: wruser and Password: [nothing]

Hyper-V
Getting Network using Legacy Network adapter on Hyper-V

Get network on the Hyper-V machine Without running the VM right click on your VM and select Settings Click in add Hardware them Legacy Network adapter then add button: Click on the Legacy Network Adapter and on Virtual switch select your network card: Click on the Regular Network Adapter and press the Remove Button: Click in Apply and OK. Now you can start your VM regularly that the network will be detected by the Operational System.

.Net Framework
Unusable Windows Forms turning when using .Net Framework

Some applications that were developed using .Net Windows Forms is deformed depending on your Windows Screen Resolution configuration. This might cause several application to hang for a while and in the end give you a result like this: To workaround this you can change your screen resolution configuration as following: 1 - Go to Screen Resolution 2 - Select the option “Make text and other items larger or smaller 3 - Change the configuration from Recommended Size to Smaller 4 - Restart your computer. You are done, the problem might no longer happen. If you are a developer and would...

Raspberry Pi
LXTerminal Commands on Raspberry Pi

Configuration Open the configuration terminal sudo raspi-config Install the Tight VNC Server (For remote desktop) sudo apt-get install tightvncserver Execute the Tight VNC Server vncserver or with more configuration options vncserver :1 -geometry 1600x900 -depth 16 -pixelformat rgb565: Kill the Tight VNC Server vncserver -kill :1 Reboot sudo reboot Network Get the network detail (Windows ipconfig equivalent) ifconfig

Tools
Windows Snipping Tool

This is an awesome utility to capture screen-shots that is available on Windows for a long time and not everyone uses it. On Windows 8 this utility is installed by default. Just type “snip” on the main window that you will be able to find it. If you write manuals or work with support, surely this tool will save you a lot of time. For more information, visit the Microsoft Website

Development Tools
Win32 Disk Imager

This tool developed for Windows, is used for writing images to USB sticks or SD/CF cards Description This program is designed to write a raw disk image to a removable device or backup a removable device to a raw image file. It is very useful for embedded development, namely Arm development projects (Android, Ubuntu on Arm, etc). Anyone is free to branch and modify this program. Win32 Disk Imager Download

Raspberry Pi
Raspberry Pi Operational System Installation Walktrought

Prerequisites Computer Raspberry Pi device 4GB SDCard Note: The operational system that we will use occupies around 3GB of space. Raspbian Operational system Note: When downloading, keep the SHA-1 Checksum code (E.g.: 99e6b5e6b8cfbf66e34437a74022fcf9744ccb1d) This will be used latter to assure that the download file is not corrupted. Win32 Disk Imager MD5 & SHA Checksum Utility Procedure Using the MD5 & SHA Checksum Utility verify if the downloaded Raspbian Operational system is not corrupted. Extract the Raspbian Operational system » Your image file will be available (*.img). Extract the Win32 Disk Imager Connect the SDCard on your computer Execute the Win32 Disk...

Indusoft
Linked Picture Default Directory on Indusoft Web Studio v7.1 + Service Pack 2

Indusoft - Linked Picture Default Directory On the Indusoft Web Studio v7.1 + Service Pack 2 we changed the default path of linked pictures to be relative to the Web folder. On older versions, this path were relative to the application folder. In case you created an application on older versions, your relative linked pictures might not load properly. To correct this problem you can enter the following entry on you application file (.App): [Options] UseAppPathForLinkedPictures=1

Productivity Tools
Phrase Express

There are some programs that are life change and in my opinion the PhraseExpress is one of them. Phrase Express WebSite The Phrase Express program monitors everything you type on the keyboard and allows you to configure several actions based on the key pressed. It do not only evaluate a sequence of keys pressed at the same time, but evaluates the previous texts typed in order to provide actions that are very flexible and configurable. For example it would not be very useful to have a kind of Visual Studio intellisense in any program that you use? More than a...

VBScript
Ping a device before sending a command using VBScript

Below you can find a VBScript code that allows you by accessing the command of the operational system to ping a device and evaluate the result. This technique can be used with any shell command. On Error Resume Next Dim strTarget, strPingResults strTarget = "198.162.1.2" 'IP address or hostname Set WshShell = WScript.CreateObject("WScript.Shell") Set WshExec = WshShell.Exec("ping -n 3 -w 2000 " & strTarget) 'send 3 echo requests, waiting 2secs each strPingResults = LCase(WshExec.StdOut.ReadAll) If InStr(strPingResults, "reply from") Then WScript.Echo strTarget & " responded to ping." Else WScript.Echo strTarget & " did not respond to ping." End If

Command Prompt
Open the command prompt directly into a folder path

Using Windows Vista, Windows 7 or later to open up a command prompt directly into a folder you might have selected just hold down the Shift key and right-click on the desktop then choose “Open Command Window Here” from the menu:

Windows CE
Windows CE 7 Command Prompt starts with your program

When testing a solution compiled using SDKs that were not built with the Windows Compact Embedded 7 platform builder, I could observe that every time the program was executed, a command prompt appears. The Solution Compile the program using a SDK that was created using the Windows Compact Embedded 7 platform builder. I executed the following steps described here to increase the performance when using ARMv7 processors and the command no longer appeared.

Windows Compact Embedded
Visual Studio 2008 and Windows Compact Embedded 7 - ATL Update

You will not be able to compile your MFC / ATL application if you use Visual Studio 2008 and Windows Compact Embedded 7 SDK. The problem is described in details on this Microsoft article: http://support.microsoft.com/kb/2468183 Take special attention on the pre-requirements described on the link above and shown below: http://support.microsoft.com/kb/2483802 The solution will be to download and install the ATL update available. This is an update for Visual Studio 2008 SP1 to extend support for Windows Embedded Compact 7. This article describes the procedure needed to proper update and configure your application. Procedure 1 - Download and install the pre-requirements...

Blog Platform
Postach.io

Automatically create/update a Web Site or Blog using Evernote What it is Postach.io Postach.io is an amazing tool that allow you to publish a WebSite using your Evernote notes. This post for example uses the Postach.io website and it was completely described using Evernote. How It Works Postach.io creates blog posts and pages from your notes. To create a post, write a note and tag it as “published” in a notebook from your choice that you link with your Postach.io site. Once Evernote syncs your note, your note is published on your site, automatically! Creating a page works the same,...

Windows CE
ARMv7 - Performance

This article informs steps that can be used during the creation of your device SDK using the Platform Builder, as well steps to be used during the compilation of your program that will speed up the overall performance of your application on ARMv7 processors. Introduction Newer processor types usually introduces techniques to improve the performance, reduce the power consumption, etc. however, those functionalities might need the introduction of specifics processor commands not available on older processors architectures that is neither always used by the compilers nor properly enabled on the SDKs. This is the case when using Microsoft Visual Studio...

Network
Slow network connection using Windows 7 or later

Windows 7 have introduced a new feature, called TCP/IP Auto Tunning, that dynamically changes the TCP/IP package sizing. This improves the speed of the TCP/IP communication. However, old Windows Servers operational systems, E.g.: Windows 2000, have problems handling the TCP/IP Auto Tunning capability. This makes the network communication between Windows 7 and those old Windows Servers really slow. Unfortunately the operational systems where this problem might happen, are no longer supported by Microsoft and therefore no solution is available on the Server side. But, you can disable the TCP/IP Auto Tunning capability on the client side by using the command...

Curiosity
Internet each minute

It is amazing the amount of information that we have in our hands though the Internet. Information can bring us knowledge and knowledge can empower people, therefore never in the history of the humanity we have such equal opportunities are we are having now. If we think that a person with a simple smart phone has more access to information that the US president Ronald Reagan had in the eighties when handling the cold war we can understand how technology can change our lives. Below is an image of what happens on the Internet each minute. For sure when I...

COM/DCOM
Export the interfaces from a TLB file

You can export the functions available on the COM interfaces from a type library (*.tlb file) using the following procedure: 1 - Open the Visual Studio command prompt 2 - Open the OLE/COM Object Viewer by executing the command “oleview” 3 - Then File » View Type Lib » inform the type library (*.tlb) file that you want the COM interface (E.g.: c:\foo.tlb) 4 - Now in ITypeLib Viewer, File » Save As… » and you can export all 3 files needed in you C++ project (.h, .idl, .c) from there.

Bosch MLC L65
Clean the Memory of Bosch Controlers

Depending of the error you might have with the Bosch MLC PLC family (More specifically the MLC65), you might need to clean the memory to recover from the error. For example, if you try to upgrade the PLC firmware and after updating it you get a system error (More specifically SYS-ERR: F92240005 error), the only way you can recover from theis error will be to execute the procedure below to clean the memory: 1 - Cycle power to the MLC. 2 - Keep ESC and ENTER button pressed during boot-up until display will say BOOTSTOP. 3 - Press briefly UP...

MFC
Frame vs View

The image below shows the difference between a Frame and View windows when using a MFC Frame/View architecture. On the MFC Frame/View architecture, each document can be linked with one or more View. The View is nothing more that a representation of the document. You can have the same document presented in several different formats by using one View for each format presentation. A View will always be inside a Frame and a Frame can have more the one View.

Visual Studio
Visual Studio Icons

Visual Studio allow us to copy and use its icons library. On Visual Studio 2008 the icons will be saved on the following folder: {Visual Studio installation directory}\Common7\VS2008ImageLibrary\1033 E.g.: C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\VS2008ImageLibrary\1033

Curiosity
Food Companies

When you go to the supermarket you might think you have a lot of choices and therefore that there is a huge competition among the companies. However, the reality is quite different. Below you have an image that shows the brands owned by the major food companies. You might be impressed to know how small is the amount of companies that control this very important market and how hard should be to compete against them.

Serial Communication
ETD vs ECD

This small article explains the definition of ETD and ECD. ETD stands for equipment terminal data, examples of ETDs are PCs, PDAs, Tables, Smart phones, HMI, etc. On those devices, that usually send the information, the TX represents an output and the RX represents an input. ECD stands for equipment communication data, examples of ECDs are Modem, Conversors (RS232/RS485), etc. On those devices, that usually receives or follows the information, the TX represents an input and the RX represents and output. Summary ETD --> TX (Out) RX (IN) ECD --> TX (In) RX (Out)

Indusoft
Watchdog for Indusoft runtime

The CEServer is able to relaunch an application in case it detects that for some reason the application is not running. This behavior might be utile if you have on critical operations that your application cannot in anyway be stopped. To enable this functionality edit the CEServer.ini with the following entry: [Watchdog] Enable = 1 TimeOut = 600 This will enable Watchdog functionality restarting the CEView and Viewer in case the CEServer identifies that any of the programs are out for more than 600 milliseconds.

Indusoft
Indusoft v6.1+SP2 and v6.1+SP3 incompatibilities

As a marketing strategy Indusoft guarantees forward compatibilities, in this way an application built in an older version of the Indusoft web Studio Product can be opened in a newer development version of the Indusoft Web Studio and be automatically upgraded. This article describe some incompatibilities between the Indusoft Web Studio v6.1 + SP2 and the Indusoft Web Studio v6.1 + SP3 that requires such upgrade as well a clean up of the binaries files in order you do not have problems: VBScript When saving a VB Script interface (Global Script, Graphic Script or Script Task), IWS saves two files...

Indusoft

Indusoft
Disable all PopUp messages on Windows CE on Indusoft

There are some conditions that you would like to disable all PopUp messages that might appear when an error happens while running your application. For example, if you have a device that does not have a monitor a PopUp message will freeze your application since you will not be able to acknowledge it. Another case would be if one of your project requirement is to do not display any error message. To disable all the PopUp messages on Windows CE you can edit the “{Indusoft Windows CE Installation Directory}\Bin\CEView.ini” file introducing the following entry: [OEM] BlindDevice=1 When BlindDevice entry is...

Indusoft
Debugging your ActiveX or .Net control directly into Indusoft

When you are creating your own ActiveX or .Net control to use with the Indusoft Web Studio you can save a lot of time when debugging it directly inside Indusoft. This article shows how you can you configure your Visual Studio and an Indusoft application to debug your control using the either the Studio Manager and the Viewer as container. Visual Studio Configuration On the Visual Studio you can set the execution of any program to be called when you stat the debug of your project by executing the following steps: Right click on your project ]] Properties ]] Configuration...

Indusoft allows you to create organizational folder inside your VBScript Global Procedure files by adding a simple command syntax in your script that will be interpreted by the script engine as comment however Indusoft will parse it and create folders inside the global procedure tree. Syntax: //$region:{your organizational folder name} E.g.: //$region:Machine Control 01 //\$region:Machine Control 02 This syntax create on the Main Procedure will provide you the following result: