Monday, April 30, 2012

Programming in Qt 2 - The core

Introduction
Signals
Slots
Exercise
 Function definition
 Connecting the slot
Finishing things up


Introduction
In the first tutorial I taught you how to basically create a "hello world" program in QT and change the value of a button. However, explicitly defining everything in that method is not the purpose of a GUI. User interaction is a key feature of any user interface, so in this tutorial I will show you how to create a button that toggles its text. To do so I will use signals and slots. Before we delve into the code, I will explain what those two things are.

Signals
During the execution of a Qt application there is a main loop until the user commands the program to stop or there is a serious exception. Signals are Qt constructs that are emitted when a certain action has occurred. You can create your own signals with the emit keyword, but for now we will only worry about custom slots.

Slots
Slots are the code executed when a signal has been emitted. These slots are connected to the signals of a certain object within the application. For instance, the slot we will make will be connected to the clicked() signal of the PushButton.

Exercise
 Function Definition
Create a toggling button
Open Qt creator and open the .pro file that you created in the last exercise. .pro files, or project files are what tell qmake to include that particular file in compilation.

You should already have an application complete with a PushButton in the center. If not, follow the steps in the first tutorial to get to that point. Our first step is to create a prototype for toggleVal() in MainWindow.h. Go to MainWindow.h in Qt creator. The file is located under the "headers" tab which may be collapsed.

I usually append the class after private: since that is the end of the generated code, but you can place these next two lines wherever you want. Some prefer to do it after public:.You need to add this code:

public slots:
void toggleVal();

As you probably already know from studying C++ this creates a prototype, or undefined declaration, of the function toggleVal(), which we will define in MainWindow.cpp.

Navigate to MainWindow.cpp and after the definition of the MainWindow deconstructor add the following lines:

void MainWindow::toggleVal(){
    QString val1="Value 1";
    QString val2="Value 2";
    if(ui->pushButton->text()=="Value 1")
        ui->pushButton->setText("Value 2");
    else if(ui->pushButton->text()=="Value 2")
        ui->pushButton->setText("Value 1");
} 

This is the slot for the PushButton. There are a few new things here. QString is used instead of std::string for Qt text. std::strings can be converted using the fromStdString() function of QString.

text() for pushButton returns the displayed text and setText() sets the text.

Why were the ifs so strict? I find it to be in good style to explicitly define my conditions in my graphical interfaces since other functions could possibly change the value and you may not want it changing at that point. You can define it however you wish, though. The main parts of this code to take are text() and setText().

 Connecting the slot

So far the only thing we have accomplished is making a function that checks the value of a button and changes the text accordingly. This can be called explicitly, but again, that does not give the user enough control. We will connect the slot in the MainWindow constructor of MainWindow.cpp.


After the code 
ui->setupUi(this);
add these two lines:
ui->pushButton->setText("Value 1"); QObject::connect(ui->pushButton,SIGNAL(clicked()),this,SLOT(toggleVal()));






The first line explicitly sets the text of the button to "Value 1" so that the function can work properly. The second line is a bit trickier.

We call the connect function of QObject which has 4 parameters. The first is the sender, which in this case is the pushButton. Then, the signal  to act on. The signal is placed inside SIGNAL(). If you typed this yourself rather than copy-pasting, you would have seen the list of signals available for use with PushButton. Next is the member, which in this case is the MainWindow. Then, the slot. Like SIGNAL() slots must also go within SLOT(). We supplied our toggleVal() function, but you will see a list of predefined slots if you type that code yourself.

Multiple slots can be connected to a single signal, and multiple signals to a single slot. This becomes an important concept once you have multiple ways to quit or to initiate an action.

This power is immense. You can define toggleVal() to do anything you want. Close the application, parse, move the application wildly around the desktop, draw squares with OpenGL... Anything that Qt and C++ are capable of can be done in slots.

Finishing things up
In this tutorial you learned how to define and connect signals and slots. In the next few tutorials, you will learn about some other parts of the Qt library like QString and QPainter in depth. The next tutorial will be on a slight delay as I still have Qt related learning to do before I am able to write it. Other resources do an alright job of explaining things, but the purpose of these tutorials is to provide a very straightforward approach to Qt. 

Sunday, April 29, 2012

Ubuntu 12.04 review

A year after the release of Ubuntu 11.04, Natty Narwhal,  the LTS release of Ubuntu, Precise Pangolin, was released. The new version featured Unity 5 with features such as the HUD and lenses. Also on the list of additions was the inclusion of classic gnome and the replacement of banshee with good-old rhythmbox.

A page out of Debian's book
Debian, the father distribution of hundreds of derivatives, uses Gnome 2 in their stable version. After all the gripe over Gnome 3 and Unity the ubuntu development team decided to include a full blown gnome-classic DE in the release. The inclusion was aimed to move people away from outdated versions of Ubuntu that are still clinging to gnome 2.

Rhythmbox, Debian's media player of choice, is also included over banshee in this distribution. After dropping rhythmbox to include Banshee for 11.04 they have gone back to their roots, leaving banshee in the dust. This was because of community preference, bugs in banshee, and stability in Rhythmbox.

Despite the reasons for these changes, Debian users will be in a more comfortable default environment than before when switching to Ubuntu.

Unity 5
In contrast to the original Unity from 12.04 Unity 5 is a vast, vast improvement. With one fell swoop the Ubuntu team has turned Unity into a tool of timesaving and productivity, and it's called the HUD. The HUD, activated with the alt key, allows access to the menu bar of any application. It also caches results so it can learn your preferences, making quick judgments about what you want to do and what you want to do quickest. The Unity interface can now be customized in a ton of ways, from myunity to the ccsm to even the appearance menu.

Small improvements define the latest version of Unity, however. The simplest features like leaving old queries in the Dash really make using the interface a much more productive experience than before. Unity is no longer the clown car of the desktop interface world.

Conclusion
12.04 is the first distribution after a year of volatility over some of Canonical's decisions to get things right. They dropped unstable software in favor of old, stable software and pushed enough bug patches to make Unity look like a family quilt. Where 11.04 had a cutting-edge, unstable feeling to it 12.04 is a noticeably stable experience that is easy for newcomers and power users alike.

How to package a .deb

          On Debian-based systems, the package manager uses .deb containers to handle the installation of packages. Many people make a connection between .deb and .exe since both are easy formats that usually lead to the installation of a program, but this is not the case. Deb files are more like an advanced .tar, and they don't even need to be used for installing programs. In this tutorial I will show you how to make and build a debian package. Make a new directory, let's say for instance, mydeb. Then, in the mydeb directory make a folder named DEBIAN. Now we can begin.

There are a few essential things to put into DEBIAN. You need to have a control file called control, a pre-installation script called preinst, and a pre-removal file called prerm. The control file uses a special syntax to define dependencies, make a description, and note the authors. Here is a sample control file:

Package: mydeb
Version: 1.0.0-0ubuntu1
Architecture: amd64
Maintainer: You <You@email>
Installed-Size: 154
Depends:
Section: accessories
Priority: optional
Description: A sample debian package.

Package is the name of the package, in this case it's mydeb. The version is the version of the file with any special revision names included. Architecture is what type of CPU it can run on. Depends is the most important, which lists dependencies. The operations > < and >= <= can be used to specify higher or lower version numbers for dependencies. The section is what type of application it is. Priority is whether or not the package is a necessity. In this case it's not. Description is a long description of what the package can do. This can be multiple lines.

Now that the control file is out of the way, make two scripts called preinst and postinst. These are bash scripts (text files with #!/bin/bash at the top) that list the commands to install and remove the parts of the program that were included on install. ldconfig should be called in either file.

The fun part
The fun and arguably the most important step is specifying the directories where files will be installed. Leave the DEBIAN folder and make one called home. Then, make one that is exactly equal to your home folder. Make a sample text file here. When the .deb is installed that text file will be placed in your home folder. This is used to spread resources across the files system, for instance the icon goes in /usr/share/pixmaps. You actually have to create those directories inside of the parent directory.

Now you should have two directories in the parent directory, DEBIAN and home. Now we can package these with the dpkg command. Enter the terminal and use the command
dpkg -b 'PATH_TO_PARENT_FOLDER' myDeb.deb


This should create a file in your home folder called myDeb.deb. Now you can install the package with gdebi, the software center, or dpkg.

A note for application developers: ldd lists the dependencies of an executable file for the Depends: part of a command file.

External: http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/How-to-make-deb-packages/

Programming in Qt 1 - Absolute Basics

INDEX:
Purpose
Prerequisites
First program in depth

Purpose 
             As a somewhat new programmer (less than a year) I have run into some irritating tutorials in my experiences. When I began to learn the Qt framework and the Qt creator Integrated Development Environment (IDE) these experiences were ubiquitous. This is in part due to the self-explanatory documentation of the library, since the documentation is enough for some people to learn their way around. Through the few good online tutorials and documentation I have taught myself the basics of Qt and am now ready to share my learning process with the internet so that upcoming programmers can learn from my breakthroughs and mistakes.

Prerequisites
               During the next posts pertaining to this I will cover Qt, Qt creator and all of its parts, and .deb packaging later on. Qt is absolutely required, and Qt creator is required for this tutorial since I will use information specific to that IDE, but Qt development can be done without it. The main reason I choose to write about and use Qt creator is for its GUI designer. You can download Qt creator and Qt at http://qt.nokia.com/downloads. Qt is a huge library, so be patient.

First program in depth
            There really is nothing more that you need to do once you have a working version of Qt creator. Launch it and we can begin writing the first program. Launch Qt creator and do the following: Create project > Qt Widget project (Qt GUI Application) > (name it and put it in the folder) > use default settings > Default settings > Finish.

             You should now be placed in mainwindow.cpp, where the constructor and deconstructor are defined. There should be a folder on the left side of the application called "Forms" with an arrow. Click on it and click on mainwindow.ui. This is a blank canvas of a user interface. Next, take a push button from the left and drag it onto the canvas. The button will read "PushButton". The code you write now will show you how to change this to demonstrate control over the UI. You do not have to do this since you can edit the text right from the Gui designer, but this will be an introduction to external UI control.

         Hit edit on the left hand side and you will be brought to the QML (Q markup langauge) for the user interface. Ignore this and move back go mainwindow.cpp under sources.

        The user interface is accessed with "ui->" from mainwindow.cpp, So, after the code ui->setupUi(this); we can change the text of the push button. After it, write ui and hit ".". The . will convert itself into -> and you will have a list of UI items. The entries with a blue block are Qt classes, including pushButton, which is what we want. Type p and enter to select the push button. Now, use "." again to see a list of variables and functions relating to pushButton. Use setText("text here"); to change the button to whatever you wish.

The final code should look like this: ui->setupUi(this); ui->pushButton->setText("text here");
      
       This code is executed right after the program sets itself up, so the user never sees "PushButton" on the button.

In the next tutorial I will show you how to use Signals and Slots, which are the Qt equivalent of Swing's events. You will make it so the button toggles its name on every click.

Sunday, April 8, 2012

Learning C++ after Java - My experience

As I have stated in previous posts and on the other pages of this blog, I attended a course at my community college to learn the Java programming language. Java is object oriented, allowing for inheritance, polymorphism, and encapsulation. However, after a while of programming in Java, I decided that the inefficient way that it executed would be too much of a burden when I started to write larger programs (and I was starting; one reached about 4000 lines). I began to learn another language: python. Python is a scripting language that has some of the same disadvantages of Java, so after I learned some of the key principles, I began to teach myself my first compiled language: C++.

C++ is object oriented as well. In fact, when it was first created it was called "C with classes". So, using online documentation I began to write a few simple programs in C++.

The C++ Hello World
#include <iostream>
using namespace std;
int main(){
cout << "Hello, world!"<<endl;
return 0;
}

As a reader of this article, you are probably a Java programmer interested in knowing how hard switching to C++ is. Java is designed to be similar to C++, so some may think that it is an easy transition; and it is.

Similarities
The syntax between the two languages is pretty similar. if, switch, int, double, float, short, void, etc. are all the same. This makes porting Java programs into C++ a pretty easy task. Most things that java can do without an import that are not in C++ can also be added with the #include directive. Cstdlib and boost are two other libraries that will provide enough functions to cover pretty much any usage that you will need for common tasks that you may have used in Java.


Differences
In Java, functions (methods) are called in such a fashion as class.func(arg); In C++, functions can be called that way from classes, structures, and unions, but they are commonly called by themselves, like this: func(arg). For functions following this format, it may be difficult to organize functions, which is why C++ offers class support. Also, C++ allows for pass-by-reference with pointers, and the syntax of pointers tend to really confuse newcomers (it confused be a lot. The video below really helps with them.


Also, Java includes its own graphical toolkit. In C++ a third-party library like GTK+ or Qt must be used.

It is also my opinion that no C++ IDE compares to the usefulness of a Java IDE. Eclipse and Netbeans, for example, are huge projects that make development a fun and easy task. With C++ I use Code::Blocks but many stick to vim and their compiler.
My personal experience
At first, it seemed like smooth sailing. However, when I started to do some of the more complicated things (changing parameter values in functions, for instance) I ran into some issues. Pointers were a really hard thing for me to grasp, and I could not see why they were needed. Aside from pointers and the god awful mess that seemed to be  the C++ library, it has been a surprisingly easy transition from Java to C++ and anybody looking to attempt it should have no trouble. To travel from C++ to Java, you will probably have no issues whatsoever, other than finding the equivalents to  functions in the C++ library.

Saturday, March 31, 2012

Starting off in Minecraft

For a quick change from the seriously themes posts of this blog I will take the time to write an in-depth guide to the first few days of minecraft and beyond. This will be a work in progress, so check back for updates. Information on installing minecraft or working with mods cannot be found here, so for help on those subjects consult other documentation. This is simply a guide to playing the game, and having fun.

Day 0
This is your first day of a new world (in survival, we will assume this entire tutorial is in survival mode on normal difficulty). If you spawn in an ocean, delete the level and reseed. Daytime lasts about 10 minutes, so you don't have much time to make the crucial few decisions that will govern the rest of your life in this level. Here are what those decisions should be:

What playing style do I want? If you are the type that prefers much scenery, try going for an extreme hills biome. If you prefer a solid building environment, seek out a desert. If you like to live underground, go anywhere but a desert or swamp. It is up to you to make the decision, as moving your house will be harder than just moving the blocks as you will read later on.

What resources do I need? If you like building with wood, your biome of choice should be a forest. In contrast, if you prefer a harsher living style like an igloo, seek tundra. Availability to wood is a must, but it is up to you to decide how much you will really need; 128 blocks should be all you need to start off.

Once you are decided on what playing style and resources you need, go to that area. Your first objective: punch trees.

Trees will provide you with wood, which you can drag into your 2X2 crafting square to create wooden planks. Fill the 2X2 crafting square with 1 wooden plank in each square to create a crafting table. This will give you a 3X3 crafting space. Set the table down on the ground. In case you did not know, this is called placing a block.

Now, turn half of your wooden planks into sticks by right clicking your pile and left clicking a crafting grid pile. Next, right click the sticks in the crafting grid and left click in the crafting box under the sticks. You should have nearly half-and-half. Now, hold shift and click the sticks. You will use these to craft your second item.

If you can't tell, crafting grids are confusing. From now on, I will refer to them in a battleship-esque format. The left row, reading up will be a, b, c. The bottom row reading right will be 1, 2, 3. The creation box will be referred to as 'e'.

To craft your first pickaxe, place a wooden stick at a1 and b2. Then, place wooden planks at c1, c2, and c3. Collect  the pickaxe from E and place it in your inventory. If you have no already found out, you can use a scroll wheel to scroll through your items on your hotbar. With the pickaxe, mine through the first layers of dirt (may vary depending on biome) until you encounter a gray stone. This is called stone. Mine this with the wooden plank. When mined, this block is known as cobblestone. You can hold 64 cobblestone and 64 stone, but the two do not stack with one another despite coming from the same block. Collect 3 cobblestone and return to your crafting table.

Now, use the same formula from above but replace the wooden planks with cobblestone. This will create a stone pickaxe. Stone pickaxes are what many miners prefer to use, since items will break and stone is plentiful. It is recommended that you build more tools, so go mine quite a bit more cobblestone.

Follow the formulas below to manufacture all the tools you will need.

Shovel: stick at a2 and b2, cobblestone at c2.

Sword: stick at a2, cobblestone at b2 and c2.

Axe: Stick at a2 and b2, cobblestone at c2, c1, and b1.

Shovels are used on dirt, gravel, and sand.

Swords are used on most blocks for double durability and mobs.

Axes are used on Wood, wooden planks, crafting tables, fences, beds, jukeboxes, note blocks, pistons, and anything made of wood.

Now that you can the items, mine up some of the most plentiful resource around (usually dirt) to create a makeshift home. Right click to place the blocks in a 3x3 square around you with the middle hollow. Build the walls. This will become your home for the night, unless you are experienced enough to fight. Fighting will earn you experience in both senses of the word, but is also risky and may result it death. Do it only if you have already made a sword. Wait out the 7 minute night in the dirt hut, watching the enemies walk by and slapping any spiders that ascend the walls. The hardest has past, now the real game can begin. Wait until morning when all of the mobs burn off. Fun fact: The reason that mobs burn in sunlight is the amount of light is powerful enough to do so. In theory, a strong enough artificial light could provide the same result.


Day 1
This is the first true day of minecraft. Destroy your makeshift hut and begin building your true home. Leave room for addition, however, because later in the game you will need a good amount of room. You can start by building the walls (larger, 10X10 is a good start) out of dirt, and replace it later. Your focus for this day is getting the frame of the building up.

Use your shovel to mine dirt and place it along the perimeter that you want to build on. Being at the same height is recommended, and if it is not you can destroy the higher areas inside the building later. At this time, all you need to do is make a 2 block high wall. You have more important things to worry about.

Using your shovel, dig down through dirt somewhere and into the cobblestone layer a few blocks. Now, mine the blocks with your pickaxe until you find a block with red spots in it. This is iron ore and it usually occurs in veins, so mine all of the nearby blocks and build out of the hole with the extra dirt you have, as you will need the cobblestone to build a forge.

To build a forge, you need at least 9 blocks of cobblestone and a crafting table. Place the cobblestone along the perimeter of the crafting grid to create a furnace. This should go right by your crafting table for convenience when smelting minerals. Place wood, not wooden planks, in the block below the fire symbol and the iron ore in the top to supply yourself with iron ingots. You must have at least two. Now, place them diagonal to one another on a crafting grid to create a new tool, called shears.

Shears: Leaves, wool, and harvesting wool.

Now, you must find sheep to harvest wool from. Right click the sheep with the shears to harvest wool. You will need this wool to create a bed to pass the night by.

 Personal fact: During my first few hours in the game, I thought the sheep were gorillas.

Now, head back to your home and go to your crafting table. Place the wooden planks on a1, a2, and a3 and you wool on b1, b2, and b3. Take your bed from E. You can deploy this bed in a safe place so that at night you can sleep. If you don't have a wall at least 2 blocks high, build another small hut within your home and place your bed inside of it, since monsters can jump over the 1 block high walls.

It should be nearly nighttime by now, so prepare to use your bed. If it's not, the best way to pass your time is to build the walls on your home.

The two hardest days of the game have passed. Tomorrow you will begin looking for a cave system, learn to identify minerals, and continue construction of your home. You will also learn about the different types of mobs and traps located throughout the underbelly of the world.

Day 2

From this point on, how you build you home is your own judgment. However, you will want it to be bright and have a roof or overhang. The reason is the mob mechanics, which I will talk about in this chapter.

There are 3 core mobs, zombies, skeletons, and creepers. In addition, there are endermen, ghasts, blazes, snowmen, octopi, silverfish, and slimes, but they play a lesser role.

 The zombie is the most common mob and recently underwent a large makeover in terms of artificial intelligence and difficulty to destroy. It can break wooden doors, evade dangers, and of course attack. Its attack is short ranged and you must make contact with the zombie to be attacked. The point is to attack it BEFORE it attacks you.   

Skeletons are the hardest mob and, in my opinion, they're unrealistically accurate with their bow. They launch long range attacks, so having a bow with some arrows is recommended. To make a bow, place wood at a2, b1, and c2. Now, place string from spiders at a3, b3, and c3. Arrows are made using feathers at b1, sticks at b2, and flint from granite at b3. The best strategy for besting a skeleton is to use the bow, but using a block to block attacks is also an acceptable method.

Creepers are arguably the most famous of the mobs. They blow up when you get close and WILL destroy their surroundings, so do not fight them near any of your creations or near a narrow ledge (they will destroy the ground under you, causing you to fall to your death.) Use either a bow or a running sword strike to knock them back. You can never be too careful with a creeper.

At first I thought mobs only came out at night, but that is incorrect and can sometimes become a costly mistake. Mobs spawn in darkness, so you must make your home and yard as bright as possible to prevent spawning. There have been many instances where I will walk into the main section of my home only to be met by a zombie or skeleton fire.

One of the darkest places on the world of minecraft are caves, naturally occurring underground structures where ores and other minerals are common. There are a few kinds of caves, including ravines and mining shafts, but they all pose similar threats.

Caves
You should look for an opening to a cave, which is a dark mass of stone where shadows appear at the back. This is a good place for a sub-base with mining carts and chests, but some just prefer to walk to their caves or build tunnels from their home to the cave. One of the hardest features of the caves are the sub-caves that branch into more subsystems. It is INCREDIBLY easy to get lost, so there are some strategies for navigating them.

I always place torches (which are vital, sick at a1 and coal at a2) on the right side of the cave so I know which way I came. Still, this can be confusing and I sometimes find myself walking in circles. Much like on Earth ores will deplete from mining, so after a branch has been mined dry, close it off with cobblestone completely to reduce the amount of branches from the main mine. This simplifies things greatly. Placing signs along the way is the best way to navigate, but it is incredibly costly. If you have the wood to spare, making directories is truly the best option.

The types of minerals available differ depending on your depth. When you hit f3, the y: variable will tell you your depth, with 64 being ground level and 0 being bedrock. Diamonds normally occur at about y:12, so one strategy is to try and stay that deep at all times. Iron should be your primary concern when mining, and that can occur at nearly any depth. (I've seen veins at ground level, although that's extremely uncommon.)

"Never dig straight down" is a saying in minecraft that means what it states, and I can back it up; don't do it. Digging into the unknown has lead to many costly deaths, ones where I had an abundance of diamonds that the lava or cave I fell into and died in took from me. Always dig using two blocks, using one to stand on. Also note, you will need an iron pickaxe to mine diamond and diamond to mine obsidian. Obsidian won't be important for a while.

The two structures of caves I mentioned earlier, the mining shafts and ravines, are important. Ravines are a somewhat new addition to minecraft (beta 1.8, The adventure update) and an extremely useful one. They are large gaps, sometimes up to 1000 square blocks large with two levels, stocked with minerals and subsystems. Mining shafts are structures that have an increased chance for having minerals and are the only way to find railroads naturally. They can occur within one another, and finding them is a wonderful thing so momentous that you may consider moving your home to move closer to it. In my most recent level, Sanctum, I use a single ravine as my entire mining base and I was lucky enough to find what I call a supersystem. They are common, but mastering them is an extremely lucrative practice. Supersystems are simply interconnecting ravines, mining shafts, and caves that create a large mining area. In my supersystem, I have two intersecting ravines with a mining shaft moving along the top, and EXTREMELY rare and helpful structure.

The last structures are dungeons and strongholds. A dungeon is a room made of cobblestone and mossy cobblestone. This is the only place where mossy cobblestone occurs, so mining the floor from dungeons is useful. In the center, there will be a cage with a rotating mob inside of it, and it will spawn whatever mob is shown inside of it. You CAN place torches on the spawner, and doing so is recommended since it can reduce the amount of mobs that can spawn there. Strongholds are enormous structures that contain a portal to the end, as you will read about in day 3.

When leaving a cave, you can either trace back your steps or build a staircase out of the stone. Be careful when building a staircase, though, and if you have a sign, ladder, or door place it at the bottom to stop any water you may find. Resurfacing in foreigns territory is common, which is another reason why lighting your home or building large towers is good practice.

Now that you have explored caves, it is time to worry about the rest of your life in minecraft: eating, advanced building, and interesting little tricks.

Day 3 - The last day before the rest of your lives
I have left a few things out of this guide, and day 3 is where you will worry about them. You may have discovered them yourself already, but now is when I will officially introduce them. I will talk about eating, the Nether, the End, and little building tricks.

To eat, you have to find food and hold the right mouse button, similar to drawing an arrow of a bow. Common food includes bread, fish, and mushroom soup, but I prefer fish since it's a fast-paced food for farming.

 To make bread, you must first have a hoe (sticks at b1 and b2, iron at b2 and a1) to prepare dirt and seeds from destroyed grass. Till the ground with the hoe by right clicking it, then place the seeds. This will create a wheat plant. After a few days, the wheat will be ready for harvesting (it will turn amber), so left click it and harvest the additional seeds and wheat. Bread is made using 3 wheats in one row of a crafting table.

Fish is farmed using a fishing rod (sticks at a3, b2, and c1. String at a1 and a2.) Right click it near water, and it will bob when a fish finds it. When it is raining, the chance to catch fish is increased, so make good use of the bad weather. After you catch raw fish, you should cook it on a furnace to make cooked fish.

Mushroom soup requires wooden bowls (wooden planks at a2, b1, and c2). You can harvest the juice from mooshrooms (a special type of cow found on mushroom isles) or use a crafting table to add a brown and red mushroom to the bowl. The mushrooms are found deep underground in low levels of light, but can be farmed in low-lighted areas.

There exists a special place called The Nether. Here, lava and the devilish netherrack is common. Ghasts fly in the air and launch explosive attacks against any intruders that enter the territory. Building the portal there is not straightforward, however. Using a diamond pickaxe, you need to have about 13 obsidian and a flint&steal(flint at a2, steel at b1). Place the obsidian in a 4X5 frame and light the inside on fire. When done correctly, it will begin to sparkle. Step inside and you will be transported to The Nether. In the Nether, there is an easy-to-mine rock called Netherack that will retain fire forever, so it is common in decoration. There are also nether fortresses for experience, and gold can be found here by killing the mobs.

Interesting Fact: If you make another Nether Portal in the Nether and exit through that, you will appear 8 times the distance from the original portal to the new portal in the overworld. For instance, if you made a portal at 0 in the overworld, and walked 4 feet in the nether, you will appear at 32 in the overworld.

The End is the end of the game. It involves fighting a Nether Dragon on a comet in outer space. You must collect eyes of ender from enderman to reach this place, and you must find a nether portal inside of a stronghold. Strongholds spawn a good distance from the spawn point of the level.

Various Tips - A work in Progress
These are tips that I find useful for Minecraft. I will add more to this section periodically, so check back. This part is not a tutorial, so experience is implied.

1) An automated cobblestone machine can be made using lava, water, and a flip-flop such as a rail. It will generate strings of 16 cobblestone.

2) Stairs can be placed upside-down for decoration.

