Top posts

Latest articles


Setting up Apache Virtual Hosts

Posted by Jongerius under Development, Internet, Webdevelopment
1 Star2 Stars3 Stars4 Stars5 Stars6 Stars (No Ratings Yet)
Loading ... Loading ...

When you are configuring a testing server, or just playing around with setting up a webserver, at one time you will arrive at the point where you want to create more “domains�. Here you can do two things, set up multiple servers, one for each sub-domain, or use the build in feature ‘Virtual Hosts’ in Apache.

What I will try and explain in this somewhat short tutorial is how to setup a virtual domain in Apache using the httpd.conf file. (Note that if you don’t know what this file does this tutorial is probably not meant for you!)

Basic requirements
Before you start reading this post please make sure you have the following things ready. If not you may not be able to successfully complete the setting up of virtual hosts.

  • Have a version of Apache installed
  • Are familiar with the httpd.conf (at least a little)
  • Have administrator rights in Windows or root access in Linux (in order to restart the Apache services)

If you have all the above then you are ready to set up some virtual hosts. If you are missing any then you will most likely fail, still feel free to read on just don’t expect miracle’s.

Setting up the basics
Now for this all to succeed you should have a domain name. If you don’t you can set up a free one at no-ip.com or an equivalent service. Why is this so important you may ask. Well simple, Apache uses this domain name and any sub-domains related. It translates them using the virtual hosts and calls up the proper website.

For example if you have the domain: play.no-ip.com
and somebody calls mail.play.no-ip.com, then Apache can see this and look in its virtual hosts to find a matching website.

Now that you know this it is time to set up our so called “mail� sub-domain. Note that the content is irrelevant for setting it up. Pretend that every virtual host contains some type of meaningful website.

Every virtual host will look similar to the following code:

DocumentRoot "/usr/http_roots/mail"
ServerName mail.play.no-ip.com
ErrorLog logs/mail.play.no-ip.com-error_log
CustomLog logs/mail.playno-ip.com-access_log common

DirectoryIndex index.html index.htm index.php
So lets explain what it all means. I’ll do this step by step to not confuse you any further.

indicates to Apache that a new virtual host definition is starting, where it is listening on all network cards in the PC and to port 80. This is default for most websites.

The DocumentRoot is somewhat self explaining. It is the address to the website, meaning the fully qualified location on the disk. Eg for Windows this could be something like “C:/http_root/mail�. For any application that originates from Linux it is best to use forward slashes rather then backslashes.

The errorlog and CustomLog both contain information as to where Apache is to store requests sent and failed. In theory you can place them anywhere.

The last and probably most important thing to keep track of is the DirectoryIndex. This allows you to set what files Apache should load if the root of the directory is called. For example:
mail.play.no-ip.com/
is translated by Apache into
mail.play.no-ip.com/index.html

Advanced options
Like with anything in Apache you can use somewhat more advanced options to tweak your virtual host. I will discus a few of them to give you a feel of what you can do with virtual hosts. For example expanding the root of the website a bit (don’t worry if you don’t know what it means I will come back on this somewhat later).

Setting options
On of the more useful settings is the Option tag, this allows you to enable or disable specific Apache options. I commonly use this for enabling file browsing (Indexes) or allowing multiple views (MultiViews).

Syntax: Options

Expanding the root
Another advanced option I love to use is expanding the website with other websites. For example you could mount the userhelp.play.no-ip.com website under mail.play.no-ip.com/help.

Off course the folder you mount does not need to be an existing part of the domain, it can quite literally be any folder you like (as long as Apache has access).

To do this you need only one command, namely AliasMatch. This allows you to translate any web-address into a physical address on the disk. In this post we will continue on the example already mentioned. So lets add the help directory.
AliasMatch ^/help(/.*)?$ “/usr/http_root/userhelp�

As you can see the first part contains weird looking code, well that is because Apache supports the usage of regular expressions. I used those to map anything starting with “help� to the userhelp files on the disk.

