Can anyone tell me if there are any performance overheads to using the dataset designer as opposed to setting up the data connection using code and manually retrieving the data?
I am using gcc. Please tell me if I am wrong -
Lets say I have two classes A & B
class A
{
public:
A(){cout<<"A constructor"<<endl;}
~A(){cout<<"A destructor"<<endl;}
};
class B:public A
{
public:
B(){cout<<"B constructor"<<endl;}
~B(){cout<<"B destructor"<<endl;}
};
1) The first line in B's constructor should be a call to A's constructor ( I assume compiler automatically inserts it). Also the last line in B's destructor will be a call to A's destructor (compiler does it again). Why was it built this way?
2) When I say A * a = new B(); compiler creates a new B object and checks to see if A is a base class of B and if it is it allows 'a' to point to the newly created object. I guess that is why we don't need any virtual constructors. ( with help from @Tyler McHenry , @Konrad Rudolph)
3) When I write delete a compiler sees that a is an object of type A so it calls A's destructor leading to a problem which is solved by making A's destructor virtual. As user - Little Bobby Tables pointed out to me all destructors have the same name destroy() in memory so we can implement virtual destructors and now the call is made to B's destructor and all is well in C++ land.
Please comment.
Hi,
I wonder if there is something wrong with the copy constructor function below?
class A
{
private:
int m;
public:
A(A a){m=a.m}
}
Thanks and regards!
Is it possible to change the value stored inside bar after it has been added?
I have tried 'boxing' the string foo but it doesnt work.
string foo = "aaaaaaa";
var bar = new System.Web.UI.HtmlControls.HtmlGenericControl("div") { InnerHtml =foo };
foo = "zzzzzz";
plcBody.Controls.Add(bar);//want this to contain 'zzzzzz'
I have an approach in mind for an image viewer in a web app, and want to get a sanity check and any thoughts you stackoverflowers might have.
Here's the whirlwind nutshell summary: I'm working on an ASP.NET MVC application that will run in my company's retail stores. Even though it is a web application, we own the store machines and have control over them. We have a "windows agent" running on the store machine which we can talk to from the browser via javascript (it is a WCF service, and our web app has permission to talk to it from the browser).
One of the web pages needs to be an "image viewer" page with some common things like Rotate & Zoom.
Now, there are some WebForms controls that offer Rotate and Zoom. However, they take up server resources and generate a good bit of traffic between the server and the browser. For example, the Rotate function would cause an ajax call to the server, which would then generate a new image written to a .NET Canvas object, which would then be written to a file on the server, which would then be returned from the ajax call and refreshed inside the browser.
Normally, that's a pretty good way of doing things. But in our case, we have code running on the store machine that we can communicate with. This leads me to consider the following approach:
When the user asks to view an image, we tell our "windows agent" to download it from our image server to the store machine.
We then redirect our browser to our image viewer page, which will pull the image from the local file we just wrote to the store machine.
When the user clicks "Rotate", we cause JavaScript code in the browser to call our "windows agent" software, asking it to perform the "Rotate" function.
The "windows agent" does the rotation using the same kind of imaging control that would formerly have been used on the server, but it does so now on the store machine.
Javascript in the browser then refreshes the image on the page to show the newly rotated image.
Zoom and similar features would be implemented the same way.
This seems to be much more efficient, scalable, and responsive for the end-users. However, I've never heard of anything like it being done, mostly because it's rare to have this combination of a web app plus a "windows agent" on the client machine.
What do you think? Feasible? Reasonable? Any pitfalls I overlooked or improvements / suggestions you can see? Has anyone done anything like this who would like to offer the wisdom of experience?
Thanks!
#include <boost/bind.hpp>
#include <iostream>
using namespace std;
using boost::bind;
class A {
public:
void print(string &s) {
cout << s.c_str() << endl;
}
};
typedef void (*callback)();
class B {
public:
void set_callback(callback cb) {
m_cb = cb;
}
void do_callback() {
m_cb();
}
private:
callback m_cb;
};
void main() {
A a;
B b;
string s("message");
b.set_callback(bind(A::print, &a, s));
b.do_callback();
}
So what I'm trying to do is to have the print method of A stream "message" to cout when b's callback is activated. I'm getting an unexpected number of arguments error from msvc10. I'm sure this is super noob basic and I'm sorry in advance.
I'm trying to connect to an oracle database with .net but i get the error:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
however, when I enter add a new database connection through toolsconnect to database. it works fine. even after copying the connection string which is:
Data Source=source here;Persist Security Info=True;User ID=userhere;Password=pass;Unicode=True
hi,
i am new to a php site, only familiar with .net web forms sites.
i can't figure out how routing is working on this php site.
www.oursite.com/suggestions.php is to suggestions.php
www.oursite.com/suggestions also loads the php fine
www.oursite.com/suggestions/ loads the php, but no css is applied
www.oursite.com/suggestions/anything - anything that comes after the '/' is ignored and suggestions is loaded without css. so oursite.com/suggestions////// works, as does oursite.com/suggestions/2/2/2/2/whatever
i have searched but not found any good explanation on how this is working. can someone explain or provide a good resource?
thank you.
Hi,
Can someone validate the following. I am supposed to
'write a formula asserting that for every number there's a unique next number...true for integers for instance'
L(x,y) means x is smaller than y
the intended Domain is the Integer numbers
Can I give
∀x ∀y [ x<y ⇒ ( ∃z : z<x ∨ y<z ) ]
Thanks
Hi,
As a summer learning experiment, I'm thinking of coding up a web front end for a trading game i wrote in python, that generates share prices and random snippets of text.
I am sort of struggling with how this should work on the back-end though. I'd rather have my GWT client page interact with the python share price generator, than to try and re-code it in java. I suppose i could use an sqlite db, and then use jdbc to pick up the prices, but i was wondering if there is a better way, for me to be able to poll some python script either from my client page, or from the serverside java code ?
I found this python wrapper, but i'm not sure how i could use it though:
http://code.google.com/apis/visualization/documentation/dev/gviz_api_lib.html
Thanks.
I have a security number generator device, small enough to go on a key-ring, which has a six digit LCD display and a button. After I have entered my account name and password on an online form, I press the button on the security device and enter the security code number which is displayed.
I get a different number every time I press the button and the number generator has a serial number on the back which I had to input during the account set-up procedure.
I would like to incorporate similar functionality in my website. As far as I understand, these are the main components:
Generate a unique N digit aplha-numeric sequence during registration and assign to user (permanently)
Allow user to generate an N (or M?) digit aplha-numeric sequence remotely
For now, I dont care about the hardware side, I am only interested in knowing how I may choose a suitable algorithm that will allow the user to generate an N (or M?) long aplha-numeric sequence - presumably, using his unique ID as a seed
Identify the user from the number generated in step 2 (which decryption method is the most robust to do this?)
I have the following questions:
Have I identified all the steps required in such an authentication system?, if not please point out what I have missed and why it is important
What are the most robust encryption/decryption algorithms I can use for steps 1 through 3 (preferably using 64bits)?
I am working on an example from a php book and am getting an error on line 8 with this code
<?php
$agent = getenv("HTTP_USER_AGENT");
if (preg_match("/MSIE/i", "$agent"));
{
$result = "You are using Microsoft Internet Explorer";
}
else if (preg_match("/Mozilla/i", "$agent"));
{
$result = "You are using Mozilla firefox";
}
else {$result = "you are using $agent"; }
echo $result;
?>
(Bubble Sort) In the bubble sort algorithm, smaller values gradually "bubble" their way upward to the top of the array like air bubbles rising in water, while the larger values sink to the bottom. The bubble sort makes several passes through the array. On each pass, successive pairs of elements are compared. If a pair is in increasing order (or the values are identical), we leave the values as they are. If a pair is in decreasing order, their values are swapped in the array. Write a program that sorts an array of 10 integers using bubble sort.
Hi All,
public static List<Order> LoadAll()
{
// Load all orders in the table. If too
// many records, consider exposing this
// operation as a plain ADO.NET function.
}
What would the "plain ADO.NET function" look like if there were too many records?
Thanks,
rod.
I need to search through a list of folders that could have more folders inside it,
and add a new folder depending what folder is its parent.(the path is stored as a String for eg = "root/MyCom/home/") Then i fill in a field with a new folder name and add it to the final folder(eg "home/").
Below as you can see , I can navigate to the right location and add the new folder to a current folder, My trouble is that i cannot ensure that currentFolder element is placed back in the list it came from
how could i add a folder to a list of folders, that could be within a list of folders,that could be within a list of folders and endless more?
YFUser user = (YFUser)getSession().getAttribute(SESSION_USER);
Folder newFolder = new Folder();
newFolder.setFolderName(foldername);
// this is the path string (root/MyCom/home/) split in the different folder names
String folderNames[] = folderLocationString.split("/");
int folderNamesLength = folderNames.length;
Folder root = user.getRoot();
Folder currentFolder = root;
for(int i=0;i<=folderNamesLength; i++){
// because root is folderNames[i]
String folderName = folderNames[i++];
int currentFolderSize = currentFolder.getChildren.getSize();
for(int o=1; o<= currentFolderSize ; o++){
if(currentFolder.getChildren().get(o) instanceof Folder){
if(folderName.equals(currentFolder.getChildren().get(o).getFolderName())){
currentFolder = currentFolder.getChildren().get(o);
if (i == counter){
//now i am inside the correct folder and i add it to the list of folders within it
//the trouble is knowing how to re add this changed folder back to the list before it
currentFolder.getChildren.add(newFolder);
}
}
}
}
}
Hi to all. In my app i record and play audio at the same time. The app is almost finished. But there is one thing, that annoying me. When audio session is set to PlayAndRecord, sounds become quiet in comparison with the same sounds with the SoloAmbient category. Is there any way to make sound louder using PlayAndRecord?
I'm trying to fill selects with json data from a web service. I'm getting error 'Object doesn't support this property or method.' when I do this $(this).html(options.join''));
Any ideas what I'm doing wrong?
;(function($) {
$.fillSelect = {};
$.fn.fillSelect = function(url, map) {
var jsonpUrl = url + "?callback=?";
$.getJSON(jsonpUrl,
function(d) {
var options = [];
var txt = map[0];
var val = map[1];
options.push('<option>--Select--</option>');
$.each(d, function(index, item) {
options.push('<option value="' + item[val] + '">' + item[txt] + '</option>');
});
$(this).html(options.join('')); //getting error Object doesn't support this property or method
}
};
})(jQuery);
I want to use Python's multiprocessing to do concurrent processing without using locks (locks to me are the opposite of multiprocessing) because I want to build up multiple reports from different resources at the exact same time during a web request (normally takes about 3 seconds but with multiprocessing I can do it in .5 seconds).
My problem is that, if I expose such a feature to the web and get 10 users pulling the same report at the same time, I suddenly have 60 interpreters open at the same time (which would crash the system). Is this just the common sense result of using multiprocessing, or is there a trick to get around this potential nightmare?
Thanks
Programming novice here. I'm trying to allow a user to enter their name, firstName middleName lastName on one line in the console (ex. "John Jane Doe"). I want to make the middleName optional. So if the user enters "John Doe" it only saves the first and last name strings. If the user enters "John Jane Doe" it will save all three.
I was going to use this:
cin >> firstName >> middleName >> lastName;
then I realized that if the user chooses to omit their middle name and enters "John Doe" the console will just wait for the user to enter a third string... I know I could accomplish this with one large string and breaking it up into two or three, but isn't there a simpler way to do it with three strings like above?
I feel like I'm missing something simple here...
Thanks in advance.
Hi all,
I have a view with a DropDownList component and a DataGroup component. The dropdownlist has to be updated from a remote php object and on change to call another remote object service in order to update the datagroup's provider.
So I am thinks to dispatch an event from my view and the in my EventMap to call the service and inject the result to the drop down. When the dropdown changes I'll dispatch another event and in the EventMap I'll call another service and I'll inject the result to the datagroup.
Is there another more sophisticated way?
Thanks in advance
I have a user control that is emmitting javascript using the ClientId function. For example:
Out &= "ValidatorHookupControlID(" & Quote & ddlMonth.ClientID & Quote & "), document.all(" & Quote & CustomValidator1.ClientID & Quote & "));" & vbCrLf
It appears to me that the ClientID function DOES not return the ultimate ID that is sent to the browser. Instead, the ClientID function only appears to be aware of its current parent control, which in this case is a the User Control and so the ID that is returned is the ID "dtmPassportExpirationDate_ddlMonth"
When in fact the usercontrol is included in a master page and the ultimate ID that is used is:
"ctl00_phPageContent_dtmPassportExpirationDate_ddlMonth"
I may be nuts, but that's what it appears to be doing. I expect that the ClientID function would return the ultimate ID used in the HTML.
Am I missing something?