Wednesday, August 29, 2007

Word Processing (with Latex) in the Command Line

In my never-ending quest to prove that you can do anything in the CLI that you can do in a GUI, this is my attempt at word processing in the command line. There is no true word processor for the CLI, that I'm aware of, but the results of using the Latex typesetting language create a good enough end result. If your not familiar with Latex typesetting language, you can sort of compare it too html markup language. With Latex you use code to assign your document layout, font type, font size and other document characteristics. A skilled Latex artist can create absolutely beautiful, high quality and professional documents.

In the GUI, I'd recommend using Lyx a great WYSIWYG Latex editor, but we're in CLI land here so we'll be using vim-latexsuite a fantastic plug-in to a brillant text editor. In Ubuntu, just 'sudo apt-get install vim-latexsuite' and you are good as gold. The vim-latex-suite has a very in-depth guide built-in. You can access the guide once in vim by typing:
:h latex-suite

This blog will walk you through creating a simple document and serve as just an introduction to the vim-latex-suite. For more a more comprehensive explanation of the latex-suite please see the guide mentioned above.

Open a vim session by typing:
vim texdoc.tex

Now press the 'i' key to change vim to 'insert mode' and type or copy the following into vim:

\documentclass[12pt]{article}\title{My First \LaTeX{} Document!}
\author{Jared Bernard}
\date{December 25 2010}
\begin{document}
\maketitle Ubuntu is my favorite Linux distribution of all time! I can do anything in the CLI that you can do in a GUI plus more. So there..... (sticks tongue out at GUI).
\end{document}

Everything that starts with a '\' is what defines the format of the document. Here is a basic description of what we just created.

  • This document is an article, using a 12 pt font. (There are several types of document classes. 'report' is another common class.)
  • the Title of this document is 'My First Latex Document!'
  • Its author is Jared Bernard. (me)
  • It was written in December 25 2010.
  • Everything else is the content of the document

Now that we know what we created, press the 'esc' key to change to 'normal mode' in vim. Then type ':w' (w/o quotes) to save the document.

Now here comes the fun part, HOLD down the '\' key while pressing the 'l' (el) key twice. This is described in the vim-latex-suite guide (mentioned at the beginning of this blog) as \ll. This will compile the .tex document. If your typeset language has mistakes you will see an error message at the bottom of vim session. If this occurs verify that your typeset language is exactly as the example given and make the appropriate changes. Otherwise, if everything worked out well, you should see no evidence of anything happening :).

Now exit vim, by typing:
:wq

Now that you are at the command line type:
ls

You should now see some new files that where created, texdoc.aux, texdoc.dvi, texdoc.log and of course texdoc.tex. These are your data files for your new document. The .dvi file is your main latex file. There are several ways to view your newly created document, but first you must install some CLI .dvi viewers. Type 'sudo apt-get install dvi2tty dvifb dvipng fbi' to install the viewers which are discussed below.

The first way is using dvi2tty, so type:
dvi2tty texdoc.dvi

This is not my preferred way to view your document as the formatting isn't always accurately displayed, but is does give you a quick look at what you have just created without the typeset language.

A Better option to view your document is using dvifb. To view, type:
dvifb texdoc.dvi

Isn't that beautiful! :) If you copied the typeset exactly as I have it you will notice the word 'Latex' in the title and the unique format I designed for it. You can see the difference as it's displayed with dvi2tty compared to dvifb.

You can also convert your .dvi file to a png image, by typing:
dvipng texdoc.dvi

This will create a file named 'texdoc.png'. You can view this image using fbi by typing:
fbi texdoc.png

Now that's great, but what if I want to email my document to my gui-loving and windows-loving friends? How can they view my new beautiful document. They should have no problem viewing your newly created .dvi file using any pdf viewer like xpdf or Adobe's Acrobat Reader or viewing the .png file in any image viewer.
If you need to make changes to your document, just open the original .tex file and make the necessary changes, save the document, compile the document using the \ll command and you should be good to go.

Let me know what you think. If there is ANYTHING you thought couldn't be done on the Command Line that can be done on the GUI, let me know. I'll try to figure it out and blog about it.

Friday, August 24, 2007

The Non-Programmer's Contributions.

The extent of my programming are some basic shell scripts, which I'm very proud of, but doesn't classify me as a hacker. Times are changing. Linux is becoming more popular and as a result the community is seeing more and more average computer users joining its ranks. As these new Linux and open source users become more familiar with the community, hopefully they will have a desire to give back. But how does a non-programmer contribute to the community which seems to be filled with programmers and system admins? I'm an accountant, am I expected to learn code to not feel like a moocher? Of course not!

Here are some ways to contribute to Linux and open sources without having a computer engineering degree.

1) Promote Linux and open source.
  • Tell your friends, co-workers and family about Linux and OSS. If they are not ready for a full OS conversion, tell them about some of the great OSS projects out there for windows, such as, Firefox, Thunderbird, Gaim, Audacity, etc.
  • Give out liveCDs. Ubuntu will even send you free CDs.
  • Offer to help install Linux on their computer.

2) Donate money to OSS projects. Many of their websites offer ways to donate.

3) Help others. Even if you still consider yourself a newbie, I can guarantee that there is someone else out there who is struggling with a problem or issue you've once faced. You can help answer questions or just offer suggestions in the following ways:

  • Forums. Visit your distributions forum. Many OSS projects also have their own forums. Help answer questions.
  • Attend installfests. Usually your local user groups put these on. Help some install Linux.
  • Jump on an IRC channel. User groups, distributions and various projects all have IRC channels where discussions and questions are asked constantly.

4) Help with documentation. Documentation is never-ending. Find a project you feel passionate about and assist in writing readme's, how-to's, tutorials, wiki entries, help guides, etc. Contact the project leader and tell him you would like to help. If you are bilingual help with translating documentation into another language.

5) Test for bugs. Learn how to properly report bugs. Download and use alpha, beta and release candidates of projects. If you don't have an extra system to test on, use one of the many virtual machines out there to test so you don't foul up your main system. Be specific so those working on the projects can have all the information they need to solve the problem.

6) Finally, continue to learn. The OSS community is fast-paced and is changing all the time. New projects pop up daily. The more you learn the more you can help others.

The Linux and open source community is non-discriminatory. Everyone is welcome. So now there are no more excuses. Get out there and help out. :)

Thursday, August 23, 2007

My Affair with Ubuntu

My first experience with Linux was Red Hat 7.0. At the time I didn't really know anything else existed, in my eye Red Hat was Linux. Two things were frustrating for me during these early exploration days, no automounting and installing applications. For the life of me I couldn't access my CD-ROM or floppy drive and the mount command was confusing to me. Installing applications beyond what was available on the Red Hat CDs wasn't going to happen. At the time, I dual booted Red Hat and Windows 98. Spending most of my time in Windows and occassionally experiementing in Linux.

It didn't take me long to discover that there was more out there then Red Hat. Mandrake (now Mandriva) caught my eye early on, so I installed 8.0 and I felt much more comfortable with Linux. When I stuck a CD-ROM in my drive, an icon appeared on the desktop which allowed me to easily access and view all the data on the CD. Though I could still only install applications from the Mandrake CDs, it seemed to me at the time that Mandrake had a sufficently large repository of applications, more so than Red Hat.

I stayed with Mandrake for a long time, up to ver 10.2. During this time, my distaste for Windows grew and I became more and more relaxed with Linux. Linux in general seemed to mature quickly. It was like riding a rollercoaster, I loved it. I eventually removed my Windows partition and was ready for Linux full time.

After Mandrake, I tried several other distros and had significant affairs with Suse, Mepis and PCLinuxOS. They all seemed like the ideal distro for me in the beginning, but like most flirtations, the honeymoon ended quickly. Now don't get me wrong, these distributions are great, I would still recommend these to any new Linux user, but "challenges" seemed to crop up slowly which caused me to divert my attention elsewhere. Suse's YaST was slow and at the time they didn't seem to support particular and necessary formats such as mp3's and encrypted DVDs. Mepis came along and satisfied my urges with multimedia, which at the time was like a passionate romp in the hay and had me declaring it the "Perfect Distro". Mp3's and encrypted DVDs were no problem and it was my first experience with apt-get (synaptic) which made my legs quiver. But the starry-eyed lover lost me when updates began breaking my system and no one messes with my system. PCLinuxOS had longer legs then Mepis and looked sexy in a mini-skirt. PCLinuxOS made my bones melt. Everything lacking in every other distro I tried, PCLinuxOS had and more. I'll admit that my break up with PCLinuxOS was for very petty reasons. Texstar is awesome, but he's one guy I wanted some of the lastest and greatest packages and I wanted them now. Texstar tried but he just couldn't put out.

I tried for a long time to ignore the harlot Ubuntu. I gave into the pressure and found a motel for that South Africian seductress and we did the unmentionable and I liked IT. Yeah, that sudo thing is annoying but Ubuntu is hot and I quickly got use to it. She's stable, she plays with the lastest and greatest and her community assets are HUGE. There are documents, helps, wikis, books and more. I've been riding Ubuntu for just over a year now and I have to say, anytime I've needed help, there has been a tutorial, how-to or help giving me step by step instructions everytime. The instructions have been specific, easy to follow and worked every time and I do some freaky things.

My eyes have yet to wander from Ubuntu. Nothing else seems to attract me. Ubuntu satisfies me like no other distro has. I see a long and happy relationship here, in fact there maybe a bun in the oven developing. I'm working on a specialized distro based on Ubuntu-server. More to come on that.

Wednesday, August 22, 2007

Amazing Photo Resize Technology

This is incredible! Technology to resize a photo not necessarily to scale but having no distortion. Watch the video to get a better understanding.

http://www.youtube.com/watch?v=6NcIJXTlugc

Monday, August 20, 2007

Some Random Links

Here is a great rant for those who don't give Linux a fair shake.
http://kmandla.wordpress.com/2007/08/20/howto-leave-ubuntu/

And free 'Free Software' stickers. Enjoy!
http://raro.oreto.inf-cr.uclm.es/apps/stickers/

50 Reasons (but not all valid)

This is my response to a blog titled '50 Reason to Dump Windows' which can be found here:
http://www.linuxhaxor.net/2007/08/13/50-reasons-to-dump-windows/

Below is the list with my comments, (I'm a Linux advocate, but I'll try to be fair):

Windows is Expensive.
-Definitely a true statement.

Windows crashes more often than Linux ever will. (Windows BSOD) (Linux Kernel Panic).
-Maybe, I haven't seen significant proof of the this, but I do think that Linux is easier to recover from a crash than Windows.

Windows Task manager is not half as cool as Linux Htop.
-Htop is pretty cool.

Windows Notepad is not 1/1000th as cool as linux vi.
-Note: they do develop vi for Windows.

Microsoft office for windows is not free. Openoffice, which was originally developed for *nix platform is free on all platforms that it supports.
-ok.

Windows Terminal vs Linux Terminal. No comments, see for yourself what you can do.
-Very true!

Windows is not friendly towards Linux installations on a separate partition.
-True, but how is this relevant. Windows user could care less. This is a reason 'Not to use Windows?'

The release of Windows Vista comes more than five years after the introduction of its predecessor, Windows XP, making it the longest time span between two releases of Microsoft Windows.
-ummmmm?

Internet Explorer is prone to vulnerabilities more than any other mainstream web browser.
-Note: They do make other browsers that run on Windows. This may be a reason not to use IE.

Microsoft Windows still looks the same. (95 98 2000 2003 XP Vista Longhorn).
-No more different then different version of KDE or GNOME or other.

Windows in owned by profit hungry corporation with little hope of innovation.
-Profit Hungry.. yes. Is that necessarily bad... no. The way they conduct business...yeah, pretty bad. Microsoft not innovative...true. I believe the open source model does provide a greater opportunity for more innovation, but I think Apple has been fairly innovative, not following the OS model.

Linux is for people by people.
-Yes.

It is legal to share linux, not so with windows.
-Yes

Linux is not tied down by one look, like windows, you can choose several looks; ie, KDE, GNOME, fluxbox. To name a few.
-There are other desktops and Window Managers for Windows but not very common or reliable.

Linux hardware requirement is so minimum you can run most current popular linux distro on a ten year old hardware, try that with windows vista.
-Yes, but not with current versions of KDE or GNOME. Less user friendly WM's like Fluxbox, Windows Maker, etc.... sure.

Viruses are few and far between.
-As far as I know, ZERO 'in the wild' viruses.

Linux faces open standard unlike windows, and so a system update won’t make any programs or systems obsolete.
-What are you talking about?

Linux can be configured by the user.
-What!? Very limited as it should be.

Linux can be customized by the user.
-What!? Very limited as it should be.

Linux can be built from scratch by the user, (if you are programmer and know how to).
-You don't even need to be a programmer. Linux from Stratch and others.

Linux doesn’t hog system in default installation like windows do.
-ummmmm?

Linux gives you the freedom to choose application/hardware unlike windows.
-What!? You can't chose what application or hardware to use in Windows? That's new to me.

Most top linux distros are updated every six months.
-Some.

High quality support are available for free online, in the form of HOWTOs, forum, e-books, wikis.
-Yeah, they have the samething for Windows, but the community is definitely more informed.

Support of linux won’t be discontinued, like windows 98 in not supported by Microsoft anymore.
-Older versions of Linux are not supported.

*nix has been around for more than 35 years, and is well tested and as secure as possible.
-This could get ugly because I know how some feel about this. LINUX IS NOT UNIX! I some might disagree and that's your right.

No licensing fees for linux.
-Yep!

Linux is more secure.
-YES! Definitely.

You won’t have to upgrade your computer hardware in order to switch to the newer version of linux.
-True.

Linux is capable of operating on a wide variety of platforms (i.e., processor and system types), rather than just being limited to Intel-compatible processors and computers.
-True. :)

Government security agencies use Linux over windows; SElinux is an example of dedication towards Linux.
-ok

Linux doesn’t have Backdoors like windows do.
-Anything can be hacked, Unless it's unplugged, bury 20 feet in the ground and covered in cement.. then maybe.

Development and popularity on linux platform encourages competition and perhaps whatever innovation that window has.
-ok

Linux doesn’t need to defragment HD.
-Windows XP and Vista, don't really require this.

Ext3 and other linux file system is better than ntfs.
-I agree.

Google runs on Linux, there is a reason for that. Think.
-Think. Google may not be the ideal model.

Apache on linux hosts more websites than IIS on windows.
- Yeah, unfortunately IIS is still gaining in market share. Apache can run on Windows also. Is this 50 reasons to use Apache?

Apache is more secure than IIS.
-Yes. Apache can run on Windows also. Is this 50 reasons to use Apache?

Firefox is far more advanced/secure than Microsoft IE. Even though you can run Firefox in windows it doesn’t provide the secure platform that linux provides and are open to attacks/exploits that firefox on linux aren’t.
-ummmmmm?

Linux has superior network and system management.
-Sure

Linux is also supported by IBM, HP, Novell.
-Ok. Novell also support Microsoft.

Linux is reliable.
-Yep.

Linux doesn’t discourage running virtual machine like windows.
-?????? VMware?

Linux is the de-facto OS for security forensics.
-I don't know anything about that.

There is a reason why Apple switched to *nix; OSX is the defining example of what you can do with *nix. It has reached such a point that Microsoft is copying ideas from apple/OSX, again.
-One more time. LINUX IS NOT UNIX! geez! I'm ok. Though that was a good move on Apple's part.

There is no “service packs”. There are updates.
-ok.

If you think Linux doesn’t provide eye candy like windows does, think again. Two words, Beryl and Compiz!!!
-Linux eye candy is way better, man.

There is nothing you can do in windows that you can’t do in linux, not the other way around.
-I agree. It may not be easier, but true.

If you are stuck with the looks of windows you can switch to linux and still use the same looks. ie, Linspire.
-yeah, but why? I've seen a way to make Windows look like Ubuntu.

Last but not least. Linux is FREE.
-True, as in Freedom right?

Sunday, August 19, 2007

Why I Linux!

This is my first blog of soon to be many. I need to let you know that I'm a Linux fanatic! I love Linux and I want to be a promoter of Linux. So let me begin with an explanation of what Linux is and why I use it.

Linux is an operating system. An operating system is the environment you use on a computer to run programs. Microsoft Windows is the most popular operating system used on computers. Apple's OS X is another well known operating system and there are others. Linux is one as well. Within an operating system you can run your Internet browser to view the web, or run a word processor to type a letter.

Six 1/2 years ago was the first time I realized that there were other operating systems besides those offered by Microsoft and Apple. My life has never been the same.

The reason I use Linux is because I treasure my freedom in every aspect of my life. Linux is free, not just as in, you don't pay a dime for it, but it's free as in freedom. You are not free using Microsoft and Apple. What makes Linux freedom is it's license. Microsoft's and Apple's licenses are restricting. When you buy Windows or OS X you do not own it, you just pay Microsoft and Apple money to use it in the way they dictate it. Meaning you can not share it with anyone, you don't have a right to do so. You are tied to the way they set it up and structure the operating system. If you don't like the way something works or is designed, live with it. You have NO option. Remember you don't own it!

Let's compare this to a car. If you bought a car and it was licensed in a similar way as Microsoft Windows, you would not own it. Yes, you paid a lot of money to rent it essentially. You couldn't fix it up and resell it to make more money on your investment because Microsoft restricted it in their agreement with you. They do this because they feel your improving on their product is taking money away from them. Remember you don't own it. You're stuck with it as is. You can not add a new muffler, rims or decide to make it into a convertible. If you do you're in trouble. Say you don't buy a car to customize it for your own needs, you just use it to get from point 'A' to point 'B', but you've had the car for 10 years now and it's been good to you, so you want to sell it, make a few bucks and buy a new one. Sorry you can't you have to throw it way. You're not allowed to sell it and they encourage you to 'lease' a new car from them again. You can only lease, never buy.

If you're not willing to use a car under these conditions, why use your computer under these conditions?

Linux is freedom because it is open source which means the programming code is available to everyone to view and change. It can be customized to your own needs. Linux provides a community that encourages you to improve upon it, copy it and share it. For a long time I didn't understand this because, I'm not a programmer, I can't change the code of the software. But there are thousands of programmer out there in the world who contribute to Linux who have customized Linux hundreds of ways and I can guarantee you that one fits you. Plus you can contribute in others ways (which I will discuss at another time).

So instead of having to choose a 'one size fits all' operating system, you can find one that fits your needs, tastes, and likes, so it feels as comfortable as a good pair of jeans. http://www.distowatch.com is a great resource to 'shop' for the perfect fit.

Before I close, let me say this, Windows is not a bad operating system and maybe it does fit your needs. There are advantages and disadvantages to each operating system mentioned here. The biggest disadvantage for me in using Windows is it's restrictions. Restrictions I never really noticed until I started using Linux. Also, beware Microsoft and those 'geeks' who love it, may tell you things about Linux which are not true. I urge you to find out for yourself the truth.

As for now, I've gone on long enough, more to come, but I hope this helps explain... why I Linux.