Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Thursday, October 10, 2013

Shared Folder on Virtualbox on Linux Host

There are  a lot of people who use windows on virtualbox which is hosted by a linux distribution. For example, I installed virtualbox on Linux Mint 1.14 to setup Windows XP on it and use this for some software that I need for my education on Electrical & Electronics Engineering. Let's start with the most known problem.

Problem :

When we use virtualbox the most important problem is that how to share folders or directories with the host and any operating systems installed on virtualbox.

Solution: 

To solve this problem just follow the given instructions below:

1.  Open virtualbox and start any os that you installed on vb.
2.  Click 'Devices' tab which is seen in the menu bar of vb.
3.  Select ' Install Guest Additions'

If it asks to download click and proceed it.

4.  Totally close the operating system that you run on virtualbox.
5.  On Virtualbox software, click settings.
6.   You are going to see an option like 'Shared Folders' or 'Shared Directories'. Click on that.
7.   In that option click Add Shared Folder icon and enter its location and its name whatever you want. Make sure you checked read box before you click ok.

That's it, now you can share any folder between your host and operating system installed on virtualbox.(also called Guest Operating Systems)
Read More

Wednesday, August 21, 2013

Firefox Babylon Add-on and More

Everyone knows Babylon dictionary, it is one of the most common dictionary that used in the world. A free babylon extension for firefox is available here. It works quite enough, the requirement is just clicking the word that you wanna search twice.

Babylon Dictionary

But missing part is that:

It doesn't save the word you search once. When you encounter a word that you have searched 10 days ago, you need to remember it or you need to search it again in a dictionary. 

SOLUTION:

I modified the babylon extension to resolve this deficiency. When you use the modified version, you will find the words you searched before in a file called mywords.html which is going to be found in your desktop. The mywords.html will looking as in the following picture. :)

Babylon - mywords.html



-->


Watch the following video tutorial to setup the babylon to do the work we want :)
[By the way, the blog you see in the video is belongs to my bro. http://make-possible.blogspot.com]



Download the modified version from here and mywords.html(right click and save it). Install the extension to the firefox and copy mywords.html into your desktop. Also you can use the following code to download mywords.html into your desktop:



Use it with fun :).

What I changed in Babylon to be able to do this? (saving every word we searched once)

The changes I have made are given in the following:

I add a new function called saveDataToFile into javascript file BabylonWordSearch.Results.js. The function is given below:



In if block that I given below, I send the answer that I get from babylon server by innerHTML  to the above function(saveDataToFile) .



To modify the extension yourself, you can find its source code from that post.

If you have any question or need some help, leave a comment below.

Read More

Wednesday, August 7, 2013

CPU Temperature Alarm System

Hi,  I want to write about Cpu Temperature Alarm System I have done by using advantages of linux kernel and linux shell. (I used bash shell in my script by the way.)

One of the biggest advantages of linux is to reach hardware components easily through kernel. The communication with hardware comes true as given in the following steps:

1. User writes his/her request as codes.
2. Shell converts these codes to be understand by kernel.
3. Kernel is a gui which can thought as an interface between hardware and shell. Kernel sends these requests to hardware components.

You can understand these simple steps and more from the following scheme:

I wrote down the following script which can control cpu temperature and if it is out of the condition I have determined, it plays an alarm.
       


The comments about the script are given in the following step by step:

1. I used acpi package to get temperature of cpu from sensors. Info: acpi - Shows battery status and other ACPI information
2. To edit the output of acpi -t command and get the cpu temperature only, I used gawk package. Info: gawk - pattern scanning and processing language
3. I wrote the cpu temperature with echo
4. I used an if-else-fi block for control part.
5. If it is lower than 90 C, I wrote down the message: "no dangere."
6. If it is higher than 90 C, I wrote down the message: "cpu is in dangere!" and play the alarm.

If you like this article, use the share buttons below to help my blog.
If you have any question or need some help, leave a comment below.

SPONSOR
-->
Read More

Monday, August 5, 2013

Tuning Processes

Introduction

In real-time systems some processes can cause huge problems, or slowing down the system performance. In such situations we need to tune the running processes. With tuning I mean stopping or killing the process. To be able to do this and to know when we need to know what processes currently runnig and when process start up? Especially, administrators need this. Because unexpected processes needs to be down or stop in systems such as servers, gaming boxes or other real-time systems. By saying processes I mean all applications and services in the system. So after that we need to view the running processes, let's look at that.

Viewing Running Processes

The only thing that consume your system resources are running processes. If your computer seems to be running slower than normal, then it is probably because of some misbehaving running processes or some running processes that use more than resources our system have.

There a couple of ways to view running processes, these are:

     1. top command: this command lists all running processes by ordering them cpu usage and memory usages.
     2. ps -ef command: this command lists every running processes in full detail.
     3. The Graphical System Monitor(SystemAdministration►System Monitor): also enables you to list all the running processes.

Sample listing of running processes from ps-ef command:



Sample listing of running processes from top command:




Killing Processes

To kill a process, we can use PID(process id). As you can see from outputs of two commands above we have process ids for each running process. For example, to kill PID 217 we type kill 217. This command will kill the process have PID of 217. To suspend (stop) a running process use kill -STOP PID, to continue to a suspended process use kill -CONT PID.
Example: As an example run an application, find its PID using above commands, and first kill, then suspend and later allow to continue the process.

Finally, we finished the tuning process techniques in linux. I hope it will help you..

If you have any question or need some help about tuning process , leave a comment below.


Read More

Saturday, August 3, 2013

System Logs in Linux

Introduction to syslogd
syslog daemon responsible from syslog. This structure collects all messages from running programs to the logs. It categorizes all of messages according to its types and priority, and presents to us. This is very useful for error debugging. We can use this messages to find the actual problem if we have any one at any time. Actually I used that in my previous post. You may wanna see it.

Reading Logs

Now, let's look at how we can read logs. FHS determines the location of logs as /var/log. We can use tail command to read last ten messages like that:

cd /var/log
tail messages # note: if you don't see anything or get no file error type: tail syslog

output of this command:




As you can see from last ten messages, at 10:42:24 I disconnected the modem I cut the internet, which is a message from network manager and it have saved into syslog.

Following Logs from tail

A system administrator would use tail -f command to follow log messages like that:
tail -f /var/log/messages or tail -f /var/log/syslog

Because by using -f parameter with tail command, we can read new messages from running programs at right now. This is very handful for debugging. Also, almost all system manager executes that command in another terminal all the time, to see the messages coming through when the programs are running.

Let's see how it works: I entered the command to read syslog continuously, and I disabled eth0 in another terminal, the terminal views are given below:

terminal 1:



terminal 2:




As you can see from terminal 2, message says eth1 disabled when we type and entered ifconfig eth1 down into other terminal. It works :).

If you have any question or need some help about system logs in linux, leave a comment below.

Read More

Wednesday, July 31, 2013

Wireless networks are not being seen by network manager

Summary: In this article I am going to show you the solution of the problem: wireless networks are not being seen by network manager even if wireless card drivers are installed.

Yesterday, I reinstalled Linux 1.14 Nadia in my pc. After that I installed my wireless card driver which is Broadcom Corporation BCM4312. I learned its name and version from lspci command. lspci is a command on Unix-like operating systems that prints detailed information about all PCI buses and devices in the system. After that I installed the driver using method 1 which is I explained earlier in that post.

Everything was ok,  I used the internet connection for hours, but after that I encountered a new problem. The wireless was working well but it couldn't see any wireless connections. I thought, I can use error debugging techniques in linux to find the actual problem.

I am going to explain Error debugging techniques in linux at an article in the next days. 

So, I opened a terminal and I typed in:

  
syslog is a .txt file which includes all errors, messages and notifications coming from apps, softwares etc. And the most beautiful property is we can view at  this moment what is going on about an application or software. Once you typed in above command it will show the new errors or messages too. 
When I typed in that command , and view messages, I clicked the icon at the right bottom of desktop and then >>Connect to Hidden Wireless Network , I choosed an past connection which I used before. And click connect. My purpose was to interact with network manager and see if it has a problem if it is see in the syslog. When I did this I saw an input to syslog which is shown below:



As you see in the last rows, it is saying eth1 is not active.(inactive) We found the actual problem!. Now we are going to solve it.. I typed the following commands into terminal to stop and restart again eth1 interface.



This solved my problem. I hope it solves your problem too..

If you have any question or need some help, leave a comment below.
Read More

Thursday, July 25, 2013

CPU Sıcaklık Alarmı Sistemi



Merhabalar, bu yazımda linux kernel ve linux shell in verdiği harika avantajlardan faydalanarak yaptığım CPU Sıcaklık Alarmı Sistemini anlatmak istedim.

Linux un bize sağladığı en büyük avantajlardan biri kolaylıkla hardware bileşenlerine ulaşabilmemizdir. Hardware ile iletişim şu şekilde gerçekleşir :

1. Kullanıcı isteklerini kodlar halinde yazar.
2. Shell bu kodları linux kernel in anlayabileceği dile çevirir.
3. Kernel ise hardware ile shell arasındaki iletişimi sağlayan bir nevi arayüz diyebileceğimiz bir sistemdir. Kernel bu istekleri hardware bileşenlerine iletir.

Bu basit adımları ve daha fazlasını şema olarak aşağıdaki resimden anlayabilirsiniz..

Resimden görüldüğü gibi linuxtaki uygulamalarda çalışırken önce shell ve user ile iletişime geçerler. Daha sonra shell uygulamanın isteklerini kernel e anladığı dilde iletir. Kernel de bu istekleri hardware bileşenlerine iletir. 

Düşündüm ki madem böyle o zaman:

1. CPU nun sıcaklığı için önce cpu nun sıcaklığını ölçen bir hardware bileşenimiz olan sensörlere ulaşmam lazım. Linux ta bu işi yapan basit komut : 'acpi -t' komutudur.
2. Sensors komutu şu şekilde bir çıktı verecektir: 
Thermal 0: ok, 46.0 degrees C
Buradaki 46.0 değeri cpu nun santigrat cinsinden sıcaklığıdır. 
3. Bu cevapta benim ihtiyacım olan sadece 46.0 değeridir. Bu değeri bu satırdan çekmek için ise şu komutu kullandım: awk '{print $4}'.. Herhangi bir linux dağıtımı kullanıyorsunuz, illa ki awk ı duymuşsunuzdur. Awk dilleri ya da yazıları scan ve process etme pattern idir. Benim bu adımda yaptığım gibi.( 46.0 değerini şu cevaptan çektik>>Thermal 0: ok, 46.0 degrees C)
4. Daha sonraki adımda kendi belirleyeceğim bir değerle cpu sıcaklığını karşılaştırıp, bir alarm zili çaldırmak istedim. (Eğer cpu sıcaklığı benim belirlediğim değerden yüksek ise.). Bu basit karar verme bloku için tabiki 'if else fi ' blokları yardımımıza koşacaktır. 
5. Dördüncü adımda bir alarm zili çaldırmak istediğimi söylemiştim. Bunu sağlamak için sox paketini kullandım. Sox paketindeki play komutu .wav vb. dosyaları çalıştırmamızı sağlar.

Anlattığım bu adımları gerçekleştirdiğim scripti aşağıda görebilirsiniz. Script doğru bir şekilde çalışıyor..


 Herhangi bir sorunuz ya da yardıma ihtiyacınız varsa, aşağıya yorum bırakabilirsiniz.
 Yazıyı beğendiyseniz,  beğen butonlarını kullanarak bloguma destek verebilirsiniz.




Read More

Monday, July 22, 2013

Install Android SDK on Eclipse On Linux Distributions

To start developing Android apps we need to first choose an IDE platform or environment. I recommend Eclipse. It is really good and efficient to develop android apps. I will give the step by step installation of Eclipse and set up it to develop android apps.

Reqired Steps:

1. Open a terminal by typing Ctrl+F2
2. Type 'sudo apt-get install eclipse' enter, enter your password , this will install Eclipse platform.
3.  After installation open Eclipse from installed apps. When it is opening it will ask you workspace folder which is contains the application folders, choose or create as you want.

Now it is time to get Android SDK:

4. There are versions for linux distributions get the latest and convenient version for your system from: http://developer.android.com/sdk/index.html
The Android SDK is a compressed folder. Download and extract the contents of this
file to a convenient place on your computer. You should install the SDK where you usually put your
development tools. Open SDK file you will see a file as tools, in that file click android script and click run to run it. This will install Android SDK.

Both Eclipse and the Android SDK are installed. It's time to install the Eclipse plug-in
to take advantage of the Eclipse environment.

Obtaining and Installing the Eclipse plug-in

1. Run the "Find and Install" feature in Eclipse, found under the Help >Software Updates menu.
2. Select the Search for new features to install option.
3. Select New Remote Site. Give this site a name, such as "Android Developer Tools," for example. Use the following URL in the dialog:
https://dl-ssl.google.com/android/eclipse. Please note the HTTPS in the URL. This is a secure download.

4. A new entry is added to the list and is checked by default. Click Finish. The search results display the Android Developer Tools. Select the Developer Tools and click Next.
5. After reviewing and accepting the license agreement, click Next. Note that the license agreement includes a special requirement for use of the Google Maps API.
6. Review and accept the installation location, then click Finish.

The plug-in is now downloaded and installed. The plug-in is not signed (at the time
of writing), so proceed at your own comfort level by clicking on Install All, then
restart Eclipse.

If you have any question, or need some help, leave a comment below.
Read More

Sunday, July 21, 2013

Linux Mint 1.14 Nadia Wireless Problem

I installed Linux Mint 1.14 Nadia a few months ago. Wireless  wasn't working because of the driver was not installed. In some linux mint distributions you can have this problem, nadia is one of them.
Also, in some ubuntu distributions you can have the wireless problem too.
To solve this problem you need to install wireless driver and reboot your computer or restart network services. To doing this there is several methods. Methods are given as follows:

Method 1:

1. Open a terminal by typing ctrl+F2
2. Type lspci and press enter, to specify your chipset, in my pc it is Broadcom
3. Open Software Manager, type 'your chipset' into search box
4. Install wireless driver
5. type sudo service network-manager restart into terminal to restart your network service Problem is solved have fun with your wireless..

-->

Method 2:

1. Open Additional Drivers
2. Select your chipset driver
3. Click apply changes
4. open terminal
5. type 'sudo service network-manager restart' to restart your network service
Problem is solved have fun..

Note: Both of methods are tested, working correctly.

If you have any guestion, or need some help, leave a comment below. 
Read More

Saturday, July 20, 2013

Ubuntu 11.10 waiting up to 60 more seconds for network configuration 'problem'

-->
I upgaded my ubuntu 11.04 Natty to ubuntu 11.10 Oneiric Ocelot a few weeks ago. To handle some issues I have needed to modify /etc/network/interfaces file. After some modifations I get the message:"waiting up to 60 more seconds for network configuration" when booting.
I have found the reason of this is to have any interfaces in /etc/network/interface file as auto. To correct the problem just remove all rows and leave it as default like:



Another solution can be modify the script /etc/init/failsafe.conf>>This script is the script that control configuration of network interfaces when booting and if they are not all configured send the message above to the screen.. So let's take a look at that script:



As we see and understood from the scripts commands: that script is controlling the waiting duration when booting.. The script keeps waiting us totally 111 seconds.. If your system doesn't need to wait  just insert a # character at the beginning of sleep calls or remove these rows. If your system needs to wait, but you don't wanna be wait this much, just change the values as you want.. Problem solved in either ways, but I recommend the first one..

Note: The values of sleep calls in your script may be different than my script, that is because of I have made a modification before in that script..
In my case, I solved my problem with two ways. In the second way the final look of my failsafe.conf script is given in the following:



-->

If you have any question, or need some help leave a comment below..
Read More

Friday, July 19, 2013

Vodafone Mobile Connect Software in Ubuntu

To install vodafone mobile connect software enter the following commands into terminal:
wget https://forge.betavine.net/frs/download.php/626/vodafone-mobile-connect_2.25.01-1_all.deb
sudo dpkg -i vodafone-mobile-connect_2.25.01-1_all.deb
After the installation you can run the software from Applications->Internet Category. The picture of the program is in the following. Have fun..
See the picture below:

Read More

Sunday, May 26, 2013

How to Encrypt Files in Linux

To encrypt a file we are going to use gpg software. That software is a command line executable software. First you need to install it if it is not installed before in your pc. To do this open a terminal and type:

sudo apt-get install gpg

After that compress the file you want to encyrpt. And type in the terminal

gpg -c fodername.tar.gz

and then type your password twice. It's done :). Delete the file you encrypted. Use foldername.tar.gz.gpg file to access your files.
To pass the password and reach your files again type:

gpg foldername.tar.gz.gpg

Read More

How to shutdown the Linux PC automatically at a specific time

Linux has a beautiful code which provides the PC can close itself at a specific time which is determine by the user. :)
To do this use the command given the next line:

sudo shutdown -h x

here x is the time with unit of minutes.
Read More

Sunday, March 17, 2013

Linux Dağıtımlarına Matlab Kurmak



Kuruluma başlamadan önce matlab2012a iso dosyasını aşağıdaki torrent linkinden indiriyoruz.
İndirdiğimiz iso dosyasını /home/kullanıcı-isminiz/Matlab dizinine çıkartıyoruz. Çıkarma işlemi bazı bilgisayarlarda 10 dakikayı bulabilir malum iso dosyası 5GB.. :)
Bu adımı hallettikten sonra kuruluma başlayabiliriz. Terminali açıp şu kodu giriyoruz:

sudo /home/kullanıcı-isminiz/Matlab/install

Bu adımdan sonra kurulum windowstaki gibidir. Yine de anlatayım. Karşımıza gelen pencerede "install without using internet" seçeneğini seçip next e tıklıyoruz. Daha sonraki pencerede lisans anlaşması kurallarını kabul etmek için "yes" seçeneğini seçip next e tıklıyoruz. Daha sonraki pencerede "I have the file installation key" seçeneğini seçip alt kısma şu lisans anahtarını yapıştırıyoruz:38699-60149-36808-21840-05491. Next e tıklıyoruz gelen pencerede "typical" seçeneği seçilidir onu değiştirmeden tekrar next e tıklıyoruz. Sonraki pencerede matlabi kurmak istediğiniz dosyanın yolu istenecektir. Size tavsiyem /MATLAB diye direk kökün altında bir dosyaya kurmanızdır. Buraya /MATLAB yazdıktan sonra next e tıklıyoruz gelen pencerede "yes" seçeneğine tıklıyoruz. Ve daha sonra install seçeneğine tıklayıp kurulumun tamamlanmasını bekliyoruz. Kurulum tamamlandıktan sonra sırasıyla next e ve finish e tıklayıp bitiriyoruz. Aslında daha bitmedi yapıcalacak birşey daha var. Terminale şu kodları giriyoruz:

sudo sh /MATLAB/bin/matlab

Gelen pencerede "activate manually without the internet" seçeneğini seçip next diyoruz. Sonra gelen pencerede ilk boşluğa lisans dosyamızın yolunu giriyoruz. Lisans dosyamızı çıkarttığınız iso dosyasında n bulabilirsiniz crack dosyasının içinde "lic_standalone.dat" ismindeki dosyadır. Buraya dosya yolunu girdikten sonra sırasıyla next e ve finish e tıklıyoruz.
Matlab i açmak için /MATLAB/bin/matlab scriptini çalıştırmanız gerekir. Her defasında bu dosyaya girmek için matlab-bin vs. yapmak istemiyorum diyorsanız bu scripte bir link oluşturmanız gerekir.
Diyelim ki bu linki masaüstüne oluşturmak istiyorsunuz o zaman terminali açıp şu kodları girin:


cd /home/kullanıcı-isminiz/Desktop
ln -s /MATLAB/bin/matlab matlab 

Ve linkiniz hazır artık masaüstünüzdeki matlab dosyasına iki kez tıklayarak matlabi açabilirsiniz iyi günlerde kullanın... :)





Read More

Linux'a Python Kurmak

Normalde linuxun bütün sürümlerinde python kuruludur. Ancak bu kurulu olan sürüm python2x dir.Eğer ki python3x sürümlerinden birini kurmak istiyorsanız yazıyı okumaya devam edin. :)
Python kurulumuna geçmeden önce bazı ayarlamalar yapmamız lazım.
Birinci Adım: Gerekli paketlerin kurulması
Alt+F2 ile terminali açıyoruz. Ve şu kodları giriyoruz:

sudo apt-get install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libc6-dev libsqlite3-dev tk-dev
Bu paketlerin kurulması net hızınıza göre bir kaç dakika sürebilir.. :)
İkinci Adım: Python un indirilmesi ve dosyaların hard diskinize çıkarılması
terminale şu kodlar giriyoruz:
wget http://www.python.org/ftp/python/3.2/Python-3.2rc2.tgz && tar -xvf Python-3.2rc2.tgz
Bu kod pythonu indirir ve dosyaları şu an bulunduğunuz dizine çıkarır.
Üçüncü Adım: Python un kurulması
Terminale şu kodları giriyoruz:
1.   ./configure
2.   make
3.  sudo make altinstall
Python3.2 linuxunuza kurulmuştur. :)


Read More