If your local username is different than your remote host it may be frustrating to type that username at each connection. Luckily, ssh comes with a config file that we can adjust.
If you are to work under two different repositories with different commit history, you may either,
- Copy the changes between multiple git repo folders, back and forth.
- Use the same directory separately for different repositories.
First one easy enough but it gets frustrating as the project evolves. Today I’ll tell you how to use any number of repositories under the same directory.
What is a System Monitor?
System monitors show various system indicators like HDD, Network, and CPU usage. If you want to learn more about your computer, it’s a must have tool.
I guide you to install conky, which is extremely powerful and customizable system monitor tool.
What is this?
This is a list of git aliases (shortcuts) to use git more efficiently. I get this valuable git config from my lovely manager Mike Veldink from Siemens AG, a special thanks to him. You can just paste this into git shell.
What is a Syntax Highlighter
Syntax highlighter helps you embed some code into your blog post and highlight it so that user will see it as if he/she is reading your code from an editor.
Here is a highlighted code:
Here is raw:
echo SELECT VDISK FILE=”C:\full\path\to\license.vhd”>%TEMPFILE%
echo ATTACH VDISK>>%TEMPFILE%
DISKPART /s %TEMPFILE%
See the difference?
In this How To, I will guide you to create specialized template functions within IBM Rational Rhapsody.
Unfortunately there is no build-in easy way to do that. Fear not, with some scripting we can handle this.
- Create a batch file and modify the path to VHD.
- Save the script to your path of preference.
- Open Task Scheduler
- Open Task Scheduler.
- Click on Create Task on the right tab.
- Give a name to the task. Click on Change User or Group and choose Administrators for the group.
- Click on Triggers. Choose At Startup
- Click on Actions. Create New Action. Point to batch file you created earlier.
- Save the task. When you restart your computer, VHD will automatically mounted.
Let’s say you have a board (beaglebone, raspberry pi, etc) and you want to connect internet by using a proxy server. Your work network may not allow this little guy or you may be in a closed-network with one gateway — proxy.
Use system-wide proxy
First, let’s see how to configure system-wide proxy in linux. Most programs honor http_proxy environmental variable. Let’s add them permanently in the system.
Open the file /etc/environment
Add the following lines, update as necessary.
Great! However, you will notice, apt-get will not work. You need to change one more file for that.
Open the file /etc/apt/apt.conf
Add following lines, update as necessary.
Set up local proxy server
Cntlm is a great proxy server written in C. Install it to your machine.
- Configure cntlm.ini file that fits to your network configuration (Domain, Username, Password tag).
- Specify any proxy that you have in your nework. (Proxy tag).
- Give a proxy port (Listen tag).
- Give permission to a certain address range (Allow tag). You can use CIDR notation. (i.e. 192.168.0.0/16).
Cntlm should register itself as a service. You can run it explicitly by calling Start Cntlm Authentication Proxy.
Voila, your proxy server should be running now.
OK I confess, I didn’t read the legandary What Every Computer Scientist Should Know About Floating-Point Arithmetic by Goldberg. It’s a must-read however sometimes you just need to find your answer, rather than master on a topic, like floating points. Here, I’ll list the things I learned from working with FPs, in case you are looking for an answer too.
Floating point is less than FLT_MIN, double is less than DBL_MIN. How is it possible?
Looking for an underflow error? How would you decide if underflow has occured. Underflow is defined by number computed is less than minimum number representable. Documentation of strtod states the following:
We expect a number which is less than or equal to FLT_MIN or DBL_MIN. Let’s check what exactly those macros are.
FLT_MIN : The value of this macro is the minimum normalized positive floating point number that is representable in type
float. It is supposed to be no more than
DBL_MIN : Same as FLT_MIN, for double.
In that case, you may ask what is minimum normalized value? Normalized numbers do not have leading zeros in decimal representation of a float. For instance,
Normalized : 1.17549e-038 (FLT_MIN)
Subnormal : 0.0017549e-41 (same number)
As you can see, even though FLT_MIN_EXP, exponent of minimum float is 38, we can write smaller numbers than it by allowing subnormal numbers. So, when you have a string represents a float smaller than FLT_MIN, it may be still representable and could smaller than FLT_MIN. Let’s look at the code:
MIN FLOAT test
Min possible : 1.17549e-038
Error: Range error
Normal : True
But wait, how? The number is smaller than FLT_MIN by all terms, exponent is smaller than FLT_MIN_10_EXP and it is still normal? Let’s take a close look on the both numbers. My favorite tool for examine floats is IEEE-754 Analysis by Michael Lubow.
Let’s check how FLT_MIN is represented in memory.
|Decimal||HEX||Exponent (Binary)||Exponent (Decimal)||Significand (Decimal)|
See the pattern? Exponent is in its minimum. We can’t lower the number any further, that’s why we hit FLT_MIN_10_EXP limit. (Why it is not -38? Because it is base2. 2-126=1.175494e-38.) However something else changes, the significand.
Well, that seem subnormal. Why isnormal() didn’t return false then? Good question, and I don’t have the answer. What I see from the tests, isnormal() doesn’t return false until the number 1.17549430e-46.
A word about errno for underflow. Standard library is not obligated to raise ERANGE when underflow occurs. Do not count on it if you will support multiple compilers.
If you change your toolchains and save, then you will realize your makefile changes will make no effect and Eclipse will create a mysterious folder named Default, based on PWD environmental variable. This is due to a bug in Eclipse that enabled automatic makefile creation when you change toolchains.
To disable it, Go to project properties > C/C++ Build and disable “Generate Makefiles automatically”