Monday, April 27, 2009

Select visible cells only in Excel 2007

There are two ways to do this. If you don't need to use it much, then you can get to it directly through the links on the menu. On the Home tab, go to "Find & Select" on the right. In that menu, select "Go To..." Click "Special..." Here is where you can choose the "Visible cells only" option. Click OK, and that will select the visible cells only. This method is also outlined in Microsoft help pages, and can be found here.

If you need to do this often, going through all of those steps may get annoying. The good news is that you can create a shortcut for it on your quick access menu. To do this, right-click on the menu bar and select "Customize Quick Access Toolbar...". In the "Choose command from:" drop down list, change the option to "All Commands". This will show all available shortcuts that you can place in your toolbar. Scroll down in that list to find the "Select Visible Cells" shortcut, which looks like 4 black boxes. Select it, then click Add>>. This will add it to your quick access toolbar. Now click OK. Look in the upper-right and you should now see the visible cell selection shortcut icon next to the save, undo, and redo links in the quick access toolbar. You can use this same method to add (or remove) additional shortcuts to your toolbar.

Sunday, April 26, 2009

Free Mac OS X anti virus software

Odds are most Mac users will never need antivirus software. Out of the 35-40 Mac users I manage, I don't have any AV software installed at all. However, that doesn't mean you can't use it if you feel you need to. There's a free package out there called ClamXAV if you're interested. If it'll help you sleep easier at night, by all means, give it a try.

Wednesday, April 22, 2009

Product key problem when installing Office 2004 on OS X

I have 3 legitimate product keys for Office 2004 for Mac, but none of the original install media. However, I have plenty of Office 2004 installation CDs from other machines, so I thought it shouldn't be too hard to just use one of those with my unused product keys. That was a wrong assumption. I double-checked the keys I had typed to make sure I hadn't transposed any letters, and also tried a couple of the keys, but the installation continued to tell me that the product key was not valid. At this point I had no choice but to turn to Microsoft Support.

I was told that this was a bug with Tiger and Leopard, and that if I did a manual install and updated to the 11.5.0 upgrade prior to trying to activate, the problem should be solved. Sure enough it worked. I couldn't find any documentation of it anywhere though, so hopefully others having the problem run across my post.

To perform a manual install, just drag the Microsoft Office 2004 folder from the CD to your Applications folder. This can take a short time while the files are transferred. After that, go to http://www.microsoft.com/mac/downloads.mspx and download the 11.5.0 update. Once downloaded, you'll have to launch the installer. Go through the install process, and once that is finished, try to launch one of the Microsoft Office applications. You should be prompted for the product key again, and this time it should work. Once you're in, I'd recommend going through the rest of the updates available using the AutoUpdate feature (under the Help menu).

It seems like a silly problem, but at least it's not too difficult to resolve. Hopefully this saves you from pulling hair and turning to Microsoft for help. If you're going to need to open the newer docx, xlsx, pptx, etc formats with your new Office 2004 install, you should check out my other post. Good luck!

Monday, April 20, 2009

DIY - How to replace a Macbook Pro screen/display

I had a user drop her 15" Macbook Pro last week, which pretty much shattered the screen. The laptop is still under Applecare, but things like this aren't covered. I talked to Apple and they gave me a quick quote of $1,200 to replace the screen. At that rate, a person is almost better off buying a new Macbook. After laughing at that, I decided to see just how cheaply I could replace the display on my own. Turns out I was able to do it for $214, and it took about an hour. Here's the story:

First, I turned to Google shopping and Ebay to see what the prices on a replacement screen were going to be. They varied, but I was able to find one for $200 (+ s/h of ~$14) from a user named macrecycling. That seemed like a pretty good deal to me since I didn't expect it to require $1,000 in labor costs to put the new screen in. I ordered the new screen and it arrived in a few days.

Next, I needed to find directions as to how you can remove the screen from the laptop. Normally this isn't too bad, but with all Apple products, they like to make it a little more difficult to just take it apart without instructions or training. A quick Google search brought me to www.ifixit.com, where they have a step-by-step guide to removing the display. It was very helpful, but it stopped at a crucial point of the process. It didn't show how to actually remove the screen from the case. Another quick Google search led me to www.screentekinc.com to their Macbook display removal guide. Luckily they skipped over most of the instructions given at ifixit.com and picked up where the other left off. Using the two sites, I was able to get the screen pulled out, and the new one installed in approximately an hour. That sure beat spending $1,200 to have someone else do it.

One thing to keep in mind when looking for your replacement screen is to make sure you're ordering the correct one. Apple made a change in their Macbook screen in 2007, so newer ones are LED backlit and older ones aren't. If you're not sure which one you'd need, you can either try Apple's Tech Specs page (requires the serial number of your Macbook), or try contacting the seller to see if they'll help you determine the correct replacement.

Another thing to remember is to take your time and be careful. Anytime you try replacing parts on your own, you run the risk of damaging the computer. Also, replacing hardware on your own can sometimes void the warranty, so you may want to check into that and take it into consideration before proceeding with any replacements.

Friday, April 17, 2009

Sharp MX3501N stuck offline during maintenance warning

We have two Sharp MX3501N printers and they've been great for us. One of them had a "Needs maintenance, code FK3" pop up yesterday, so I called in for service. It's a routine change of the fuser web kit, whatever that is. I know if helps keeps things clean, so without it the prints can get spotty. Anyway, the tech came out and found that he'd need to order a part. He said the printer would work in the meantime, but for some reason it was registering as offline on our print server and the clients. It seemed to print directly from a Linux app we use though, which seemed odd. I did some digging and found the answer.

In Windows, the Sharp driver will force the printer into offline mode if it detects a maintenance warning, regardless of what it is. This is because SNMP is enabled on the printer port by default. It is simple to disable. What you need to do is go into your Printers & Faxes, right-click your Sharp printer, then select Properties. From there, go to the Ports tab, select the Port that is active for your printer, then click on Configure Port. Towards the bottom you will see a box that is checked and reads "SNMP Status Enabled". Uncheck that box, then click OK a few times to get back to your Printers & Faxes window. Check to see if the Sharp printer is back to the "Ready" state, and if so, anything stuck in the queue should be printing too.

I'm assuming this carries over into other Sharp printers, but I can verify that it worked with the MX3501N printer that we were having issues with. I also found that this only seemed to affect Sharp printers using the default IP port settings. The Sharp-specific ports didn't have any SNMP options available, so using a Sharp port is a better option anyway. However, I just ran into a problem where the printer was registering as offline using the Sharp ports. To fix it, I changed the port to a generic TCP/IP port using that same IP address, and everything printed out right away. 

I originally found the answer here.

Thursday, April 16, 2009

Outlook attachment error, can't create file

If you're one of those users who is notorious for opening all attachments without downloading and saving them first, you may have run into this problem before. Eventually you may get an error when trying to do so, which says:

Can't create file: yourfile.ext. Right-click the folder you want to create the file in, and then click properties on the shortcut menu to check your permissions for the folder

This can be very annoying, especially since you will most likely experience it with only a select few of your files. However, the good news is that it's not a big deal and is easily fixable.

The problem is that every time you open an attachment without saving it first, Outlook will first download it into a temporary folder and then open it from there. Unless you keep up on cleaning this temp folder, the files eventually build up. Each time you open a file with a name that already exists in this temp folder, Outlook with append a number to the name (e.g. "file.txt" opened a 2nd time would be saved in the temp folder as "file (2).txt"). This is where the problem comes in. Outlook is limited to 100 versions of the same file, so once your file name reaches "file (99).txt" (starts numbering at 0), the next one will fail to open and you'll get the error above. The fix is to go to the temp folder and clear the other copies of the same file, or if you want to be really good, empty the folder completely.

In order to clean out the temp folder, you'll first have to know where it is stored. This is really the only tricky part because it can vary from machine to machine. However, the location is stored in the system registry so you can retrieve it from there. Here's how to do this for Outlook 2003

1. Go to Start->Run, type "regedit", then press Enter. This will bring up the registry editor tool. Be careful not to make any changes to the registry as they can have adverse affects on your computer.
2. Navigate to HKEY_CURRENT_USER->Software->Microsoft->Office->11.0->Outlook->Security registry key
3. Look for the OutlookSecureTempFolder value. This is the folder location you'll need. It's easiest to double-click on it, then copy the path of the folder
4. Close Registry Editor
5. Go to Start->Run, then paste the folder path in the box and press Enter
6. The folder should pop up in Windows Explorer. This is where you'll want to delete the files from
7. Now that the files are deleted you can close that folder and try opening your attachment again

The easiest way to avoid this would be to first save your attachment to a location you're aware of, and then open it from there. Since 90+% of you will probably never do that, this will at least allow you to continue opening attachments

I haven't run into this problem with Outlook 2007, but that doesn't mean it doesn't exist. If you're having the issue with Outlook 2007, just replace the key in step #2 with HKEY_CURRENT_USER->Software->Microsoft->Office->12.0->Outlook->Security. That is where Outlook 2007 specifies its value for the temp folder

The original post that helped me figure this out can be found here.

Tuesday, April 14, 2009

Applescript to automatically replace characters in filename

Here's the second half to my post regarding automatically adding file extensions to files in OS X.

If you're in a mixed environment where Mac and PC users are, you know that it can sometimes be a challenge to get everyone to name files so that they are compatible with both types of computers. Normally the Mac users are the culprits because Macs allow a wider range of characters in the filenames. Configuring folder actions, and using a simple Applescript, you can automatically remove any characters you want from the file names though, or replace them with a different character of your choosing. Here's the Applescript:


--set the list of characters you want to replace
--disallowedChars will be replaced with the replacementChar
--in this case, an underscore
property disallowedChars : ":;,/|!@#$%^&*()+" 

--anything in disallowedChars2 will be removed altogether
property disallowedChars2 : "'"

--set the character you'd like to use to replace the invalid 
--characters specified in disallowedChars
property replacementCharacter : "_"

on adding folder items to this_folder after receiving added_items

tell application "Finder"
try
repeat with x in added_items

set fileNamed to name of x
set newName to my CleanName(fileNamed)
set (name of x) to newName

end repeat
on error
display dialog "An error occurred."
end try
end tell

end adding folder items to

--function for cleaning the characters from the file name
on CleanName(theName)

set newName to ""
repeat with i from 1 to length of theName

--check if the character is in disallowedChars
--replace it with the replacementCharacter if it is
if ((character i of theName) is in disallowedChars) then
set newName to newName & replacementCharacter

--check if the character is in disallowedChars2
--remove it completely if it is
else if ((character i of theName) is in disallowedChars2) then
set newName to newName & ""

--if the character is not in either disallowedChars or
--disallowedChars2, keep it in the file name
else
set newName to newName & character i of theName

end if
end repeat

return newName
end CleanName

Using that script in combination with OS X folder actions will allow you to successfully replace any character you want with any character you specify. The only things you'd need to modify are the disallowedChars, disallowedChars2, and replacementCharacter variables. 

Add empty item to databound drop down list in C# .NET

Do you have a data-bound drop down list, but want to leave the list empty or blank initially? Well, you can, and it's really simple. In your aspx page, where you declare your DropDownList, just make sure to do it as follows:

<asp:DropDownList ID="yourID" runat="server" AppendDataBoundItems="True">
<asp:ListItem Value="" Text="" />
</asp:DropDownList>


The key here is the AppendDataBoundItems="True" property. This allows you to define your own list items, and then any items that are bound to data are added after those items, aka appended.

You can find the original post at http://stackoverflow.com

However, if you find that you're getting the same items added multiple times you can do it this way instead. Leave AppendDataBoundItems="False" and rather add the empty/blank entry programmatically. To do that add the following code after your drop-down has been filled

DropDownList1.Items.Insert(0, new ListItem(String.Empty, String.Empty));
DropDownList1.SelectedIndex = 0;

This will add an empty/blank entry at index zero of your dropdown box, and also make sure that it is the selected value. If you don't want to change it to the selected value don't use the second line. I found this on http://stackoverflow.com as well

Monday, April 13, 2009

Embed or un-embed a linked file in an Illustrator CS3 document

The trick here is paying attention to the options in the Link screen. The symbol for showing that a file is embedded is , which will show up next to the file in the Link panel. If that symbol is not there, then the linked file is just that, linked only.

To embed the file, simply clear the Link checkbox at the bottom left of the window when you select the file to be linked. That will embed it rather than create a link. 

If you want to link a file rather than embed it, make sure the Link checkbox is checked when you place the file into your document. If you've already embedded it, you can go back in and check that box to change it to being linked.

Just watch for the "embedded" image, or lack of, to keep track of the status of your placed document. There's an Adobe article on how to do this same thing, and it can be found here.

Thursday, April 9, 2009

Send email via command line with sendmail

So you want to make sure sendmail is running and able to send email messages, but can't quite figure out the command to test it from the command line? It's easier than you may think, but it requires you to create an input file to specify the parameters.

Create a new file, we'll call it email.txt, with vi or whatever text editor you use. Then add parameters for the SMTP headers that you want to include in the message, such as "From:", "To:", and "Subject:". You also MUST remember to leave an extra, empty line at the end of the document because that signals the end of your email message. An example of the text for a basic message would be:

From:me@myemail.com
To:you@youremail.com
Subject:Hello, thanks for reading

Hi, I appreciate you reading this blog post.



You can specify other header parameters in the file as well, such as date, cc, etc by simply adding an entry for them. If you want to find out more, check the SMTP Wiki, or perform your own Google search to find resources.

After you've saved that text into your email.txt file, now you're ready to use sendmail to send this message. You can use the -t switch to import your file.

/usr/sbin/sendmail -t < email.txt

That is assuming you're still in the same directory as your email.txt file. If not, you'll want to specify the full path to the email.txt file so sendmail knows what to import.

If you're looking for more information, check out the original post I used to answer my question about sendmail.

Tuesday, April 7, 2009

Windows update problems with Vista service pack 1, error 80070026

I tried helping someone out who was having issues installing Vista SP1 on her laptop (Vista Home Premium). I had heard stories of problems, but haven't had any myself on the machines I've installed it on many computers already so I thought it would be pretty easy to take care of. Wrong! I had to deal with Microsoft support, which is providing free support for this problem until June 30th, 2009. If you want to jump right to that, you can go to http://support.microsoft.com/oas/default.aspx?prid=11274&gprid=500921. Anyway, on to the issue...

Upon attempting to install Vista's service pack 1, I kept getting an error code of 80070026. After guessing Conficker, then other spyware, and just about everything else, I took a step back. I popped the hard drive out of the laptop and into my desktop so I could run a chkdsk /r, and also another virus scan. Neither helped, so I turned to the free support option. 

The support agent guessed a corrupt .NET Framework installation, but after cleaning the .NET installations with a handy tool from www.pcsafety.us, we tried installing the latest version only to encounter another error. This is when the agent suggested using the in-place upgrade feature of Vista. I hadn't heard of this before, and was pleasantly surprised.

The in-place upgrade will reinstall your system files, but leave your files and applications intact. Yes, I was skeptical too, but I ended up having no issues with it. I still suggest backing up any files you want to save prior to doing anything with your operating system though.

The first thing I had to do was disable my startup programs and services. You can do this by going to Start->Run, then typing in "msconfig" and pressing Enter. If you don't have the Run option, you can either add it by customizing you Start menu, or go to the command prompt (Start->All Programs->Accessories->Command Prompt) and enter "msconfig" there instead. This will bring up the Microsoft system configuration utility. Go to the Services tab, check the box to Hide all Microsoft Services, then click on Disable All. Then go to the Startup tab and click on Disable All. Now click Apply, then OK. You will be prompted to restart, which is fine. Go ahead and restart the computer. After the upgrade, you will need to go back into the msconfig tool to reenable these services and programs.

After restarting, put in the Vista installation CD/DVD. One thing to note is that you MUST use installation media containing the same version of Vista that you already have installed. As an example, in my case the laptop had Vista Home Premium, so I had to use a Vista Home Premium install disc. Mismatched versions will not give you the upgrade option. Once the disc is inserted, start the Vista installation procedure if it doesn't start automatically. Here you'll see two options, one of which is upgrade. It will explain that the upgrade will not harm your files or applications, but only reinstall the Windows system files. Follow that path. The rest is pretty simple, and mainly is just a matter of clicking Next or Continue. However, the in-place upgrade will wipe out any updates installed prior to it, so once the upgrade has completed, make sure to run Windows Updates until you have all of the latest patches installed. I had to go through Windows Update a few times before it had everything, but it didn't give me any issues this time around. Service pack 1 was installated without any problems either. The only thing left after this is to go back into "msconfig" and reenable your Startup programs, and your Services. After you've done that, restart, and the pain of not being to update your Vista machine should be gone.

Monday, April 6, 2009

C# ASP .NET fileupload control problems in Firefox and Safari on OS X

I'm working on providing a web form for input to a department that needs it, but have been running into problems getting the Visual Studio .NET 2005 C# FileUpload control to work with both Firefox and Safari on Mac OS X. I've had no issues with any browsers on the Windows machine: IE, Firefox, Safari, and Chrome. I've narrowed it down to a few things.

First, Safari 3.2.1 works. Most of the OS X users who were using Safari haven't updated their systems. I've found that the page errors disappear as soon as the latest version of Safari is installed. That's a logical first step when trying to diagnose the problem, but I wanted to state it because of what I found with Firefox...

The latest version of Firefox, Firefox 3.0.8, does NOT work on OS X with the fileupload control. However, Firefox 3.0.6 does seem to work (haven't tested 3.0.7), and Firefox 3.0.8 on Windows works fine as well.

Again, I'm using the built-in FileUpload control for C# web forms on my pages, from within the Visual Studios .NET 2005 environment. Maybe I'm the only one experiencing this, but since the odds are usually against that, I wanted to post this and also give you the workarounds I've found to this point in case you're running into the same issue. If I figure anything else out regarding the FileUpload control in OS X browsers, I'll post an update.

Update: Still no success when trying it with Firefox 3.1 beta 3. There is a Google discussion for this, which can be found here: http://groups.google.com/group/mozilla.feedback.firefox.prerelease/browse_thread/thread/16c5480e8d620842

Friday, April 3, 2009

Create a reusable selection list for ntbackup

ntbackup is a free Microsoft utility for backing up or restoring files from your Windows server or desktop. You can download it from Microsoft here, but odds are it's already installed on your machine.

One nice feature of ntbackup is that you can save a list of what you'd like to backup, called a backup selection list, and then use that one list for multiple backup jobs. It's really easy to do to. Here's how:

1. Go to Start->All Programs->Accessories->System Tools->Backup. It'll likely start in wizard mode, so if it does, just click on the link for Advanced Mode.
2. Click on the Backup tab
3. You'll see a file selection tool. Use this to select everything you want to backup.
4. Once everything that you want to backup is selected, go to Job->Save Selections As... and save your .bks file wherever you want it
5. Go ahead and close ntbackup

Now you have a selection file that can be used to set up multiple backup jobs. It can help save time if you have to manage multiple jobs, and is useful if you want to use ntbackup from the command line. ntbackup from the command line is talked about in MS KB 814583. If you're looking to add email notification to your ntbackup job, check out this post from just a few minutes earlier.

Adding email notifications to ntbackup

ntbackup is the free, Windows-based, backup utility provided by Microsoft. It is a very helpful tool for backing up and restoring files on a Windows computer. You can download it for free from Microsoft.com if you don't have it, but unless your computer is older, it should be included in your original Windows installation. This article focuses mainly on Windows Server 2003 and Windows XP.

One of the features missing in ntbackup is email notifications. Maybe you don't need them, but I would guess that like myself, you want to at least know whether your backup job finished. There's a way to get around this though, and that is by scripting. You can use ntbackup from the command line, and then add an additional command to use a simple smtp mail program to send an email. This actually isn't all that difficult, as long as you already have an SMTP host you're allowed to send mail through. Here's how:

First you need to create a batch file. You can use VB Script if you'd like, but I think batch files are easier to work with for more people. The reason for using a script file is because you can use it to perform multiple commands, and also can schedule it to run using Windows scheduler. You can create this file simply by creating a new text document in Notepad, then using File->Save As to save it as a .bat file. You'll have to change the Save As Type to All Files in order for this to work, otherwise Notepad will assign the default .txt extension to your file. For now that's all you need to do, as you'll add the commands to the file later in the next steps.

Now you need to know how to run ntbackup from the command line. A good reference for this is MS KB 814583. The main thing to know here is that you can select what to backup two different ways: in the command itself, or with a saved backup selection file (.bks). I suggest using the backup selection file, since you can use the ntbackup GUI to create it. To do this, check out my other post about saving a selection list for ntbackup.

For an example, lets say I want to back up the entire Documents and Settings folder to a location on a drive mapped as Z, and created a .bks file with that information in it called BackupDocs.bks. I saved my .bks file right on the C drive, so it's at "C:\BackupDocs.bks".  I can use the command line to invoke the backup by using the command:

ntbackup backup "@C:\BackupDocs.bks" /J "BackupJobName" /F "Z:\BackupFolder\BackupFile.bkf"

In the example, /J assigns a name to the backup job, and /F lets you specify a file location for your backup file. Consult KB 814583 if you want to find out more about ntbackup from the command line and the various switches you can use.

Ok, now that you know how to use ntbackup from the command line you're ready to create your .bat file. You can either go into Notepad and open it from there, or right-click on it and choose Edit. Either way it'll open in Notepad. On the first line, add you ntbackup command and save. Now if you were to double-click on your .bat file, it would execute that command. You can add multiple ntbackup commands if you'd like, or any other command line commands you'd like to perform before or after the backup. One command you're going to want to add to the end is for your email, and you'll have to use a command line SMTP program.

If you just want a notification saying the job completed, a free SMTP program you could use is called bmail. It's free to download, and does the job. Clicking that link will bring you to a download page, and also contains more information on the command line switches you'll need in order to get it to work. If you want to include the backup log files in the email, you'll have to do some searching to find a command line utility for that. I ended up writing my own C#-based Windows application just for my purposes. If you're interested in that rather than finding one somewhere else, leave me a comment and I can get it to you. Once you've added your SMTP notification command to the end of your batch file, you can save and close. The only thing left is to use Windows scheduler to schedule your batch file to run.

You can find the Windows scheduler by going to Start->All Programs->Accessories->System Tools->Scheduled Tasks. When asked what you want to schedule, use the Browse button to go out and select your .bat batch file that you created above. This way your backup and notification will run according to whatever schedule you set.

That's it. This turned into a longer post than I originally intended, but hopefully it covers the topic enough to help you get those notification going. If you run into problems, or have more questions, leave me a comment.

Wednesday, April 1, 2009

Use cascading style sheets (css) with your webpage

I'm going to assume you're familiar with the different properties you can set using css. If not, check out the tuturial here. There are a few different ways you can include cascading style sheets (css) on a webpage.

1. Inline
2. With the <style> tag
3. Using an external stylesheet

Inline

You can simply set the style property for various HTML tags. This works best if the css property you are defining is unique to that particular tag. If it is not unique, you will be better off using one of the other two options

<div style="position:absolute; color:red; width:100%; top:50px; ></div>

Using the <style> tag

You can use <style> to define css properties for an entire page. This helps to keep you from having to define the same properties over and over, and makes changes much easier. However, if the properties carry over from page to page, you most likely will want to use the next option of external stylesheets. The text below does the same thing as the inline example, except it will affect all <div> tags on the webpage this is defined in.

<head>
<style type="text/css">
div { position:absolute; 
color:red; 
width:100%; 
top:50px; }
</style>
</head>

Including an external stylesheet (.css file)

If you have a styles that need to span multiple pages on your site, the best way to do that is with an external file that contains all of the defined styles needed. You can then link that file to any of your pages using a simple tag in the section, which will allow you to use the css properties within that file in any of those pages. This helps consolidate your properties to a single location so you can make site-wide changes by modifying a single line. This example assumes you have a file containing you css properties already, it's at the root of your site, and it's named myCSS.css.

<head>
<link rel="stylesheet" type="text/css" href="myCSS.css" />
</head>


It's relatively simple, and can make modifying your pages much, much easier later on. You should understand css inheritance as well. It's a top-down approach, and the style most closely defined to any particular element is the one that takes precedence.  This means you can override a css property defined in a linked stylesheet, or in a <style> tag, by using an inline style. If you want to find out more about css inheritance, I suggest checking out http://www.webdesignfromscratch.com/css-inheritance-cascade.php