Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, February 14, 2013

How to share folders between linux (host) and windows(guest) using Oracle VirtualBox



1- Setup a virtual HD and install windows on it.
2- From VBox settings, go to 'shared folder' and add new folder. also you may check automount option.


3- Download virtualbox additions CD , and it should be same as your VBox version (ex: VBoxGuestAdditions_4.2.4.iso)
4- Add the iso image to your virtual devices and boot into windows
5- From windows open CD and install the additions, this will install many drivers and you may need to reboot windows.


6- From windows go to 'my computer', you will find your shared drives. enjoy!




Thursday, October 18, 2012

make -r world: build failed. Please re-run make with V=s [solution]

when i tried to compile openWRT for the first time i had the following errors

make[3]: Leaving directory `/home/oghazal/Desktop/openWRT/trunk/tools/missing-macros'
make[3]: Entering directory `/home/oghazal/Desktop/openWRT/trunk/tools/cmake'
mkdir -p /home/oghazal/Desktop/openWRT/trunk/dl
/home/oghazal/Desktop/openWRT/trunk/scripts/download.pl "/home/oghazal/Desktop/openWRT/trunk/dl" "cmake-2.8.9.tar.gz" "801f4c87f8b604f727df5bf1f05a59e7" "http://www.cmake.org/files/v2.8/"
--2012-10-15 16:54:18--  http://www.cmake.org/files/v2.8/cmake-2.8.9.tar.gz
Resolving www.cmake.org... 66.194.253.19
Connecting to www.cmake.org|66.194.253.19|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26570240 (25M) [application/x-gzip]
Saving to: `STDOUT'

100%[=======================================>] 26,570,240  10.2M/s   in 2.5s   

2012-10-15 16:54:21 (10.2 MB/s) - written to stdout [26570240/26570240]

MD5 sum of the downloaded file does not match (file: 685d9d1fb6538b5ec03d67f54137685e, requested: 801f4c87f8b604f727df5bf1f05a59e7) - deleting download.
--2012-10-15 16:54:21--  http://mirror2.openwrt.org/sources/cmake-2.8.9.tar.gz
Resolving mirror2.openwrt.org... 46.4.11.11
Connecting to mirror2.openwrt.org|46.4.11.11|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2012-10-15 16:54:21 ERROR 404: Not Found.


Download failed.
--2012-10-15 16:54:21--  http://downloads.openwrt.org/sources/cmake-2.8.9.tar.gz
Resolving downloads.openwrt.org... 78.24.191.177
Connecting to downloads.openwrt.org|78.24.191.177|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2012-10-15 16:54:22 ERROR 404: Not Found.

Download failed.
No more mirrors to try - giving up.

make[3]: *** [/home/oghazal/Desktop/openWRT/trunk/dl/cmake-2.8.9.tar.gz] Error 2
make[3]: Leaving directory `/home/oghazal/Desktop/openWRT/trunk/tools/cmake'
make[2]: *** [tools/cmake/compile] Error 2
make[2]: Leaving directory `/home/oghazal/Desktop/openWRT/trunk'
make[1]: *** [/home/oghazal/Desktop/openWRT/trunk/staging_dir/target-mips_r2_uClibc-0.9.33.2/stamp/.tools_install_nnnnn] Error 2
make[1]: Leaving directory `/home/oghazal/Desktop/openWRT/trunk'
make: *** [world] Error 2
so it seems that cmake is not getting downloaded correctly using wget, so to solve this problem we need to download the cmake package manually (using firefox not wget) and then to place it in `trunk/dl` directory and then run `make` again.

openWRT: please fix package/helloworld/Makefile - see logs/package/helloworld/dump.txt for details [solution]


