Monday, February 7, 2011

Dropbox (Error code -36)

Today, I was faced with Dropbox 'Error 36' on MacOS.
So, let's start from beginning... Dropbox has file name limitations, and those limitations are a bit different than operating system limitations (MacOSX).
I am convinced that there are good reasons for these, as they have special meaning on the command line level or would look really weird in the browser.

Let's start with the issues:
- Issue 1: File names can not start or end with blank character
- Issue 2: File names should not contain slashes

Where issue 2 is easy to spot, finder does not make it easy to spot issue 1. Thus I have created a short script that fixes blank characters in file names.

You can download dropbox_fix_script.pl. You need to navigate to the folder you are trying to copy, unzip and run this script from terminal.

Before you run this script, make sure to backup your data.

If there are enough interested readers, I may wrap this into application that you can drop a folder on.

--- script content is:
#!/usr/bin/env perl
#
sub fix()
{
    my @list = `find .` ;
    chomp(@list);
    for my $file (@list)
    {
    print "." ;
    my $base = `basename "$file"` ;
    my $dir = `dirname "$file"` ;
    chomp($base);
    chomp($dir);
        if( ($base =~ /\s+$/) || ($base =~ /^\s+/) || ($base =~ /\// )
        {
      print "match $file\n" ;
          $base =~ s/\s+$//mig ;
          $base =~ s/^\s+//mig ;
          $base =~ s/\//_/mig ;
    print "\n" ;
          return ( $file, "$dir/$base");
        }
    }
    return undef;
}

while( 1 )
{
    my ($file, $new_file) = &fix();
    if( defined( $file ) )
    {
        print "rename '$file' '$new_file'\n" ;
        if( -f $new_file )
        {
            print "file already exists $new_file -- fix $file \n" ;
            exit ;
        }
        if( -d $new_file )
        {
            print "dir already exists $new_file -- fix $file \n" ;
            exit ;
        }
        rename $file , $new_file ;
    }
    else
    {
        last;
    }

}

Wednesday, January 26, 2011

DNA reverse complement

Just published simple DNA reverse complement tool. It features reverse sequence generation, complementary RNA and DNA generation and of course reverse complement for both DNA and RNA. Check it out.

Wednesday, January 19, 2011

Click-o-mania and cyclick-o-mania in pure HTML

Last time I wrote click-o-mania clone was in summer of 1999. I wrote it in an MIT Athena cluster one summer day with the idea that it would help me with, than fresh Java skills.

Now the time has come, and I wanted to work on my GWT skills - thus - new HTML only, Flash-free, Java-free version of Click-o-mania and cyclick-o-mania are available. This simple games are written in using GWT/Java and compiled and tested on Mac and Windows, in variety of browsers and also adapted to work on iPhone. If they work well on Android, I would be interested to hear.

I hope you will enjoy these games as much as I enjoyed writing them.

Wednesday, September 8, 2010

Punnett Square at Bugaco.com

I just started writing Punnett Square calculator. It seems to be a nice tool for understanding inheritance relationships. Check it out at: http://www.bugaco.com/calculators/punnett_square.php

Wednesday, March 31, 2010

Eclipse - Linux - Unable to connect to repository

I just moved to new Ubuntu 10.4, and downloading Eclipse or Aptana Studio suddenly stopped working with repositories. This is very very annoying as I'm unable to install pydev and continue working on my improvements of Analytics@bugaco. So, what I had to do something to fix it. It seems that I am not the only one with this problem.

The problem seems to be related to Java's preference to use IPv6 stack over IPv4 stack that causes some systems to be unable to connect to web sites.

Fix for it is documented at debian's bug report's list. The reading is quite verbose, so I'll document cookbook solution that just works for me.

Open your eclipse.ini file, at some stage it has -vmargs line, after that line add following define: 
-Djava.net.preferIPv4Stack=true

Original file
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.200.v20090520
-product
org.eclipse.epp.package.cpp.product
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms40m
-Xmx256m



New file
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.200.v20090520
-product
org.eclipse.epp.package.cpp.product
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Djava.net.preferIPv4Stack=true 
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms40m
-Xmx256m

Good luck! Let me know if this fixes your problem...

Sunday, November 15, 2009

Windows 7 on Acer TravelMate C110

introduction
I got Acer travel mate Tablet PC. This is a great little workhorse - it has 900MHz CPU that is on par with most of the Atom's out there, so I find little reason to even consider getting a netbook.

My Acer was running Windows XP Table PC edition. I wasn't even thinking of upgrading it to Windows Vista (as it did not have enough resources), but with all the hype that Windows 7 is optimized operating systems - I was thinking - let's give it a try!

First, let's go with the setup of Acer - it has 1.25GB of memory, thereby passing a requirement for more than 1GB of RAM. It has 900MHz CPU, barely below 1GHz minimum, and I upgraded it with 80GB/5400 PATA drive that works just fine.



As you can see from "Windows Experience Index" the slowest part of the setup is graphics, but given that I don't plan to play first person shooters on it - it's just fine!

install
Acer does not have DVD drive, so I used USB key to boot Windows installation.
I installed clean install of Windows 7 on the machine (I upgraded HDD before installing Windows 7, so there was no point of transfering XP over first).
Machine booted in safe graphics mode, and it was missing some of the drivers.

network
First I installed network drivers - it turns out one can install Intel 2100b drivers for XP on Windows 7. It turns out you can 'force' windows to use XP's driver. So I downloaded latest driver from Intel's site and forced Windows 7 to accept Intel drivers although it complained a lot!

This was not enough to get Windows 7 to start using networking adapter, and after some agony I remembered that friend of mine mentioned that Acer has stupidest software button that turns of wireless adapter. Linux has a app that can be used to flip the software switch, as button in itself is dead and wireless if off (remember that wireless is on only when red LED is turned on).

After trying to install most of the original Acer utilities I figured that I may need to return back to XP as Notebook Manager throws exceptions almost on any click. After a bit of frustration I noticed that 'Launch manager' althrough it does not help with the button has an option 'Wireless Device Boot Status' and it can be turned on.


This saved the day! Now networking works.

sleep & graphics
Acer is not functional, so let's see what is next issue on the list. Mysteriously Acer does not want to sleep. It just wants to hibernate or shut down. This is a bit of annoying as using XP I could just close the lid and it would sleep fine.

Another set of frustrating explorations led to the command that will list sleep states, and what prevents system from falling a sleep. Results of this command suggested that the issue is in graphics adapter that was generic VESA and as such it didn't know anything about sleeping.

It turns out that Intel didn't provide support for 855 chipset - can you blaim them? Chipset is about quite old and they would like us to buy new ones. Installing 915 drivers didn't work, but using XDDM mode of 855 drivers (produced for Vista) worked just well enough to get my machine to accept driver, and to be able to happily fall asleep.


Now finally sleep worked fine! Awesome!

not much sleep for the wary
While sleep would be really cool and I would enjoy it - it had one drawback. Remember network? And that stupid button? Well, if you sleep machine, on wake up network does not wake up.
So I just hibernate my Acer when I'm done using it.

conclusion
Windows 7 works well on Acer C110. It is an awesome little machine. Sleep does not work well, but most of the other functions are just fine. I also like how Windows 7 improved tablet functionality - hand writing recognition is way better than before.


Friday, November 13, 2009

Setting Putty with Kerberos on Windows (including Windows 7)

note
If you don't know what is Kerberos and SSH - you probably don't need it. So read some of the other posts that may be more relevant for you.

introduction
If you do know that you want Kerberos and SSH on your machine - welcome to the post that will explain how to set it up on Windows. Unlike MacOSX that comes with Kerberos and kerberos aware SSH and Ubuntu, Red Hat and other major Linux distributions that have Kerberos and Kerberos aware SSH easily accessible, finding good Kerberized SSH client for Windows was a challenge.
Although I like challenges, I like to solve them once, and reuse them often - so this post is on how to setup yourself with Kerberized SSH and SCP for Windows.

installation
Best SSH client I have found for Windows is Putty, but default installation does not came with Kerberos enabled, so if you need Kerberized Putty, you can download it from Mattew Loar's web page.
In addition to Kerberized Putty you will need to install MIT's Kerberos for Windows.
As kerberos needs to be in the path, Putty may not work until you add it to the path (by for example restarting CMD or slickrun)
Install these two packages and you should have whole install.

why kerberos?
Cool thing about Kerberos is that separates your credentials (authentication) from your privilegies (authorization). By default you should be able to login to your account SSH enabled Unix server, but Kerberos makes it easy to allow someone else to login as you without giving them password - for example I can login as both root and myself on our server with same Kerberos ticket, and so guy next to me; but unlike non-Kerberized SSH revoking and adding people is matter of editing .k5login file.

how to do it with Putty?
1. Get a ticket.
2. Open Putty and select 'connection -> data' and setup user account you are authorized to access - for example root.
3. login to server by setting server name in session tab.

resources
Putty with Kerberos authentication:

MIT Kerberos Package: