How to check database type of subversion repository

Doing some maintenance on my Subversion repository –namely taking out a directory and creating a new repository with only that directory– I wanted to find out how to check what type of database (FSFS or Berkeley DB) my current svn repository uses.

After some searching all I came up with were pages talking about the two database types, not what database type an existing Subversion repository uses. I decided to look around the file structure of my repository and found an aptly-named file called “fs-type“. Calling cat on the file told me what I needed:

$ cat {PATH_TO_REPO}/db/fs-type
fsfs

Posted in Uncategorized | Tagged | 2 Comments

Select boot device key on Sony Vaios

Most BIOSes nowadays have a feature whereby pressing a specific F key brings up a one-time boot device selection menu, handy for operating system (re)installs. The BIOS on my new Vaio didn’t display any information regarding keys (not even how to get into the BIOS). After blindly trying escape and del, F2 got me into the BIOS. There was no one-time boot option in the BIOS so I did a google search. A random post in a random thread said to try F11, which cycles the boot device through the available media.

I was trying to boot from USB: the first time I pressed F11 during boot the laptop tried booting from the empty CD drive. The second time (I can’t remember if the laptop rebooted itself, or if I had to) I pressed F11 it successfully booted from the USB.

Resources

Posted in Uncategorized | Tagged | 6 Comments

Find XPath to any element quickly with FireBug

Edit: I found out that right clicking on a tag in Firebug’s HTML tab and clicking on “Copy XPath” is a much quicker method.

I just discovered a way to quickly find the XPath to any element on a webpage with Firebug. This will help me a lot in the development of my Greasemonkey script HorariGlobal.

  • Right-click on element.
  • Click on “Inspect element” entry.
  • Go to HTML tab in the Firebug frame then the style tab on the right.
  • Right-click on empty space in that frame, select “Edit element style”
  • Hover mouse over the text item “element.style {” that has just appeared.

I imagine there is a tool somewhere out there that will do this in one step, but this will do me for now.

Posted in Uncategorized | Tagged , | 1 Comment

“Logon failure: unknown username or bad password.” when trying to access Windows XP share from Windows 7

After a recent Windows Update I could no longer access the folders on my Windows XP file server. A window popped up asking for a username and password even though they are both the same on the two computers. The error message each time was “Logon failure: unknown username or bad password.”

I typed in my username and password five times. It reached the point where I thought I had gone crazy and was typing in the wrong one: it kept on coming back to me with the dreaded “Logon failure: unknown username or bad password.”.

I quickly returned to my senses and guessed something was up with the authentication between XP and Windows 7. A few Google searches later I found out that a Local Security Policy needs changing.

  • Open the Start menu
  • Type “Local Security Policy” in the search box
  • Open Local Security Policy
  • Navigate to “Local Policies” -> “Security Options” and then locate the entry named “Network security: LAN Manager authentication level”. Double click on it.
  • In the dropdown list choose “Send LM & NTLM – use NTLMv2 session security if negotiated
  • Click OK

It seems that a recent Windows Update has changed that policy’s settings to be undefined, which —from what I can tell— forces NTLMv2 session security always. My XP installation mustn’t have NTLMv2 capability and that is why I kept seeing “Logon failure: unknown username or bad password.” errors.

After changing the local policy I was immediately able to connect to my network shares again.

Links

Posted in Uncategorized | Tagged , , | 46 Comments

Turning screen off with “Access IBM” button

My trusty old T43 has a blue “Access IBM” button just above the F-key row that has sat unused ever since I first reinstalled windows. The other day while browsing the thinkpads.com forums I found an interesting use for this button: turning the screen off.

As time passes, I get more and more conscientious about taking care of my laptop. It recently occurred to me that I needlessly leave the screen on for hours on end, shortening the life of the CCFL backlight. My warranty ran out last year and I’m not planning on buying a new laptop in the near future, so I’m keen on taking good care of it. I could configure the different power plans to turn the display off after X minutes of being idle but the Lenovo Power Manager utility crashes each time I open it, and there is no update for that yet.

Plus, pressing the Access IBM button (which I never use anyway) and having the screen turn off, fading into black, is more fun.

On to the instructions; first we need an executable that turns the screen off and then we need to edit the registry so it is executed when the Access IBM button is pressed.

Executable

Registry edit

To make the Access IBM button do anything when pressed there needs to be a key in the registry for it. Create the following registry key if it doesn’t exist
HKEY_LOCAL_MACHINE\SOFTWARE\IBM\TPHOTKEY\8001
Inside this key create a new string value named “File”. Double click on it and insert the path to the executable in the data field. In my case it was:
C:\\Scripts\\MonitorOff.exe
All done. Pressing the button now turns off the display (the laptop screen and any other display attached) and the ThinkLight. Moving the mouse or pressing a key on the keyboard turns the monitor(s) back on (not the ThinkLight).

Links

Solution: Using ThinkVantage button to turn off monitor – Thread at thinkpads.com forums with original instructions. Credit to yak, the author of MonitorOff.exe

ThinkPad Button – Information about the different Thinkpad buttons in existence at ThinkWiki

Posted in Uncategorized | Tagged | Leave a comment

Revisiting PPPoE forwarding to PfSense

A few months ago I described how I started using PfSense as a proper gateway. I configured my ADSL router to act as just a modem, forwarding the PPPoE tunnel to PfSense. PfSense would then be in charge of everything related to the internet connection.

I initially did it because I was having to restart the ADSL router every so often. It would lock up, not creating any new connections, which annoyed everyone trying to use the internet. The goal was to have a rock-solid connection that didn’t need restarting ever.

A few months have passed and I had forgotten about the last sentence in my initial post: to see whether the situation improved at all, or whether it was still locking up.

During my almost-daily checking up on the site -I am the only visitor, after all. Those stats don’t create themselves!- that last phrase caught my eye and I realised I should follow up, for posterity if nothing else.

The result has been as I’d hoped: I haven’t restarted the ADSL modem or the PfSense box since I set it up. The only downtime has been when the electricity went out, about 57 days, 03:53h ago.

Posted in Uncategorized | Tagged , | Leave a comment

Automounting Windows samba share with autofs – dollar sign and SELinux woes

The target directory for my (well, the one I got from DokuWiki’s wiki vOv) DokuWiki backup script is on a Windows fileserver. I did some searching and the best way to access this share seemed to be using autofs to mount the share only when the local directory it is mapped to is accessed. This way there is no worry that the file server is down when the Linux server boots and tries to mount the network share – which would require manual intervention to resolve (or testing that the share is available in the script). Instead, each time the script is run the share is mounted; and if it does fail for whatever reason hopefully the issue will be fixed for the next execution.

To set up autofs I used the information at this CentOS wiki page. Initially I went with the “Basic Method” because I couldn’t get autofs to work. I later found out that autofs was failing because the share name I was trying to connect to had a dollar sign, which I wasn’t escaping.

After reading the autofs errors in the system log, I caught on to the fact autofs wasn’t even able to find the share, which made me think about having to escape the dollar sign. A few searches later confirmed it, so I tried putting a backslash infront of the dollar sign, which worked. In a way.

Autofs was now spitting out another type of error. SELinux was denying access -like it  always does >:(- to the filesystem or something. Searching the internet didn’t provide me with a conclusive solution (I have no idea how SELinux actually works and it seems like a very broad topic). I decided to just disable SELinux at the start of the backup script, and reenable it at the end. Can’t get much more jerry rigged than that can you?

Posted in Uncategorized | Tagged , , | Leave a comment

Backing up DokuWiki with rotating backups on a samba share

After procrastinating for a while I got down to setting up backups for our DokuWiki installation: it was getting to the point where it had enough useful information that losing it would be a Disaster. I got cold sweats just imagining having to type all that stuff up again.

Some searching later I found this pretty good DokuWiki backup script over at the official wiki. After customising the script and spending a (long) while mounting a remote samba share, I added the script to the crontab on a daily schedule.

It’s now a few weeks later and I have a seven-day rotating set of backups for our documentation, getting backed up both to tape and to a remote fileserver. I had a gander through the backups the other day and noticed, however, that the rotating portion of the script seems to be a bit wonky. Each day’s backup folder seems to have a subfolder with a full backup inside it, a few levels deep. For now it’s not too serious as it’s only a few hundred MB, but it’s something I’ll have to look into.

Next up are my adventures with dollar-sign-in-the-name samba shares and my misadventures with SELinux. For now though it’s bed time, and luckily for me I get to sleep with one less worry on my mind.

Posted in Uncategorized | Tagged , | Leave a comment

Comtrend HG/CT536+ and how to bridge PPPoE connections

Recently I managed to fix my horribly designed -and implemented- home network such that computers accessing the internet no longer had to double-NAT. It has been glorious and extremely stable: much better than having to restart the ADSL router/gateway every day or two.

Nothing lasts eternally though, so just a few months later my network has been shaken up again. Our telephone company cancelled the telephone line instead of cancelling a telephone number alias we had set up. This caused our internet ISP to (obviously) stop providing us with internet. When we finally got the telephone line reinstated we appeared as new customers to the ISP. I took advantage to go through with the possibly-daunting task of upgrading our connection to 20/1. I had been wanting to make the switch for a few years, but horror stories had stopped me from doing so. These horror stories include people not having telephone or internet for 3+ months (sometimes stretching to 9 months).

We were out of internet for at least a month anyway, so I thought I might as well dance with the devil and I took the plunge. The ISP has either sorted themselves out, or, we were lucky. 3 weeks later the internet worked.

It dawned on me that I would possibly have to replace our current ADSL modem/gateway with the new one, which wasn’t a happy thought. Maybe it would be crippled and the bridging wouldn’t work. We’d be back to double-NATting.

For the first few days I decided not to rouse the evil networking spirits and just used the old modem/gateway, which worked fine. I then discovered that my ISP offers an Annex M profile. To take advantage of the extra upload bandwidth I needed to use the new router they had given me. Woe is me.

The router they gave me is a Comtrend HG/CT 536+. It is different from other routers I’ve had in that instead of just having 4 regular ethernet ports on the back it has two marked as ethernet, and the other two are “HG” and “IPTV”. I didn’t pay much attention to that until later.

After setting up the router as a bridge and assigning it the proper IP, activating Annex M, etc. I replaced it with the old router. And crossed my fingers. On cue and not to disappoint me, it didn’t work. I spent about 20 minutes fiddling with different configuration options, like the ATM service classes (I don’t even know what they do). After none of that worked I thought maybe this router had the same problem as the other one, maybe I had to set the mode to bridge from the wizard, otherwise it didn’t ‘stick’. I couldn’t find the wizard though, and I despaired.

Finally I remembered the IPTV and HG ethernet ports. I’m not using IPTV, but what was the HG for? Either on the shipping box or in the manual I had seen ‘Home Gateway’…HG. Maybe in bridge mode it only forwards the connection through the HG port? Yeah.

End result: my network hasn’t been cannibalized and I now have more bandwidth. More is better, right?

Posted in Uncategorized | Tagged , , | Leave a comment

Windows 7 open command prompt from right click context menu

Windows XP had the PowerToys, which added useful functionality to the system. One of my favourites was the “CMD Shell here” PowerToy, which opened a cmd prompt with its working directory set to the folder you were in.

Vista incorporated this into the OS, obviating the need for a PowerToy. I was happy with this. Then I installed Windows 7 and the option has disappeared from my context menu.

After a quick search I’ve come across the following:

  • Holding shift down when right clicking on a folder brings up a few extra options, one of them being “Open command prompt here”
  • Save the following as a .reg file, then right click -> merge it to add an entry to the context menu which creates an elevated (Admin privileges) command prompt:
    Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOTDirectoryshellrunas]
    @="Open Command Window Here (Administrator)"
    
    [HKEY_CLASSES_ROOTDirectoryshellrunascommand]
    @="cmd.exe /s /k pushd "%V""

Read the articles about Windows 7 right click command prompt and elevated command prompt.

Posted in Uncategorized | Tagged , , | Leave a comment