How To Edit the Hosts File in Windows 7

Posted by Brian R Cline | Windows | Saturday 21 August 2010 8:12 am

I’m an Administrator on my installation of Windows 7 and had to edit the hosts file for one of my projects. I wasn’t able to make the changes though because it kept saying file was in use. I realized that I need to run notepad as the administrator and then I could make my changes!

  1. I went to the start menu, and typed in notepad.
  2. Right clicked on the notepad icon and selected Run As Administrator
  3. Clicked yes when it confirmed whether it should
  4. Navigationed to c:\Windows\System32\drivers\etc\hosts

Hope this helps!

Installing PHPUnit on WAMPServer

Posted by Brian R Cline | PHP,Programming,Windows | Tuesday 29 June 2010 9:19 pm

Test Driven Development and xUnit seem to be popular among many of the professional and very public programmers, so I thought I might like to give it a whirl and see if I can improve the flexibility of my source code and better decouple objects. Unfortunately, I use WAMPServer on Windows as a development server while at work so directions for installing PHP related plugins/PEAR aren’t exactly identical. (Usually, I can figure it out fairly quickly.)

Installing WAMPServer is fairly quick and well documented online, so I won’t cover it specifically although I will mention I am using WAMPServer v2 at time of this writing. I will also assume that you have used the default file paths of “C:\wamp” and “C:\wamp\www”

Steps to installing PHPUnit:

  1. Install PEAR if you haven’t already by opening up a new command window and entering the following commands

    cd \wamp\bin\php\php5.3.0
    go-pear.bat
  2. Press enter when the list of directories appears
  3. When asked if you want PHP.ini to be modified press Y and then enter.
  4. You will be told the include path is updated. Press enter.
  5. You be will be told PEAR_ENV.reg has been created.
    PEAR_ENV.reg
  6. Pear is installed, but it isn’t the newest version of the updater, so we should update because PHPUnit requires at least PEAR Updater 1.8.1
    pear update-channels
  7. Thankfully, we are nearly done our journey. We simply need to add a channel to PEAR and then we can install!
    pear channel-discover pear.phpunit.de
    pear install –alldeps phpunit/PHPUnit

Good luck testing and keep checking back to see how to test!

Reducing Download Speed in Firefox (Throttling)

Posted by Brian R Cline | Experience,Firefox,Windows | Monday 28 June 2010 7:20 am

At work, I often need to download extremely large files (software updates, etc) that can severely cripple internet usage for other staff. Unfortunately, additional bandwidth or internet providers aren’t currently available in our area and purchasing new hardware is out of the question because of budget constraints. Typically, I use Mozilla Firefox on Windows XP so finding an addon to better throttle my downloads shouldn’t be difficult. I also would like to be able to restrict only bandwidth to certain sites and not restrict any internal network traffic whatsoever.

Conveniently, Firefox Throttle meets my needs exactly and allows exclusions for specific websites or specific IP Addresses.

  • Included Features:
  • Limit download and upload rates for all open Firefox windows/tabs and downloads
  • Bursting mode (allow short rate “bursting” after inactivity)
  • Preset and custom limits
  • Configurable lists for IP addresses and domains that should be throttled or excluded from throttling
  • Automatically excluded LAN IPs

After running, Firefox Throttle for four hours I have found it to meet my needs and have also found out there’s a plugin for Internet Explorer too called IE Throttle.

Skype API Basics – Part 1

Posted by Brian R Cline | C#.NET,Programming,Windows,linux | Thursday 3 June 2010 5:48 pm

What is the Skype API?
The Skype API is an easy way to create plugins that can dramatically change the way Skype functions. For example, we could make a program that reads messages out loud as we receive them instead of having to check for new messages.

The Skype API is potentially very different for each of the operating systems Skype is available for. And, of course, there are different wrappers of the API available for some of the different languages.

What Operating Systems Are Supported?

  • Linux
  • MAC
  • Windows

What Languages Are Supported?
The Windows API,Skype4COM, is supported in literally any language that can import an ActiveX DLL or using a bit of hackery and some Skype commands we can also use Windows Messages via the Win32 SendMessage API .

Wrappers are available for additional languages that aren’t necessarily updated as frequently as Skype4COM. Skype4Java is a completely cross platform, language specific, implementation of the Skype API. Unfortunately, Skype4Java is infrequently updated and often lags behind the other implementations. Skype4Py is the other language specific implementation of the Skype API and can be used with Python on Windows and Linux.

What is Skype4COM?
Skype4COM is an ActiveX dll for use on Windows. Basically, it offers us a collection of properties, objects, and interfaces that we can use to manipulate Skype. By default, Skype4COM is installed with the Skype Extras although I always think it is prudent to provide it with our application and reference the included version.

What is Skype4Java?
Skype4Java is an older language specific wrapper for use with Java and is pretty much outdated and dying. I haven’t personally used Skype4Java, but have noticed it hasn’t been updated since 2006.

What is Skype4Py?
Skype4Py as previously mentioned is the language specific wrapper for Python and is fully supported on Linux and Windows. Skype4Py contains two different naming schemes: one follows the norms of Python, and the other set of naming conventions resembles Skype4COM.

Why use the Skype API?
There are a lot of interesting applications that make use of Skype to do telemarketing (predictive dialing even!), make Skype act like a fax machine, and even completely replace the need for a telephone! Unfortunately, my first use of the Skype API was to monitor employees that were deleting their Skype history and copy all of the messages sent and received to a location.

How should I get started?
Usually, I start reading a little bit about the API before, I begin to use it but I don’t ever focus in enough to learn the API completely unless I absolutely need to. Instead of spending your time focusing on learning APIs you should instead focus on learning computer programming fundamentals or some website development fundamentals.

More coming next week!

Dell Studio: Epic Fail

Posted by Brian R Cline | Computer Maitenance,Dell,Experience,Uncategorized,Windows | Friday 5 February 2010 12:26 pm

At work today, I had a user come see me regarding his keyboard suddenly not working on his Dell Studio 1550 laptop which the company bought about a month ago. Keys being pressed weren’t being sent properly to Windows 7, and LEDs weren’t properly lit.

Solution:

  1. Remove the battery
  2. Press and hold the power button for about 10seconds

Apparently, this solution removes static build up?

PHP On IIS & My Epic Battle (Failed to write session data)

Posted by Brian R Cline | PHP,Programming,Windows | Friday 2 October 2009 5:41 pm

Recently, I have been busy using Windows Server 2003 and IIS to host a web-enabled application written in PHP,using the PEAR modules, and MySQL and MS SQL.

I couldn’t really believe how much messing around is necessary to get PHP to function correctly, and to properly use the PEAR modules. I have probably spent two hours modifying the php.ini file based on what I have found on php.net and around the internet.

My webapp, needed sessions and of course I kept getting warnings and critcal errors from PHP. I found so much information that was just plain wrong and probably never was correct. My latest problem in this epic battle was this warning:

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0

Eventually, I read through my PHP.ini file from start to finish and found this information:

; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP’s session functions.

;
; As of PHP 4.0.1, you can define the path as:
;
; session.save_path = “N;/path”
;
; where N is an integer. Instead of storing all the session files in
; /path, what this will do is use subdirectories N-levels deep, and
; store the session data in those directories. This is useful if you
; or your OS have problems with lots of files in one directory, and is
; a more efficient layout for servers that handle lots of sessions.
;
; NOTE 1: PHP will not create this directory structure automatically.
; You can use the script in the ext/session dir for that purpose.
; NOTE 2: See the section on garbage collection below if you choose to
; use subdirectories for session storage
;
; The file storage module creates files using mode 600 by default.
; You can change that by using
;; session.save_path = “N;MODE;/path”
;
; where MODE is the octal representation of the mode. Note that this
; does not overwrite the process’s umask.

In conclusion, if you will run your web-enabled application on a Windows PC you must set the session.save_path to something and you must create the directory structure yourself. I am using the session.save_path = “C:\temp” and recommend you do something similiar.