Tuesday, August 27, 2013

Modeling a Whale Call with Matlab

I did my computer probation in a company called FIGES last year. In one of these days, my job was modeling a whale call of a blue whale. To do this firstly I did a long research, because I have needed
some equations to represent whale call.

According to my research:

Befitting the largest mammal on earth, the call of an adult blue whale is loud and low The
sound carries farther than any other animal sound, and can be detected over a thousand miles
away. The call has a distinct pattern. An a “trill” usually precedes a series of B “moans.”
There is little variation in the call among individual whales.

The B call is simpler and easier to analyze. It consists of a fundamental frequency around 16-
17 hertz and a series of harmonics(multiples) of the fundamental frequency. The amplitude of
the call is modulated to produce a loud moan followed by weaker moan.

• The envelope of the signal is treated as a decaying sine wave of the form A0*e^(-
Bt)*sin(2*pi*fm*t) where the amplitude A0 the decay rate B, and the modulating
frequency fm are all adjustable parameters.

• The signal itself is treated as a sum of harmonics sin(2*pi*n*f0*t) for n=0,1,2,3, ... .
The harmonics are assumed to be present for the entire duration of the call, even
though the higher harmonics appear and disappear in the middle of the call. (Simply
chopping off the higher harmonics introduces unwanted frequencies.)

• Because blue whale calls are so low, they are barely audible to humans. The time scale
in the data being modeled is compressed by a factor of 10 to raise the pitch and make
it more clearly audible. The model works with the same “x10” audible frequencies.

Using these informations I wrote the script in the following:



The Blue Whale B call model is shown in following figure. If you also wanna hear the voice, write down the codes into a matlab mfile and run it..



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

Monday, August 19, 2013

Loops in Matlab ( for in matlab, while matlab, for matlab)

There are two loops in matlab:
  • For loops 
  • While loops
For loops are used when the number of loop is certain whereas while loops are used when the condition is specified for a loop to terminate the code in it. 

You can see the usage form of for loops and while loops from given examples below:

Example 1: For loop



Example 2: While loop



For information in detail type in command window:

'help for' to get the following result:



or you can type doc for  to get reference page in help browser. I am not giving it here.

For while loops you can type:

'help while' to get information in detail like as given below:



or you can type 'doc while'  to get reference page in help browser. I am not giving it here.

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

Read More

Sunday, August 18, 2013

Flash for Linux

Hi guys, most of the linux distributions do not include flash as default installed software. Mint comes with flash but such as in ubuntu it is not preinstalled. So we have to install it. There are a few ways to install flash in linux:
1.   - open software center
        - enter 'adobe flashplugin
        -click install, that's it. (That is the first way to get linux flash)

2.   - open terminal by typing Ctrl+F2
        - write the following code:

to install adobe flash on ubuntu:



to install adobe flash on mint:



        - after this, if it ask Y or N type Y. Flash is installed, you can try it now. (That is the second way yo get linux flash)

 3.  - Open any website that requires flash, like youtube. It will ask you 'install missing plugins' press install or download. That should solve your problem about flash plugin. (That is the third way to get linux flash)

4.  -Open software center
       - type adobe flash into search box
       -click install, that's it. (that is the fourth way to get flash on linux)

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

Monday, August 12, 2013

Flashlight Android Application

Hi guys, today I wanna tell about one of my experince on android app development. A couple of days ago, I wrote a Flashlight android app using docs in developer.android.com, I checked the app in two different phones:

  • first in a Motorola phone: my app worked perfect, it did its job. (turning on and turning off flash of the camera)
  • second in a Samsung SIII Mini: my app didn't work, it didn't do its job. (when I touched the 'open flash' button, flash couldn't open.)

So, I started to search the problem. There were a lot of statements in websites like that: "FLASH_MODE_TORCH doesn't work on samsung". I have used this parameter in my app too. I didn't believe that, because when I request possible parameters from eclipse by pressing Cntrl+Enter there was only one parameter which can open the flash: FLASH_MODE_TORCH. So, I thought there must be a missing code which requires in samsung phones and not needs in phones like Motorola. I continued to search and found a nice solution which says use "camera.startPreview()" after setting parameters of the camera. I used this in my app and it worked in samsung phones too.

The picture of my app are given in the following, and you can download it from the link below pic. I wrote the app just for an example, so its gui is really bad and simple.



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.

Read More

Saturday, August 10, 2013

Initial Arrangement Example in Matlab

Read More

A Traveling Wave by Making an Animation in MATLAB



After that I run it from the command window. I give three figures these are in different time to
see properly the wave is travelling.






Read More

How to add Categories to Blogger

Guys, today I will tell about categories in blogger. Unfortunately there is no any category widget in blogger. So we have to create it by ourselves. To do this We have two solutions.

First Solution: We can use labels with Links widget. Let me Explain with an example let’s say We want Matlab,Linux,Apple as our site’s categories. Then we need to add these names as labels to our posts. Then by clicking the labels in Labels widget we get their URLs. Copy these URLs one by one and add them to Links widget. In that way, we have categories in our blog. Have fun...

Second Solution: We can use laves with HTML/JAVASCRIPT widget. This time we will modify or create our Links widget by ourselves via writing html codes into HTML/JAVASCRIPT widget. The advantage of this solution is creating original categories with your requests. I hope it helps..
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

Sunday, August 4, 2013

Format USB(flash drive) From Terminal

It's easy to format usb drives from terminal. But, you need to first find what's your usf file system. To find this we can use df command.

df: report file system disk space usage 

Also, to be able to format the usb, usb shouldn't be mount, if it is we are going to unmount it.
Now, just to be clear I am going to format my own usb step by step, at required steps I will give the terminal screenshots.

Steps I have down:

      1. type df command into terminal

terminal output:




     2. Plug in usb (flash drive)
     3. type df command into terminal

termainal output:




As you can see we have a new entry at the last row, which is should be my usb. It's file system is given as /dev/sdb at terminal output of df command.

    4.  to unmount the flash drive type: sudo umount /dev/sdb
    5.  to format the usb as fat type: sudo mkfs.vfat -I /dev/sdb

You can see the terminal executions of step 4 and 5 below:  




That's it we are done, I hope it helps..

If you have any question or need some help about format usb drives, 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

Friday, August 2, 2013

Gimp The GNU Image Manipulation Program

Gimp is an alternative software to Photoshop. Most users of linux use Gimp instead of Photoshop. Last version of Gimp is 2.8. I use it myself in my ubuntu 11.10 Oneiric Ocelot and Linux Mint 1.14 Nadia.

I recommend it to you if you are using a distiribution of linux. If you are using Windows or other platforms, I think Photoshop is better than Gimp. As we know it is more common than Gimp.

      Features:
  • Customizable Interface 
  • Photo Enhancement
  • Digital Retouching
  • Hardware Support
  • File Formats (jpeg, gif, png, tiff, psd.)
  • Supported platforms
    • GNU/Linux (i386, PPC)
    • Microsoft Windows (XP, Vista)
    • Mac OS X
    • Sun OpenSolaris
    • FreeBSD
      Last Version: Gimp 2.8

To download Gimp you can use the following link which is from its official website:
Also you can download some documentation from:

     Some Screenshots:  You can see in original dimensions by clicking the pics below.

Gimp Screenshot 1
Gimp Screenshot 2
Gimp Screenshot 3
Read More