Kenny Fowler

Random information about technology

[Javascript] parseInt returns NaN

Posted on February 19, 2017 in Javascript

Here's a boneheaded problem I ran into.

>> var a = JSON.stringify("0")
undefined
>> var b = 1
undefined
>> parseInt(a) + b
NaN

If you're not overly familiar with JSON.stringify, you might assume that parseInt would give a value of 1. But after some research, I figured out that the ""s were getting stringified as well.

>> a + b
""0"1"

Since I just wanted to stringify the number 0 (and not the double quotes), I did the following. This yields the value of 1 that I was expecting.

>> var a = JSON.stringify(0)
undefined
>> parseInt(a) + b
1

Terminal not working in Debian 7.8 (Wheezy) in Xfce

Posted on July 31, 2015 in Debian Linux Xfce

Xfce uses gnome-terminal by default and when you attempt to launch it, the window comes up fine but it does not appear that you can type a command. I noticed this issue and sidestepped it for a long time by using xterm and other terminal clients.

Come to find out that it is a color issue. You can type commands in the window all day long, you will just not necessarily see them. If you do an ls, you will notice the coloring for different file types and realize that the client is actually working.

Solution:

Edit menu > Profile Preferences

Colors tab

Uncheck "Use colors from the system theme"

Select a color scheme from the built-in schemes or create your own using the palette provided.

 

[Top]