3) Light penetrates stairs, but mobs cannot.

4) Grass, wood, and stone all affect the way a note block plays.

5) Velocity is not lost due to spider webs, so once you leave you will exit at the same speed you entered. (think: portals)

6) A fishing lure that bounces off of something can still catch fish. What some people do is have a "bumper box", a block of wood in the water near shore to decelerate their lure, making it land closer to them.

Sunday, March 25, 2012

10 must-have programs for gnu/linux

I have used GNU/Linux for over a year on various distributions. I have done everything from edit text, programming, gaming, emulating, and modifying the look and feel of the desktop environment. To do so, I used a variety of useful tools which I will list below.

1 - GNU C Compiler

The GNU C Compiler, or GCC for short, allows you to compile programs written in the C programming language with gcc and C++ programming languages with g++. Non-programmers will also benefit from having gcc on their system, since a lot of the software mentioned will not come in a compiled package, so you must do it yourself.

sudo apt/yum/equo install gcc

2 - Firefox

Although not specific to gnu/linux, firefox is arguably the best web browser available. Firefox is free and open source, so anybody can edit and modify it to their needs. Firefox is also built on top of the second best plugin framework around (first being Eclipse), so it is highly extensible.

sudo apt/yum/equo install firefox

3 - Terminator

sudo apt/yum/equo install terminator

On most distros, xterm is the default terminal emulator. Terminator is a new terminal emulator with much added functionality, such as terminal groups and broadcasting.

4 - The Libreoffice suite

The Libreoffice suite can be seen as the open-source version of the Microsoft office suite, allowing the user to create presentations, documents, spreadsheets, databases, and drawings. Downloads are available at their website.

www.libreoffice.com

5 -  zsh

Zsh, the Z-shell, is a replacement for BASH, the shell that is commonly found on Linux systems. Zsh brings multiple improvements to batch, especially with its advanced tab completion. Some of the attractions to zsh are its portability (since it doesn't rely on external programs), its backwards-compatibility with BASH, and the way it handles tab completion.

sudo apt/yum/equo install zsh

6 - GIMP

GIMP, the GNU Image Manipulation Program, is a photo editing program much like Photoshop. A debate continues to this day over which is better, but the fact that there is even question over which is superior is a telltale sign of GIMP's functionality. In the next major release, GIMP will become much easier to use and add additional features. That version of GIMP is available on Github right now.

sudo apt/yum/equo install gimp

7 - Avast Antivirus

Avast offers a free (gratis) antivirus program that can scan Linux systems for viruses. Although Linux is a very secure operating system, it has it's security holes. The primary usage for avast isn't for scanning your own system, but for scanning files you are planning on giving to another person.

www.avast.com

8 - vim

Vim is a text editor that runs from the command line. It is a vast improvement over its predecessor, vi, in multiple ways. It supports plugins, has syntax highlighting right out of the box, and has a more logical (and less painful) command system than emacs.

sudo apt/yum/equo install vim

8 - tint2

This program may seem trivial, but if you are using another dock such as gnome-panel or cairo-dock you may want to check this out. I used to use docky, but it was heavyweight and requires composting. Tint2, in contrast, is lightweight, simple, and attractive. It could also save you some time. Right clicking on a window will close it instead of bringing up a menu.

sudo apt/yum/equo install tint2


9 - mplayer2

Whenever I'm not doing something that requires too much concentration, I listen to music. Although, I found myself wondering why I needed a GUI to do so. mplayer2 allows you to play music and watch videos from the command line. It also supports playlists and streaming.

sudo apt/yum/equo install mplayer2 


10 - Links2

While we're still on the theme of command line applications, I must mention links2. Links2 is an improvement over links and lynx, and allows the browsing of the web through the command line. In addition to browsing, links can also handle the downloading of files. With links2 there is also an extremely fast, graphical browser that supports pictures.

sudo apt/yum/equo install links2

There are programs  I have not mentioned that I use every day, such as picasa and code::blocks, but I did not mention them since they wouldn't appeal to everybody.