Thursday, August 12, 2010

how to vim remotely

Lately I've been developing code that needs to be tested on a remote server. I played with a few different scripts to scp changes to the server and decided I needed something stronger. I went looking for a plugin for VIM and found out remote file editing is part of the base vim function.

You can specify a remote file path via scp://user@server/path/to/file or scp://user@server//fully/qualified/path/to/file .

Saving the file with copy over the changes. Any local editing done on the file is done in a temporary file that is cleaned up when the editor is closed.

Thursday, June 24, 2010

Updated interactive perl script

This is still just a quick script to test out perl concepts before trying to write them into a program. It isn't fancy but it is functional.

Look for more updates as I build this out a bit more:
#!/usr/bin/env perl

use Term::ReadLine;
use strict;
use warnings;

my $prompt = "> ";

my $term = new Term::ReadLine("iPerl -- interactive perl");

while (defined ($_ = $term->readline($prompt))) {
chomp;

next if (/^\s$/);
last if (/^(?:q|quit|exit|logout)$/);

my $output = eval $_ or print $!;

print "\nOUT: $output\n" if $output;
}

print "\n";

Wednesday, June 23, 2010

how to do ipython in perl...

I've been writing a lot of python code lately and I really enjoy having that instant trial and error you can get by using an interactive code shell. (IPython and a half dozen other tools allow this).

I had to switch to perl on a project and went looking for a similar tool. I wasn't able to find much out there but I did stumble on a quick solution.

perl -ne 'eval $_ ; print ">> "'


This will loop over all input from standard in and attempt to evaluate it. The only downside is you won't be able to write anything that takes multiple lines (for, while, try, or functions). But it is a lot easier than writing perl oneliners over and over again to test out theories.

Thursday, March 25, 2010

to fix ubuntu speedstepping

For some reason my laptop decided to start scaling the processor back to the slowest possible frequency even when I was on AC power and running cpu intensive workloads.

I scanned for cpufreq modules in the kernel using
$lsmod | grep cpufreq


And I found nothing. I attempted to insert speedstep-centrino or acpi-cpufreq as a kernel module and found there were no modules to be loaded.
[~]$ sudo modprobe speedstep-centrino
FATAL: Module speedstep_centrino not found.

[~]$ sudo modprobe acpi-cpufreq
FATAL: Module acpi_cpufreq not found.



At this point I started looking at bug reports and user forums and I found the following:
* speedstep-centrino appears to be deprecated in favor of acpi-cpufreq
* acpi-cpufreq is actually compiled as part of the 2.6.31 ubuntu kernel so there is no module to load
* Ubuntu 10.x may revert to using acpi-cpufreq as a module but thats not confirmed
* cpufreqd and powernowd are userspace speed stepping daemons
* Ubuntu prefers powernowd but my system had cpufreqd installed
* hal (hardware abstraction layer) also has a speed step controller that no one talks about.

The last point is the one that tripped me up. I think the behavior I was seeing was hal getting confused when I would suspend the laptop, change from running on battery to AC, and then restart the laptop. The hald-addon-cpufreq daemon was doing speed stepping by setting min cpu = max cpu = target frequency. Which means switching the governors didn't do anything.

On the advice of a hal configuration bug report I found I removed the 10-cpufreq.fdi file I found in /usr/share/hal/fdi/policy/10osvendor/10-cpufreq.fdi and restarted the computer.

Removing the hal cpu controller, powernowd, cpudyn, and cpufreqd finally removed every last bit of automated control over my cpu speed stepping. I have cpufrequtils installed which gives me the ability to view and change cpu max, cpu min, and cpu governor manually. After the headache of trying to figure out why my cpu frequency randomly changed I think I'll stick with a system I can control.

Monday, February 8, 2010

flash followup

Apparently fixing flash on Karmic Ubuntu is easier and harder than I thought. I messed with various profile setting for a long while and still couldn't get GDK_NATIVE_WINDOWS to stick in all cases. It looks like gnome makes a habit of launching things outside of the context of the parent process.

I have everything working correctly now, but it took wrapping the firefox and prism executable with a one liner to set the environment variable

[~]$ cat /usr/bin/firefox
#!/bin/sh
GDK_NATIVE_WINDOWS=1 exec firefox-bin $@


That was enough to get it working again. Hopefully this saves someone some time.

Monday, February 1, 2010

how to fix flash in Ubuntu Karmic

This has been annoying me for a while now. I wasn't able to hit half of the buttons in flash games, youtube, or GrooveShark while running karmic. I figured an update in flash broke my system but it turns out the problem runs a bit deeper.

Gnome decided to enable client side rendering in their GTK windows. This allows for quicker and cleaner redraws when doing special effects. I happen to run fluxbox so I didn't notice anything in the switch. Eclipse users might be familiar with this since Eclipse hasn't handled the change yet. I stole most of this fix from their boards.

You can disable this new client side rendering using the environment variable GDK_NATIVE_WINDOWS=1.

My trouble was that it was impossible to get that variable to set anywhere in my config. I edited .profile (which is frowned on), .bash_profile (which is cheating since the variable won't make it into the window manager), /etc/environment (which sets it on a system level), and ~/.pam_environment (which sets it at a user level). None of these solutions would actually get the environment variable to stick.

Flash forward a frustrating half an hour of trial and error and I realized I started up the gnome-settings-daemon in my fluxbox startup script. I put a sleep after the gnome-settings-daemon and appended the GDK_NATIVE_WINDOWS assignment and everything started working. Turns out gnome-settings-daemon was hiding the environment variable changes. I have no idea how to reconfigure the setting daemon so I'm currently letting the hack stand (1 second delay and all).

Long and short of it: Add the line "export GDK_NATIVE_WINDOWS=1" to your startup files (any that I mentioned above) and keep in mind the gnome-settings-daemon might decide to squash them.

Hopefully that will spare you some troubles

Friday, May 1, 2009

how to improve graphics on a t60p running Jaunty (xorg 1.6 + radeaon)

Brian commented a few times on my last Jaunty post with some helpful advice. ATIRadeon Wiki posts the driver options for your xorg.conf file. Xorg 1.5 and up can run without the xorg.conf file by automatically guessing drivers and monitors, but it doesn't selected the tuned options all the time.

After my upgrade headaches I cleared the xorg file and started fresh, but I didn't think to add in the device options. I followed the wiki and performance is better, but not stellar. Compiz is still slow and multiple windows running transparency will bring the system to its knees. But its not all bad news. Fluxbox is finally acting the way it used to (desktop switches are quick, windows move without lag)

I still need to try out the radeon HD driver to see if that adds anything. For now I'll happily use fluxbox with Brian's tweaks and be content with it getting the job done.

PS: Brian, I wanted to visit your blog but your profile is blocked. Thanks again for the help

Thursday, April 30, 2009

how to change ktimetracker systray icon

My recent switch from gnome to fluxbox has been a happy improvement save one small detail. I had really gotten used to using the gnome-panel applets but I didn't want to muddy up fluxbox with the gnome-panel (even though you can run it as a subset). Long story short I found there was no good way to run gnome-panel applets without running gnome-panel and I started to look for new applications to fill the void.

Enter ktimetracker. ktimetracker is a handy kde application that can be run standalone. It offers a simple way to create tasks and track time against them. As an added bonus, the system tray icon for ktimetracker animates a clock moving when ktimetracker is tracking time against a task. The only downside is that the icon was small and it was hard to tell when it was animated and when it was stopped.

I found the icons used in the system tray as a bunch of xpms (active-icon-*.xpm) in /usr/share/kde4/apps/ktimetracker/pics . I figured if I changed the icons and restarted ktimetracker I'd be able to see the new system tray icon, but I was only partially right.

I replaced the icons and the system tray didn't change until I had rebooted the system a few time. I still have no idea why it switched (or why it didn't switch immediately) but at least I know where I can go to customize it.

Tuesday, April 28, 2009

why you should avoid putting Ubuntu Jaunty on a t60p

I excitedly installed the newest version of Ubuntu on my t60p and found out the following unfortunate facts.

1) The t60p (and many other tSeries laptops) have the Mobility FireGL V5250 video card
2) Catalyst (ATI driver) delayed the delivery of the 9.3 driver to cram as much function into it as they could. The reason they did this was because 9.3 was the final driver to support the Mobility FireGL V5250 video card along with a plethora of other cards. (Full list of unsupported cards here)
3) Ubuntu Jaunty makes use of xorg-xserver 1.6 which only supports the 9.4+ version of the Catalyst ATI driver

All this ends up meaning that the warning Jaunty throws when you try to update with an Mobility FireGL V5250 video card means a lot more than there will be degraded graphics after the update. The only driver that will work with xorg-xserver 1.6 is the Radeon opensource driver for ATI cards.

I'm a big fan of opensource, but the Radeon driver are just not ready for primetime. There is no 2d acceleration which means all the compositing and pretty graphics are gone. Since switching to Jaunty and the Radeon drivers I've noticed a serious drop in performance doing standard things like moving windows and switching desktops.

On the upside: moving away from the Catalyst drivers (fglrx) re-enabled suspend / resume on my laptop. I've also started using fluxbox again (http://www.fluxbox.org).

The only noticeable update from Ibex to Jaunty has been the network manager and the new libnotify. The NetworkManager does a pretty good job of making sure I'm connected anyway it can connect me. The new libnotify insert message snippets into the pidgin and xchat notifications I get (which is nice).

If you are happy with Ibex, stay with Ibex until the radeon driver improves or someone backports support for the Catalyst 9.3 fglrx driver into xorg-xserver 1.6.

Tuesday, January 20, 2009

how to stretch standard definition broadcasts on a charter digital tuner

I recently bought a nice HD tv that was without a QAM tuner. QAM tuners are what allow you to watch the free HD channels while your TV is connect to cable. You can learn more about QAM at wikipedia.

I got a digital tuner box (also known as a set top box) from charter so I could get access to the HD channels. The box worked like a charm but it displayed all standard definition programming as a 16:9 feed with black bars on the side. My TV couldn't zoom or stretch the signal since it was already in 16:9.

There were no options on the remote or in the charter menu that would set the display size. After some poking I found the User Guide for DCH6200 which is the set top box I had.

All the output options for the box are hidden in a secret menu you access by shutting off the box and hitting the menu button in rapid succession. Once the hidden menu is up you can select 480p to send standard definition as a 480p signal that the TV can stretch or display however you'd like.

Its a shame that the menu is hidden and charter didn't send the user manual with the box, but it works pretty well now that I know what I'm doing.

Thursday, July 31, 2008

to catch everyone up to speed

For those of you who haven't noticed the little box to the right of this entry, I've started to use twitter to post the little tidbits I see every day. I started using it because there was a way to post from an IM client. I'll be using it even more in the future (more on that later).

Its been so long since I've written anything here my firefox awesome-bar (new feature in firefox 3... if you don't have it you should) didn't even remember the url. So let me catch up a bit by posting not one, not two, but three whole things I learned today.

In no particular order:

My laptop is awesome : The moment I got home I poured myself a nice tall glass of iced tea and settled in to do some interneting. Or at least that was the intent... Instead I poured a nice tall glass of iced tea and then spent the next ten minutes trying to clean the tea off the floor and my laptop. The laptop was fine and the floor cleaned up nicely. Lets here it for ThinkPads... you can drop them, you can spill stuff on them, you can own them for years without an upgrade. (NOTE: dropping, spilling, and lack of upgrading not recommended

My car is awesome : For the last month or so my car has made the most hideous noise whenever I started it moving or went over a bump or roll in the road. I figured something in the suspension was messed up and took it in to get it checked out. One free inspection (For the record, CarX rules) later and my car was given a clean bill of health. Nothing seems wrong, there are no signs of damage, and everything else checks out. Shame the noise is still there.

Resistance is futile : This I almost hate to admit... I'm not an Apple fan. While I have nothing against their technological direction on a theoretical level, I've never been a fan of any of their products. It was sort of a, "wow thats kinda cool, but really not for me." The interface has always taken a back seat to the function and customization other technologies have presented.

That said... I've been looking for an all-in-one gadget to handle gps, social camera (you know... something point and shooty for taking snapshots of friends doing something stupid in a social setting), mp3s, and phone calls. Right now, the iphone is the best (or certainly the most popular) thing on the market. So in 10 to 21 days I'll be the some what hesitant owner of a brand new iPhone. I hope it lives up to the hype.

Thats all from here. I'll post a lessons learned once I start playing with the iphone.

Wednesday, July 16, 2008

that rock concerts aren't about the music

Some friends went to a Puddle of Mud / Saving Abel / Rev Theory concert and I tagged along. I know none of these bands are really hardcore but they are a lot heavier than the music I normally listen to.

The venue was pretty small and we had general admission tickets. The first few bands were good. They were loud (as you might expect) but ear plugs kept it manageable. Stuff started to get crazy when the headliners came out.

I managed to work my way to the front group of people that were standing near the stage. The crowd seemed to ebb and flow sporadically, so I just got used to getting pushed and pushing back. After a couple of really strong pushes from behind I turned around and discovered that I was part of the wall of the mosh pit.

I started deflecting moshers away from the group of girls that were next to me. One of the girl's boyfriends and I managed to direct most of the stuff away from our area. Two guys came barreling into me and caught me off balance. I fell into someone who promptly launched all three of us back into the mosh pit.

I was still in the air when I hit the far wall of the pit. The wall, who was really just one guy wearing a backwards baseball cap and a polo, sent me back the way I came. At this point I figured I might as well just go with the flow. I pinballed a few times (thank you middle school bullies for the practice) before someone put a death grip on my leg and I had to stop moving to make sure I didn't fall over.

Ah... good times... good times...

The rest of the concert was spent watching people be people at a rock concert. Oh! and I caught a pick from the guitarist with my elbow. "If you can't be good, be lucky"

Wednesday, July 2, 2008

its funnier in japanese

I caught wipeout on ABC.com and had some high hopes for it. I'm a huge fan of Japanese game shows and was hoping for more of the same. I think it looses something when you can understand what they are actually saying.

Did the pushups quicker than I normally do 'cause my collar bone seemed to be popping when I did them slowly. Not really sure what to make of that. On the upside, the quicker pace meant I could hit a new max. Go me!

Today's score card : 16 - 13 - 11 - 11 - 25
Current Max : 25
Total to date : 429

Monday, June 30, 2008

Week 2 day 1

Looks like Week 2 starts with another warmup round. This one didn't do too badly. Probably a good thing... its already been a long week and its monday.


Today's score card : 12 - 12 - 9 - 7 - 12
Current Max : 19
Total to date : 353

Friday, June 27, 2008

that muscles are tiny motors running on strings

Again, it pays to know people who know more than you do. Title says it all.

Day 3 came and went. I didn't the set without too many issues. Its nice to see progress. Still haven't felt like any of the sports I play are easier, but week 1 is in the books and its been fun. Monday starts week 2.

Today's score card : 15 - 13 - 10 - 10 - 15
Current Max : 19
Total to date : 301

Wednesday, June 25, 2008

that it pays to know people

I went rollerblading with a friend last night that has spent some time as a personal trainer. Its amazing what you can learn from your friends.

Apparently the trick to pushups is to put a book under your stomach. When you hit the book you know you can start pushing up. Also, having your stomach hit the book keeps you thinking about it and you'll keep it tighter. My stomach was a little sore by the time I finished.

I think once I'm done with this program I'll switch to the other exercise I learned about. Get two dumbells and use them as handles as you do a push up. Then alternate: 1 push up, 1 left handed single hand row, 1 push up, 1 right handed single hand row. That will handle arms, pecs, back, stomach, and obliques.

Today's score card : 12 - 12 - 10 - 10 - 14
Current Max : 19
Total to date : 238

Tuesday, June 24, 2008

Day 1 (again)

I redid day 1 last night to get everything back on an even keel. Amazing how much easier it was to rattle them off.

It probably would have been a lot easier, but I was in a rush and didn't really take the recommended 60 - 90 second break between sets.

I'm posting late, but I did do all the work last night

Today's score card : 10 - 10 - 8 - 6 - 11
Current Max : 19
Total to date : 180

Friday, June 20, 2008

Persistance pays

Day 2 Week 1

I finished off the day, but that second set almost didn't make it. I also don't think I'm doing a full push up.

I'll be taking the next two days off and restarting week 1 on Monday. This will get me on a more manageable schedule and also give me a chance to do the week with some better form.

Today's score card : 12 - 12 - 10 - 10 - 15
Current Max : 19
Total to date : 135

Wednesday, June 18, 2008

that push-ups hurt

Day 1 (again)

So trying to do day 1 after the initial test wasn't a smart move. Initial set is 10 - 10 - 6 - 8 - max. Assuming the initial 19 were the first rep I made 19 - 10 - 6.

Started day 1 (again) and I was already sore. This doesn't bode well.

Handy note: Use a door jam to stretch before and after. It feels good and should help flexibility. Now if I could only figure out a way to make my wrists stop hurting.

Today's score card : 10 - 10 - 8 - 6 - 7
Current Max : 19
Total to date : 76

Monday, June 16, 2008

to push up?

I've taken a bit of a break from this site. I'm not going to apologize 'cause its not going to fix anything.

... sorta ...

Justin twitter'ed about this : http://hundredpushups.com/challenge.html and I'm up for the challenge. I was thinking about starting stomache torture anyways.

I'll try to keep a running report on here. If I'm accountable online I might actually see the thing till the end. With that said, the posts are going to be short and sweet three times a week for the next six weeks.

Initial test : 19 pushups (20, but I didn't want to push it too badly).
I'm going to try to do day 1 of the training today just so I'm on a good Monday - Wednesday - Friday schedule. I'll post on Wednesday about if this was a good idea or not.

Wish me luck...