Archive for the ‘Linux’ Category.

C# download web page

I’m sure you had the need sometime to download the content of a web page to be able to analyze it or work with the content. Here is a code snippet just for you, we will use simple http GET for the specified URL.

public static string getWebPage(string psUrl)
{
    WebResponse result = null;
    string sRet = string.Empty;

    try
    {
        WebRequest req = WebRequest.Create(psUrl);
        req.Method = “GET”;
        req.Timeout = 3 * 1000// 3 secs
        // Explicit no caching, usually this is the default
        req.CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache);

        // Has to process the results if the responding service is spitting it out
        result = req.GetResponse();
        Stream ReceiveStream = result.GetResponseStream();
        Encoding encode = System.Text.Encoding.GetEncoding(“utf-8”);
        StreamReader sr = new StreamReader(ReceiveStream, encode);
        // in case the caller is interested
        sRet = sr.ReadToEnd();
    }
    finally
    {
        if (result != null) result.Close();
    }

    return sRet;
}

The LinuxHater

Just a quick one here, it might lighten up your day just as it did for me.  We all know the guy who likes to hate on Linux at LinuxHaters closed shop.  As I sadly pointed out a few months back.  But guess what, he’s back in business get your smile on lusers !

Minix hack to Linux

I just read an interesting post with a reference to a newsgroup post from Linus Benedict Torvalds.  On October 5, 1991 about the new “free version of a minix-lookalike.” Beware it’s only for developers hackers !

Interesting excerpt from the post,

This is a program for hackers by a hacker.  I’ve enjouyed doing it, and somebody might enjoy looking at it and even modifying it for their own needs.

Doesn’t that remain the state of Linux today ?

Linux day#5

I tried to address the Skype issue today, not being able to use skype voice  from the linux box isn’t going to work.  At least not if all the daily tasks are to be included.  I snug over to the Mint forums and used an advise from a thread that gave better results than what I had tried before.  Still my father on the other end in Florida complained about some rattle sound from the mic etc, but a lot better than talking with a muffler on.  It’s usable but it’s not great as it is on the win box.

Then I started to setup the dual monitors, that has only given mixed results.  I was able to activate both monitors but they are still showing the same desktop.  Which doesn’t make it very usable… to be continued.

Linux day#4

I had to review a checkin from a fellow developer in svn, so I fire up the newly installed rapidSvn.  The first complain was something about not able to find the current locale, but it starts, kewl.  I goto the commit log of a file and choose my diff location, next complain you must have external diff tool configured, ok sounds good.

I go google-ing seems either Kompare or Meld will do the job, Meld seems to be better liked and more feature, install is a snap with the Synaptic Package Manager.  So I point rapidSvn to use meld, now I can go differ and get this review over with.  But guess what, doing a diff crashes rapidSvn and it doesn’t matter if I use diff or meld, something fishy going on here.

Another star goes to TeamCity as I can click on the list of changed files since last build further I can do a diff right there in the browser, nice.

In rapidSvn I just get Segment fault, so I use gdb to see if I can catch any debug info, although I don’t have the debug version as google wasn’t to helpful.

gdb rapidsvn
snip…
(gdb) r
Starting program: /usr/bin/rapidsvn
(no debugging symbols found)
(no debugging symbols found)
snip…..
[New Thread 0xb62d0b90 (LWP 18555)]
(no debugging symbols found)
(no debugging symbols found)
snip….
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb62d0b90 (LWP 18555)]
0xb7ee46e1 in svn::Status::entry () from /usr/lib/libsvncpp.so.0

And after another google, it turns out the rapidSvn version 0.9.4 has a bug#111169 The good news is that you can compare your working copy against the head or a version in the repo to see changes.  I hope 0.9.6 or whatever next stable will have a fix as I don’t want to get the C# source down on the linx box from the repo.

Btw, another thing that’s annoying with rapidSvn, it saves your configuration on shutdown, which means you have to shutdown once in a while to save the latest things you have configured if your expecting crashes like I was.  Maybe there should be a save environment command ?

Now about the other / first problem  ( Cannot set locale to “.  )  whatever that means.  Here we go google-ing again, suprised as I might be that turned out to be pretty easy.  For some people go System -> Administration -> Language Support.  There choose English ( United States ) or whatever is to your liking and you should be good.  In my case when the dialog opened up it claimed that I didn’t have the full language support installed and wanted to install couple of modules, uh sure thing.  After install and forced reboot ( reminds me of win ) I’m all good.

Linux day#3

More on the Linux experience, I had to upload some java code to the Linux box as I wanted to do java coding there in Eclipse.  In order to do so I needed to configure the vsftpd server, of course they leave it pretty much shut down on the initial install, that way you won’t open your computer to the whole world.  You need to modify the configuration file at

/etc/vsftpd.conf

These are more or less the settings that your interested in, after google-ing I found those, but the config file itself contains a lot of documentation, you can start there.

local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
nopriv_user=nobody
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
anonymous_enable=YES

Then I go uploading the source, rar-ed of course, but when I went to unrar on the linux box, no dice.  It turns out you can buy a copy from winrar, or just get unrar-free which works fine in most cases, pretty self explanatory, the quick start can be found from the command prompt.

unrar-free –usage

The Rapid SVN client works fine against the win svn server, no complain there.  At least I can do java development on the linux box.

And then, your Mother using linux ???

What about Mint maybe I should have tried that instead of Ubuntu ?  Mint is based on the Ubuntu distro with a twist.