When I tried to compile a `hello world' package for openWRT i had the following

ERROR: please fix package/helloworld/Makefile - see logs/package/helloworld/dump.txt for details

and inside dump.txt

....
Makefile:90: *** DESCRIPTION:= is obsolete, use Package/PKG_NAME/description.  Stop.


it seems that using description in the makefile is an old way so i just commented the description out and then compilation went with no errors.

Wednesday, October 17, 2012

Makefile:4: *** missing separator. Stop. [solution]

When i tried to compile a program using a Makefile, i had the following error  
Makefile:4: *** missing separator.  Stop.
  after googling the error i found that `make` does not accept whitespaces and unlike DOS, it is expecting a tab in the beginning of each line.

so to solution is to replace the whitespaces ( in this case in the 4th line) with a tab.

reference: http://www.delorie.com/djgpp/v2faq/faq22_17.html

Tuesday, October 16, 2012

After Update Firefox is not working; /usr/lib64/firefox/firefox: symbol lookup error: /usr/lib64/xulrunner/libxul.so: undefined symbol: PR_SetCurrentThreadName [solution]

When i tried to run firefox after update on my fedora 17 machine,  when i was trying to run it nothing has appeared. also i tried to run it on terminal to find out what error is happening i got


/usr/lib64/firefox/firefox: symbol lookup error: /usr/lib64/xulrunner/libxul.so: undefined symbol: PR_SetCurrentThreadName


a quick search over the internet brought to me an easy solution since this problem seems to be popular, the solution was to update a package called nspr

#yum update nspr

reference : https://bugzilla.redhat.com/show_bug.cgi?id=865941

Wednesday, May 23, 2012

How-To Convert Audio/Video in Linux

Sometime we need to convert audio/video from type to another for many reasons such as reduce the size  of an email attachment, compatibility hell or others.Linux users are lucky enough to have a nice tool called ffmpeg.

ffmpeg is a very fast video and audio converter that can also grab from a live audio/video source. It can also convert between arbitrary sample rates and re-size video on the fly with a high quality polyphase filter.

Installation is easy and straight forward since ffmpeg tool is exist in most primary distributions repository.so we can use the package manager to install it. since i am running a fedora system i am going to us YUM.

$ sudo yum install ffmpeg


The usage of ffmpeg is easy too, i will show few examples.

Example below is the simplest way, which is to pass the input file name and the output file name only.

$ ffmpeg -i mysong.wav mysong.mp3    # this will convert audio.wav to audio.mp3.

$ ffmpeg -i video.avi video.mp4    # same as the previous example.

Notice that we are providing the output file's extension too. There are many options for this tool, the most common are below.

Audio/Video

-i  input file name
-b  bitrate
-f  format ( mp3,ogg,wav,avi,mp4...etc)
-fs file size, this option will trim your video when the size limit is reached
-y  overwrite output files
-sameq covert but keep original quality

Video only

-r frame rate (fps)
-s set frame size (128x96,800x600,1920x1080...etc)


a little more advanced method were we put more options is use.

$ ffmpeg -i song.mp3 -y -b 44.1k -f ogg -fs 10M song


$ ffmpeg -i video.webm -y -b 44.1k -f avi -fs 100M -s 1920x1080 -r 60 video

see the manual for all options


$ man ffmepg

Saturday, May 19, 2012

General Purpose Voice Command Device

ABSTRACT

General purpose voice command device controlled by means of the human voice, with ability to interact and responds back a neural speech belongs to the asked command or by performing a related certain hardware action like switching or stepping a motor.

System Overview

The device totally removes the usage of buttons or switches, and instead its responds to human-independently vocal commands.

SUMMARY


Approach Type Quick-And-Dirty
Programming Languages POSIX and ANSI C
Processors I686 Compatible CPU and Microchip PIC18F4550
Software Components/Libraries Linux Kernel, Bash Shell, Gstreamer, Espeak,Microchip USB Framework and other open-source libraries
Compiler/Linker GNU C Compiler
Microchip C18



How to delete saved wireless network in gnome 3

Presumption

Linux system with GNOME 3

you had to connected a wireless network and it is automatically saved and every time the saved network is available, Network manager is trying to connect it.

How-TO

open your favorite terminal emulator

write

$ nm-connection-editor

click on wireless tab, and then select the unwanted network and delete it.


Monday, May 14, 2012

Syntax highlighting in nano text editor

Presumption

Linux system with nano text editor


open your favorite terminal emulator 

go to your home directory

$ cd ~

create a file named ".nanorc"

$ nano .nanorc

add the following lines

include "/usr/share/nano/c.nanorc"
include "/usr/share/nano/java.nanorc"
include "/usr/share/nano/sh.nanorc"
include "/usr/share/nano/perl.nanorc"

save

CTRL+X

have a nice coding!

Monday, May 7, 2012

How to ptrhead on Linux using codeblocks IDE


If your linker is complaining when you are pthread-ing on your Linux, then you are probably looking for the solution below

Method 1






From "Setting" menu choose "Compiler and debugger.." click on "linker Settings" tab, under "Other linker option" write 'pthread', click OK and compile.


Method 2

 





If the first method didn't work for you,repeat the same steps and remove what did you write under "Other linker option". now under "link libraries" scroll down and click "add" then add the path to libpthread. to know its location. execute in terminal


$ locate libpthread


then click OK.

the linker is happy now, so compile your code.

Saturday, April 28, 2012

Installing MPLAB X IDE on Linux




MPLABX Integrated Development Environment (IDE) is a free, integrated toolset for the development of embedded applications on Microchip's PIC and dsPIC microcontrollers.

MPLAB X is not a new version of the current MPLAB IDE v8 framework but is instead based on Oracle's open-source NetBeans platform. In addition to its predecessor's functionalities and compatibility with Microchip's existing development tools, the new IDE utilises many NetBeans features allowing for user-interface improvements and performance upgrades[1]

Presumption

System: Fedora Core 16 - x64

Downloading


download IDE and your favorite compiler
http://ww1.microchip.com/downloads/mplab/X/index.html

OR using wget
wget http://ww1.microchip.com/downloads/mplab/X/mplabx-ide-v1.10-linux-installer.run # mplab X IDE
wget http://ww1.microchip.com/downloads/mplab/X/mplabc18-v3.40-linux-full-installer.run # C18 Compiler

Since IDE written in Java we need java run time if you already them installed go to next step if you dont, following the link below

http://www.java.com/en/download/help/linux_install.xml

Installing

$ chmod 755 mplabx-ide-v1.10-linux-installer.run
$ chmod 755 mplabc18-v3.40-linux-full-installer.run

$ ./mplabx-ide-v1.10-linux-installer.run
$ ./mplabc18-v3.40-linux-full-installer.run

$ reboot

Configuring

now we should configure the IDE before we start compiling codes

Run mplabx

$ mplab_ide

from "run" menu --> Set Project Configuration --> customize...

In left-most click on mcc18 then in right-most scroll down and double-click on "Include directories", a new dialog will be opened,double-click on it and change the default path for header file directories to "/opt/microchip/mplabc18/v3.40/h".

Compiler Configuration

Click ok.

In left-most click on MPLINK then in right-most scroll down and double-click on 'Library directories',a new dialog will be opened, double-click on it and change the default path for header file directories to "/opt/microchip/mplabc18/v3.40/lib/".

Linker Configuration


Click ok.

Apply then ok.

Case-Sensitive Problem


i have notice a small problem when i tried to compile an old project. the error was "Error - could not find file 'LibName.lib'.

this problem happen because lib names are written as high-letter on hard disk whereas MPLINK looking for low-letter names. eg ( on disk p18F4550.lib and MPLINK looking for p18f4550.lib).

to solve this problem we will make all of them low-letter


$ su -  # be root
# cd /opt/microchip/mplabc18/v3.40/lib
# for f in `find`; do mv -v $f `echo $f | tr '[A-Z]' '[a-z]'`; done


Known Bug in Oracle Java JDK 1.6.x



Bug Description

incorrect mouse pointer position on java menus when running the application
maximized under gnome-shell.

1. If I single-click a menu in the menu bar, the menu will flash
briefly and disappears (instead of staying opened).
2. If I click and hold on a menu in the menu bar, the menu stays
opened, but the selection is vertically displaced (I have to move the
mouse to the third menu item to select the first one, for example).
3. If I right-click to access a context-menu, the selection is
displaced as described in the previous case).


The problem is that when the window is maximized java was not updating the
 window position properly. If the window was at pixel (100,100) then it was
 maximized, AWT thinks that it is still at pixel (100,100) instead of close to
(0,0). This causes it to miscalculate mouse pointer positions relative to the
window. [2]

Solution for this bug

remove old packages
# yum remove java-1.6.0-openjdk-1.6.0.0-65.1.11.1.fc16.x86_64 java-1.6.0-openjdk-devel-1.6.0.0-65.1.11.1.fc16.x86_64

*this could be vary from system to another, to know yours
$ rpm -qa|grep java

install new packages
# yum install java-1.7.0-openjdk
# yum install java-1.7.0-openjdk-devel

Set default Java version to mplabx_ide
# cp  /opt/microchip/mplabx/mplab_ide/etc/mplab_ide.conf  /opt/microchip/mplabx/mplab_ide/etc/mplab_ide.conf.bk
# gedit /opt/microchip/mplabx/mplab_ide/etc/mplab_ide.conf

search for jdkhome="/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.3.x86_64/" and replace it with jdkhome="/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.3.x86_64/"

*this could be vary from system to another, to know yours
$ ls /usr/lib/jvm/

References

[1] http://en.wikipedia.org/wiki/MPLAB
[2] https://bugzilla.redhat.com/show_bug.cgi?id=698295

Friday, April 27, 2012

Installing usburn on linux for brenner8


usburn is a Linux program, that analyses a HEX-file and transfers the
contained data via USB to the PIC-programmer Brenner8 or Brenner9. 

Prepare a place for installation
$ mkdir usburn && cd usburn  

download the usburn for Linux using firefox

or using wget
$ wget http://www.sprut.de/electronic/soft/usburn/linux/usburn_0_4.tar

then extract it
$ tar xvf usburn_0_4.tar 

modify "makefile" with your favorite text editor
$ gedit makefile 

change the line "-L/usr/local/lib" to 'libusb.so' location. I've found it under /lib/ directory so i will change the line to "-L/lib/". to find the location of yours, simple execute

$ locate libusb.so

save and close.

$ make
$ sudo mkdir /usr/bin/usburn.dir
$ sudo  cp -r usburn *.dat b8_firmware/ b9_firmware/ bootloader_0_2550/  /usr/bin/usburn.dir
$sudo gedit /usr/bin/usburn

write
#!/bin/sh
cd /usr/bin/usburn.dir
./usburn



save and close

$chmod +x /usr/bin/usburn

Usburn uses libusb instead of kernel modules to access the programmer,
consequently root privileges are required. To give access to normal users one
has to create a file "/etc/udev/rules.d/99-sprutbrenner" and to write into this
file: 

SUBSYSTEM=="usb", SYSFS{idProduct}=="ff0b", SYSFS{idVendor}=="04d8",
GROUP = "plugdev" [1]

$ cd /etc/udev/rules.d/
$ sudo echo "SUBSYSTEM=="usb", SYSFS{idProduct}=="ff0b", SYSFS{idVendor}=="04d8", GROUP = "plugdev" " >> 99-sprutbrenner

now programmer need to be calibrated, the manual below shows the steps
http://sprut.de/electronic/pic/projekte/brenner8/calibration_under_linux.pdf

the manual of usburn exist on

*NOTE* usburn does not support x64 in the meantime due to database incompatibility. check this out http://sprut.de/electronic/soft/usburn/linux/usburn_linux.htm#probleme

Thursday, April 26, 2012

Fedora :: error: db4 error(-30974) from dbenv->failchk: DB_RUNRECOVERY

While I'm trying to install a program using yum, yum was locked by another process then i had to freed it by sending it SIGKILL, and after that i passed my program to yum to install it then ... OPS !! yum is displaying a fatal error 

"error: db4 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db4 - (-30974)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:
Error: rpmdb open failed"

tried too many solution like cleaning up the yum's DB and it didnt solve it and in the end i fixed the problem by cleaning the RPM's DB and rebuild it again.

$ sudo rm -rf /var/lib/__db*
$ sudo rpm --rebuilddb
$ reboot # i had to reboot to solve it as well.

Wednesday, April 25, 2012

/boot/syslinux/ldlinux.sys: no match for target

If you are getting the error

"/boot/syslinux/ldlinux.sys: no match for target
syslinux: warning: unable to move ldlinux.sys"

then you are probably trying to install the syslinux boot loader to solve it make sure

1) your drive ( partition)  which you are trying to install syslinux on is either FAT16 or FAT32 otherwise syslinux will fail to start.

2) you have already created the file in your storage. using

$ mkdir -p /boot/syslinux/

then normally execute the syslinux installation command

$ syslinux -f -d /boot/syslinux /dev/sdb1

Tuesday, April 24, 2012

Installing Skype on Fedora 16 x64 machine using Autoplus (Error: Protected multilib versions)

Presumption

you are getting "Error: Protected multilib versions" when trying to install Skype using Autoplus on x64 system.

Solution

"Error: Protected multilib versions: glibc-2.14.90-24.fc16.6.i686 != glibc-2.14.90-14.x86_64"

This error seems to be occurred because skype is x32 bit executable but the system is x64, the "file" output says

/usr/bin/skype: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped


To solve this problem you have to install the glibc but the x32 bit, to do that, simple execute

$ sudo yum install  glibc-2.14.90-24.fc16.6.i686


If you have more "Protected multilib versions" just install thier x32 version then run autoplus and install Skype.

Monday, April 23, 2012

Flowchart and diagram drawing program for Linux


Presumption

Gnome 3 desktop environment is installed.

DIA

If you are looking to draw a flowchart or diagram for your documentation on Linux you may find “dia” project very interesting, the diagram drawing program (dia) is part of gnome project.

The man description says:

"Dia is used to create diagrams. Dia has a number of basic tools, like lines and boxes but can also dynamically load sheets. A sheet is a collection of tools that are used in a certain type of diagram.
Most diagram objects in Dia has handles. Lines can be connected to these handles and this way graph structures can be formed. When objects are moved or resized the connections will follow the objects.
Diagrams drawn in Dia can be exported PostScript."

After using it for hours i believed that is is good tool and it fits my need for drawing flowcharts of my software.

Installation

$ mkdir /tmp/dia
$ cd /tmp/dia/
$ wget ftp://ftp.gnome.org/pub/gnome/sources/dia/0.96/dia-0.96.1.tar.bz2 # size is 4.2 MB
$ tar xfv dia-0.96.1.tar.bz2
$ cd dia-0.96.1/
$ ./autogen.sh
$ make
$ sudo make install

now the program is installed and you can run it from terminal by writing $ dia or by clicking ALT+F2 then write “dia" and hit enter.


Saturday, April 21, 2012

How to customize fedora 16 and make it functional


-->

Presumption

Installed distro is Fedora 16 with Gnome 3 desktop environment.

Adding close and minimize buttons to windows

$ yum install gconf-editor

run it after installation by clicking on ALT+F2 then write “gconf-editor ” and hit enter.

in the Configuration Editor navigate to desktop --> gnome --> shell --> windows
Find “button_layout” and click on it and change it to ":minimize,maximize,close" .
logoff and logon again OR ALT+F2 then write “r ” and hit enter.

Show desktop icons and right clicks

 $ yum install dconf-editor 

Go to org --> gnome --> desktop --> background and check the box to show desktop icons. 

While this brings back desktop icons, and enables right clicking on the desktop, it makes the computer, home, trash icons visible. These are usually hidden with Ubuntu. To make them hidden again, but still allowing icons on the desktop, go to nautilus --> desktop, and uncheck the boxes for the icons you want hidden. 

Taskbar & dock

$ yum install docky # if you like dock-like taskbar
$ yum install tint2 # if you like classical taskbar
$ yum install gnome-panel # if you like the gnome original panel

to run and test them, ALT+F2 then write the name of program you want to run.

Personally i would recommend the gnome-panel for stability reasons, to add it to every system start up, ALT+F2 then write “gnome-session-properties” and hit enter, put name, lets say “gnome panel”, command “gnome-panel --replace”, and comment “ start up gnome-panel” then click add.

Hide all windows

usually, fedora user was hiding all menu by clicking ALT+CTRL+D, i like windows way to hide them (because it is uses less keys) which is WinKey (Or Super)+D.

To make it functional, hit WinKey and write "keyboard" --> "shortcuts" -->navigation --> "hide all normal windows " then set the shortcut you like.

Customizing the icons, fonts & theme

$ yum install gnome-tweak-tool

Then run it by hitting ALT+F2 then write “gnome-tweak-tool ” and having happy customization!
I like default xfce icons which is rodent icon set . I didn't find away to install it independently so i went to install the xfce desktop environment.

$ yum install xfce4-icon-theme

ALT+F2 then write “r ” and hit enter, after making any changes.

Fonts

the fonts "Tahoma" and "Calibri" are pretty enough with many languages support , they can be installed from windows directory. 

Gnome shell extensions

to install most of gnome extensions 

$ yum install gnome-shell-extension* 

the gnome-tweak-tool can be used for extensions customization.

Codeblocks

$ yum install codeblocks # for codeblocks
$ yum install codeblocks-contrib #for most plugins 

System monitoring gadget

"gkrellm" is nice and does the job 

$ yum install gkrellm 

To download transparent theme

To install the theme
Untar it on /home/<user_name>/.gkrellm2/themes

Wednesday, November 9, 2011

Computer/Mobile Control Unit

ABSTRACT

Control Unit that can monitor and control electrical switches such as, electric doors air conditioners, garage gates, and more, remotely from a personal computer or/and phone via internet.

SUMMARY

Approach Type Quick-And-Dirty
Programming Language ANSI C
Processor I686 Compatible CPU and PIC18F4550
Libraries Microchip USB Framework
Compiler/Linker MinGW, Microchip C18