Top posts

Posts in Internet


Postfix, MySQL setup a blackhole

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

In previous articles I got into how to setup Postfix and Dovecot using MySQL for management. Well this time round a question rose about creating a blackhole. Which is basically a catch all e-mail address that dumps all mail coming in.

Doing this in the MySql setup created before should be relatively easy. First of modify the ‘/etc/aliasses‘ file and add ‘devnull: /dev/null‘. This will add a virtual debian user called devnull to the system. Keep in mind this alias is not yet active. To activate it run: newaliases. This will compile the file and load it into the memory.

Now open either PostfixAdmin or MySql and add an alias from ‘@domain.com’ to ‘devnull’. Which will catch all e-mail sent to domain.com and store it into the file belonging to user devnull, which in our case is the blackhole :) .

Please be carefull, as all mail sent to the domain will be dropped unless either an alias or a mailbox is defined for the domain.


Using Ajax in your website

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

I noticed something when I went through the posts I created on this blog. I have been raving for and against Ajax in several posts. Ranging from whether or not you should include Ajax for usability, how to work with Ajax in combination with forms and my personal favorite if you should use Ajax at all. Please keep in mind that this last post is really old already and probably a bit outdated.

Looking through all of these posts I noticed that even though I talked quite some bit about Ajax I never actually gave any examples of how to implement it. So today I will correct this mistake ;)

A simplified explanation of what Ajax is

It’s probably best to first give a very brief explanation of what Ajax is and how you could use it to create more dynamic and user interactive web pages. So what is Ajax actually. Well in a nutshell it’s a JavaScript implementation of communicating between the browser and the web server without having to reload an Internet page.

You can create a good impression of how it works by thinking about this as follows. In an traditional website each action a user takes will cause the browser to call a page on the web server. The web server then generates the full HTML for that page and returns it to the browser. This is visible to the user as the page they are looking at will ‘refresh’. Ajax is a technique to call the web server without reloading a page or redirecting to a new page. Hence fetching new content to an already displayed page in the browser. See the image below for a graphical overview of the communication between the browser and the web server during a typical Ajax call.

Ajax Interaction diagram

This gives you the change to greatly enhance your existing website with new features. Loading in content area’s on the fly. Submitting forms to the server without having to redirect the user, you name it and you can do it with Ajax. There are some limitations, but most of those are covered in my initial articles on this blog.

Multiple browsers, multiple problems

One of the first things I should probably try and explain is that every browser seems to have a different way of implementing the Ajax object. On its own this is not a big issue, but you need to keep track of this fact when you build some form of Ajax functionality in your website.

So creating the Ajax object needed to perform these calls to the web site has to be done with some try and catch work. Below is an example of how to create the Ajax object, supported by most of the popular browsers. In the example we first try and create the Ajax object for the Internet Explorer, which uses ActiveX objects.

try
{
// try to allocate the ActiveX object used by Internet Explorer
this.xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
this.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
this.xmlHttp = false;
}
}

if (!this.xmlHttp && typeof XMLHttpRequest!='undefined')
{
// fallback for Firefox and other Mozilla based clients
this.xmlHttp = new XMLHttpRequest();
}

After executing this code (keep in mind it is JavaScript so put it in a script block in the HTML) you should have the Ajax object available in this.xmlHttp. It may be useful to know a little more about the object functions before continuing the example. The Ajax object has the following functions:

  • .status,
    returns the current status of the page. This is after the result is returned from the web server. (Status 200 is good)
  • .responseText,
    contains the result that was sent by the webserver after the url was called
  • .open(protocol, url, asynchronized),
    will open the connection to the web server and start the call
  • .onreadystatechange,
    the event that gets triggered by the Ajax object during the call to the webserver. This will be called multiple times, especially in Internet Explorer. (Possible status: 2 = busy, 4 = done)
  • .send,
    send the request to the server and wait for the result (or not if asynchronized call was selected)

A basic call to the webserver

After initializing the Ajax object you can perform any call to the webserver you’d like. The example below will show you how to open an web page and display the result into a message box. What the content is that is returned is not relevant for the functioning of the example.

this.xmlHttp.open('GET', 'http://www.example.com/page.html', false);
this.xmlHttp.onreadystatechange = function()
{
if (self.xmlHttp.readyState == 4)
{
alert(self.xmlHttp.responseText);
}
}
this.xmlHttp.send(null);

As you can see this is a very basic example, but it does show exactly how to use the Ajax technology. You can apply this logic for loading in new content on the fly, or just preloading some stuff.


Corel WinDVD 9 Blue-Ray error =38

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

I love playing DVD’s on my MediaCenter. Well until very recently I used WinDVD to do so, which worked out perfect. Supporting HD-DVD / BlueRay and normal DVD. Recently I got the error =38 every single time when I started out the WinDVD application.

At first you might think that you may have to restart or that something went wrong during the loading of the application. But the problem kept occurring even after rebooting several times. Just to make sure that it had nothing to do with the computer I re-installed. But allas the problem remained.

So the internet became my best friend. I started searching for the error, unfortunately I found nothing exactly describing what is going wrong. But I did found some obscure reference to a new authentication and license service that Corel is including in it’s newest products.

Damn the windows services

Then I rememberd something. A little while back I optimized the computer to perform better. One of the usuall things I do is disable programs to startup and services to start. Mostly those that I do not recognize. One of the services I disabled was the ‘Protexis Licensing V2′ service. I now that I read something about this on the Internet in relation to the Corel Applications.

So just for fun I enabled the services and started it up. And sure as hell, no more errors when I started WinDVD 9. Problem solved ;)

As to why Corel opted to such obscure error messages is beyond me. Just give me a clear error stating that the Licensing service is not running. At least then I know what to do! :)


Speeding Apache up using Compression

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

As of late I started to notice my little VPS server had more difficulty keeping up with the amount of data it has to sent to the webbrowsers. I knew that the amount of requests increased and after some tracking I found out that the average page size also increased.

Keep in mind the average page size is not only the size of the HTML but also adding the external CSS, JavaScript and images. Which could dramatically increase the amount of data the users are downloading. So I started looking in the compression options of Apache 2.0

First I looked on the official Apache page, but as usual the data is probably available but not very user friendly. So after some testing and crashing I found out the following procedure which seems to work fine to enable compression per Virtual Host.

Firstly enable the module that supports compression by executing:

:> ln -s /etc/apache2/mods-available/deflate.load /etc/apache2/mods-enabled/deflate.load

This will instruct Apache to load the needed library (module) for compression using GZip. The second thing you will need to do is add the following lines to every single Virtual Host you want to use compression on.

    <Location / >
      SetOutputFilter DEFLATE
      BrowserMatch ^Mozilla/4 gzip-only-text/html
      BrowserMatch ^Mozilla/4\.0[678] no-gzip
      BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
    </Location>

This will enable the compression for output (everything sent to the end-user) but not for incoming requests, which in my case is enough compression for right now. It also exludes some browsers that do not support compression.

Now restart or reload your apache by running the statement below and your website should support compression. This will make the loading of pages faster, though the client software needs to decompress the pages from this point on.

:> etc/init.d/apache2 reload

If you have any trouble enabling compression just leave a message and I’ll try and help you where I can.


Setting up a mailserver, continued

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

In my last article on how to setup a basic mail server in debian using postfix and dovecot, I am now continueing on how to setup some basic spam filters. The reason to split this up, well I was stupid and assumed I wouldn’t need a spam filter yet. But I forgot that I also moved one domain to my new mail server that got 200 spam messages a day.

So now to repair my mistake I am adding the following features to my already existing mail server. To find out how to setup the  mail server itself read my earlier article.

  • Use spamassassin to mark spam in the header
  • Change the mail delivery to dovecot LDA, this is needed for step 3
  • Automatically move marked e-mails to the spam folder of the user

Sounds easy right. Well it should be ;-) .

(more…)

« Previous PageNext Page »