PCL to PDF conversion on CentOS 5.5

yum -y install libXt-devel libXext libXext-devel gcc
cd /usr/src
wget http://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/ghostpdl/ghostpdl-8.71.tar.bz2 http://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/GhostPCL/urwfonts-8.71.tar.bz2
for i in ghostpdl* urwfonts* ; do otar jxvf $i;done
mkdir -p /usr/share/ghostpdl/fonts
mv urwfonts-8.7.1/*.ttf /usr/share/ghostpdl/fonts
cd ghostpdl-8.71
sed -i "s|/windows/fonts/;/win95/fonts/;/winnt/fonts/|/usr/share/ghostpdl/fonts|g" pl/pjparse.c
make

It's all pretty much the default stuff, except for the required libs and the fonts. If you don't have the -devel packages, you get weird errors while compiling that don't show exactly what is missing.

To generate A4 output, add @PJL SET PAPER=A4 to the pcl input file.

© GeekLabInfo PCL to PDF conversion on CentOS 5.5 is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Remove “standby” from shutdown window

I recently discovered that one of my most annoying users has found another way to frustrate the WSUS update process: First, she simply didn't shutdown the computer when she went home. Now I've installed a psshutdown script on the SBS Server that forces a shutdown every evening, she found out that she could put the computer in hibernation mode. Which of course isn't a bad idea to shutdown the computer in the lunch break, but is terrible for the administrative processes if you do it every night, day after day.

The solution

I removed the hibernation option from the shutdown window. This can be done by adding a parameter to the ACPI section of the registry:
Key: HKLM\SYSTEM\CurrentControlSet\Services\ACPI\Parameters
Attribute name: Attributes
Attribute value: 0x70

You can change this parameter on the command line:
reg add "HKLM\SYSTEM\CurrentControlSet\Services\ACPI\Parameters" /v Attributes /t REG_DWORD /d 0x70 /f

To use this in a GPO, you'll need to create a .adm file... or simply run above command as a startup/shutdown script.

© GeekLabInfo Remove "standby" from shutdown window is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Useful VPN Services

Say you're living in China, and you have no web freedom whatsoever. Or in the Netherlands, and your favorite linux distro download site has been blocked by the corrupt "elite". Then having a tunnel to outside the country could be very useful.

I found two VPN services that seem very promising:
ItsHidden.com
MacroVPN.com

© GeekLabInfo Useful VPN Services is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

MS Core fonts on Fedora 13

Due to copyright issues, Fedora cannot include the "core" fonts Arial, Times, Verdana etc. Instead, Fedora offers an alternative under the name "Liberation fonts". Well, great. Except that 99,9% of all documents received use these core fonts, and I'm not planning to do a find and replace with each and every document I open.

So, I'm sorry to say this: I think trying to replace the core fonts is simply stupid.

How to build your own font package

wget https://www.geeklab.info/wp-content/uploads/2010/06/msttcore-fonts-2.0-3.spec
yum install rpm-build cabextract
rpmbuild -ba msttcore-fonts-2.0-3.spec

Now install your package

sudo rpm -i ~/rpmbuild/RPMS/noarch/msttcore-fonts-2.0-3.noarch.rpm

© GeekLabInfo MS Core fonts on Fedora 13 is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Speed up your website: Preloading and caching images

For a customer, I'm building a website that has a pretty large header jpeg that is different for every single page. To speed up loading several pages, I've taken several steps:

1. Force browser caching

You can tell a browser to keep certain files in cache longer than normal. In apache, update the virtual host configuration or put this in a .htaccess file:
<FilesMatch "\.(jpg|jpeg|png|gif|swf|css|ico|js)$">
ExpiresActive On
ExpiresDefault A864000
</FilesMatch>

2. Install libraries

2a jQuery
On this site, I'm using jQuery to perform some tasks. As it was loaded anyway, I can use it for this task as well. So, download jQuery here and install it like:
<script type='text/javascript' src='/lib/jquery.js'></script>

2b jQuery cookie
Download the jQuery cookie plugin (by Klaus Hartl) as well
<script type='text/javascript' src='/lib/jquery.cookie.js'></script>

2c jQuery cookie
The last lib is a image preloading plugin for jQuery, that I found on engineeredweb.com:
(function($) {
var cache = [];
// Arguments are image paths relative to the current page.
$.preLoadImages = function() {
var args_len = arguments.length;
for (var i = args_len; i--;) {
var cacheImage = document.createElement('img');
cacheImage.src = arguments[i];
cache.push(cacheImage);
}
}
})(jQuery)

You can put it in a separate file, for example jquery.preload.js. And again, load it: <script type='text/javascript' src='/lib/jquery.preload.js'></script>

3. Put it all together

jQuery(document).ready(function(){
if(jQuery.cookie("preload")==null){
try{
jQuery.preLoadImages("header1.jpg","header2.jpg");
}catch(e){}
jQuery.cookie("preload",1,{path:"/"})
}
});'

This means:
jQuery(document).ready( = wait until document is completely loaded before starting new downloads.
if(jQuery.cookie("preload")==null){ = only try to fill the cache when cookie 'preload' is not found, ie. once per session
jQuery.cookie("preload",1,{path:"/"}) = set the cookie so this routine will not be executed again during this session.

© GeekLabInfo Speed up your website: Preloading and caching images is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Backup your WSUS database

"c:\Program Files\Microsoft SQL Server\90\Tools\binn\SQLCMD.EXE" -E -S np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query -Q "BACKUP DATABASE [SUSDB] TO DISK = N'C:\backups\SUSDB.BAK' WITH NOFORMAT, INIT, NAME = N'WSUS Database Backup', SKIP,NOREWIND, NOUNLOAD, STATS = 10"

c:\backups must be writable by the user that is running the database. In my case, I believe this is user "NETWORK SERVICE".

© GeekLabInfo Backup your WSUS database is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Using SQL Server Management Studio Express for WID

Connecting to a Windows Internal Database (WID, codename WYukon) with SQL SServer Management Studio Express is possible. However, not over the network.

1. Install SQL Server Management Studio Express on the local machine.
2. Connect to \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query as instance name.

© GeekLabInfo Using SQL Server Management Studio Express for WID is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...