≡ Menu

Prepulator

A toy program for demonstrating Python functions:

#==============  readChoice ==============  
def readChoice():

    choice = "bogus"
    while choice not in("S", "D", "R", "N", "E"):
        #**** Functions can invoke other functions. Here we're invoking the print() function.
        print("********************************")
        print("(S)quare")
        print("(D)ouble")
        print("(R)eciprocal")
        print("(N)egate")
        print("(E)xit")
        choice = input('Choose from the functions above: ').upper()

    return(choice)

#==============   readX ==============
def readX():

    hasGoodX = False
    while not(hasGoodX):
        try:
            x = int(input('Enter your x: '))
            hasGoodX = True
        except ValueError:
            print("Try again. x must be an integer.")

    return(x)

#==============  printResult ==============
#****** Functions can accept many arguments. Here we're accepting a string and 2 integers.
def printResult(funcName, originalX, result):
    print("The " + funcName + " of " + str(originalX) + " is " + str(result) + ".")

#==============   square ==============
def square(x):
    return x * x

#==============   double ==============
def double(x):
    return x + x

#==============   reciprocal ==============
def reciprocal(x):
    return 1/x

#==============   begin main program ==============
choice = "not E"
while(choice != "E"):
    choice = readChoice()
    if (choice != "E"):
        x = readX()

    if (choice == "S"):
        printResult("square", x, square(x))
    elif (choice == "D"):
        printResult("double", x, double(x))
    elif (choice == "R"):
        printResult("reciprocal", x, reciprocal(x))
    elif (choice == "N"):
        print("Rats! I forgot to implement Negate. Why don't you try it?")

Dell Latitude Slowed by Low Power

I recently experienced poor (slow) performance from a brand new Dell Latitude laptop. I googled and googled and couldn’t find the answer, but our IT department knew the problem. I’m writing it up here so maybe some other lonely soul experiencing it can arrive here via google.

I recently got a new Dell Latitude at work. I immediately noticed something was wrong. Whenever I docked it the speed dropped noticeably. Something wrong with the graphics? Any kind of drawing to the screen was choppy. Maybe it’s network related? Any network requests took dramatically longer than normal. It actually seemed like it was slower on every kind of task.

When I undocked it would be back to normal. My docking station is 6 years old; maybe it wasn’t as compatible as advertised.

I found a few promising hits on google that suggested it might be underclocking the CPU when docked. They suggested it was some kind of ventilation and heat problem, and the machine’s way of handling that was dialing back the processor speed. That sounded iffy to me. Furthermore, Task Manager showed my CPU usage was very low.

Defeated, I filed a help desk ticket. In 15 minutes our world class IT department replaced my old 65 watt power supply (which worked fine on my older notebook machines) with a new higher power supply (I think it’s 100 watts). Problem solved.

In summary: if you’re experiencing lagging performance from your Dell notebook, check if your power supply is underpowered.

Latest Project – Credit Card Bonus Monitoring

I just launched a brand new project at CreditCardBonusCategories.com.

I’m always optimizing my credit card cashback rewards. I figured, “As long as I’m putting in the effort to stay on top of these credit card bonuses, why don’t I publish my findings for others to benefit?” So that’s what I’ll do at CreditCardBonusCategories.com. I’ll be sharing various hacks, reviews, and commentary on the offers available from the best cards. So if you’re interested in ringing a bit more cash from your cashback cards, check out my newest project: CreditCardBonusCategories.com.