Pages

Tuesday, October 15, 2013

android, apps can't connect to internet, except browser

I came across this problem, that in my android phone, i was not able to connect o gtalk, whatsapp, maps etc, whereas  I was able to browse internet via browser.

The reason I found out was that I came across a wifi connection sometime that blocked my phone apps from connecting to internet. After that, even if I use data connection via sim, I was not able to use internet based apps.


The solution is:

go to

Settings->Wireless and Networks ->Mobile Networks-> Access point names

Now, right click and select 'Reset to default'.

That's it, now I was able to connect these apps to internet.

Monday, September 16, 2013

Ubuntu: wifi(wireless) connection fails?

In secured network setup like in your office, if you try to connect to office wifi, it will keep asking for proper 'authentication' popping up userid and password window forever, although credentials are correct!.

So, how to overcome this error and make your ubuntu laptop connect to wifi ?

While connecting to wifi, if you observe the syslog closely, you will find that target router keeps cancelling connection request with the reason ' unable to get local issuer certificate...'.

What is happening in the background is, the wireless service on ubuntu, eduroam, is forcing CA certification validation, from your client PC also. Usually your laptops are not CA certified, isn't it?.

So open your target wifi config file

sudo vim /etc/NetworkManager/system-connections/<wifi i want to connect to>

change 'system-ca-cert=true' to 'system-ca-cert=false'.

I hope it should start working for you now !.

Otherwise, go back to syslog and see what's messed up!.


Friday, August 30, 2013

boost your Linux running laptop's power savings - PowerTop, laptop-mode-tools

Often, people find their laptop running linux consuming more power compared to windows. Mostly this is so because, it a luxury that Linux offers you, to install on any kind of hardware. People would purchase  Windows installed Laptops, those that do not officially support Linux. But you will remove windows and Linux immediately and it works !!! , except few issues like more power consuption, or fan running with high speed etc..

Anyways, there are couple outstanding utilities out there to help you balance the power usage on your laptops(these utils work for desktops also, but relatively these are more helpful in tuning your laptops ).

PowerTOP
===============

How to Install:
------------------------

sudo apt-get install powertop

How to run:
------------------------

:~$ sudo powertop

the output is an interactive window that looks like below,


The Overview shows which process/device consuming how much power. With this you can make out which process/device is using the power most and take corrective actions accordingly.

Use arrow keys(left and right) to navigate between each of the tabs on the console.
The second tab, "idle stats' shows cpu wise and core wise (including hyperthreads) idle state.

The third tab 'frequency stats' shows frequency wise power usage statistics.

Fourth tab 'Device stats' shows which physical device is consuming power most.

Fifth tab 'tunables' shows configurable paramters that we can tune to improve the power savings. 

To get realistically what needs to be done to increase power savings, run

:~$ sudo powertop --html

This will create an html file called powertop.html. It looks like below

If you see the above window, it will exactly tell what you need to do. You have to update certain kernel config files with certain values as shown. Doing this will improve the power usage.

Also, if you don't want to take all that headache, you can keep the laptop running in battery mode(unplug the power cable) and run

:~$ sudo powertop --calibrate

This will calibrate the system by doing all the necessary tunings.



laptop-mode-tools:
=======================

This is another tool that lets you do efficient power management on the laptop. Run

$~: sudo apt-get install laptop-mode-tools

This will install the utility as startup app by default. Hence you do not have to worry about starting it everytime when you turn on the laptop. The configuration file will be in 

/etc/laptop-mode/laptop-mode.conf

If you make any update to this file, run 

$~: service laptop-mode reload

for the changes to take effect.

For more info on this tool, refer

 https://wiki.archlinux.org/index.php/Laptop_Mode_Tools





Sunday, August 25, 2013

add virtualbox guest to network domain

I have done this on a linux host and windows 7 guest.  The requirement was to put the windows 7 guest to office network.

1. create a bridged adapter for the guest, using virtualbox settings window.


2.  This will create an adapter on the guest that will have the IP picked from ntework domain in which your host exists. That means The IP will be looking similar to the host IP, that can be pinged from a different PC.

3. Now, go to your guest OS, Start-> My computer-> right click -> Properties

4. Click on 'change settings' that you see on the right bottom side. you will get below window.


5. Click on 'Change' button in the above window. (see 'To rename this computer or domain...'). you will get below window.


6. You will see 'Workgroup' enabled. Change it to 'Domain'(see under 'Member of'). Add your domain name here and click okay. This will make the OS to contact DNS server and register itself . Here on you will be able to login to domainname/username in your Guest OS.



enable telnet on non default port, allow root login

Telnet deamon listen to port 23 by default. If you want to enable make it listen on different port(for example 2233), perform following steps:



For BusyBox telnet:

=> start telnetd on server as "telnetd -p 2233". This will run the deamon in background making it listen on port 2233.
=> from client, login as 'telnet <server ip> 2233'
=> Note that busybox telnet does not allow root login.


For ineutil telnet:

=>You will have a config file 'telnet' in /etc/xinetd.d/ directory
=> The file looks like 


# default: on
# description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
flags = REUSE IPv4
socket_type = stream
only_from = 0.0.0.0
wait = no
server = /usr/sbin/in.telnetd
instances = 5
log_on_failure += USERID
disable = no
}

=> to this file, add entry

port = 2323

to change listening port. Also edit /etc/services file and modify 

telnet          23/tcp

to 

telnet          2323/tcp

To allow root login, add entry

user = root
If you want to restrict only certain clients to be able to login, modify 

only_from = <ip range>








Wednesday, August 14, 2013

subtitle and video synchronization in vlc player

Sometimes, the subtitles we download from internet do not sync with the video we are playing. Either it will be little ahead or behind, resulting in a different subtitle appearing for a different picture frame.

By knowing how much is the lag between video and the subtitle, we can sync these two, to play it proper.

to know the lag, play the video, try to listen to most commonly recognizable word. Not down the time stamp at that moment. Now, you have to find out at what timestamp actually that word being played from the subtitle file. Either you open the file with a word processor and see around that time or while playing the video itself you will know what time the subtitle was/is being played.

For example, In my video, I hear a sound 'Hey Macho' that i can clearly recognize. I note that it is played at 4 min 11 sec. From the file, the subtitle 'Hey Macho' is being played at 4 min 5 sec. So the lag is around 6 seconds.

To overcome this lag, on your VLC player, go to Tools->Track synchronization


The track synchronization window looks like below:

the Subtitle track synchronization window shows 1.7 seconds value which means the subtitle will be played 1.7 second late compared to how it would have played without this synchronization.





Tuesday, July 16, 2013

count number of blank lines in a file using grep



To count number of blank lines in a file, we use following grep expression.

$grep -c '^$' filename

=> this will try to extract lines starting and ending with nothing in between.