In closings
I’ve introduced you with a lot of new and hopefully useful information. But keep in mind that every change you make in the httpd.conf is to be followed by restarting Apache. Otherwise the changes will not appear until the next time you reboot the system.


Optimizing .Net Remoting

Posted by Jongerius under Development
1 Star2 Stars3 Stars4 Stars5 Stars6 Stars (1 votes, average: 4.00 out of 6)
Loading ... Loading ...

Have you ever worked with .Net remoting and had the problem of huge lag and lost information. Well when I was developing a ocean simulator this is just what happened to me. In our case the advantage of distributing the work load was soon overtaken by the overhead of the network traffic.

Don’t get me wrong in most applications you will never find any hinder from using remoting, but our application had thousands of objects that were communicating over the network. To keep it short it produced so much overhead the program, on all computers, would stall and eventually crash. Not something you want on a production system. So let me try and explain why this happened to us, and most likely to you in similar systems.

Disclaimer: I am expecting you to already know how remoting works, and what worked for me might not work for you. But you should be able to use my information to solve some problems in latency and network overhead.

The setup
In our application we had a simple setup, just to keep it manageable. We had a ocean on one computer and distributed all the fish over the various subscribing systems. With this we expected problems would occur with A.I. of similar fish so all fish of one species were located at one system.

To prevent any single system from being crippled with hundreds of fish while another had not even one we included a load balancing system. This system spread any new species to those system with the fewest amount of fish.

Overall we thought this would be a good setup and would not cause to many problems. Oh boy were we wrong!

First trial
During our initial trials with up to fifty fish everything appeared to run smoothly. But then came the shock. As soon as the amount of fish increased to over 100 with two clients the programs locked up completely. I was less then happy with this result, lets just say that some nasty words were used.

So what we did was introduce caching into the system, in our case nothing else was reachable as we only had a few weeks left. The new scenario included that every system had its own cache copy of the entire ocean. Thus reducing the number of requests send over the network somewhat.

Our hopes were that this would cut the network traffic in about half. And initially it did, we only updated the cache every three seconds or less (Took some tweaking to find an acceptable level). What we forgot to think about was the fact that the more fishy there were in our little ocean, the more objects had to be copied across the network.

Second trial
After we thought to solve most of our problems we started testing the new scenario. At first everything appeared to work fine, but then again the A.I of the fishy were not yet activated. Without enabling the A.I. the world could sustain about 500 fishes on three different systems without to much problems.

Successful trial you might think, but alas we were to happy to soon. In the second trial I enabled my A.I. system. Soon after I wished I didn’t though. The application started out fine, but after a few minutes of running the first remoting exceptions were thrown. Did not take to long to completely crash the application again.

What I had forgotten to take in mind was that in our system the fishes interacted with each other. This is needed for finding food and allies as well as fleeing for potential threads. But it also dramatically increased the amount of network calls to remoted objects.

Third trial setup
To make it appear the program was working we introduced some shortcuts, like making the A.I. dumber and reducing the cache refresh rate. Needless to say it made the entire program useless, but then again it was only a school project which needed to run for 15 minutes tops.

Still I was not happy with the results. I mean you must be able to apply remoting without instantly crashing or slowing down your application. To find out if it is even possible I decided to start a library for automating remoting tasks. This includes a network service, load balancer and base classes for any object needing to be networked.

Now as of yet I’ve not been able to do much testing, or completing for that matter, of the library. But it is showing promise as I’m only sending calls with changes of values and not entire objects. As well as trying to make every networking call in separate threads as not to block the program.

Remoting a real challenge
At first remoting may look appealing because of the ease at which you can set it up, well relatively spoken that is. But it has huge performance hits when you try to remote to many objects and don’t apply the following simple tricks:

  • Reduce the number of networked calls whenever possible
  • Don’t use serialization, unless absolutely necessary (sending huge XML or BLOB data is not smart!)
  • Try to only send primitive data types, like integer and bytes. Prevent using strings as these can be quite long in size
  • Work as much as possible in separate threads to prevent locking the program when waiting on return values.
  • When calling void functions use a-synchronic calls, thus preventing the calling application from blocking

