Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Wednesday, March 17, 2010

Sansa Clip and Karmic

Upon upgrade to Karmic Koala Ubuntu (9.10), my trusty Sansa Clip player was not autodetecting like it did under the Ubuntu distribution I was previously using. So I scoured the web and found this site which gives a workaround: when the Sansa Clip is disconnected, go to Settings->USB Mode on the Sansa Clip and set it to MSC. It should now present itself to the computer as a normal file system. Unless, of course, the file system is screwed up, in which case you'll have to go to Settings->Format and format the Sansa Clip drive before connecting it again.

Friday, April 04, 2008

Searching SVN trees with Ack (for Ruby on Ubuntu)

Searching through a subversion tree with grep is a pain in the ass. It wastes time searching through files I don't want to look into and its syntax is inconvenient for the task. Fortunately, there is a tool called ack which is suited specifically for matching text in VCS trees (including svn trees). Here's how to set it up on Ubuntu Gutsy (apparently you won't need to do all this in the next Ubuntu release; there's a package for Hardy).

First, you're going to need some relevant libraries. sudo apt-get install perl-doc to start. Next, download the File-Next archive from CPAN. Extract the archive and cd into the directory, then use the series of commands perl Makefile.PL && make && make test && sudo make install to install it.

Now for ack itself. svn checkout http://ack.googlecode.com/svn/trunk/ ack-read-only to checkout the source tree from Google Code and cd into the directory. Now if you want to edit some of the types that are built into the program, here's where to do it. For example, I want to also search for haml files with the --ruby flag. I grep -R rhtml * to see that four files (actually, less, but let's go ahead and edit all of them anyways...) require modification. The ruby line in Ack.pm, for instance, now reads ruby => [qw( rb rhtml rjs rxml erb haml )]. (Types can also be set on the command line using the --type-add and --type-set flags). Once you're finished tweaking types, use the same perl Makefile.PL && make && make test && sudo make install command to install ack.

For extra credit, you can also add flags to a ~/.ackrc file that get executed upon each invocation of ack. Personally, I add the --ruby flag because it seems to be that .rb, .haml and .rhtml files are all that I'm searching for these days.

And voila! Now a simple ack -f gives me a listing of all the ruby files in my svn tree (and no vi swp files, svn files, log files, etc.). ack "regex" returns a grep-like search of the relevant parts of the subversion tree with the parts of the line that matched the regex highlighted. SWEET! Get more information on the command line with ack --help for more help, ack --help type for a listing of matching types.

Do you know how hard this would have been with find/grep/xargs? Well, tough. grep -RE "regex" * | grep -v svn | grep -v log | ...etc... searches all files in the tree and might exclude matching lines if the contain one of the strings being filtered out by the later grep instances. That syntax can be improved to a alternating regular expression with grep -RE "regex" * | grep -v -E \(log\|svn\) but it still has the same problems. grep also has an --exclude flag which can exclude certain filenames that match a glob from being searched (although the manpage would seem to imply otherwise), but it doesn't have regex capabilities. So maybe we can use find and xargs? Nope, a svn tree output will kill xargs, which will compain that the "argument line is too long" if too much gets sent to it: grep -E "regex" `find . -regex '.*\.\(rhtml\|rb\|haml\)' | xargs -0` Perhaps find's --exec flag could be of use? Well, only if you want to kill your computer with the overhead of creating a new grep process and forking and context switching a couple times (etc.) upon each file match... find . -regex "regex" -exec grep -E "regex" '{}' \; will really do your cpu in. Then there's the cumbersome grep -E "regex" $(find . -regex "regex" | grep -vE \(log\|svn\)) ... well, let's just say I'm glad I found ack at this point.

UPDATE:
Put --type-add=ruby=.haml in your .ackrc to add haml as a type dynamically.

Sunday, March 30, 2008

Amazon's Music Store on Ubuntu Gutsy

Unfortunately, there are some CDs that are so obscure nobody is seeding them on BitTorrent. One of these happens to be Hicksville by Celtic Cross. I decided to give the Amazon Music Store, where this CD is available for purchase, a shot.

