Skip to main content

Posts

Showing posts from November, 2008

Best Buy black friday ads 2009 slick deals Released

Check out information on black friday ads,
Best Buy black friday ads 2009 slick deals Released target, best buy black friday ads, walmart black friday ads, best buy deals clipped from bolmamabol.blogspot.com
Best Buy From target.com black friday ads
And here is best buy from walmart black friday ads Target.com Target Target Black Friday ad listing for 2008 at BlackFriday.info along with the Target.com Black Friday, and online coupons. clipped from bolmamabol.blogspot.com
Best Buy Black Friday 2008 From Sears Circuit City and Wal-Mart
1. How to start making out of best deals and best buy? 2. Why slickDeals is favorite? They have created a Excel spreadsheet to get idea and quick overview of items and prices. No need to scan through tons of color ad pages. and Kmart, Target, Meijer, and a few others will be opening at 6:00am. Check out some of best deals for 2009 black friday. Laptops
HDTV Best Buy Best Buy is Wal-Mart's $199 Xbox 360 Arcade pack which includes Guitar Hero, Blu-ray from Circuit…

SATA disk is Not Detecting While Linux bootup

Did you experience below kind of error anytime with SATA disk,

PCI: enabling device 0000:00:01.0 (0140 -> 0143)
ata1: SATA max UDMA/100 cmd 0xC2852080 ctl 0xC285208A bmdma 0xC2852000 irq 22
ata2: SATA max UDMA/100 cmd 0xC28520C0 ctl 0xC28520CA bmdma 0xC2852008 irq 22
ata1 is slow to respond, please be patient

after waiting you get
ata1: no device found (phy stat 00000000)
scsi0 : sata_sil

and at last
ata2 failed to respond (30 secs)

And you know how simple answer is for this.
Yes only thing is knowing is the key.

The answer lies in power source connector; SATA disks are very sensitive to power source, so if you see such errors coming while bootup and your SATA disk is not getting detected then press the power connector, And your are saved. This is my experience after struggling for an hour with changing SATA disk and changing SMPS, changing target board, but nothing worked; finally press hold on power connector to SATA disk and done. bbuuuurrr..

what does /dev/null 2>&1 command do?

what does /dev/null 2>&1 command do ?
or
What does > /dev/null 2>&1″ mean?
I was running some CGI for disk formatting and during this process some warning messages were coming on screen; even though I was duplicating standard out file pointer to some temporary file pointer. It was not redirecting standard error messages to this temporary file. Searched on google, but was not able to hit google with right keyword. Got this answer of using /dev/null 2>&1.
Here is explanation,

In Linux There are three standard file descriptors, Standard In (STDIN, file descriptor 0), Standard Output (STDOUT, file descriptor 1) and Standard Error (STDERR, file descriptor 2). /dev/null is the null device, which is like "write only memory". > will write to the specified file (overwriting its contents) and >> will append to the specified file.

> /dev/null 2>&1 redirect both output and error to /dev/null
> /file 2>&1 redirect both output and error to …

Use of CUT Grep AWK Linux Command Combinations

Today I learn about power usage of grep cut and awk command;
My requirement was to know on which physical USB port which device is connected,
I can get this information from /proc/bus/usb/devices; which tells me about on which port which device is connected; my udev script will automatically mount the USB device with combination of Manufacturer name and serial number;
Here is the steps how I reached to simple solution instead of coding hundred lines of code.

To search for the SerialNumber in proc file i used
$ grep 'SerialNumber' /proc/bus/usb/devices
was giving me output in "S: SerialNumber=LDVTCGP6" format, I don't need that S: so used pipe;
$ grep 'SerialNumber' /proc/bus/usb/devices | awk '{print $2}'
This removes initial "S:" The output is combination of SerialNumber=LDVTCGP6 lines;
I need to separate each strings with individual values; use cut command from linux.
$ grep 'SerialNumber' /proc/bus/usb/devices | awk '{print $2}&…

It's a Bigger World than Java and C++

We hear a lot about Java and C++, but that doesn't mean they're the only languages developers are using.
Tokeneer was developed for the U.S. National Security Agency (NSA), an outfit known for keeping things secret. Which makes it even more surprising that not only did the NSA acknowledge Tokeneer's existence, but they released it as open source software.
In a nutshell, Tokeneer is a proof-of-concept of what's called "high-assurance software engineering." Secure software, in other words. Software you can trust. Software that must work correctly or else the consequences could be calamitous. And software that's written in Ada—yes, Ada—and developed using Praxis High Integrity Systems (www.praxis-his.com) Correctness-by-Construction (CbyC) methodology, the SPARK Ada language (www.sparkada.com), and AdaCore's GNAT Pro environment (www.adacore.com). The project demonstrates how to meet or exceed all those things that are necessary to achieve high assurance, …

Refresh HTML Page Every 5 Seconds Usages META tag

How to Refresh HTML/CGI page every 5 seconds?
Today I was searching for page refresh after a certain activity is completed. I was running some task in say CGI 1; which uses fork() to execute another task; once this task is done CGI 1 should get refreshed or should show me the updated status which is being updated by new task.
I tried lot of other combination like calling refresh function from new task; with window.opener.refresh_fucntion(); and a lot.
Finally got the solution using meta tag of html.

Meta HTML tag,The element provides meta-information about your page
And the answer to question is just include before head element this tag;
Refresh page every 5 seconds:



Refresh page every 5 seconds:

<meta http-equiv="refresh" content="5" />


and my job is done.
Thanks to meta tag.

C Programming Caution while using execlp function

What is C Programming Caution while using execlp function?

programming caution while using execl function series. execlp function series most of the time are used with fork() system call;
If the requirement is there to kill the process started by execl function, then one caution need to take care, as execl functions will replace complete child process image with the new process image, This means new process started is having new pid and not as same as child pid.
In order to kill the process we need to call getpid function in calling function and store this pid in temp file and while killing this new process use
kill(pid) system call.

Example usage assuming in pid is stored in /var/childpid.

fptr = fopen("/var/childpid","r");
if(fptr != NULL)
fgets(child_pid,10,fptr);
else
printf("Can't open childpid file");
close(fptr);
child_pid[strlen(child_pid)-1] = '\0';

