Search Results

Search found 12674 results on 507 pages for 'programming competitions'.

Page 168/507 | < Previous Page | 164 165 166 167 168 169 170 171 172 173 174 175  | Next Page >

  • Is it possible to create a domain model for legacy code without refactoring?

    - by plaureano
    I currently have a client that wants me to 'abstract' out a domain model from the existing code but they specifically said that I shouldn't refactor the existing code itself. My question is 1) whether or not this is advisable and 2) what techniques would you apply in this scenario if you can't refactor the code yet they expect you to come up with a model for it? (EDIT: I can't quite put my finger on it, but somehow, not being able to refactor in this case just feels wrong. Has anyone else run into this type of scenario?)

    Read the article

  • Support FOSS Projects via T-Shirts

    - by The MYYN
    Can we get a list of free and open source projects, which can be supported through purchasing branded garment? Free Software Foundation http://shop.fsf.org/ ps. I know this is extremly off-topic. But I'd like to buy clothing and support open source at the same time, if possible. And I'd like to know, where this is possible.

    Read the article

  • Did Java invent interfaces?

    - by Jordão
    I know about C++ pure virtual classes, but Java went one step further and created a first-class (no pun intended) concept for multiple-interface (not implementation) inheritance, the interface. It's now a staple of major statically-typed languages. Did Java invent the interface concept? Or did it appear in older languages also as a first-class concept?

    Read the article

  • Pthread-ed filetransfer application crash

    - by N.R.S.Sowrabh
    I am developing a file transfer application and am using pthreads on the receiver side for receiving multiple files. The function which is passed to pthreads calls the following function and at the end of this function I get a SIGABRT error and stack-smashing error appears on the terminal. Please help me find the bugs. If you need anymore code I'd be able to post the same. Thanks in advance. void recv_mesg(int new_sockid, char *fname) { cout<<"New Thread created with "<<new_sockid<<" and "<<fname<<endl; char buf[MAXLINE]; int fd; fd = open(fname, O_WRONLY ); int len =0; while (len<1024) { int curr = recv(new_sockid, buf, 1024-len, 0); //fprintf(stdout,"Message from Client:\n"); len += curr; //write (fd, buf, curr); fputs(buf, stderr); } int file_size = 0; sscanf(buf,"%d",&file_size); if(file_size<=0) perror("File Size < 0"); sprintf(buf,"Yes"); send(new_sockid,buf,strlen(buf),0); len = 0; while (len<file_size) { int curr = recv(new_sockid, buf, min(file_size-len,MAXLINE), 0); len += curr; write (fd, buf, curr); //fputs(buf, stdout); //fflush(stdout); } len = 0; close(fd); close(new_sockid); }

    Read the article

  • Winsock failed to connect to local ip address

    - by JKS
    I have used the following code in a form that acts like a server, WskServer(0).Close LocalIP = WskServer(0).LocalIP WskServer(0).LocalPort = DEFAULT_TCP_PORT WskServer(0).Protocol = sckTCPProtocol txtStatus.Text = "Starting server" Call WskServer(0).Bind(DEFAULT_TCP_PORT, LocalIP) WskServer(0).Listen when i execute above code,i received the following error "Address is not available from the local machine" . If i changed the line Call WskServer(0).Bind(DEFAULT_TCP_PORT, LocalIP) to Call WskServer(0).Bind(DEFAULT_TCP_PORT, "127.0.0.1") this is working What's wrong with the code?, can anybody give the fix Update I just removed the line Call WskServer(0).Bind(DEFAULT_TCP_PORT, LocalIP) now server working properly. this way is correct or not

    Read the article

  • topic-comment naming of functions/methods

    - by Daniel
    I was looking at American Sign Language the other day... and I noticed that the construction of the language was topic-comment. As in "Weather is good". That got me to thinking about why we name methods/functions in the manner of: function getName() { ... } function setName(v) { ... } If we think about naming in a topic-comment function, the function names would be function nameGet() { ... } function nameSet() { ... } This might be better for a class had multiple purposes. IE: class events { function ListAdd(); function ListDelete(); function ListGet(); function EventAdd(); function EventDelete(); function EventGet(); } This way the functions are grouped by "topic". Where as the former naming, functions are grouped Action-Noun, but are sorted by Noun. I thought this was an interesting POV, what do other people think about naming functions/methods Topic-Comment? Obviously, mixing naming conventions up in the same project would be weird, but overall? -daniel

    Read the article

  • Artificially create a connection timeout error

    - by Mark Ingram
    I've had a bug in our software that occurs when I receive a connection timeout. These errors are very rare (usually when my connection gets dropped by our internal network). How can I generate this kind of effect artificially so I can test our software? If it matters the app is written in C++/MFC using CAsyncSocket classes. Edit: I've tried using a non-existant host, and I get the socket error: WSAEINVAL (10022) Invalid argument My next attempt was to use Alexander's suggestion of connecting to a different port, e.g. 81 (on my own server though). That worked great. Exactly the same as a dropped connection (60 second wait, then error). Thank you!

    Read the article

  • awk can and perl cannot

    - by alvin
    somewhere i read about one specific feature present in awk which is absent in perl. failed in locating it again. would appreciate it, if anyone of you could remember. (yep, this might be a useless trivia.) but still curious.

    Read the article

  • Which is more appropriate way of programmming

    - by Raju
    If a variable can take n values should we check for the validity of the values or assume that if all the n-i checks fail it would be the nth value. For example if we have a variable that stores gender as M or F If gender = "M" do male_processing else do female_processing endif If gender = "M" do male_processing else if gender = "F" do female_processing else print "Something has gone wrong Gender has a value " Gender endif endif

    Read the article

  • Generic callbacks

    - by bobobobo
    Extends So, I'm trying to learn template metaprogramming better and I figure this is a good exercise for it. I'm trying to write code that can callback a function with any number of arguments I like passed to it. // First function to call int add( int x, int y ) ; // Second function to call double square( double x ) ; // Third func to call void go() ; The callback creation code should look like: // Write a callback object that // will be executed after 42ms for "add" Callback<int, int, int> c1 ; c1.func = add ; c1.args.push_back( 2 ); // these are the 2 args c1.args.push_back( 5 ); // to pass to the "add" function // when it is called Callback<double, double> c2 ; c2.func = square ; c2.args.push_back( 52.2 ) ; What I'm thinking is, using template metaprogramming I want to be able to declare callbacks like, write a struct like this (please keep in mind this is VERY PSEUDOcode) <TEMPLATING ACTION <<ANY NUMBER OF TYPES GO HERE>> > struct Callback { double execTime ; // when to execute TYPE1 (*func)( TYPE2 a, TYPE3 b ) ; void* argList ; // a stored list of arguments // to plug in when it is time to call __func__ } ; So for when called with Callback<int, int, int> c1 ; You would automatically get constructed for you by < HARDCORE TEMPLATING ACTION > a struct like struct Callback { double execTime ; // when to execute int (*func)( int a, int b ) ; void* argList ; // this would still be void*, // but I somehow need to remember // the types of the args.. } ; Any pointers in the right direction to get started on writing this?

    Read the article

  • cons operator (::) in F#

    - by Max
    The :: operator in F# always prepends elements to the list. Is there an operator that appends to the list? I'm guessing that using @ operator [1; 2; 3] @ [4] would be less efficient, than appending one element.

    Read the article

  • Bluetooth service problem

    - by hara
    hi I need to create a custom bluetooth service and I have to develop it using c++. I read a lot of examples but I didn't success in publishing a new service with a custom UUID. I need to specify a UUID in order to be able to connect to the service from an android app. This is what i wrote: GUID service_UUID = { /* 00000003-0000-1000-8000-00805F9B34FB */ 0x00000003, 0x0000, 0x1000, {0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB} }; SOCKET s, s2; SOCKADDR_BTH sab if (WSAStartup(MAKEWORD(2, 2), &wsd) != 0) return 1; printf("installing a new service\n"); s = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM); if (s == INVALID_SOCKET) { printf ("Socket creation failed, error %d\n", WSAGetLastError()); return 1; } memset (&sab, 0, sizeof(sab)); sab.addressFamily = AF_BTH; sab.port = BT_PORT_ANY; sab.serviceClassId = service_UUID; if (0 != bind(s, (SOCKADDR *) &sab, sizeof(sab))) { printf ("bind() failed with error code %d\n", WSAGetLastError()); closesocket (s); return 1; } int result=sizeof(sab); getsockname(s,(SOCKADDR *) &sab, &result ); printSOCKADDR_BTH(sab); if(listen (s, 5) == 0) printf("listen() is OK! Listening for connection... :)\n"); else printf("listen() failed with error code %d\n", WSAGetLastError()); printf("waiting connection"); for ( ; ; ) { int ilen = sizeof(sab2); s2 = accept (s, (SOCKADDR *)&sab2, &ilen); printf ("accepted"); } if(closesocket(s) == 0) printf("closesocket() pretty fine!\n"); if(WSACleanup () == 0) printf("WSACleanup() is OK!\n"); return 0; When i print the SOCKADDR_BTH structure retrieved with get getsockname i get an UUID that is not the mine. Furthermore if i use the UUID read from getsockname to connect the Android application the connection fails with this exception: java.io.IOException: Service discovery failed Could you help me?? Thanks!

    Read the article

  • Problem determining how to order F# types due to circular references

    - by James Black
    I have some types that extend a common type, and these are my models. I then have DAO types for each model type for CRUD operations. I now have a need for a function that will allow me to find an id given any model type, so I created a new type for some miscellaneous functions. The problem is that I don't know how to order these types. Currently I have models before dao, but I somehow need DAOMisc before CityDAO and CityDAO before DAOMisc, which isn't possible. The simple approach would be to put this function in each DAO, referring to just the types that can come before it, so, State comes before City as State has a foreign key relationship with City, so the miscellaneous function would be very short. But, this just strikes me as wrong, so I am not certain how to best approach this. Here is my miscellaneous type, where BaseType is a common type for all my models. type DAOMisc = member internal self.FindIdByType item = match(item:BaseType) with | :? StateType as i -> let a = (StateDAO()).Retrieve i a.Head.Id | :? CityType as i -> let a = (CityDAO()).Retrieve i a.Head.Id | _ -> -1 Here is one dao type. CommonDAO actually has the code for the CRUD operations, but that is not important here. type CityDAO() = inherit CommonDAO<CityType>("city", ["name"; "state_id"], (fun(reader) -> [ while reader.Read() do let s = new CityType() s.Id <- reader.GetInt32 0 s.Name <- reader.GetString 1 s.StateName <- reader.GetString 3 ]), list.Empty ) This is my model type: type CityType() = inherit BaseType() let mutable name = "" let mutable stateName = "" member this.Name with get() = name and set restnameval=name <- restnameval member this.StateName with get() = stateName and set stateidval=stateName <- stateidval override this.ToSqlValuesList = [this.Name;] override this.ToFKValuesList = [StateType(Name=this.StateName);] The purpose for this FindIdByType function is that I want to find the id for a foreign key relationship, so I can set the value in my model and then have the CRUD functions do the operations with all the correct information. So, City needs the id for the state name, so I would get the state name, put it into the state type, then call this function to get the id for that state, so my city insert will also include the id for the foreign key. This seems to be the best approach, in a very generic way to handle inserts, which is the current problem I am trying to solve.

    Read the article

  • Compiler Construction course

    - by donpal
    I'm looking for a course (preferably video, much preferably) like MIT's video courses on Compiler Construction. Can someone point me to some decent resources or help material (preferably video)?

    Read the article

  • Suitable compiled language for new project [closed]

    - by Toby
    Hello, I'm about to develop some commercial software that will run on OSX and Linux. The program will be doing some heavy string manipulation, base64 encoding, zlib compression and may require http libraries in the future. Does anyone have a suggestion? Many thanks in advance, Toby.

    Read the article

  • Haskell - Parsec Parsing <p> element

    - by Martin
    I'm using Text.ParserCombinators.Parsec and Text.XHtml to parse an input like this: This is the first paragraph example\n with two lines\n \n And this is the second paragraph\n And my output should be: <p>This is the first paragraph example\n with two lines\n</p> <p>And this is the second paragraph\n</p> I defined: line= do{ ;t<-manyTill (anyChar) newline ;return t } paragraph = do{ t<-many1 (line) ;return ( p << t ) } But it returns: <p>This is the first paragraph example\n with two lines\n\n And this is the second paragraph\n</p> What is wrong? Any ideas? Thanks!

    Read the article

  • shared hacker houses in europe

    - by Mantas
    Hey, I'm a freelance web developer. I'm borred of my hometown, so I want to hit the road. Do you know any shared hacker houses in Europe? Do you have any ideas what is the best way to look for a shared flat? France, Spain, Holland, Italy... I'm interested in virtually any country :) P.S. I speak English and Lithuanian only, so it's hard to look up shared flat in local languages...

    Read the article

  • How to access File over the Network

    - by Polo
    Hi! I am having a hard time on this one, I have a folder over the network with public access (no credential restriction). I am trying to do a File.Exist or Directory.Exist and I keep on having a exception. Can someone tell me the good way to do IO over the network. EDIT 1 FOR DETAILS: if i do execture = \agoodip\Public\test.txt I get the file etc etc In my code it look like a basic Directory.Exist(@"\\agoodip\Public") or File.exist(@"\\agoodip\Public\test.txt") The exception I get is Path not found. EDIT 2 : I am using Silverlight 3, Is there any security pattern to be aware of to lookup file on the network? Thanks!

    Read the article

  • What features of interpreted languages can a compiled one not have?

    - by sub
    Interpreted languages are usually more high-level and therefore have features as dynamic typing (including creating new variables dynamically without declaration), the infamous eval and many many other features that make a programmer's life easier - but why can't compiled languages have these as well? I don't mean languages like Java that run on a VM, but those that compile to binary like C(++). I'm not going to make a list now but if you are going to ask which features I mean, please look into what PHP, Python, Ruby etc. have to offer. Which common features of interpreted languages can't/don't/do exist in compiled languages? Why?

    Read the article

< Previous Page | 164 165 166 167 168 169 170 171 172 173 174 175  | Next Page >