Monthly Archives: March 2012

Installing Xen-tools check_python FAILED error

If you got the error like this:

  *** check_python FAILED

Use next:

# eselect python list
Available Python interpreters:
  [1]   python2.7
  [2]   python3.2 *

And then choose 2.* one:

  # eselect python set 1

Would be helped.

Convenient way to iterate collection in Java

Simple snipet to iterate through a collection:

for(Iterator iter = itemTypeList.iterator(); iter.hasNext();)
{
    Items.ItemType item = (Items.ItemType)iter.next();
    System.out.println( "\t" + item.getQuantity() +" copies of \"" 
        + item.getProductName() +"\"" );
}

Set domain name in Gentoo

You can set domain name in /etc/hosts:

    127.0.0.1 hostname.domain.com hostname localhost

Set in /etc/conf.d/net:

    (Set the dns_domain variable to your domain name)
    dns_domain_lo="homenetwork"

    (Set the nis_domain variable to your NIS domain name)
    nis_domain_lo="my-nisdomain"

Set in /etc/conf.d/domainname:

    OVERRIDE=1
    DNSDOMAIN="domain.com"
    #NISDOMAIN="" 

First method is good for me.

C#

Response.Redirect and Thread was being aborted in C#.NET

To prevent error “Thread was being aborted” while Response.Redirect() method execute, use second parameter equals to FALSE:

    Response.Redirect("http://google.com", false);

Also proof,
http://stackoverflow.com/questions/1433448/thread-was-being-aborted
http://programming360.blogspot.com/2009/10/thread-was-being-aborted.html

Delete string from array in Java

Useful snipet here:

    String s = "Some super string here...";

    // Get word list
    Pattern patTag = Pattern.compile("<.*?[^<]+>",Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.DOTALL);
    List aWords = new ArrayList(Arrays.asList(patTag.split(s)));
    
    // Deleting...
    String[] aIgnored = new String[] { "", " ", ",", ", ", ".", ". ", " ", "  " };
    aWords.removeAll(new ArrayList(Arrays.asList(aIgnored)));

As a result, we’ve clear word list.

Run NetBSD in Virtualbox

Running NetBSD in vbox may occurs some problem. To solve use VBoxSDL:

"C:\Program Files\Oracle\VirtualBox\VBoxSDL.exe" --norawr0 --startvm netbsd

where netbsd is your vm name.

How to disable kernel autoupdates in Linux

For panic admins. You could manually disable kernel automatic updates by editing file /etc/sysconfig/kernel:

    UPDATEDEFAULT=no

Don’t forget, grub won’t be updated! Make it handly or set to “yes”!