Jump to content

Tuxiscool

Members
  • Posts

    88
  • Joined

  • Last visited

Everything posted by Tuxiscool

  1. Most free tutorials available online tend to be rather poor, but I suggest taking a look at the pages linked to from http://iso-9899.info/wiki/Main_Page, particularly the stuff at http://www.c-faq.com/top.html Also a few extra ones that I like: http://www-128.ibm.com/developerworks/library/pa-ctypes1/ http://www-128.ibm.com/developerworks/library/pa-ctypes2/ http://www-128.ibm.com/developerworks/library/pa-ctypes3/ http://www-128.ibm.com/developerworks/library/pa-ctypes4/ Good luck.
  2. Visual C++ is not a language, but an IDE (Integrated Development Environment) that you may use to compile C++ programs. You can use it to compile executables for Windows. Under Linux/UNIX-based OSs you will want to use g++ (Part of the GNU Compiler Collection, GCC). I disagree about learning C# instead of C++. C++ has a much broader collection of cross-platform libraries available for you to learn and use.
  3. Browse: [About the FAQ Forum] [Table of Contents] [FAQs] [Contribute] [CL: Command Line Questions] CL-09: Compiling C or C++ Programs It is undeniable that the success of the Free/Libre/Open-Source Software movement has largely been due to GCC, the GNU Compiler Collection. Since Richard Stallman -- the founder of GNU -- released The GNU C Compiler to the world in the late 1980s, it has seen many improvements; the support for many many more languages, and a plethora of architectures. After reading this FAQ, you should be able to: Compile C and C++ programs Get the compiler to warn you about stupid mistakes Link your programs with the required libraries. And finally, optimise your binaries. This FAQ will not cover the C or C++ languages, they require their own book! The Compilation Process For compiling C and C++ programs, there are two separate compilers to use, gcc and g++, respectively. Using the famous 'Hello, world!' example (in C) -- hello.c: #include <stdio.h> #include <stdlib.h> int main(void) { printf("Hello, world!\n"); return EXIT_SUCCESS; } We would compile this file into a binary, named 'hello', with the command: gcc hello.c -o hello This command calls 'gcc,' specifying an input file (you can of course have more than one of these 'translation units'), and an output file -- specified after the -o flag -- called 'hello'. Similarly, in C++ -- hello.cc #include <iostream> int main(void) { std::cout << "Hello, world!" << std::endl; return EXIT_SUCCESS; } We would compile this file into a binary, named 'hello', with the command: g++ hello.cc -o hello Very simple, don't you think? Mistakes, and how to catch them We all make mistakes, there's no doubt about that, so having a good way to catch them can make our lives a lot easier. gcc and g++ both provide facilities to do this, the use of a few compiler flags. Both gcc and g++ accept the following flags -W -Wall -ansi -pedantic -W will enable warnings to help protect you against common mistakes. -Wall will enable extra warnings, if you like. -ansi Will make the compiler reject most features that are not part of the ISO C90 standard (By default GNU extensions are enabled.) -pedantic Will ensure strict conformance to ISO C90, giving no mercy for non-standard features. It is typically a good idea to use all of these flags when compiling your programs, they really do help you discover many possible problems with your code. More information can be found within the gcc man page ('man gcc'). To link, or not to link, that is the question If you ever want to make any interesting programs, it is likely that you will need to use the linker to link with the libraries of the APIs that you make use of. GCC provides two main facilities to do this. -l -L Quite intuitive indeed, but what's the difference? -l<libraryname> will search in the default directories for lib<libraryname>.so -L<path> can be used to give an absolute path to the library you want to use, or to add another directory for gcc to search in. A very common usage of -l is to link with the math library in C and C++ programs that use functions from the header <math.h> and <cmath> respectively. To link such a program with the math library, assuming a source file 'program.c', one would issue the command: gcc program.c -o program -lm Easy as that! Optimisation, the double-edged sword? gcc and g++ are optimising compilers, they can be used to increase the speed or size of your compiled binaries. Typically, code that you will be debugging should disable optimisation, but in release-code, you will probably enjoy its benefits. Enabling optimisation is a simple matter, all we need to do is pass an -O (Capital 'Oh'), which has a few main variants. -O0, The default, optimisation-less compile, this is redundant. -O1, Basic optimisation. -O2, More optimisations enabled - this is probably the most-used. -O3, Even more optimisations. -Os, Size optimisations, this may decrease the size of the output binary. Of course, specific details of these optimisations can be found in the gcc man page. I hope you've enjoyed the FAQ, feel free to ask me any questions if you have trouble.
  4. Browse: [About the FAQ Forum] [Table of Contents] [FAQs] [Contribute] [XD: XFree86, desktops, Gnome, KDE...] XD-04: Konqueror FAQ This FAQ will introduce you to some of the neat features available in Konqueror, the KDE Web Browser and File Manager. I will be discussing Konqueror 3.4, found in KDE 3.4, so if you have an older version some of the features discussed here may not be available to you. Tabs Tabs are the greatest thing since sliced bread, they can make browsing multiple pages at the same time simple, and at the same time keep them all easily accessible; another bonus is that they use less memory than opening a new window. There are three ways to open a new tab: Click on the "Location" button on the menubar at the top of the screen and then select "New Tab". Click on the "Window" button on the menubar and then select "New Tab". Press Ctrl+Shift+N Split Views Yet another great innovation, this feature allows you to look at multiple pages in the same tab (If you were wondering, you cannot make more tabs inside a split view.) You can split views Left and Right or Top and Bottom. To do this, click on the "Window" button on the menubar at the top of the screen and then select "Split view Left/Right" or "Split view Top/Bottom" to split the view however you want to, as many times as you wish. The Navigation Panel Last, but certainly not least, I will discuss the Navigation Panel, a feature that you are likely to find useful. To Show/Hide the navigation panel, click on the "Window" button on the menubar at the top of the screen and then select "Show Navigation Panel" or "Hide Navigation Panel", or just press F9. Let the fun begin! You will find tabs here showing: Your Bookmarks System Devices Your Browsing History Your Home Folder The Sidebar Media Player FTP archives and web sites Your Root Folder (A tree view of the filesystem). And the last tab is worth a bit more discussion. Here you will find a highly useful "Audio CD Browser," that you can use to extract music from your CDs to both WAV (Uncompressed) and OGG (Compressed) files; it even downloads the name of each track for you from an online database (freedb). There are also several browsers: A device browser A font browser A LAN Browser A print system browser, which displays connected printers, current jobs, and so on. Of course, there is always more to find in the "Konqueror Handbook" which you can access through the Help menu, or by just pressing F1. Access Keys Access keys are a feature that can potentially speed up your web-browsing (Note that I'm now using 3.5, this may not apply to 3.4). Pressing the right or left 'Ctrl' key while browsing will enable the use of access keys. Access keys map keys on the keyboard to all the hyperlinks contained in a page, so if you press a key associated with a link, Konqueror will follow it. Vi(m) Movement Keys Vi(m) fans may be pleased to know that the vim movement keys, h, j, k, and l can be used for navigation around websites. For those that are not practicioners of Vi(m), these keys correspond to the following movements: h - left (it is the key on the left.) j - Down (sort of looks like an arrow down.) k - Up l - Right (it is the key on the right. I hope you enjoyed this FAQ and most of all that you learned something, thanks.
  5. A segmentation fault occurs when a program tries to access some memory that isn't there. It usually occurs when a program tries to use a file that doesn't exist, so you must be missing something the game requires. Since the error occurs in 10.1 but not 10.0, my guess is that some system specific files are missing, maybe packages that weren't installed this time. Are there any other games which get the same error?
  6. It's the filesystem that controls maximum file sizes and I'm assuming you use ext3 (And i'm quite sure ext3 has a 2GB limit). If so, you may want to consider ReiserFS (Version >= 3.6). More info here.
  7. Tuxiscool

    MDK 10. CE

    I had very much the same problem when i tried installing 3.2 on my 9.2 system. It started at completely random times, sometimes it got further than others etc. It seemed to be a problem with ~/.ICEauthority because i got a few warning dialogs about it, other than that i'm not sure. Hope I was some help. PS: Once I installed 10.0 beta1 the problem was gone.
  8. Without having to get the mplayer codec packages, you could also use Totem, which has support for WMV. EDIT: Then again, you could always use XINE....which totem is based on.
  9. Quoted from Mandrakesoft Wiki pages here.
  10. Sorry that i can't post that FAQ, i do have one, but it has copyright issues. If anyone wants it , i could distribute it individually if you PM me. But there is also a very good resource here: http://kerneltrap.org/node/view/799
  11. Excellent news! And Urza9814, I don't understand what MPlayer cannot do that WMP can. Mplayer has become an excellent supporter or basically all well-known codecs. And is avaliable for people that don't know at www.mplayerhq.hu
  12. Good to know, not that i am surprised though, i've been running 2.6 for a while and noticed very nice speed improvements in Return To Castle Wolfenstein, on a resonably slow (compared to modern standards) Pentium 3 650MHz computer. Most other apps that i use have also gained a speed improvement. The 2.6 kernel and Reiser 4 will make for a nice couple. :D
  13. Just to answer your question in the topic: Programs designed using the Windows API use special "system calls" that Linux does not recognise natively, so what an emulator, like WINE does, is change Windows API system calls into calls that Linux can understand. That's why running programs through emulation will always be slower than natively. Hope that helps.
  14. Browse: [About the FAQ Forum] [Table of Contents] [FAQs] [Contribute] [CL: Command Line Questions] CL-10: Basic Shell Scripting This FAQ will cover basic shell-scripting techniques in BASH (Bourne-Again SHell), the default shell on all (or at least 99%) of all current Linux distributions, and probably for many years this will remain the case. BASH is a very powerful shell, and bash scripting can introduce users to concepts used in all computer programming, which I will talk about briefly in this FAQ. A program is just a collection of instructions to carry out a task. Finding efficient ways to do these "tasks" is what programming is all about. To program in BASH, you need slight knowledge of different Linux terminal commands, as that is essentially all BASH scripting is, instead of writing several commands to do a specific task, you can combine them all so they can all be done through one command with BASH scripts. I will begin with a simple example: Create a file called firstscript.sh, using the command touch firstscript.sh Now open that file with your favourite text editor and type the following code into the file. #!/bin/bash echo "Hello, What is your name?" read NAME echo "Nice to meet you, $NAME" Now save the file. Now, before you can use this program, you must first make the file executable, you can do this like so: chmod 0755 firstscript.sh or chmod +x firstscript.sh Now you are free to run the program, like so: ./firstscript.sh I will go over the different lines of the program, so this will make more sense (hopefully). #!/bin/bash - This tells the computer that the program is a BASH script. echo "Hello, What is your name?" - "echo" prints the contents between double quotes (also known as a String Literal) to the screen read NAME - This line introduces the concept of a "variable", a simple analogy for a variable would be a pocket, it is a storage space which can hold a variety of things, in this case the words entered by the user. In other words, The program stores anything you enter, into the variable NAME, and things can be done with that variable, which will be covered soon. echo "Nice to meet you, $NAME" - The only new content of this line that you haven't seen before is "$NAME", as you may have found out out by running the program, when used with "echo," prints out the contents of variable NAME. The "$" can be interpreted to mean "contents/value of", so with $VARIABLE you would be referring to the contents, or the value, stored in the variable, named VARIABLE . Evaluating expressions Evaluating an expression can be done through the use of square brackets ([ and ]). A simple way to explain this would be through making a rudimentary calculator, so write the code below in your favourite editor and save it as "calculator.sh" #!/bin/bash echo "Finding X * Y" echo "Enter X:" read X echo "Enter Y:" read Y echo "X * Y = $X*$Y = $[X*Y]" You can run the program by making it executable as shown before, and executing it. (./calculator.sh). As you can see, the $[X*Y] returns the value by multiplying the values stored in the variables X and Y. You should take note that if you have many variables, you should use parenthesis '(' and ')' to show the order you want the expressions evaluated. As an example: "$[((X*Y) / (X + Y)) - X]" As you should know from maths, the contents of the brackets will be evaluated first. If and Else Statements If and else statements are useful in the way that you can get a certain block of code to be used only if a condition is true. To show this as an example, make a new file called "ifandelse.sh", you can copy the code from "calculator.sh" to take a slight shortcut, and modify the file to look as it is below: #!/bin/bash echo "Finding the greater number" echo "Enter X:" read X echo "Enter Y:" read Y if test "$X" -gt "$Y"; then echo "$X is greater than $Y" elif test "$X" -lt "$Y"; then echo "$X is less than $Y" else echo "$X is equal to $Y" fi A few new things were introduced in this script, and I'll go over each. The "if" statement - This tests if the "expressions next to it are true, I'll cover these soon. and if thy are true, the code under them will be "used". After that code has been executed, the script continues from after the "fi" statement. test "$X" -gt "$Y" - This uses the GNU command "test" and tests if the value stored in X is greater than (-gt) the value stored in Y. The wonderous semicolon ( ; ) - Like many programming languages, BASH can use the semicolon to separate statements (NOTE: The semicolon is only needed in BASH if you have more than one statement/command on the same line, otherwise it is optional, unlike many other languages where a semicolon is needed to separate every statement.). then - This statement is used after "if" and "elif" (It is not used anywhere else.) to tell it to use the code under the statement, if the condition is true. An easy way to think what this code means if test "$X" -gt "$Y"; then echo "$X is greater than $Y" is "If X is greater than Y, "then" print the contents of the double quotes in the echo statement to the screen. elif - (short for "else if") This tests another condition if the previous condition was found as false, if the previous condition was found as true, this elif statement, and the rest of the code until after the "fi" statement, is ignored. If the condition here is found true, the code below it is executed (as with the "if" statement). -lt - (less than) This is another argument to the "test" command that tests if a the value stored in a variable is less than another. You can find out about the different options that the test command offers you by using the command "man test" else - This is used to test the last condition between the "if" and "fi" statements. As you can see, "then" isn't needed after the else statement. fi - This shows the end of the if/else statements. Looping with "while" statements Usually, "program flow" in a shell script goes in the order "top to bottom". If you want a certain piece of code to be used a certain amount of times, there are a few different statements you can use, this part of the FAQ will cover the "while" statement. The way the computer uses "while" statements is like so: A good example is getting the computer to show you that it can count up to ten. So create a file called "while.sh", and write the following code into it: #!/bin/bash X=1 while test "$X" -le "10" do echo "$X" X=$[X+1] done If you run the script you will get the following output: 1 2 3 4 5 6 7 8 9 10 As you can see, using loops (with "while" statements in this case) is much more efficient than writing 10 different "echo" statements to get exactly the same output. Loops are a very important part of all programming and most programs that you will ever write are very likely to contain at least one loop. As with other examples, this one also introduced new ideas. X=1 - This stores the value "1" in the variable named X, quite simple. NOTE: You cannot have spaces between X and the equals sign ( = ), and the equals sign and 1, otherwise they are all treated as separate statements. while - As said before, this is used like "while condition is true, execute/process code between the "do" and "done" statements. -le - (less than or equal to) Tests if one expression/value is less than or equal to another. do - If the condition in the while statement was true, the do statement shows where to start processing the code. "do" is used with while, until and for statements. (both of which will be explained shortly.) X=$[X+1] - This increments the value stored in variable X by one every time this code is encountered. done - As said before, this shows the end of the "while" statement. Behaves in much the same way as "fi" does for if/else statements. Exercise: Now you can try making a script that counts down from 10 to one using your gained knowledge of shell scripting. If you really want, you can even send me a PM and I'll mark it for you ;). The "until" loop Something that uses the opposite logic of "while", but has the same syntax is the "until" statement which is quite self-explanatory, though i will provide an example anyway. #!/bin/bash X=1 until test "$X" -gt "10" do echo "$X" X=$[X+1] done This executes the code between "do" and "done" until the value stored in the variable X is greater than 10. This script has the same output as the previous example. The "for" loop "for" loops have quite a different syntax from that of "while" and "until" loops. The best way to explain these differences is by example, so create a file "forloop.sh", And write the following code into it: NOTE: The code below contains only my opinion, I mean no offence to anybody whatsoever, if you don't agree with it you can substitute values for your tastes. #!/bin/bash for food in chinese italian korean vietnamese japanese thai cambodian do echo "$food food tastes good" done echo "But indian food does not" I will go over the new parts in this script. for - "for" statements have the syntax "for <variable> in <variable value> ...". I will explain parts of this now. <variable> you substitute for the name of a variable you want to access/use inside the for loop. "in" stores the strings and/or values after it into <variable>. <variable name> are the values or strings that you want <variable> to store. For example, the first time through the last "for" loop, the value stored in the variable food would be the string "chinese", the second time through, "italian" and so on. The value of <variable> is one of the strings/numbers after "in" each time through the loop. The loop finishes when all of the numbers/strings after "in" have been used. If you are confused over what was just said (I wouldn't be surprised), you should run the script and the code should be understood quite easily. The alternative "for" syntax If you have ever come across some programming in C or C++, you are likely to have seen that the syntax of the "for" statement is quite different to what has been shown in the previous examples. This other way of using for loops will be introduced now: for (( i=0; i<10; i++ )) For loops contain three parts, each one separated by semicolons. The format of this is: for ((initialisation;condition;increment)) I will explain each part now: initialisation - This part creates, and sets the value for one or more variables. In the above example, "i = 0" Creates the variable 'i' if not previously created, and sets the value that 'i' contains, to zero. condition - This part tests one or more conditions, just like the if/while statements do. Using the above as an example: "i<10" would test if the value stored in 'i' is less than ten. If it is, the loop will run, if not, the loop will be ignored. increment - This part is used to alter the variable(s) that were previously created. In the previous case "i++", The value stored in 'i' is incremented by one each time the loop has run through. A new thing that you may have noticed is the increment operator (++). This will increment the value stored in a variable by one. There is also a decrement operator that can be used (--), which will decrement a value by one. Time for a proper example of it's use, note that the output will look familiar. for ((i=0, f = 10; i<10, f > 5; i++, f--)); do echo $i;done This certainly isn't the most efficient for loop, but it demonstrates what they can do quite well. It can be "read" as saying, "Initialise 'i' as 0 and 'f' as 10, while 'i' is less than 10 and 'f' is greater than 5, carry out the loop (printing each value of 'i' to the screen) between the 'do' and 'done' statements, and at the end of each "loop", to increment 'i' by one, and decrement 'f' by one." The loop will give the following output: 0 1 2 3 4 The "seq" command This command prints out a sequence of numbers, and as quoted from the "seq" man page, takes these arguments. I'll give an example of each use, even though they are quite easy to understand. seq 20 That would print out the numbers 1, to 20, being incremented by 1 each time. Though if you are wanting the numbers to count up starting from 0, you will need to use the one of the last two formats of the "seq" command, as shown below. seq 0 20 That would display the numbers from 0 to 20, again incrementing by one each time. If you want to change the amount incremented, you will have to use the third format of the seq command, for example: seq 0 3 50 This would display the numbers one through to 50 with an increment of three each time (as compared to the others where "seq" only incremented by 1 each time. Counting down with the "seq" command is also possible, to do this, you would have a negative "INCREMENT", prefixing the number with a "-", like so: seq 400 -20 5 This would count down from 400 with a decrement of 20 until the number 5 is reached, as you will be able to see from these examples, "seq" is very easy to use, and you can find out a little more about it from it's man page. "seq" can be used in your shell scripts like all other commands, and as you may see, is much more efficient than any loop to do the same task. Thanks to aru for telling me about the seq command and the ability of using C's syntax in for loops. If you have any ideas, comments etc. for this FAQ, you can PM me.
  15. do if [ ! -f $imgname ]; then echo $imgname" not found." break fi Using these square brackets means the same as using the GNU command "test". It's saying that if $imgname doesn't exist as a regular file, as opposed to a symlink or whatever, then carry out the instructions between the if statement., i would have thought though that the $imgname part was enclosed in the double quotes, but i am not certain on that. About the rest of the script, you'll have to ask some others ;).
  16. You should also make sure that you have the latest version of Mesa installed from http://www.mesa3d.org/, if it has been updated since 9.2....
  17. Thanks, this is a really nice theme, i'm sure it'll stay my default for a while :), can't wait for the metacity port :D.
  18. Browse: [About the FAQ Forum] [Table of Contents] [FAQs] [Contribute] [SI: Software Installation] SI-01: How do I install tar.gz's and RPM's? There are as many ways to install software on linux as there are penguins in antarctica, but in this FAQ I will describe the two most simple ways, RPM's and .tar.gz's/.tar.bz2's. RPM Installation RPM (Redhat Package Manager) is the packaging system that Mandrake, Red Hat (of course) and some other distributions use. To install a RPM that you have downloaded off the net: In the console: rpm -ivh /location/of/package.rpm You will have to substitute "/location/of/package.rpm" for the location of the package. For example, if you have a GAIM RPM for Mandrake 9.1 in your /home directory, you would install it like so (assuming that the user has the name bob, substitute for your username.): rpm -ivh /home/bob/gaim-0.74-1mdk9.1.i586.rpm And to upgrade an RPM that you currently have installed, you substitute the -ivh argument for -Uvh, so to upgrade a version of GAIM to 0.74 (as an example), you would use the following command, like so: rpm -Uvh /home/bob/gaim-0.74-1mdk9.1.i586.rpm In a GUI File Manager (Like Konqueror, or Nautilus): To install a package using the File Managers is simple. All you need to do is click/double click (depending on your configuration) on the rpm and Mandrakes' (I'm assuming that you use Mandrake) gurpmi tools will choose whether to install or upgrade (depending on if you have the package installed already), tell you any dependencies that the package has (I will talk about these later), and of course, install the package. Useful rpm command-line arguments: There are many arguments for using "rpm", too many to list here in fact, so I will summarise some of the most useful options for installing and upgrading RPMs. -v This will print verbose information to the screen when installing an RPM. -i This installs an RPM package. -U This upgrades an RPM package. -h This prints 50 hash marks (#) while package archive is unpacked. --nodeps This tells "rpm" to not perform a dependency check before installing an RPM. --oldpackage This allows an old package to replace a newer one. --replacefiles This makes "rpm" install files even if they replace files from other packages. You can get a Complete summary of the options by typing "man rpm" at the command line. RPM dependencies Dependencies would probably be my most hated part on RPM installations. You get dependencies when a package relies on some other package to be able to function. The only simple solution to RPM dependencies is URPMI. (Refer to LiquidZoo's FAQ for information on how to use URPMI, which you can find here.). Otherwise you will most likely end up searching for days on the net, which is a huge hassle. .tar.gz Installation .tar.gz's come with many different contents, from binaries, to source packages, i will cover the default installation of both types, so you should be able to install most of the .tar.gz packages you find on the net, and if not, there should always be a README and/or INSTALL file with installation instructions. .tar.gz Source Installation/Compilation First you must extract the .tar.gz To do this, you use the command "tar", like so: tar -xzvf /home/bob/compressedfile.tar.gz This command would extract the contents of the file "compressedfile.tar.gz" into the current directory. If you didn't issue this command from the "/home/bob" directory (substituting "bob" for your username of course), "tar" would try and extract the contents to whatever directory you are in, showing an error if you do not have permissions to the directory. You can find the current directory you are in with the command "pwd" (Present Working Directory). Now you "cd" into the location of the source code For example, MPlayer 0.91 when extracted creates a directory "MPlayer0.91/". So, to go into this directory wou would use this command: cd MPlayer0.91/ This should be similar to any other software that you download (with, of course, a different name) Compiling & Installing it Most Linux software follows the same conventions when packaging their software, and with most software, only four commands should usually be needed. They are used in the order shown below: ./configure make su make install The configure command, oddly enough, configures software for your computer and checks if you have everything needed for it to build. The make command compiles the software. The su command allows you to log in as the root user (all powerful admin). And finally, make install installs the compiled software as the root user. NOTE: Sometimes when using ./configure you get an error that you are missing some "devel", or "development" packages, for example, I got the following error compiling Gaim (gaim.sourceforge.net) *** GLib 2.0 is required to build Gaim; please make sure you have the GLib *** development headers installed. The latest version of GLib is *** always available at http://www.gtk.org/. Sometimes, the ./configure script will tell you where you can find the missing package (as above), sometimes it will, not, if not, you can either search for the rpm, there are some useful sites for doing this like: pbone.net rpmfind.net Development packages usually have the -devel suffix in the filename The Mandrake (or whatever distribution you use) cds you have contain many of the development packages that you should ever need. The net should only be a last resort for finding packages You will usually find more accurate and extra information in the README and/or INSTALL files contained with the software about the different compile options. .tar.gz Binary Installation Some software packages, with realplayer as an example, distribute their binaries in a .tar.gz and not source code, these are much easier to install, first you extract the contents of the tar.gz and then run the binary like so: ./nameofbinary As you can see, you precede the name of the binary with './' NOTE: Sometimes, if you can't use "./nameofbinary", you will need to make the file executable, you do this like so: chmod +x nameofbinary .tar.bz2 Software Bzip2 files use a newer and much better compression algorithm than gzip (.gz) and are just as simple to use. You uncompress them like this (as an example): tar -xjvf /home/bob/compressedfile.tar.bz2 And you can follow the same instructions as for .tar.gz's for installing/compiling the software. If you have any suggestions, comments, corrections etc, you can send me a PM.
  19. Browse: [About the FAQ Forum] [Table of Contents] [FAQs] [Contribute] [BL: Bootloaders] BL-01: LILO configuration LILO stands for "LInux LOader". It is one of the many Bootloaders for Linux, and the default on most distributions. This FAQ will cover the configuration of LILO. The File /etc/lilo.conf contains the information that allows LILO to "know" where to boot your Operating Systems/Kernels. Below is an example of my /etc/lilo.conf file. boot=/dev/hda map=/boot/map vga=normal default="linux" keytable=/boot/us.klt prompt nowarn timeout=100 message=/boot/message menu-scheme=wb:bw:wb:bw image=/boot/vmlinuz label="linux" root=/dev/hda6 initrd=/boot/initrd.img append="devfs=mount hdd=ide-scsi acpi=off" read-only other=/dev/hda1 label="windows" table=/dev/hda other=/dev/fd0 label="floppy" unsafe image=/boot/vmlinuz-2.4.21-0.13mdk label="linux2" root=/dev/hda6 initrd=/boot/initrd-2.4.21-0.13mdk.img append="devfs=mount hdd=ide-scsi acpi=off" read-only image=/boot/vmlinuz label="failsafe" root=/dev/hda6 initrd=/boot/initrd.img append="failsafe devfs=nomount hdd=ide-scsi acpi=off" read-only Summarising the options: boot=/dev/hda This is the device that will be booted. It will almost always be either /dev/hda or /dev/sda, depending on your Hard Drive. map=/boot/map This is a file that contains the specific locations from where your kernels are booted. You should never need to change this option. vga=normal This sets LILO's resolution, your distribution should set it up on install, and you should not need to change it. vga=791 is 1024 x 768, vga=788 is 800 x 600 and vga=normal is 640 x 480. default="linux" You can set a default kernel to boot here. This corresponds to one of the label="*****" options. keytable=/boot/us.klt To be honest i don't actually know what this line does, and if someone can inform me that would be appreciated. For a guess, i think that this would load the default so-called "keymap" that "tells" the kernel what your keyboard layout is. prompt Tells LILO to display a prompt where you can select which kernel to boot. nowarn With this i also have no idea of what it does. If anyone can inform me, this would, again, be much appreciated. timeout=100 Tells LILO how many tenths of a seconds to display the prompt (after which the first kernel is booted). message=/boot/message I do not know what this does, either should you need to know it. Anyone know? menu-scheme=wb:bw:wb:bw I have no idea how to modify this, nor should you ever need to, i am guessing it corresponds to the colour of LILO's prompt, but i am not too sure. I'd say this line is only applicable for a text-based LILO, not Mandrake's graphical stuff. Now the options for the specific boot options: image=/boot/vmlinuz This tells LILO which linux kernel image to boot, by default, Mandrake's kernel is stored in the file /boot/vmlinuz . other=/dev/hda1 The "other=" prefix tells LILO that this is a non-linux kernel to boot. In my case here, a windows kernel (*gasp*, NOTE: I do not use is, it's for my mother ;) ). The "/dev/hda1" part shows the device to boot the kernel from. This may vary for you, depending on your configuration. label="linux" The text to type/select at the boot prompt to boot the kernel is contained within double-quotes. In my case here, "linux" of course :D root=/dev/hda6 This points to the root partition ( / ) that the kernel must mount at boot. NOTE: This option is only applicable for Linux kernels, not Windows. initrd=/boot/initrd.img This points to the so-called "Initial Ramdisk". I do not know much about it, but you should not need to modify this, ever. append="devfs=mount hdd=ide-scsi acpi=off" This passes options to the kernel at boot time (the stuff in the double quotes). Using mine as an example, the devfs filesystem is mounted, the kernel is "told" to enable SCSI emulation for cd burners (Thanks to HJ for this correction) and it is "told" to turn off ACPI. You will rarely need to change this, the only case i can think of would be when compiling your own kernel from source, but i have never needed to change this. read-only This option specifies that the root filesystem must be mounted "read-only" initially. You should not need to change this. table=/dev/hda Only applicable for Windows, this points out where your windows partition is (my guess is that the option is called "table=" because of Windows' filesystem being FAT, a.k.a File Allocation Table.) I do not know what this line would look like for an NTFS partition, sorry. unsafe I do not know what this option does, you can probably always keep this "as-is". Configuring LILO to boot a "custom-kernel": Since i have never done this using LILO, i will just improvise, and please, someone correct me if i'm wrong here. WARNING: Though you may feel the urge to kill me if a custom kernel doesn't boot properly after using the instructions outlined below, i will point out now that you are doing it at your own risk, and i take no responsibility for what happens with your "custom kernel". Use these instructions at your own risk. You can copy one of the sections for the kernel you are using, e.g image=/boot/vmlinuz label="linux" root=/dev/hda6 initrd=/boot/initrd.img append="devfs=mount hdd=ide-scsi acpi=off" read-only to the bottom of the file /etc/lilo.conf. then you can edit the options for the new kernel image (most likely a bzImage file). You should only need to modify the "image=" line and "label=" line, and in some special cases, the "append=" line. Also, in some cases (RPM install for example) you will have to edit the "initrd=" line. For example, a 2.6.0 kernel would have a setup something like this: image=/boot/bzImage-2.6.0 label="Linux2.6" root=/dev/hda6 initrd=/boot/initrd.img append="devfs=mount hdd=ide-scsi acpi=off" read-only After making any changes to LILO, in lilo.conf, you must run "lilo" in the terminal to make the changes take effect. If you have any corrections, suggestions, constructive-critisism, please, pm me.
  20. Sounds almost like the start of Palladium/TCPA to me, and about there being a linux BIOS, one was started many years ago, it can be found here http://www.linuxbios.org/.
  21. As having only a 1GB HDD for an MP3 player, while that is not a problem, you should try and get the smallest possible , that being an "embedded linux". In my opinion, the best for the task would be the "Linux Router Project". If i had time, i would write a guide to help you get it working, but time is something i don't have, so i will just provide you with a few links, and you will have to sort yourself out. ftp://ftp.linuxrouter.org/linux-router/di....8_Linux_2.2.gz There you will get an LRP disk image. ftp://ftp.linuxrouter.org/linux-router/di...RP.linux.tar.gz There you will get a kernel that you can compile on a different computer. This is needed since LRP doesn't provide sound card support. http://www.kernel.org/pub/linux/utils/boot...slinux-1.48.zip Here you will get a very nice, small bootloader. The LRP is a linux distro that uses FAT16 partitions, so make a dos boot disk with 'fdisk', 'format', 'edit' and 'lock' on it (sorry, you will need a winblows macine for this), run fdisk in a dos prompt and make 2 partitions, The first one being ~7MB, and the latter using the rest (the one for the MP3's). Reboot and format both partitions. On another machine, extract 'syslinux.com' from the file 'syslinux-1.48.zip' and put that on a floppy. Using the boot disk, run 'lock c:' on the MP3 box. (to allow direct disk access), then with the other floppy, run 'syslinux.com c:' on the MP3 box to install the bootloader. Now, run 'cp idiot-image_1440KB_FAT_2.9.8_Linux_2.2 /dev/fd0' on a box to write the disk image to a floppy. After putting that floppy in the MP3 box, copy all of the files except 'ldlinux.sys' to the primary partition. Now use 'edit on the dos boot disk to alter 'syslinux.cfg' file on the primary partition. If the box has more than 12MB of RAM, then change the number after 'ramdisk_size=' to '8096', and also change 'boot=/dev/fd0u1440' to 'boot=/dev/hda1' You will now have a bootable LRP system. Sorry but since i really have lots to do, i will have to let you do the rest (compile the kernel with sound support etc -- which i linked you to earlier), set up networking, bla bla bla. Good Luck! :D
  22. Tuxiscool

    mplayer...

    If anyone wants to know, you can also press the 'f' key to change to fullscreen mode.
  23. Thank you very much for all of your help and Dr Thrall, i will try out your advice when i can be bothered ;), but for a start, trying ACOS() , ASIN(), and ATAN() produces the following errors. calculator.cpp: In function `int main()': calculator.cpp:177: `ACOS' undeclared (first use this function) calculator.cpp:177: (Each undeclared identifier is reported only once for each function it appears in.) calculator.cpp:197: `ASIN' undeclared (first use this function) calculator.cpp:217: `ATAN' undeclared (first use this function) do i need to add an extra header file or is it something different i do? Thanks in Advance
  24. Yeah, thanks for that, i had done that already though over a week ago, now it does a few more things aswell. Now im trying to figure out how i can find the size of an angle when i have the value CosA (where A is the angle) and also tanA and sinA. Here's my code so far #include <iostream.h> #include <math.h> struct answer{ double multiply, add, divide, subtract, square, sqrt, tanA, cosine, sine, circumference, semiCircumference; }; int main() { int Choice, choiceCircumference; double mulnumone, mulnumtwo, addnumone, addnumtwo, divnumone, divnumtwo, subnumone, subnumtwo, squarenum, sqrtnum, tannumopposite, tannumadjacent, cosnumadjacent, cosnumhypotenuse, sinnumopposite, sinnumhypotenuse, circleDiameter, semiCircleDiameter; answer answer; while (1) { // Menu Heading cout << "ttt##########################n"; cout << "ttt####### CALCULATOR #######n"; cout << "ttt##########################n"; //Menu Choices cout << "nttt1) Multiply Numbers n"; cout << "ttt2) Add Numbers n"; cout << "ttt3) Divide Numbers n"; cout << "ttt4) Subtract Numbers n"; cout << "ttt5) Square Numbers n"; cout << "ttt6) Find Square Root of number n"; cout << "ttt7) Find cosA n"; cout << "ttt8) Find sinA n"; cout << "ttt9) Find tanA n"; cout << "ttt10) Find Circumference n"; cout << "ttt11) Exit the calculator n"; cout << "ntttPlease Enter your choice: "; // Find users choice cin >> Choice; // Accordng to choice Calculate users input // Multiplication if (Choice == 1) { cout << "ntttYou chose to Multiply Numbers.nttt"; cout << "ntttEnter the numbers that you want to Multiply, after you type each number, press enternttt"; cout << "ntttEnter First Number: ttt"; cin >> mulnumone; cout << "ntttEnter Second Number: ttt"; cin >> mulnumtwo; // Calculate the Multiplication Equation answer.multiply = mulnumone * mulnumtwo; cout << "nttt" << mulnumone << " times " << mulnumtwo << " equals " << answer.multiply << "nn"; } // Addition else if (Choice == 2) { cout << "ntttYou chose to Add Numbers.nttt"; cout << "ntttEnter the numbers that you want to Add, after you type each number, press enternttt"; cout << "ntttEnter First Number: ttt"; cin >> addnumone; cout << "ntttEnter Second Number: ttt"; cin >> addnumtwo; // Calculate the Addition Equation answer.add = addnumone + addnumtwo; cout << "nttt" << addnumone << " plus " << addnumtwo << " equals " << answer.add << "nn"; } // Division else if (Choice == 3) { cout << "ntttYou chose to Divide Numbers.nttt"; cout << "ntttEnter the numbers that you want to Divide, after you type each number, press enternttt"; cout << "ntttEnter First Number: ttt"; cin >> divnumone; cout << "ntttEnter Second Number: ttt"; cin >> divnumtwo; // If divnumtwo equals 0, don't try to divide if (divnumtwo == 0) { cout << "ntttSorry, you can not divide by Zero, Please try something else.nn"; } // Calculate the Division Equation else { answer.divide = divnumone / divnumtwo; cout << "nttt" << divnumone << " divided by " << divnumtwo << " equals " << answer.divide << "nn"; } } // Subtraction else if (Choice == 4) { cout << "ntttYou chose to Subtract Numbers.nttt"; cout << "ntttEnter the numbers that you want to Subtract, after you type each number, press enternttt"; cout << "ntttEnter First Number: ttt"; cin >> subnumone; cout << "ntttEnter Second Number: ttt"; cin >> subnumtwo; //Calculate the Subtraction Equation answer.subtract = subnumone - subnumtwo; cout << "nttt" << subnumone << " minus " << subnumtwo << " equals " << answer.subtract << "nn"; } // Squaring else if (Choice == 5) { cout << "ntttYou chose to Square a Number.nttt"; cout << "ntttEnter the number you want to Square: ttt"; cin >> squarenum; // Calculate the Squaring Equation answer.square = squarenum * squarenum; cout << "nttt" << squarenum << " squared equals " << answer.square << "nn"; } // Square Rooting else if (Choice == 6) { cout << "ntttYou chose to find the Square Root of a number.nttt"; cout << "ntttEnter the number you want the Square Root of: ttt"; cin >> sqrtnum; //Calculate Squaring Equation answer.sqrt = sqrt (sqrtnum); cout << "nttt" << "The square root of " << sqrtnum << " is " << answer.sqrt << "nn"; } // Finding cosA else if (Choice == 7) { cout << "ntttYou chose to find cosA.nttt"; cout << "ntttEnter the size of the adjacent side: ttt"; cin >> cosnumadjacent; cout << "ntttEnter the size of the hypotenuse: ttt"; cin >> cosnumhypotenuse; // Find cosA answer.cosine = cosnumadjacent / cosnumhypotenuse; cout << "nttt" << "cosA equals " << answer.cosine << "nn"; } // Finding sinA else if (Choice == 8) { cout << "ntttYou chose to find sinA.nttt"; cout << "ntttEnter the size of the opposite side: ttt"; cin >> sinnumopposite; cout << "ntttEnter the size of the hypotenuse: ttt"; cin >> sinnumhypotenuse; // Find sinA answer.sine = sinnumopposite / sinnumhypotenuse; cout << "nttt" << "sinA equals " << answer.sine << "nn"; } // Finding tanA else if (Choice == 9) { cout << "ntttYou chose to find tanA.nttt"; cout << "ntttEnter the size of the opposite side: ttt"; cin >> tannumopposite; cout << "ntttEnter the size of the adjacent side: ttt"; cin >> tannumadjacent; // Find tanA answer.tanA = tannumopposite / tannumadjacent; cout << "nttt" << "tanA equals " << answer.tanA << "nn"; } // Finding Circumference else if (Choice == 10) { cout << "ntttWhat do you want to find the circumference of? n"; cout << "nttt1) Circle. n"; cout << "ttt2) Semicircle. n"; cout << "tttWhat is your choice? "; cin >> choiceCircumference; if (choiceCircumference == 1) { cout << "ntttYou chose to find the circumfefence of a circle.nttt"; cout << "ntttEnter the diameter of the circle: ttt"; cin >> circleDiameter; // Find Circumference of circle answer.circumference = circleDiameter * 3.14159; cout << "nttt" << "The circumference of the circle with the diameter " << circleDiameter << " is " << answer.circumference << "n"; } else if (choiceCircumference == 2) { cout << "ntttYou chose to find the circumference of a Semicircle.nttt"; cout << "ntttEnter the diameter of the Semicircle: ttt"; cin >> semiCircleDiameter; // Find Circumferene of semicircle answer.semiCircumference = (semiCircleDiameter * 3.14159) * 0.5; cout << "nttt" << "The circumference of the semicircle with the diameter " << semiCircleDiameter << " is " << answer.semiCircumference << "n"; } } // If users choice was to exit the calculator, exit else if (Choice == 11) { cout << "ntttYou chose to Exit the Calculator. Bye.nttt"; break; } // If users Choice is not valid, must enter again else { cout << "ntttYour choice is NOT valid!n"; cout << "tttPlease enter a CORRECT choice!nn"; } } return 0; } [/code]
  25. I also noticed the same thing when i switched to mandrake from Red Hat for the first time (Red Hat 7.2 to Mandrake 8.1). I know that there are many patches that mandrakesoft put into their kernels but i am not sure which ones sorry. The main reason though, as you said, is because of the i586 optimisations (i'm quite sure that's the case anyway). EDIT: well now i'm just confused, you said that Gentoo was slower than Mandrake???, that shouldn't be right, does anyone else know anything about this?
×
×
  • Create New...