Why do I feel cold in winter in a room at the same temperature as in summer?

Because of thermal equilibrium — there is more stuff in the room (like the walls) that is colder than you are and so you are loosing heat while the walls are trying to get warmer resulting in you feeling cold. In summer, the walls are warmer and there is less of a temperature difference between objects and so you aren’t loosing heat and so you don’t feel as cold. There is also humidity that contributes into the same thing of establishing thermal equilibrium.

Share

Emacs 24.5.1 update issue on Windows 7

After updating Emacs to 24.5.1 (from 23.2) on my Windows 7 machine, I found that Emacs wouldn’t startup properly and would just display a white/blank screen and appear to hang. When running it from the command line, I was seeing a couple of lines of errors indicating a problem with GTK on startup:

GLib-GObject-CRITICAL **: gtype.c:2720: You forgot to call g_type_init()
GLib-CRITICAL **: g_once_init_leave: assertion `result != 0′ failed

This reminded me that I had installed GTK+ 3.0 recently prior to my update and thought perhaps this was some interaction with the new GTK installation. Rather than uninstall GTK, I opted to remove the path to the GTK bin from my Windows 7 PATH environment variable. Once I did that and then tried to run Emacs, it worked properly. Not sure what the weird interaction was about — perhaps the wrong GTK DLL was being loaded up?

Share

Emacs, Cygwin, cvs, etc. on Windows 7

When using Emacs 24.3.1 on Windows 7, I found that cygwin-mount.el would not work (it gave a bogus error of being unable to locate mount.exe) or using version control (cvs) within Emacs would fail with “Permission Denied”. Turns out the problem was Windows UAC (User Access Control). By changing the properties on runemacs.exe to “Run as administrator”, I was able to fix this issue.

Share

Mac RDP using CoRD to Windows 7 and issues with mouse cursor disappearing

When using CoRD to RDP to a Windows 7 machine from a Macbook Air running OS-X 10.6.8 (Snow Leopard), I was having trouble with the mouse cursor disappearing after starting any email edits with Microsoft Outlook on the remote Windows 7 machine. Turns out this is a Windows feature where the mouse cursor is hidden whenever in a editing window. There are settings in the Mouse control panel to remove this default behavior: Control Panel > Hardware and Sound > Mouse (dialog) > Pointer Options (tab) > “Hide pointer while typing” (checkbox). My problem was that the mouse pointer would disappear and stay disappeared for that session. Turns on there is a setting already to fix this — if you press the “Control” key and then move the mouse, the cursor reappears. Also clicking the mouse button once while still editing brings the cursor back temporarily (until you start editing again).

Share

PuTTY, Linux Terminal, Xterm, Emacs, 256 Colors

The title says it all. This is some documentation to track how to get colors right when using PuTTY from Windows to SSH into a Linux server and then use Emacs in text-mode and edit php or other programming language files in syntax highlighted color.

In PuTTY, first make the following change (away from the default) — On the left-hand side configuration Category tree, select the Data sub-node from the Connection node. In there change, the “Terminal-type string” to “xterm-256color

Once you connect and login to the Linux server, do “echo $TERM” and you should see “xterm-256color” as a result. This allows the terminal emulation to support an xterm-type terminal with 256 colors. Once logged in, if you run “tput colors“, you should see “256” as the result of running this command.

Then run EmacsEmacs will run in text-mode. Within Emacs, run the command ‘list-colors-display‘. This should display 256 colors.

After this, you need to load up the appropriate major mode for the language you are going to be working on to get proper syntax coloring for that language (if you don’t use a suitable mode, you might get some syntax color, but not all the syntax coloring that will be supported in a full-fledged mode that is designed to support the language of your choice).

Share

C — How to check how much time a section of code takes to execute.

This requires use of standard C library support for the clock_gettime() function. This returns time as a data-structure (struct timespec) that includes the current time in seconds and nano-seconds. Call this one time before the section of code to evaluate and once after and then take a difference of the end time versus the start time to figure out the time taken in the section of code.

 

struc timespec timespec_diff(struct timespec end, struct timespec start)

{

}

void testThis()

{

int i;

struct timespec start, end, diff;

 

clock_gettime(0, &start);

for (i = 0; i < 100000; i++)

{

x = i * 45;

}

clock_gettime(0, &end);

diff = timespec_diff(end, start);

printf(“Section of code took %u seconds %d nano-seconds\n”, diff.tv_sec, diff.tv_nsec);

}

Share

C — How to check how much time a section of code takes to execute.

This requires use of standard C library support for the clock_gettime() function. This function returns clock time as a data-structure (struct timespec) that includes the the clock time in seconds and nano-seconds.

Call this function one time before the section of code to evaluate and once after and then take a difference of the end time versus the start time to figure out the time taken in the section of code.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <time.h> // for the clock_* APIs and struct timespec

struct timespec timespec_diff(struct timespec end, struct timespec start)

{
    timespec temp;


    if ((end.tv_nsec-start.tv_nsec) < 0)
    { // If this is the case, then the seconds values are different by atleast 1.
        temp.tv_sec = end.tv_sec - start.tv_sec - 1; // Borrow one second from the seconds field...
        temp.tv_nsec = 1000000000 + end.tv_nsec - start.tv_nsec; //...and use it in the nano-second field.
    }
    else
    {
        temp.tv_sec = end.tv_sec-start.tv_sec;
        temp.tv_nsec = end.tv_nsec-start.tv_nsec;
    }

    return temp;
}

void testThis()
{
    int i;
    struct timespec start, end, diff;


    clock_gettime(CLOCK_REALTIME, &start);

    for (i = 0; i < 100000; i++)
    {
        x = i * 45;
    }

    clock_gettime(CLOCK_REALTIME, &end);

    diff = timespec_diff(end, start);
    printf("Section of code took %u seconds %d nano-seconds\n", diff.tv_sec, diff.tv_nsec);
}
Share