There was an error in this gadget

+1

Monday, March 21, 2011

Application : Caffeine - for pleasure of uninterrupted viewing

0 comments
How often have you felt irritated by intruding screen-saver or your computer going into power saving mode while you are watching your favorite movie or series. I for one find this very irritating, annoying and I had in fact disabled power saving and screen saver from my computer.

This is not a very good solution, disabling power saving mode is not wise,as you waste a lot of energy and consequently this degrades the battery life of your laptop,in case you are using laptop. Caffeine is a small applet that comes handy in this situation, it allows you to disable Screen Savers and Power Saving mode temporarily while you enjoy video or any other activity which might have resulted in computer going into power saving mode.

To install Caffeine, open the terminal window from ( Applications -> Accessories -> Terminal) and issue the following command to add repository for caffeine and subsequently install caffeine on your system. ( These instructions are meant for Ubuntu 10.10 and earlier versions)
sudo add-apt-repository ppa:caffeine-developers/ppa
sudo apt-get update
sudo apt-get install caffeine
Once, you install caffeine you can launch Caffeine from ( Applications -> Accessories -> Caffeine), caffeine would sit in panel around the date and time.
Caffeine in the panel above, preferences loads up different options -


In preferences you can decide if you want to launch caffeine as soon as you log in, further you can configure option to launch caffeine automatically when you run certain program for instance you can add all your different media players, allowing caffeine to launch automatically whenever you play video files or for instance you can configure caffeine to launch when you play flash files.

Preferences for Caffeine

In short, caffeine is a short and simple tool that allows you to have hours of uninterrupted viewing of your favorite media files and yet keep all your power saving and screen saver settings unharmed, a very useful addition to your Desktop Linux arsenal.



Article Written by : Ambuj Varshney (blogambuj@gmail.com)
For Linux on Desktop Blog , http://linuxondesktop.blogspot.com
(C) 2011 , Ambuj Varshney

How to download Flash Files : No Flash files in /tmp ?

5 comments
Firstly, we have our facebook page now, you will find a link to like this page in the right column, please like this page and keep yourself updated about new post(s) on Linux on Desktop.


First a disclaimer,it might be illegal to download flash file,it depends upon the website's TOS and I encourage you to go through them before attempting to download flash file, if it is illegal I will NOT recommend that you download flash file.


There are different ways to download flash file, there are plugins that you can install in firefox, there are scripts that allow you to do so, however,one of the better ways that I have used for years( at least more than a year) is copying FlashXXX files from /tmp and renaming them appropriately.

Whenever flash played any media file in the browser, it downloaded Flash file locally in /tmp and deleted it when you closed the page. This had many advantages, for instance if you find something interesting and have already watched it in browser, you do not have to download it again using some plugin, or for instance you could only play part of file by seeking it appropriately and the relevant section is only downloaded in /tmp.

However, I found after updating my system, I no longer had FlashXXX files stored in /tmp , I looked frantically on net to find out reasons for this and found that this has to do with Adobe Flash Player being updated, which no longer saves Files temporarily in /tmp. I further looked up different forums on the Internet and found Flash indeed saved file on the system locally, it was just bit more difficult to access them.

In this post I would try to demonstrate how to retrieve flash files stored locally in the system while it is being played in the web-browser when they are not saved in /tmp. This works with Mozilla Firefox, I haven't tried this with other browsers, though it can work.

One approach to solve this problem would be to downgrade your flash to earlier version, but this is not recommended as updates fix many critical security vulnerabilities and further have performance improvements.

The key to finding flash is the fact that on POSIX based systems, or for instance GNU/Linux all the information about processes running on the system is stored in "/proc" directory were each running process is identified with Process ID and there is a directory corresponding to PID in /proc. Further, all the open File descriptors are maintained here i.e in a lyaman all the information about files opened by process is here.

So if we can find process ID corresponding to the instance of flash player and find the fd corresponding to opened flash file we can easily copy the file and this is the approach that is followed by this script ( I am not the original author of this script) :

Open your favorite text editor and copy the following script, and rename it to something like - findflash.sh

#!/usr/bin/env bash

for flashpid in $(pgrep -f flashplayer.so); do
cd "/proc/$flashpid/fd"
for video in $(file * | grep '/tmp/Flash' | sed 's/\(^[0-9]*\).*/\1/g'); do
echo "/proc/$flashpid/fd/$video"
done
done
Now, open your favorite flash(ensure it is legal to copy) file in web-browser, and in terminal window execute this file by issuing command :

