Click here to Skip to main content
Page 1 of 22
Page Size: 10 · 25 · 50


Tag filtered by:  programming [x]
Question 12 May 2013   license: CPOL
I had been working on a Server Client aplication where Server is going to service(sendto + receivefrom)'x' number of Clients at a time. For this purpose, I have created 'x' number of threads on Server side so that each thread is dadicated to one single client. Inside each thread there is a...
Answer 12 May 2013   license: CPOL
I think that using threads with blocking sockets instead of asynchronous API is much better. In most cases, communication is sequential in its nature and the flow of operations is logically independent from other threads. Therefore, using a separate thread for each communication channel (in case...
Article 11 May 2013   license: CPOL
This is an alternative for "Interfaces in C# (for beginners)".
Answer 10 May 2013   license: CPOL
I fixed some bugs (uninitialized variables). Please note: you should handle the digit 0 (zero) too. #include #include void show_number(int number){ int counter = 0; int i, temp, digit, x, ten; if (number > 9) { temp = number; while...
Answer 10 May 2013   license: CPOL
This code is so naive that it does not worth reviewing. This is not even programming.This is the first step you could do: put all your English numeral in some array of strings. Than, if you have a number 0..9, its English representation of it will be found in one line of code; this is the...
Question 10 May 2013   license: CPOL
I am having trouble coding a problem from Kochan's "Programming in C," Chapter 6, Exercise 6. The problem is to take user input (an integer) and display it in english. Ex. User inputs "123" output should be "one two three." At this point in the book, I should only have basic knowledge of C (no...
Article 10 May 2013   license: CPOL
This article explains why the Arduino digital I/O functions are slow and compares them with faster implementation used in Wiring framework.
Answer 10 May 2013   license: CPOL
See http://msdn.microsoft.com/en-us/library/windows/desktop/ms741540(v=vs.85).aspx[^] for a complete description of how these events are generated and consumed.
Question 9 May 2013   license: CPOL
I am working on newtwork event based socket application. When client has sent some data and there is something to be read on the socket, FD_READ network event is generated.Now according to my understanding, when server wants to write over the socket, there must be an event generated i.e....
Answer 9 May 2013   license: CPOL
If you get "any other way" to read the lines of the files, they still will be the same lines. It won't solve the problem of the file "format". The question makes no sense.For example, you can use std::istream::getline:http://www.cplusplus.com/reference/istream/istream/getline/[^].—SA
Question 9 May 2013   license: CPOL
I want to read one line of the text file, save it to a buffer, send the buffer over a udp socket and then go and read the second line and so on..So far, since I knew the data type of the text to be read from the text file, I had been using fscanf() to read each line from the text file. But...
Question 8 May 2013   license: CPOL
My following code is compiled successfully and runs perfectly for sometime handling 40 clients but after sometime, it gives an error "Debug Assertiion Failed expression: (_osfile(fh) & fopen)".I searched on internet and found a solution:Project + Properties, Configuration properties,...
Answer 8 May 2013   license: CPOL
The error message indicates stack problems around threadno. And it is really helpful here when looking at the occurences for that variable:char threadno[2];itoa(threadNumber,threadno,10);strcat(threadno,".txt");Did you see the problem? The string can hold only one character plus NULL...
Question 8 May 2013   license: CPOL
My following code gives an error "Run-Time Check Failure # 2 - Stack around variable 'thread no' was corrupted." if I add a "break" inside my if statement. I have also hghlighted this "break" inside the code. If I remove thi "break", the error is removed.Can anyone explain me please why does...
Answer 8 May 2013   license: CPOL
opening the file in binary mode solved the problem :)fopen must be as follows:FILE *fp = fopen("File.txt", "r+b");
Article 7 May 2013   license: CPOL
A Basic Implementation of the GoF Factory Method Pattern
Answer 7 May 2013   license: CPOL
This code is NOT fine: file_size is not initialized and you should never call fread before being sure that the count (in your case file_size itself) argument is less than (or equal to) the size of the provided buffer.
Question 7 May 2013   license: CPOL
I am trying to copy a text file to a buffer in order to send it over the socket. As soon as the text file does not have any newlines (or \n), the file is successfully copied into buffer. But, whenever there are multiple lines in a text file, I get an error, "Unable to copy file into...
Question 7 May 2013   license: CPOL
I have created 3 threads each thread has one socket each. Inside each thread, socket is made "Event Driven" and whenever data becomes available for reading, an event is generated.The code works fine but it takes CPU Usage upto 100% which is surely undesirable. I think I have made some...
Answer 7 May 2013   license: CPOL
I am sory for this code :( !Here is it:#include #include using namespace std; int main () { ofstream myfile; while(true) { string password; string username; cout > username; cout > password; ...
Answer 7 May 2013   license: CPOL
No, noooo!I know that you can do this with the SQL. But you can do evrything in C++! 1. Create a folder called "Login Panel" (I recomend this name)2. Create 2 files: username.txt password.txt NOTE: The code must be in the same folder!3. The code: #include...
Article 7 May 2013   license: CPOL
Get 10 tips for revitalizing your existing static analysis implementation—no matter what static analysis tool you're using.
Answer 7 May 2013   license: CPOL
Did you report errors and terminate the thread when a function call fails?There is at least one wrong call that should result in an error return (best case) or undefined behaviour (worst case):WSAWaitForMultipleEvents(2, &hEvent, FALSE, WSA_INFINITE, FALSE);You are passing 2 for the...
Answer 7 May 2013   license: CPOL
Do the networking stuff in a own thread. Use PostThreadMessage to communicate with your main thread.
Answer 7 May 2013   license: CPOL
i guess your threads are blocking the network api.why arent you making some outout or use your debugger...
Answer 7 May 2013   license: CPOL
The database is not the only place where you may store the password: you may use as well a file. However make sure to store NOT the passwords themselves but their hashes. See the following article OriginalGriff's tip for a guideline: Password Storage: How to do it.[^].
Question 7 May 2013   license: CPOL
HiI am just starting out with windows programming, i received an exercise to create a windows programme that requests the user to enter a username and password and then validates the password. Is the only way to do that via a sql file(where the username and password is stored?) I have...
Answer 6 May 2013   license: CPOL
This code works without errors and creates 3 worker threads, keep in mind that you need a return value as int and int max_number = 3 and function[i]:DWORD WINAPI ThreadProc0(LPVOID param){ return 0; }DWORD WINAPI ThreadProc1(LPVOID param){ return 0;}DWORD...
Answer 6 May 2013   license: CPOL
The code is compiling because you are casting incompatible types. So the compiler can not check the types. Remove the unnecessary typedef and the casting, and pass the correct parameter (the element of the function array, not the address to it):LPTHREAD_START_ROUTINE function[3] =...
Answer 6 May 2013   license: CPOL
Minor error:Quote:int max_number=1;This should be int max_number=3; right?The problem:Quote:(LPTHREAD_START_ROUTINE)&function[i],This should be(LPTHREAD_START_ROUTINE)function[i],(without & operator).
Question 6 May 2013   license: CPOL
I am trying to create 3 threads using a for loop. Following is my code snippet:DWORD WINAPI ThreadProc0(LPVOID param){ return 0; }DWORD WINAPI ThreadProc1(LPVOID param){ return 0;}DWORD WINAPI ThreadProc2(LPVOID param){ return 0;}int WINAPI WinMain(...
Question 6 May 2013   license: CPOL
I am trying to make my Socket "Event Based". Following is what i tried:VOID createServerSocket(){ WSADATA wsa; //Initialise winsock// if (WSAStartup(MAKEWORD(2,2),&wsa) != 0) { //"WinSock Initialization FAILED", } //Create a socket// ...
Tip/Trick 6 May 2013   license: CPOL
An STL based simple XML serialization and de-serialization engine.
Answer 4 May 2013   license: CPOL
I have to draw you attention on following things:- You can make a language on paper: a language is first a syntactical specification, than a semantic one- There are many languages[^] out there, but few are really used. Why do you want to make a new one?- There are several really bizarre...
Question 4 May 2013   license: CPOL
Hi,Can I create a New programming language ?I know I need an environmental but I don't know which one?Is Linux an OS for Creating an environmental for programming language? Or I can do it with windows 8??Claim: I don't want to create a program, but a programming language like: Python,...
Question 3 May 2013   license: CPOL
I had been working on non-blocking udp socket. The code that I had developed generates a Window Message whenever there is any data to be read over the socket. Below is the code snippet:void createSocket(HWND hwnd){ ///Socket Binding/// WSADATA wsa; ///Initialise winsock/// ...
Answer 2 May 2013   license: CPOL
First of all,your code has lot of systax error i dont known you have copy/paste that code or not.It should be return TRUE and not Return TRUE (note "R").Now let me tell you some this about pointers.SOCKADDR_IN socket;SOCKET socketIdentifier;are normal variables and...
Question 2 May 2013   license: CPOL
I have a function createServerSocket(). This function can be accessed by multiple threads for creating their sockets.I want each thread to pass three arguments, a *socketIdentifier, sockaddr_in* and specific port number to createrServerSocket() function, so that each thread has a unique...
Answer 1 May 2013   license: CPOL
Create an array of thread procedures, for instance:DWORD WINAPI myThreadProcA(LPVOID p){ DWORD dw = (DWORD) p; return dw;}DWORD WINAPI myThreadProcB(LPVOID p){ DWORD dw = (DWORD)p; return dw*dw;}VOID CreateMyThreads(LPTHREAD_START_ROUTINE myProc[], int max_number,...
Answer 1 May 2013   license: CPOL
You may create an array holding the addresses of your thread procedures:LPTHREAD_START_ROUTINE pThreadProcs[] = { ThreadProc1, ThreadProc2 /*, ...*/};for (int i = 0; i
Answer 1 May 2013   license: CPOL
How about something along the lines of:typedef std::vector ThreadProcList;typedef std::vector ThreadIdList;ThreadProcList threadProcs;ThreadIdList threadIds;// add all the thread procs to threadProcs://...
Question 1 May 2013   license: CPOL
I have successfully created a single thread using CreateThread().Now I want to create 'n' number of threads but each with a different ThreadProc().I have tried the following code but using it, 'n' number of threads are created all performing the same task (since Threadproc() function af...
Question 1 May 2013   license: CPOL
Hello .. I used the sources codes of genetic algoritms from the following link:Genetic Algorithm Library[^] I want to use it as localy or globaly in my APP ..so I need for (.lib ) File I started making the static library and add all headers and sources files .. What should I...
Answer 30 Apr 2013   license: CPOL
It depends on how much clients do you expect and how large messages will be sent.The issue is that UDP does not guarantee delivery of data by itself, so some packets could be dropped.http://technet.microsoft.com/en-us/library/cc785220(v=ws.10).aspx[^]Simultaneous data sending both by...
Question 30 Apr 2013   license: CPOL
I have developed a udp application in which a single server is able to handle 'x' number of clients. Inside my server, there is a primary thread keeps on receiving requests/data continuously from the clients and keeps saving the information of each client in a list.As soon as a request comes...
Article 27 Apr 2013   license: CPOL
Perform web scraping of web site using Testing tools like Watin
Article 26 Apr 2013   license: CPOL
This article describes using web modelpop extender as Windows model popup dialogbox.

Page 1 of 22
1 2 3 4 5 6 7 8 9 10


Advertise | Privacy | Mobile
Web02 | 2.6.130513.1 | Last Updated 14 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid