Search Results

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

Page 124/507 | < Previous Page | 120 121 122 123 124 125 126 127 128 129 130 131  | Next Page >

  • a question in NS c programming

    - by bahar
    Hi I added a new patch to my NS and I've seen thise two errors. Does anyone Know what I can do? error: specialization of 'bool std::less<_Tp::operator()(const _Tp&, const _Tp&) const [with _Tp = _AlgorithmTime]' in different namespace from definition of 'bool std::less<_Tp::operator()(const _Tp&, const _Tp&) const [with _Tp = _AlgorithmTime]' and the errors are from this code typedef struct _AlgorithmTime { // Round. int round; // Fase. int fase; // Valore massimo di fase. int last_fase; public: _AlgorithmTime() { round = 0; fase = 0; last_fase = 0; } // Costruttore. _AlgorithmTime(int r, int f, int l) { round = r; fase = f; last_fase = l; } // Costruttore. _AlgorithmTime(const _AlgorithmTime & t) { round = t.round; fase = t.fase; last_fase = t.last_fase; } // Operatore di uguaglianza. bool operator== (struct _AlgorithmTime & t) { return ((t.fase == fase) && (t.round == round)); } // Operatore minore. bool operator < (struct _AlgorithmTime & t) { if (round < t.round) return true; if (round > t.round) return false; if (fase < t.fase) return true; return false; } // Operatore maggiore. bool operator > (struct _AlgorithmTime & t) { if (round > t.round) return true; if (round < t.round) return false; if (fase > t.fase) return true; return false; } void operator++ () { if (fase == last_fase) { round++; fase = 0; return; } fase++; } void operator-- () { if (fase == 0) { round--; fase = last_fase; return; } fase--; } }AlgorithmTime; template< bool std::less::operator()(const AlgorithmTime & t1, const AlgorithmTime & t2)const { if (t1.round < t2.round) return true; if (t1.round t2.round) return false; if (t1.fase < t2.fase) return true; return false; } Thanks

    Read the article

  • Android programming: Authentication and data exchange with Java EE

    - by Konsumierer
    I am having a Java application running in a Tomcat server using Spring, Hibernate, etc. and a two web interfaces, one implemented in Tapestry 5 and the other one using Flex with BlazeDS and Spring-BlazeDS. In my first android application I would now like to log in to the server and retrieve some data. I´m wondering how I could achieve this in a secure way. First of all I need to know which technology is the best to retrieve data from the server and how can I restrict the access to users only that have been successfully authenticated. With what I read until now I would try to implement a HTTPServlet on the server and make server calls via HTTP Client. In the servlet I could probably use the HTTPSession to check if the request comes from an authenticated user. And the data I would try to send serialized (JSON). Unfortunately, I´ve never done those things and maybe I´m on the wrong way and there are more comfortable solutions.

    Read the article

  • Extend legacy site with another server-side programming platform best practice

    - by Andrew Florko
    Company I work for have a site developed 6-8 years ago by a team that was enthusiastic enough to use their own private PHP-based CMS. I have to put dynamic data from one intranet company database on this site in one week: 2-3 pages. I contacted company site administrator and she showed me administrative part - CMS allows only to insert html blocks & manage site map (site is deployed on machine that is inside company & fully accessible & upgradeable). I'm not a PHP-guy & I don't want to dive into legacy hardly-who-ever-heard-about CMS engine I also don't want to contact developers team, 'cos I'm not sure they are still present and capable enough to extend this old days site and it'll take too much time anyway. I am about to deploy helper asp.net site on IIS with 2-3 pages required & refer helper site via iframe from present site. New pages will allow to download some dynamic content from present site also. Is it ok and what are the pitfalls with iframe approach?

    Read the article

  • Best programming based games

    - by Matt Sheppard
    Back when I was at school, I remember tinkering with a Mac game where you programmed little robots in a sort of pseudo-assembler language which could then battle each other. They could move themselves around the arena, look for opponents in different directions, and fire some sort of weapon. Pretty basic stuff, but I remember it quite fondly, even if I can't remember the name. Are there any good modern day equivalents?

    Read the article

  • iPhone programming guideline : List / detail / modify

    - by Oliver
    Hello, I have a program that displays a list (a TableView). When the user clicks an item, it's detail is shown. On the detail view, the user can ask to modify it so a modify window is shown. Here, the user can ask to delete the item. I would like at this time return to the list with the item deleted from the list and from the data source. There may be thousands of methods to do this, but I wonder which is the best / good one. Could you help me, and/or give me a good reference to read about this ? Thank you.

    Read the article

  • Event driven programming in perl?

    - by TheGNUGuy
    Hey everyone, I'm trying to make a jabber bot and I am having trouble keeping it running while waiting for messages. How do I get my script to continuously run? I have tried calling a subroutine that has a while loop that I , in theory, have set up to check for any messages and react accordingly but my script isn't behaving that way. Here is my source: http://pastebin.com/03Habbvh

    Read the article

  • Purpose of singletons in programming

    - by thecoshman
    This is admittedly a rather loose question. My current understanding of singletons is that they are a class that you set up in such a way that only one instance is ever created. This sounds a lot like a static class to me. The main differnce being that with a static class you don't / can't instance it, you just use it such as Math.pi(). With a singletong class, you would still need to do something like singleton mySingleton = new singleton(); mysingleton.set_name("foo"); singleton otherSingleton = new singleton(); // correct me if i am wrong, but mysingleton == othersingleton right now, yes? // this the following should happen? otherSingleston.set_name("bar"); mysingleton.report_name(); // will output "bar" won't it? Please note, I am asking this language independently, more about the concept. So I am not so worried about actually how to coed such a class, but more why you would wan't to and what thing you would need to consider.

    Read the article

  • Conditional interface programming for iPad?

    - by Fyrian
    Hi everyone! I'm working on an app for the iPad and am a little over my head with one issue. Is it possible to build an app for iPad that uses a function to control which interface layout is displayed? Something like "if these parameters are met, use XIB file "a" else use XIB file "b". I know that's not in any kind of legitimate format, but you get the idea. If this is possible, does anyone know of any tutorials on how to do it or sample code I could look at? Thanks!

    Read the article

  • How does Object Oriented Programming work?

    - by venom
    Hello, I am not sure about some things in OOP. If I have Class1, which has some private field, for example private Field field1, and make getField1 () { return field1; } then I have some class with constructor public Class2 (Field field) { someMethod(field); } And then I call constructor of Class2 in Class3 like: Class2 cl = new Class2(instanceOfClass1.getField1()); And now the question: Am I working with field1 of instanceOfClass1 in someMethod(field)?

    Read the article

  • Database Programming in C#, returning output from Stored Proc

    - by jpavlov
    I am working at gaining an understanding at how to interface stored procedures with applications. My example is simple, but it doesn't display my columns and rows in the command prompt, instead it display System.Data.SqlClient.SqlDataReader. How do I display the rows from my stored procudure? ----Stored Proc-- ALTER PROCEDURE dbo.SelectID AS SELECT * FROM tb_User; ----- Below is the code: using System; using System.Data.SqlClient; using System.IO; namespace ExecuteStoredProc { class Program { static void Main(string[] args) { SqlConnection cnnUserMan; SqlCommand cmmUser; //SqlDataReader drdUser; //Instantiate and open the connection cnnUserMan = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=c:\\Program Files\\Microsoft SQL Server\\MSSQL10.SQLEXPRESS\\MSSQL\\DATA\\UserDB.mdf; Integrated Security=True;Connect Timeout=30;User Instance=True"); cnnUserMan.Open(); //Instantiate and initialize command cmmUser = new SqlCommand("SelectID", cnnUserMan); cmmUser.CommandType = System.Data.CommandType.StoredProcedure; //drdUser = cmmUser.ExecuteReader(); Console.WriteLine(cmmUser.ExecuteReader()); Console.ReadLine(); } } } Thanks.

    Read the article

  • How HID devices work when programming?

    - by user1008476
    I have a barcode scanner works as HID device. Everytime a barcode scans it goes directly to windows keyboard, for example if I open notepad I can see the barcode typed there. As far as I know programmatically is it possible to to read HID data from your HID devices. But what happens if the user is already on a form with a text edit control? The scanned code will go inside the text box. Can you block incoming text and make a background-only processing? Can you explain the theory please?

    Read the article

  • Programming error in Java Socket

    - by Akhil K Nambiar
    Can you tell me what is the error in this code? Socket socket = new Socket(hostname, port); PrintWriter out = new PrintWriter(socket.getOutputStream(), true); //DataInputStream is = new DataInputStream(socket.getInputStream()); out.println("hi"); System.out.print(in.readLine()); The Server Socket program is written in .Net and it echoes back the data. The data is sent successfully but could not be retrieved properly. I tried the same by using the linux command nc 192.168.1.6 8425 (enter) Hi (Sent data) Hi (recieved data) When I checked the code the data is found to have sent as byteStream in .Net. Is that a problem. In that case what modification should I make.

    Read the article

  • C Programming - Passing a pointer to array

    - by Pedro
    How do I pass a pointer value to an array of the struct; For example, on a txt I have this: John Doe;[email protected];214425532; My code: typedef struct Person{ char name[100]; char email[100]; int phone; }PERSON; int main(){ PERSON persons[100]; FILE *fp; char *ap_name; char *ap_email; char *ap_phone; char line[100]; fp=("text.txt","r"); if(fp==NULL){ exit(1); } else{ fgets(line,100,fp); ap_name=strtok(line,";"); ap_email=strtok(NULL,";"); ap_phone=strtok(NULL,";"); } return 0; } My question is how can I pass the value of ap_name, ap_email, ap_phone to the struct? And, do I need to use all of these pointers?

    Read the article

  • What are the common patterns in web programming?

    - by lankerisms
    I have been trying to write my first big web app (more than one cgi file) and as I kept moving forward with the rough prototype, paralelly trying to predict more tasks, this is the todo that got accumulated (In no particular order). * Validations and input sanitizations * Object versioning (to avoid edit conflicts. I dont want hard locks) * Exception handling * memcache * xss and injection protections * javascript * html * ACLs * phonetics in search, match and find duplicates (for form validation) * Ajaxify!!! (I have snipped off the project specific items.) I know that each todo will be quite tied up to its project and technologies used. What I am wondering though, is if there is a pattern in your todo items as well as the sequence in which you experienced guys have come across them.

    Read the article

  • Why use constants in programming?

    - by Adam N
    I've just been going back over a bit of C studying using Ivor Horton's Beginning C book. I got to the bit about declaring constants which seems to get mixed up with variables in the same sentence. Just to clarify, what is the difference in specifying constants and variables in C, and really, when do you need to use a constant instead of a variable? I know folks say to use a constant when the information doesn't change during program execution but I can't really think of a time when a variable couldn't be used instead. Thanks

    Read the article

  • in .net, what programming model would be good for prototyping, but then reusable for production (for

    - by Greg
    Hi, In .NET land what would be a good approach for quick prototyping of a concept (i.e. development just on my PC) that could then be extended out to product (users across LAN/WAN), BUT in a fashion that the model/business logic code and data access layer code can be used as is? One thought for example I had as to do: (a) WinForms with business logic and Entity Framework layer to SQL Server Express on my PC, then (b) Go then to ASP.net (using the business logic / data library) with SQL Server/IIS Any comments? Other suggestions?

    Read the article

  • C programming: hashtable insertion/search

    - by Ricardo Campos
    Hello i have a problem with my hash table its implemented like this: #define HT_SIZE 10 typedef struct _list_t_ { char key[20]; char string[20]; char prevValue[20]; struct _list_t_ *next; } list_t; typedef struct _hash_table_t_ { int size; /* the size of the table */ list_t ***table; /* first */ sem_t lock; } hash_table_t; I have a Linked list with 3 pointers because i want a hash table with several partitions (shards), here is my initialization of my Hash table: hash_table_t *create_hash_table(int NUM_SERVER_THREADS, int num_shards){ hash_table_t *new_table; int j,i; if (HT_SIZE<1) return NULL; /* invalid size for table */ /* Attempt to allocate memory for the hashtable structure */ new_table = (hash_table_t*)malloc(sizeof(hash_table_t)*HT_SIZE); /* Attempt to allocate memory for the table itself */ new_table->table = (list_t ***)calloc(1,sizeof(list_t **)); /* Initialize the elements of the table */ for(j=0; j<num_shards; j++){ new_table->table[j] = (list_t **)calloc(1,sizeof(list_t *)); for(i=0; i<HT_SIZE; i++){ new_table->table[j][i] = (list_t *)calloc(1,sizeof(list_t )); } } /* Set the table's size */ new_table->size = HT_SIZE; sem_init(&new_table->lock, 0, 1); return new_table; } Here is my search function to search in the hash table list_t *lookup_string(hash_table_t *hashtable, char *key, int shardId){ list_t *list ; int hashval = hash(key); /* Go to the correct list based on the hash value and see if key is * in the list. If it is, return return a pointer to the list element. * If it isn't, the item isn't in the table, so return NULL. */ sem_wait(&hashtable->lock); for(list = hashtable->table[shardId][hashval]; list != NULL; list =list->next) { if (strcmp(key, list->key) == 0){ sem_post(&hashtable->lock); return list; } } sem_post(&hashtable->lock); return NULL; } And my insert function: char *add_string(hash_table_t *hashtable, char *str,char *key, int shardId){ list_t *new_list; list_t *current_list; unsigned int hashval = hash(key); /*printf("|%d|%d|%s|\n",hashval,shardId,key);*/ /* Lock for concurrency */ sem_wait(&hashtable->lock); /* Attempt to allocate memory for list */ new_list = (list_t*)malloc(sizeof(list_t)); /* Does item already exist? */ sem_post(&hashtable->lock); current_list = lookup_string(hashtable, key,shardId); sem_wait(&hashtable->lock); /* item already exists, don't insert it again. */ if (current_list != NULL){ strcpy(new_list->prevValue,current_list->string); strcpy(new_list->string,str); strcpy(new_list->key,key); new_list->next = hashtable->table[shardId][hashval]; hashtable->table[shardId][hashval] = new_list; sem_post(&hashtable->lock); return new_list->prevValue; } /* Insert into list */ strcpy(new_list->string,str); strcpy(new_list->key,key); new_list->next = hashtable->table[shardId][hashval]; hashtable->table[shardId][hashval] = new_list; /* Unlock */ sem_post(&hashtable->lock); return new_list->prevValue; } My main class runs some of tests by executing the insertion / reading / delete from the elements of the hash table the problem is when i have more than 4 partitions/shards the tests stop at the first reading element saying it returned the wrong value NULL on the search function, when its less than 4 it runs perfectly well and passes all the tests. You can see my main.c in here if you want to give a look: http://hostcode.sourceforge.net/view/1105 My complete Hash table code: http://hostcode.sourceforge.net/view/1103 And other functions where hash table code is executed: .c file http://hostcode.sourceforge.net/view/1104 .h file http://hostcode.sourceforge.net/view/1106 Thank for you time, i appreciate any help you can give to me this is a college important project that I'm trying to solve and I'm stuck here for 2 days.

    Read the article

< Previous Page | 120 121 122 123 124 125 126 127 128 129 130 131  | Next Page >