Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

Monday, March 10, 2014

How To Prevent Copy or Cut File From Computer to Flashdisk

http://.blogspot.com

The steps are as follows:

  1. Sign in to Regedit (Press Windows key + R and type regedit)
  2. Sign in to HKEY_LOCALMACHINE SYSTEM CurrentControlSet Control
  3. Right-click on the Control folder select New-> Key
  4. Name the new folder with "StorageDevicePolicies"
  5. Then right click on the folder with the name "StorageDevicePolicies", and select New-> DWORD
  6. Give the name "WriteProtect"
  7. Double click DWORD with the name "WriteProtect", and then change the Value Data to 1
  8. Restart your computer

  • Note: If that takes data from the user computer will display the message *. User to restore it just change the Value Data from key "WriteProtect" to 0
Read more »

Tuesday, February 18, 2014

How to remove comments and blank lines from file

So often you need to remove comments and blank lines form configuration files.
You can do it in a very easy single step.

#grep -v ^$ file.conf | grep -v ^#

What it does is grep ^$ from your file. You must be saying I dont have any such character in my file. Actually those characters have their own meaning.

^ begging of the line
$ end of the line

So searching for ^$ means you are searching a blank line.
The -v option invert your search.
So #grep -v ^$ matches all the lines except the blank lines.

Again the pipe | sends those match to another grep command which matches any line begging with #. Then -v option again inverts the match giving you all the lines except comment and blank lines.

If you want the output in a file rather than screen then redirect it,
#grep -v ^$ file.conf | grep -v ^# > newfile

For more of the input/output and error redirection visit http://.blogspot.com/2008/06/devnull-2.html
Read more »

Monday, January 27, 2014

SOLVED File Not Opening On Click

While working on a website I had problem of file not opening when I double click them or choose open from right click menu. I had set the default opener for .html file geany, but no matter what I do it wouldnt open. I tried changing it to text editor (gedit) but none of the file would open with the default program.

After investigating the problem was the text file had +x (execute) permission on them. And I had set preference in nautilus to run executable text files when they are opened. So every time I was trying to open the text file it was running instead of opening.




The solution is simple:
  1. Either remove the execute permission of the text files
  2. Or In Nautilus-Preference-Behavior-Executable Text Files Change option to view executable text files when they are opened
Read more »