Read a Whole Textfile Into a String

Posted by Brian R Cline | C#.NET,Programming | Thursday 30 July 2009 4:31 pm

At work, I’ve been working on an auto html emailer.   I’ve been receiving files from our Latin American office that are completely in spanish and trying to sift through the HTML and recreate the email taking into account size and the fact that Outlook 2007 still doesn’t accept background images and most CSS.

Anyway, one of the files they sent originally that the old software produced didn’t work. And to prove this, I had to somehow figure out how to loop through this text file they’ve been sending and prove this to my boss. I eventually found a function, that would let me avoid the looping, the steam writer and just do it.

System.IO.File.ReadAllText(String fileName)

How do I check if Ubuntu is 32 bit?

Posted by Brian R Cline | linux | Tuesday 28 July 2009 8:45 pm

I’m really excited that there’s an increasing number of Linux questions on Yahoo! Answers.

“I want to install the new Ubuntu or some other Linux distro. How do I check if I can run 32bit or 64 bit on a computer already running linux?”

Actually, this should be really easy on your Linux box.

  1. Open up the terminal
  2. Type uname -m

If you see i386 or i686 then your current hardware is 32 bit. If you see x86_64 then your current hardware definitely supports 64 bit software.

Open Web Tools Directory

Posted by Brian R Cline | Uncategorized | Tuesday 21 July 2009 10:04 am

Not too long ago, Mozilla launched an extreme pleasent and fairly easy to use Web Tools directory which includes many easy to use and sometimes hard to remember names of frameworks, debugging tools, and et cetera.Open Web Tools Directory

Thoughts on Linux

Posted by Brian R Cline | linux | Monday 13 July 2009 11:13 am

When I switched to Linux (Ubuntu) only at home in 2008, I believed this would be a temporary solution on an old desktop. I say temporary because my notebook stopped working and needed to be repaired.  Almost a year later, and I don’t think I would ever consider going back to any of the Microsoft Windows Operating Systems.

Even on a five year old desktop, I almost never experience hang ups or the infamous blue screen of death which I did manage to see maybe once or twice still in Vista. There’s no need to run a virus scanner as by default because viruses and worms aren’t as common for Linux and actually running without root privileges by default is possible compared to Windows which won’t run a lot of software without Root / Admin.

I’ve grown accustomed to being closer to the machine and being able to customize everything. I am ever so thankful to those programmers in the trenches that designed Linux and all the rest of the OSS applications.

How To Stop A .NET Form from Closing

Posted by Brian R Cline | .NET Framework,C#.NET,Programming,VB.NET | Friday 10 July 2009 1:22 pm

I always find it so amazing how people don’t or won’t bother to spend even five minutes using a search engine like Google to find out about how to do something and instead spend more time posting a question on Yahoo! Answers.

We simply add e.Cancel = true to the Form’s Closing Event, there are two simple examples below.

Closing a Form in C#.NET goes like this:

private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true
}

Closing a Form in VB.NET goes like this:

Private Sub Form1_Closing(ByVal sender As Object, ByVal e AsSystem.ComponentModel.CancelEventArgs)
e.Cancel = True
End Sub

Becoming a Super User In Ubuntu

Posted by Brian R Cline | Ubuntu,Uncategorized,linux | Friday 10 July 2009 12:16 pm

I frequently answer questions on Yahoo! Answers and have noticied that there’s consistantly new Ubuntu (Linux) users asking how they become the super user to run some certain command. Of course, finding the answer to this question should be extremely easy with Google and it is.

In Ubuntu, by default, the root user’s password is locked. This means that we don’t know it and we can’t always sign in as root or unfortunately use the normal linux su command either. Locking the root user’s password forces users to use the lowest needed acccess which reduces some of the ways a system can be attacked or “rooted.”

The command in ubuntu is sudo which allows programs (or commands) to run with root-level privileges.The syntax is very simple:

sudo /etc/init.d/httpd restart

In this example, I just restarted apache.

For more information, please check out the sudo man page