sprintf(cmd,"kill %s >…

How to Check Directory Size In Linux Also lists file size

How to check directory size in linux?
du is the answer.
du - estimate file space usage
Summarize disk usage of each FILE, recursively for directories.
useful options are
-h, --human-readable
print sizes in human readable format (e.g., 1K 234M 2G)
-s, --summarize
display only a total for each argument
To check the directory size use $ du -hs
this will give current working directory size if specified gives specific directory size ie
$du -hs /home/bhagwat/test/dir
gives size of /dir.

while df is also there but it gives disk space not directory space
df - report filesystem disk space usage
df displays the amount of disk space
available on the filesystem containing each file name argument. If no file name is given,
the space available on all currently mounted filesystems is shown.

Use of Execlp Functions C program Explained

Below code listing illustrates usage of execl function series, and talks about how to redirect the output from these functions.
Here is trick to redirect the output from execlp command series
In other words implematiation of "ls -l >/var/test.log"
first open file using "open" system call

#include
#include
#include

int open(const char *pathname, int flags);

then duplicate this file pointer with stdio file pointers
stdio file pointer are 0 for stdin
1 for stdout and 2 for stderr

use of dup2

dup and dup2 create a copy of the file descriptor oldfd.
int dup2(int oldfd, int newfd);


here is c example implementation in function;

int spawn(char* cmd)
{
pid_t child_pid;
int fptr,fptr2;
char tmp_devfs[20];
int child_status=-1,ret=-1;

// printf("executing cmd=%s\n",cmd);
fptr=open("/var/test.log",O_RDWR);
/*create new process */
child_pid = fork();
if (child_pid != 0){
/* This is the parent process. */
ret = child_pid;
//printf(&q…

Why We Need to Call a Pig a Pig - The politics of language ..

We know Orwell for his novels, but it's the way he saw the politics of language that makes him relevant. clipped from www.newsweek.com Why We Need to Call a Pig a Pig (With Or Without Lipstick) We know Orwell for his novels, but it's the way he saw the politics of language that makes him relevant.clipped from www.newsweek.com Though many of Orwell's essays describe single incidents, his concerns are political, in the largest sense: the way human dignity is corrupted by false phrases. He was less interested in what motivates people to act without integrity than in the words they use to camouflage and perpetuate their dishonesty: for Orwell, bad language and bad politics were one and the same. Yet for all his penury and despair, his faith in the power of clear, strong language can only be read as optimistic. Orwell's ideas have been bastardized and simplified over time, so that "Big Brother," the totalitarian, state-run citizen-control mechanism of "1984,&qu…

Stupid Products

Consumers MUST BE SATISFIED! clipped from www.guidespot.com Inflatable Toast The Goatee Saver Taco Propers Sci Fi Themed Condoms Handsets for cell phones Cassette Tape Dispenser Day-Glo Camouflage Zaky Infant Pillow Two-da-loo Tandom Toilet CLEAN-UP SLIPPERS Hair Guard for Noodle Eating

Get Mounted File System Type C function

How to get Mounted file system type using C program?
Here is trick to get mounted file system type or say this trick can be applied to get variable from linux; This is simple combination of "grep" and "awk" commands. check out below; this function takes mounted point name like where you have mounted the disk example
/dev/sda1 is being mounted at /mnt/test so the input argument to this function is test and the output should get is /dev/sda1 filesytem type.
If you type mount command you will get the file type

on my system with one pen drive; it shows
dev/sda1 on /mnt/JetFlash type ext3 (rw)
input to this function is JetFlash and I will get return as ext3 which is file system type.
Description : returns mounted FS type
char *get_fs_type(char *mount_point_name)
{
char temp[20];
char cmd[100],*ret_p;
FILE *fptr;


sprintf(cmd,"/sbin/fdisk -l | grep %s | awk '{print $6,$7}' > /var/mpt",mount_point_name);
system(cmd);

fptr = fopen("/var/mpt&…

Scratchbox Cross-compiling Made Easy

Often Getting problems with corss compiling here is the perfect solution, read on.
Scratchbox is a configuration and compilation environment for building Linux software and entire Linux distributions.
The basic idea of Scratchbox is to offer developers an environment that works and looks like the target environment before the target environment is available.
The Scratchbox is an environment that you log into like you would log into some machine. However, the Scratchbox tools can be used either inside or outside of Scratchbox download
scratchbox-core
http://www.scratchbox.org/download/files/sbox-releases/1.0/tarball/scratchbox-core-1.0.1-i386.tar.gz
scratchbox-libs
http://www.scratchbox.org/download/files/sbox-releases/1.0/tarball/scratchbox-libs-1.0.1-i386.tar.gz
scratchbox-toolchain-arm-glibc
http://www.scratchbox.org/download/files/sbox-releases/1.0/tarball/scratchbox-toolchain-arm-gcc3.3-glibc2.3-1.0.1-i386.tar.gz
untar all tar ball using tar -xzf command
then run
$/scratchbox/run_me_first.sh

’…

fdisk Compilation for ARM-Target board Errors

Today Trying my luck with compiling fdisk utility;

Source code at:
http://www.gnu.org/software/fdisk

Current fdisk 1.0 is July 7 2007 370K source .tar.gz

./configure --disable-cfdisk --host=arm-linux --build=i686 --disable-largefile
./configure says to install GNU/Parted before compiling.
It needs parted/parted.h.


http://www.gnu.org/software/parted Latest version is 1.8.7 of May 2007.
1.4GB source code tar.gz.
./configure --host=arm-linux --build=i686
configure: error: GNU Parted requires libuuid - a part of the e2fsprogs package (but
GNU Parted requires libuuid - a part of the e2fsprogs package (but
sometimes distributed separately in uuid-devel or similar)
This can probably be found on your distribution's CD or FTP site or at:
http://web.mit.edu/tytso/www/linux/e2fsprogs.html
Note: if you are using pre compiled packages you will also need the development
package as well (which may be called e2fsprogs-devel or something similar).
If you compile e2fsprogs yourself then you need to do &#…

Install NTFS read Write Support ntfsmount a big Bang

Today's leanings are
1. How to create NTFS partition from FAT32 filesystem?
Need to have windows XP or NT to run this command.
Created NTFS partition using command from cmd prompt; -
CONVERT F: /FS:NTFS
2. Major task was to enable NTFS Read/write support;
Started with enabling NTFS_RW in Linux kernel, its help says;
CONFIG_NTFS_RW:
This enables the partial, but safe, write support in the NTFS driver.
The only supported operation is overwriting existing files, without changing the file length. No file or directory creation, deletion or renaming is possible. Note only non-resident files can be written to so you may find that some very small files (<500 href="http://bhagwat-masalkar.blogspot.com/2008/10/about-ntfs-tools-and-library-ntfsprogs.html"> user level driver(requires FUSE) and kernel mode driver.

Started with kernel mode driver from ntfs-3gwhich uses mkedev function ref to our arm-tool chain in file /tools/arm-tools-3.3.1/tools.Linux/hard_fp/armv5-linux/sys-include/s…

UDEV Simple Rules For Events In Linux

How to execute external program upon certain events occurred in linux?
This is quite wide requirement if you are running embedded linux on target board. Well The answer could be varied as question is more general. Lets limit the scope of question to USB devices.
Running external programs upon certain events to be specific want to run a program on USB device connection and on USB device removal.
Well I am going to do it with UDEV,
For the beginners/novices about UDEV and howto write UDEV rules the howto is pretty nice and easy to apply.
One can do it with signals also, but I like this way. To start with,
I have written simple udev rules file and kept in /etc/udev/rules.d/90-local.rules (off course you can give any name but with ext .rules and start with some no like 90 here); My udev rules are in 50-udev.rules files which defines the way to mount on USB connection and unmount on USB device disconnect.
I can't believe myself that with simple two lines rule placed in 90-local.rules file m…

Palindrome Number Checking for Int C program Functions

Write a c program to know if given number is palindrome or not?
Well first try to digg out what is palindrome?
A palindrome is a word, phrase, number or other sequence of units that can be read the same way in either direction. Palindrome example is TENT on either direction characters are same.
The most familiar palindromes, in English at least, are character-by-character: the written characters read the same backwards as forwards. Palindromes may consist of a single word (civic, level, racecar, rotator, Malayalam), or a phrase or sentence ("Was it a rat I saw?", "Wasilla: All I saw", "Mr. Owl ate my metal worm", "Sit on a potato pan, Otis", "Neil, a trap! Sid is part alien!", "Go hang a salami I'm a lasagna hog.", "Satan, oscillate my metallic sonatas", "I roamed under it as a tired nude Maori"). Punctuation, case and spacing are usually ignored, although some (such as "Rats live on no evil star&quo…