Posts Tagged Linux

How to display ICE (In Case of Emergency) contact on your iPhone, Android, or BlackBerry lock screen

If you  have stored ICE (In Case of Emergency) contacts in your phone, you probably noticed that your phone treats them like any other contact. This means that emergency responders won’t be able to access your contacts if your phone is locked. Also, if you’re an Android user using a custom ROM, there’s a chance an emergency responder won’t even know how to access your contacts. In an emergency, every moment is important.

You can, through a few easy steps, display emergency contact information, along with any other information you select, on your phone’s lock screen. This means that it will be available just by turning on the screen, making it quickly and easily available in the case of a real emergency. Who knows, this might actually help you get your device back in case it’s lost or stolen.

You might also be interested in reading about how to streamline your emergency contacts with an emergency email address.

So how to do it?

Select a wallpaper (dimensions)

Start by selecting what will be your new wallpaper (either an existing photo or graphic) with a resolution close to your phone’s display, to prevent the text from being stretched or scaled. Here’s the resolution of many popular smartphone displays:

  • BlackBerry: Varies by model, but the most common sizes are:
    • BlackBerry Bold: 480×320
    • BlackBerry Curve: 320×240
    • BlackBerry Pearl: 240×260
    • For other devices, or to verify the above, see BlackBerry forums for your device’s exact resolution.
  • Android: Android also supports a wide variety of screen resolutions. You will likely find your device and its resolution listed at Comparison of Android devices – Wikipedia.
  • iPhone 2G through 3GS: 320×480
  • iPhone 4 and 4S (retina display): 640×960

Edit it to add your contact information

Open your soon-to-be wallpaper in your favorite image editor, or use one of the following utilities:

You’ll want to place your text and/or information where the UI isn’t going to cover it. Here’s some pointers:

  • BlackBerry: Avoid the top 1/4 and bottom 1/4 of the image, as well as the direct center (where the unlock/password prompt appears).
  • Android: Avoid the top 1/4 and bottom 1/4 of the image, as well as any other UI elements (such as the unlock slider). You may have to experiment somewhat, since different Android versions have different slide-to-unlock methods.
  • iPhones: avoid the top 1/4 and bottom 1/4 of the image.
You may want to consider creating text over a solid color of text, so it stands out and it easy to read. If you’re not handy with the above programs, consider asking a friend to make the edits for you.

Save it to your phone

  • BlackBerry: Either insert your microSD card to your computer, or connect your phone and mount it as USB storage. Copy your picture to your card in any location, but remember where you put it for the next step.
  • Android: Either insert your microSD card to your computer, or connect your phone and mount it as USB storage. Copy your picture to your card in any location, but remember where you put it for the next step.
  • iPhone: The easiest way to get your picture onto your device is to email it to an account you have set up on your phone. Then, from your phone, save the attachment from your email.

Set it as your wallpaper

  • BlackBerry: open your pictures (via Media, may vary by OS version), display the image you want, hit menu > Set as Home Screen image.
  • Android: From your home screen, press menu  button > Wallpapers > Gallery > (select folder and file).
  • iPhone: Go to Settings > Wallpaper > (touch screen) > Camera Roll > (Select your picture) > Set.

There you have it. Your emergency contact information is now displayed on your phone’s display, even when it is locked, making it available to emergency personnel quickly and easily.

What do you think of this tip? Was this useful to you? Do you have any other tips or suggestions to share related to this? Please share in the comments section below! Thank you!

, , , ,

1 Comment

I put down my Android and picked up an iPhone… here’s what I noticed

I’ve been getting more than a few expressions of “You? Got an iPhone?” from friends and family lately, after they see my iPhone 4S. While I’ve been known not to be the biggest fan of Apple up until now, I’m starting to realize why the device has gotten to be so popular — it’s an easy-to-use, reliable device that doesn’t frustrate.

Although learning a new smartphone OS hasn’t been terribly difficult, here’s some of the major points between the two that I’ve found myself having to adjust to.

The Home Screen

The home screen on an Android phone is more-or-less a “blank slate”, waiting for you to fill it to your liking with widgets and shortcuts, to make it just the way you want it. If you want to access all your installed apps you open what’s typically referred to as the “app drawer.”

On an iPhone, that “app drawer” is your home screen. No widgets here, though apps do have what’s called “badges” that can show an indicator on the icon if the app has something that wants your attention, such as a number of missed calls over the phone icon, unread texts over the messages icon, and so on.

Removable Storage

Android-based phones feature a microSD card slot for removable storage. It’s an optional — but highly recommended — additional storage space that you can use for media, and on some versions of Android, even apps. You can upgrade this by simply popping out the card, copying the contents to a new, presumably larger card, and putting that card in your phone.

On an iPhone on the other hand, what you buy is what you get — buy a 16GB iPhone, get a gross total of 16GB. Likewise for the other sizes, such as 32GB.

However, there’s some distinct differences:

Android phones by default have their apps installed on the phone’s lower-capacity internal memory. Since the internal memory is smaller than the microSD card, (Sprint’s Epic 4G for example, only has 1GB internal memory), you are sharply limited for the space your apps have to share with everything else. Starting with Android version 2.2 (Froyo) and up you had the ability to move apps to the SD card. This frees up internal memory. However, its up to the app developer to support this feature, and if they did, most apps still required that you move it yourself from within the phone’s settings. Remember those widgets? Don’t plan on them working if you move your app to the SD card.

iPhones on the other hand have a single unified storage area for everything. Assuming you get a 16GB iPhone, that storage space is used for everything — there’s no need to move anything. Apps, media, and the OS all share a single storage space. You might say “this is less overall than an Android phone”, and you would be right. But — you aren’t going to have to try to balance what apps are stored on SD card versus the phone’s internal memory.

When you plug your Android-based smartphone into your computer’s USB port, you’ll likely get a message asking if you want to charge-only, or mount as removable storage. If you select to mount as removable storage you have full access to the SD card in the phone. This is handy if you want to use your phone’s memory card as a makeshift USB flash drive. However, once you mount it to the PC, you don’t have access to it from the phone. Apps that are installed on the SD card cannot be run, and you won’t have access to any media on the card until you unmount it from the PC.

Media

Installing media on an Android phone isn’t difficult. Simply mount the phone to your PC as USB storage (or insert the microSD card into your computer), and copy music, pictures, or anything else you like to it. When you unmount (or insert the card back into the phone) the media scanner will automatically detect your media and propagate the media libraries. But — it’s up to you to get your own music.

With an iPhone and a Windows or Mac computer running iTunes you simply connect your phone to your PC, select what media — such as music, movies, or other — you want to sync, and iTunes adds it to your device. You can purchase your music through iTunes as well. However, you have to use iTunes. Don’t expect your iPhone and Linux-based PC to get along very well.

Backup and Restore

With an iPhone, completely backing up your device is as quick and easy as plugging it into iTunes and right-clicking on it and choosing “Backup.” iTunes takes care of it, and makes restoring it just as painless.

With an stock Android, you don’t have any options to make a “full” backup. You can sync your contacts, calendar, etc to your Google (or other) account, and there they will sit in case you need them. In case of a serious issue, you can boot your phone to recovery mode and wipe it from there, restoring it to stock configuration, after which, prepare to spend some time reinstalling and reconfiguring your apps and account. Rooted users have a few additional options, such as ClockworkMod’s Nandroid backup and restore, and the third party app Titanium Backup.

There’s a lot more differences between the two that I didn’t cover above. But I will say this: When people ask me why I got an iPhone, my typical response is something along the lines of “it’s easy to use without having to think about.” I really enjoy my iPhone, and I don’t think I’ll be picking up an Android phone again anytime soon.

