C# :: DB Calls Via Tasks?

Jan 6, 2015

I have a multi-thred piece of code that should be fast. As I have to update a Database from time to time, I wonder if I do it in a prpoer manner with calls like this:

Task.Factory.StartNew(()=>update_execution_to_db(exec));

Those are my sporadic updates, my ongoing update have a queue and a dispatcher thread reading from the Q, I just don't want to use this overhead for the sporadic updates.

View 6 Replies


ADVERTISEMENT

C :: Routines Library For Numerical Tasks

Jan 13, 2014

I am looking for C-libraries that would do numerical tasks with special emphasis on numerical differentiation of arbitrary order, numerical integration (Monte Carlo etc.) and interpolation. I would be grateful if you can provide me with some resources. By the way I already have Numerical Recipes but would like to have another resource at hand.

View 11 Replies View Related

C/C++ :: Implement Two Tasks Synchronized On External Event Using Mailboxes

Jan 21, 2014

I have to make a C++ program that implements two tasks synchronized on a external event using mailboxes. The first task, T1, reads integer from keyboard, and record them to a vector. The second task, T2, transforms the integer numbers in binary and shows them. External events that are synchronized tasks is typing an integer.

This is what i made so far.

#include <iostream.h>
#include <conio.h>
int v[50], n, i;long sum;
void citire(){cout<<"dati numarul de elemente al vectorului:";cin>>n;
for(i=1;i<=n;i++){cout<<"introduceti elementele vectorului: ";

[Code] ....

I don't know how to use tasks, and the program doesn't convert from int to bin..

View 14 Replies View Related

C++ :: Use Circular Linked List And Data Structures To Store Tasks

Mar 30, 2014

The program use a circular linked list and data structures to store the tasks.

- Every task should include a task name, a name for the person assigned to it, and the deadline for the task.
- Variables should be dynamic and their sizes should be determined at runtime based on the length of user input.
- You should implement the following functions (with appropriate arguments and return types) for your structure: add(), remove(), search(), and list().
- The add()function should add tasks alphabetically by task name. You do not need to implement any file operations.
- The search() function should be able search for a task by the task assignee name or the task name.
- The list() function should print records to the screen in the order they appear in the circular linked list.
- You should successfully deallocate all of the allocated memory before termination of your program.

View 4 Replies View Related

C++ :: Calls From Ancestor

Mar 7, 2012

Code:
class A {
virtual method1() { };
};
class B : public A {
method1() { }
}

Code:
A* a = new A();
a->method1(); // call B's method1?

Is it possible to call B's method1 in this case?

View 8 Replies View Related

C :: Way Recursive Calls Actually Works

Apr 27, 2013

This is simple recursive solution of Fibonacci number:

Code:

int fibo(int n)
{
if(n<=1)
return 1;
else
return fibo(n-1)+fibo(n-2);
}

Now the recursion will generate a large recursion tree, like if n=5, 5 will call (5-1), (5-2) or 4,3 . What I want to know is, will fibo(n-1) will be called 1st go all the way to the base case 1, then do the summation or fibo(n-2) will be called right after fibo(n-1) ?

View 6 Replies View Related

C++ :: Cancel Destructor Calls In Operator

Apr 18, 2014

Let's start with something from the c++ reference:

... delete[] is an operator with a very specific behavior: An expression with the delete[] operator, first calls the appropriate destructors for each element in the array (if these are of a class type) ...

I was wondering if I can tell delete[] to not call destructors, for example if I already know that the delete[] statement should be delete without []. That would be very useful for memory management/memory leak detection.

View 12 Replies View Related

C/C++ :: Multiple Malloc Calls On One Variable?

Feb 13, 2013

I'd like to know what happens if I use multiple calls to malloc() on one pointer (without free) in a single function. Here is the example:

void *data_thread(void *sockfd_ptr) {
  int sockfd = *(int *) sockfd_ptr;
  const int BUFSIZE = 5;
  char recvmessage[BUFSIZE];
  char *headerstr = NULL;
  char *newheaderstr = NULL;

[code]....

what happens with newheaderstr every time malloc() is called. There isn't a realloc() or anything. I didn't think it looked right to keep using malloc() like that.

View 4 Replies View Related

C++ :: Lines Without Semicolon - Function Calls?

Aug 28, 2013

The below code is taken from open source filezilla project

(FileZilla_3.7.3_srcfilezilla-3.7.3srcinterfacebookmarks_dialog.cpp)

Code:
#include <filezilla.h>
#include "bookmarks_dialog.h"
#include "sitemanager.h"
#include "ipcmutex.h"
#include "themeprovider.h"
#include "xmlfunctions.h"
BEGIN_EVENT_TABLE(CNewBookmarkDialog, wxDialogEx)
EVT_BUTTON(XRCID("wxID_OK"), CNewBookmarkDialog::OnOK)
EVT_BUTTON(XRCID("ID_BROWSE"), CNewBookmarkDialog::OnBrowse)
END_EVENT_TABLE()

I'm unable to understand what are these lines after the #include. They don't end in semicolons. Looks very much like function calls.

Are BEGIN_EVENT_TABLE, EVT_BUTTON and END_EVENT_TABLE function calls? Function calls should end with semicolons right?

View 5 Replies View Related

C++ :: Server Application - How To Delete Calls To New

Mar 29, 2012

I created a server application but i need to know how to delete my calls to new

Code:
CBaseServer::CBaseServer() {
}
CBaseServer::~CBaseServer() {
}
void CBaseServer::Start() {
struct sockaddr_in ain;

[Code] .....

Also when I call this..

Code:
new CThreadManager();

It gives me this warning...

warning C4345: behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized

View 10 Replies View Related

C++ :: Repeated Handling With Different Methods Calls But Same Parameters

Apr 24, 2014

I have several functions doing similar things, inside their implementations, the parameters are the same, but they call different methods.

I want to create one function to make the structure easier, and reduce the duplication. I heard template might be one solution. But I am not sure how to use it in this case.

void GetA(...XXX) {
for()
{

[Code].....

View 1 Replies View Related

C# :: How To Store Multiple Function Calls In Array

Oct 9, 2014

My function "MatrixMul" returns an int array with multiple values Let's say, res[0] and res[1]

When I'm calling the array in a for loop for multiple times, and when I'm storing the results in another array, in each iteration the results are over-written with the new results.

If the first call returns [0,1] the array will store [0,1] at index [0] and [1], which is fine, but when I'm calling the function again, the new results are stored at the same indexes [0] and [1] How can I avoid that?

The code is:

class Hill_Cipher
{
string AtoZ="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
public string Hill_Cipher_Enc(string input, int[,] key)

[Code].....

For example, my outPut contains the following: "TH","IS","AT" when I'm calling the function with the first element of array "TH", it converts "T" to its equivalent number and apply some calculations and same with "H". Let's say the final answer is 20 for "T" and 30 for "H". The problem is that every time, encChars will store the values at index 0 and 1: encChars[0]=20 encChars[1]=30 When I call the function again it will store the new values at 0 and 1.... That's because I'm not changing the index value for encChars on each call, so how do I do that?

View 1 Replies View Related

C :: Multiple Scanf Calls Skip Printf Lying Between Them

Mar 31, 2014

Code:

scanf("%d", &a);
printf("A");
scanf("%d", &b);

prints "A" after calling scanf two times instead of between the calls (first scan, then print, then scan). I'm using GCC v4.6

View 7 Replies View Related

C/C++ :: Code That Recursively Calls Itself And Prints Given Digits In Ascending Order

Mar 15, 2015

I'm trying to implement a code that recursively calls itself and prints the given digits in ascending order, i.e. if the number is 5, then the function will print 1 2 3 4 5. I cannot use loops in any way!

The problem I have is with keeping my variable i at a set value each time the function calls itself.

void print_ascending(int n){
int i = 1;
if(i < n) {
printf("%d", i);
i++;
print_ascending(n);
}
}

Of course, the problem with this code is it will re-initialize the variable i to 1 every single time and infinitely loop to print 1.

View 11 Replies View Related

Visual C++ :: Disable CCheckListBox Items Without Access To Code That Calls AddString

Apr 19, 2013

I need to be able to disable the items on a CCheckListBox but I can't change the code that calls AddString. I know I can use the CCheckListBox::Enable function to disable an item if I have an index but I don't have the index which would be provided by AddString.

I've tried intercepting the LB_ADDSTRING message and then looping through the items in the control but the string has not been added at this point so the last item in the list is never disabled.

I used Spy++ to see what messages were being sent and I noticed that LB_GETTEXT was sent so I tried intercepting this message (ugly hack) but this caused my app to hang - I assume because of the number of times the message is sent. Is there a way to disable the items?

View 10 Replies View Related

C++ :: Menu Program Broken Down Into Series Of Calls To Function For Each Of Menu Items

Aug 19, 2013

I am trying to write a menu program that will be broken down into a series of calls to function for each of the menu items. Two of the menu items will be simple programs which I wrote.

I want two of the functions to run one of the two programs I am trying to include as items in the menu.

So far I am only familiar with variables, loops, if statements, and I just learned how to write functions.

The problem I am have is that I don't quite understand how to write a function that will run one of the two programs. Also I am having a hard time writing the program in away that would allow the user to select the menu items.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved