types

Prevent system tray icon from stealing focus when clicked

I am writing an application in Java that places an icon in the system tray (via SWT). When this icon is clicked, I wish to have it automatically type some keys (via the Robot class) into whatever text field is in focus at the time of clicking (could be in any window). Unfortunately, clicking the system tray icon steals the focus away fro...

C# generic list <T> how to get the type of T?

Hello, I’m working on a reflection project, and now I’m stuck. If I have an object of “myclass” that can hold a List does anyone know how to get the type as in the code below if the property myclass.SomList is empty? List<myclass> myList = dataGenerator.getMyClasses(); lbxObjects.ItemsSource = myList; lbxObjects.SelectionChanged +=...

Working with an unknown number of unknown types - .NET

hey guys, I've removed some of the complexities of my needs to the core of what I need to know. I want to send a collection of Values to a method, and inside that method I want to test the Value against, say, a property of an Entity. The property will always be of the same Type as the Value. I also want to test if the value is null, or...

C#: Overriding return types

Is there way to override return types in C#? If so how, and if not why and what is a recommended way of doing it? My case is that I have an interface with an abstract base class and descendants of that. I would like to do this (ok not really, but as an example!) : public interface Animal { Poo Excrement { get; } } public class Anim...

Type Declarations in Fortran

I suppose the type of Y below is REAL. SUBROUTINE F(X, Y) C IMPLICIT NONE REAL :: X, Y C REAL :: A, B C REAL, PARAMETER :: C = 3.14E0 C X = Y + 2 * SIN(Y) END But what is it's type here? SUBROUTINE F(X, Y) C IMPLICIT NONE REAL X, Y C REAL :: A, B C REA...

Implicit Type Conversion for PHP Classes?

Is there a way to tell the php complier that I want a specific implicit conversion from one type to another? A simple example: class Integer { public $val; } function ExampleFunc(Interger $i){...} ExamFunc(333); // 333 -> Integer object with $val == 333. [edit]... someone asked for an example. Here's an example from c#. This is a...

Is string a value type or a reference type?

I just can't find a "good" explanation for this... ...

Can you pass a "type" as an argument?

I want to do something like the following in VB.NET, is it possible? Function task(value as Object, toType as Type) Return DirectCast(value, toType) End Function ...

Should I use double or float ?

What are the advantages and disadvantages of using one instead of the other in C++? ...

Type order with overloaded methods in Java

Hi Given two methods on the same class in Java : public void doSomething( Person person ); public void doSomething( Employee employee ); where Employee extends Person If I call : doSomething( employee ) I find that doSomething( Person ) get's invoked. I'd have expected the overload with the closest matching contract be invoked...

rails: emulate "Save page as" behaviour

Hey guys, for a rails project I need to provide the user with a downloadable HTML version of a statistics page. I got so far as creating a controller action that will set the header as follows and then render and return my vanilla html page: headers["Content-Type"] ||= 'application/x-unknown' headers["Content-Disposition"] = "attachmen...

How to make UI Image Picker Controller read a custom source type in iPhone

I have to create a photo gallery app in iPhone. It should function same as the Photos app which is shipped with iPhone. But it should show the images which I package with the app. UIImagePickerController reads only the following source types. UIImagePickerControllerSourceTypePhotoLibrary, UIImagePickerControllerSourceTypeCamera, ...

Typecasting a custom column in rails ActiveRecord?

Let's say we do: default_scope :select => '*, 1+1 AS woah' in a model, we can then access woah as a method on the model, but it's a string. How do we typecast this so that it's an integer? In my real-world example I'm actually selecting an id from a joined table but it's being typed as a string. I need it to be a ruby integer. ...

How do you use the IS operator with a Type on the left side?

I have a method I'm writing that uses reflection to list a class's static properties, but I'm only interested in those that are of a particular type (in my case, the property must be of a type derived from DataTable). What I would like is something like the if() statement in the following (which presently always returns true): PropertyI...

Ms Access Type Mismatch Error 13

Hi, I'm trying to open a Report which has several sub reports in it. In some of the reports the values are null. I always get the error messgae. Also, there will always be some reports will null values. ...

C# string reference type?

I know that "string" in C# is a reference type. This is on MSDN. However, this code doesn't work as it should then: class Test { public static void Main() { string test = "before passing"; Console.WriteLine(test); TestI(test); Console.WriteLine(test); } public static void TestI(string t...

RSA pubkey file type detection

Hi all! I got a RSA pubkey.dat (almost obvious what it is) that has the following structure on contents: ASN1 Integer of around 1024 bits (Modulus) ASN1 Integer (Exponent) Blob of 256 bytes (Signature) No tags like "----begin---" or so. pure hex values in it. There's any way to identify its format like if it's DER/PEM/etc , so i ca...

Java Type Erasure Problem

Hello. I've made an example to demonstrate my problem: Metrical.java public interface Metrical<T> { double distance(T other); } Widget.java public class Widget implements Metrical<Widget> { private final double value; public Widget(double value) { this.value = value; } public double getValue() { return value; } ...

UIkeyboard type

I want to use only alphabetic keyboard, how to restrict it? I've used following statement but it doesn't hide the button that converts keyboard in numeric one tempTextField.keyboardType = UIKeyboardTypeAlphabet; ...

Is it possible to create a type method in Delphi?

Hello, It's possible to create a type idenitifier for example: type PByte = ^Byte; Is it possible to do the following: function a:shortint; begin Exit(8); end; type b = a; so you can call "b" and "a". Is it possible? I'm asking,because I'd like to replace "Exit" with "return" so I can call this: return(5);// for example ...