Thursday, November 3, 2011

How to set different permissions for subfiles and subdirectories

To give different permission settings for all subdirectories and subfiles use following commands:

find /start/location/ -type f -print0 | xargs -0 chmod 644
find /start/location/ -type d -print0 | xargs -0 chmod 755

If you receive such an error "permission denied", run above commands as root with "su" parameter or try them as following:

sudo find /start/location/ -type f -print0 | sudo xargs -0 chmod 644
sudo find /start/location/ -type d -print0 | sudo xargs -0 chmod 755

In here permission settings of all subfiles will be changed to "644" and all subdirectories will be changed to "755".

Saturday, July 9, 2011

Some useful Linux commands & tips

1) List users with cat or awk in a system
cat /etc/passwd | cut -d: -f 1,3,6 | grep "[5-9][0-9][0-9]" | grep "/home" | cut -d: -f1
awk -F: '$6 ~ /\/home/ && $3 >= 500 {print $1}' /etc/passwd

2) Count the results with the pipe wc -l
Above commands can be rewritten as following
cat /etc/passwd | cut -d: -f 1,3,6 | grep "[5-9][0-9][0-9]" | grep "/home" | cut -d: -f1 | wc -l
awk -F: '$6 ~ /\/home/ && $3 >= 500 {print $1}' /etc/passwd | wc -l

3) Grep command
Recursively search "some_string" only in python files in home directory
grep -r --include="*.py" "some_string" /home
Display the process containing "some_string"
ps aux | grep "some_string"

Thursday, June 9, 2011

Reverse Engineering: Developing a device driver for Linux

Reverse engineering is the most used way to develop a device driver for Linux. If you are interested to write a program to support your unknown driver in Linux, at least you need an average programming capability in C language.

Some useful links:

Introduction to Reverse Engineering Software
www.acm.uiuc.edu/sigmil/RevEng

Learning how to reverse engineer a Windows USB driver
www.jespersaur.com/drupal/book/export/html/21


Processing: Web-cam capturing in Linux

Processing is an open source and cross-platform programming language and integrated development environment (IDE). It is especially used for teaching the basics of computer programming.
Website:
http://processing.org

To capture a web-cam with processing there is a standard video library.
However it requires pre-installation of Quicktime and WinVDIG.

It seemed quite difficult for me to run this way video capturing in Linux.
Finaly I found an additional library GSVideo.
Website:
http://gsvideo.sourceforge.net

It works very similar to the standard video library. Plus it does not require pre-installation of Quicktime & WinVDIG, and works in Linux platform as well.

Below simple example shows the differences of standard video library and GSVideo library.



// Capturing web-cam with standard video library.
// It requires pre-installation of QuickTime and WinVDIG.
// Hard to use in Linux platform.

import processing.video.*;
Capture camera;

void setup(){
size(320, 240);
camera = new Capture(this, 320, 240, 12);
}

void draw(){
image(camera, 0, 0);
}

void captureEvent(Capture camera){
camera.read();
}



// Capturing with GSVideo library works cross-platform.
// It only requires additional GSVideo library as below directory order;
// <processing>/sketchbook/libraries/GSVideo
// Visit gsvideo.sourceforge.net for reference information.

import codeanticode.gsvideo.*;
GSCapture camera;

void setup(){
size(320, 240);
camera = new GSCapture(this, 320, 240);
camera.play();
}

void draw(){
image(camera, 0, 0);
}

void captureEvent(GSCapture camera){
camera.read();
}



It worked very well for me.
Hope this post helps someone else in similar case :)


Friday, June 3, 2011

Display or print Japanese fonts within a pdf file in Ubuntu/Linux Distribution

I had a problem to display/print Japanese fonts in a pdf file in my Ubuntu 10.04 distro. Evince did not display nor print the Japanese fonts. Adobe Reader displayed correctly however it did not print the Japanese fonts.

Installing the package poppler-data fixed those problems. It is available in Ubuntu package manager.

Prior of installing the package poppler-data, I realized that Foxit PDF reader was already rendering the Japanese fonts very well. Therefore I also recommend installing Foxit PDF Reader.

Foxit Reader for Linux:
http://www.foxitsoftware.com/pdf/desklinux/download.html


Monday, January 24, 2011

Choppy Flash playback in full screen [Ubuntu/Linux]

Try these commands:

sudo mkdir /etc/adobe
echo "OverrideGPUValidation=true" >~/mms.cfg
sudo mv ~/mms.cfg /etc/adobe/

Restart the browser.

If that doesn't work, then right-click the flash video, select "Settings", then untick the option "Enable hardware acceleration".

Sources:
http://www.webgapps.org/flash/issues-and-solutions
https://bugs.launchpad.net/ubuntu/+bug/346289

Saturday, January 22, 2011

Install Lingoes translator tool in Ubuntu/Linux ... or give it a try to a Linux native dictionary software: Goldendict

1) Install Wine Compatibility Layer (WineHQ):
winetricks should be also installed as default, if not also install winetricks.

2) Install Internet Explorer 7 via winetricks:
Open terminal and type "sh winetricks ie7" then follow the instructions.

3) Copy "mfc42u.dll" file to system and system32 folders:
http://www.dll-files.com/dllindex/dll-files.shtml?mfc42u

4) Download and install Lingoes translator tool (version 2.7.1 tested):
http://www.lingoes.net/en/translator/download.htm

5) Open "Internet Explorer" with Wine and edit "ActiveX Controls" settings:
Tools -> Internet Options -> Security
Click "Custom Level" for "Internet" zone and enable ActiveX Controls
Enable "Download signed ActiveX Controls"
Probably Internet Explorer will not be your default Internet browser in Linux, therefore security warnings due to those settings might not be so important.

6) You may also install the fonts like following way:
sh winnetricks fakejapanese
sh winnetricks fakekorean
sh winnetricks fakechinese

7) You can add speech functionality, if you like:
Go to http://www.lingoes.net/en/translator/speech.htm and follow the instructions.

Except hot-keys and text capturing from the screen Lingoes might work well.

GoldenDict:
GoldenDict is a great dictionary software and natively supported in Linux Distributions.

Supported dictionary files:
  • Babylon .BGL files,
  • StarDict .ifo/.dict./.idx/.syn dictionaries,
  • Dictd .index/.dict(.dz) dictionary files, and more.

GoldenDict official website:
http://goldendict.org