Wednesday, August 31, 2011

The Future

Wow, it's happened again. There has been no posts for a great deal of time. Sorry.

This month marks the 2 year anniversary of the creation of GuysOnFOSS. We've done quite a bit in the two years including reviews, podcasts, rants, etc. I, for one, have enjoyed the process immensely.

I'd like to take a moment to talk about the future. The next year I expect will be hectic, as the majority of the writers are moving onward and upward. In September, most of us will be entering university. There may be little time for blogging in the upcoming months. In university, the whole team will be studying subjects related to the topics relevant to this blog. I can see this transition going two ways. Either the blog slowly falls into oblivion, only to be spoken of at Christmas and Summer breaks; or it keeps going, hopefully with a new perspective that will be born from the new found knowledge that we'll [hopefully] obtain through our next level of education and beyond. I'm rooting for option 2, but the best we can do is take this one week at a time.

Thanks,

-The Thoth-

Friday, May 13, 2011

An Introduction to Threading and Multi-core Processors

An Introduction to Threading and Multi-core Processors


With the increasing popularity of multi-core processors, most people imagine that all their programs will run much faster. While this is true, it is not always the case. Sure, the operating system boots up faster, but what about Firefox, or Blender? Some people have noticed they just stay the same speed. So why do these programs run so slowly on such a “fast” processor?

The answer to this question lies in threads. So what is a thread? One can think of a thread as a lightweight process, where it can execute in a process and access the process’s resources, along with sharing information with other of its kin. Seems a bit bizarre? Do not fear, threads are quite simple to understand when you put them in an analogy. Imagine a room. In this room, there is only a filing cabinet will all the documents employees of Department A need to process. Joe, our hard-working employee works in this office, which all people of Department A share. Now, Joe’s office has a small problem - it is missing an essential piece of furniture: a desk. Without it, Joe has nowhere to place any of his work. Not to worry, the company did ensure that Joe the employee can work. So they ordered a desk. Unfortunately, they were a bit low on budget and could only afford one desk, so all the employees must share this one table. Problem is, the desk is so small that only one person can work on it. This means while Joe is filling out paperwork, Alice, an employee from a different department, must wait until Joe is finished. This may seem like it is very unproductive (and it is), but it gets worse. By a company policy, employees can only work on 10 documents during one session at the desk so other employees can use the desk too. This makes their work time slower as more people line up to use the desk if they have more than 10 documents, as they need to make trips back to the . Joe often needs to work on hundreds of documents. To increase the efficiency of his department The obvious solution is to hire another employee, and put him in the same department as Joe. So the company hires Steve and places him in Department A. Joe can then give half his work to Steve and he can wait behind Joe and as soon as Joe is finished working on 10 documents, Steve can jump to the table while Joe returns the end of the line. By employing another worker, the Department is performing faster. This technique is called multi-threading in programming.

In this analogy, Joe and Steve are threads (employees) of the same process (Department A). They can both access the documents (instructions) in their room and also work at the same pace. Now Alice who works in Department B is a thread in a different process and she can only get documents from her department. This is how processes work. Threads of one process can only access instructions and data from the process in which they were created.

Now back at the office, the Board of Directors thought it would be a good idea to increase productivity. The next day, all the employees walked into the workplace for a surprise: the company is now the proud owner of two desks. Now any of the employees can work at 2 times the efficiency. Now, to the board of directors, they had expected all the work to be done in half the time. Why was it that Alice’s department, Department B still worked at the same speed as it did before the second desk. The answer is that there is still only one employee in Department B and regardless of how many free desks, Alice can only work so fast. So single threaded applications such as Firefox are like Alice, where there is only one employee who needs to share the desk without sharing the work. This fact makes them unable to use the additional core as efficient as other programs such as Apophysis (a Fractal Renderer) that have multi-threading capabilities.

In this scenario, adding another desk is equivalent to adding an additional core to the processor. This is where you get dual core processors from Intel and AMD. This covers the basic theory of threads. This is also where I am going to finish of this article. Of course, being a introduction, it does not cover some of the more advanced topics such as:

Hyper-Threading - Where the workers literally share the desk by drawing a line down the middle and have two people work on it at the same time
Process Isolation - If there is a murder in Department A, Alice from Department B does not need to know about it.
Deadlocks - Steve is waiting for Joe to give him some data so he can finish his work but Joe is waiting on Steve to give himself data so he can give Steve the data he needs.



So if you want to know more about them, Wikipedia is a great resource. Cheers!

Wednesday, May 4, 2011

Beginning to code

Are all your friends are programming making you feel left out? Do you think that all those things that you use online can be made better? Have you ever complained that a game could be so much better if they just changed that level? Fear not! The power of programming will solve all those problems! Or will they?

Many of the representations of coding scare or fool many non-programmers. Being a programmer myself, it is easy for me to say that scenes of sitting in front of a terminal with flowing text (See hackertyper for reference). This is by far the most common view I have heard of whilst mingling with normal folk. To know the true experience of programming, one must sit down and start learning. Yet, the beginning programmer faces another hurdle. The world of programming has many languages to choose from, each with its strengths and weaknesses. The most common languages is C and C++, with the majority of all programs and operating systems written using them. While it is the most common, don’t get fooled into thinking that you must learn them first, or even at all. Of course, there must be a reason for the advocacy of C and C++, otherwise, why do so many use it. The first step to programming is picking the right language for the job. An in depth article on picking a programming language will be covered in a future post, as I intend this article as a primer to programming.

Before you start on programming, you should think about how you will see programming and what to expect. You may be programming as a hobby, or you may be stepping into the world of the computer industry. These two different views will affect how you program. A professional programmer will spend much more time, and will usually have more resources than a hobbyist. This leads into the next topic: Your Environment. All programmers have usually have a specific environment they like to work in. The most common environment is the Integrated Development Environment (IDE), which is a pre-made set of software where all the development can be done within a window. Others may like a text editor only, or even just cat and append. Consideration of these elements of programming is very important to the beginning programmer, as it will help with learning the language and make the development smooth.

So, what next? There are many paths that one can take when programming. The main branch is software vs web programming, and each of those split into smaller sub-branches. It is up to you to pick where to go next. It can be developing a website or making a game. As a final not, I encourage you not to stick to only one type of programming, play around with different styles and methods. Learning and programming in narrow views is limiting the amount of work you do. Read what others say, try new concepts. All of it will be helpful to you, and last but not least, enjoy yourself. Remember: more than once a programmer’s problem is resolved by an epiphany overnight.

Saturday, April 23, 2011

Vim vi vim

Text editing is a common task many Linux users do day to day. Gedit, Kate, Kwrite - they are all programs which assist us in changing configuration files, or just taking notes. While today’s systems orient around newfangled graphical interfaces with mouse support, fancy sounds, and (not so) nice assistants, some have forgotten about the good old editors which were one of the foundations of the Linux OS. Before the GUI, text editors existed on the command line. Now, newer Linux users who have seldom used the terminal interface are dwarfed by the mighty command line interface and step back from using anything which has a black background with green text. While on first glance it may be scary, users of CLI based editors will tell you that it is not, and while there may be new material to learn, the result could mean efficiency and time saved for other work.

This article investigates one of the most popular editors for the CLI: Vim. This editor is distubited with most Linux distros. Created by Bram Moolnaar in 1991 for the Amiga (Yup, its that old), it was an improved version of an earlier editor, vi, hence the name Vi IMproved (which is shortened to vim). Vi, created by Bill Joy was an improvement on ex, an even older editor. Now over the generations, these tools were created to increase efficiency for text editing. Vim is no exception to this philosophy and encourages it as one of its goals.

Vim and Vi are based on a mode system. Depending on how you write and code, you may be in either insert or normal mode for the majority of your session. These modes are what throws some people off, simply because the keys they hammer away don’t appear on screen. One of the first things a vi user learns is the insert mode. In this mode, you are able to type into the document itself (which is what a text editor is supposed to do, right?) The other mode is normal mode. Now at this point, you may be thinking “Why do I need another mode when you just told me that insert mode does what I want it to do?”. This second mode is quite important for efficiency in coding, and also allows you to save the text to the drive. The rationale behind the different modes is for faster processing of the work. A user is able to get into insert mode a number of ways. To name a few, by pressing o,O, a, A, i and I, the user is placed into insert mode. The different keys and their uppercase counterpart have different functions though. While all of them put you into insert mode, they place the cursor in different locations. O and o opens a new line above and below the current position respectively. I inserts places the cursor at the beginning of the line, while i has the cursor insert before the character. A appends the line, placing the cursor at the end of the line while a puts it after the current character.

There are many commands to learn before a user is able to code faster than the average non-vi user, but don’t let new knowledge push you back. All the commands do something slightly different and can mean moving to another location in the document or perform macros. The keys which are mapped to commands are also smartly located. The more often the command is used, the closer the key is to the home row (on QWERTY keyboards). This reduces the time needed to move and insert text. Don’t believe me? Go onto Youtube and search Vi or Vim, many of the videos shown are not in time lapse, the users are merely using the full power of Vim.
With all this said, I encourage you to go out and try Vim. Much of my coding is done within this spectacular program and I have noticed an increase in the speed of my coding. Have fun with it too, forcing yourself to learn the complete dictionary of commands extremely hard in one day. If you don’t know where to start, vimtutor (just type that in) is a interactive tutorial which will bring the user up to the basics of Vim. Now, as a final note to the reader: Watch out for those sneaky EMACS users, they will try to convert you to the dark side...

Friday, February 25, 2011

LaTeX Part 1 - History

Throughout history there have been people who identify a problem, and instead of idly accepting the situation, they produce a solution. These are people like Henry Ford who noticed the inefficiency of automobile production and invented the assembly line, a standard in modern manufacturing. Or perhaps we consider Bette Nesmith Graham, painter and more importantly white out inventor. She saw a common problem and instead of just chucking out entire sheets of typing she set out to fix the problem. Often these innovators do not realize the full potential of their solution to one problem. Who doesn't have a can or two of WD-40 in their house? This was originally a product to solve a specific space related problem, but it is now used on everything from zippers to distributer caps.
There is another case in which a project was designed due to solve a daily irritation which took off quite dramatically. Of course I am talking about the subject of this article: TeX and more specifically LaTeX.


To understand where LaTeX came from we must first examine it's foundation, TeX (pronounced tɛk). TeX was invented by a man by the name of Donald E. Knuth. Donald was growing frustrated with the current typesetting practices in the 70's. In fact his own book, The Art of Computer Programming, was re-pu
blished in the 70's he found the typesetting to be hideous. A few months later Knuth decided that he would not accept the situation idly and set out to produce TeX. The project was started in 1977 and Knuth
predicted that he'd be able to finish it in one year. His estimate was off by about 10 years.

However, Knuth's system did not really take off until the invention of a macro package called LaTeX. LaTeX was invented by a man named Lamport as a way for the user to concentrate on the writing instead of the formatting. Think C instead of Assembly. Today if you were to start writing a book in TeX, you'd most likely use LaTeX. It does a bunch of automatic formatting by section, chapter, etc. in order to make the document as readable as possible. This system really lets the author focus on the content, and then make stylistic changes later.

Next article: Plain TeX vs LaTeX

Very Useful Links:
Wiki pages: LaTeX TeX

-The Thoth-

Wednesday, February 16, 2011

A Minecraft diary thing

So i've been gone awhile and the Thoth has been bugging me to do some posting so ill be doing a day by day type thing of Minecraft. Similar to what PC gamer is but im doing this on my server which about half of the blog team plays. Those who do play are me Inerg, Crazy2be and Mekapedia and then the odd friend that does join. Any who here goes for day 1.
So the first thing I would like to state is that I started this in a world were me and
Crazy2be
created a house like thing already. I'll do a walk through it sometime later maybe day 3 any
ways. Lastly the reason why I have glow stone is due to a mod that lets us set spawn rates so we set stone to have a .05% chance of dropping glow stone since you cant get it in multiplayer.

So I started off my day deciding ill go and look in Crazy2be's collecting hole thing to come across this.


Luckily for me the 2 creepers got caught on each other and couldn't walk up the stairs so I was able to easily dispatch them with my bow. Also to any readers who play on server I highly suggest using a bow as a weapon as the combat system is pretty rough if you try and stab your enemies.

Any ways later in my day I decided to go and look in a cave that I had found earlier that was huge. So as I was exploring this cave I found this.

Due to issues with the images I'm making them links for now.

Thats right a single yellow flower cooking by some lava. This is the first time I've found a flower underground or even so close to lava so I decided to include it in my daily log. Lastly in my adventures in the cave I came across this.


Its not the easiest to see sadly and I wasn't able to disable my HUD do to being in combat but it was a worthy shot :). Its a picture were I had three skeletons and a zombie after luckily for me a Skeleton shot one of the zombies so I got to have a bit of a easier time killing them :). Actually that was the last I forgot to add I was working on a cart system as well.

Due to issues with the images I'm making them links for now.

And heres what I ended my day with creating a cart system to transport goods up and down from our mine. It didn't work great but I improved it on day 2 after Crazy2be broke it.


As a final not I would like to suggest that you at least try this game in single or multiplayer although I got really hooked once I started on multiplayer. Also Blogger get a better damn way to handle images while I can edit the HTML for placing them make it so that I don't I like being lazy :(. Also OH GOD THE PICTURES THEY RUIN EVERYTHING! I'll try and figure a way to make them small clickable links. Well for now I'm going to make them links later on ill make them better.

Friday, February 11, 2011

LibreOffice History

Wow Ladies and Gentlemen, it has been far too long. I doesn't seem like a month ago since I last posted. Anyways, the show must go on.

What have the GuysOnFOSS been up to lately? Not too much actually. Individual projects rumble onwards, and the new semester has brought more schoolwork... For most of us.

Recently I switched my office suite from OpenOffice to LibreOffice. Our readers will probably be familiar with the course of events which prompted the creation of LibreOffice, but if you missed it I will reiterate it here:

Sun Microsystems was the company which owned OpenOffice and it's closed source sibling StarOffice. When the data base giant Oracle purchased Sun Microsystems, they also acquired StarOffice and OpenOffice, as well as OpenSolaris. OpenSolaris was killed and many feared that OpenOffice was going the same way. Fans of Sun were horrified. Oracle published this to the Sun Facebook page:
Hi, everyone! Just a quick heads-up: Now that the acquisition has gone through, we will be phasing out the Sun Facebook page over the coming weeks. Please join the official Oracle Facebook page to stay on top of Oracle/Sun-related news, connect with peers etc. Thanks!
Not surprisingly the comments went mostly like this:
"Do not want." -Jeff Dudley

"Im not joining Oracle anything... Sun Rulez. Oracle Sucks." -Anthony ' Alby' Williams

"PLEASE dont kill that name an Logo!! PLEASE!!!!! Im devasteted, its actually a part of my life just disappearing.Please!!!For have many years havent I stared at the beatiful blues and greys of SUN? Many! It allways felt so comforting, and now? BOOOOOOOOOOOOOOOOOOO! -Magnus Nystrom

The feeling of impending doom was so strong that several devs started "The Document Foundation" built from the code of OpenOffice. Origonally the plan was to include Oracle in the new buisness by contributing code back; however, Oracle wanted nothing to do with it and threatened to fire the devs. 33 devs left Oracle and in September 2010, LibreOffice was born.

Thats the story, it's a relevantly old story, but hey, we haven't posted in a couple months so just pretend we posted this in January and you missed it. Next time I'll go into what I've found so far with LibreOffice.

Until then,

-The Thoth-