Log in



Categories » ‘Web Development’

Move page, keep rank

April 7th, 2009 by Peter

If an existing web presentation is moved to a new URL scheme or domain, most people are unsure about their precious Google page ranking. Most sources agree about the following rules:

  • Redirect every single URL by answering with HTTP error code 301 (Moved permanently). A 301 permanent redirect is not considered webspam by Google. Make absolutely sure that no 404 error (page not found) occurs somewhere. Do not perform wildcard redirects.
  • Try to keep the content of old and new page somehow similar, in order to stick with the indexed key words from the old page.
  • Invite GoogleBot by an updated sitemap file. If you have a sitemap for your old page, resubmit it, so that GoogleBot finds the 301’s earlier.
  • It’s okay to have multiple pages that perform 301 redirects; but you should try to avoid multiple redirects one one URL (e.g. A -> B -> C -> D).

Sources:

http://www.mattcutts.com/blog/seo-advice-discussing-302-redirects/
http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=83105
http://groups.google.com/group/Google_Webmaster_Help/web/q-a-from-the-junetune-live-chat

Domain map

March 23rd, 2009 by Peter

If you need a nice geek present, check this one.

http://www.domain-karte.de/

The german ISP company United Domains offers this map for sale, or even for free if you write a short notice about them in your blog. Just as I do ;-)

World map with according domain names

Death March

February 20th, 2009 by Peter

I am proudly following the Internet Explorer 6 death march

Peering and Transit

September 8th, 2008 by Peter

A nice article about the underlying rules of peering and transit fees in the Internet autonomous systems (AS). If you ever wanted know why your HTTP request for the local newspaper home page travels through New York, here is the answer:

http://arstechnica.com/guides/other/peering-and-transit.ars

Password check against LDAP server in PHP

August 26th, 2008 by Peter

I have a long and unfriendly history with PHP. Since I moved to serious languages such as Python, these dark times are over. However, a colleague asked me for some help with his PHP application. He wanted to check user name and password against the LDAP interface of a Lotus Notes server. Here is the code snippet.

I left out the HTML form code that fills the $_POST variables. The “uid” attribute as anchor to find further information might not work in other directories than Notes. Use a tool on your server to find the right one.