What about you, reader? What are you experiences with Android and iPhones? Do you have anything to share or compare that I didn’t cover in the above? Please feel free to share your thoughts in the comments below!

, , , , , , , ,

2 Comments

How to run a game or other program in a new X session in Ubuntu Linux

To do this, CTRL-ALT-F1 to an open terminal, log in, and run:

xinit ./program -- :1

where program is the program file you want to start in a new X session. Assuming your normal X session is on :0 and appears when you CTRL-ALT-F7, your new one will spawn on CTRL-ALT-F8.

Questions, comments? Please feel free to leave them in the comments section below. Thank you.

,

Leave a comment

Easy Ubuntu data usage monitor

If you’re lucky enough to have a broadband card that works under Linux, your plan probably includes an “allowance” or data usage quota per month. You might be thinking how nice it would be to have a utility that tracks your data usage for the month (or other period) and gives you an easy-to-read report. You might also want said monitoring utility to have pre-built packages for Ubuntu / Debian.

NTM (Network Traffic Monitor) is what you want. As of this post the latest version is NTM 1.2.4.

Start by going to the NTM download site and downloading ntm-1.2.4.deb. Then double-click on it to install it using Ubuntu Software Center.

Once installed, you will find NTM at Applications > Internet.

Upon starting, it minimizes to the tray (next to the clock). You can open the interface by left-clicking the icon, and open the menu to access preferences by right-clicking the icon.

By default NTM monitors ppp0, which is the most likely interface that your broadband card will use. If you want to monitor a different interface, change that under the General tab. If you’re not sure what interface to use, run the following command:

ifconfig -a

This lists all interfaces and will help you locate your desired connection by IP / MAC and other info.

Also by default, NTM is configured with some other settings, such as auto-disconnecting after a data threshold has been reached (98MB by default), and disconnecting after a certain number of usage hours (30). These are likely too low for most mobile broadband users. Be sure to change these settings, under the Traffic, Time Slot, and Time tabs, to prevent unexpected disconnections.

Questions, comments, or other feedback? Please comment below. Thanks!

, ,

Leave a comment

Windows CHKDSK at boot cancelled by phantom keypress

When you run the Windows checkdisk (chkdsk) utility, it may report the disk being in use and recommend that you schedule chkdsk to run the next time the computer restarts, like the following screenshot shows:

chkdsk_schedule2

Windows can’t check the disk while it’s in use. Do you want to check for hard disk errors the next  time you start your computer?

However, doing that ran me into a very curious issue on Michele’s laptop: I would restart the computer, and get a message telling me to press any key within a few seconds to abort the scan if I so desired. Sorry, but I don’t have the exact message in front of me at the moment. Curiously it would abort itself after a second or two, stating that I pressed a key (which I did not). I’m fairly certain this is caused by this issue here: kernel atkbd.c: Unknown key released messages on Linux.

In order to make the chkdsk run without aborting due to that phantom keystroke, you have to set the delay to zero. To do this, boot back up into Windows, open an administrative-level command prompt, and run the following:

chkntfs /t:0

That will set the delay to zero seconds, effectively making it unable to be interrupted. Schedule the disk check again and reboot. It should run without issue.

Questions, comment, or any issues with the above are welcome in the comments section. Thank you!

, ,

9 Comments

How to tell if your CPU supports virtualization under Ubuntu Linux

If you’re thinking of running a virtual machine, you should check first to see if your processor supports the VT extension. To do so, run the following command in a terminal.

cat /proc/cpuinfo | egrep '(vmx|svm)'

Having the VT extension allows improved virtual machine performance, as well as the ability to run 64-bit virtual machines. Note that some manufacturers have an option to enable/disable VT in the BIOS (which is usually set to disabled), so if you have VT extensions, you may want to check to make sure it’s enabled.

Further Reading: Linux Tip: How to Tell if Your Processor Supports VT

Sorry for the brief post, but it’s late and I’m just making a quick note of this. Note that this works in just about any Linux distro, not just Ubuntu.

