October 13th, 2009 by Anthony Curreri
The default quick print icon behavior in Word 2007 is to print to your default printer. Here is how to make an icon in the Word 2007’s Quick Access Toolbar (QAT) which prints directly to any printer you want. This is handy if you want an icon that prints to a different printer than the default, or you just want a quick print icon for each of your pinters.
To do this, we need to input a macro. To do that, we need the “Developer Tab”. Follow these steps to make the Developer Tab appear:
- Click the Microsoft Office Button in the upper left, and then click Word Options.
- Click Popular.
- Under Top options for working with Word, select the Show Developer tab in the Ribbon check box.
The following creates the print macro.
- Click the Developer Tab.
- Click on the large Macros button on the left.
- Type anything in the Macro Name box, for ex: “PrintFromFavoritePrinter”
- Click the Create button.
- Cut and paste the commands below, so that your window looks like this:
Sub PrintFromFavoritePrinter()
'
' PrintFromFavoritePrinter Macro
'
'
Dim sCurrentPrinter As String
sCurrentPrinter = ActivePrinter
ActivePrinter = "HP LaserJet 1020"
Application.PrintOut FileName:=""
ActivePrinter = sCurrentPrinter
End Sub
- Replace the text: “HP LaserJet 1020″ with the exact name of your printer, from the Printers and Faxes section of your control panel.
- Press ctrl+s to save, then close the window.
The macro has been created, you can run it out of the macros list, but what a pain! Create an icon on the Quick Access Toolbar.
- Right-click anywhere on the QAT and click: “Customize Quick Access Toolbar…”
- Select “Macros” from the “Choose commands from:” drop-down.
- Click the “PrintFromFav…” macro on the left, then click the “Add>>” button.
- Click the Modify button at the bottom, choose an icon and change the name to something short, then click OK.
The QAT now has the icon you selected. When you click on it, it should immediately print to your favorite printer!
If you found this helpful, help me by checking out the ads on the right. Thank you!
Posted in Microsoft Office | No Comments »
October 6th, 2009 by Anthony Curreri
I originally got this function from the comments on this page: http://us2.php.net/manual/en/function.split.php. But I recently put a bit of time into making it compatible with fields quoted with multiple quotes. This function can deal with input like:
"one"," "two"", """three"""
It will parse data that is not CSV (comma separated values) as well, just pass in a different delimiter.
I have two helper functions here, one which removes an element from the array, then rebuilds the array to re-create the array keys. The other deals with the multiple quote issue by stepping through the initial array and removing the extra rows created due to the fact that we have multiple quotes.
#######################################
function RemoveArrayElement($array, $removeKey)
{
unset($array[$removeKey]);
foreach ($array as $value)
$return[] = $value;
return ($return);
}
#######################################
function DealWithMultipleSurroundingQuotes($splitter, &$getstrings)
{
for($x = 0; $x < count($getstrings); $x += 2) //foreach even key
{
if (!stristr($getstrings[$x], $splitter)) //if splitter is not in row
{
if (trim($getstrings[$x-1]) == '') //if previous row is empty
//remove previous row
$getstrings = RemoveArrayElement($getstrings, $x-1);
else
//remove current row
$getstrings = RemoveArrayElement($getstrings, $x);
return false;
}
}
return true; //Function finished successfully!
}
#######################################
function quotesplit( $splitter=',', $s, $restore_quotes=false )
{
# First step is to split it up into the bits that are surrounded by quotes
# and the bits that aren't. Adding the delimiter to the ends simplifies
# the logic further down
$getstrings = explode('"', $splitter . $s . $splitter);
while(!DealWithMultipleSurroundingQuotes($splitter, $getstrings));
# $instring toggles so we know if we are in a quoted string or not
$delimlen = strlen($splitter);
$instring = 0;
while (list($arg, $val) = each($getstrings))
{
if ($instring == 1)
{
if($restore_quotes)
{
# Add string with quotes to the previous value in the array
$result[count($result)-1] = $result[count($result)-1]. '"' . addslashes(trim($val)) . '"';
} else {
# Add the whole string, untouched to the array
$result[count($result)-1] = addslashes(trim($val));
}
$instring = 0;
} else {
# Break up the string according to the delimiter character
# Each string has extraneous delimiters around it (inc the ones
# we added above), so they need to be stripped off
$temparray = split($splitter, substr($val, $delimlen, strlen($val)-$delimlen-$delimlen+1 ) );
while(list($iarg, $ival) = each($temparray))
$result[] = addslashes(trim($ival));
$instring = 1;
}
}
return $result;
}
If you found this helpful, help me by checking out the ads on the right. Thank you!
Posted in Web | No Comments »
May 21st, 2009 by Anthony Curreri
Windows Media Player just doesn’t have the chops for this task. You’re going to have to install a better video player. Don’t worry, it’s free!
- Install VLC Media Player: http://www.videolan.org/vlc/download-windows.html
- Open VLC
- Load the video file by clicking on the Media drop down, the Open File
- Click the Tools drop down, then Preferences
- Click ‘Video’ on the left.
- In the last box ‘Video Snapshots’ it lists the directory where captured images will go. Take note of this directory or change it to be whatever you wish.
- Play the video.
- At the moment you wish to capture an image, click the Video drop down, then click Snapshot.
- Go to that directory we saw in preferences, and Robert’s your mother’s brother! Images!
If you found this helpful, help me by checking out the ads on the right. Thank you!
Posted in Windows XP | No Comments »
April 23rd, 2009 by Anthony Curreri
When trying to play a Blu-ray in Cyberlink PowerDVD and you get the following error:
Warning
Cannot initialize secure display session – (Error Code = 0122) You may try the following resolution to solve the problem.
- Incompatible graphics driver. Please make sure your graphics drivr meets the minimum requirement criteria. (More information can be found from Cyberlink FAQ Website)
- Do not use dual-monitor to playback this movie (Clone Mode)
Please run the BD/HD Advisor tool for more information.
You probably have two outputs on your video card. One is HDMI, and the other is a VGA output, also known as the PC output. Right now, your video card is configured to display on both outputs.
If you have an NVIDIA display adapter and are running Windows Vista, here is how to turn off ‘Clone’.
- Right click anywhere on the background
- Click ‘NVIDIA Control panel’
- Click ‘Set up multiple displays’ in the left column
- Under 1. Choose the nView display mode to use, select ‘Only use one display (Single)’
- Under 2. Select the display you would like to use, select the monitor that is connected to your HDMI output. In this case, I selected ‘Sony TV XV (2 of 2)’.
- Click ‘Apply’.
- The screen will blank out for a second, this is necessary because we are reconfiguring the screen.
Now play your Blu-ray movie!
If you found this helpful, help me by checking out the ads on the right. Thank you!
Posted in Windows XP | No Comments »
March 5th, 2009 by Anthony Curreri
First, create the tables in your new Postgres database. I used a program called Navicat. You should create the tables by hand because the field types are different in MySQL and Postgres.
Use the following command to get mysqldump to create a dump file of the database that you can upload. You can also use Navicat to run the script.
mysqldump databasename tablename -v --compatible=ansi,postgresql --complete-insert=TRUE --extended-insert=FALSE --compact --default-character-set=UTF8 -u username -p -r “c:\shares\postgres.sql”
If you found this helpful, help me by checking out the ads on the right. Thank you!
Posted in Database | No Comments »
March 5th, 2009 by Anthony Curreri
As a regular user, or as root if you leave off the sudo bits:
sudo yum -y install postgresql postgresql-server php-pgsql
sudo /sbin/chkconfig postgresql on
sudo /sbin/service postgresql start
This is setting up the postgres user. Enter a password you’ll remember when prompted.
sudo passwd postgres
After this command, enter that password again. Now you’ll be logged in as the new postgres user.
su – postgres
psql
create user gpsdata;
create database gpsdata owner gpsdata;
control+d
The following makes it possible to access the database from another computer.
vi /var/lib/pgsql/data/postgresql.conf
add the line:
listen_addresses=’*’
vi /var/lib/pgsql/data/pg_hba.conf
add the line:
host all all 192.168.3.0/24 trust
control+d
sudo /etc/init.d/postgresql restart
Now you’ve just got to open port 5432 on your firewall.
sudo vi /etc/sysconfig/iptables
add the line:
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 5432 -j ACCEPT
sudo /etc/init.d/iptables restart
If you found this helpful, help me by checking out the ads on the right. Thank you!
Posted in Database | No Comments »
March 3rd, 2009 by Anthony Curreri
Normally, I just:
sudo yum check-update
sudo yum update
sudo reboot
Note: A reboot might not be necessary depending on what you are updating.
If yum is having problems resolving some dependencies, or you get the error: “[Errno -1] Metadata file does not match checksum”, try running the command below, then re-running the commands above.
sudo yum clean all
If a “yum clean all” doesn’t fix it, it might be that your satellite server just needs to re-sync with RedHat’s servers. Wait a day and try it again.
If the your system is having trouble communicating with the Red Hat server, you probably need to:
sudo /usr/sbin/rhnreg_ks --force --activationkey=XXXXXXXXXXXXXXXXXXXX
For University of Washington, XXX can be found here.
If you found this helpful, help me by checking out the ads on the right. Thank you!
Posted in Linux | No Comments »
February 17th, 2009 by Anthony Curreri
- Select the data on the sheet. Note that I had to click the first, hold shift then click the last. Selecting the entire column didn’t work.
- Right click, then click Copy.
- Right click, click Paste Special, make sure Transpose is checked.
If you found this helpful, help me by checking out the ads on the right. Thank you!
Posted in Microsoft Office | No Comments »