Please note that PHP silently performs an anonymous bind if the provided password in ldap_bind() is empty. Please also note the very “advanced” result structure of ldap_get_entries(). No further comment …
[sourcecode language='php']
if ($_POST["user"]) {
if (trim($_POST["pw"])==”") die(“Empy password not allowed”);
$server=ldap_connect(“our.ldap.server.se”);
if (@ldap_bind($server, $_POST["user"], $_POST["pw"])) {
print “Good one
“;
} else {
print “Go away
“;
}
// for fun, get all available info about this guy
$query=ldap_search($server, “”, “(uid=” . $_POST["user"] .”)”);
$res=ldap_get_entries($server, $query);
for($entry=0; $entry < $res["count"]; $entry++)
for($attr=0; $attr < $res[$entry]["count"]; $attr++) {
$attrname=$res[$entry][$attr];
for ($val=0; $val < $res[$entry][$attrname]["count"]; $val++) {
$actval=mb_convert_encoding($res[$entry][$attrname][$val], "HTML-ENTITIES", "UTF-8");
print $attrname . ": " . $actval . "
“;
}
}
}
[/sourcecode]

Self-Fulfilling Prophecy

October 22nd, 2007 by Peter

Every year Gartner announces its opinion about future trends in industry technologies. Beside the fact that industry typically takes this as ‘god-given’ facts even research funding (like EU programs) seems to align itself to the typical hype topics. Therefore these Gartner publications tend to be a self-fulfilling prophecy. Well-known examples are Web 2.0, Grid Computing, and SOA …

In 2008 there is a high probability that industry will be keen on these recently announced topics:

  • Green IT, especially power consumption-aware scheduling.
  • Business Processing Modeling, so SOA is still in the game.
  • Metadata management, but since Gartner’s usage of the word Metadata is different to the typical scientific understanding, I would name this as data consolidation.
  • Virtualization 2.0 (ouch). Add some policy and management features to ’simple’ virtualization and you confirm to the new hype.
  • Mashups. Sound like the old portal story, coming back again.
  • Web platforms.
  • Computing fabric. This one is interesting, since the article says:
    “The next step in this progression is the introduction of technology to allow several blades to be merged operationally over the fabric, operating as a larger single system image.

    Great, we get distributed operating systems back !

  • Real world Web. This is the upcoming (or continued) playground for all mobility research activities.
  • Social software. This fits to my personal observation about the relevance of LinkedIn and friends in the daily work.

Adding copyright statement recursively

April 24th, 2007 by Peter

I needed to add an LGPL copyright statement to all of our 462 Java source code files, in a deep directory tree. You could think about a shell script with same awt magic, but 12 lines of Python also do the job:

[source:python]
import os

copytext=”"”/*
* Copyright (C) 2007
* Author
*
* This code is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

“”"

for dirpath, dirnames, filenames in os.walk(‘.’):
for name in filenames:
if name.endswith(“.java”):
f=open(dirpath+”\\”+name,”r”)
data=f.read()
f.close()
if data.find(“Copyright”) == -1:
print “Changing ” + name
data=copytext+data
f=open(dirpath+”\\”+name,”w”)
f.write(data)
f.close()
[/source]

Solving OutOfMemory and PermGen space problems in Java

April 2nd, 2007 by Peter

Our ASG web application usually leads to OutOfMemory exceptions after 10-20 runs on a 3GB machine. Since we are using multiple software layers which utilize at least 50 different libraries, it is quite hard to profile for the right problem source. We found an excellent page, which summarizes the major problems with Java memory configuration:

http://confluence.atlassian.com/display/JIRA/Causes+of+OutOfMemoryErrors

Before doing anything else (e.g. extensive profiling), go through this page and follow the instructions. It was written for the Jira system, but is useful in any servlet or EJB – based application. For our case, we simply had too much classes loaded.

WS-* specifications overview

February 22nd, 2007 by Peter

You might have noticed that I added some new information on troeger.eu. The most interesting part for you could be the WS-* overview page, which is an additional feature for my Web service specifications tutorial. It provides an automatically generated list of WS-* specifications from W3C. The idea is to have a better overview of the many different specifications available today.

The generator script is written in Python, and relies on the common document formatting in W3C. In theory, the W3C document template allows an automated parsing of all specifications. In practice, there are different template versions, and the authors mis-use the tagging. Therefore, the list is far from being perfect, so I would like to know if there is any interest in further improvements on this overview …

Wasting time with IE bugs

January 30th, 2007 by Peter

You might also know these little ‘by the way’ feature requests from your boss, which cost you 2 days of work and look like 5 minutes of work. I spent the day with one of them.

I tried to develop a little web page with “Web 2.0 style” overview of some videos about our research. After finishing the dynamic list creation in PHP (30 minutes), I started to evaluate the different available JavaScript libraries. As one example, we found BoxOver, which produces really nice-looking tooltip windows, and Scriptaculous. After some playing, we had a basic set of effects on the page.

Next step was to implement that the click on a video preview image leads to the loading of an embedded video player, running the chosen video. YouTube and friends solve this by embedding a flash movie – nice as copy protection, and nice to control through images with JavaScript event handlers. However, we wanted to keep our original movie formats, and therefore looked for a solution to embed MPEG files directly with Windows Media Player or Apple QuickTime Player. Elizabeth Castro provides a great summary of all the things that can go wrong while embedding these players in your web page. The most relevant information was that video player embedding usually demands explicit width and height tags, even if they are marked as optional. After some testing, we got a static version working.

So far so good, but how to show the media player on click ? First option was to hide the media player element and re-show it in the click event handler. This does not work for IE7, since the click on the image brings up an “I disabled an ActiveX control for security reasons and now your page is messed up. Sorry.” warning without any option to continue anyway. I can understand the reasons not to embed hidden ActiveX controls without notice, but I would like to decide myself if this is a problem or not. The second problem was that some browsers started to load all (==10) movies at the same time, since the hidden player object element was already part of the page. Bad user experience with low bandwidth, as you might guess …

Our second idea then was to add the video player code dynamically in the onClick() routine, which is the usual “Web 2.0″ style of modifying the page content on client side. It worked *great’ on Firefox, but the JavaScript code crashed on IE7 all the time. With an useless error message, it took me hours on the web to find the original source of the problem. It seems like Microsoft is not able to fix an approved bug for the appendChild() method, which is known since IE5.5 (!):

[source:JavaScript]
function msvideo(file) {
new Effect.Appear(“enlarge_” + file,{ duration: 3.0 });
var tags = document.getElementsByTagName(‘img’);
for (var i = 0; i < tags.length; i++) {
if (tags[i].id == file) {
var newotag = document.createElement('object');
newotag.setAttribute('type','video/x-ms-wmv');
newotag.setAttribute('data','./data/movies/' + file);
newotag.setAttribute('width','‘);
newotag.setAttribute(‘height’,’‘);
newotag.setAttribute(‘id’,file);
newotag.setAttribute(’standBy’,'Loading player …’);
addParam(newotag,’src’,’./data/movies/’ + file);
addParam(newotag,’controller’,'true’);
addParam(newotag,’autostart’,'false’);
addParam(newotag,’qtsrcdontusebrowser’,'true’);
addParam(newotag,’enablejavascript’,'true’);
tags[i].parentNode.replaceChild(newotag, tags[i]);
}
}
}

function addParam(o, key, value) {
var newparam = document.createElement(‘param’);
newparam.setAttribute(key,value);
// breaks on IE5 to 7 due to MS Bug 927917
o.appendChild(newparam);
}
[/source]

As I understood, you cannot add new child nodes to an open parent container in IE, which is no problem in all the other browsers. If you remove all calls to addParam() in the example above, then everything is fine. The problem – WM10 is shown in IE7, but does not play anything, since the “activate ActiveX plug ins explicitly” feature stops your video from playing with the default settings.

In sum, I found hundreds of postings regarding similar problems with the DOM support in IE. We ended up with converting all videos to flash, and using an embedded player like YouTube:

http://www.dcl.hpi.uni-potsdam.de/

  • You are currently browsing the archives for the Web Development category.