Fix Dell laptop keyboard with Scotch tape
Jan 28, 2010 Technology, Work
Since I work with so many laptops on a daily basis something is always broken around my desk. Either re-loading the operating systems, software issues, screws loose or broken keyboards, it never ends! Many of our laptops are reaching the end of their warranty or we need to get the laptop back out into the field in a pinch so we get creative. One recent issue is that the laptop with a problem was out of warranty and the keyboard would just start typing random characters when you push down on the case between the touchpad and the keyboard. If the laptop was still under warranty I would call Dell and get a replacement keyboard and the problem would be solved. Below is a quick/dirty/temporary fix to this issue if you have no way to replace the keyboard entirely.
Step 1: Remove the keyboard from the computer. Usually there is a cover that goes over the top of the hinges and has the power button on it. You will need to remove the 2 screws that are under this cover along with removing the ribbon cable connecting the keyboard to the motherboard. (I am showing a Dell Latitude D520 below)
Step 2: Look at the ribbon cable on the keyboard and look for a small wear mark near the keys.
Step 3: Place a small piece of clear Scotch tape or other rather thin tape over this wear mark. This tape acts just like the plastic covering the wires on this inside of this cable and keeps the case from making contact to these wires.
Now just put the laptop back together and try it out. When placing your wrists on the palm rest while typing it should no longer randomly type characters until this tape gets a wear mark in and needs to be replaced.
Tip: Choppy playback of video on computer from Canon 7D
Jan 24, 2010 Photography
I had previously been rather disappointed with the quality of video playback from the video that the Canon 7D takes. When I would open the videos using VLC player or any other media players I have installed the video would be all choppy. After doing some searching I came to the conclusion that it was more than likely my slower compact flash (CF) card which is a 4GB 133x card which only operates at 20.0 MB/s. Since CF cards now go up to 667x (100 MB/s) I thought this is a very plausible situation. I now have a new 16GB 400x (60 MB/s) card waiting to come in the mail to see how much that helps. However, after taking some spur of the moment video of some friends kids while over at my house and previewing the video on the camera the video played back just fine. With this new information I started doing even more searching and I found this tip on how to have smooth playback in VLC and it seems to work rather well.
Step 1: Open VLC player and navigate to the Tools menu and select Preferences.
Step 2: In the lower left corner of the Preferences dialog box change Show Settings from “Simple” to “All”.
Step 3: Then navigate to Input & Codecs > Other Codecs > FFmpeg and change the option called “Skip the loop filter for H.264 decoding” from “none” to “all”
Now try to play your video back again and see the difference.
When you hover your mouse over this select option it says:
Skipping the loop filter (aka deblocking) usually has a detrimental effect on quality. However it provides a big speedup for high definition streams.
Now you can enjoy smooth playback of your video from your Canon 7D DSLR.
Make Firefox open new tabs at end of tab row
Jan 23, 2010 Technology
So you have recently upgraded Firefox and you have noticed that when you open a link in a new tab that it does not open at the end of the tab row. Here is an easy way to fix this:
- Open a new tab/window and type “about:config” in the address bar – You may need to click the “I’ll be careful, I Promise!” button to let you continue opening this page.
- Do a search for: “browser.tabs.insertRelatedAfterCurrent”
- The default value for this key is true. Double click the key value to change it to false.
- Close out of the about:config
Enjoy opening new tabs at the end of the tab row. If you want to revert back to the related tabs opening right after the other just change the value back to true.
Using Notepad++’s Function List plugin for PHP development
Jan 22, 2010 PHP Coding, Web Development, Work
One thing I really love about Notepad++ is the plugin’s that are available. One of such plugins that I enjoy is the Function List plugin to automatically search my code to pull classes, functions and much more into an easy to see pane on the right side of my screen. I had previously posted tutorials on another site but now I have made the process for “installing” these new rules easier by posting the XML as well as adding more features. Once you have followed the below steps the Function List plugin will show all of the following:
- PHP classes
- PHP class variables – (public, protected and private)
- PHP functions – already does this by default
- CodeIgniter Views
- CodeIgniter Helpers
- CodeIgniter Libraries
- CodeIgniter Models
- PHP include()
- PHP include_once
- PHP require()
- PHP require_once()
Update: I updated the instructions based on a comment below to close Notepad++ while editing the .xml file
Step 1: Close Notepad++
Step 2: Navigate to C:\Program Files\Notepad++\plugins\Config – This is the default installation folder, it may be different on your system.
Step 3: Open the FunctionListRules.xml file in your favorite editor other than Notepad++. The settings may not save if you open this file in Notepad++.
Step 4: Do a search for the following line: (This will more than likely be at the end of the file.)
<Language name="PHP" imagelistpath="">
Step 5: Add the following code between the opening and closing Language tags:
<Group name="Classes" subgroup="Functions" icon="0" child="0" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="\{" keywords=""> <Rules regexbeg="class" regexfunc="[\w_ ]+" regexend="" bodybegin="\{" bodyend="\}" sep="" /> </Group> <Group name="Class Variables" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="public\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" /> <Rules regexbeg="protected\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" /> <Rules regexbeg="private\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Functions" subgroup="" icon="0" child="0" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="\{" keywords=""> <Rules regexbeg="function[\s&]+" regexfunc="[\w_]+" regexend="\s*\(.*\)" bodybegin="\{" bodyend="\}" sep=";" /> </Group> <Group name="CodeIgniter Views" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='\$this->(.*)load->view\(['"]' regexfunc='["\/\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="CodeIgniter Helpers" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="\$this->(.*)load->helper\(array\(" regexfunc='[',"\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> <Rules regexbeg='\$this->(.*)load->helper\(['"]' regexfunc='["\w_]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="CodeIgniter Libraries" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="\$this->(.*)load->library\(array\(" regexfunc='[',"\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> <Rules regexbeg='\$this->(.*)load->library\(['"]' regexfunc='["\w_]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="CodeIgniter Models" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="\$this->(.*)load->model\(array\(" regexfunc='[',"\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> <Rules regexbeg='\$this->(.*)load->model\(['"]' regexfunc='["\w_]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Include" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='include\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Include Once" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='include_once\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Require" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='require\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Require Once" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='require_once\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group>
My full section including the Language tags looks like this:
<Language name="PHP" imagelistpath=""> <CommList param1="#" param2="" /> <CommList param1="//" param2="" /> <CommList param1="/\*" param2="\*/" /> <Group name="Classes" subgroup="Functions" icon="0" child="0" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="\{" keywords=""> <Rules regexbeg="class" regexfunc="[\w_ ]+" regexend="" bodybegin="\{" bodyend="\}" sep="" /> </Group> <Group name="Class Variables" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="public\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" /> <Rules regexbeg="protected\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" /> <Rules regexbeg="private\ " regexfunc="\$.*[^;]" regexend=".*;" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Functions" subgroup="" icon="0" child="0" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="\{" keywords=""> <Rules regexbeg="function[\s&]+" regexfunc="[\w_]+" regexend="\s*\(.*\)" bodybegin="\{" bodyend="\}" sep=";" /> </Group> <Group name="CodeIgniter Views" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='\$this->(.*)load->view\(['"]' regexfunc='["\/\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="CodeIgniter Helpers" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="\$this->(.*)load->helper\(array\(" regexfunc='[',"\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> <Rules regexbeg='\$this->(.*)load->helper\(['"]' regexfunc='["\w_]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="CodeIgniter Libraries" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="\$this->(.*)load->library\(array\(" regexfunc='[',"\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> <Rules regexbeg='\$this->(.*)load->library\(['"]' regexfunc='["\w_]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="CodeIgniter Models" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="\$this->(.*)load->model\(array\(" regexfunc='[',"\w_ ]+' regexend="" bodybegin="" bodyend="" sep="" /> <Rules regexbeg='\$this->(.*)load->model\(['"]' regexfunc='["\w_]+' regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Include" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='include\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Include Once" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='include_once\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Require" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='require\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group> <Group name="Require Once" subgroup="" icon="0" child="0" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg='require_once\(['"]' regexfunc="*.*[\w]" regexend="" bodybegin="" bodyend="" sep="" /> </Group> </Language>
Step 6: Save and close, then open up a PHP file in Notepad++ to see if it shows the desired output in the Function List tool.
Tags: CodeIgniter, Coding, Function List, Notepad++, PHP, XML
Notepad++ upgrade
Jan 21, 2010 Technology, Web Development, Work
At work my main workstation is a Microsoft Vista box. I do most of my development in Notepad++ and a little bit in PSPad. I had previously been running an older version of Notepad++ (v5.4.5 UNICODE to be exact) and I was upgrading to v5.6.4 UNICODE. Here are a few things to keep in mind when upgrading:
- Windows Vista: Give your user login full permissions to the c:\Program Files\Notepad++ folder. This allows you to make theme changes and other changes in the system and have those changes get saved automatically.
- Open My Computer and navigate to c:\Program Files
- Right click on Notepad++ folder and go to Properties
- Select the Security tab and click the Edit button
- Click Add and search for your name
- Once you have added your name click on it under Group or user names
- Check the Full control allow checkbox and click OK on the remaining properties boxes.
- If you use the Function List plugin make sure you visit here and download the FunctionList20091109_dll.zip file and place this .dll in the plugins folder (c:\Program Files\Notepad++\plugins\). This download is compatible with the Unicode version of Notepad++ 5.5 +.
Tags: Function List, Notepad++, PSPad, Windows Vista
Calculate users age with PHP
Jan 19, 2010 PHP Coding, Web Development
Recently I needed some code to calculate a users age based on their birthday. There are many different functions that are already created out there that I could have used, but instead I wrote this piece of code. It uses PHP 5 DateTime class to return an array of information pertaining to how old a person is. By default if you leave the second parameter off it will calculate the difference from the start date to the current day. If you are trying to calculate how old somebody was when they had passed away or how old they were on a certain date you can pass the second parameter. There are several different checks in this code snippet to make sure you are using a valid date for the start and end date.
This function requires dates to be passed in standard: YYYY-MM-DD format
Code:
if (!function_exists('calculate_age')) { // Checked this function against http://www.timeanddate.com/date/duration.html function calculate_age($startdate = '0000-00-00', $enddate = '0000-00-00') { // Check to see if start date is valid @list($year, $month, $day) = explode('-', $startdate); if (@!checkdate($month,$day,$year)) { return false; } // Create a new datetime object to do our calculations with $s = new DateTime($startdate); // We have to have an end date so if it is empty or 0000-00-00 we will make it right now if (empty($enddate) OR $enddate == '0000-00-00') { $enddate = 'now'; } else { // Check to see if end date is valid @list($year, $month, $day) = explode('-', $enddate); if (@!checkdate($month,$day,$year)) { return false; } } // Create a new datetime object to compare as an end date $e = new DateTime($enddate); if ($s->format('Ymd') > $e->format('Ymd')) { // End date cannot be before start date return false; } // Calculate our base numbers here $years = $e->format('Y')-$s->format('Y'); $months = $e->format('m')-$s->format('m'); $days = $e->format('d')-$s->format('d'); // We cannot have negative days // Calculate how many days are in the startdate month // subtract the startdate day and add 1 // Then add back in the day of the enddate // Subtract 1 month if ($days < 0) { $days = $s->format('t')-$s->format('d')+1; $days += $e->format('d'); $months--; } // We cannot have negative months // Subtract 1 year and add back 12 months to make months positive if ($months < 0) { $years--; $months += 12; } return array('years'=>$years,'months'=>$months, 'days'=>$days); } }
Usage:
// Current date is 2010-01-19 $birthday = '1987-09-23'; $age = calculate_age($birthday); var_dump($age); echo '<hr />'; $startdate = '1985-09-06'; $enddate = '1987-09-23'; $difference = calculate_age($startdate, $enddate); var_dump($difference);
Output:
array(3) { ["years"]=> int(22) ["months"]=> int(3) ["days"]=> int(27) }
——————————————————————————————————–
array(3) { ["years"]=> int(2) ["months"]=> int(0) ["days"]=> int(17) }
Enabling / Disabling Bcc field in Microsoft Outlook
Jan 18, 2010 Technology, Work
The use of the Bcc field in email is something that more people should use. Over the summer I had purchased a new home and gave my realtor my email address to email me new listings. A few months later her husband (her partner in the real estate firm) sent out some mass emails and placed everybody’s email address in the To field. The problem with this is that I along with every other one of her clients now have the email addresses of all of her clients, some of which I recognized. To prevent this you can use the Bcc field which will hide all of the recipients. Enabling this field in Microsoft Outlook 2003 and 2007 is rather easy.
Outlook 2003
Step 1 is open Outlook and create a new email. Once in the new email you will need to find the Options button that is located on the main toolbar. Click on the small down arrow just to the right of the word Options.
Step 2 is to click on the Bcc option which is 2nd from the bottom.
You will now see the Bcc address line just above the Subject field.
Outlook 2007
Step 1 is to open Outlook and create a new email. Once in the new email you will see the ribbon at the top. You will need to click the Options tab.
Step 2 is to click on the Show Bcc button in the Fields section of the Options ribbon.
The Show Bcc field will now be highlighted and the Bcc field will be placed just above the Subject field.
That is how easy it is to show the Bcc field in your new emails so you can hide the email addresses of the recipients of your email.
Hunter Ice Festival – Part 2
Jan 18, 2010 Photography
The Hunter Ice Festival is a 3 day festival that starts on a Friday night with lots of carving, setting out sponsor’s sculptures and lots more. While I was playing with the wireless Speedlight flash system on the first night I caught this little boy looking up at one of the main sculptures in amazement. I only got two shots off and thankfully one of them turned out since the father was telling the boy to step back.
On Saturday you get to see more of the tools that get used while carving these sculptures. Anything from angle grinders, chainsaws, picks, chisels, dremel tools, custom made jigs and cloths irons get used.
Some people use templates made out of paper to help start the carving process.
While others just have a drawing and go at the ice just by looking at it.
When doing night photography with a flash you can easily tell where many of the different blocks are.
More photos in the gallery at: Hunter Ice Festival, Niles Michigan
Tags: Canon 40D, Canon 7D, Festivals, Michigan, Photography, Winter
Rock On! – Hunter Ice Festival, Part 1
Jan 16, 2010 Photography
Today kicked off the Hunter Ice Festival in Niles Michigan. This is my first year going to this festival and so far I think that it will not be my last. How can you beat ice carving and fire? This is my first time getting out with my new Canon 7D and seeing what it can do. I was working with the wireless Speedlight trigger and some higher ISO’s due to hand holding of the camera in crowds. More photos to come once the weekend is over.
Tags: Canon 7D, Festivals, Michigan, Photography, snow, Winter
Canon 7D is here!
Jan 11, 2010 Photography
So I can’t wait to continue learning all of the different features of my Canon 7D. I purchased it as an upgrade to my Canon 40D. Not exactly sure what I am going to do with the 40D just yet. I may keep it around so if I do different photo shoots I can just grab a different camera instead of changing lenses. What I can say though is that I was a little worried when it arrived. The UPS man showed me this hole in the side of the main delivery box and asked me to check the contents to see if it was damaged. Thankfully B&H packed it with enough air pockets that nothing was damaged.
There will be several future postings on what I like/dislike about the 7D as compared to my 40D.
Tags: Cameras, Canon 40D, Canon 7D, Photography