Bing It On Challenge – Unbiased? Part 1

 

By now I’m sure just about everyone has heard about the “Bing It On” Challenge. Microsoft created it as a blind test to encourage people to use Bing. As a technically savvy consumer and science enthusiast, I had to try the challenge.

Before I even discuss the challenge itself, I’d like to state my views of the companies before I took the challenge. I would like to note that I was already heavily biased against Microsoft. Although I used Microsoft Windows for until I was fifteen, when Windows Vista came out everything changed. I have used Ubuntu full-time since 2009. Since Google embraces Ubuntu and the open source philosophy, and put that in the smart phones we call Androids, they already have an unfair advantage.

This is a screenshot from my first run. After each answer I gave, I ran a Google search with the same terms. At some points, results were left out. This is either because Google blocked the results from appearing outside of the normal interface, possibly even specifically for “Bing It On”. This is unlikely, as it would result in Bing winning this challenge more often. Wait – Bing would win more often because Google’s results were missing. Doesn’t that sound suspiciously like Microsoft’s problem?

Despite this, Bing preserved most of Google’s formatting, like the descriptions for the sub-links, and the “report these images” link for image results embedded in the page. Obviously, “Bing It On” removed the word “Google” and “Bing” from the top, or people would select Google without looking at either results. However, after selecting what I thought was the best results, which in my case was Google, the page froze up. It would seem “Bing It On” doesn’t want to admit defeat. In fact, it got stuck there so long, I was able to take the above screenshot, and come back to it ten minutes later! This isn’t going to happen all the time, though, or Microsoft wouldn’t be claiming two out of three people prefer Bing, they’d claim everyone who tried this prefer Bing. It is my opinion that the results are extremely skewed, but intentionally force a fixed ratio of two to one ratio to avoid suspicion. As a huge fan of science, I will be testing this theory, documenting the process in full. I will also post some of the other differences between Bing and Google, and may even compare other search giants, like “Yahoo!”, but as a full-time college student I may not have time for more than a Google-Bing comparison. More later.

Posted in Bing It On - Unbiased? | Tagged , , , , , , , , , , | Leave a comment

GLaDOS is “Still Alive”…in Shell!

Thanksgiving vacation was very entertaining. For me at least. I had five and a half days off from school, and over maybe two of those days, I worked for a few hours on some unfinished projects I had on my computer. I found a program based on the end of Portal that I started to write several months ago, designed to look like the terminal as GLaDOS sings “Still Alive”. Unlike the original, I was planning to sync the lyrics to the nearest syllable, to make it look like GLaDOS was typing EXACTLY as she sang. I also wanted to include the original ASCII art, including some that was never actually used. But at 7,360 lines (!), and not even one page completed (!!!), it was time to try a different approach. Mainly figuring out how to leave the cursor where I need it instead of retyping the whole screen whenever a character was added. Which helped with fixing errors, since I now only have to fix the syllable, thousands of near duplicates.

The first problem I faced with this is timing. I opened the music in audacity, typed the lyrics in a label track, and exported them. Simple enough. Now I told my program to wait the correct duration between each character. I played the song, and even though the start matched, the end didn’t. As fast as computers are, nothing is instant. Shell is slower than some other programming languages, like C, and there were so many commands executed by my program, the text was noticeably slower than the music. The command “date +%s%N” quickly became my friend, allowing me to time everything from Midnight, January 1st, 1970, in seconds with nanosecond accuracy. There’s still a delay, but not a noticeable drift. Here is the timing code, which I saved as “~/bin/PreciseWait.sh”:

StartTime=$1
EndTime=$2
Unfinished=1
while [ $Unfinished = '1' ]
    do
        CurrentTime=`date +'%s.%N'`
        ElapsedTime=`echo "$CurrentTime - $StartTime" | bc`
        Unfinished=`echo "$ElapsedTime < $EndTime" | bc`
    done

I can call this with “PreciseWait.sh [when my program started] [when to stop waiting]“. I fed this through a program I wrote to “type” for me. I used the standard escape characters (like “\n” for new line), and was forced to create my own escape characters, partly for convenience, and partly because I didn’t know how to properly handle spaces. “~/bin/type.sh” looks like this:

#program start time (seconds.nanoseconds)
ProgramStart=$1
#time to start/end text segment
TextStart=`echo "$2" | bc`
TextEnd=`echo "$3" | bc`
#text to display
Text=$4

