Sign in or Join FriendFeed
FriendFeed is the easiest way to share online. Learn more »
Answer by ardsrk for How to compare size_t and pid_t with int - http://stackoverflow.com/questio...
In C, size_t is an unsigned type and its size is the size an int type takes on the underlying architecture. Because C is weakly typed you could however assign signed integers to a size_t type. The responsibility of using the types properly partly rests on the programmer. In your case since you are comparing the size_t type to zero it is fine. Try comparing it to a negative number. You would be surprised. - Arvind
Answer by ardsrk for Reading code of real production projects. How to find? - http://stackoverflow.com/questio...
Django is both object oriented and MVC based framework written in Python. The Chapter 5: Models of the free Django book explains the MVC pattern as applied to Django. Also look at this SO question. - Arvind
@noufalibrahim just sent you one. Though it will take some time before we can start waving.
@BrentO That's way more than facebook users. Microsoft should start social networking sites around their product offerings.
Comment by ardsrk on Memory full on calling a method through its method pointer - http://stackoverflow.com/questio...
laalto: Though hard to find the leave was caused by a failed memory allocation. The lesson I have learned is to TRAP every call that can leave. Thanks. - Arvind
Wondering whether bit vectors [ http://en.wikipedia.org/wiki... ] is a better way to represent your data than an array of enums...
Comment by ardsrk on C structs don't define types? - http://stackoverflow.com/questio...
Mikael is right, C++ does not require you to use struct while declaring types of the structure. Why was the answer down voted? - Arvind
Answer by ardsrk for How to find shift/reduce conflict in this yacc file? - http://stackoverflow.com/questio...
As mientefuego pointed out you grammar has the classic "dangling else" problem. You could beat the problem by assigning precedence to the rules that causes conflict. The rule causing conflict is: selection_stmt : IF '(' expression ')' statement | IF '(' expression ')' statement ELSE statement ; First start by making ELSE and LOWER_THAN_ELSE ( a pseudo-token ) non associative: %nonassoc LOWER_THAN_ELSE %nonassoc ELSE This gives ELSE more precedence over LOWER_THAN_ELSE simply because LOWER_THAN_ELSE is declared first. Then in the conflicting rule you have to assign a precedence to either the shift or reduce action: selection_stmt : IF '(' expression ')' statement %prec LOWER_THAN_ELSE ; | IF '(' expression ')' statement ELSE statement ; Here, higher precedence is given to shifting. I have incorporated the above mentioned corrections and listed the complete grammar below: /* C-Minus BNF Grammar */ %token ELSE %token IF %token INT %token RETURN %token VOID %token WHILE %token ID %token... - Arvind
Comment by ardsrk on Good C code to read for learning - http://stackoverflow.com/questio...
I would personally ask you to look at wget. It is a useful utility backed by friendly and talented bunch of programmers. - Arvind
Answer by ardsrk for Javascript code,unterminated string literal - http://stackoverflow.com/questio...
You could use arrays to store fragments of your markup and then use the join method to get the complete markup: a = new Array(20); a[0]='<li><div class="above">' a[1]= $question_number a[2]= 'Question Title</div>' a[3]= '<div class="middle">' a[4]= '<input type="text" name="question' a[5]= $question_number a[6]= '" size="55"/></div>' a[7]= '<div class="below">' a[8]= $question_number a[9]= '<input type="text" name="option' a[10]=$question_number a[11]= '" size="6"/>' a[12]=$question_number a[13]='<input type="text" name="option' a[14]=$question_number a[15]='" size="6"/>' a[16]='<input class="btn" type="button" name="Submit" value="Add" />' a[17]='<input class="btn" type="button" name="Submit" value="Remove" />' a[18]='</div>' a[19]='</li>' $html = a.join(''); - Arvind
Answer by ardsrk for I want to start reading the Python source code. Where should I start. - http://stackoverflow.com/questio...
Download the source from the python website. Say you unzipped the source into a directory named Python-3.1.1. I suggest you two starting points within Python source code that would help you explore how Python works under the hood: Examine how the Python Virtual Machine executes the bytecode generated from the interperter. The Python VM is in the file named Python-3.1.1/Python/ceval.c. The core of the VM is an eval loop that starts at the function PyEval_EvalFrameEx in ceval.c. Read through the source and the inline comments. I am sure you would enjoy it. Another option is to look at how built-in python data types like lists, dictionaries and sets are implemented. For instance sets are implemented in Python-3.1.1/Objects/setobject.c. The Objects directory contains implementations of other data types as well. Hope this helps. Enjoy!! - Arvind
Memory full on calling a method through its method pointer - http://stackoverflow.com/questio...
I have a method pointer like below: typedef void (MMsnInternalCallBacks::* FuncPtr)(); FuncPtr iSoapActionComplete; I call the method below through the pointer iSoapActionComplete like below: (iCallbacks.*iSoapActionComplete)( ); While the function is being called a message "Memory Full. Try closing some applications" flashes on my Symbian S60 3rd Ed emulator. Any idea why this could be happening. - Arvind
Working Effectively with Legacy Code (Robert C. Martin Series) - http://www.goodreads.com/review...
I want to start reading the Python source code. Where should I start. - Stack Overflow - http://stackoverflow.com/questio...
Is 4-5 years the “Midlife Crisis” for a programming career? - Stack Overflow - http://stackoverflow.com/questio...
A history of Python packaging - http://faassen.n--tree.net/blog...
Answer by ardsrk for Is this simple python code thread safe? - http://stackoverflow.com/questio...
Are you sure that the functions increment and decrement execute without any error? I think it should raise an UnboundLocalError because you have to explicitly tell Python that you want to use the global variable named 'c'. So change increment ( also decrement ) to the following: def increment(): global c c += 1 I think as is your code is thread unsafe. This article about thread synchronisation mechanisms in Python may be helpful. - Arvind
Answer by ardsrk for what is operation overloading? - http://stackoverflow.com/questio...
I guess you have got the wrong understanding about operator overloading. The idea of operator overloading is to present user-defined types with operations similar to those that could be performed on primitive types ( like integers ). Of course you could use operator overloading to overload the increment operator ( ++ ) that would actually decrement some member variable's value but you would surprise the users of your class just the way you would if you reported the objects being compared as unequal even though you have found them to be equal under certain conditions. Doing such things may be fine for learning the concepts but don't take them anywhere beyond. - Arvind
Comment by ardsrk on Very fast memcpy for image processing? - http://stackoverflow.com/questio...
banister: don't forget to mail him that you used his code in your project ;) [ williamchan.ca/portfolio/assembly/… ] - Arvind
Answer by ardsrk for Function to read files one by one in a directory - http://stackoverflow.com/questio...
By what I get from your question its a good case for interprocess communication. You say that you need to be notified when a file in a directory is created. Now, doing interprocess communication through files is bad in my opinion. In Unix you have several alternatives for interprocess communication as this guide details. Using Unix sockets would be the simplest way to go. If you have written the other process that now creates a file for interprocess communication you could change the implementation to write it to the socket. - Arvind
RT @achitnis: Geodesic announces SPOKN: Internet Telephony - Perfected. Fully functional & legal. Check it out NOW: http://www.spokn.com/cgi-bin...
RT @sshreyas: RT @achitnis: FOSS.IN/2009 Delegate Registration is now open http://foss.in/registe... (please RT/repost generously)
All you should really know about Autoconf and Automake | GNU Smalltalk - http://smalltalk.gnu.org/blog...
HTTP Analyzer Stand-alone - http://wakoopa.com/softwar...
HTTP Analyzer Stand-alone
Generators in C - Stack Overflow - http://stackoverflow.com/questio...
Free Programming Classes : Learn How to Program - http://origin.reddit.com/r...
Other ways to read this feed:Feed readerFacebook