Friday, September 16, 2011

Programming tips

Why not to use gets() in Linux ?
Ans:  http://c.ittoolbox.com/groups/technical-functional/c-l/store-character-string-containing-spaces-using-structure-4414903
-----------------------------------------------------------------

Command to change vdi's uuid.
$ VBoxManage internalcommands setvdiuuid disk.vdi
-----------------------------------------------------------------


LDD3 examples

-----------------------------------------------------------------

C Programming

http://codingrelic.geekhold.com/search/label/C%20Programming


Monday, July 25, 2011

ssh login problem

Problem: When I try to connect target board using ssh, it gives me error of 'password has expired'. The log is given below.

-------------------------------------------------------------------------------

$  ssh root@192.168.1.142
root@192.168.1.142's password:
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for root
New password:
Bad password: too short
Retype password:
Password for root changed by root
Connection to 192.168.1.142 closed.
---------------------------------------------------------------------------------

Soln: change the entry in shadow file,
old entry: root:$1$bmWHS8dA$cWZORf5md8ecQbEvL.Ule.:0:0:99999:7:::
new entry: root:$1$bmWHS8dA$cWZORf5md8ecQbEvL.Ule.:11851:0:99999:7:::

The problem is in shadow file, in this 'days since last password changed' field is set 0, so change modify it.


Ref: http://lists.busybox.net/pipermail/buildroot/2011-March/042165.html

Friday, May 20, 2011

Interview

ioctl

Q] Why ioctl() operation is removed form Linux Kernel 2.6.36?
Ans: When ioctl was executed, it took the Big Kernel Lock (BKL), so nothing else could execute at the same time. This is very bad on a multiprocessor machine, so there was a big effort to get rid of the BKL. First, unlocked_ioctl was introduced. It lets each driver writer choose what lock to use instead. This can be difficult, so there was a period of transition during which old drivers still worked (using ioctl) but new drivers could use the improved interface (unlocked_ioctl). Eventually all drivers were converted and ioctl could be removed.
compat_ioctl is actually unrelated, even though it was added at the same time. Its purpose is to allow 32-bit userland programs to make ioctl calls on a 64-bit kernel. The meaning of the last argument to ioctl depends on the driver, so there is no way to do a driver-independent conversion

Friday, January 14, 2011

मराठी भाषेची ताकद

खालील  लेखात, प्रत्येक शब्द 'आणि ' पासून सुरु करुन येवढा मोठा परिच्छेद लिहिला आहे.

 
------------------------------------------------ ---------------------------

केव्हातरी कोल्हापूरच्या कर्तव्यतत्पर केळकर काकांबद्दल काकांच्याच कचेरीतल्या केशवने काकूंसमोर कागाळी केली. काकू कावल्या. काकूंनी कपाटातून कात्री काढून काकांच्या कामाचे कोरे करकरीत कागद कचाकचा कापले. काकांचे कापलेले कागद केशवानेच कचऱ्यात कोंबून काकांच्याच किचनमध्ये 'कजरारे-कजरारेकवितेवर कोळीनृत्य केले.
काकूंनी कागद कापल्याचे कळताच काका कळवळले. काकांनीही कमालच केली. काकांनी काकूंचे काळे कुळकुळीत केस कात्रीने कराकरा कापले. काका काय करताहेत काकूंना कळेनाच! काकूंनी कर्कश्श किंचाळून कलकलाट केला.
काका काकूंची कसली काळजी करणार! काकांना कामाची काळजी. काकूंच्या कर्णकर्कश्श कोलाहलातहीकेशवाने कचऱ्यात कोंबलेले कागदाचे कपटेन कपटे काढून काकांनी कचेरीकडे कूच केले.
कचेरीच्या कामासाठी काकांनी कंबर कसली. कागदाच्या कापलेल्या कपट्यांचे काकांनी 'कोलाज'
करून कामकाज कार्यान्वयित केले. केशवाचे कारनामे कळताच काकांनी काट्यानेच काटा काढला.
काकांनी केशवालाच कोलाजचे काम करण्यासाठी कुथवला. कपटी केशवने काकांवरच कामचुकारपणाचा
कांगावा करून कामाचा कंटाळा केला. काकांनी कठोरपणे केशवाला कामावरून काढले. कासावीस काकूंनी कालच्या कडू कारल्याची कोशिंबीर कटाप करून काकांसाठी कच्च्या कैरीचे कोय काढून कालवण केले. काकांनीही करुणेने काकूंचे कृत्रिम केस कुरवाळले. केळकरांच्या कोकणस्थ कुटुंबात कर्तव्यापुढे कर्मकांड केव्हाही कनिष्ठच. कर्तव्यदक्ष काकांच्या कार्यकाळात कचेरीने कर्मरूपी किल्ल्याचे कीर्तिशिखर काबीज केले.
कामावरून काढलेल्या केशवाने कितीतरी काबाडकष्ट काढल्यावर कोल्हापूरच्या कॉम्रेड कणेकर
कॉलेजने केशवाला कबड्डीचा कर्णधार केला. क्रिडापटू केशवाने कबड्डीतच करियर केले. कालच्या  कागाळीखोर केशवाला काळानेच केला 'कबड्डीतल्या किचकट कसरतींचा कर्ता'!
कथासार
-
क्रियेविण करिता कथनकिंवा कोरडेची कीर्तन,
कितीक किताब कष्टाविणकाय कामाचे
 

