Total Pageviews

Monday, November 7, 2011

Lua in Linux

Hi.
if you want to install lua interpretter in your linux operating systems just type :

sudo apt-get install lua5.1

and then you can run Lua interpretter by typing "lua" in terminal.


if you are expert in lua programming in Linux please contact me for coversation.tnx

Tuesday, August 16, 2011

DRDY ERR UNC

Hi guys.
I had a trouble with my Linux.when i want to login into my system it takes about 15 minutes to boot.
I get an error during boot process that is "DRDY ERR UNC".I taught it may be a crash in Ubuntu and i reinstalled Ubuntu.Now i cant login.and after receiving this error (DRDY ERR UNC) i have no choice  to do something.i Googled  for this error and the results weren't helpful.is there anybody who can help me? or have this problem like me?

Saturday, June 18, 2011

How to install Burg boot loader in Ubuntu?

hi guys.
in this article i explain about burg boot loader and how to install it.
burg is a very beautiful and interesting boot loader ,sometimes called sexy grub.
if u have installed Ubuntu on your system you are using grub1 or grub2 boot loader.
grub2 is default boot loader for Ubuntu since version 9.10. Grub2 is version 1.98 and later.
to determine your version use "$ grub-install -v".grub version 1.99 is default in Ubuntu 11.04(Natty narwhal).
OK.you can change your background image in Grub2 and change resolution and some other settings in grub2.
to know how you can change grub2 setting and make it interesting search in Google.
but to install burg instead of grub read following explanation.
you can see a few images of my burg boot loader at the end of this post.

at first you should add this repository.enter following command in terminal:
$ sudo add-apt-repository ppa:n-muench/burg

now update
$ sudo apt-get update

install burg and burg themes.use this command
$ sudo apt-get install burg burg-themes

now you should add burg into you MBR.(search in Wikipedia for more info about MBR).
write your disk where your MBR is there instead of "(hd0)".be careful about what you write.not boot partition but MBR.
MBR is the first 512 byte of any disks.for example my hard is /dev/sda and my boot partition is /dev/sda1.i write /dev/sda instead of "(hd0)".
$ sudo burg-install "(hd0)"

now update burg
$ sudo update-burg

now you can test your burg.use below command.
$ sudo burg-emu




to change theme hit f2.
to change resolution hit f3 , and for more info go to setting->help.

to manage your burg u can install burg-manager and graphically change setting such as changing background.
prerequisite for burg manager is "buc".install it then burg-manager and enjoy your new graphically and interesting boot loader.
if you have a question or problem during installing or after , leave a comment , i'll reply as soon as possible.

Saturday, May 7, 2011

Read Arrow Keys in C++


Hi guys.
I would like to write a program in C++ ,doing something after pressing arrow keys.at first i decided to test reading arrow keys.i wrote a simple program that after pressing arrow keys prints in console screen which one of arrow keys is pressed.for writing this prog i require to find out Ascii values of this 4 keys.therefore i wrote a program print Ascii value of a keyboard key when i press that key.after running this program i find out this value is 3 byte.in my OS (Ubuntu 10.10) this 3 value is 27 , 91 , and 3rd part for UP key ,DOWN key ,RIGHT key ,LEFT key is consecutively  65,66,67 and 68.i expect this prog runs at Windows OS successfully ,because i expect this values be the same of Ubuntu in Windows OS.in Windows this prog is unusable and after discovering Ascii codes of my arrow keys in Windows (that is 2 byte 0x0H) i wrote another special prog for Windows.
I would like to write a portable program ,which can use in different type of OS?what's the solution?why ascii values are different in operating systems?
At the following you can see this progs ,in Ubuntu and also in Windows.

Sincerely.
Kaveh Shahhosseini 1/May/2011

//========================
//this progs wrote in C programming language.
//Ubuntu...used only 65,66,67,68 values instead of "27,91,65" , "27,91,66" ...
#include <stdio.h>
//--------------------------
int main()
{
    char ch;
    do{
        ch=getchar();
         if(ch==65)
            printf("You pressed UP key\n");
         else if(ch==66)
            printf("You pressed DOWN key\n");
         else if(ch==67)
            printf("You pressed RIGHT key\n");
         else if(ch==68)
            printf("You pressed LEFT key\n");



    }while(ch!='e');
 return 0;
}
//======================
//Windows...
#include <stdio.h>
#include <conio.h>
using namespace::std;
//-----------------------------
int main()
{
      char ch;
  do{

        ch=getch();
        if(ch!='\0')
        {
          ch=getch();
          if(ch=='H')
              printf("UP\n");
                 else    if(ch=='P')
              printf("DOWN\n");
                   else    if(ch=='M')
              printf("RIGHT\n");
                     else   if(ch=='K')
              printf("LEFT\n");
        }
  }while(ch!='e');

    return 0;
}
//====================

Console Copy Program in C++


I would like to write a console copy program in C++ that copies a file into another file like linux or windows copy programs.this programs take name of file and copy into the same folder with the same name concatenate it to a "copy_" word.this is a simple program but i would like to develop it's features.
there are some problems at this way.when you give a executable program name to this simple copy program  , the new "copy_executablefile" can't run.for other files such as files with 'pdf' extension it has no problems and copied file (copy_pdfextensionfile) is exactly like the same original file.but in executable file i have a problem.after some check and compare between original file and copied file byte by byte using "Hex Editor" program i discovered that at the end of copied file one byte with 00H value is extra.after removing this extra byte using Hex Editor ,copied file runs successfully.but i can't find out why this extra byte appends into copy_file.what do you know about this prob?please help me.perhaps copying character by character is the reason.because a character is 4byte.what's the solution?
you can see this simple prog following.

Sincerely
Kaveh Shahhosseini 6/May/2011

//this prog tested in Ubuntu 10.10 with Gcc compiler and works correctly.
//begining of copy program.
//=======================
#include <iostream>
#include <fstream>
#include <string.h>
using namespace::std;
//---------------------------
int main()
{
    char filename1[12],ch,filename2[18];
    cout<<"Enter file name:\n";
    cin>>filename1;
    ifstream in(filename1,ios::in);
    strcpy(filename2,"copy_");
    strcat(filename2,filename1);
    ofstream out(filename2,ios::out);
    while(!in.eof())
    {
        in.get(ch);
        out.put(ch);
    }
    return 0;
//end
}
//====================

Tuesday, April 26, 2011

About

Hello every body.this is my first experience using Blogger.
I hope you spend good time at this blog.
I share with you anything that i think is helpful and useful.
please teach me anything that you may know about computer ,specially in my interested field which is mentioned at 'About Me'.
Sincerely
Kaveh.