Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

2009/11/25

Sometimes I hate Windows.



Surely, every OS has strong and weak points (I'm still using windows/linux dual-boot), but when something breaks for absolutely no reason, it is never funny.


Today I was supposed to spent a lot of time programming windows software. Unfortunately, at one point I had to reboot the system, and after reboot system went to hell.


For some reason, my network adapters disappeared from "Network Connections" folder (although they were still working), I couldn't start VPN connection anymore, connection sharing broke up, and shortly after startup I was greeted by message telling me that RPC could not start, and system will shutdown in 60 seconds. "Last working configuration" (F8 at the boot time) didn't help either, and of course I disabled system restore on all drives few months ago. System CD was lost too, although I still had copy of installation files.


Investigation (My Computer->Manage->Event Viewer) uncovered dozens of errors in system logs:


  1. Event ID: 4609

    The COM+ Event System detected a bad return code during its internal processing. HRESULT was 800706BA from line 44 of f:\xpsp3\com\com1x\src\events\tier1\eventsystemobj.cpp.
  2. Event ID: 8193

    Volume Shadow Copy Service error: Unexpected error calling routine CoCreateInstance. hr = 0x80040206.
  3. Event ID: 1802

    The Windows Security Center Service was unable to establish event queries with WMI to monitor third party AntiVirus and Firewall.
  4. Event ID: 7023

    The Windows Firewall/Internet Connection Sharing (ICS) service terminated with the following error:
    The handle is invalid.
  5. Event ID: 7023

    The Security Center service terminated with the following error:
    The endpoint mapper database entry could not be created.
  6. Event ID: 7034

    The Remote Procedure Call (RPC) service terminated unexpectedly. It has done this 1 time(s).


At first it looked as MsBlast virus comeback, but virus checking tool made by symantek didn't find the virus, and that vulnerability have been fixed long time ago.


in the end it looked like everything was tied to COM+ and access rights. Somehow access rights on %windir%\restore has been reset to "no access to anyone" and COM+ services couldn't start, but of course fixing access rights didn't fix the problem. Then I searched for instruction on reinstalling/resetting COM+ (google for "reinstall COM+" and you will find them yourself). There were couple of instructions but none fixed my problem. Error messages changed to


  1. Event ID: 4689

    The run-time environment has detected an inconsistency in its internal state. This indicates a potential instability in the process that could be caused by the custom components running in the COM+ application, the components they make use of, or other factors. Error in f:\xpsp3\com\com1x\src\comsvcs\events\lcedisp.cpp(131), hr = 80040206: Failed to CoCreate EventSystem object.
  2. Event ID: 7000

    The COM+ System Application service failed to start due to the following error:
    The service did not respond to the start or control request in a timely fashion.

Somehow I managed to make my NICs visible again, but this didn't make VPN work.
I also tried to monitor processes with processmonitor (to find broken privilegies or missing files), but it quickly become evident that processmonitor is no match for strace/ptrace available on Linux. I was unable to reinstall COM+ completely, because of "Sub-component COM+ raised an exception while processing the OC_COMPLETE_INSTALLATION setup message" error.


In the end, after several hours of googling, swearing, and numerous failed attempt to fix the system, when I was about to give up and initiate full system reinstall, I finally remembered that system was transferred from older harddrive only week ago, and old system partition wasn't overwritten yet. A quick boot into Slackware Linux, ntfsclone+ntfsresize, and voila, I had working system again.


Why all this stuff happened, still remains a mystery to me.


My advice: if you ever encounter similar problem, and if you were unable to fix it in 30 minutes, forget about it, and do full reinstall. You'll waste less time. It also makes sense to keep system restore enabled, and backup system at least sometimes (nothing beats backup, even search engine). NTFS backup can be easily done from linux system, see "ntfsclone manual" for more info.


Links I've been using while trying to fix the system:


  1. How to clean up a damaged COM+ catalog on microsoft.com
  2. Reinstall COM+ forum discussion.
  3. COM+-related events may be logged in Event Viewer when you install Windows XP Service Pack 2 and join the computer to a domain
  4. W32.Blaster.Worm Removal Tool
  5. Linux-NTFS wiki
  6. Linux-NTFS manpages.

2009/04/27

"Windows versus Linux": yet another opinion


Introduction


It is widely known that "Linux vs Windows" is one of the most popular discussion topics. There are numerous large threads (for example, this one), discussing this question. Typically such threads never end (unless they turn into flamewar, and moderators close them), and new messages are being added during many years. After reading yet another thread where several people tried to prove that

Why is this question so popular


People keep discussing this because of (on of the) following reasons:

  • Because they see only better side of their operating system, and refuse to accept that there are weaknesses in their operating system.
  • Because they finally discovered that "there is no ideal operating system", and are trying to explain it to someone else.
  • Because they don't know which OS is more suitable for them, and didn't think about using search engines
  • Because they like trolling. (Windows/Linux/MacOS users are very easy to enrage by making comments about their operating system)


Why Linux users discuss it


(Based on personal experience, not guaranteed to be true about every user) Most linux user go through "fanboy" (or "euphoria") phase. This typically happens within few months after user learned basic skills and medium-level system skills, used few applications, made first useful shell script, learned iptables, etc.

For example, there is a KDE application called kstars, which displays night sky for any place on earth for any date within few thousands of years from now. It also can control telescope, and has access to large database of stars. And it is free. And you can get its' source code, read it, modify, and derive your own application from it, and sell it. Now think about it - you have very complex, cool-looking application, which can control telescope, display sky for any point on earth and any date in human history, AND it is free, AND you can get source code, sell it. Even though I knew about GPL long before I discovered kstars, I couldn't understand how this is possible. And there are tons of very useful shell utilities, graphical desktops, compilers, browsers, there is web-server software, ipfilter software, and tons and tons of other utilities and all this is free. If you are know at least a little bit about programming, you will be able to estimate how much it would cost to develop all this stuff. If you have some medium-level programming skills, then you will be delighted to discover that you can tear any piece of software apart, read its' source code, understand how it works and modify it. When you will understand all this, (especially if you are a programmer) your mind first will refuse to accept this("how is this possible? We are paying for other software, why all this stuff is free?"), and then you will decide that you are in heaven and linux is the best thing ever created by mankind, so you should go forth and spread the word about opensource.

Congratulations, at this state you will become a "fanboy" which will attempt to convert all friends and relatives into using linux. This attitude will eventually wear off (it will take from several weeks to several months, depending on your personality. Some people are never cured, though).

Why windows users discuss it


Honestly, I have no idea. I've been using Windows for several years, and it never looked like something I would say is "the best operating system ever".

Personal experience with both platform


Windows: pros and cons


Pros:

  • Well-known, widely spread, has most market share.
  • Supports newest hardware.
  • Has games.
  • Has visual studio (don't get me wrong - it has a bunch of really horrible features (like IntelliSense), but VS2005 had best GUI I saw since Delphi 5)

Cons:

  • Price.
  • Malware. You'll need AV software to deal with malware/viruses, and not all AV packages are free.
  • For most problems solution is reinstallation
  • Reinstallation takes forever. If you have a lot of custom software, which is configured for your needs, and managed to completely kill your system (so the only reinstallation from scratch will help), then it will take up to several days to repair everything.
  • Program settings are hidden in registry, which isn't really well documented. Which means if registry is damaged, you will lose all program settings. Also, it won't be that easy to recover the registry.
  • When you discover a bug, you are not allowed to fix it, even if you can. You'll have to wait another patch, which will introduce more bugs.
  • Poor quality of desktop environment. Only one desktop, can't configure shortcuts (not on WinXP, at least).
  • Fresh installation has poor selection of software and can't do much useful. Will need codecs, etc.
  • Many system-wide actions require reboot.
  • License conditions. Average Windows (XP) machine is allowed to connect 10 network devices at once (fixing this will probably break EULA). As far as I know, there is also limit on the number of hardware upgrades.
  • Commercial software isn't guaranteed to be free from bugs, to be usable or to do what you want. See EULAs.
  • Doesn't include development tools.
  • You can't legally become better programmer by analyzing this system - source code is available, reverse-engineering s forbiddeb by EULA. Basically, it is a car where engine compartment is welded shut.

Linux: pros and cons


Pros:

  • Price.
  • Several very configurable desktop environment (always liked KDE desktop, never liked Windows desktop)
  • Supported hardware "Just works" without additional steps.
  • Large amount of software available.
  • Very good environment for a programmer (unless he/she uses .NET) Provides good opportunity to learn code, use source from real projects (instead of book examples), many languages and dozens of free tools.
  • Most problems can be fixed without reinstalling system.
  • Most actions doesn't require reboot.
  • No limit on the number of connections, number of hardware upgrades.

Cons:

  • Smaller selection of commercial games. However, smaller companies tend to create Linux version of games more frequently.
  • No alternative to visual studio. Quality of free IDEs will vary. However, working without IDE seems to be the best option, and even simple text editor might be used as a sufficient alternative.
  • Newest hardware frequently isn't supported - because manufacturers do not want to create drivers or doesn't provide specification.
  • Using USB devices (web-cameras, scanners, cameras) can be a real trouble.
  • You should be willing to learn something to be comfortable on Linux.
  • Less popular than windows, although frequently used in large number of network devices (routers, modems, etc)
  • Available software might not be completely finished, and probably is still in development. On other hand, this also applies to commercial software.
  • You will have to be careful when upgrading hardware - you will have to research if your hardware is supported before purchasing something. Linux will work fine on old machines, but if you have top hardware (which isn't supported yet), you might not be able to even install Linux in some cases. This issue is known to cause problems for people that suddenly decide to move from Windows to Linux.

Commonly used myths and incorrect arguments


General



  • "My commercial applcation isn't available on your platform! Therefore, my platform is superior"

    Not true. When you have application you can't live without (maybe it is your main source of income), then using this application is more important for you that choosing certain operating system. I.e. you use OS where application works, instead of using applications that work on your OS (as people normally do). This is not an OS problem.

  • "Average user can't use Linux!"

    First, there is no "average user". Self-proclaimed "experts" often can get stuck with basic problems, while inexperienced novices can solve difficult things because it is more interesting for them. System administrator or programmer might have problems with word processors, while someone experienced with word processor surely will have problems compiling even basic application. Every user has his/her own area of expertise, and because using computer doesn't require license, everyone can be a computer user. Which means there will be no "average"

    Second, "complete newbie" can use Linux system in the same fashion as Windows machine. This is because configured Linux system doesn't look too different from windows machine. On Windows machine you will have graphical desktop with icons and buttons, where each program is window, and each window can be moved/resized with mouse. And, guess what? On Linux it will be exactly same things: graphical desktop with icons and buttons, where each program is a window, and each window can be moved/resized with mouse (although software is slightly different). To my experience true computer newbie will operate both systems with similar level of success, and might not even realize which operating system is installed on his computer.

  • "Linux is more difficult to learn"

    Not true. If you start from zero level on either system, you will have to spend similar amount of time to learn it (kids should have least amount of problems learning either system). No one learned windows instantly.

  • "Linux is only for geeks"

    Isn't anymore. Linux was only for geeks when it was created. Since that time, Linux has gone a long way, and right now there are several companies attempting to make Linux into a product suitable for everyone, "for novices" or for mythical "average user". While making a product useful for everyone isn't a good idea (what is easy to learn isn't always easy to use, and vice versa), there are couple of distributions which everyone can install from scratch.

  • "Linux is for everyone"

    No. Linux is free, and because of this, it demands something from you. To be able to successfully master Linux system, you should be willing to learn it. If you do not want to learn, you will not master the system (although you still might be able to use it for some extent). Also, if you have to use software which doesn't work on linux, then you won't be able to keep Linux as the only operating system on your PC.


Games



  • "Linux don't have games!"

    Linux has large amount of games. The problem is that there is a relatively small number of commercial games (examples: Doom 3, Penumbra, Unreal Tournament 2004, Quake 4, Darwinia, etc), for whatever reason. You can run some of the commercial windows games using WINE software (or similar commercial derivatives), but you will get minor performance drop if game extensively uses shaders, and you will get problems if games uses certain copy protection mechanisms. However, Linux has a large amount of free games written by hobbyists. One resource for them is happypenguin.org. Notable examples of free Linux games include Alien Arena, Urban Terror, War$ow, America's Army, Sauerbraten, etc.

  • "Linux isn't suitable for making games":

    It is suitable for making games. You have advanced graphic API (OpenGL, which is easier to use on Linux, because on Windows default supported OpenGL version is still 1.x), generic cross-platform framework (SDL), several free physics engines and a bunch of similar libraries. Also there are ready to use game engines, like Ogre3D, Sauerbraten's Engine, etc. And you have tons of free tools for every gaming task.

  • "Windows has best games" or "Windows has better gaming experience"

    This is not true. To my experience, best games are available on consoles, and PC gaming terribly suffers from one big PC problem: hardware. The problem with PC's hardware is that it is flexible, and every user will have different configuration. This will make hardware developers either spend too much time trying to make game work on every video card ever created (instead of spending this time on making better game), or place high system requirements (so you will be able to comfortably play the game only two years later after several hardware upgrades). Another problem is that there is a low number of high-quality games on PC. Latest titles I bought (Fallout 3, Spore, L4D), were clearly overhyped and didn't provide quality I expected. Sure, you will be able to spend several dozens hours playing this, but you will very quickly reach the point where you know everything and don't want to play game ever again - because there is nothing left to do and you already know how to beat it. In short: best games on PC currently are only mediocre, and I'd like to play a masterpiece. The games that are not "the best ones" focus on graphics too much, and because of this gameplay suffers. Another problem with PC games is that once game is released, instead of playing it, you will spend most of your time tuning performance, fighting bugs and crashes, and waiting for patches that will turn game into something stable and playable. Whether you like it or not, a PC game released without bugs is a very rare sight, which spoils PC gaming experience in general.

  • "Linux doesn't have DirectX 10"

    True. But I haven't seen a game that couldn't work without it. Every game created so far with DirectX 10 support seems to use it only for minor, small graphical improvements. I haven't seen a DirectX 10 game with a truly astonishing graphics. For example, compare Quake 1 and Quake 4. If game uses "superior" graphical API, it should provide similar increase of graphic quality. This means, that DirectX 10 game when compared to the best DirectX 9 game should look as Quake 4 when compared to Quake 1.


Hardware



  • "Linux supports small number of hardware"

    Only partially true. Linux has a good support for large number of devices, which is provided by the kernel. Which means that on Linux system if hardware is supported, it will work out of the box. While on Windows, you will have to search for drivers. Buy a new ethernet card, install it in WinXP machine and you will have to search for a driver. And if you've just installed windows on completely new computer, you will have to search for several drivers. Until you find all of them - your machine might stand here without sound and network access. On Linux this card will work right now.

    However, Linux does have trouble with new hardware, USB devices (cheap web-cameras, scanners, force feedback on joysticks). This is because most hardware manufacturers don't support Linux, and don't provide specifications for writing drivers. Which means, some time will have to pass before someone reverse-engineer device protocol and write a Linux driver for it. Which means when you decide to upgrade your computer, you will have to check if new hardware is supported or not.

    On other hand, situation with hardware on windows isn't that great. For some reason, with each year driver packages tend to become larger and larger. Sometimes, just one driver takes more megabytes than entire Linux kernel. If you have a very fast connection, this won't be a problem, but if your internet speed is below 500kbps, this will quickly become annoying. Also, many windows drivers are buggy. I was very surprised to discover than on WinXP my "Vista Certified" motherboard produces slightly noisy sound (can't be fixed), while on Linux same problem doesn't exist, I have better sound quality, although motherboard isn't officially supported.


Software



  • "Linux doesn't have any good software"

    On contrary, amount of Linux software is quite large. Currently average Linux distribution includes Word Processor, compiler, several music players, several different image editors, several IDEs, and several desktop environments on the same DVD. So when you install it, you have ready to use working environment. On windows, after first installation you'll have empty machine that can't do much useful - you'll have to spend several hours installing codecs, Adobe Acrobat, your Office Suite, IDE, normal music player, and so on. The downside of all this is that most of the linux software is provided "as is, without warranty of any kind", and many programs are still in development. Which means some of them might have unfinished features, etc.

  • "I don't want to compile software"

    On large number of distributions, software is installed via package manager - you won't have to compile anything (unless you are using Gentoo, LFS or Slackware). However, it is highly recommended to learn how to compile programs manually - sometimes software might not be available via package manager.

  • "Compiling software on Linux takes hours"

    Not on modern hardware. Only largest packages (Qt 4, KDE, etc) might take hours to build. Normally software compiles within 5..15 minutes.

  • "I don't want to compile kernel on Linux"

    You don't have to compile kernel. Most distribution already provide properly tune kernel for you. Unless you want to make your machine a bit faster, you don't want to attempt rebuilding kernel yourself.


Communities



  • "If something breaks on Linux, community will help you"

    Not quite true. Community will try to help you. However, people in communities are mostly volunteers, and they might refuse to help you if:


    • You didn't read and apply rules from "How to ask questions the smart way"
    • You haven't tried to fix problem yourself.
    • You didn't ask question properly ("Help me, please" is not a good idea);
    • You just wish someone fix your problem for you (and for free).
    • You complain about things, and say something like "This didn't happen on windows"

    Also, quality of community (skill, knowledge level) depends on distribution. As far as I know, most helpful/skillful people use most difficult distributions (Gentoo, Slackware), however they may be a bit strict about the "rules", and you will have to ask question properly (and read "How to ask questions smart way" - it isn't that hard) to get high quality help. On other hand, communities that use "simpler" and "friendlier" distributions are not guaranteed to have skilled users (personally, I had serious trouble with advanced questions on Ubuntu communities).

Licensing and philosophy



  • "Open Source is the way software all should be distributed! It is the future!":

    Unfortunately, this isn't true. Open Source software has one serious problem: you can't earn serious amount of money by making programs and selling them. Don't get me wrong: you still can earn some cash from donations, or by selling merchandise (T-shirts, toys, gadgets) which is somehow associated with you program, or you can sell CDs/DVDs with that program, but you can't sell the program. At least, not with GPL. Of course, GPL allows you to "sell" programs, but once you do this, anyone can resell your program for lower price, or give it away for free in unlimited quantities. I believe this is one of the reasons why large software companies aren't releasing their products under GPL. Of course, there are other licenses, like BSD license, but software under those licenses can be easily converted into proprietary. So, although Open Source is (in some cases) good for software development, it isn't really good for software developers. I don't think you can make the living by developing your own OpenSource software.

    Another problem is that OpenSource doesn't seem to be suitable for at least one kind of projects: games. Sure, there are many good games made by individual developers, but I haven't seen a sophisticated OpenSource game with a great story, music, gameplay and art. I'd love to see gaming masterpiece (for example, something comparable to "Max Payne", "Silent Hill 2", "The Movies", etc) developed under OpenSource license, but it looks like such game doesn't exist. Another interesting thing is that good OpenSource games (for example, War$ow) use different license for their art, music and models, and typically this license is proprietary. Which makes me believe that OpenSource isn't suitable for making games, only for making game engines (which is different story).

  • "Proprietary software always is the best!"

    Unfortunately it also isn't true. When some software is being developed by a single company, they control the course of software development. While it is exactly what you would want in game development, it isn't always good for other kinds of software. Software developer might decide to add flashy GUI with dozen of bugs instead of making software more useful for you. Or it might decide to change course of development, so the next version of software will not meet your requirements anymore, but will appeal to larger audience. And another problem with proprietary software is that once it is broken, you are not allowed to fix it, even if you can do it. And Let's not forget various licensing and DRM problems. However, this was already discussed many times.



The Truth


The truth is that there is no "the best" operating system. Every OS that is available has problems in one or another area. User's goal is to pick operating system that doesn't have problems in important (for that user) area. For example, if you don't use some windows application, lack of its' alternative on Linux won't be a problem for you. Or if you don't use some linux utilities (dd, mount, iptables, cron), their unavailability on Windows won't be a problem for you.

So, What should I do about all this?


Nothing. "Linux vs Windows" appears again and again and again. People keep using same arguments over. Some people provide a very lengthy, detailed responses which cover common problems and provide a really good comparison of operating system, but large amount of people don't read them, and simply jump in discussion to prove their point. So the best thing you can do about those discussions is never participate in them.

Links


Linux is not Windows
How to ask questions the smart way

2009/03/07

how to find identical files on Linux using python script


In situation where you have two directories (A & B) with a lot of files, where some files in B directory are same as some files in A directory, you can use this python script to find identical files.

find_identical.py:
#!/usr/bin/env python
import os
import sys
import commands
#import string

if len(sys.argv) != 3:
print """not enough arguments!
usage: find_identical.py source destination"""
exit(0)

src=sys.argv[1]
dest=sys.argv[2]

#print "src: %s, dest: %s" % (src, dest)
print "#!/bin/sh"

srcText = commands.getoutput("md5sum %s/*" % src)
destText = commands.getoutput("md5sum %s/*" % dest)

def dictFromString(val):
lines = val.split("\n")
result = {}
for line in lines:
line = line.split()
result[line[0]] = line[1]
return result

def listFromString(val):
result = val.split("\n")
for i in range(len(result)):
result[i] = result[i].split();
return result;

srcDict = dictFromString(srcText)
destList = listFromString(destText)
filesFound = False
for file in destList:
if srcDict.has_key(file[0]):
print "rm \"%s\" #identical to %s" % (file[1], srcDict[file[0]])
filesFound = True;

if not filesFound:
print "#no identical files found"
exit(1)




Script needs two arguments - name of first and second directory. By default script prints (to standard output) shell script that would remove files from B directory which present in A directory.
So, to remove files from B which already present in A, you'll need to run:
find_identical.py A B >applychanges.sh
bash applychanges.sh


This done this way so you can examine list of files which will be removed before removing them. This behavior can be easily changed by modifying line:
 print "rm \"%s\" #identical to %s" % (file[1], srcDict[file[0]])

to something you need.

Script needs md5sum to work.
Notice, that there is already linux software available that does same thing (finds identical files). So this script is mostly useful for learning python, or as base for making another script.

How to find largest file in directory on Linux system

If you run out of disk space and would like to know which files took the most of it, us following command.

In terminal "cd" into any folder (or your home folder) and type:
du -sm *|sort -nr|less

or
du -sm *|sort -nr|head

Explanation:
"du -sm *" returns how many megabytes file takes - for all files and directories within current directory.
"sort -nr" sorts list according to the value of the first column (which is size in megabytes), and puts largest files first.
"less" is used to scroll output using cursor keys.
"head" is used if you want to print only first largest files.

How to generate password on linux system


Every user eventually will need to create secure password (alphanumeric, not a common word, etc).
On linux, you can easily generate it without additional software

To generate eight characters long alphanumeric password use following line:

tr -dc '0-9a-zA-Z' </dev/urandom |head -c 8;echo


You can put this into shell script, if you are going to need it often.

In case you are a newbie and don't understand what this line does, explanation is below.

Explanation

/dev/urandom is one of a few special files on linux/unix systems (other files are /dev/zero, /dev/null and /dev/random).
/dev/urandom provides endless stream of pseaudo-random data, but even if you paste data from that file into text file, you won't be able to use it as password, because it will containt a lot of characters that doesn't fit into ASCII charset.
So that's why "tr" comand is used. "tr -dc '0-9a-zA-Z'" reads data from /dev/urandom and then prints to output only characters that fit into given character set (which is '0-9a-zA-Z'). See "man tr" for more details.
This means that if you want use another set of characters in password, you will need change character set to something else.
For example, '0-9' means only numeric characters, '0-9a-z' - numeric or lowercase latin letters, and '0-9a-zA-Z!@#$%^&*()_+-' will include extra characters to make your password more secure.

Because /dev/urandom is "endless", "head -c 8" is used to copy first 8 characters (see "man head" for explanation).
If you need more or less characters, change number accordingly.

"echo" command without arguments simply prints a newline. It is only useful if you want to print password into terminal (because without "echo" next shell prompt will be printed right after password - on the same line).

Possible problems
On system with UTF-8 locale, you won't be able to generate password with non-ASCII letters using this method. This is because tr handles only one character("byte") at the time, and UTF8-encoded non-ASCII character will use more than one byte.

2009/03/06

Making slackware packages from source without slackbuild


Originally posted on linuxquestions.org by me.

This article describes how to build software packages for slackware linux from source code.
It is not easiest method, but it is useful for quick package creation.
If you simply want to install software, and do not want to compile it, then either download precompiled packages from www.linuxpackages.net, or get slackbuild from www.slackbuilds.org. Another option is to use src2pkg utility or checkinstall (but checkinstall is mostly broken since Slackware 11.0).

I'm posting this because some people have problems with making packages from source code, and howto where I learned how to do it isn't available anymore.

WARNING!:
  1. howto is pretty short and doesn't dive into details too much (although I initially thought about overview of commonly used build systems).
  2. This doesn't work for all packages, only for most of them. Method is not universal
  3. This stuff is written for people that don't like Slackbuilds, or want to compile software without slackbuild. If you simply want to install program as fast as possible, search for compiled package on www.linuxpackages.net, or search for slackbuild on www.slackbuilds.org.
Requirements
This method will work only if following conditions are met:
  1. program package contains ./configure script.
  2. Makefile produced by ./configure contains word DESTDIR (case-sensitive).
Seems pretty restrictive, but, fortunately, this covers 95% of all available linux software.

If there is no ./configure, or makefile doesn't have "DESTDIR" inside, this will not work. (there are exceptions from that rule, of course, but explaing them will take too much space)

Short explanation
In this example I assume that we have extracted our package, and right now are within source code directory, where ./configure script is located. In example our program has name "programname" and version "programversion". When compiling your own package, replace "programname" and "programversion" with values you need.

Most software can be turned into slackware package using this sequence:
  1. ./configure
  2. make
  3. mkdir pkg
  4. make DESTDIR=`pwd`/pkg install
  5. cd pkg
  6. su
  7. makepkg programname-programversion-1xyz.tgz
  8. chown me.users ./programname-programversion-1xyz.tgz (instead of "me" use your user name)
  9. mv ./programname-programversion-1xyz.tgz ..
  10. cd ..
  11. rm -r pkg
  12. Ctrl+D (exits "su")

If package meets requirements mentioned before, this sequence will create slackware package for you.

How it works
  1. "./configure" - configures package according to our system.
  2. "make" - compiles package.
  3. "mkdir pkg" - creates directory called "pkg" within same directory where ./configure is located. This "pkg" directory will be used to
    store files that will be put into package.
  4. "make DESTDIR=`pwd`/pkg install":
    This tells to the "make" command to install package as if "pkg" subdirectory (that we created in current directory) were root "/" folder.
    "`pwd`" inserts output of "pwd" command into current command line. DESTDIR is a variable used inside makefile. DESTDIR specify the root of installations, and because GNU make allows to override some variables during compilation, we can change it, and say that "pkg" subdirectory is a root of installation.
  5. "cd pkg" we are going into "pkg" subdirectory.
  6. "su" (enter password here) - changing privilegies to root, because makepkg (which is used to create packages) won't work with other privilegies.
  7. "makepkg programname-programversion-1xyz.tgz" This creates slackware package without description. Answer "yes" to all questions (well, unless it doesn't suit your needs). Also, notice "1xyz" part of the filename instead of numbers. When you build custom packages, you need to be able to distinguish them from stock packages. To do that, instead of standard numbers numbers, use custom signature, something like "1abc", "2abc", etc. Use whatever combination you want (I use number + my nickname), as long as you can distinguish your package from packages made by other people.
  8. "chown me.users ./programname-programversion-1xyz.tgz" Created package has "root.root" owner. If we want to be able later to move it somewhere, we need to change owner to our user ID.
  9. "mv ./programname-programversion-1xyz.tgz .." We are moving our package into the source directory - i.e. one level up.
  10. "cd .." Going one level up. (back into directory with "configure")
  11. "rm -r pkg" we are cleaning up and removing our pkg subdirectory.
  12. "Ctrl+D" - this equivalent to "exit" command which ends "su" session.

Done
Now you have your slackware package.
If something doesn't work, or you don't understand something, ask it on slackware forums.

Few Notes
Package created this way normally will end in "/usr/local" instead of "/usr". This is because "/usr/local" is default location for user-built packages. "/usr/local/" is fine if you are creating packages for yourself, but, for example, linuxpackages.net rejects packages that are not in "/usr". So if you want to distribute your packages, or submit them to linucpackages.net, then change installation location from "/usr/local" to "/usr" using --prefix configure option.

How to answer questions without wasting too much time


This text was originally posted on www.linuxquestions.org (here). It was created because there is already famous "How to ask questions the right way", but I don't remember any document for those answering questions.
Information should be useful for people that hang out on various forums/newsgroups answering questions and solving other people problems (mostly useful for linux users).




Okay, I've just got through another flamewar, so I decided to write a some info about answering questions without wasting too much time in the process. The content is based on personal experience, my own point of view, and isn't supposed to be absolute truth or something. I also don't expect someone to agree with me. Recommendations are written in random order, and are supposed to prevent wasting too much time typing replies, or breaking your keyboard too quickly.
Beware! Some people probably might find this thing offensive.

The recommendations are based on following assumptions:
  1. You want to help other people to solve their problem.
  2. You don't want to spend many hours per day doing that.
  3. You want to get satisfaction from giving out info - i.e. people should be grateful, or discussion should be interesting.
  4. You do not want to live on the forum, just post answers to some threads.
  5. You don't want to have a bad mood after helping someone.

Here are recommendations:

  1. Always remember that you can ignore other people instead of trying to reason with them. By "ignoring" I mean ignore list, which is located at this page on linuxquestions and often present in other forums. Ignore list is a very handy feature.
  2. Never participate in threads about religion. There were many of those, and when there is a clash between believers and atheists (or simply followers of different religions), no matter which side you take, you'll never prove to "them" that you are right. Also, your opponents will never prove you that you are wrong. The thread will eventually degrade into pillow-fight, and someone will close it.
  3. Never post in "Linux vs Windows" threads. Yes, this is tempting, but should be avoided. Such threads either never ends or many of them eventually degrade into flamewar. Which side "wins" in case of flamewar depends on forum, but in most cases, moderators win. Providing non-biased info in such threads is difficult, and sometimes leads to disappointment - especially when you discover that someone asked the question you already answered in details one year ago in the same thread.
  4. If are feeling too emotional while typing a reply, do not type a reply. If you were offended, report incident to moderators. If you are angry, go outside and take a walk. If you don't like someone, ignore him or her (by adding into ignore list). Being furious or simply emotional causes too much typing. And too much typing means too much time wasted.
  5. When someone posts something that doesn't fit into your system of beliefs, and it enrages you, do not try to explain something to that guy/girl, ignore him/her. If he posted something gross, then report it to moderators. To my experience, trying to explain something to someone who don't want to listen is #1 cause of wasting time on the internet. This applies to the choice of distribution, operating system, religion, some questions about women, and so on. Same principle applies to trolls or any person that pisses your off.
  6. Do not reply in the threads started by spammers. They don't read it.
  7. When replying to "newbie" section, try to keep your replies extremely short, but informational. It is tempting to overwhelm newbie with the amount of things you know, but this guy might not need it. He might be simply interested how to watch DVD, and not in the mood for linux history lesson or detailed comparison of all available dvd-players.
  8. When you realize that you started to type extremely long, detailed instructions about "how to do something in linux", stop, put keyboard away, take a deep breath, relax, and then try to find howto on the subject you were writing about. There is high chance that someone already wrote what you were going to write right now, so you'll be reinventing wheel. If there is a howto on the subject, post a link to it or quote it (but still provide link). This will make howto more widespread and will save time for other people.
  9. When you found a good howto or manual, and want to put a link to them in reply, consider quoting them. Websites sometimes disappear, and seeing dead link 3 years later (and answering same thing again) isn't much fun. If the source of article doesn't look "stable" enough, quote good portion of it (but still provide link). If website is unlikely to disappear, then link should be enough.
  10. If you really pissed someone off, and was unable to pacify that person within small amount of replies (1..3), consider ignoring that person. This is because when someone thinks that you are "evil person that hates all people" (no matter what were your intentions, what did you post, how friendly you were, people might think that about you), you can waste considerable amount of time reasoning with that person and explaining your position. If you started such "clarification conversation", observe person's reaction, and if person is unlikely to change attitude quickly, don't waste your time. Some people can be reasoned with, some can't.
  11. When you see newbie poster (which has 1 message on the forum) with a short question (literally short - one statement with poor punctuation, small amount of info, etc), and you want to write really long answer, stop, and think about it again. Poster might be "fly by homework question author" - i.e. he will ask question, and then mysteriously disappear, while other people will waste their time explaining things to him and writing huge replies for few weeks. Not all newbies magically disappear, but you should consider that possibility.
  12. Don't do other people's homework, they normally won't truly appreciate it, and this will spoil your mood and take your time. I.e. if the guy asked how to make some script, do not engage in 3 hours of googling, researching and testing just to make that script for him, because in the end his "thanks" might not satisfy you. To my experience, answers that were written with little effort (link to howto, article) generate more positive emotional feedback (for you - i.e. you'll feel more happy) when people say "thanks" than answers where you spend hours to find solution. Making other people's homework makes sense only if the problem is extremely interesting for you and you really like to solve complicated problems. Notice, that even if you solved problem you still can choose not to provide info to the OP, if you think he is too lazy or didn't do his homework.
  13. Do not live on the forums. If you are checking forums for new messages every 3 minutes and looking for _any_ discussion to participate in, and occasionally attempt to derail existing threads, then you should probably turn off computer and go jogging, watch the movie, take dog for a walk, or do anything that is fun, takes at least hour and doesn't involve computers. Helping people is fine, forums are good, but, unfortunately, for some people participating in such discussion is a bit addictive. And when you start spending too much time on the forums, quality of your answers decreases.

Now this is it. I hope this information will be useful for someone.