Getting a Useful Crash Log in Windows XP

September 26, 2007

Windows XP does not automatically log crashes like OS X, but it does include Dr. Watson, an easy to set up tool that can be configured to log them.


* A dialog box will appear informing you that Dr. Watson has been installed as the default debugger. Press OK.

*Crash information will now be logged to the drwtsn32.log and user.dmp files in C:\Documents and Settings\All Users\Application Data\Microsoft\Dr Watson\.

* All crashes you experience on Windows XP are logged to drwtsn32.log. Dr. Watson will also create a user.dmp file that contains a dump of the memory Your Application was using when it crashed. This is generally more useful for debugging a crash than the crash log, but be careful as it is overwritten with every crash.

* Running drwtsn32 without any options or switches will bring up a window that allows you to change various setting such as moving the log folder to a more easily accessible location or throwing a visual alert letting you know it caught the crash.

Blogged with Flock


Getting a Useful Crash Log in Mac

September 26, 2007

Obtaining a crash log on Mac OS X is incredibly easy since it automatically creates easily accessible crash logs for you.

* If Appplication has just crashed or you can easily reproduce the
crash, press the Report button on the CrashReporter dialog box to view
the crash information.

* If the crash report dialog does not appear or the crash is hard to
reproduce, you can get the crash log from the
YourAppplicationName.crash.log file located in
~/Library/Logs/CrashReporter/. This file is a plain text file and can
be viewed in the default Console.app or your favorite text editor.

All crashes are logged to this file so please only attach the last
crash in it. Crashes are separated by a series of asterisks
(∗∗∗∗∗∗∗∗∗∗) for easy identification.

Blogged with Flock


Display/Hide Hidden Files Finder

September 26, 2007

We need to set the AppleShowAllFiles preference for the Finder to show/hide the Hidden Files.

Execute the following statement in Terminal to display the hidden files in Finder

defaults write com.apple.finder AppleShowAllFiles TRUE&&killall Finder &

Execute the following statement in Terminal to hide the hidden files in Finder

defaults write com.apple.finder AppleShowAllFiles FALSE&&killall Finder &

Blogged with Flock


How To Restore Your SVN Trunk to a Previous Version

September 26, 2007

Restore the version of trunk that you want to use. In this example, we’re using revision 234 as the source of our new trunk.

svn cp -r 234 http://url/for/my/trunk http://url/for/my/trunk -m “Restore trunk to previous version.”

Happy restoration.

Blogged with Flock


Creating Hello World Kernel Module in Linux

September 26, 2007

2.1. Hello, World: The Simplest Module

When the first caveman programmer chiseled the first program on the walls of the first cave computer, it was a program

to paint the string `Hello, world’ in Antelope pictures. Roman programming textbooks began with the `Salut, Mundi’ program.

I don’t know what happens to people who break with this tradition, but I think it’s safer not to find out. We’ll start with a

series of hello world programs that demonstrate the different aspects of the basics of writing a kernel module.

Here’s the simplest module possible. Don’t compile it yet; we’ll cover module compilation in the next section.

Example 2-1. hello-1.c

/* hello-1.c – The simplest kernel module.

*/

#include <linux/module.h> /* Needed by all modules */

#include <linux/kernel.h> /* Needed for KERN_ALERT */

int init_module(void)

{

printk(“<1>Hello world 1.\n”);

// A non 0 return means init_module failed; module can’t be loaded.

return 0;

}

void cleanup_module(void)

{

printk(KERN_ALERT “Goodbye world 1.\n”);

} Kernel modules must have at least two functions: a “start” (initialization) function called

init_module() which is called when the module is insmoded into the kernel, and an “end” (cleanup)

function called cleanup_module() which is called just before it is rmmoded. Actually, things have

changed starting with kernel 2.3.13. You can now use whatever name you like for the start and end functions of a module. In fact, the new method is the preferred method. However, many

people still use init_module() and cleanup_module() for their start and end

functions.

Typically, init_module() either registers a handler for something with the kernel, or it replaces

one of the kernel functions with its own code (usually code to do something and then call the original function). The

cleanup_module() function is supposed to undo whatever init_module() did, so the

module can be unloaded safely.

Lastly, every kernel module needs to include linux/module.h. We needed to

include linux/kernel.h only for the macro expansion for the

printk() log level, KERN_ALERT, which you’ll learn about in Section 2.1.1.

2.1.1. Introducing printk()

Despite what you might think, printk() was not meant to communicate information to the user,

even though we used it for exactly this purpose in hello-1! It happens to be a logging

mechanism for the kernel, and is used to log information or give warnings. Therefore, each printk()

statement comes with a priority, which is the <1> and KERN_ALERT you see.

There are 8 priorities and the kernel has macros for them, so you don’t have to use cryptic numbers, and you can view them

(and their meanings) in linux/kernel.h. If you don’t specify a priority level, the

default priority, DEFAULT_MESSAGE_LOGLEVEL, will be used.

Take time to read through the priority macros. The header file also describes what each priority means. In

practise, don’t use number, like <4>. Always use the macro, like

KERN_WARNING.

If the priority is less than int console_loglevel, the message is printed on your current

terminal. If both syslogd and klogd are running, then the message will also

get appended to /var/log/messages, whether it got printed to the console or not. We use a high

priority, like KERN_ALERT, to make sure the printk() messages get printed to your

console rather than just logged to your logfile. When you write real modules, you’ll want to use priorities that are

meaningful for the situation at hand.

2.2. Compiling Kernel Modules

Kernel modules need to be compiled with certain gcc options to make them work. In addition, they also need to be

compiled with certain symbols defined. This is because the kernel header files need to behave differently, depending on

whether we’re compiling a kernel module or an executable. You can define symbols using gcc’s -D option, or

with the #define preprocessor command. We’ll cover what you need to do in order to compile kernel modules

in this section.

We use gcc’s -isystem option instead of -I because it tells gcc to surpress some

“unused variable” warnings that -W -Wall causes when you include module.h.

By using -isystem under gcc-3.0, the kernel header files are treated specially, and the warnings are

surpressed. If you instead use -I (or even -isystem under gcc 2.9x), the “unused variable”

warnings will be printed. Just ignore them if they do.

So, let’s look at a simple Makefile for compiling a module named hello-1.c:

Example 2-2. Makefile for a basic kernel module

TARGET := hello-1

WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes

INCLUDE := -isystem /lib/modules/`uname -r`/build/include

CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}

CC := gcc-3.0

${TARGET}.o: ${TARGET}.c

.PHONY: clean

clean:

rm -rf {TARGET}.oAs an exercise to the reader, compile hello-1.c and insert it into the kernel with insmod

./hello-1.o (ignore anything you see about tainted kernels; we’ll cover that shortly). Neat, eh? All modules

loaded into the kernel are listed in /proc/modules. Go ahead and cat that file to see that your module

is really a part of the kernel. Congratulations, you are now the author of Linux kernel code! When the novelty wares off,

remove your module from the kernel by using rmmod hello-1. Take a look at

/var/log/messages just to see that it got logged to your system logfile.

Blogged with Flock


Yuvraj’s sixes to savour

September 25, 2007

Yuvraj Singh celebrates after reaching his half-century against England in the ICC Twenty20 World Cup match at Kingsmead in Durban, on Wednesday.