#find real number of characters
TextLength=${#Text}
EndLength=$TextLength
for (( i = 1; i <= TextLength; i++ ))
    do
        TempText=`expr substr $Text $i 1`
        if [ $TempText = '\' ]
            then
                i=$i+1
                EndLength=`echo "$EndLength-1" | bc`
            fi
    done

#find duration of one character
CharDur=`echo "scale=9; ( $TextEnd - $TextStart ) / $EndLength" | bc` #"scale" is # of places after decimal

TextLength=${#Text}
CharEnd=$TextStart
#wait until start time
PreciseWait.sh $ProgramStart $TextStart
#start typing
for (( i = 1; i <= TextLength; i++ ))
    do
#type normal char if TRUE, escape code (real or mine) if FALSE
        NormalPrint='TRUE'
#get next character
        TempText=`expr substr $Text $i 1`
#Escape code! Get the next letter too!
        if [ $TempText = '\' ]
            then
                TempText=`expr substr $Text $i 2`
                i=$i+1
            fi
#simulate a normal backspace, "\b" is more like the left arrow key
        if [ $TempText = '\B' ]
            then
                NormalPrint='FALSE'
                echo -e -n "\b \b"
            fi
#clear the screen
        if [ $TempText = '\C' ]
            then
                NormalPrint='FALSE'
                clear
            fi
#If you know how to display a space NORMALLY, let me know @ http://nngprojects.wordpress.com/2011/12/03/glados-is-still-alive-in-shell/
        if [ $TempText = '\S' ]
            then
                NormalPrint='FALSE'
                echo -n " "
            fi
#display normal and (standard) escape characters
        if [ $NormalPrint = 'TRUE' ]
            then
                echo -n -e "$TempText"
            fi
#wait until it's time for the next character
        CharEnd=`echo "$CharEnd+$CharDur" | bc`
        PreciseWait.sh $ProgramStart $CharEnd
    done

This can be run with “type.sh [song start time] [text start time] [text end time] [text]“. The last three fields are exactly what Audacity outputs on every line of a lyric file. The first field is from the program playing the song, “~/bin/StillAlive.sh”, which is run as “StillAlive.sh”, in a full screen terminal for best effect. It looks like this:

mplayer -msglevel all=-1
echo 'Please wait a few seconds.'
echo 'Some errors will appear,   |\_/|'
echo 'the screen will clear,     |0 0|__'
echo 'and Wheatley will make     =-*-=__\'
echo 'a fool of himself.        c_c__(___)'
sleep 6
StartTime=`date +'%s.%N'`
mplayer -msglevel all=-1 ~/StillAlive.flac &
sleep 4
clear
echo -n 'wheatley@GLaDOS:~$ '
type.sh $StartTime    4.5    5.5    'powerup'
type.sh $StartTime    6    9.249029    "\CForms\SFORM-29827281-12:\nTest\SAssessment\SReport\n\n\n"
StartTime=$StartTime-10
type.sh $StartTime    0.249029    0.498989    "This\S"
type.sh $StartTime    0.498989    0.748326    "was\S"
type.sh $StartTime    0.748326    0.999532    "a\S"
type.sh $StartTime    0.999532    1.249492    "tri"
type.sh $StartTime    1.249492    1.384757    "umph.\n"
type.sh $StartTime    3.997805    4.249635    "I'm\S"
type.sh $StartTime    4.249635    4.496478    "ma"
type.sh $StartTime    4.496478    4.749555    "king\S"
type.sh $StartTime    4.749555    5.000138    "a\S"
type.sh $StartTime    5.000138    5.498812    "note\S"
type.sh $StartTime    5.498812    6.248068    "here:\n"
type.sh $StartTime    6.248068    6.749235    "HUGE\S"
type.sh $StartTime    6.749235    6.998571    "SUC"
type.sh $StartTime    6.998571    7.505971    "CESS.\n"
type.sh $StartTime    8.997628    9.250081    "It's\S"
type.sh $StartTime    9.250081    9.751248    "hard\S"
type.sh $StartTime    9.751248    10.000273    "to\S"
type.sh $StartTime    10.000273    10.725219    "o"
type.sh $StartTime    10.725219    10.999893    "vers"
type.sh $StartTime    10.999893    11.497387    "tate\n"
type.sh $StartTime    11.497387    12.023701    "my\S"
type.sh $StartTime    12.023701    12.711851    "sat"
type.sh $StartTime    12.711851    12.987648    "is"
type.sh $StartTime    12.987648    13.509205    "fac"
type.sh $StartTime    13.509205    13.965227    "tion\n"
type.sh $StartTime    16.248064    16.498603    "Ap"
type.sh $StartTime    16.498603    16.749141    "er"
type.sh $StartTime    16.749141    17.000363    "ture\S"
type.sh $StartTime    17.000363    17.250901    "Sci"
type.sh $StartTime    17.250901    17.739008    "ence:\n"
type.sh $StartTime    19.994197    20.249856    "We\S"
type.sh $StartTime    20.249856    20.496981    "do\S"
type.sh $StartTime    20.496981    20.745472    "what\S"
type.sh $StartTime    20.745472    21.002155    "we\S"
type.sh $StartTime    21.002155    21.217877    "must\n"
type.sh $StartTime    21.753088    22.001579    "be"
type.sh $StartTime    22.001579    22.482176    "cause\S"
type.sh $StartTime    22.74432    23.003733    "we\S"
type.sh $StartTime    23.003733    23.500715    "can:\n"
type.sh $StartTime    25.24288    25.748053    "For\S"
type.sh $StartTime    25.748053    25.996544    "the\S"
type.sh $StartTime    25.996544    26.752939    "good\S"
type.sh $StartTime    26.752939    26.995968    "of\S"
type.sh $StartTime    26.995968    27.752363    "all\S"
type.sh $StartTime    27.752363    28.000853    "of\S"
type.sh $StartTime    28.000853    28.230229    "us,\n"
type.sh $StartTime    28.497835    28.751787    "Ex"
type.sh $StartTime    28.751787    28.998229    "cept\S"
type.sh $StartTime    28.998229    29.199616    "the\S"
type.sh $StartTime    29.199616    29.499989    "ones\S"
type.sh $StartTime    29.499989    29.74848    "who\S"
type.sh $StartTime    29.74848    30.002432    "are\S"
type.sh $StartTime    30.002432    30.242731    "dead.\n\n\n"
type.sh $StartTime    30.776576    30.892629    "But\S"
type.sh $StartTime    30.996395    31.195733    "there's\S"
type.sh $StartTime    31.217579    31.715925    "no\S"
type.sh $StartTime    31.730944    32.099584    "sense\S"
type.sh $StartTime    32.244309    32.500992    "cry"
type.sh $StartTime    32.500992    32.749483    "ing\n"
type.sh $StartTime    32.749483    32.993195    "o"
type.sh $StartTime    32.993195    33.243051    "ver\S"
type.sh $StartTime    33.243051    33.499051    "ev"
type.sh $StartTime    33.499051    33.746859    "ery\S"
type.sh $StartTime    33.746859    34.232917    "mis"
type.sh $StartTime    34.232917    34.690987    "take.\n"
type.sh $StartTime    34.744235    35.000917    "You\S"
type.sh $StartTime    35.000917    35.246677    "just\S"
type.sh $StartTime    35.246677    35.6672    "keep\S"
type.sh $StartTime    35.743659    36.235179    "on\S"
type.sh $StartTime    36.235179    36.495957    "try"
type.sh $StartTime    36.495957    36.733525    "ing\n"
type.sh $StartTime    36.733525    36.95744    "till\S"
type.sh $StartTime    36.95744    37.238699    "you\S"
type.sh $StartTime    37.238699    37.498112    "run\S"
type.sh $StartTime    37.498112    37.749333    "out\S"
type.sh $StartTime    37.749333    38.246315    "of\S"
type.sh $StartTime    38.246315    38.691413    "cake.\n"
type.sh $StartTime    38.744661    38.998613    "And\S"
type.sh $StartTime    38.998613    39.132416    "the\S"
type.sh $StartTime    39.132416    39.507883    "Sci"
type.sh $StartTime    39.507883    39.752277    "ence\S"
type.sh $StartTime    39.752277    40.231509    "gets\S"
type.sh $StartTime    40.231509    40.739413    "done.\n"
type.sh $StartTime    40.739413    40.992    "And\S"
type.sh $StartTime    40.992    41.243221    "you\S"
type.sh $StartTime    41.243221    41.499904    "make\S"
type.sh $StartTime    41.499904    41.752491    "a\S"
type.sh $StartTime    41.752491    42.166187    "neat\S"
type.sh $StartTime    42.248107    42.705493    "gun.\n"
type.sh $StartTime    42.746453    43.003136    "For\S"
type.sh $StartTime    43.003136    43.161515    "the\S"
type.sh $StartTime    43.221589    43.501483    "Peo"
type.sh $StartTime    43.501483    43.748608    "ple\S"
type.sh $StartTime    43.748608    43.998464    "who\S"
type.sh $StartTime    43.998464    44.35072    "are\n"
type.sh $StartTime    44.505003    44.745301    "Still\S"
type.sh $StartTime    44.745301    45.225899    "al"
type.sh $StartTime    45.225899    45.987755    "ive."
type.sh $StartTime    45.987755    51.995546    "\CForms:\SFORM-55551-5:\nPersonnel\SFile\SAddendum:\n\nDear\S<>,\n\n"
type.sh $StartTime    51.995546    52.247853    "I'm\S"
type.sh $StartTime    52.247853    52.496318    "not\S"
type.sh $StartTime    52.496318    52.749905    "ev"
type.sh $StartTime    52.749905    52.997089    "en\S"
type.sh $StartTime    52.997089    53.246835    "an"
type.sh $StartTime    53.246835    53.736079    "gry.\n"
type.sh $StartTime    56.24506    56.502489    "I'm\S"
type.sh $StartTime    56.502489    56.749673    "be"
type.sh $StartTime    56.749673    57.00198    "ing\S"
type.sh $StartTime    57.00198    57.72304    "so\S"
type.sh $StartTime    57.72304    57.999681    "sin"
type.sh $StartTime    57.999681    58.500452    "cere\S"
type.sh $StartTime    58.500452    58.998662    "right\S"
type.sh $StartTime    58.998662    59.792725    "now.\n"
type.sh $StartTime    61.229721    61.754827    "E"
type.sh $StartTime    61.754827    62.003291    "ven\S"
type.sh $StartTime    62.003291    62.751247    "though\S"
type.sh $StartTime    62.751247    63.248176    "you\S"
type.sh $StartTime    63.248176    63.724613    "broke\S"
type.sh $StartTime    63.724613    63.996131    "my\S"
type.sh $StartTime    63.996131    64.754332    "heart.\n"
type.sh $StartTime    64.754332    65.000236    "And\S"
type.sh $StartTime    65.000236    65.499726    "killed\S"
type.sh $StartTime    65.499726    66.001778    "me.\n"
type.sh $StartTime    67.99718    68.250767    "And\S"
type.sh $StartTime    68.250767    68.499232    "tore\S"
type.sh $StartTime    68.499232    68.750258    "me\S"
type.sh $StartTime    68.750258    68.998723    "to\S"
type.sh $StartTime    68.998723    69.25103    "pie"
type.sh $StartTime    69.25103    69.738994    "ces.\n"
type.sh $StartTime    71.999509    72.250536    "And\S"
type.sh $StartTime    72.250536    72.499    "threw\S"
type.sh $StartTime    72.499    72.750026    "ev"
type.sh $StartTime    72.750026    73.010018    "ery\S"
type.sh $StartTime    73.010018    73.647829    "piece\S"
type.sh $StartTime    73.727235    73.998753    "in"
type.sh $StartTime    73.998753    74.33687    "to\S"
type.sh $StartTime    74.721093    74.969558    "a\S"
type.sh $StartTime    74.969558    75.443434    "fire.\n"
type.sh $StartTime    77.247044    77.628386    "As\S"
type.sh $StartTime    77.728284    77.951134    "they\S"
type.sh $StartTime    78.007486    78.740073    "burned\S"
type.sh $StartTime    78.740073    79.121735    "it\S"
type.sh $StartTime    79.239563    79.703193    "hurt\S"
type.sh $StartTime    79.741616    79.992642    "be"
type.sh $StartTime    79.992642    80.492132    "cause\n"
type.sh $StartTime    80.492132    80.738036    "I\S"
type.sh $StartTime    80.738036    80.994185    "was\S"
type.sh $StartTime    80.994185    81.240088    "so\S"
type.sh $StartTime    81.240088    81.470622    "ha"
type.sh $StartTime    81.470622    81.716525    "ppy\S"
type.sh $StartTime    81.716525    81.985482    "for\S"
type.sh $StartTime    81.985482    82.413251    "you!\n"
type.sh $StartTime    82.700138    83.002394    "Now\S"
type.sh $StartTime    83.002394    83.243174    "these\S"
type.sh $StartTime    83.243174    83.714488    "points\S"
type.sh $StartTime    83.714488    84.234471    "of\S"
type.sh $StartTime    84.234471    84.488058    "da"
type.sh $StartTime    84.488058    84.739084    "ta\n"
type.sh $StartTime    84.739084    84.982426    "make\S"
type.sh $StartTime    84.982426    85.233452    "a\S"
type.sh $StartTime    85.233452    85.492163    "beau"
type.sh $StartTime    85.492163    85.74575    "ti"
type.sh $StartTime    85.74575    86.08899    "ful\S"
type.sh $StartTime    86.08899    86.747293    "line.\n"
type.sh $StartTime    86.747293    86.995758    "And\S"
type.sh $StartTime    86.995758    87.246784    "we're\S"
type.sh $StartTime    87.246784    87.741152    "out\S"
type.sh $StartTime    87.741152    88.010108    "of\S"
type.sh $StartTime    88.238081    88.49423    "beta.\n"
type.sh $StartTime    88.49423    88.745256    "We"
type.sh $StartTime    88.745256    88.998844    "re\S"
type.sh $StartTime    88.998844    89.24987    "rel"
type.sh $StartTime    89.24987    89.498334    "eas"
type.sh $StartTime    89.498334    89.749361    "ing\S"
type.sh $StartTime    89.749361    90.215552    "on\S"
type.sh $StartTime    90.215552    90.743219    "time.\n"
type.sh $StartTime    90.743219    90.999368    "So\S"
type.sh $StartTime    90.999368    91.250394    "I'm\S"
type.sh $StartTime    91.250394    91.498859    "GLaD\S"
type.sh $StartTime    91.498859    91.749885    "I\S"
type.sh $StartTime    91.749885    92.162285    "got\S"
type.sh $StartTime    92.223761    92.748866    "burned.\n"
type.sh $StartTime    92.748866    93.007577    "Think\S"
type.sh $StartTime    93.007577    93.248357    "of\S"
type.sh $StartTime    93.248357    93.499383    "all\S"
type.sh $StartTime    93.499383    93.758094    "the\S"
type.sh $StartTime    93.758094    93.998874    "things\S"
type.sh $StartTime    93.998874    94.2499    "we\S"
type.sh $StartTime    94.2499    94.749391    "learned\n"
type.sh $StartTime    94.749391    95.00554    "for\S"
type.sh $StartTime    95.00554    95.251443    "the\S"
type.sh $StartTime    95.251443    95.502469    "peo"
type.sh $StartTime    95.502469    95.743249    "ple\S"
type.sh $StartTime    95.743249    95.999398    "who\S"
type.sh $StartTime    95.999398    96.498889    "are\n"
type.sh $StartTime    96.498889    96.752477    "still\S"
type.sh $StartTime    96.752477    96.99838    "al"
type.sh $StartTime    96.99838    97.999923    "ive."
type.sh $StartTime    97.999923    104.244838    "\CForms:\SFORM-55551-6:\nPersonnel\SFile\SAddendum\SAddendum:\n\nOne\Slast\Sthing:\n\n"
type.sh $StartTime    104.244838    104.503548    "Go\S"
type.sh $StartTime    104.503548    104.743048    "ahead\S"
type.sh $StartTime    104.743048    105.0056    "and\S"
type.sh $StartTime    105.0056    105.448738    "leave\S"
type.sh $StartTime    105.4513    106.096796    "me.\n"
type.sh $StartTime    107.99486    108.237562    "I\S"
type.sh $StartTime    108.237562    108.504597    "think\S"
type.sh $StartTime    108.504597    108.753062    "I\S"
type.sh $StartTime    108.753062    108.996403    "pre"
type.sh $StartTime    108.996403    109.444664    "fer\S"
type.sh $StartTime    109.74692    109.839134    "to\S"
type.sh $StartTime    109.839134    110.231042    "stay\S"
type.sh $StartTime    110.727331    110.902152    "in"
type.sh $StartTime    110.902152    111.523712    "side.\n"
type.sh $StartTime    113.246805    113.743787    "May"
type.sh $StartTime    113.743787    113.991595    "be\S"
type.sh $StartTime    114.091947    114.594389    "you'll\S"
type.sh $StartTime    114.732288    115.139157    "find\S"
type.sh $StartTime    115.210155    115.753557    "some\S"
type.sh $StartTime    115.753557    116.000683    "one\S"
type.sh $StartTime    116.000683    116.714752    "else\n"
type.sh $StartTime    116.714752    116.985088    "to\S"
type.sh $StartTime    116.985088    117.499819    "help\S"
type.sh $StartTime    117.499819    118.235733    "you.\n"
type.sh $StartTime    120.234581    120.503901    "May"
type.sh $StartTime    120.503901    120.735716    "be\S"
type.sh $StartTime    120.735716    120.967531    "Black\S"
type.sh $StartTime    120.99955    121.418333    "Me"
type.sh $StartTime    121.418333    121.90848    "sa...\n"
type.sh $StartTime    124.236373    124.432981    "THAT\S"
type.sh $StartTime    124.432981    124.73472    "WAS\S"
type.sh $StartTime    124.73472    124.867157    "A\S"
type.sh $StartTime    124.985941    125.30816    "JOKE.\S"
type.sh $StartTime    125.725952    125.996288    "HA\S"
type.sh $StartTime    125.996288    126.233856    "HA.\S"
type.sh $StartTime    126.233856    126.736299    "\B\B\B\B\B\B\B"
type.sh $StartTime    126.736299    126.861909    "FAT\S"
type.sh $StartTime    126.982059    127.656533    "CHANCE.\n"
type.sh $StartTime    129.226667    129.991253    "Any"
type.sh $StartTime    129.991253    130.695765    "way,\S"
type.sh $StartTime    130.695765    131.184555    "this\S"
type.sh $StartTime    131.184555    131.708843    "cake\S"
type.sh $StartTime    131.708843    131.987371    "is\S"
type.sh $StartTime    131.987371    132.487083    "great.\n"
type.sh $StartTime    132.487083    132.579925    "It's\S"
type.sh $StartTime    132.579925    132.915797    "so\S"
type.sh $StartTime    132.915797    133.248939    "de"
type.sh $StartTime    133.248939    133.497429    "lic"
type.sh $StartTime    133.497429    133.748651    "ious\S"
type.sh $StartTime    133.748651    133.99168    "and\S"
type.sh $StartTime    133.99168    134.300245    "moist.\n"
type.sh $StartTime    134.726229    134.999296    "Look\S"
type.sh $StartTime    134.999296    135.204096    "at\S"
type.sh $StartTime    135.204096    135.717461    "me\S"
type.sh $StartTime    135.717461    136.118869    "still\S"
type.sh $StartTime    136.118869    136.40832    "tal"
type.sh $StartTime    136.40832    136.667733    "king\n"
type.sh $StartTime    136.667733    136.968107    "when\S"
type.sh $StartTime    136.968107    137.200213    "there's\S"
type.sh $StartTime    137.200213    137.47328    "Sci"
type.sh $StartTime    137.47328    137.732693    "ence\S"
type.sh $StartTime    137.732693    138.095872    "to\S"
type.sh $StartTime    138.095872    138.557355    "do.\n"
type.sh $StartTime    138.748501    138.996992    "When\S"
type.sh $StartTime    138.996992    139.245483    "I\S"
type.sh $StartTime    139.245483    139.753387    "look\S"
type.sh $StartTime    139.753387    140.247637    "out\S"
type.sh $StartTime    140.247637    140.512987    "there,\n"
type.sh $StartTime    140.512987    140.703818    "it\S"
type.sh $StartTime    140.703818    140.939475    "makes\S"
type.sh $StartTime    140.939475    141.082919    "me\S"
type.sh $StartTime    141.082919    141.401825    "GLaD\S"
type.sh $StartTime    141.401825    141.656693    "I'm\S"
type.sh $StartTime    141.656693    142.224063    "not\S"
type.sh $StartTime    142.224063    142.738923    "you.\n"
type.sh $StartTime    142.738923    142.941281    "I've\S"
type.sh $StartTime    142.941281    143.233291    "ex"
type.sh $StartTime    143.233291    143.520178    "per"
type.sh $StartTime    143.520178    143.912086    "iments\S"
type.sh $StartTime    143.912086    144.227149    "to\S"
type.sh $StartTime    144.227149    144.701025    "run.\n"
type.sh $StartTime    144.701025    144.980227    "There\S"
type.sh $StartTime    144.980227    145.233815    "is\S"
type.sh $StartTime    145.233815    145.420804    "re"
type.sh $StartTime    145.420804    145.72306    "search\S"
type.sh $StartTime    145.72306    145.989455    "to\S"
type.sh $StartTime    145.989455    146.243042    "be\S"
type.sh $StartTime    146.243042    146.739972    "done.\n"
type.sh $StartTime    146.739972    146.990998    "On\S"
type.sh $StartTime    146.990998    147.239462    "the\S"
type.sh $StartTime    147.239462    147.482804    "peop"
type.sh $StartTime    147.482804    147.738953    "le\S"
type.sh $StartTime    147.738953    147.995102    "who\S"
type.sh $StartTime    147.995102    148.392133    "are\n"
type.sh $StartTime    148.392133    148.727689    "still\S"
type.sh $StartTime    148.727689    148.999207    "a"
type.sh $StartTime    148.999207    149.981218    "live."
type.sh $StartTime    149.981218    150.748705    "\CPS:\S"
type.sh $StartTime    150.748705    151.007415    "And\S"
type.sh $StartTime    151.007415    151.245634    "be"
type.sh $StartTime    151.245634    151.465922    "lieve\S"
type.sh $StartTime    151.465922    151.778424    "me\S"
type.sh $StartTime    151.778424    151.991028    "I\S"
type.sh $StartTime    151.991028    152.357321    "am\n"
type.sh $StartTime    152.357321    152.751791    "still\S"
type.sh $StartTime    152.751791    152.992571    "al"
type.sh $StartTime    152.992571    153.448516    "ive.\n"
type.sh $StartTime    153.448516    154.496166    "PPS:\S"
type.sh $StartTime    154.496166    154.744631    "I'm\S"
type.sh $StartTime    154.744631    154.987972    "do"
type.sh $StartTime    154.987972    155.133977    "ing\S"
type.sh $StartTime    155.133977    155.531008    "Sci"
type.sh $StartTime    155.531008    155.75642    "ence\S"
type.sh $StartTime    155.75642    155.992077    "and\S"
type.sh $StartTime    155.992077    156.399354    "I'm\n"
type.sh $StartTime    156.399354    156.745155    "still\S"
type.sh $StartTime    156.745155    156.996181    "al"
type.sh $StartTime    156.996181    157.431635    "ive.\n"
type.sh $StartTime    157.431635    158.497215    "PPS:\S"
type.sh $StartTime    158.497215    158.748241    "I\S"
type.sh $StartTime    158.748241    158.965968    "feel\S"
type.sh $StartTime    158.965968    159.211871    "FAN"
type.sh $StartTime    159.211871    159.496196    "TAS"
type.sh $StartTime    159.496196    159.762591    "TIC\S"
type.sh $StartTime    159.762591    159.990564    "and\S"
type.sh $StartTime    159.990564    160.372226    "I'm\n"
type.sh $StartTime    160.372226    160.746204    "still\S"
type.sh $StartTime    160.746204    160.99723    "al"
type.sh $StartTime    160.99723    161.501844    "ive.\n"
type.sh $StartTime    161.501844    162.733921    "\nFINAL\STHOUGHT:\n"
type.sh $StartTime    162.733921    162.984947    "While\S"
type.sh $StartTime    162.984947    163.220604    "you're\S"
type.sh $StartTime    163.220604    163.492122    "dy"
type.sh $StartTime    163.492122    163.735464    "ing\S"
type.sh $StartTime    163.735464    163.999297    "I'll\S"
type.sh $StartTime    163.999297    164.327168    "be\n"
type.sh $StartTime    164.327168    164.747253    "still\S"
type.sh $StartTime    164.747253    165.003402    "al"
type.sh $StartTime    165.003402    165.520823    "ive.\n"
type.sh $StartTime    165.520823    166.489066    "\nFINAL\STHOUGHT\SPS:\n"
type.sh $StartTime    166.489066    166.750338    "And\S"
type.sh $StartTime    166.750338    166.996242    "when\S"
type.sh $StartTime    166.996242    167.231899    "you're\S"
type.sh $StartTime    167.231899    167.498294    "dead\S"
type.sh $StartTime    167.498294    167.74932    "I\S"
type.sh $StartTime    167.74932    167.992662    "will\S"
type.sh $StartTime    167.992662    168.289795    "be\n"
type.sh $StartTime    168.289795    168.755986    "still\S"
type.sh $StartTime    168.755986    168.989082    "al"
type.sh $StartTime    168.989082    169.442465    "ive.\n"
type.sh $StartTime    169.442465    170.236528    "\n\n"
type.sh $StartTime    170.236528    170.75651    "STILL\S"
type.sh $StartTime    170.75651    170.976798    "A"
type.sh $StartTime    170.976798    171.417375    "LIVE"
type.sh $StartTime    171.417375    172.354881    "\C"
type.sh $StartTime    172.354881    172.78265    "STILL\S"
type.sh $StartTime    172.78265    173.028553    "A"
type.sh $StartTime    173.028553    173.449918    "LIVE\n"
echo -n 'wheatley@GLaDOS:~$ '
sleep 5
clear

So over one weekend I wrote three programs totaling 455 lines to replace 7,360 lines of unfinished code. (Keep in mind I already had the lyric file and previous knowledge from past attempts. This is at least the third try.) I’d like to add the original ASCII art, if I can get some help merging the lyrics with the art. I’d also like to replace “StillAlive.sh” with a more generic program, so does anyone know how to read line $number from a text file in shell? Post your suggestions in the comment, please.

 |\_/|
 |0 0|__
 =-*-=__\
c_c__(___)

-from the game robotfindskitten, used without permission. According to the license, I don’t need it. You should read the license before using it yourself, though.

UPDATE: Same day!

I can now export audio from audacity, with lyrics, and put both into a generic program! Now I don’t need to rewrite it! And it’s only been a week! I’ve got to thank Bruce Barnett for creating a “sed tutorial”. Now all that’s left is writing the ASCII art “lyrics”, and writing the code to merge them! (Second one’s harder. First one will probably be done today.) The program “TypeLyrics.sh” now reads:

SongFile=$1
LyricFile=$2
clear
echo 'Please wait a few seconds. |\_/|'
echo 'Some errors will appear,   |0 0|__'
echo 'the screen will clear,     =-*-=__\'
echo 'and music will then play. c_c__(___)'
echo ''
StartTime=`date +'%s.%N'`
mplayer -msglevel all=-1 $SongFile &
TotalLines=`wc -l $LyricFile | sed 's/\([0-9]*\).*/\1/'`
for (( LineNum=1; LineNum <= TotalLines; LineNum++ ))
    do
        CurrentLine=`sed "$LineNum q;d" $LyricFile`
        type.sh $StartTime $CurrentLine
    done

“StillAlive.sh” now reads:

bin/TypeLyrics.sh ~/StillAlive.flac ~/Still_Alive_labels.txt

Much simpler! Now the line count is down to 97, and only one line needs to be changed per song!

Posted in Linux, Portal, Programs, Shell | 1 Comment

Hypocrits in Congress?!!!

You may have heard in the news about such countries as China, Iran and Syria censoring the Internet. Despite US citizens in general complaining about such actions, the revolution in Egypt, Congress is reviewing a law that could censor entire web pages. If this bill were to pass, and a link to another site was considered dangerous, even without reason, then any site containing that link would be shut down. Since anyone can post these links, social networks are at MAJOR risk! YouTube, Facebook, WordPress, Wikipedia, email, and more could be shut down within seconds! This not only means that you will have to find another way to express yourself on a global scale, but it would also put millions out of work. This is a direct contradiction to the First Amendment, the right to free speech, and the Fourth Amendment, protection against unreasonable search and seizure.

Some critical websites to visit:

Mozilla

American Censorship.org

The Electronic Frontier Foundation

There is a limit to how much I can fit here, but I would appreciate any and all opinions in the comments.

Posted in Uncategorized | Leave a comment

To the polls!

I have noticed that most of my comments exist in my article Checking NVIDIA graphics card temperature in shell. One of the latest comments put explained exactly what I feared was the case: my articles are too long/detailed. I therefore decided to create a poll about how to remedy this problem.

In addition, I can’t work on or publish all of my projects at once, so I decided to create a pair of polls that will allow you, my readers, to suggest an order for me to work in, according to popularity.

You can vote on each poll once a day, so be sure to check back regularly. I will close the poll on my longer articles in about two weeks, and the polls on my project will simply be edited as needed.

Posted in Polls | Leave a comment

Just an update:

A lot of the projects I work on take a long time to complete, and I like to make them work before posting them and showing how to do them. Unfortunately, the projects I’m working on could take a while to complete, so I’ll look through some of my completed projects to see what else I can post.

I’ve noticed I have a regular viewer, or maybe just a different person everyday, but I’m guessing the former. Either way it makes me smile in the morning. :) I have set up several ways to subscribe to this post on the right panel, but I haven’t seen any sign of these working yet. I have no idea how to fix that, so I’m just going to hope someone can post that in the comments or that it will be fixed automatically without my participation.

As long as I’m providing this update, I might as well publish some projects I’m working on:

  • custom Compiz magnifier overlays
  • Portal Music Videos
  • Still Alive for gnome-terminal
  • “Space Core Impact” (Space Core and Wheatley after the events of  Portal 2)
  • Programs for the TI-84

…I thought that would have been larger, considering I’ve used all 20 virtual desktops on my computer working on them! Now some things that I’ve finished: feel free to suggest an order for me to post these.

  • quadraphonic Nyan Cat
  • quadraphonic mixes of Symphony of Science and possibly other titles
  • Ding Dong the Witch is Dead, made to sound the way it was recorded
  • color ASCII art (It’s on my DeviantArt account already, but I could post it here as well. It might actually make the description shorter by moving the instructions here)
  • invisitree (An invisible Christmas tree, also posted on my DeviantArt page. The lights seem to float in the air.)
  • staring pictures (based upon the ones at Disney’s Haunted Mansion)
  • Darth Vader meets GLaDOS: I find your lack of cake disturbing (It’s on my DeviantArt page)
  • The Square Root of Rope is String (Brought to you by Portal 2′s Fact Sphere)
  • My music video for Brad Sucks’s song “Work Out Fine”, now on his website
  • Various spreadsheets related to math and physics
  • “Wheatley the Genius” (On my DeviantArt page, involves a screenshot and a translation)
  • custom BlueProximity icons
  • custom disc icons in Ubuntu
  • custom Ubuntu schemes
  • virtual discs (CDs, HDDs, game ROM)
  • scaling CPU frequency through shell

…and finally some neat stuff I’m not responsible for:

  • tineye, searches for images similar to one that you provide
  • My OS of choice: Ubuntu (I remove Unity, the Mac-like interface, and add my own software before using it)
  • Some neat panoramas
Posted in Uncategorized | Leave a comment

Checking NVIDIA graphics card temperature in shell

Let’s face it: Linux has awesome graphics. It’s still the only OS that supports Compiz effects (some of which were illegally copied by Apple), such as the famous desktop cube. But not every computer can handle these. These require you to use drivers for graphics cards from NVIDIA or ATI (though there are probably more). I have an NVIDIA graphics card, but if the graphics get slow, or I hear my computer’s fan working really hard, it makes me curious how hot my GPU is, and it’s a pain in the neck to get administrative privileges and sort through settings with a busy graphics card. So instead, I wrote another shell script.

Some of you may be wondering why I bother with shell. Sometimes there isn’t a graphical utility to access something. I don’t know how to write a GUI (at least, not for a NORMAL computer), and shell is pretty easy to learn. At least according to me, a programmer with years of experience…

nvidia-settings -q gpucoretemp -t

returns the temperature in Celsius. I really do prefer Metric, but I’m going to be hypocritical and use Fahrenheit. This requires a conversion which involves simple math that I won’t bother to type, since My computer already has ConvertAll, a program to convert any unit combination to any compatible unit combination. First we need to save the Celsius value to a variable, though.

CoreTempC=$(nvidia-settings -q gpucoretemp -t)

The parentheses allow the command “nvidia-settings -q gpucoretemp -t” to be treated as a single value. The dollar sign makes sure it returns “x” in Celsius instead of giving the variable the textual value “nvidia-settings -q gpucoretemp -t”. “CoreTempC” is the variable name, and the equal sign sets “CoreTempC” to the correct temperature. Variables can be entered into programs as “$VariableName” wherever you want to place their value. Now to convert.

CoreTempC=$(nvidia-settings -q gpucoretemp -t)
CoreTempF=$(convertall $CoreTempC C F -q)
echo $CoreTempF

That’s it! Save it as a text file, and be sure to make it executable through the file properties. Drag the file into a terminal window and hit enter to see your computer’s temperature. The format is “36 C = 96.8 F”, as an example. Now if you want to put this in a GUI or a screensaver, all you have to do is type it where it belongs. For example, the fish applet:

Thermal Fish applet

Or xscreensaver:

Hopefully this will be as useful to you as it is for me.

Posted in Linux, Programs, Shell | Leave a comment

GLaDOS invades Ubuntu!

In this post, I will be including text in “quotes”. This is to indicate a special use. “Text in quotes” should be typed as directed. Formating such as “Ctrl+V” is used to indicate keyboard shortcuts. Formating such as “Edit>Undo” is used for menus. Keep in mind that everything is CASE SENSITIVE, meaning “cat” is not the same thing as “CAT”.

Thanks to BlueProximity, my computer now talks to me when my phone leaves my computer, or when it gets close to my computer. This has been the main reason I carry my phone today. Here’s how it works:

BlueProximity can be downloaded through the Ubuntu Software Center. It tracks how far away your phone is, and locks your computer if you go too far away, then unlocks your computer if you get close enough. It also lets you set such things as how far away is too far, how far away is too close, and what program to run to lock or unlock your computer.

Focus on the top two.

That last part is important! You can have it run any program, not just lock or unlock your computer! But, I don’t just want to lock my computer, I also want to play a random sound file from a folder, and maybe control a running application. Here is where shell scripts come in handy.

In Linux, you can save a text file anywhere on your computer as an executable text file. This means that the document can be edited as text, or run as a program. The general format is as follows: each line of the document acts as it would in a terminal. For every application, there is a line of text that means the same thing in the terminal. For example, the screensaver and locker application is called “gnome-screensaver”. These commands can also hold options, or in some cases, other commands that will accept the options. There is a simple way to check for these options and commands.

Most Ubuntu users access their programs through the main menu icon in the upper-left hand corner of their screen. Right clicking on it allows you to edit the menus, or at least navigate to an application in a familiar way.

Right click Ubuntu logo, then click here.

Once you’ve highlighted a program, click edit and remember the text in the field “command”, or copy it straight into a text file. Please note that if there is a space, you can almost always delete the space and everything after it. Anything after the space is an option, possibly looking for a specific file after it. There are some exceptions, and I am about to go over general rules for finding them.

At this point in time, you will need to open a terminal of your choice. For simplicity, I am going to open the default terminal located under accessories in the main menu. Advanced users can press “Ctrl+Alt+T” or “Alt+F2″ followed by the terminal of their choice, like “bash”, or “gnome-terminal”. Now type “man ” followed by the command of your choice in your terminal. “man” is the manual application for most Linux applications. In this case, the application you type is accepted as an argument, specifying which program manual you want to read. Let’s start with “gnome-screensaver”, the default Ubuntu screensaver (Ubuntu is based on Gnome).

Typing “man gnome-screensaver” into your terminal, or copying the text in quotes and pasting it into terminal through “edit>paste” or “Ctrl+Shift+V” and pressing enter will result in something like this:

the gnome-screensaver man page

To navigate this document, use the arrow keys, page up/down, and home/end on your keyboard to scroll through the document. To exit, type “:q”. (NOTE: 11.10 uses “q” instead, and displays a lovely reminder about this.)

Toward the bottom of this document, you will see something titled “SEE ALSO”. This usually contains a list of related programs, or a list of other common options, in this case GTK options. However, some applications, like the Gnome screensaver, the X screensaver, and Rhythmbox, use a different application for command line controls. As the default BlueProximity settings indicate, we actually want to read the gnome-screensaver-command man page.

Typing “man gnome-screensaver-command” into terminal should bring up something more useful.

the gnome-screensaver-command man page

The description mention “gnome-screensaver”, just as expected. At the bottom of this screen, we see the -l option that was shown in BlueProximity, but its description is cut off. Scrolling down will fix this.

the gnome-screensaver-command man page continued

Now we can see both commands of interest. “gnome-screensaver-command -l” locks the computer, and ”gnome-screensaver-command -d” unlocks the computer. (I’m ignoring the poke command, which didn’t seem to affect anything.) I recommend that at this point in time you find a folder on your computer that you won’t see everyday. and create a folder with the name “executable_text” or similar, you decide what you actually call it. I also recommend that the folder doesn’t contain any spaces (underscores and dashes are fine), as they are a pain to reference in terminal. Within this new folder, you will write your first two executable text files.

First create a text file, one whose name ends in “.txt”, not “.doc” or “.odt”. Because this doesn’t involve any sort of formating, you can use “Accessories>Text Editor” for this. Save the first document as “unlock.txt”, as we will be working on a program to unlock your computer first. The first line should read “gnome-screensaver-command -d” so it actually unlocks your computer.

To make this application play sound files, I just had to tell a music player to play a sound file in one of the lines of the text file. while the default music player, “totem”, can play files, I didn’t want to close anything I was playing in totem, or leave a window open whenever I approached my computer, so I chose “mplayer”, a music player for terminal. The line I added was “mplayer ” and a file name, with the full path, which you can probably figure out if I tell you your music folder is in “/home/(your username)/Music”.

To make everything a little more random, I copied the code from Melanie Gross’s program. I made several changes, which can be seen in the final code below. Remember to make a similar program for locking!

You may also want to set an application to do something while you’re away. I set BOINC to work on such projects as World Community Grid and SETI. To set it to automatically run faster while I was away, I checked the man for “boinc”, which showed “boinccmd” under “SEE ALSO”. I then checked for anything useful under the options for “boinccmd”. By typing “boinccmd –set_run_mode always” in the line before “gnome-screensaver-command -d”, I was able to set this to run as fast as it wanted. To reverse the effects, I typed “boinccmd –set_run_mode auto” in the line before “gnome-screensaver-command -d”.

The final code for unlock.txt is [

#set BOINC to normal priority
boinccmd --set_run_mode auto
#unlock screen
gnome-screensaver-command -d
#pick a random sound file
soundsfolder="/home/tim/Public/Files/sound/computer/Sounds/BlueProximity/unlock"
echo "sounds are in" $soundsfolder
cd $soundsfolder
pwd
echo "working in" $soundsfolder
files=(././*)
N=${#files[@]}
echo “found” $N “files”
((N=RANDOM%N))
echo “picked file” $N
randomfile=${files[$N]}
echo $randomfile
randomfile=cut –characters=5- $randomfile
echo “file name is” $randomfile
#play it
mplayer “$soundsfolder/$randomfile” -msglevel all=-1

]. The final code for lock.txt is [

#set BOINC to high priority
boinccmd --set_run_mode always
#unlock screen
gnome-screensaver-command -l
#pick a random sound file
soundsfolder="/home/tim/Public/Files/sound/computer/Sounds/BlueProximity/lock"
echo "sounds are in" $soundsfolder
cd $soundsfolder
pwd
echo "working in" $soundsfolder
files=(././*)
N=${#files[@]}
echo “found” $N “files”
((N=RANDOM%N))
echo “picked file” $N
randomfile=${files[$N]}
echo $randomfile
randomfile=cut –characters=5- $randomfile
echo “file name is” $randomfile
#play it
mplayer “$soundsfolder/$randomfile” -msglevel all=-1

]

When working with these, it might be easiest to use the default text editor, and select “View>Highlight Modes>Scripts>sh”, since this is technically a shell script, meaning you could also save this as a sh file. In any event, when you are done editing a file remember to right-click the file, click “properties”, go to the “Permissions” tab, and give the file executable permissions! Failure to do so will make the file an ordinary text file, and it won’t run as a program. Once the permission has been changed, you can double-click the file and tell it to run. If you try the lock command, you will have to enter your password.

Now you must tell BlueProximity to run the files.

Focus on the top two.

Change the top line to your new lock command, remembering to type the address. Same idea with the bottom line.

Much better.

For some reason, some of the commands used in my program won’t run unless they run through terminal. To fix this, I simply run the files through bash, the terminal. Now my computer can play sound from the folders you specified earlier.

Now you might be wondering about how GLaDOS fits in all of this. My lock folder and my unlock folder are FILLED with sound files from Portal and Portal 2, including the turrets, GLaDOS, Wheatley, Cave Johnson, Caroline, and even the announcer. When leaving my computer, I now hear GLaDOS saying “Make no further attempt to leave the testing area.”, or a turret asking “Are you still there?”. They are also set up to talk when I get back, such as GLaDOS welcoming me to the enrichment center. Now that I have shared this fun project I think it’s time to say goodbye for now.

Cave: “Say goodbye Caroline.”

Caroline: “Goodbye Caroline.”

Update #1: I figured out how to always play through the speakers, even if the default is headphones! At the last line of both programs add “ -ao alsa:device=hw=0.0″. The first number is which sound card, the second which output on that sound card. If you have digital headphones, HDMI outputs, or other digital audio outputs, they will count as a sound card, although not your primary sound card, and I could be wrong if you connect such a device to an existing sound card. The second number changes with the output on a sound card, so speakers on a computer may be 0.0, but headphones might be 0.1. I used Audacity, a professional audio editor, to check the correct output. To check, click “View>Toolbars>Device Toolbar”. Then a new toolbar will appear near the bottom, with output devices on the left, input devices on the right. Focus on the options near the top, the ones that end in (hw:#,#). Judging by the name, select a few that feature the company name of your sound card. Import a sound file through “File>Import>Audio”, or “Ctrl+Shift+I”, and play the file, listening for it to play through your desired sound output. Then copy the number from Audacity as “a,b” and paste it into my code as “a.b”. I think there is an easier way to use the option “ -ao alsa:device=hw=0.0″, but this one works for me.

Update #2: For those of you using Ubuntu since 11.04, you cannot see the command for your programs from the dash/launcher. I was still using 10.10 when I made this, but I now know how to fix this problem, at least temporarily. You can install the menu editor from 10.10 and earlier with “Main Menu”, also known as “alacarte”.

And for those of you using Android Phones (and possibly others): If your device doesn’t stay reliably connected to your computer, check the available Bluetooth channels from BlueProximity. On my Droid, Channel 7 is unavailable, but several other channels are open for communication. Each one is responsible for an action, like contacts and audio connections, and your Droid will tell you which one your computer is using from its Bluetooth settings, so pick one you feel comfortable with. For me, it was the sound system. Regardless of your choice, all BlueProximity does is ask “Are you still there?”, to which the reply is either “Yes.” or “…”, except in computer code, so nothing will really be read or changed.

Posted in Linux, Portal, Portal 2, Programs, Shell, Ubuntu | 2 Comments

Hello world!

Normally, “Hello world!” is a program written by beginners to display the text “Hello world!” on a screen and then quit the program. My first program was for a robot with a screen that couldn’t display text, and besides, this is a blog! Here I will post about many interesting projects, preferably mine more than those of others.

Here are a few of my sites:

http://nicknackgus.deviantart.com/

http://www.youtube.com/user/NickNackGus/

Some websites I visit:

http://www.thenxtstep.blogspot.com/

http://botbench.com/blog/

http://www.evilmadscientist.com/

http://www.philohome.com/

…and some funny comics I read:

http://markleybros.com/

http://stupidfox.net/

http://www.garfield.com/comics/todayscomic.html

http://www.garfield.com/usacres/todayscomic.html

http://www.dilbert.com/

http://www.foxtrot.com/

http://averagecats.com/

Posted in about me | Leave a comment