Hopefully when you apply these pointers you will have more success then we had with our setup. And if you are interested in knowing the results of my experiment in creating a library with less overhead then stay tuned every now and then. If you found a solution to the lag and latency with remoting don’t hesitate to contact me.


Getting Internet Explorer to Crash

Posted by Jongerius under Internet, Webdevelopment
1 Star2 Stars3 Stars4 Stars5 Stars6 Stars (No Ratings Yet)
Loading ... Loading ...

I’ve been developing websites for quite some time now and I consider myself to have a real thorough understanding of how to write good HTML code. But lately I’ve found myself wondering if IE (Internet Explorer) hates me!

Why am I saying this, well the following is the case. I’ve got a pretty big web project in the workings and most of it works fine in both Firefox and IE. But I got reports back from some of my testers (more like volunteers) that the website kept crashing their browser. First thing I did was check it out. I couldn’t find it so at first I thought it to be a fluke, but these guys kept reporting the same thing. Specific pages were crashing IE. Just about half of the pages!

After some talking with the testers and some trial and error I finally got IE to crash. I loaded a perfectly OK page, completely XML1.0 Strict valid. And IE decided to tell me to go and ***** myself.

IE Notification of my crash

Nice, but vague, report of IE

So what was the reason for the crash? I don’t know exactly. What I do know is that it only happens when you have both IE and some form of Visual Studio Debugger installed. My guess is that the debugger somehow interferes in the parser of IE. Some specific order of elements(like div, b) cause this parser to crash. Note that it only seems to happen in combination with the CSS styles I’m using.

First I thought it was because the pages in question were using tables inside div layers, which is not a nice way of programming. But after changing this to full div lay-out and validating it with W3.org the damn thing still crashed.

Granted the point of the crash is know different. It only happens when you try and select the text, but it is still annoying to crash browsers. The positive spin I’m giving it right now is that it is a copy protection method, which is a load of crap.

Round up
So what’s my conclusion of this. I’m afraid I don’t know what to do at this point. I can’t seem to find the exact cause for IE to crash. Other then that it is a combination of the Visual Studio Debugger and IE(all versions by the way). Guess I have a lot more debugging to do to try and figure this one out.

Oh and if any of you had the same experience, or better yet solved it. Please let me know! I’m dying to solve this one.


1, 2 or 3 tier design

Posted by Jongerius under Development
1 Star2 Stars3 Stars4 Stars5 Stars6 Stars (1 votes, average: 5.00 out of 6)
Loading ... Loading ...

Ever had the challenge of designing software or business applications. If so you probably faced the same problem most of us have. Which tier design do I pick?

The three tiers
Lets start of with a brief explanation of what the different tier setups are. Most applications work as follows. You have a user interface that allows input and displays information. The program then processes the entered information before saving it internally. This data then gets stored into a file when the program closes or in between for safety reasons. This process of displaying, processing and storing information is called 1-tier. Where everything is done by one application.

A two-tier setup means that you have the same application as above, but all the information is stored using a second program. For example a database system. This storage system can have some primitive checks, like data integrity and type (text, numeric, etc).

A three tier system is even more complicated. Here one application is responsible for displaying and input handling. A second application handles all business intelligence checks. That is verifying if information complies with rules, eg. a phone number consists of ten digits. A third and final application takes care of the storage of information.

One setup not mention is the N-Tier setup. This means that there can be multiple applications that handle displaying and input. This is mostly for web based applications, but to complicated to explain here.

Advantages
The more tiers you pick the more overhead your system will have. I mean every different application (tier) needs to communicate with one or two others. This needs verification that it was successful. So why on earth would you pick the three tier implementation! Well easy enough. If your solution is complicated, not just a simple webshop or personal tool, then it may be complicated to maintain and update. This is one of the reasons to choose for two tier systems.

