@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2



Comments:

<0> back to 1wire_*();
<1> that is not a valid symbol
<0> michai: really? ;)
<1> well
<1> yes
<0> poor me
<1> you are invenitng your own protocol/
<1> ?
<0> nope, just implementing dallas/maxim`s 1wire protocol
<1> how fast is that
<0> dunno, important is that it uses only one wire :)
<0> it`s also powered by that one wire
<1> yeah
<1> someone on #otherchan was also making something with it
<1> but complained it was too sensitive to environment
<0> uhm, i didn`t notice any problems



<0> but it`s true, sometimes i get crc-errors
<1> that's what crc is for I spose
<1> did you ever implement i2c for multi master?
<1> I am slowly reading spec and considering that, but it's kind of tricky
<0> that is only implementation i have made http://netlab.servebeer.com/~ravi/icard/i2c.c
<0> didn`t need more
<1> is that single master?
<1> ok I looked anyway
<0> single
<1> ok
<0> i thought i2c is easy to implement :)
<1> well...
<1> with multiple masters you have arbitration and what not
<1> and synchronizing clocks
<1> but it's beautiful :)
<0> ;)
<1> nity
<2> I am trying to learn network programming with c.. I just noticed that I can't bind port with client because my server program have already binded it.. is it true that I can't bind port 80 with my server program, because OS already have http server?
<3> correct.
<3> stop the http server or select a different port.
<2> hmm
<4> antifreeze, why would you need to bind the same port twice by different programs?
<5> or a diffrent IP
<5> if the other server doesnt listen on 0.0.0.0
<2> well, I have one problem..
<2> I can send from server to client, if I use address, which I have received with recvfrom function. But if I try to send data to client with ip address ("127.0.0.1"), client doesn't receive data
<2> I thought I need to bind local address with client too
<2> I have tried to build destination address and send data to client. dest.sin_family=AF_INET; inet_aton("127.0.0.1", &dest.sin_addr); dest.sin_port=htons(port); sendto(client_sock,data,size,0,(struct sockaddr*)dest,sizeof(dest));
<2> but I guess that I am sending those messages to server itself
<3> dest is not a pointer.
<3> (struct sockaddr *)&dest
<2> well, I rewrite it here incorrectly
<3> *shrug*
<2> is gdb worth of learn?
<3> learning a debugger is often very worthwhile.
<2> I have used to code only on MSVC++6, and that have really easy to use debugger. now I am writing code with Kate.. maybe I should use kdevelop
<3> *shrug*
<3> you learned msvc's debugger. nothing stopping you from learning another.
<6> good morning...
<2> gdb seems to be easier to use than i thought
<6> 10 of August...
<6> hb to pht!
<7> morning
<8> moin
<9> moin
<0> lo lorindol
<10> Hi, do you have an idea why I get undefined values in an array, when initializing the array with memset? memset(&list[0], 0, LISTSIZE); There are values like 0, -1073743576 or 134603056 I thought I could replace a for loop by memset for initialiszing arrays.
<3> you probably did it wrong.
<11> why do you call it list, when thats an array?
<3> if list is an array: memset(list, 0, sizeof list)
<10> I want to initialize the array in a function. So the array is p***ed by reference and I cant use sizeof to get the size of the array.
<3> there is no p*** by reference in c.
<3> in addition to p***ing the pointer, p*** the total array size.
<3> void f(int *list, size_t size) { memset(list, 0, size); } int main(void) { int list[1000]; f(list, sizeof list); }
<10> function(&array[0]); ?
<3> not really.
<10> The size is defined as constant integer
<3> if list is a pointer then you used malloc or realloc, so you know the size you requested, p*** that.
<3> LISTSIZE is *obviously* not the total size *in bytes* of the allocation.
<3> int main(void) { int *list = malloc(LISTSIZE * sizeof *list); f(list, LISTSIZE * sizeof *list); }



<10> twkm you re right
<10> LISTSIZE is the amount of possible elements
<3> so multiple by the element size, e.g., as i showed.
<10> ok
<10> thank you
<10> twkm, I get the same problem. I replaced the constant LISTSIZE by the size *in bytes* for memset, but I still get undefined values. I hate memset now. I will replace it by a for loop as used before.
<3> cool.
<12> he-he
<13> m_0_r_0_n: maybe you mix up the parameters of memset. its memset( void* dest, int number, int count ); so it should be memset( buffer, 0, bufsize ); if reseting buffer.
<6> m_0_r_0_n: how many bytes do you need to allocate one int variable?
<6> and for two variables of the same type?
<10> void setOpBanlist(int OpBanlist[], size_t size) { ... memset(&iOpBanlist[0], 0, size); ... } int main(void) { int OpBanlist[30]; setOpBanlist(OpBanlist, sizeof OpBanlist);} Do you see an error?
<13> m_0_r_0_n: try to debug.
<13> you will find out probably that parameter [size] in the setOpBanList() is 120 instead of 30. why ? because size of the array is 30 x 4 byte int = 120 bytes
<13> ah silly me, thats correct right.
<13> so it should be working
<3> which calls into question the method used to determine the values are trash.
<3> hopefully the iOpBanlist is a typo, and should be just OpBanList.
<14> to know if a file exist, is faster to use fopen (fclose) or stat ?
<15> Stat is better if you do not want to open it after you find out that it exists.
<14> thx, was only courious since there was a question here in the office :)
<14> some said "the right way to do this is fopen, so must be done... "
<14> thats after i've suggested stat :)
<13> is stat os independant ?
<5> if you have to use that file later except only checking its existence then using stat yields a possible race condition
<5> i see no reason why speed is important in such i/o stuff but first open() and then fdopen() if you need a FILE* is likely a good bet
<5> .. if supported by your os
<13> http://xkcd.com/comics/pointers.png
<16> ...
<12> haha
<17> yes, haha
<6> pht, are you 26 today?
<6> or am I wrong? :)
<16> haha internet
<1> hoi
<1> *cricket noise*
<18> hi all. I have to create a rtsp/mjpeg streaming from a series of jpeg images, contained in a directory. Can you suggest my the best libraries for doing that? (and some example code too..)tnx
<1> not me, but did you browse freshmeat.net ?
<19> yes
<19> did.
<1> not you foo'
<19> oh.
<19> I did not, then.
<19> if you insinst
<19> -n
<0> michai: mhm, what means 'strong pull-up' in 1wire? external resistor pullup+avr internal pull-up aren`t enough to power device in parasite-power mode? Do I need a transistor pull-up?
<0> too lazy to test, so i`m asking :P
<19> .o(holy paranoia)
<0> :-)
<1> Ravi_Holmes, I have no idea; I guess transistor pullup makes no sense
<1> strong pullup could be low R
<1> for all I knw
<19> just short circuit it
<19> and add a good 230V from the wall socket
<0> (c) 'good advices from sm_barbie'
<19> yes
<19> because of that this advice will cost you 8 Euro.
<19> or 12 U$
<1> I am adding version[] string from cvs checkout; how to get string without 'Revision:' ?
<1> I use $Revision$ now
<1> I could have sworn there's some trick
<19> use it in a string, parse that string
<1> </c_related>
<1> yeah... fear so
<1> :(
<19> it could be worse!
<1> explain
<1> then I tell funny anecdote
<19> you could have not even the $REVISION$ macro
<19> none
<19> nada
<19> zilch!
<1> hmm cvs -k can do iy
<1> hmm point


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #c
or
Go to some related logs:

#worldchat
#metal
#worldchat
#worldchat
#worldchat
#worldchat
italians talk
easynav lebanon
#worldchat
#worldchat



Home  |  disclaimer  |  contact  |  submit quotes