Archive

Archive for the ‘technology’ Category

Ubuntu: Resizing Virtual Screen in X11

April 22nd, 2010 1 comment
Number of Views: 23

Thanks to a little surplus grant money, I was able to purchase a nice, large, external monitor for my office.  With my docking station, that meant I could use two monitors simultaneously – my laptop monitor and my external monitor.  I had been doing this previously, but the external monitor I had before was about the same size as my laptop monitor (15″), so setting it up using dual monitors in Ubuntu was relatively easy.  But the new monitor is, well, huge (28″) and has a much higher native resolution – 1920×1200 vs. 1024×768.  I had two problems when initially trying to set up my new dual monitor system.  First, X11 wasn’t correctly detecting the possible resolutions for the monitor – it only allowed resolutions up to 1024×768.  Second, X11, when I first set up the dual monitor system, created a default virtual monitor that was 2048×768, which basically meant that I couldn’t go any larger than that.  As it turns out, solving the second problem solved the first problem for me.  Keep in mind that I’m using Ubuntu 9.04 on my laptop because of some other X11 problems that 9.10 had when I first tried it out.

Here’s how I solved this.  In a terminal, I input the command to modify the X11 configuration file:

$ sudo gedit /etc/X11/xorg.conf

Technically you should always back this up before you mess with it, but I didn’t this time around as I knew I was just going to change one thing and figured I could always change it back if there was a problem.

In the “screen” section of the xorg.conf file, it said:

Section “Screen”
Identifier    ”Default Screen”
Monitor        ”Configured Monitor”
Device        ”Configured Video Device”
SubSection “Display”
Virtual    2048 768
EndSubSection
EndSection

I changed the settings for “virtual” to: 2944 1200, which is the maximum width and height of my new monitor combined with my laptop monitor (width – 1920+1024=2944; height – 1200 encompasses 768, so I went with 1200).  So my new xorg.conf file looked like this:

Section “Screen”
Identifier    ”Default Screen”
Monitor        ”Configured Monitor”
Device        ”Configured Video Device”
SubSection “Display”
Virtual    2944 1200
EndSubSection
EndSection

Once I changed this, I logged out, then logged back in.  Then using the “Display” tool (System->Preferences->Display), I selected my 28″ monitor and found that the maximum resolutions were now available.  I chose the correct one – 1920×1200, and hit apply.  Et voila, my dual monitors are now using their maximum resolution.  I think the video card in my laptop is freaking out trying to handle this resolution, but it works!

Categories: technology Tags: ,

Ubuntu: Securely Erase Hard Drive with “shred”

January 17th, 2010 No comments
Number of Views: 49

On Windows, I used the free program Eraser to wipe hard drives when I was finished with them. I looked for a while for something similar for Ubuntu Linux but couldn’t find any programs like Eraser.  Turns out, however, that this functionality is built into the operating system, though it is command-line only.  Here’s an example of the command with an explanation following:

# shred -vfz -n 100 /dev/hda

Here’s what this does.  The # sign is the command prompt.  “shred” is the command that tells the operating system that you want to not only erase all the files on the drive but also to over-write those files with random bits.  The “f” in the “-vfz” command forces the write by changing the permissions on the drive wherever necessary.  The “z” in the “-vfz” command writes zeros to the drive.  The “-n” command is followed by a number (“100″ in the example above).  This tells the operating system how many times to write random data to the drive.  The more times you write over the data you had on the drive, the lower the odds that someone will be able to recover your files.  Writing over your data 100 times is likely overkill; 3 to 5 times is how many times I typically wrote over data using Eraser (which does the same thing).  Finally, the “/dev/hda” portion of the command tells the computer which drive to wipe.

If you are wiping your primary drive, you’ll need to boot into Ubuntu (or some other brand of Linux) using a live disc then open a terminal and type the above command.  Otherwise, the primary hard drive will be from where the operating system is running,which means you won’t be able to issue the command.  There is, apparently, a disc image you can download that makes wiping the primary drive quite easy: Darik’s Boot and Nuke or DBAN.  It’s basically like booting using the live disc, but the sole purpose of DBAN is to wipe the drive.

If you’re wiping an external drive, you just need to know the letter of the drive, and can then swap that out in the command (e.g., “/dev/hdc” or “/dev/hds”).  You can figure this out by looking in the “dev” folder or by using gparted.  Just make sure you get the right drive; you don’t want to try wiping your primary drive or any other important information.

For those reading this who don’t know why you would want to securely delete your files, here’s the rationale: just deleting files on a hard drive doesn’t mean someone can’t recover them.  I’ve recovered deleted files for students from their hard drives and from thumb drives numerous times; it just requires a little technical know-how.  This is much more difficult using EXT4, the Linux file system, but quite easy using NTFS, the default file system of Windows (or FAT32). But there are things you can do to pretty securely erase files from a hard drive.  What this program does is erase the files on the drive and overwrite that data with random data.  You would do this if you: (1) had files on your drive you deleted that you don’t want anyone else to be able to recover; or (2) you were giving away or selling your hard drive to someone else (e.g., on Ebay) and didn’t want them to have access to any of your files.  I did this to the hard drive of a laptop I recently sold on Ebay to ensure that they couldn’t recover my data.

Oh, and one more thing, the above instructions come from here.  I reposted them here with additional instructions so I’ll have it for future reference.

Categories: technology Tags: ,

remove apostrophes before numbers in OpenOffice Calc

November 29th, 2009 26 comments
Number of Views: 486

The Problem:

You have a spreadsheet that has a column of what you think are numbers in it.  The numbers display fine in their cells, but when you try to do something with them, you find that you can’t.  For example, you may want to sort them or use them as part of a calculation and it doesn’t work.  Here is a screenshot illustrating that the numbers look like numbers in their cells:

apostrophe problem - 01

If you click on one of the cells, you’ll see that the numbers actually have a hidden apostrophe in front of them, like you see in this screenshot:

apostrophe problem - 02

After spending some time on the internet, I finally found out what is going on.  While you think those are numbers, the apostrophe is Calc’s way of saying that the numbers you see are to be treated as text, but they are in a cell that is formatted as a “number.”  You can verify this by right-clicking on the cell, selecting “Format cells” and then clicking on the “Numbers” tab, as illustrated in the screenshots below:

apostrophe problem - 03

apostrophe problem - 04

So, the spreadsheet program is treating a series of number as text in a cell formatted as numbers.  Talk about aggravating.

The Solution:

There is a solution for this.  It involves a “find and replace” function.  From the “Edit” menu, choose “Find & Replace.”  In the “Find” box, type “^.” (i.e., carat + period).  In the “Replace” box, type “&” (without the quotes, of course).  But you have to do one more thing for this to work.  At the bottom of the “Find & Replace” window you’ll see a button that says “More Options.”   Click on it, then select the box next to “Regular Expressions.”  You should now have a “Find & Replace” box that looks like this:

apostrophe problem - 05

Now, hit “Replace All” and all of your apostrophes will disappear.  Your series of numbers will now be seen as numbers by your spreadsheet program and will be in cells formatted as number cells.  Problem solved.

Notes:

I actually don’t know how/why this works, but it does.  I found the solution here.

Categories: technology Tags:

Ubuntu: How to save handouts in OpenOffice Impress as PDFs

September 6th, 2009 1 comment
Number of Views: 32

I’m not a computer programmer (sometimes I wish I was), so I’m going to guess that implementing the ability to save handouts as PDFs in OpenOffice.org’s Impress (OpenOffice’s version of Powerpoint) may be a very challenging programming task.  For those who have never used OpenOffice, one of its greatest features is the built-in ability to save documents as PDFs.  You can save your slides in Impress as PDFs, but if you want to put multiple slides on one page with lines for notes for your students (which is what I do with my discussion notes), there isn’t a way to directly export those handouts as PDFs.  You can customize the handouts, which is a very nice feature, but you can’t save them to PDF.

However, there is a way to work around this limitation.  It’s actually quite simple, but it took me about 30 minutes to figure out.  So, here’s another Ubuntu how to.

First, you need to install a PDF printer in Ubuntu.  This is actually quite easy, though I recommend you do it from the command line as it is even easier this way.  So, pull up a terminal and type:

sudo apt-get install cups-pdf
mkdir ~/PDF
sudo chmod u+x,a+x,+s /usr/lib/cups/backend/cups-pdf
sudo /etc/init.d/cups restart

(I found the above here.)

What does the above do?  First, it installs the CUPS PDF printer.  Second, it makes a directory in your “home” directory called “PDF,” which is where the PDF printer will send your documents when they are printed.  Third, and this is the part that is difficult to do from anywhere other than the command line, it adds access to the CUPS PDF printer to your User.  If you don’t do that, you can’t access the printer.  The last line simply restarts the CUPS printer.

You now have done the hardest part.  The next part is simply to set up your handouts in OpenOffice Impress:

Impress PDF - 01

Once you’ve done that, go up to “File->Print”.  Choose the “PDF” printer.  Then choose “handout” in the middle of the window and how many slides you want per page:

Impress PDF - 02

When you’re ready, hit “OK”.  Now, go check the “PDF” folder in your “home” directory and you should see a PDF there with the handouts.  Voila!  You can now create PDFs of handouts in Impress.

Notes:

1) You can set the printer to print in color by clicking on the “Properties” tab.  It’s set to print in “grayscale” by default.

2) You can also set the PDF printer as the default printer in Ubuntu.  Go to “System->Administration->Printing.”  You should see the PDF printer.  Right-click it and set as default.

3) Microsoft’s Powerpoint can’t do this either.  You have to install a PDF printer in Microsoft’s Powerpoint to achieve the same effect.

4) I have received an error after doing this before.  Apparently there was a “security” issue in that the PDF printer didn’t have some rights to access files.  The error said “cups-insecure-filter.”  I fixed this using these directions:

Open a terminal and type the following:

sudo chown -hR root /usr/lib/cups/filter
sudo chown -hR root /usr/lib/cups/backend
sudo chgrp -hR root /usr/lib/cups/filter
sudo chgrp -hR root /usr/lib/cups/backend

Categories: technology Tags: ,

Ubuntu: Getting Streamzap PC Remote Control working with Ubuntu and Boxee

August 21st, 2009 No comments
Number of Views: 41

We periodically watch videos from the internet on our TV.  I found a cool piece of software that is getting a lot of attention – Boxee.  It’s pretty slick, though not without it’s bugs (it is beta software and free, though, so I can’t complain).  In the spirit of true American laziness, once I realized Boxee would work on our computer connected to our TV I decided I wanted to try a remote to control Boxee.  I found a remote that says it works with Linux – the Streamzap PC Remote.  I ordered it from Amazon.com and once it arrived I faced the next issue: getting it to work with Linux.

The Streamzap ships with software for Windows, but no software for Linux.  Like most of Linux, support for the hardware is mostly built in or provided via open-source software packages. It isn’t the easiest thing in the world to set it up, so I’ve documented here how to do it so I have a future reference and for others (based on these instructions).

First, install the “lirc” package using the Synaptic Package Manager (or “sudo apt-get install lirc” in the terminal).

lirc - 01

Once the install is complete, a window will pop up asking for the remote and some additional information.  Fill everything out, selecting the Streamzap PC Remote.

Once the install is complete, you can test to see if the remote is working by plugging it into a USB port, starting a terminal, and typing the following at the prompt:

irw

If the remote is working, when you push a button you should see an indicator in the terminal that the button was pushed.  If you see indicators, LIRC is communicating with your remote and your remote is communicating with your computer, like this:

lirc - 02

Now, you need to tell LIRC which buttons should do what in which programs.  You can use a program to help generate the requisite scripts.  Install “mythbuntu-lirc-generator” from the Synaptic Package Manager (or “sudo apt-get install mythbuntu-lirc-generator” in the terminal).

Once installed, type “mythbuntu-lirc-generator” in the terminal and it will generate LIRC files for several programs.  It puts a “.lircrc” file in “/home/USER/”.  That file indicates that the generated scripts are installed in “/home/USER/.lirc”, which is a hidden folder in your user folder.  Here’s what the files says:

#Custom lircrc generated via mythbuntu-lirc-generator
#All application specific lircrc files are within ~/.lirc
include ~/.lirc/mythtv
include ~/.lirc/mplayer
include ~/.lirc/xine
include ~/.lirc/vlc
include ~/.lirc/xmame
include ~/.lirc/xmess
include ~/.lirc/totem
include ~/.lirc/elisa

You can modify these for the Streamzap Remote Control.  I modified one, totem, to give it added functionality.  My version is included in the zip file linked to below.

If you want to use the remote in Boxee, you have to install Boxee, then find the Boxee remote file in “/home/USER/.boxee/UserData”.  The file is called “Lircmap.xml”.  You need to add the following to the file:

<remote device=”Streamzap_PC_Remote”>
<pause>PAUSE</pause>
<stop>STOP</stop>
<forward>&gt;&gt;</forward>
<reverse>&lt;&lt;</reverse>
<left>LEFT</left>
<right>RIGHT</right>
<up>UP</up>
<down>DOWN</down>
<select>OK</select>
<pageplus>CH_UP</pageplus>
<pageminus>CH_DOWN</pageminus>
<back>EXIT</back>
<menu>MENU</menu>
<title>PLAY</title>
<info>More</info>
<skipplus>&gt;&gt;|</skipplus>
<skipminus>|&lt;&lt;</skipminus>
<display>Teletext</display>
<start>Home</start>
<record>RECORD</record>
<volumeplus>VOL_UP</volumeplus>
<volumeminus>VOL_DOWN</volumeminus>
<mute>MUTE</mute>
<power>POWER</power>
<myvideo>Videos</myvideo>
<mymusic>Music</mymusic>
<mypictures>Pictures</mypictures>
<mytv>TV</mytv>
<one>1</one>
<two>2</two>
<three>3</three>
<four>4</four>
<five>5</five>
<six>6</six>
<seven>7</seven>
<eight>8</eight>
<nine>9</nine>
<zero>0</zero>
<mytv>RED</mytv>
<mymusic>GREEN</mymusic>
<mypictures>YELLOW</mypictures>
<myvideo>BLUE</myvideo>
</remote>

If you want to just use my files, here they are.

<lircmap>
<remote device=”Streamzap_PC_Remote”>
<pause>PAUSE</pause>
<stop>STOP</stop>
<forward>&gt;&gt;</forward>
<reverse>&lt;&lt;</reverse>
<left>LEFT</left>
<right>RIGHT</right>
<up>UP</up>
<down>DOWN</down>
<select>OK</select>
<pageplus>CH_UP</pageplus>
<pageminus>CH_DOWN</pageminus>
<back>EXIT</back>
<menu>MENU</menu>
<title>PLAY</title>
<info>More</info>
<skipplus>&gt;&gt;|</skipplus>
<skipminus>|&lt;&lt;</skipminus>
<display>Teletext</display>
<start>Home</start>
<record>RECORD</record>
<volumeplus>VOL_UP</volumeplus>
<volumeminus>VOL_DOWN</volumeminus>
<mute>MUTE</mute>
<power>POWER</power>
<myvideo>Videos</myvideo>
<mymusic>Music</mymusic>
<mypictures>Pictures</mypictures>
<mytv>TV</mytv>
<one>1</one>
<two>2</two>
<three>3</three>
<four>4</four>
<five>5</five>
<six>6</six>
<seven>7</seven>
<eight>8</eight>
<nine>9</nine>
<zero>0</zero>
<mytv>RED</mytv>
<mymusic>GREEN</mymusic>
<mypictures>YELLOW</mypictures>
<myvideo>BLUE</myvideo>
</remote>
Categories: technology Tags: ,