So when to pick the 1-tier system, well if your application fits the following needs:

  • Small amount of users that need access to the same information
  • Business intelligence is limited and somewhat easy
  • There is little or no expansion planned for the future

Some pointers for choosing the two-tier system:

  • System has multiple users that need access to the same information
  • Business intelligence is limited and somewhat easy
  • Some expansion may be needed, and the storage capabilities must be easily updated (change of database software)

Reasons for choosing a three-tier system:

  • High degree of flexibility required, for example easy to change business inteligence
  • Many different visitors that use the software simultaneously

As you can see in the list above it is not easy to make the choice between the various models. By far the choice depends on what you expect of the solution in the future. If you expect many changes then two or three tier is probably the way to go. Separate the logic and user interface as much as possible.


Increasing the Popularity Ranking

Posted by Jongerius under Search Engines, Webdevelopment, Website optimization
1 Star2 Stars3 Stars4 Stars5 Stars6 Stars (No Ratings Yet)
Loading ... Loading ...

For search engines the ‘Popularity Ranking’ (PR in short) is one of the important algorithms used in ranking websites. Knowing this, a lot of webmasters will do anything to increase the PR of their website. In this (somewhat short) article I will walk you through some of the do’s and don’ts in optimizing you PR. Short description of what PR is first. It measures the amount of links and the general value of a page for a search engine. This is used to appropriately rank pages.
Lets first give a firm warning: The PR displayed by Google is NOT the one they use in the algorithm

I love myth busting, and this is the most persistent one. Google has never presented the general public (meaning us) with the rankings they give pages (PageRank), nor have they confirmed using the system. From experience I know they use a form of PageRank, but I also know it is not the stupid number (or green bar) displayed in the toolbar.

Back to basics
Even though Google (and others) would love to deny it, the only way to know if a page or website is popular is to look at the amount AND type of links a website gets. Notice that I sneaked the type of link in there, this is because I don’t know precisely what they see as a good link and what not (more on that later on). Why do they need to use this so called link graph! Well it’s easy search engines are computer programs looking for patterns. This means they can’t look at the amount of visitors a website has, because they simply don’t have access to this kind of data. (Baring in mind you haven’t installed Google Analytics that is)

That leaves the question of: “Are all links of equal value?”

Again an easy answer NO they aren’t. Let me explain why to you. If all links were of equal value then it would be very easy to artificially increase rank by linking a bunch of websites together. Obviously this is not what search engines like. We shouldn’t meddle in their priced ranking system to make it useless.

Bringing a new question into mind. If all links aren’t equally valuable then how on earth do I know if a link is valuable for my website. Short answer yet again. You don’t, not exactly anyway. How to value a link and how to decide if it will help you in increasing PR is a corporate secret of the search engines. But you can guess it just as easily as I can. What makes a link good. Lets view the page linking to you from a visitors point of view. Will this link bring the visitor more value? Will it enlighten him further or bring more entertainment or is it just seen as spam to be ignored?
Why do I use the visitor as a measurement in the value of a link. Easy, search engines try and please the visitors to get accurate results. So if a visitor might click the link then it must be of value.

Increasing PR
Now that you now how to select website you would like to get linking to you the difficult part can begin. Try and persuade the webmaster to add a link, but don’t be fooled in reciprocal linking. If your website is good enough why would anyone hesitate in placing a link to it.

Which brings me to the last point for this article. I’ve seen the best results in increased PR by simply doing nothing. I don’t exactly know why or how, but I haven’t done any SEO (Search Engine Optimizing) on any of my pages and the PR seems to be increasing every update made by the search engines.

Concluding
So what should you do, well opinions vary a bit. Some prefer a very agressive linking scheme and try to get every link they can. Personally I would prefer to do little to nothing about linking at all. Just let it happen somewhat naturally and you should be fine.

Next Page »