,

1 Comment

Batch converting audio files to MP3

If you’re converting a single file, http://media.io/ is a great online tool. However, for batch conversion, you’ll want to look at one or more of the following tools:

Windows:

dbPowerAmp is a great conversion utility http://www.dbpoweramp.com/dmc.htm

Ubuntu:

While dbPowerAmp says Linux is supported through Wine, I’ve found that soundconverter works wonderfully. To install it:

sudo apt-get install soundconverter

Next, just run it. You can select your input files and directories in the GUI. By default, soundconverter produces .ogg output. If you want mp3, simply select it in Edit > Preferences

, , ,

3 Comments

Cleaning up after PhotoRec – Linux Edition

A friend of mine accidentally formatted her 2TB backup drive and brought it to me to see what I could do. PhotoRec was the only tool that would give more than a hint of recoverable data from my Linux-based laptop. After letting it run for several hours, I had a mess: PhotoRec recovered over 230,000 files,  and spread them out over 430 directories!

Finding and sorting them by hand was obviously out of the question as it would take way too long. I took a hint from another recovery program I had [unsuccessfully] tried, and thought of sorting them into directories based on their file extensions. I.e. .jpg into ‘jpg’, .doc into ‘doc’, etc.

However, since I was working with the large number of files and directories, I had to take this a bit further. This will sort files into directory names like ‘jpg.1′, ‘jpg.2′, etc. These are numbered to prevent putting too many files in a single directory and killing system performance :)

I came up with the following bash script for use on Linux systems. A word of caution is due: This script does very little error checking, though the commands are quite sensible and I ran it as-is with fine results. I’m not responsible for unanticipated results.

Here is the script:

#!/bin/bash
#
# PhotoRec Cleanup Script for Linux - Written by Mike Beach http://mikebeach.org
# Last update: 2013-06-03
#
# This script is designed to clean up the mix of files stored in recup_dir directories
# created after a PhotoRec recovery of a large number of files. This script traverses the
# directories and sorts the files into new locations based on the file's extension,
# creating the new directories where needed. CAUTION: This script doesn't do nearly as
# much error checking as it should, so naturally, use at your own risk.
#
# This script should be run from the parent of any recup_dir.* directories
#
# Behavior:
# By default, this is set to 'cp' (copy) for safety.
# Change to 'mv' (move) if you want that behavior.
# Valid values are ONLY 'cp' or 'mv'.
# Anything else will generate a fatal error and a non-zero exit code.
BEHAVIOR='mv'
#
# Only edit anything below this line if you know what you are doing. If you do feel the need
# to edit something, please drop me a line to explain why so that I can improve the script.
# http://mikebeach.org/2011/08/21/cleaning-up-after-photorec/
#
echo
echo "PhotoRec Cleanup Script for Linux - Written by Mike Beach http://mikebeach.org"
echo
B=$BEHAVIOR
if [[ $B != 'cp' && $B != 'mv' ]]; then
echo "[E] Invalid behavior set. This can cause undesirable/unpredictable behavior.";
echo "[E] Please edit the script, check the behavior setting, and re-run.";
exit 1;
fi
P=$PWD
# Check for any recup_dir directory
GO=0
for z in recup_dir.*; do
GO=1;
done
if [[ $GO == 1 ]];
then echo "[I] $P/recup_dir.* exists, proceeding as planned.";
else echo "[E] $P/recup_dir.* not found.";
echo "Are you in the right directory? Stopping.";
exit 1;
fi
for x in recup_dir.*; do
echo "[I] Entering $x...";
cd $x;
for y in *; do
# E is the extension of the file we're working on.
# Convert all extensions to lowercase
E=`echo $y | awk -F. '{print $2}' | tr '[:upper:]' '[:lower:]'`;
# fix for recovered files without extensions
if [[ "$E" == "" ]]; then E="no_ext"; fi
# C is the counter number; the 'number' of the directory that we're on
C=`echo $x | awk -F. '{print $2}'`;
# D is the destination pathspec. $P/$E/$E.$C -> (jpg) $PWD/jpg/jpg.1
D="$P/$E/$E.$C";
if [[ ! -d $D ]];
then 
mkdir -p $D;
if [[ ! -d $D ]]; then
echo "[E] Creating directory $D failed. Aborting.";
exit 255;
fi
fi
$B -f "$y" "$D"; echo -n "."
done
cd ..;
if [[ $B == 'mv' ]]; then
echo "[I] Attempting to remove now-empty directory $x."
rmdir $x;
fi
done
echo "[I] Complete."

Questions, comments, and feedback are welcome. Please leave them in the comments section below. Thank you!

, , , ,

9 Comments

How to monitor your microphone through headphones in Ubuntu

If you want to monitor your headphone feed, either for streaming it to the output or for mixing purposes, you’ll need to know your audio device names. Start with reading the latter half of this post to find your device names. Once you have the input and output device names, substitute them in the following command:

pacat -r --latency-msec=1 -d alsa_input.pci-0000_00_1b.0.analog-stereo | pacat -p --latency-msec=1 -d alsa_output.pci-0000_00_1b.0.analog-stereo

Note that the .monitor part has been removed from the playback device. Not much explanation to go on here, but it does the job and I’m writing this in a hurry.

Based on PulseAudio: Monitoring your Line-In Interface.

,

Leave a comment

Broadcasting a multimedia stream using icecast2 and gst-launch in Ubuntu Linux

The following is (I hope) an adequately-documented procedure to stream desktop audio capture via icecast2.

What you will need:

  • Basic audio hardware
  • An Internet connection
  • Ability to accept inbound connections on a port (default 8000)
  • Some basic idea of what you’re doing :)

 

Setting up the icecast2 server

Icecast2 is a free server for streaming multimedia similar to SHOUTcast. I won’t go in to all of the differences here — you can easily Google them or visit the respective websites and do some light reading. What I will actually explain here is how to get the server actually running.

Install icecast2 from either Synaptic or command line.

sudo apt-get install icecast2

By default, the icecast2 server’s logging configuration is set up in a way that might deeply frustrate the amateur user. This is because it is set up to log to /var/log/icecast2, which is set up with the following permissions:

drwxr-xr-x 2 icecast2          icecast    4096 2011-06-27 23:45 icecast2

That’s 0755 for user icecast2 and group icecast. Fortunately that user and group account are already created for us, but the configuration file isn’t set to change the running process id (it’s commented out) and the entered defaults are for user nobody. No worries. Read on.

Now edit the  /etc/icecast2/icecast.xml config file using your favorite text editor. If you don’t mind my recommendation, and you’re doing this on a machine running Gnome or Unity, gedit is excellent. Make sure to edit the file as root.

sudo gedit /etc/icecast2/icecast.xml

Edit the file to your preference.

The next settings change depends on whether you’re running Ubuntu Desktop or Server. Find the section below that applies to you.

Ubuntu Desktop: Make sure to head down to the bottom and make the important change to set the correct user/group combination. Find the  section and uncomment (remove the <!-- and --> marks) from around the section. Change to icecast2 and to icecast, like so:

icecast2
icecast

Now start the icecast2 server

sudo icecast2 -c /etc/icecast2/icecast.xml

You should see messages similar to the following:

Changed groupid to 125.
Changed userid to 115.

… and then the program will not produce any more output, but remains running (does not drop back to a prompt). Congratulations, your icecast2 server is running. If it produced an error message, or dropped back to a prompt, investigate the configuration file for any problems, and make sure the port you have icecast2 set to isn’t being used by another process.

To stop the server, hold ctrl and press c (CTRL-c). It does take a few seconds after the keypress to completely halt.

Ubuntu Server: Edit the /etc/default/icecast2 file. The uid and gid should already be set correctly. Verify they are set as follows:

# Name or ID of the user and group the daemon should run under
USERID=icecast2
GROUPID=icecast

Next, follow the instructions on the last 3 lines:

# Edit /etc/icecast2/icecast.xml and change at least the passwords.
# Change this to true when done to enable the init.d script
ENABLE=true

Now start the service

/etc/init.d/icecast2 start

You should get the following output:

Starting icecast2
Detaching from the console
icecast2.

Finding your audio device for streaming

I tried using various programs to set up my audio stream, such as the SHOUTcast Transcoder (sc_trans), darkice, and a few others that I don’t even recall — but none worked correctly for my case. The reason? I either couldn’t figure out what audio device to use, or it wouldn’t work with the audio device I gave it.

As it turns out, Linux machines primarily use PulseAudio as a sound system and many of these utilities expect or are designed to work with an ALSA sound system. I tried /dev/dsp and /dev/audio as input devices but neither existed on my system. I tried padsp with darkice configured to use /dev/dsp but that didn’t work either. I found Alexandru Csete’s GStreamer article and a few other posts and figured gst-launch-0.10 would be the answer that I needed. As it turns out, that was completely correct.

With all credit to Alexandru Csete, here are the steps to find the correct PulseAudio device name for your scenario.

Run the following command:

pactl list | grep -A2 'Source #' | grep 'Name: ' | cut -d" " -f2

You should get output similiar to the following:

alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor
alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
alsa_input.pci-0000_00_1b.0.analog-stereo

These output ‘monitor’ sources feed your devices entire playback stream — effectively ‘what you hear’. The input sources are a microphone or other line-in device. Select the device appropriate for your scenario. If you are trying to capture a webcam microphone or other removable device, generate this list with your device plugged and then unplugged and then compare the lists to find your device.

Once you have your device name, it’s time to…

 

Set up your audio stream

Example command:

gst-launch-0.10 pulsesrc device=DEVICE ! audioconvert ! vorbisenc bitrate=BITRATE ! oggmux ! shout2send ip=IP port=PORT password=PASSWORD mount=MOUNT

An explanation of the options:

  • DEVICE: Your audio device (from above)
  • IP and PORT: The IP address and PORT number of your Icecast2 server
  • PASSWORD: The password to your icecast2 server
  • MOUNT: The mount point of your stream.
  • BITRATE: The bitrate you want your audio to be (see examples below)

In my case the audio device I wanted to use was:

alsa_output.pci-0000_00_1b.0.analog-stereo.monitor

So my line was:

gst-launch-0.10 pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! audioconvert ! vorbisenc bitrate=32000 ! oggmux ! shout2send ip=localhost port=8000 password=XXXXXX mount=stream

The above produces an OGG stream. This works pretty well, but some Windows users report issues with OGG streaming. If you want MP3 streaming instead, try this:

gst-launch-0.10 pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! audioconvert ! lame bitrate=32 ! shout2send ip=localhost port=8000 password=XXXXXX mount=stream

Note that if you are streaming to a SHOUTcast server (as opposed to an Icecast2 server), change the command as follows:

Remove mount= and replace it with protocol=2. Make sure you are connecting on the port specified in sc_serv.conf and not the +1 port. Example:

gst-launch-0.10 pulsesrc device=alsa_output.pci-0000_00_1b.0.analog-stereo.monitor ! audioconvert ! lame bitrate=32 ! shout2send ip=localhost port=8000 password=XXXXXX protocol=2

Running this produces output similar to the following:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstAudioSrcClock

If you get some sort of error investigate your shout2cast settings.

Again, CTRL-c stops the streaming.

At this point, you should have a working icecast2 server and a working stream (via gst-launch-0.10). Congratulations!

I’m sure this guide is far from perfect, so please feel free to share any feedback you may have in the comment sections below. Thank you!

, , , , , ,

Leave a comment

Follow

Get every new post delivered to your Inbox.

Join 34 other followers

%d bloggers like this: