Saturday, December 30, 2017

How To Solve Sublime Text Not Showing In Optional Application List Of Open With Menu On Right Click

How To Solve Sublime Text Not Showing In Optional Application List Of Open With Menu On Right Click

I just installed sublime text in my new Linux box.. And tried to open text file with it instead of default editor.. So I clicked on 'Open With' option in Right Click menu.... But I couldn't see sublime-text in application list shown on clicking 'Open With'...

So I just googled for solution... It's easy to fix... We just need to copy desktop entry to local list of desktop entries list...

Just Run The Following Lines.. To Make Things Work...

Step 1 :

Just Copy the contents of /usr/share/applications/sublime_text.desktop to ~/.local/share/applications/sublime_text.desktop

cp /usr/share/applications/sublime_text.desktop ~/.local/share/applications/sublime_text.desktop

Step 2 :

Now Just update the index of desktop entries... sudo update-desktop-database

sudo update-desktop-database

That's It Now It will appear at menu list of 'Open With'...

Just check the video... Friends... Don't Forget To Subscribe...


Sunday, September 10, 2017

How To Find And Kill Application / Process Running On Particular Port In Linux Systems

How To Find And Kill Application / Process Running On Particular Port In Linux Systems



Today, I'm going to show you how to find and kill application / process running on particular port in Linux Systems.

We can use lsof command to find the process running on particular port. The syntax of lsof command to find the application running on particular port looks like following..

lsof -i:port

Summary of above code...
lsof command is used to list open files.. and the argument -i is used to list files whose ip address / port matched to specified ip address / port.

Note: If you ignore ip address / port after -i then the above command will lists processes for all ip addresses...

For example to find the process / application listening on port 80, run the following code..

lsof -i :80

The output will looks like following..

shivaraj@shivaraj-A14RM0E:~$ lsof -i:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME plugin_ho 3981 shivaraj 20u IPv4 420822 0t0 TCP 192.168.0.117:33104->45.55.41.223:http (CLOSE_WAIT) shivaraj@shivaraj-A14RM0E:~$

If you omit port value... lsof -i the output will looks like following one..

shivaraj@shivaraj-A14RM0E:~$ lsof -i COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME plugin_ho 3981 shivaraj 20u IPv4 420822 0t0 TCP 192.168.0.117:33104->45.55.41.223:http (CLOSE_WAIT) node 4165 shivaraj 12u IPv4 509873 0t0 TCP *:http-alt (LISTEN) firefox 4178 shivaraj 114u IPv4 7216095 0t0 TCP 192.168.0.117:42436->server-54-230-190-100.maa3.r.cloudfront.net:https (ESTABLISHED) shivaraj@shivaraj-A14RM0E:~$

Now, we are going to see how to kill the process which is listening on particular port.. If we can find the pid of process we can pipe it to kill command. so that we cann kill the process listening on particular port..

By specifying -t for lsof command we can get pid of process listening on particular port... Look at the below command signature..

lsof -t -i :port

If you want to find out pid of process listening on port 80, run the following code..

lsof -t -i :80

The above commands output will looks like..

shivaraj@shivaraj-A14RM0E:~$ lsof -t -i :80 3981 shivaraj@shivaraj-A14RM0E:~$

To kill the process listening on port 80, pass the output of above command to kill command...

sudo kill $(lsof -t -i :80)

That's it for now.. If you like don't forget to share it guys.. You can follow us on fb.com/opensourceinside and also subscribe our channel on Youtube..


Wednesday, February 8, 2017

Disabling/Changing Drum Beat Sound On Ubuntu Startup

Disabling/Changing Drum Beat Sound On Ubuntu Startup


Ubuntu would always play, Drum Beat sound on Ubuntu system startup, But some people may find this is annoying and want to disable or want to change it with their own custom alert sound... Unfortunately, Ubuntu haven't provided a simpler GUI way to disable/customize the startup sound (so far I know..).

However, it's not that much hard to disable/change the startup sound. In this post I will show you how to change/disable startup sound in Ubuntu.

Mostly, All sounds which generally used by Ubuntu are .ogg format sound files and they are located in /usr/share/sounds/ubuntu/. We can disable or change the startup sounds just by renaming/replacing the corresponding sound file...

Disable Startup Sound :

To disable startup sound we just have to rename the file named system-ready.ogg which is located in /usr/share/sounds/ubuntu/stereo/. Just run the below command to disable the startup drum beat in your Ubuntu system..

sudo mv /usr/share/sounds/ubuntu/stereo/system-ready.ogg /usr/share/sounds/ubuntu/stereo/system-ready.ogg.old

Changing The Startup Sound With One You Like To Hear..

We can change/customize our startup sound just by replacing existing system-ready.ogg with our own sound file (should be in .ogg format) with existing name (system-ready.ogg)..

I have already mentioned that Ubuntu use .ogg file format for its alert sounds.. So your new sound file also should be in that format.. Don't worry, If you don't have your sound file in .ogg format.. You can just convert your sound file from current format to .ogg .. There are many tools available to do that for you.. Even you can convert it in online... media.io is one of such kind of web site where you can freely convert your sound file to .ogg format..

Now, if you have your new sound file with .ogg format in your hands.. Then... Just disable existing sound by running following commands..

sudo mv /usr/share/sounds/ubuntu/stereo/system-ready.ogg /usr/share/sounds/ubuntu/stereo/system-ready.ogg.old sudo cp /PATH_TO_YOUR_NEW_SOUND_FILE/ /usr/share/sounds/ubuntu/stereo/system-ready.ogg
Please, Don't forget to replace /PATH_TO_YOUR_NEW_SOUND_FILE/ with your files path..

For Example..

If you have your new file named beep.ogg in your Downloads directory.. Then you have to execute following command....

sudo cp ~/Downloads/beep.ogg /usr/share/sounds/ubuntu/stereo/system-ready.ogg
I have tested it in my Ubuntu Linux 16.04 LTS and Hope will work in other versions too...

That's it.. Now just restart your system and see the change... Follow us on facebook.


Tuesday, January 24, 2017

QR Code Generation Using JavaScript

QR Code Generation Using JavaScript


QR code stands for Quick Response Code. We can encode some text / string as QR Code and can retrieve it later by decoding the QR code. We can generate QR code using different programming languages in different ways but so far I know, the simplest way to generate QR code is using JavaScript.

QRCodeJs Library :

In this post, I am going to show you how to generate QR code using JavaScript. For this demo we are going to use library called QRCodeJS. In short QRCodeJS is a JavaScript library that makes generation of QRCode for given string easy using JavaScript.

Basic Usage:

Just create a new html file, include qrcode.js file and copy paste the below code into your html file..

<div id="qrcode"></div> <script> new QRCode(document.getElementById('qrcode'), 'Hello, World'); </script>

It just needs user to write two lines of code.. The first line is DIV element in which we want to display our generated QR Code. The next thing we have to do is, creating the instance of QRCode object with our custom values. It takes two parameters, first one is HTML Element | Object in which we want to display QR Code and the second parameter is text | String which we want to encode as QR Code.

Live Demo

Type something in below input field...

Here, you can see/get the full code for above demo..

QR Code Generation With Custom Options :

You can customize QR Code generation by configuring QRCode object.

<div id="qrcode"></div> <script> var qrcode = new QRCode(document.getElementById('qrcode'), { text: 'Hello, World', width: 500, height: 500, colorDark : 'brown', colorLight : 'lime', correctLevel : QRCode.CorrectLevel.H }); </script>

Some other methods available in QRCode generator..

qrcode.clear(); // This method will clear the current code. qrcode.makeCode('Hello, User'); // This will generate new code.

That's it for now.. Follow us on Facebook
Don't forget to share it with your friends...