Counting HTML / XML Tags from stdin

Perl No Comments »

#!/usr/bin/perl

undef $/; # enable "slurp" mode
$_ = <>; # whole file now here
$/ = \1234; # set back

while ( /< (([^ >]|\n)*?)>/ ) {
$count++;
print “$count. $&\n”;
$_ = $’;
}

How to extract images from Excel files with OLE?

Perl No Comments »

#!/usr/bin/perl

use strict;
use Win32::OLE qw(in with);
use Win32::OLE::Const;
use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3; # die on errors...

my $filename = 'C:\ist\Win32\OLE\ChartOLE\chart.xls';
my $filter = 'GIF'; # can be GIF, JPG, JPEG or PNG
my $count = 0;

my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
|| Win32::OLE->new('Excel.Application', 'Quit'); # use the Excel application if it's open, otherwise open new
my $Book = $Excel->Workbooks->Open( $filename ); # open the file
foreach my $Sheet (in $Book->Sheets) { # loop through all sheets
foreach my $ChartObj (in $Sheet->ChartObjects) { # loop through all chartobjects in the sheet
my $savename = "$filename." . $count++ . ".$filter";
$ChartObj->Chart->Export({
FileName => $savename,
FilterName => $filter,
Interactive => 0});
}
}
$Book->Close;

Handling Microsoft Word and Excel files using OLE

Perl No Comments »

This perl code running under Windows 32 operating systems, and requires the MS Office to be installed.
#!/usr/bin/perl

use Win32::OLE::Const 'Microsoft Excel';
printf "xlMarkerStyleDot = %d\n", xlMarkerStyleDot;
my $wd = Win32::OLE::Const->Load("Microsoft Word 9\\.0 Object Library");
foreach my $key (keys %$wd) {
printf "$key = %s\n", $wd->{$key};
}

How to extract HREF links from the input

Perl No Comments »

#!/usr/bin/perl -n00
print "$2\n" while m{
< \s*
A \s+ HREF \s* = \s* (["']) (.*?) \1
\s* >
}gsix;

Searching in the source of a webpage

Perl No Comments »

#!/usr/bin/perl
use LWP::Simple;
$count = 0;
$search = $#ARGV >= 0 ? $ARGV[1] : "author";
$server = $#ARGV >= 1 ? $ARGV[0] : "www.webhauser.com";

$page = get "http://$server";
@lines = split /[\n\r]+/, $page;
foreach $line (@lines) {
if ( $line =~ /$search/ ) {
print "found: $line\n";
$count++;
}
}

print '-'x70 ."\n";
print "internet szerver: $server\n";
print "keresett szo: $search\n";
print "Talalat $count sorban\n";

Getting the source of a webpage

Perl No Comments »

#!/usr/bin/perl

use LWP::Simple;

print $ARGV[0];
print "\n";
getprint "http://" . $ARGV[0];

Webdesign affiliate shop

Magyar nyelven, Web development No Comments »

Működőképes magyar nyelvű viszonteladói Websablon-tárházat készítettem a MyTemplateStorage partnerprogram segítségével. A promóciós eszközök támogatása ebben a partner programban rendkívül fejlett, a magas felhasználói szinttől kezdve egészen részletesen a WebAPI specifikációig.

A webdesign mintabolt címe http://webdesign.tevagyasztar.com

htaccess rule to use php as html documents

Web development, SEO Marketing No Comments »

The following simple webmaster trick shows how to change the Apache server configuration through a .htaccess file to use dynamic php pages in .html files. To take the effect, the following .htaccess file should be in the webserver’s DocumentRoot directory.

AddType application/x-httpd-php .php .html

HTML/OS Desktop Link

HTML/OS No Comments »

The HTML/OS ICONPAGE variable if exists then it contains the desktop manager link. The fast, on-line Web application development practice recommends it. The HTML/OS program behaves differently when you enter the page URL as a registered start link or just open from the Web Desktop / File Manager.

[[ IF iconpage!="ERROR" THEN
  DISPLAY "<a href="+iconpage+" mce_href="+iconpage+">Desktop</a>" /DISPLAY
/IF ]]

What is the best WordPress permalink structure?

WordPress, SEO Marketing No Comments »

The default WordPress permalink structure is not very SEO friendly as they looks like some “domain.com/?p=123″ URL format.

From the SEO point of view most likely the “domain.com/postname” alone or the “domain.com/category/postname” URL formats are the best choice.
/%category%/%postname%/

I recently use the “Pretty Permalinks” option which gives the “domain.com/2008/05/16/postname” URL format. I don’t change my site permalink format, because i started the blog with this option for better readability.

WebSite Powered by webHauser
Entries RSS Comments RSS Login