28 Mayıs 2012 Pazartesi

Mevlana quotes

Thanks to this web site, I learnt much more than I know Mevlana quotes. I want to share some of them here.
  • Your task is not to seek for love, but merely to seek and find all the barriers within yourself that you have built against it.
  • The eye goes blind when it only wants to see why
  • Love is the cure,
    for your pain will keep giving birth to more pain
    until your eyes constantly exhale love
    as effortlessly as your body yields its scent.
  • We Are All the Same
    Listen to the reeds as they sway apart;
    Hear them speak of lost friends.
    At birth, you were cut from your bed,
    Crying and grasping in separation.
    Everyone listens, knowing your song.

    You yearn for others who know your name,
    And the words to your lament.
    We are all the same, all the same,
    Longing to find our way back;
    Back to the one, back to the only one.
  • Be like a river in generosity and giving help. Be like a sun in tenderness and pity. Be like night when covering other's faults. Be like a dead when furious and angry. Be like earth in modesty and humbleness. Be like a sea in tolerance. Be as you are or as you look like.
     

22 Mayıs 2012 Salı

Learning

"Learning is finding out what you already know, Doing is demonstrating that you know it, Teaching is reminding others that they know it as well as you do. We are all learners, doers, and teachers."

  Richard David Bach

19 Mayıs 2012 Cumartesi

Sarcasm

I hate sarcasm because It hurts people. I mean Oscar Wilde realised this, however He said "sarcasm is the lowest form of wit". I certainly agree with him. True wit helps the others and improves others' opinions.

17 Mayıs 2012 Perşembe

An author recommendation

I would like to write a sentence from William Engdahl's Seeds of Destruction book. According to book, Henry Kissinger's statement that "If you control the oil, you control the nations; if you control the food, you control the people." You should read this book and As I do, You should follow William Engdahl's the other books.

14 Mayıs 2012 Pazartesi

android emulator hanged error after powering off

When you go into Android Emulator, you press power  button. You wait to close emulator. But something happens strange. Your emulator hangs. To correct this situation, you may try to this power off site. There's offers:

---> just close your emulator window
---> launch AVD Manager from eclipse
---> press Start button
---> check "Wipe user data"
---> click "Launch" and you will get clean and initial state of emulator

This is work for me.

Suse 12.1 auto load modules on boot

If you want to load suse linux modules at boot, you must edit into /etc/sysconfig/kernel file  MODULES_LOADED_ON_BOOT="(add here what module you want to load)" line.

Maze Path Finder in C Recursively

Having a 12x12 maze, We start to wander a starting point until finding stop point. We move to up, down, left,right from starting point. If we couldn't find any solution we return -1.

#include <stdio.h>
#define SIZE 12

void show_maze(int maze[][SIZE])
{
 int i,j;
 printf("\n\n");
 for (i = 0; i < SIZE; i++)
 {
  for (j = 0; j < SIZE; j++)
   printf("%d\t", maze[i][j]);
  printf("\n");
 }
}

int wander_maze(int maze[][SIZE], int sr, int sc)
{
 if (maze[sr][sc] == 2 || maze[sr][sc] == 1) return -1;

 show_maze(maze);

 if ((maze[sr][sc] != 1) && (sr >= 0) && (sr < SIZE) &&
  (sc >= 0) && (sc < SIZE))
  {
   maze[sr][sc] = 2;
   if (wander_maze(maze, sr, sc - 1) == 0) return 0;
   if (wander_maze(maze, sr, sc + 1) == 0) return 0;
   if (wander_maze(maze, sr - 1, sc) == 0) return 0;
   if (wander_maze(maze, sr + 1, sc) == 0) return 0;
  } else
  {
   return -1;
  }
}

int main(int argc, char *argv[])
{
 int maze[SIZE][SIZE] =
 { {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} ,
   {1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1} ,
   {0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1} ,
   {1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1} ,
   {1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0} ,
   {1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1} ,
   {1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1} ,
   {1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1} ,
   {1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1} ,
   {1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1} ,
   {1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1} ,
   {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} };

 wander_maze(maze, 2, 0);
 return 0;
}

A simple workqueue and char driver example for Linux Kernel 3.x

If you wonder about how to work interrupt,tasklet and schedule in linux kernel 3.x, you could see this code series. When I start to search in internet for examining example source code, I found useful articles such as http://www.ibm.com/developerworks/linux/library/l-tasklets/index.html, but I couldn't find any example source code satisfying my desire. Therefore, I decided to write a simple driver. Furthermore, This driver will be a start point for a project which I thought. After this intro ceremony, We answer to that question. "What does this simple driver do?". Before I explain what it does. I need to mention about its architecture.

Driver includes a few features inside it. What are they?

    cdev structure(char device) implementation
    udev implementation
    workqueue

I put especially udev implementation in order not to struggle with creating device node such as "mknod /dev/char_timer c major_num minor_num" after every working insmod.

Alright, We come to what it does. Driver sets a static int variable at every one second.  You will see printk inside interrupt routine output to dmesg. Furthermore, if you want to run test program, you will see value of that timer variable.

That's all. If you encounter any trouble, I could try to help as best I can.

Source code is here.

https://github.com/sharku/char_timer

If you find  this article useful, you could make a small contribution in order to be produced such kind of articles.

Linux patch implementation

You have a xxx.patch file. You want to apply it to a project directory. You insert that directory. And run this command

patch -p1  < xxx.patch

Android error: insufficient permissions for device

If you have this adb error, you only need to do this:

su
cd android-sdk-linux-linux/tools
./adb kill-server
./adb start-server
./adb devices

That's all. You will use adb correctly.

Suse 12.1 Changing Display Manager

To change display manager (xdm,gdm,kdm), you only need to edit /etc/sysconfig/displaymanager file.

## Path: Desktop/Display manager
## Description: settings to generate a proper displaymanager config
## Type: string(kdm,xdm,gdm,wdm,console)
## Default: ""
## Config:      xdm,kdm,gdm
#
# Here you can set the default Display manager (kdm/xdm/gdm/wdm/console).
# all changes in this file require a restart of the displaymanager
#
DISPLAYMANAGER="kdm"

Suse 12.1 pcmanfm doesn't work error and add a boot script

After moving my usb flash disk suse to my backup disk, I encountered a strange error. My pcmanfm had not worked anymore. After searching, I found that Suse didn't work swap partition at boot. Therefore, I want to write a boot script and add it to among boot scripts. I found how I could do this that address systemd and using the after.local in open suse 12.1.This can help for anyone who need this kind of solution. My simple bash script is here.

DISK=`fdisk -l | grep swap| cut -d " " -f 1`
if [ DISK != " " ]
then
 swapon $DISK
fi