Increasing Netbook Screen Size

March 21, 2016

I’ve got an old Acer Aspire One 521 netbook that I’ve had for ages. One of the downsides of netbooks is that their screen resolution is 1024×600 – which is too low for a lot of programs. In particular, all the interesting buttons of the MFJ-226 control program “T-Series Vector Impedance Analyzer” are below the bottom of the screen.

I found a workaround that appears to work on Windows 7 and higher. I found it here: http://www.tlbhd.com/how-to-get-better-resolution-on-your-standard-10-inch-netbook-2772/

The solution: use regedit to search for all instances of “Display1_DownScalingSupported” and change the value 0 to 1. (According to various things I’ve read, you’ll need to do that for all instances, not just one.) Then reboot. When I did this, I ended up in 1024×768 (which looks strange).

Strange isn’t bad, though. Now I can change resolutions to 1024×768 or 1152×864 if an inconsiderate programmer decides he wants to use more than my screen.

 


Samba – let Windows execute even if execute bit not set

April 23, 2015

I’ve set up Samba once again, and it’s still not easy, especially with Cygwin in the mix. I still haven’t figured out Cygwin, but I did get the magic phrase that lets Windows machines run exe files without having to set the execute bit.

This is an option that’s not documented in the /etc/samba/smb.conf file, but that’s where it goes:

# Allow Windows machines to execute things that don't have
# the execute bit set
acl allow execute always = True

Thanks to forge.univention.org/bugzilla/show_bug.cgi?id=33785 for the info!


Changing Unix/Linux filenames to handle DOS conventions

December 12, 2009

Recently, I had a bunch of files with characters in their names that made them hard to handle under Windows. Although Unix has no problems with :, ? and others, DOS / Windows doesn’t handle them well. This made using them on my CIFS share a bit of a pain.

To rename them, I hacked up a quick Groovy script. It maps all “weird” characters to _, which is pretty much universal.

Note that this script doesn’t currently handle the case where two files map to the same name. If you have :foo and ?foo, they’ll both get mapped to _foo and you’ll lose one of them.

I called it dosname because it was late and I wasn’t feeling creative.

#!/usr/bin/groovy -
if(args.length == 0) {
	printArgs()
	System.exit(0);
}

dirName = args[0];
new File(dirName).eachFile() { file ->
    def matcher = (file.getName() =~ /[\?\:\"\\]/)
    def newName = matcher.replaceAll("_")
    File newFile = new File(dirName + "/" + newName.toString())
    println file.getName() + " -> " + newFile.getName()
    file.renameTo(newFile)
}
System.exit(0);

def printArgs() {
	println("Usage: dosname [dirname]")
	println(" Note: I don't handle the case where two files map to the same filename yet!")
}

The interesting bit is in the line

def matcher = (file.getName() =~ /[\?\:\"\\]/)

That line defines the regular expression which contains a group of characters which will be replaced by _. Right now it’s [?:”\] (all quoted with \ because that’s what you have to do in regex).

Run it with “dosname directoryname“. There’s no way to reverse its effects, so try not to use it on useful directories like /etc/.

Also, I needed to install OpenJDK6 JDK (not just the runtime) in order to run Groovy on Ubuntu 9.04. Go figure.

Since I don’t know Groovy, I stole most of this code from here.


Using rsync to back up a Windows box to Ubuntu Server 8.04

December 10, 2009

After getting rsync working so well for backing up hard drive to hard drive, I naturally wanted to back up from my Windows box to my Ubuntu server. Luckily, Cygwin has an rsync for Windows – so I started by installing that. (I actually already had it installed – Cygwin is nice.)

I found some good instructions here, and used them as the basis for what I did.

The steps I went through:

  1. First I created /etc/rsyncd.conf. I wanted to share a single directory called shared, so I had just one entry:
    [shared]
    path=/data/shared
    comment=Shared directory
    uid=andrew
    gid=sambashare
    read only=false
    auth users=rsyncuser
    secrets file=/etc/rsyncd.secret

    I picked group sambashare just to be consistent with my Samba configuration. rsyncuser does not exist on the machine; it is instead mapped to andrew (uid)

  2. Next I created /etc/rsyncd.secret:
    rsyncuser:secretrsyncpassword
  3. After that, I needed to enable rsync (both right now and after reboot). First, I edited /etc/default/rsync and changed RSYNC_ENABLE to true:
    RSYNC_ENABLE=true
    

    Next I started the rsync daemon:

    sudo /etc/init.d/rsync restart
    
  4. The /etc/inetd.conf of a plain Ubuntu 8.04 Server install was empty, which was a surprise to me. There appears to be a utility called “update-inetd” to update the file and then restart inetd. Because I couldn’t be bothered to find out the syntax, I just edited /etc/inetd.conf and put in:
    rsync  stream  tcp     nowait  root    /usr/local/bin/rsync rsyncd --daemon

    Then I used update-inetd from the command line to restart inetd for me:

    sudo update-inetd --disable rsync
    sudo update-inetd --enable rsync
  5. At this point, I could telnet to port 873 (the rsync port) and see a connection, but rsync itself still didn’t want to run. Instead, it failed (even when I entered the correct password) with this message:
    @ERROR: auth failed on module shared
    rsync error: error starting client-server protocol (code 5) at main.c(1383)

    Andrew Tridgell has awesome utilities, but he really has a problem with displaying meaningful messages.

    It turns out that rsync really wants the secrets file (in my case /etc/rsyncd.secret) to be readable only by the rsync user. There is a global option “strict modes” that can be set to false to allow you to get around this, but I decided why not just do the right thing:

    sudo chown root.root /etc/rsyncd.secret
    sudo chmod 400 /etc/rsyncd.secret
  6. Finally, I needed a command for the rsync on my Windows box. Here was one I came up with:

    @echo off
    set RSYNC_PASSWORD=secretrsyncpassword
    rsync -vrtz --delete --delete-excluded --exclude "Temp/" --exclude "*.tmp" --exclude "parent.lock" --exclude "UsrClass.dat*" --exclude "NTUSER.DAT" --exclude "ntuser.dat.LOG" --exclude "Cache/" "/cygdrive/c/Documents and Settings/" "rsyncuser@myserver::shared/win2k-backup/Documents and Settings"

    This command preserves timestamps (t) and prints out what it’s doing (v) as it recursively (r) goes through Documents and Settings and backs up the files, using compression so it’s faster over the net (z). It excludes a bunch of things.

I should probably have used a file to specify what’s excluded (–exclude-from), but I was lazy and just kept adding to the command line. I’m excluding cache files, as well as lock/log files that are kept open by Windows 2000 (they report as errors if you try to back them up).

At some point I’ll probably add a “hosts allow” line to my /etc/rsyncd.conf, as soon as I decide which machines I want to let backup to the server.