Category: Technical

[HowTo] change from OEM installation to normal user mode?

Last week, I have installed Ubuntu 16.04 on my Laptop alongside Windows 10 and chose OEM install during the installation just to try what it is up-to. Later, I learnt that OEM mode is a System Manufacturer Mode and choosing this would allow one to customise the OS before shipping to the end-users. This is definitely what I intended to do as a direct end-user. I, therefore, wanted to revert it to the normal user mode and this is how I did in just 1 step.

— Double click on “Prepare for shipping to the end user” icon in the Desktop. Upon rebooting, you will be asked for your preference (including name and username) and voila! you can login as a normal from then-on..
ubuntu OEM install

How to fix Wifi connectivity issues with WPA & WPA 2 Enterprise on Ubuntu 13.10

After the upgrade to Ubuntu 13.10, I was able to connect to my home wifi, but not my office one. I realised Ubuntu has issue is with only “WPA & WPA 2 Enterprise” type authentication. On Googling, I came across this stackoverflow post to be closely relevant. However, I fixed the following way. Delete the faulty connection from list in Network Connections.

$ locate MyWifiName /etc/NetworkManager/system-connections/MyWifiName

Open the above file as a root user and remove the below line and retry connecting. It works!

system-ca-certs=true

and you’re welcome 🙂

How to take a screenshot of a portion of the screen in Ubuntu

Taking a screenshot is as simple as pressing PrintScreen button and finding it saved in ~/Pictures directory. This gets awfully tough when we have a multiple screen setup and wanted to take just a part of the image. I used to manually crop the required portion using an image editor (like Shotwell, yes you heard it right).

It was just today I discovered that there is an option to take a screenshot of just a portion of your scrreen by pressing Shift+PrintScreen combination. You may press ALT+PrintScreen for a screenshot of the current active Window. This gives us a plus cursor to highlight/choose just a portion of a screen and once done highlighting, release the cursor.. and voila! that’s it 🙂

This is one such incredible hack for those multiscreen users like me!

[Solved] How did I fix Screen Resolution in Ubuntu

Today, I’ve got a new external LCD Monitor on my work station. I had resolution issue in my Ubuntu 13.10. The monitor suggested the recommended resolution to be 1680×1050, but mine listed 1024×768 as it’s maximum resolution.

By Googling, I came across this post and it worked out for me:

Open up a shell :

$ xrandr

(This will show you your connection type, in my case it’s VGA1)

$ cvt 1680 1050 60

(Just type this in and hit enter, my refresh rate is 60. My resolution can handle 1680×1050. Copy the part after ‘Modeline’ e.g. Modeline “1680x1050_60.00” 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync then add this to the following command.

$ xrandr --newmode "1680x1050" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync

(Notice how I took out the “_60.00” part after “1680×1050” above? It only works if you take out that refresh bit.)

$ xrandr --addmode VGA1 1680x1050

(This should add the new resolution you used to get, my monitor only gets to 1680×1050. The VGA1 is the connection type you get in the first command i mentioned. You might have something like hdmi1 or something.)

How did I fix a fan error

I found something unusual with my lenovo T410 laptop since last week. It started to perform too slow. ‘top’ command didn’t hint any unusual activity. Later, I realised my laptop getting heated up insanely.  It didn’t strike my mind to check the heatsink fan whether it’s running.

laptop fan

heat sink fan Courtesy : geek.com

I realised only when my laptop got shut down without notice when overheated. While attempting to restart, it throwed a fan error. I then took it to my admin ninja at office. He blew too hard into the heat sink few times. It emitted loads of dust, followed by which he had hit ‘Esc’ and voila! it started to boot. Till date, it works like a charm and it no more gets heated up.

P.S. I was lucky enough to get it working this way. You may have to take it to a service centre if this method doesn’t fix for you.

 

[Solved] Ubuntu Hardware not detected

Today, I’ve encountered a strange issue with my laptop. When I start as usual, none of my hardware components were not working including my keyboard, trackpad and wifi. I have soon plugged in an external keyboard and mouse to see if they work, so that I can find what’s happening within and Voila, it worked!. I was shocked to see my settings had no options associated with wifi nor my trackpad. I found no result being populated when I tried the below command.

lspci | grep wireless

Restart didn’t help me either. Then, Shrini hinted me to run software update and do a restart. Oh yes! Now I remember, my previous update was unsuccessful because I had to ‘force kill’ it as it was hung at the time of update for some reason.

Solution : I ran the update by bringing the update manager (Press Alt+F2 and type ‘update-manager’ in the box and hit enter) and it asked me for a restart. Hooray! Everything started working as expected after a restart.

Lesson learnt : Avoid force killing the update process while updating. If done, make sure you re run before a restart.

[SOLVED] Why don’t many https enabled sites load on Windows?

Yesterday, a friend of mine came to me with a strange but interesting issue on his Windows 7 machine. Many secured (https enabled) sites were not loading properly; whereas Google.com worked fine, but not any other Google services. They either result in a web page not found error or load partly and fails to login.

Screenshot from 2013-07-18 11:01:56

As an initial triage, to check for consistency, I verified if this issue exists across all browsers –   and yes! IE, Firefox and Chrome resulted the same.

Ping to google.com was successful with no delay; But telnet facebook.com 443 failed. This made me confirm that the issue is close to the traffic towards https. I also made sure firewall was turned off while testing this.

Next, I thought if his Airtel 3g dongle modem had some issues and thus I tried connecting to my BSNL Wifi. Whoops! it behaved the same way.

Google results suggested me to change the default DNS to either openDNS (208.67.222.222) or Google’s (8.8.8.8) and to my destiny, it didn’t help me either.

After a while, out of no where, my instinct suggested from my past experience that I fixed a similar kind of issue by changing the System date and time while I was using Windows.

.. .and voila!! I see the same issue here. His system date and time in his laptop was set way behind the actual date (May be it’s time to replace his CMOS battery or whatsoever). After setting the right time and enabled auto-sync with the internet, all websites started loading as expected without any issues.

Uff! Seriously, a change in date could impact this bad? Doh, whatever.. I fixed it and left the room like a boss 😉

Script to import Salesforce Solutions to Zendesk Forums

I was given a task to migrate Salesforce Solutions to Zendesk Forums. I realised the only way that you can export Solutions from Salesforce, is to generate a report and export the results as .xls or .csv format.

I selected only Content Title and Solution Description and exported to a csv file. I chose .csv format as I had a feeling it could be comparatively easier to code to import.

Create a forum in Zendesk where you want the Salesforce solutions to be dumped and find it’s forum id via the URL.

Replace it in the script that I wrote and run it to to read this csv file and import into Zendesk.

You may find the script here : https://github.com/ijeyanthan/salesforce-solutions-to-zendesk-forum

To extend the functionality, visit developer API docs http://developer.zendesk.com/documentation/rest_api/forums.html for the list of possible JSON requests available in Zendesk.

How to do a batch image resize in Linux

Today, I realised my ~/Photos directory has crossed 50GB and I badly had to clear them up. I’m definitely not spending time choosing images to delete this time, but just reduce the size of those high resolution images that are eating away my disk space.

I found a way to reduce the size of the image without reducing the quality much.

you need to install it if you don’t have the tool :

sudo apt-get install imagemagick

The most basic way to use convert is to give a file at a time on the command line:

$ mogrify -verbose -resize 50% <filename>

I had to do this for the whole directory and thus replaced the filename with a *

$ mogrify -verbose -resize 50% *

This is a time consuming operation and thus a due patience is required.

We can also mention the dimension of a picture. Say, I reduced the dimension to 1024×768 with this command:

$ mogrify -resize 1024×768 *.jpg

I also found that we can convert all our PNG images in a folder to the JPEG format

$ mogrify -format jpg *.png

NOTE : mogrify will replace your existing file with the updated content. Make sure you are aware of this.

For further info, $ man mogrify to read the manual or go to http://www.imagemagick.org/www/mogrify.html

Deleting specific strings from file using Python

I had to delete/replace few words from few text files. Find and Replace feature wouldn’t come handy if there are too many files to edit.

The following python script helps us to replace specific string/phrase from the file with something else.


#filename=prune.py

infile = "file.txt"
outfile = "updated_file.txt"

delete_list = ["phrase1", "phrase2"]
fin = open(infile)
fout = open(outfile, "w+")
for line in fin:
    for word in delete_list:
        line = line.replace(word, "")
    fout.write(line)
fin.close()
fout.close()