------------------------------------------------ ---------------------------------

परवा पुराण-प्रसिद्ध पखवाज पंडित पुरोहित पंतांची पिवळी पगडी पुरंदरच्या पंधराशेव्या पायरीवरून पुण्यात पर्वतीच्या पाचव्या पायरीपाशी पर्णकुटीपासून पंधरा पावलांवर पहुडलेल्या पंकजच्या पोटावर पटकन पडली. पगडी पडलेली पाहताच पंत पुरंदरच्या पायथ्याशी पोलिसठाण्यात पळाले. पुरंदरच्या पोलिसांनी पंतांना पुण्याच्या पोलिसांकडे पाठवले.

पंत पुण्यात पोहोचताच पोलिसांवर पेटले. पंत पेटल्यामुळे पोलिस पटकन पर्वतीकडे पळाले. पांढर्‍या पोषाखातल्या पोलिसांना पाहून पंकज पर्वतीच्या पलिकडे पळाला. पोलिसांनी पंकजचा पिच्छा  पुरवला.

पळता पळता पंकज पाण्याच्या पाँडमध्ये पडला. पंतांनीच पाण्यात पोहून पंकजला पकडले. पिवळी
पगडी पण पकडली. पोलिसांनी पंकजला पोलिसठाण्याकडे पिटाळले. पकडणारा पोलिस पदपथावर
पाय पसरून पडला. पोलिस पडलेला पाहून पंकज पाठीवर पांघरूण पांघरून पळाला.

पंतांनी पुरंदरला पोहोचताच पगडीत पंकजचे पैशांचे पाकिट पाहिले. पाकिटातले पुष्कळ पैसे पंतांनी
पनवेलला पुत्राला पोस्टाने पाठवले. पंतांच्या पाजी पुत्राने पैशांच्या प्राप्तीतून पोटात पंजाबी पदार्थ पचवले.

पंतांना परमेश्वरच पावला!
पंकजला पकडण्यासाठी पंतांसोबत पुण्यात पोहोचलेली पंतांची पोरगी प्राची पंकजला पहिल्यांदा पाहताच पंकजच्या प्रेमात पडली. प्राचीने पंकज,पोलिसांची पकडा पकडी पाहिली. पंकजचा पदपथावरून पोबाराही पाहिला. पानशेतच्या पुराच्या पाण्यामुळे पुनर्वसित पंकज परत पर्णकुटीत पोहोचला.

पित्यासमवेत प्राची पुरंदरला परतलीपण पंतांनी पंकजच्या पाकिटातल्या पैशांबाबत पंक्ति-प्रपंच पाळला. पुष्कळ पैसे पुत्राला पाठवले. पंतांच्या पुन्हा पुन्हा पिडणार्‍या पुराणांच्या पोपटपंचीमुळे प्राची पेटली.

पंकजच्या प्रेमाखातर प्राची पुण्यास परतली. प्राचीनेच पंकजवरच्या पोलिसांच्या पंचनाम्याला  पाने पुसली. पंकजला पहायला प्राची परत पर्णकुटीपाशी पोहोचली. पण पर्णकुटीत पहुडलेल्या पंकजचे पाय पळून पळून पांढरे पडलेले! प्राचीने पंकजच्या पायावर पिवळे पुरळही पाहिले.

पंकजची परिस्थिती पाहून प्राण पिळवटलेल्या प्राचीने पदर पाण्यात पिळून पंकजचे पाय पुसले. प्राचीचा प्रथमोपचार पाहून पंकजला पोरगी पसंत पडली. पंकजने प्राचीला पर्णकुटीतच पटवले. पर्णकुटीतील प्रेम-प्रकरण पाहून पर्णकुटीच्या पायर्‍यांवर पत्ते पिसणारी पोरे पूर्व-पश्चिमेला पांगली. प्राचीने पंकजचे पा़किट पैशांविनाच परतवले. परंतू प्रेमात पारंगत पंकजने प्राचीस पाच पाप्या परतवल्या.

पंतांना परमेश्वर पावलापण पंकजला पंतांची पायाळू पोर पावली.


Monday, August 9, 2010

Translation Limits

The term "translation limits" refers to the minimum numbers of various element that a C compiler must be able to handle. These include such things as the length of identifiers, levels of nesting, number of case statements, and a number of member allowed in structure or union. C99 has increased several of these limits beyond the already generous ones specified by C89. Here are some examples:

Limit                                                                       C89      C99
Nesting levels of blocks                                         15        127
Nesting levels of conditional inclusion                  8          63
Significant characters in an internal identifier       31        63
Significant characters in an external identifier      6          31
Members of a structure or union                         127      1023
Arguments in a function call                                31        127
Numbers of case statement in switch                 257     1023

Ref: C, The Complete Reference by Herbert Schildt (Fourth Edition)

-----------------------------------------------------------------------------------------------------------------------

Some good c-examples

c_program_examples