iShare: Videos – Cricket-Yuvraj 6 Sixes vs Englan, Yuvraj  6  Sixes  vs  England  Twenty20  World  Cup  Match 

  • The left-hander smashed six sixes in an over off fast bowler Stuart Broad to become the first player to achieve the feat in the shortest form of cricket.His 14-ball 58 saw India beat England by 18 runs and keep their hopes of making it to the semi-finals alive.

    The image “https://i2.wp.com/www.indiaabroad.com/wc2003/2003/mar/03yuvraj.jpg” cannot be displayed, because it contains errors.

  • Blogged with Flock

    Tags: , ,

    Blogged with Flock

    Tags: , ,


    Create FTP Accounts in Mac using PureFTPd Manager

    September 25, 2007

    The built-in FTP software in both Mac OS X releases (Jaguar and Panther) is an Apple-modified version of FTP software that works fine with other Unix and Linux variants. Unfortunately, when Apple modified the code so that it worked with their particular idea of how FTP should function with Mac OS X users and accounts, they introduced a number of problems.

    For instance, it works well for one purpose only: user logins and guest access to specific user folders for uploading and downloading. If you want to set up a secure and configurable FTP server for any other purpose, you will likely run into trouble. The fact that it’s difficult to turn guest FTP service off shows how little effort Apple put into making FTP a robust part of Mac OS X; they just put it in because it was available.

    Another good point: Security Update 2004-09-07 broke Apple’s built-in FTP software because the included FTP server was misconfigured. Apple fixed the problem in a security update a few weeks later, but the fact that the component was tested so minimally (if at all) shows how little attention Apple is paying to FTP.

    In light of these problems, I recommend that you avoid Apple’s built-in FTP server software. (Note: To turn off Apple’s built-in FTP server, open the Sharing pane in System Preferences. Click the Services tab and uncheck FTP Access.)

    Let me tell you about a much, much better and vastly easier and safer way to operate FTP on the Mac. You need Pure-FTPd, a free, sophisticated, and superb package that’s a bear to configure by hand. Fortunately, you can use PureFTPd Manager, by Jean-Matthieu Schaffhauser, to help with configuration. PureFTPd Manager provides not only a graphical user interface to this free FTP server software, but also a fully compiled and configured version of Pure-FTPd. PureFTPd Manager works under Mac OS X 10.2 and 10.3.

    1. Install PureFTPd Manager


    Before you start PureFTPd Manager installation process, make sure Mac OS X default FTP server is not running. You can check this in the Sharing preference pane of your System Preferences.

    Mac OS X Sharing Preference Panes with FTP Access Off.

    Mount PureFTPd Manager Disk Image on your computer and click PureFTPd Manager.mpkg and complete the installation process.

    If the version of your Mac OS is older then 10.3 (ie: you are using Mac OS 10.2.8), please Customize your installation in order to install pureftpd-jaguar.pkg. If you are using Mac OS 10.3 or above, you do not need to customize the installation process.

    Once the installation process has been completed, you can start PureFTPd Manager from your Applications folder.

    2. Running PureFTPd Manager for the first time


    PureFTPd Manager needs system administrator privileges in order to execute properly. When prompted, please authenticate with an administrator username and password.

    Mac OS X Authentication Prompt.

    If this is the first time you start PureFTPd Manager on your computer, PureFTPd Manager Setup Assistant will help you defining the default system settings required to run pureftpd on your Mac.
    Default settings suggested by this assistant should be fine for most of you. So if you want to keep it simple, just click continue and go through all configuration step until the end.

    Last screen of PureFTPd Setup Assistant.

    Everything set up by this assistant can be modified later on by running the assistant again or through PureFTPd Manager Preferences.
    To learn more about PureFTPd Manager Setup Assistant, click here.

    3. Welcome to PureFTPd Manager


    When PureFTPd Manager starts, it displays your FTP server status. To start your server, click the Start button at the bottom right of this window.

    PureFTPd Manager - Server Status

    Your FTP server is now running. Other people can access your FTP server at ftp://your_server_ip using anonymous login, a user account on your machine, or using a FTP virtual user account.
    On the screenshot above, have a look at the connected users. ftp always refers to an anonymous connection, jms is a Mac OS X real Mac OS X user account (one you use to log into Mac OS X), and flo is a FTP virtual user account (a special account, only for FTP).

    4. Add FTP-only user accounts


    Right now, your FTP server is set up so that only a person that currently have a valid username and password on your computer can login to your system (except for anonymous connections). The next thing you probably want to do is create FTP-only user accounts in order to enable and control access to your files using dedicated user accounts.

    Go to the User Manager and click on the New button in the toolbar.

    PureFTPd Manager - User Manager

    A New User will be added to the virtual users list and automatically selected. Specify a login, a password, and a home directory for this one. In the above example, I used marie as login, and /Users/ftp/VirtualUsers/marie for her home directory.
    Notice the Restrict user access to his home directory checkbox. When selected, a user logged into your server won’t be able to browse your entire server’s hard drive. You can always extend a user’s access to specific parts of your computer using Virtual Folders. Please read the virtual users help pages to learn more about that.

    The User and Group option lets you map a virtual user to a particular system user and group. You won’t have to change this except for advanced setup. If unsure, always select the user and group created by PureFTPd Manager Setup Assistant: ftpvirtual and ftpgroup.

    Your server is ready


    You are now ready to serve files to the world. Your FTP server allows connection to your system for standards Mac OS X users, anonymous users and a special set of FTP-only virtual users.

    Blogged with Flock

    Tags: , ,