sontek ( John M. Anderson )

June 30, 2008

Windows Hater (in response to Linux Hater)

Filed under: Uncategorized, Windows — Tags: — sontek @ 11:59 pm

So I’ve become a huge fan of Linux Haters blog because he makes some very valid points about Linux and the open source community in general and it got me thinking of why I moved from Windows to Linux in the first place.

Picture this, you just bought built a brand new computer and want to install the brand spankin’ new Windows Vista Ultimate, you plop down $300, and away you go! What does $300 get you? A bare minimum operating system with nothing but MS Paint and Media Player.

So you spend the next 45 minutes installing your bare minimum operating system, it takes 45 minutes because the initial install is 15gb, so by bare minimum I mean feature set, not file size. So after you get installed you try to use the Internet and realize that it didn’t detect any of your hardware (video, audio, network), so you spend the next 2 hours spidering through multiple vendor’s websites who all have their downloads/driver section in different areas.

Now you have all your drivers downloaded, you go to install them to find out that the majority of the installers only extracted the files to your disk, they didn’t install them, the installer did not tell you they were only extracting, nor did they tell you where they were extracting them to. So after searching your disk and finding the extracted files you go into the folder to figure out what needs to be done to install them, but that is a waste of time since the vendor didn’t feel the need to write a README file. Being the genius that you are, you right click on My Computer -> Hardware -> Device Manager (because that was an intuitive place to look, thats the first place I thought of going to install drivers!) and now you are prompted with a dialog with a list of “Unkown Device” with little exclamation point next them. What to do? Easy! You right click on it, go to properties -> details and look at the very intuitive and easy to read string “PCI/VEN_1002&DEV_AA08&SUBSYS_AA081545&REV_00\4&1245FE7B&0&0108″ and go to http://pciids.sf.net and search for each device so you can figure out what driver to install for it.

After you have all your device drivers installed and can utilize all your hardware, you’ll want to go to Windows Update to make sure your computer is completely secure. You run the first batch of updates and it asks you to reboot, when it comes back up it doesn’t tell you all your updates weren’t finished, but using your spidey sense, you know that couldn’t have been all! So you go back to windows update to find a whole mess of updates waiting for you, these ones will also ask you to reboot (and so will the next 3 or 4 groups of updates). Rebooting is good for your new system, gets it warmed up.

4 reboots and 230 updates later you decide you would like to edit some family photos for your Christmas postcards–no problem-Vista comes with the all powerful MS Paint, which can do everything you’d ever want to do, just check out what this guy did with it: MS Paint Skills!.

Editing family photos was fun but now you would like to add everyones birthday to your calendar and setup some re-occurring tasks to remind you to take out the trash and pay bills on time, but you’ll soon have shut off notices and piled high garbage because there is no default calendaring program in Windows! But your boss will save the day, he just called and needs your latest TPS Report so you need go to open up your spreadsheet but you find out there is no spreadsheet program either, so you hike down to your local computer shop and plop down $300 for the office suite with the added benefit of having outlook (yay a Calendar for $300!!).

Spend the next 30 minutes to install Office (yes, office takes about as long to install as your whole operating system, but office is more powerful than your OS, so its O.K), after office is installed and you update your TPS report and send it to your boss you decide you’d like to create a vlog (Video Log) and post it on youtube, but as you’ll soon find out, Movie Maker isn’t going to be the easiest thing to locate.Bill Gates can’t even find it.

Six hundred dollars and 7 hours later you have an almost usable computer, you still can’t watch DIVX or DVDs, burn Audio CD’s, Balance your checkbook, Sync your phone to your calendar and e-mail, or entertain your children with any games but minesweeper or solitaire. You don’t even have a virus scan program yet!

I probably went around the block just to get next door, but my point is that after a simple 20 minute install of any popular Linux distribution I can do all of the things I’ve listed above. They come with the majority of hardware supported out of the box, an office suite (open office, abiword, gnumeric, evolution, etc), multiple graphic tools (gimp, inkscape), easy package manager that handles updates without multiple reboots (rpm, yum, yast, zypper, apt-get, package kit), video recording program (cheese), cd burner (Brasero, Wodim), lots of fun games, and the ability to balance your checkbook with GNU Cash.

Find duplicate files by content not name

Filed under: Bash — Tags: — sontek @ 11:36 pm

Today in IRC suseROCKS needed to find all duplicate files in a directory by their content, not by their file name, so we whipped up this fancy little 1 liner bash script to do the trick:

find . -type f -exec md5sum '{}' \; | sort | awk 'dup[$1]++{print $2}’

EDIT:

As Andreas suggested, using xargs instead of -exec is much faster, here is the updated command:

find . -type f -print0 | xargs -0 md5sum | sort | awk ‘dup[$1]++{print $2}’

June 22, 2008

Achieve Zen with openSUSE 11.0 (i.e Get rid of pulse audio)

Filed under: Linux, SUSE — Tags: , , , , — sontek @ 3:23 pm

I’ve been having a lot of stability issues with openSUSE 11.0 lately and the majority of them boiled down to audio.

Here is a list of a few:

1. VLC required root to have audio, wtf?
2. Sound would crash after listening to any audio for an extended period of time (music, video, flash).
3. If my audio crashed, Firefox could not start up until I did rcalsasound restart
4. Some videos were slow/choppy.

So, you are probably asking, how did I fix all these issues?

zypper rm alsa-plugins-pulse
zypper addlock alsa-plugins-pulse

This removes the alsa plugin for pulse and locks it so it will never install again. Without the alsa plugin installed, the apps go back to using alsa directly. This has fixed every issue I’ve had with openSUSE 11.0 so far.

June 12, 2008

Vim Tip: Use Ctrl-Space for omni and keyword completion.

Filed under: vim — Tags: — sontek @ 12:19 am

Having Ctrl+Space for auto-completion is great because its a much more natural binding than the vim defaults.

Sometimes omni completion doesn’t find things properly (such as when searching in the current buffer), so I like to fall back to keyword completion if no results are found in omni-completion.

Put this in your .vimrc to get the same effect:

inoremap <expr> <C-Space> pumvisible() \|\| &omnifunc == '' ?
\ "\<lt>C-n>" :
\ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" .
\ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" .
\ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>"
imap <C-@> <C-Space>

This provides an even more powerful feel to the code completion in vim.

June 9, 2008

Official OpenSUSE Forums

Filed under: Linux, SUSE — Tags: , , — sontek @ 11:00 pm

Great news! The official openSUSE forums are finally here, combining the awesome communities from suseforums.net, suselinuxsupport.de and the openSUSE support forums at forums.novell.com.

If everyone could try to spend a half hour each day browsing the forums to help new users, it would benefit the whole community. openSUSE is growing fast and these forums fill a huge gap in our community for new users.

Without further adieu, http://forums.opensuse.org/

openSUSE 11.0 RC2 - Please do final testing!

Filed under: Linux, SUSE — Tags: , , — sontek @ 9:25 pm

Coolo was nice enough to leak us the RC2 LiveCD’s for openSUSE 11.0 RC2, please download and do final testing to make sure we have the best openSUSE release. Get them here

Features to test can be found here and as always, check most annoying bugs.

June 8, 2008

Vim Tip: Save file with root permissions

Filed under: vim — Tags: — sontek @ 7:06 pm

Have you ever opened up a configuration file in vim and then after you do all your editing you realize you don’t have permissions to save?

A simple command that will re-open your current buffer with root permissions is this:

exe “%!sudo tee %” | e!

You can bind this in your vimrc and then never waste time editing a read-only file again!

Debugging Mono with Trace.WriteLine and Debug.WriteLine

Filed under: .NET, C#, Mono, Programming — Tags: , , , , — sontek @ 4:43 pm

The point of Trace.WriteLine and Debug.WriteLine is to give you the ability to monitor certain areas of your code when debugging or tracing but avoid cluttering your screen or hard drive with useless output when you aren’t. When most people stumble upon Trace/Debug they think it should “Just work”–without any setup–this isn’t the case.

Another great benefits of using Trace/Debug instead of the old Console.WriteLine is you can define exactly where to log to in your app config or with environment variables, so sometimes you might want direct output to the Console but other times you might want to log to a file.

To get your output from Trace/Debug you first need to define either DEBUG or TRACE in your preprocessor directives.

You can do this in code by placing:

#define TRACE

in your code or by passing it at compile time:

gmcs -d:TRACE

after you have your preprocessor directives setup, you have to define where to log to. You can do this by defining it in your app config:

<configuration>
  <system.diagnostics>
    <trace autoflush="false" indentsize="4">
      <listeners>
        <add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="TextWriterOutput.log" />
        <remove name="Default" />
      </listeners>
    </trace>
  </system.diagnostics>
</configuration>

or you can define it with the environment variable MONO_TRACE_LISTENER:

export MONO_TRACE_LISTENER=Console.Out

and then you can start your logging with System.Diagnostics.Trace.WriteLine(”Hello World”).

To learn more about Trace/Debug check out:the docs here and here. To learn more about other environment variables you can use with mono ‘man mono’ or click here.

Powered by WordPress