I'm trying to avoid using a long else if statement.
Lets say I have an object and I want to test if it's of type ClassA, ClassB, ClassC, etc..?
What is a clean way of doing this?
Hi,
First, when you want to free the memory assigned to an object in C++, which one is preferred? Explicitly calling deconstructor or using delete?
Object* object = new Object(...);
...
delete object;
OR
object->~Object();
Second, does the delete operator call the deconstructor implicitly?
Thanks,
I'm trying to implement a Chord distributed hash table. I want to use SHA-1 as the hash function to generate node ids and map values to the DHT. However, I'll need to use numerical operations on the SHA-1 generated key, such as a modulo, for example. I wonder in which type of variable should I put the array of bytes I get, and how can I convert from one to another.
Hello,
I'd like to create this object...
object = {
'object[1][var_name_1]' : 'value1',
'object[1][var_name_2]' : 'value2',
};
I'm trying to it this way, but I'm getting error missing : after property id...
function getPrefix() {
return 'object[1]';
}
object = {
getPrefix() + '[var_name_1]' : 'value1',
getPrefix() + '[var_name_2]' : 'value2',
}
What am I doing wrong? Or maybbe it is impossible to set object property name using js experession?
Thank you
Is it posible to dump/save an in memory object so that the dump contains both the state and methods and then transfer it across the wire. I'm primarily using C# but if this can be done in some other technology, that should be good .
I have a menu click event that looks something like this....
Public Sub ToolbarManager_ToolClick(sender as Object, e as EventArgs)
Case "New"
CreateNewFile()
Case "Save"
SaveCurrentFile()
Case "Exit"
ExitApp()
Case.......
etc...
etc...
End Sub
This strikes me as being 'ugly' - but I'm unsure of the 'best' way or the most appropriate way to clean it up.
I am curious about the IDs that are used to identify items in winqual.
I assume it is some sort of hash. Is this published?
Hash of the module name, its version and an offset?
That seems appropriate but the size is too small to cover the possibilities unless some truncation/lossy algorithm is used.
This seems to be generated with the minidump on the client machine.
I finally found the object model documentation for Microsoft Office.
However it talks about interop assemblies and stuff that sounds like .NET. I don't use .NET directly, and I don't really want to learn much about it. Is there a way to just use plain COM/ActiveX classes/interfaces to automate MS Word/Excel?
Is there any way to create a hash of string at compile time using the C/C++ preprocessor (or even template-metaprogramming)?
e.g. UNIQUE_SALT("HelloWord", 3DES);
The idea is that HelloWorld will not be present in the compiled binary, just a hash.
How can I loop through all members in a JavaScript object including values that are objects.
For example, how could I loop through this (accessing the "your_name" and "your_message" for each)?
var validation_messages = {
"key_1": {
"your_name": "jimmy",
"your_msg": "hello world"
},
"key_2": {
"your_name": "billy",
"your_msg": "foo equals bar"
}
}
Say I got:
class X_
{
public:
void do() { }
}
class Y_ : public X_
{
}
And I have this function:
void foo(X_ whatever)
{
whatever.do();
}
Can I send a "Y_" object to the foo function, would this work?
I just realized that I could have tested this myself :)
Hello,
I am developing a web application, where i want to give freedom of changing style elements of css linked to a page via an admin screen. So I am wondering is there any way I can load CSS file into a C# object or into XML passable formate and update it from the admin screen inputs?
Thank you,
Krishnaraj
I wrote the following:
Object.prototype.length = function(){
var count = -1;
for(var i in this) count++;
return count;
}
It works. But when I execute my page, even without using this function, Firebug tells me that jQuery's .appendTo() is no longer a function. Why would this be?
Let say we have a class and a memberfunc.
An object is created for this class, say ObjA.
ObjA calls memberfunc.
Can we get this name 'objA' inside memberfunc programatically?
I'd like to initialize an object in javascript calling directly a method that belongs to it:
var obj = (function(){
return{
init: function(){
console.log("initialized!");
},
uninit: function(x){
console.log("uninitialized!");
}
};
}).init();
//later
obj.uninit();
obj.init();
This specific example doesn't work, is there something similar?
I'm trying to Display individual elements of an Object I have created.
It is a simple Java program that allows users to add and keep track of Player Details.
I'm just stumped when it comes to displaying the details after they have been added already. here is what my code looks like
I can create the object and input it into the arraylist no problem using the case 2, but when I try to print it out I want to do something like
System.out.println("Player Name" + myPlayersArrayList.PlayerName + "Player Position" + myPlayerArrayList.PlayerPosition + "Player Age" + "Player Age");
I know that is not correct, but I dont really know what to do, if anyone can be of any help it would be greatly appreciated. Thanks
System.out.println("Welcome to the Football Player database");
System.out.print(System.getProperty("line.separator"));
UserInput myFirstUserInput = new UserInput();
int selection;
ArrayList<Player> myPlayersArrayList = new ArrayList<Player>();
while (true) {
System.out.println("1. View The Players");
System.out.println("2. Add A Player");
System.out.println("3. Edit A Player");
System.out.println("4. Delete A Player");
System.out.println("5. Exit ") ;
System.out.print(System.getProperty("line.separator"));
selection = myFirstUserInput.getInt("Please select an option");
System.out.print(System.getProperty("line.separator"));
switch(selection){
case 1:
if (myPlayersArrayList.isEmpty())
{
System.out.println("No Players Have Been Entered Yet");
System.out.print(System.getProperty("line.separator"));
break;}
else
{for(int i = 0; i < myPlayersArrayList.size(); i++){
System.out.println(myPlayersArrayList);
}
break;
case 2: {
String playerName,playerPos;
int playerAge;
playerName = (myFirstUserInput.getString("Enter Player name"));
playerPos = (myFirstUserInput.getString("Enter Player Position"));
playerAge = (myFirstUserInput.getInt("Enter Player Age"));
myPlayersArrayList.add(new Player(playerName, playerPos, playerAge)); ;
break;
}
I want to improve my JavaScript so I thought it'd be a good idea to get a book on Object Oriented JavaScript. But I also use a lot of jQuery so I'm looking for a book that approached OO JavaScript from a jQuery point of view
What I need is to hash a string. It doesn't really have to be secure because its just going to be a hidden pharse in the text file (simply it doesn't have to be recognizable for a human-eye).
It should not be just a random string because when user will be typing the string I would like to hash it and compare it with already hashed one (in the text file).
What would be the best for this purpose? Can it be done with the own class?
I need to convert XML data to Java objects. What would be best practice to convert this XML data to object?
Idea is to fetch data via a web service (it doesn't use WSDL, just HTTP GET queries, so I cannot use any framework) and answers are in XML. What would be best practice to handle this situation?
I just spent some time reading http://stackoverflow.com/questions/2768248/is-md5-really-that-bad (I highly recommend!).
In it, it talks about hash collisions. Maybe I'm missing something here, but can't you just encrypt your password using, say, MD5 and then, say, SHA-1 (or any other, doesn't matter.) Wouldn't this increase the processing power required to brute-force the hash and reduce the possibility of collision?
I need to convert XML data to Java objects. What would be best practise to convert this XML data to object?
Idea is to fetch data via webservice (it doesn't use WSDL, just HTTP GET queris, so I cannot use any framework) and answers are in XML. What would be best practise to handle this situation?
My multithreaded Java program crashes because it runs out of heap space and I don't think it should. Assuming the culprit is unintentional object retention, what's a good free tool to investigate what objects are being unintentionally retained?
My IDE is Eclipse.
I remember reading somewhere that the original concepts behind OO were to find a better architecture for handling the messaging of data between multiple systems in a way that protected the state of that data. Now that is probably a poor paraphrase, but it made me wonder if there is a way of teaching OO without the (Bike, Car, Person, etc.) object analogies, and that instead focuses on the messaging aspects. If you have articles, links, books, etc., that would be helpful.