On Ubuntu Gutsy, there are a few things you need to do to make this work. The first, of course, is to download the .deb package from this page. Install that with sudo dpkg -i amazonmp3.deb or sudo dpkg --force-architecture -i amazonmp3.deb if on a 64 bit system. You're also going to need a few Boost libraries: sudo apt-get install libboost-date-time1.34.1 libboost-thread1.34.1 libboost-iostreams1.34.1 libboost-signals1.34.1 If you're on a 32 bit system, launching the /usr/bin/amazonmp3 binary should now work (it also inserts an entry in the GNOME panel under Applications->Internet).

But for all you 64-bit'ers out there, there's a bit more work to do. Launching the binary fails with the message "amazonmp3: error while loading shared libraries: libgtkmm-2.4.so.1: cannot open shared object file: No such file or directory". This is because amazonmp3 needs 32 bit libraries, not 64 bit ones (see this thread). Download getlibs, a bash script which installs 32 bit versions of libraries on 64 bit systems. Install the package with sudo dpkg -i getlibs-all.deb and then run getlibs /usr/bin/amazonmp3 to install the 32 bit libraries. The program should now run without error.

The application, by the way, is quite minimalistic. I don't know why they put users through this trouble and don't just send you a tarball of the music files. I guess there might be some reason on other platforms where it integrates with other applications... not on Linux, though!

Wednesday, October 24, 2007

Gutsy (Ubuntu 7.10) Tweaks

Just upgraded to Gutsy from within Feisty, which took about an hour, and things look great, for the most part. But here's a few things just to make sure everything was in tip-top shape:
  • To enable Compiz Fusion, System->Preferences->Appearance->Visual Effects->Extra
  • Gutsy doesn't ship with the Compiz Fusion settings manager, and I wanted my old (Beryl) settings back... run sudo apt-get install compizconfig-settings-manager in a terminal to install it and ccsm in a terminal to launch it
    • Don't forget to create a new profile in Preferences or else you'll be screwing with the default settings
    • Personally, from the defaults I enable Rotate Cube, Paint fire, Water effect, Wobbly windows, Annotate, Splash, Cube Caps, Shift Switcher; I disable Expo; I tweak Desktop Cube (General->Multi Output Mode->One Big Cube) and Animations
  • Fonts on my system were oddly stretched out vertically. Here's a solution from this thread: edit the line in /etc/gdm/gdm.conf that says -command=/usr/bin/X -br -audit 0 to say -command=/usr/bin/X -br -audit 0 -dpi 96
  • The fonts still look a little screwy. I'm just going to bite the bullet and install the MS core fonts ... a HOWTO is here.
  • Download updates automatically in the background: System->Administration->Software Sources->Updates->Download all updates in the background
  • Synchronize your clock to NTP servers sudo apt-get install ntp
  • Autohide pannels: Right click on a panel->Properties->Autohide
    • Set how much of a panel can be seen when it is hidden: link

Friday, April 20, 2007

Feisty Fawn customization

Here are the things I did after I installed Feisty Fawn Ubuntu 7.04 off of the alternate install CD on my Compaq X1000 laptop/other systems.

If on an AMD64 processor system
  • Follow these instructions (and run the script) to get mplayer, flash and java support for firefox. Update all launchers and shortcuts to launch firefox32 instead of firefox
  • Skip the remaining instructions that are italicized

Install add-on packages (by the way, all except the first can be done in one command... just append all the packages you want to install after "install")

  • Edit /etc/apt/sources.list following these instructions to add extra repositories
  • Install full Vim support (without this, no help, syntax highlighting, etc.) sudo aptitude install vim-full
  • Install Flash sudo aptitude install flashplugin-nonfree
  • Install media codecs sudo aptitude install gstreamer0.10-ffmpeg gstreamer0.10-gl gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse w32codecs
  • Install Amarok sudo aptitude install amarok
  • Install Java sudo aptitude install sun-java6-jre sun-java6-plugin sun-java6-fonts
  • Install Azureus sudo aptitude install azureus (or, alternatively, ktorrent)
  • Enable DVD support
  • Possible user programs: xmms, xchat, mplayer plugin, vlc, skype, picasa, eclipse, google earth, beagle, clipboard manager
  • Security programs: sudo aptitude install nmap kismet wireshark airsnort aircrack-ng john
  • Install Beryl (nVidia) (I also find it convinient to add a sessions entry for beryl-manager so the stone shows up in the tray)
Trick out Firefox
Trick out the Terminal (and partners in crime)
  • Either create a new profile or edit the current profile
  • Disable General->Show menubar by default in new terminals
  • Set Colors to aesthetically pleasing values
  • Set Effects->Transparent background and set the bar about 2/3 of the way to Maximum
  • Set Scrolling->Scrollback to 2000 lines
  • Edit ~/.bashrc
  • Edit ~/.vimrc
  • Put the line set editing-mode vi in ~/.inputrc (the configuration file for readline... this also makes the set -o vi in the .bashrc redundant)
Trick out GNOME
  • Fix the Right Alt key System->Preferences->Keyboard->Layout Options->Third level choosers->Press Menu Key to Choose 3rd Level
  • Change the Desktop Background by right clicking on it (good backgrounds here (OSX Tiger) and here (fractals) and at DeviantArt)
  • Map the Windows keys to do something cool in System->Preferences->Keyboard Shortcuts (I think "Run a terminal" and "Hide all windows and focus desktop" are good candidates)
  • Enable visual system beep System->Preferences->Sound->System Beep->Flash Window Titlebar
  • Make the panels transparent Right Click on Panel->Properties->Background->Solid Color and adjust the slider appropriately (about halfway looks good)
  • Add the system monitor to the panel Right Click on Panel->Add to Panel->System & Hardware->System Monitor->Add to Panel (I enable all but "Load"... wtf is load?)
  • Disable launching of unnecessary programs at startup (such as Evolution Alarm Notifier) Preferences->Sessions->Startup Programs
  • Save your session in a desireable state: gnome-session-save (don't use the automatic option in Prefs->Sessions... it causes problems!)
  • Put the panels in a desirable place by dragging them across the screen
  • Get 4 workspaces Right Click on Workspaces on Panel->Preferences->Number of Workspaces
  • Disable Rhythmbox launching upon iPod detection (Amarok rulez!) System->Preferences->Removable Drives and Media->Multimedia->Uncheck "Play Music Files when Connected" and also Uncheck Storage->"Browse removable media when inserted"
  • Enable the text-based location bar in Nautilus (in favor of the button-based one) by hitting the notepad button on the top left in a Nautilus window
If on a laptop...
So what's so different about Feisty (as opposed to Edgy)?
  • All the latest stable versions of software in the repos, obviously
  • GNOME network manager manages wireless devices by default (and keyring support to boot)
  • Fool-proof support for installing restricted drivers, media codecs, etc.
  • Nice command line assistance if you try and run software that's not installed (prints a "use this repository and this command to get the software"-type message)
  • Easy enabling of "Desktop Effects"
  • And more

Thursday, April 19, 2007

iPod + Amarok

Using your iPod with Ubuntu is disgustingly easy. As a Linux user, I was almost disappointed... no config files to edit? No dependencies to chase down? No bugs to fix? Nope, Ubuntu and the Amarok music player make everything simple. Here, I will detail how to use Amarok with your iPod on an Ubuntu system. I'm using Ubuntu Feisty Fawn 7.04 (just installed today!), a fourth-generation iPod and Amarok version 1.4.5.

First install Amarok with sudo aptitude install amarok (and with aptitude, not apt-get). If you want Amarok to be useful with most file formats (such as mp3) it would be a good idea to install proprietary codecs as well: sudo aptitude install gstreamer0.10-ffmpeg gstreamer0.10-gl gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse libxine-extracodecs w32codecs

Now that those monster installs are finished, you can go ahead and connect your iPod. If it automatically shows up on your desktop as a little iPod icon, great! If not, check out
this thread for more detailed info. When I popped in my iPod, Amarok did me one better and recognized the device, popping up a little dialog asking me what kind of player it was. When this happens, you should select Apple iPod Media Device in the drop-down box. There are a few more options you can set regarding the device -- check out Settings->Configure Amarok->Media Devices in the Amarok toolbar menu. (If this explanation was too complicated for you, there's a guide with nice pictures here describing a slightly different way of going about things.)

To add files to the iPod, go to the Collection tab on the left and highlight whatever you want to transfer to the iPod in the left frame. Right click on it and select Transfer to Media Device. Then go to the Devices tab (with the little iPod logo) and hit Transfer at the top to transfer your files. When you're done transferring files, hit Disconnect at the top. If you're lucky, Amarok will unmount the device for you. If not, you'll have to right click on the desktop icon of the iPod and unmount it that way. I asked in the Amarok IRC channel if it was possible to sync the iPod and apparently it's not... for now, just delete everything off of the iPod and put the new stuff back on, as time consuming as that may be.

There are some other things you can do in Amarok to tweak the settings for the iPod. In the Devices tab under the (usually hidden) iPod menu you can set the model of your iPod. This is used for advanced support such as photo and video copying.

It's annoying that Rhythmbox, the default GNOME music application, launches whenever you connect your iPod. To disable this, go to Preferences->Removable Drives and Media->Multimedia->Portable Music Players and disable Play music files when connected. Just doing this will make a window open up in Nautilus every time you insert a removable drive, including an iPod. To turn this off, go to the Storage tab and uncheck Browse removable media when inserted.

Links

Wednesday, March 07, 2007

Which Ubuntu version am I using, again?

On the command line: lsb_release -a

Alternatively, look in one of these two files for the answer (links to sources where I found info): /etc/lsb-release or /etc/issue

Also, find out if your install is 64-bit via uname -m (thread1, thread2).

Tuesday, March 06, 2007

Connecting to servers in Ubuntu with "Connect to Server..."

I don't know how this has eluded me for so long, but there is actually a very nice interface built into Ubuntu that allows you to connect to servers using any of the following protocols: ftp, ssh, windows share, WebDAV (http), Secure WebDAV (https), and more. This is a nice alternative to using third party software like FireFTP (even though that program rocks) or the command line.

Simply pulling down the Places->Connect to Server... option in GNOME opens a dialog box which allows you to enter the appropriate information about the server you want to connect to. After the connection is successful, a folder representing the remote file system will appear on both the Desktop and in the Places menu. Another nice feature is that the folder even has some little letters on it telling you what protocol it is connecting over. You can now drag and drop files via the Nautilus interface, as if the directory was local. How convenient!

This tip found via the free online book Ubuntu Linux Bible. (Reviews on Amazon) By the way, this is an incredibly comprehensive reference on all things that an end user might want to do on Ubuntu. It also has sections on setting up subversion, using LaTeX, setting up other servers such as Apache, multimedia usage, and just about everything else. UPDATE: Whoops! This actually got posted by mistake by Lifehacker... the book has been taken down... it's still a good book, though!

UPDATE: For some more (unrelated) GNOME fun, right click on an icon and select "Stretch Icon" to blow up the icon to a cartoonish size. Click "Restore Icon's Original Size" in the same menu if you get tired of it (which you will, after 2 seconds).

Thursday, January 04, 2007

HOWTO Starcraft/Brood War on Ubuntu Linux Edgy Eft with Wine

One of the (very very very) few things for which I use my Windows partition anymore is playing Starcraft /Brood War. Of course, as anyone that dual-boots knows, restarting your machine just for one Windows application and then back to Linux is highly annoying and time-consuming. One solution to running Windows apps on Linux is Wine, which I will describe how to configure to play SC/BW in this post. I'm using Ubuntu 6.10 (Edgy Eft). Thanks to JTerry for his help with this.

First, you're going to need a few things. Open a terminal and run sudo apt-get install wine to get wine. After that finishes, insert the Starcraft CD. cd to whatever cdrom drive you put the cd in (under the /media/ directory). Use Wine to setup SC with wine setup.exe. You'll get the install screen for SC -- enter your CD key and install the software. The SC executable will be installed under the path of ~/.wine/drive_c/Program\ Files/Starcraft/starcraft.exe. If you try and play SC now, you might notice that the sound does not work. Run winecfg and go to the Audio tab. Set Hardware Acceleration to Emulation. The sound should now work fine. If you want to play Brood War, read on; if not, skip to the next paragraph. Eject the SC CD and insert the BW CD. Again, cd to the appropriate /media/ directory and run wine setup.exe. To play SC/BW, run wine ~/.wine/drive_c/Program\ Files/Starcraft/starcraft.exe.

Playing online over Battle.net requires a little bit more work. First, you'll need the proper fonts that Battle.net uses... sudo apt-get install msttcorefonts for this. You'll also need the newest patch for Battle.net which updates BW to version 1.14. Get this patch here (other patches, for instance for regular SC, can be found here). Use wine to run the downloaded file, BW-114.exe. An updater should run, after which you'll be able to play online using Battle.net. It works, but all is not perfect -- the display of the Battle.net interface is kind of screwed up (it never refreshes when you change views). However, if you're familiar with the Battle.net interface you should be able to get into a game after which SC/BW runs without a hitch.

Some tips: tweak your mouse sensitivity and acceleration to play SC/BW. It runs at a low resolution and your cursor will be uncontrollably flying all over the place if you don't. Change this in System->Preferences->Mouse->Motion. Also, sometimes (rarely) the screen resolution doesn't change back to what you had it at before playing SC/BW. Change this in the System->Preferences->Screen Resolution menu. If you hear a lot of static from your speakers, try switching from OSS to ALSA in winecfg->Audio.

More information on this topic can be found at the Wine Application Database page for SC/BW.

Update: here's another good page on Ubuntu forums

Another update: yet another good page from the Ubuntu community detailing how to enable the 'no CD' patch

Thursday, December 21, 2006

Static IPs in Debian-based Linux

Here's a brief overview of how to set up an internet connection using a static IP address on Debian-based Linux systems. Most large networks nowadays use DHCP to get a user an IP address, but knowledge of static IP configuration can still be helpful in a lot of situations. First, edit the /etc/network/interfaces file as a superuser so that the entry for the desired interface looks something like this (replace x's with numeric values):

iface eth0 inet static # static, as opposed to dhcp... replace eth0 with desired interface
address xxx.xxx.xxx.xxx # ip address you want assigned to this computer
netmask xxx.xxx.xxx.xxx # subnet mask
network xxx.xxx.xxx.xxx # optional
broadcast xxx.xxx.xxx.xxx # optional
gateway xxx.xxx.xxx.xxx # gateway (usually router/firewall) ip address

Once you have done this, restart your network interfaces with sudo /etc/init.d/networking restart

The gateway can also be specified on the command line if it's not in the interfaces file: sudo route add default gw xxx.xxx.xxx.xxx The command netstat -nr can show the routes, including gateways, that the kernel is currently using.

To explicitly release a dhcp connection, do something like dhclient -r eth0

If your computer and network is set up correctly, you should now be able to ping your gateway and access sites on the internet by IP address. However, in order to access sites by name you need the help of DNS. Add entries to the /etc/resolv.conf file as a superuser in this format (you can have as many as you want):

nameserver xxx.xxx.xxx.xxx

Now, if you point your browser to a domain name like www.yahoo.com, you should be able to get there. Welcome to t3h 1nt3rw3b. You can also do all the above by accessing the System->Administration->Network menu.

Links:
Update (in light of ubuntu-users post and responses):
For switching from one interface configuration to another (assuming eth0 and correct /etc/network/interfaces):
  1. sudo ifdown eth0
  2. edit /etc/network/interfaces
  3. sudo ifup eth0
SIOCDELRT: No such process means something is screwy. You probably have the wrong number (i.e. gateway) somewhere. Haven't determined exactly what this means.

Saturday, October 21, 2006

Linux PCI Wireless cards (and the bcm43xx driver)

It's a pain in the butt when manufacturers of PCI wireless cards don't release a driver to go with their hardware. Case in point: broadcom, whose card I purchased. Luckily, there is a hacked driver available from the community.

Links:

Note to self: whatever I do, do NOT use ndiswrapper for wireless drivers. All the kernel hackers tell me it's bad... and, they were right. I believe it attempts to load the Windows driver on top of a layer that enables the cooperation of the hardware and the Windows driver. When I tried to use it, it crashed GNOME. Grrr...

The jury's out on whether this actually works or not (I have yet to get this desktop in range of a usable wireless signal) but I can iwlist eth0 scan for stuff and get results back so I'm optimistic...

Update: this thing works (most of the time). Sometimes it will inexplicably lose the signal and I'll have to connect again. Not the biggest deal in the world, but still pretty annoying.

Thursday, September 14, 2006

Ubuntu System Beep

Hate the system beep? Get rid of it with rmmod pcspkr
Nostalgic for the system beep? Bring it back with modprobe pcspkr

Tip from: Lifehacker's top 10 Ubuntu tips and tweaks

Also, you can find it in GNOME at System->Preferences->Sound->System Beep