Hi i have a hashtable named table. The type value is long. I am getting values using .values()
Now i want to access these values.
Collection val = table.values();
Iterator itr = val.iterator();
long a = (long)itr.next();
But when i try to get it it gives me error. Because i cant convert from type object to long.
How can i go aro...
I vave 2 class:
public class ClassA
public class ClassB (from another namespace) : ClassA
I use methdo at ClassA
public static ClassA Deserialize(string path)
{
ClassA classA;
//classA=code...
return classA;
}
I invoke this method at classB
public void DoSomething()
{
ClassB classB=(ClassB)ClassA.Deserialize("c:\directory\file.x...
int a = -534;
unsigned int b = (unsigned int)a;
printf("%d, %d", a, b);
prints -534, -534
Why is the typecast not taking place?
I expected it to be -534, 534
If I modify the code to
int a = -534;
unsigned int b = (unsigned int)a;
if(a < b)
printf("%d, %d", a, b);
its not printing anything... after all a is less than b??
...
I'm trying to obfuscate some VB.NET 2003 app.
The resulting assemblyes are obfuscated and "run" with some errors.
I cleaned all potential reflection problems, but I'm not being able to read the selected value of a combobox.
I load the Combobox using their Datasource properties, using a collection of "VTPair" (a class created by me wit...
Just because I've never read binary files before I wrote a program that reads binary STL files. I use ifstreams read member that takes a char* a parameter. To cast my struct to a char* I use a reinterpret_cast. But as far as I remember every book about C++ I read said something like "don't use reinterpret_cast except you have to". What w...
Why does this:
(new[]{1,2,3}).Cast<decimal>();
result in an
InvalidCastException: Specified cast is not valid.
...
I am developing smart device application in C#. In that I am calling the web services. The web service method return google map. The return type of the method is object []. The object [] contains the image in byte format. The soap response for google map image is xsi:type="xs:base64Binary". In object I am not getting the string. In objec...
Consider these 2 pieces of code (you can assume execeptionObj is of type Object, but we know it's an instance of Throwable):
1)
logger.log(Level.ERROR, (Throwable) exceptionObj,
((Throwable) exceptionObj).getMessage());
2)
Throwable t = new Throwable((Throwable)exceptionObj);
logger.log(Level.ERROR, t, t.getMessage());
During ...
AFAIK, for pointers/references static_cast if class definition is not visiable to compiler at this point, than static_cast will be behave like reinterpret_cast.
Why static_cast is unsafe for pointers/references and is safe for numeric values?
...
This doesn't seem to work (compiler complains that Something's getFoo() method doesn't implement HasFoo) and I can't figure out why or how to fix it....
enum FooKey { BLOB1, DONUT, ... }
interface HasFoo
{
public Object getFoo(FooKey k);
}
class Something implements HasFoo
{
private Map<FooKey, Object> map;
@SuppressWarni...
Hi!
I'm implementing an event system for a game. It uses an event queue, and a data structure to hold all registered event handlers for a given event type. It works fine so far registering handlers, but when it comes to unregistering them (something that will take place when a game object is destroyed, for instance) I'm having a bit of ...
During the modification of an existing ATL COM object I came across an article from the "The Old New Thing" blog called "The ways people mess up IUnknown::QueryInterface" and there was a discussion in the comments section that started when one of the respondents (Norman Diamond) pointed out that that in one of the article's examples that...
I am using ASP.NET MVC2 and Entity Framework. I am going to simplify the situation a little; hopefully it will make it clearer, not more confusing!
I have a controller action to create address, and the country is a lookup table (in other words, there is a one-to-many relationship between Country and Address classes). Let's say for clari...
Total noob to anything lower-level than Java, diving into iPhone audio, and realing from all of the casting/pointers/raw memory access.
I'm working with some example code wich reads a WAV file from disc and returns stereo samples as single UInt32 values. If I understand correctly, this is just a convenient way to return the 32 bits of m...
Hello
I have a SubMenu in a ContextMenu which ItemSource is set to a expression like
ContextMenu.Items[i].ItemsSource = DatabaseInstance.GetAllObjects()
When i handle the clicks from the ContextMenu i have this event handler:
XALM:
<ContextMenu MenuItem.Click="ContextMenu_Click">
C#:
if (e.OriginalSource as MyObject == nu...
I'm trying to get a list of usernames and bind them to a DropDownList and I must be missing a trick because I can't seem to cast it to the correct type. The code is below and the title is the error message I'm recieving.
EDIT - QUser inherits from MembershipUser
UserRepository userRepository = new UserRepository();
// retrieve custom u...
Hi folks,
I'm learning Java here, and using a "GLabel" object. It's in the ACM Graphics library, and you can read about it here:
http://jtf.acm.org/javadoc/student/acm/graphics/GLabel.html
In short, the GLabel prints a string. The thing is I have an int that I want to print there. How would I achieve this?
This is the loop I have, ...
Hi all,
I have
class A
{}
class B : A
{}
I also have a method that expects a List parameter
void AMethod(List<A> parameter)
{}
Why can't I
List<B> bs = new List<B>();
AMethod(bs);
And secondly what is the most elegant way to make this work?
regards
...
I am developing a Web application in Java. In that application, I have created webservices in Java. In that webservice, I have created one webmethod which returns the image list in base64 format. The return type of the method is Vector. In webservice tester I can see the SOAP response as xsi:type="xs:base64Binary". Then I called this web...
The following code does not give a warning with g++ 4.1.1 and -Wall.
int octalStrToInt(const std::string& s)
{
return strtol(s.c_str(), 0, 8);
}
I was expecting a warning because strtol returns a long int but my function is only returning a plain int. Might other compilers emit a warning here? Should I cast the return value ...