bash findflash.sh
This should print the fd corresponding to all the flash files currently playing, copy them using conventional UNIX command and rename it to meaningful name.

The screen shot below illustrates this -

We had opened a video in Firefox, then we executed findflash.sh script, which gave us file descriptors of opened flash video, we copied and renamed this to some meaningful file name and played it using mplayer.



Article Written by : Ambuj Varshney (blogambuj@gmail.com)
For Linux on Desktop Blog , http://linuxondesktop.blogspot.com
(C) 2011 , Ambuj Varshney

Sunday, March 20, 2011

Ubuntu Tips: Manage CPU temperature

3 comments
Firstly, we have our facebook page now, you will find a link to like this page in the right column, please like this page and keep yourself updated about new post(s) on Linux on Desktop.

I started using computers way back in early 90's and I remember often people used to say that computers should always remain in cool, air conditioned , controlled environment, things might have changed over the years, computers might have become more robust,rigid, I am not sure, but one thing I am fairly certain of is, computers don't like overheating, this affects performance, reduces reliability and often leads to failure. Microprocessor is heart of computer, it consumes the maximum power as well as generates the maximum amount of heat and hence the fact that CPU temperature needs to be controlled becomes important.

I live in Ahmedabad, a city in Western India. In summers the temperature outsides goes to as high as 40-45 degrees, and in dorm rooms we do not have air-conditioning. Since, the ambient temperature is high, laptops usually boil, I have lots of respect for people who have designed these machines, the laptops usually get so hot that someone can make omelette's on these machines, still, I fear this might lead to failure and I wish I had way of finding out temperature of CPU to prevent potential failure.

A sensor is a device that converts physical phenomenon into electrical signals, your computer hardware has different sensors on-board, allowing you to find runtime information about present CPU temperature, fan speed, operating frequency etc and your operating system can inquire about these data values from sensor and thus allow you to monitor if you are reaching critical limit.

I will in this post show you different ways of keeping tab of temperature values on your Ubuntu box:

Finding temperature at command line -

Shoot up Terminal Window ( Applications -> Accessories -> Terminal ) and issue the following command to find out temperature of your system :

acpi -t

or for more complete information

acpi -v

However, if it shows acpi command not found, you can install by issuing the following command:

sudo apt-get install acpi


acpi showing CPU temperature, notice acpi -V gives lots of different parameters

(Note : Another possibility of showing CPU temperature is to look at file - /proc/acpi/thermal_zone/TZXX/temperature , TZXX check your system )


Additionally, there are other sensors on your system that you can find information about, lm-sensors or Linux Hardware Monitoring helps you find information about these.

To install lm-sensors issue the following command ( I have included applet as well to make it simpler for you to find information graphically ) in the terminal window:

sudo apt-get install lm-sensors sensors-applet

Now issue the following command to configure different sensors and load appropriate module ( it is in general safe to agree to question asked in the configuration )

sudo sensors-detect
Now once this completes, you can inquire about values of different sensors on your system by issuing following command in terminal window:

sensors
Alternatively, you can find information by adding applet to panel in gnome, to do so right click on panel at top and chose "Add to Panel"

Hardware Monitor Applet

Once, you add hardware monitor applet, you should get real-time information about present temperature of different core of your processor -


Additionally, if you want information about Hard Disk temperature you can do so by installing hddtemp and issuing hddtemp at command line with parameter as the drive whose tempreature sensor you want to access.

sudo apt-get install hddtemp
sudo hddtemp /dev/sda

Assuming, you want to access hardware sensor of drive /dev/sda.

Hard Disk temperature

Additionally, one can adjust frequency of operation of microprocessor i.e control scaling if the kernel supports it, the higher the frequency at your processor works the more heat it produces and thus if you can control the scaling you can to some extent control how much heat it produces.

There is a very useful applet called "CPU Frequency Scaling Monitor" that allows you to see the frequency at which you are presently operating and helps you tweak ass well, you can add it easily again by right clicking on panel above and right clicking, selecting "Add to Panel" and choosing "CPU Frequency Scaling Monitor".


Additionally if you click on the Applet,you will get option to pick CPU frequency or chose different profile.
You can easily switch between frequency,lower frequency means less heat.

additionally, if CPU temperature constantly remains high, try cleaning fan at the bottom of your laptop, with time it usually gets clogged with dust and removing dust can reduce heat significantly.


Article Written by : Ambuj Varshney (blogambuj@gmail.com)
For Linux on Desktop Blog , http://linuxondesktop.blogspot.com
(C) 2011 , Ambuj Varshney