<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pantokrator&#039;s Blog</title>
	<atom:link href="http://blog.pantokrator.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pantokrator.net</link>
	<description>Nam et ipsa scientia potestas est.</description>
	<lastBuildDate>Sat, 17 Oct 2009 07:02:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Reading URLs protected with HTTP Authentication with Java</title>
		<link>http://blog.pantokrator.net/2008/09/23/reading-urls-protected-with-http-authentication-with-java/</link>
		<comments>http://blog.pantokrator.net/2008/09/23/reading-urls-protected-with-http-authentication-with-java/#comments</comments>
		<pubDate>Tue, 23 Sep 2008 21:35:54 +0000</pubDate>
		<dc:creator>pantokrator</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://blog.pantokrator.net/?p=9</guid>
		<description><![CDATA[In Java, you can use URLConnection class to read from an URL. For example, to read the page from google.com, you can do something like this:

import java.net.*;
import java.io.*;

public class URLConnectionReader {
    public static void main(String[] args) throws Exception {
        URL google = new URL("http://www.google.com/");
  [...]]]></description>
			<content:encoded><![CDATA[<p>In Java, you can use <a id="geiq" title="URLConnection" href="http://java.sun.com/javase/6/docs/api/java/net/URLConnection.html" target="_blank">URLConnection</a> class to read from an URL. For example, to read the page from google.com, you can do something like this:</p>
<blockquote>
<pre>import java.net.*;
import java.io.*;

public class URLConnectionReader {
    public static void main(String[] args) throws Exception {
        URL google = new URL("http://www.google.com/");
        URLConnection gc = google.openConnection();
        BufferedReader in = new BufferedReader(
                                new InputStreamReader(
                                gc.getInputStream()));
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            System.out.println(inputLine);
        in.close();
    }
}</pre>
</blockquote>
<p>If the access to the URL is protected with authentication mechanism, IOException is thrown when you try to read from InputStream associated with URLConnection. In that case, you need to use <a id="q6yv" title="Authenticator" href="http://java.sun.com/javase/6/docs/api/java/net/Authenticator.html" target="_blank">Authenticator</a> class from java.net package, that makes accessing password-protected URLs as easy as can be.</p>
<p><span id="more-10"></span></p>
<p>So, you simply install an Authenticator, with Authenticator.setDefault(). Then, when authentication is necessary, the installed Authenticator&#8217;s getPasswordAuthentication() method is called, and you return a <a id="gixj" title="PasswordAuthentication" href="http://java.sun.com/javase/6/docs/api/java/net/PasswordAuthentication.html" target="_blank">PasswordAuthentication</a> instance with the appropriate username and password.</p>
<p>The example code is shown below.</p>
<blockquote>
<pre>import java.net.*;
import java.io.*;

public class URLConnectionAuthReader {
    public static void main(String[] args) throws Exception {
        String username = "username";
        String password = "password";
        URL authurl = new URL("http://www.protectedurl.com/");

        Authenticator.setDefault(new MyAuthenticator(username, password));
        URLConnection ac = authurl.openConnection();
        BufferedReader in = new BufferedReader(
                                new InputStreamReader(
                                ac.getInputStream()));
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            System.out.println(inputLine);
        in.close();
    }

    protected static class MyAuthenticator extends Authenticator {
        private String username, password;

        public MyAuthenticator(String user, String pwd) {
            username = user;
            password = pwd;
        }

        protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication(username, password.toCharArray());
        }
    }
}</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.pantokrator.net/2008/09/23/reading-urls-protected-with-http-authentication-with-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Encoding DVD to MPEG-4 AVI using MEncoder</title>
		<link>http://blog.pantokrator.net/2006/09/25/encoding-dvd-to-mpeg-4-avi-using-mencoder/</link>
		<comments>http://blog.pantokrator.net/2006/09/25/encoding-dvd-to-mpeg-4-avi-using-mencoder/#comments</comments>
		<pubDate>Mon, 25 Sep 2006 19:37:03 +0000</pubDate>
		<dc:creator>pantokrator</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.pantokrator.net/2006/09/25/encoding-dvd-to-mpeg-4-avi-using-mencoder/</guid>
		<description><![CDATA[1. Introduction
MEncoder is a part of MPlayer package, a movie player for Linux that can play most MPEG, VOB, AVI, OGG/OGM, VIVO, ASF/WMA/WMV, QT/MOV/MP4, FLI, RM, NuppelVideo, yuv4mpeg, FILM, RoQ, PVA, Matroska files, supported by many native, XAnim, RealPlayer, and Win32 DLL codecs. MEncoder (MPlayer&#8217;s Movie Encoder) is a simple movie encoder, capable of encoding [...]]]></description>
			<content:encoded><![CDATA[<h2>1. Introduction</h2>
<p><strong>MEncoder</strong> is a part of <a target="_blank" href="http://www.mplayerhq.hu/">MPlayer</a> package, a movie player for Linux that can play most MPEG, VOB, AVI, OGG/OGM, VIVO, ASF/WMA/WMV, QT/MOV/MP4, FLI, RM, NuppelVideo, yuv4mpeg, FILM, RoQ, PVA, Matroska files, supported by many native, XAnim, RealPlayer, and Win32 DLL codecs. <strong>MEncoder</strong> (MPlayer&#8217;s Movie Encoder) is a simple movie encoder, capable of encoding the wide range of fileformats and decoders of MPlayer, to all the codecs of <a target="_blank" href="http://ffmpeg.mplayerhq.hu/">FFmpeg&#8217;s libavcodec</a>.</p>
<p><span id="more-9"></span></p>
<h2>2. Encoding a DVD</h2>
<h3>2.1 MEncoder Command Line</h3>
<p>MEncoder command line for DVD encoding has the following format:</p>
<blockquote><p>mencoder dvd://title# [options].</p></blockquote>
<p>The title# is number specifying DVD titles to encode, and with [options] parameters you can control many aspects of encoding process. Some options for DVD encoding are discussed later in this article.</p>
<h3>2.2 Cropping and Scaling</h3>
<p>Native DVD resolution is 720&#215;480 for NTSC, and 720&#215;576 for PAL, but there is an aspect flag that specifies whether it is full-screen (4:3) or wide-screen (16:9). Many wide-screen DVDs are not strictly 16:9, and will be either 1.85:1 or 2.35:1. This means that there will probably be some black border bands in the video that will need to be cropped out.</p>
<p>To crop a video, you can use <strong>-vf crop[=w:h:x:y]</strong> video filter, that crops the given part of the image and discards the rest. The <code>w</code> and <code>h</code> parameters specify cropped image width and height, and <code>x</code> and <code>y</code> parameters specify position of the cropped picture.</p>
<p>MPlayer provides a crop detection filter that can help you determine the crop rectangle. Run MPlayer with <strong>-vf cropdetect</strong> and it will print out the crop settings to remove the borders. You should let the movie run long enough that the whole picture area is used, in order to get accurate crop values. For example, running:</p>
<p><code>$ mplayer dvd://1 -vf cropdetect</code></p>
<p>will give output similar to this:</p>
<p><code> [CROP] Crop area: X: 2..719  Y: 68..505  (-vf crop=704:432:10:72).<br />
[CROP] Crop area: X: 2..719  Y: 68..505  (-vf crop=704:432:10:72).<br />
... </code></p>
<p>Because MPEG-4 uses 16&#215;16 macroblocks, you will want to make sure that each dimension of the video you are encoding is a multiple of 16 or else you will be degrading quality. You can do this by rounding the width and height of the crop rectangle down to the nearest multiple of 16.</p>
<p>To scale the video image, you can use <strong>-vf scale=[w:h:[...]]</strong> video filter (for a complete list of scale filter parameters, consult the mencoder manual). Parameters <code>w</code> and <code>h</code> specify scaled width and height of an image.</p>
<p>You can test your video filters options before the actual encoding, by passing the to the mplayer for unencoded video playback. For example:</p>
<p><code> $ mplayer dvd://1 -vf crop=704:432:10:72,scale=352:216 </code></p>
<h3>2.3 Specifying Encoding Segment</h3>
<p>If you want to encode only a section of the DVD, you can use <strong><strong>-ss</strong> time </strong> and <strong>-endpos time|size</strong> mencoder options. The -ss option seeks to given time position, and -endpos option stops encoding after a given time or encoded byte size. For example:</p>
<ul>
<li><code>-ss 01:00:00</code> &#8211; start encoding one hour into the movie</li>
<li><code>-endpos 60</code> &#8211; encode only 60 seconds</li>
<li><code>-endpos 100mb</code> &#8211; encode only 100mb of movie</li>
<li><code>-ss 05:00 -endpos 10:00</code> &#8211; start 5 minutes into the movie and encode 10 minutes of video</li>
</ul>
<h3>2.4 Selecting Audio Channels and Subtitles</h3>
<p>If your DVD has several audio channels and/or subtitles, and you would like to encode a non-default one, you will need to specify audio channel and subtitle to mencoder. To display informations about the DVD and available channels and subtitles, you can use mplayer with option -v.</p>
<p><code>$ mplayer dvd://1 -v</code></p>
<p>It will display many informations about a source DVD, an several lines of text about audio channels and subtitles, for example:</p>
<p><code>[open] audio stream: 0 audio format: ac3 (5.1) language: en aid: 128<br />
[open] audio stream: 1 audio format: ac3 (stereo) language: en aid: 129<br />
[open] audio stream: 2 audio format: ac3 (stereo) language: en aid: 130<br />
...<br />
[open] subtitle ( sid ): 0 language: en<br />
[open] subtitle ( sid ): 1 language: is<br />
[open] subtitle ( sid ): 2 language: pt<br />
[open] subtitle ( sid ): 3 language: el<br />
...<br />
</code></p>
<p>To select an audio channel, you can use either <strong>-aid id</strong> or <strong>-alang code</strong> mencoder option. The -aid option takes id number of the audio stream (128, 129, etc.), and -alang takes two letter language code (en, pt, el, etc.) as a parameter.</p>
<p>Selecting a subtitle is similar to selecting audio channel. Available options are <strong>-sid id</strong> or <strong>-slang code</strong>. The -sid option takes id number of the subtitle (0, 1, etc.), and -slang takes the two letter language code as a parameter (en, is, etc.).</p>
<ul>
<li><code>-sid 128</code> &#8211; selects audio channel with id 128</li>
<li><code>-alang en  -sid 2</code> &#8211; selects English audio channel and subtitles with id 2</li>
</ul>
<h3>2.5 Encoding the Audio</h3>
<p>To encode the audio, you need to specify the audio codec with <strong>-oac codec</strong> mencoder option. To get a list of available codecs you can use <strong>-oac help</strong> option. We will use lavc codec, to encode audio with libavcodec codec. To pass some additional information to lavc codec about type of codec and bitrate, we will use <strong>-lavcopts</strong> mencoder option. That option has several parameters, acodec for specifying codec and abitrate for specifying audio bitrate in kbps. To specify file name of encoded file, there is an <strong>-o file</strong> option. To encode only audio, we will use frameno video codec, that can be used for audio only encoding. For example:</p>
<p><code>$ mencoder dvd://1 -ovc frameno -oac lavc -alang en -lavcopts acodec=mp3:abitrate=128 -o frameno.avi</code></p>
<ul>
<li><code>-ovc frameno</code> &#8211; sets output video codec to frameno, so that video will not be encoded</li>
<li><code>-oac lavc</code> &#8211; sets output audio codec to libavcodec</li>
<li><code>-alang en</code> &#8211; sets the audio language to english</li>
<li><code>-lavcopts acodec=mp3:abitrate=128</code> &#8211; sets libavcodec audio codec to mp3, and audio bitrate to 128 kbps</li>
<li><code>-o frameno.avi</code> &#8211; sets output file name to frameno.avi</li>
</ul>
<blockquote><p>Note: Do not change the name of frameno.avi output file, because mencoder will use it later when video will be encoded.</p></blockquote>
<p>When audio encoding is finished, mencoder will output recommended video bitrates for encoding to various sizes. Take a note about bitrate, as it will be used in next step of encoding the video. Output will be similar to something like this:</p>
<p><code>Recommended video bitrate for 650MB CD: 553<br />
Recommended video bitrate for 700MB CD: 606<br />
Recommended video bitrate for 800MB CD: 713<br />
Recommended video bitrate for 2 x 650MB CD: 1248<br />
Recommended video bitrate for 2 x 700MB CD: 1355<br />
Recommended video bitrate for 2 x 800MB CD: 1569</code></p>
<h3>2.6 Encoding the Video</h3>
<p>For the video encoding we will use libavcodec, because it is superior to DivX 4 or 5 and at least as good as XviD. For a playback in Windows you will need DivX 5 codec installed. To gain a better quality of encoding, we will do a two-pass encoding.</p>
<p>To specify the output video codec, we will use <strong>-ovc codec</strong> option (in this case we will use lavc as codec), and <strong>-lavcopts</strong> to specify encoding parameters. Command for the first pass:</p>
<p><code>$ mencoder dvd://1 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1250:vhq:autoaspect</code><code>:vpass=1</code><code> -oac copy -vf crop=704:432:10:72 -o /dev/null</code></p>
<ul>
<li><code>-ovc lavc</code> &#8211; sets output video codec to lavc</li>
<li><code>-lavcopts vcodec=mpeg4:vbitrate=1250:vhq:autoaspect</code><code>:vpass=1</code> &#8211; sets mpeg4 encoding, bitrate to 610, high quality encoding, automatically set aspect ratio, and encoding pass one</li>
<li><code>-oac copy</code> &#8211; set output audio codec to copy, so that mencoder will use previously encoded sound in frameno.avi file</li>
<li><code>-vf crop=704:432:10:72 </code>- sets video filtering options, previously discussed here</li>
<li><code>-o /dev/null</code> &#8211; sets output file to be /dev/null, since we don&#8217;t need actual first pass encoding, only a log file that mencoder will create for second pass encoding process</li>
</ul>
<p>For the second pass encoding, the command is similar to the previous command:</p>
<p><code> $ mencoder dvd://1 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1250:vhq:vpass=2:autoaspect -oac copy -vf crop=704:432:10:72 -o movie.avi<br />
</code></p>
<ul>
<li><code>-lavcopts vcodec=mpeg4:vbitrate=1250:vhq:vpass=2:autoaspect </code>- options are same as in previous command, only vpass parameter is set to 2</li>
<li><code>-o movie.avi</code> &#8211; sets the file name for output, that will be the final encoded movie</li>
</ul>
<blockquote><p>Note: You can add other options for scaling, subtitles, and partial encoding, discussed earlier in the article, and use values for bitrate that you get while encoding audio, if you want a specific size of final encoded movie.</p></blockquote>
<h2>3. Conclusion</h2>
<p>Well, these are basic instructions for encoding DVD to AVI format. There are many other options available, so if you want even more control over the process, read a <a target="_blank" href="http://www.mplayerhq.hu/DOCS/HTML/en/index.html">manual for MPlayer</a>, and use this article as a guideline. Comments are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pantokrator.net/2006/09/25/encoding-dvd-to-mpeg-4-avi-using-mencoder/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Compiling SDL_image with MSYS/MinGW</title>
		<link>http://blog.pantokrator.net/2006/08/13/compiling-sdl_image-with-msysmingw/</link>
		<comments>http://blog.pantokrator.net/2006/08/13/compiling-sdl_image-with-msysmingw/#comments</comments>
		<pubDate>Sun, 13 Aug 2006 12:40:41 +0000</pubDate>
		<dc:creator>pantokrator</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://blog.pantokrator.net/?p=6</guid>
		<description><![CDATA[1. Introduction
SDL_image is an image loading library that is used with the SDL library, and almost as portable. It allows a programmer to use multiple image formats without having to code all the loading and conversion algorithms themselves. SDL_image supports BMP, GIF, JPG, LBM, PCX, PNG, PNM, TGA, TIFF, XCF, XPM and XV image formats.
SDL_image [...]]]></description>
			<content:encoded><![CDATA[<h2>1. Introduction</h2>
<p>SDL_image is an image loading library that is used with the SDL library, and almost as portable. It allows a programmer to use multiple image formats without having to code all the loading and conversion algorithms themselves. SDL_image supports BMP, GIF, JPG, LBM, PCX, PNG, PNM, TGA, TIFF, XCF, XPM and XV image formats.</p>
<p>SDL_image requires <a target="_blank" href="http://www.ijg.org">JPEG library</a> for JPG image support, <a target="_blank" href="http://www.libpng.org/pub/png/libpng.html">PGN libarary</a> and <a target="_blank" href="http://www.gzip.org/zlib">zlib library</a> for PGN image format support, and the <a target="_blank" href="http://www.remotesensing.org/libtiff/">TIFF library</a> for TIFF image support.</p>
<blockquote><p>Note: Current version of TIFF library has some problems compiling under Windows/MinGW, so we will disable support for tif file format in SDL_image library.</p></blockquote>
<p><span id="more-8"></span></p>
<h2>2. Compiling SDL_image</h2>
<h3>2.1. Compiling zlib library</h3>
<p>Download the latest version of <a href="http://www.zlib.net/zlib-1.2.3.tar.gz">zlib library</a> (version 1.2.3, at the time of writing), and save it in your MSYS home folder.</p>
<p><code> $ tar -xzvf zlib-1.2.3.tar.gz<br />
$ cd zlib-1.2.3<br />
$ configure --prefix=/mingw<br />
$ make<br />
$ make install</code></p>
<h3>2.2. Compiling PNG library</h3>
<p>Download latest version of <a href="ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.12.tar.bz2">libpng library</a> (version 1.2.12, at the time of writing), and save it in you MSYS home directory.</p>
<blockquote><p>Note: Current version of PNG library has some problems with installing shared version of library under MinGW system, so we will disable compilation of shared version, and patch the generated Makefile with a simple sed script, to make it work without problems.</p></blockquote>
<p><code> $ tar -xjvf libpng-1.2.12.tar.bz2<br />
$ cd libpng-1.2.12<br />
$ ./configure --prefix=/mingw --disable-shared<br />
$ mv Makefile Makefile.orig<br />
$ sed -e 's/for ext in a la so; do/for ext in a la; do/' Makefile.orig > Makefile<br />
$ make<br />
$ make install<br />
</code></p>
<h3>2.3. Compiling JPEG library</h3>
<p>Download the source code for <a href="ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz">JPEG library</a> (version 6b, at the time of writing), and save it in your MSYS home directory.</p>
<p><code> $ tar -xzvf jpegsrc.v6b.tar.gz<br />
$ cd jpeg-6b<br />
$ ./configure --prefix=/mingw --enable-static<br />
$ make<br />
$ make install-lib<br />
</code></p>
<h3>2.4. Compiling SDL_image</h3>
<p>Now that we have compiled all needed dependencies for SDL_image library, we can proceed and compile SDL_image library itself. Download the latest version of <a href="http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.5.tar.gz">SDL_image library</a> (version 1.2.5, at the time of writing), and save it in you MSYS home directory.</p>
<p><code> $ ./configure --prefix=/mingw --disable-tif --disable-jpg-shared --disable-png-shared<br />
$ make<br />
$ make install<br />
</code></p>
<h2>3. Conclusion</h2>
<p>This procedure will get you compiled SDL_image library, that you can use in your SDL projects. Do not forget to copy SDL_image.dll library from /mingw/bin to you application directory, if you application makes use of it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pantokrator.net/2006/08/13/compiling-sdl_image-with-msysmingw/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting up MSYS/MinGW build system for compiling SDL/OpenGL applications</title>
		<link>http://blog.pantokrator.net/2006/08/08/setting-up-msysmingw-build-system-for-compiling-sdlopengl-applications/</link>
		<comments>http://blog.pantokrator.net/2006/08/08/setting-up-msysmingw-build-system-for-compiling-sdlopengl-applications/#comments</comments>
		<pubDate>Tue, 08 Aug 2006 21:25:52 +0000</pubDate>
		<dc:creator>pantokrator</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://blog.pantokrator.net/?p=5</guid>
		<description><![CDATA[1. Introduction
MSYS is a Minimal SYStem to provide POSIX/Bourne configure scripts the ability to execute and create a Makefile used by make on MS Windows operating system.
 MinGW is a collection of freely available and freely distributable Windows specific header files and import libraries combined with GNU tool sets that allow one to produce native [...]]]></description>
			<content:encoded><![CDATA[<h2>1. Introduction</h2>
<p><a target="_blank" href="http://www.mingw.org">MSYS</a> is a Minimal SYStem to provide POSIX/Bourne configure scripts the ability to execute and create a Makefile used by make on MS Windows operating system.<br />
<a target="_blank" href="http://www.mingw.org"> MinGW</a> is a collection of freely available and freely distributable Windows specific header files and import libraries combined with GNU tool sets that allow one to produce native Windows programs that do not rely on any 3rd-party C runtime DLLs.<br />
In this tutorial we will setup MSYS/MinGW configuration, and compile libraries needed for development of SDL and OpenGL applications.</p>
<p><span id="more-7"></span></p>
<h2>2. Installation</h2>
<h3>2.1. MSYS Installation</h3>
<p>First, you need to download <a target="_blank" href="http://prdownloads.sf.net/mingw/MSYS-1.0.10.exe?download">MSYS setup</a> exe file, and execute it. Once you have started setup, accept the license and select the folder where MSYS will be installed (or leave it on C:\msys\1.0, which is the default installation location). When installation is finished, MSYS will start post-install script in console window, which will try to detect if there is a previous installation of MSYS on your system (just enter y here), and then it will ask if you have MinGW installed (enter n here, because MinGW will be installed later). Follow the instructions presented, and installation will finish.</p>
<p>Now you have basic Bourne shell on your Windows system, with some standard UNIX-like utilities (make, diff, awk, etc). You can start MSYS shell from Start->Programs->MinGW->MSYS menu.</p>
<p>Next you need to download and install <a target="_blank" href="http://prdownloads.sf.net/mingw/msysDTK-1.0.1.exe?download">msysDTK</a>. The msysDTK package is MSYS Developer Tool Kit, which contains the following list of tools: autoconf, automake, libtool, guile, cvs, openssl, openssh, inetutils, perl and vim. Similar to MSYS, the download is an installation binary. It will default the directory location to your MSYS installation.</p>
<h3>2.2. MinGW Installation</h3>
<p>Download the most recent <a target="_blank" href="http://prdownloads.sf.net/mingw/MinGW-5.0.2.exe?download">MinGW setup</a>, in the time of writing this, it is version 5.0.2. This setup will download and install components of MinGW package. It will present you a list of SourceForge mirror sites, and an option to download only or download and install MinGW components. Next, choose Current as a type of MinGW package, and select components to be installed. At least, choose MinGW base tools, which will install a GNU C compiler, binutils, and Win32 API header files for you. Other components you can choose are g++ compiler (GNU C++ compiler), g77 compiler (fortran), Ada, Java and Objective C Compiler. Next, you need to select a destination folder for component installation. Since we already installed MSYS, you can choose mingw folder in MSYS installation folder for destination folder.</p>
<blockquote><p>If you choose some other folder, you will need to modify /etc/fstab file under MSYS, and map a MinGW installation folder to /mingw MSYS folder. For example, if you installed MinGW in C:\mingw, you will need to add the following line to /etc/fstab file:<br />
<code>C:/mingw /mingw</code></p></blockquote>
<h2>3. SDL compilation</h2>
<h3>3.1. Introduction</h3>
<p><a target="_blank" href="http://www.libstd.org">Simple DirectMedia Layer</a> is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via <a target="_blank" href="http://www.opengl.org">OpenGL</a>, and 2D video framebuffer.<br />
We will download source version of SDL library, and compile it under MSYS/MinGW. There are also precompiled versions of library for MinGW, but if you compile it yourself, you have a control over library configuration and compilation.</p>
<h3>3.2. Preparation</h3>
<p>Download <a target="_blank" href="http://www.libsdl.org/download-1.2.php">SDL library source code</a> (the .tar.gz archive) and put it in your MSYS user home directory. The current library version in the time of writing is SDL 1.2.11.</p>
<blockquote><p>Note: After installing MSYS, setup creates user home folder with the name of system user name, under the MSYS /home folder. You can access it from Windows Explorer from {msys_instal_dir}\home\{windows_user}. When you start MSYS shell, working directory is set to user home directory.</p></blockquote>
<p>Extract the content of the archive and enter SDL directory:</p>
<p><code>$ tar -xzvf SDL-1.2.11.tar.gz<br />
$ cd SDL-1.2.11</code></p>
<h3>3.3. Configuring SDL</h3>
<p>SDL library compilation can be configured with many options. Configure script examines the capabilities of system, and tries to adapt the library configuration. Some options can be controlled by user. For a list of available configuration options and their default values, run:</p>
<p><code>$ ./configure --help</code></p>
<p>One option that you will need to set is &#8211;prefix=PREFIX option. This options set installation directory for the library. Under MSYS, we need to set this option to /mingw directory, so that include files and compiled library is installed in compiler directory.</p>
<p><code>$ ./configure --prefix=/mingw</code></p>
<p>Some options control what parts of SDL subsystem will be compiled into the library:</p>
<p><code> --enable-audio          Enable the audio subsystem [default=yes]<br />
--enable-video          Enable the video subsystem [default=yes]<br />
--enable-events         Enable the events subsystem [default=yes]<br />
--enable-joystick       Enable the joystick subsystem [default=yes]<br />
--enable-cdrom          Enable the cdrom subsystem [default=yes]<br />
--enable-threads        Enable the threading subsystem [default=yes]<br />
--enable-timers         Enable the timer subsystem [default=yes]<br />
--enable-file           Enable the file subsystem [default=yes]<br />
--enable-loadso         Enable the shared object loading subsystem [default=yes]<br />
--enable-cpuinfo        Enable the cpuinfo subsystem [default=yes]</code></p>
<p>If you do not need some SDL subsystems, you can configure compilation to exclude it, by passing parameters to configure script. For example, if you do not need the support for joystick and cdrom subsystem, you can configure SDL with:</p>
<p><code>$ ./configure --prefix=/mingw --enable-joystick=no --enable-cdrom=no</code></p>
<p>Another option that might be interesting is <code>--enable-stdio-redirect</code>, which is enabled by default on Win32 systems. This option enables redirection of standard console output to files stdio.txt and stderr.txt. If this option is enabled, every program output (using functions like printf in C, for example) is redirected to these files. If you don&#8217;t want these files to be created when your SDL program is started, you can disable this option:</p>
<p><code>$ ./configure --prefix=/mingw --enable-stdio-redirect=no</code></p>
<p>You can control C <a target="_blank" href="http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Option-Summary.html">compiler options</a> by setting <code>CFLAGS</code> environmental variable before configuring library compilation. Also, you can set <a target="_blank" href="http://gcc.gnu.org/onlinedocs/gcc-3.4.6/gcc/Link-Options.html">linker flags</a> by setting <code>LDFLAGS</code> variable. Be carefull, setting some compiler options can cause serious compilation or execution problems, so, before setting options, be sure that you know what you are doing. You set environmental variables by using export shell command. For example, to set compiler optimization for size, type:</p>
<p><code>$ export CFLAGS=-Os</code></p>
<p>If you don&#8217;t want to make any customizations to SDL configuration and leave all options to their default values, than just configure it with the following command:</p>
<p><code>$ ./configure --prefix=/mingw</code></p>
<h3>3.4 Compiling SDL</h3>
<p>Now that SDL library is configured for compilation, you can proceed with compilation and installation.</p>
<p><code>$ make<br />
$ make install</code></p>
<p>After that, you will have installed a working version of SDL library, and header files.</p>
<h3>3.5 Testing compiled SDL library</h3>
<p>SDL library provides testing examples in <code>test</code> subdirectory, which you can use to test various features and capabilities of an SDL library. To compile test examples:<br />
<code>$ cd test<br />
$ ./configure<br />
$ make</code></p>
<p>When make process is finished, you can start examples from MSYS shell, by typing the name of test exe file. If you want to start example from Windows, you will need to copy exe file with the SDL.dll library, which can be found under /mingw/bin directory, to some separate directory and start it from there.</p>
<blockquote><p>Note: You can also copy SDL.dll library in windows\system32 directory, and in that case, all the applications that use SDL will use that copy of the library, which might lead to some problems, depending of the options you used during compilation&#8230;</p>
<p>Note: Almost every SDL example gives some output, so depending of options you specified during the SDL library configuration, you can see that output on console, or saved in stdio.txt file.</p></blockquote>
<h2>4. Conclusion</h2>
<p>This procedure will get you complete system for configuring and compiling SDL applications, and you should be able to compile existing SDL application, or write your own&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pantokrator.net/2006/08/08/setting-up-msysmingw-build-system-for-compiling-sdlopengl-applications/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Flaming Guide</title>
		<link>http://blog.pantokrator.net/2006/02/18/flaming-guide/</link>
		<comments>http://blog.pantokrator.net/2006/02/18/flaming-guide/#comments</comments>
		<pubDate>Sat, 18 Feb 2006 11:09:47 +0000</pubDate>
		<dc:creator>pantokrator</dc:creator>
				<category><![CDATA[Humor]]></category>

		<guid isPermaLink="false">http://blog.pantokrator.net/?p=4</guid>
		<description><![CDATA[Fueling The Fire
Now, to get a proper flame going, you have to setup people. Normally this is done by approaching with a somewhat non imposing character and bluntly saying something you know will piss people off. Try and be subtle about it. Throw in things like religion, politics and choice of pet. Here are some [...]]]></description>
			<content:encoded><![CDATA[<h3>Fueling The Fire</h3>
<p>Now, to get a proper flame going, you have to setup people. Normally this is done by approaching with a somewhat non imposing character and bluntly saying something you know will piss people off. Try and be subtle about it. Throw in things like religion, politics and choice of pet. Here are some examples:</p>
<blockquote>
<ul>
<li>Damn liberal</li>
<li>Damn chicken god lover</li>
<li>Damn cat lover</li>
</ul>
</blockquote>
<p>Notice these are pretty laid back. You could substitute a few key swear words as well, should you choose to. Also, try and kindle an old flame as well. Pull up something dirty out of the skeleton closet, and using some kind of excellent finesse, throw it into the conversation:</p>
<p><span id="more-6"></span></p>
<blockquote><p>This reminds me of when such and such happened</p></blockquote>
<p>What a great plan! You get two flames for the price of one! Once last resort is to bring it to the gentoo-dev mailing list. Doing so produces a wider audience to further spread the flame. This however, has no finesse and should be utilized only at last resort! Now that we have a flame going, we need to keep it going. Let&#8217;s take a look at how we can keep the flame burning.</p>
<h3>Keep The Flame Burning</h3>
<p>First off, you need to recognize the key players in a flaming situation. Read archives of the list to see who will keep commenting no matter what you say. They are the key to your flame&#8217;s survival! First thing to do in your flame is to bring the other person down. Such tactics including things like personal insults. This is usually family members, expecially mothers:</p>
<blockquote><p>That&#8217;s not what your mother said last night!</p></blockquote>
<p>Another way to achieve a continual flame is to find people that you&#8217;ve seen screwup before and bring that up:</p>
<blockquote><p>This person did such and such so they&#8217;re stupid and we shouldn&#8217;t listen</p></blockquote>
<p>Another way to handle things is with experience. Come up to the plate with your 10 years work and bash them down with it!</p>
<blockquote><p>I&#8217;ve been doing this for 10 years, so even though your logic is sound, shutup!</p></blockquote>
<p>With experience you can also pose another flame bait, not reading what the person said. By not reading what the person said, you can avoid anything that might support their cause and focus on what truly matters: finding the gunk!</p>
<p>One thing is to frequently refer to <em>us</em> or <em>our</em>. Pretend like people are with you on this, so the uncertain ones will flock to your side!</p>
<blockquote><p>Stop wasting our time!</p></blockquote>
<p>One last resort if your flame appears to be dying is to see the first section. Remember, flames are willing to sacrifice themselves for the better cause! If one is dying, let it rot away and bring a new one! The old one will die in your honor! Now while flames are great for you, they&#8217;re not great when they&#8217;re aimed at you! Let&#8217;s look at some ways to counter flames.</p>
<h3>Putting Out The Flames</h3>
<p>Alright, flamers are pretty persistant, as this doc has clearly shown! To counter, you need to go all out! First thing to do is threaten them with personal loss.</p>
<blockquote><p>A curse upon your children!</p></blockquote>
<p>Also threaten them with account access!</p>
<blockquote>
<ul>
<li>How about I ban you?</li>
<li>How about I delete your account?</li>
<li>How about I let my dog use your account?</li>
</ul>
</blockquote>
<p>Use your experience back as well! Tell them how it is:</p>
<blockquote><p>Don&#8217;t make me slap you with my 20 years experience!</p></blockquote>
<p>Cite them specific documentation, make them read (This will delay for a bit)!</p>
<blockquote><p>read this: <a title="Linkification: http://www.readthisnow.com" class="linkification-ext" style="color: #006620" href="http://www.readthisnow.com/">http://www.readthisnow.com</a></p></blockquote>
<p>Well, that ends it for the flame guide. I hope you enjoyed it! May the Flame be with you!</p>
<p><strong>Note:</strong> Original <em>Flaming Guide</em> article is written by Chris White, and can be found <a href="http://dev.gentoo.org/~chriswhite/docs/flame.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.pantokrator.net/2006/02/18/flaming-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Real Programmers</title>
		<link>http://blog.pantokrator.net/2006/02/17/real-programmers/</link>
		<comments>http://blog.pantokrator.net/2006/02/17/real-programmers/#comments</comments>
		<pubDate>Sat, 18 Feb 2006 01:10:14 +0000</pubDate>
		<dc:creator>pantokrator</dc:creator>
				<category><![CDATA[Humor]]></category>

		<guid isPermaLink="false">http://blog.pantokrator.net/?p=3</guid>
		<description><![CDATA[
Real Programmers don&#8217;t write specs &#8211; users should consider themselves lucky to get any programs at all and take what they get.
Real Programmers don&#8217;t comment their code. If it was hard to write, it should be hard to understand and even harder to modify.
Real Programmers use C since it&#8217;s the easiest language to spell.
Real Programmers [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li>Real Programmers don&#8217;t write specs &#8211; users should consider themselves lucky to get any programs at all and take what they get.</li>
<li>Real Programmers don&#8217;t comment their code. If it was hard to write, it should be hard to understand and even harder to modify.</li>
<li>Real Programmers use C since it&#8217;s the easiest language to spell.</li>
<li>Real Programmers have no use for managers. Managers are sometimes a necessary evil. Managers are good for dealing with personnel bozos, bean counters, senior planners and other mental defectives.</li>
<p><span id="more-5"></span></p>
<li>Real Programmers don&#8217;t write application programs; they program right down on the bare metal. Application programming is for feebs who can&#8217;t do systems programming.</li>
<li>Real Programmers&#8217; programs never work right the first time. But if you throw them on the machine they can be patched into working in &#8220;only a few&#8221; 30-hour debugging sessions.</li>
<li>Real Programmers never work 9 to 5. If any real programmers are around at 9 AM, it&#8217;s because they were up all night.</li>
<li>Real Programmers don&#8217;t write in BASIC. Actually, no programmers write in BASIC, after the age of 12.</li>
<li>Real Programmers don&#8217;t play tennis, or any other sport that requires you to change clothes. Mountain climbing is OK, and real programmers wear their climbing boots to work in case a mountain should suddenly spring up in the middle of the machine room.</li>
<li>Real Programmers don&#8217;t document. Documentation is for simps who can&#8217;t read the listings or the object deck.</li>
<li>Real Programmers only write specs for languages that might run on future hardware. Nobody trusts them to write specs for anything homo sapiens will ever be able to fit on a single planet.</li>
<li>Real Programmers spend 70% of their work day fiddling around and then get more done in the other 30% than a user could get done in a week.</li>
<li>Real Programmers are surprised when the odometers in their cars don&#8217;t turn from 99999 to 9999A.</li>
<li>Real Programmers are concerned with the aesthetics of their craft; they will writhe in pain at shabby workmanship in a piece of code.</li>
<li>Real Programmers think they know the answers to your problems, and will happily tell them to you rather than answer your questions.</li>
<li>Real Programmers don&#8217;t think that they should get paid at all for their work, but they know that they&#8217;re worth every penny that they do make.</li>
<li>Real Programmers log in first thing in the morning, last thing before they go to sleep, and stay logged in for lots of time in between.</li>
<li>Real programmers don&#8217;t draw flowcharts. Flowcharts are after all, the illerate&#8217;s form of documentation.</li>
<li>Real Programmers don&#8217;t write in Lisp. Only effeminate programmers use more parentheses than actual code.</li>
<li>Real Programmers don&#8217;t write in Pascal, Ada or any of those other pinko computer science languages. Strong variable typing is for people with weak memories.</li>
<li>Real Programmers don&#8217;t like the team programming concept. Unless, of course, they are the Chief Programmer.</li>
<li>Real programmers ignore schedules.</li>
<li>Real Programmers don&#8217;t bring brown bag lunches to work. If the vending machine sells it, they eat it. If the vending machine doesn&#8217;t sell it, they don&#8217;t eat it.</li>
<li>Real Programmers think better when playing Adventure or Rogue.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.pantokrator.net/2006/02/17/real-programmers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
