I'm using StyledText widget in my SWT app. SWT by default appends "Input method" submenu to the end of existing context menu. Is there any way to remove it?
How do I spell a method whose argument can either be an object of a certain type, or nil? You see those all the time in framework classes, but I've just encountered my first instance where it would be useful to create one.
I seem to recall that Loader.unload() could once be used to stop loading a swf before it had finished loading. I can no longer find documentation or the blog where I read this. Perhaps it was an unofficial feature. Anyhow, IModuleInfo, returned by ModuleManager.getModule() has an unload() method. If I want to halt loading a Flex Module that is in progress, do I just call iModuleInfo_instance.unload()?
The title is pretty descriptive... Is there any extension that let me see FULL documentation of the method I'm typing ? I would like to see the documentation as I can see it in Object Browser with description of parameters and everything not just some "summary". So what I'd like to see when I type String.Format is:
Of cause with an option to see all overrides. It may be part of intelisence or I don't know what it does not really matter.
Often, in C# documentation, you come across a member where the description says something along the lines of "be sure to call the base method if you override this."
Is there a way to ensure at compile time that one has actually called the base function?
I am having problems with centering the map using the panTo() method - as well as making the directions (from/to) to work like tabs.
Here is my code:
http://dpaste.com/76251/
Why can we have static final members but cant have static method in an inner class ?
Can we access static final member variables of inner class outside the outer class without instantiating inner class ?
Consider an object declared in a method:
public void foo() {
Object obj = new Object();
// A long run job that consumes tons of memory and
// triggers garbage collection
}
Is obj subject to garbage collection?
Would be thread-safe to use the yield operator inside an extension method?
For example:
public static CartItem GetItems( this Cart cart )
{
{
while( cart.hasNext() )
yield return cart.GetNextItem( );
}
}
I have a convert method, which takes a String and a class as arguments and constructs an object of the given class, which will be returned.
The usage should look like this
Something s = Converter.convert("...", Something.class)
Is it possible to express this with Java generics?
Something like:
public static <T> T convert(String source, ??? TClass)
What would be ????
Given any object in Ruby (on Rails), how can I write a method so that it will display that object's instance variable names and its values, like this:
@x: 1
@y: 2
@link_to_point: #<Point:0x10031b298 @y=20, @x=38>
I also want to be able to print <br> to the end of each instance variable's value so as to print them out nicely on a webpage.
the difficulty now seems to be that not every instance variable has an accessor, so it can't be called with obj.send(var_name)
(the var_name has the "@" removed, so "@x" becomes "x")
Maybe the title might be better, if someone knows a better one, please edit.
I've seen in many Java code notation that after a method we call another, here is an example.
Toast.makeText(text).setGravity(Gravity.TOP, 0, 0).setView(layout).show();
As you see after calling makeText on the return we call setGravity and so far.
How can I do this with my own classes? Do I have to do anything special?
I am new to photo apps, recently I am interested in making a sticker app like those can be seen in the appstore, I know I would need to use uiimagepickercontroller, uiscrollview and uigesturerecognizer.
However I wonder which code method should I use for the app to load multiple stickers? Should it be called programmatically? Is that I would need to use the if-statement, say if one sticker is loaded, the app will auto generate a new sticker on top of it?
Does the method get called with a null value or does it give a null reference exception?
MyObject myObject = null;
myObject.MyExtensionMethod(); // <-- is this a null reference exception?
If this is the case I will never need to check my 'this' parameter for null?
Say I have a struct:
struct MyStruct
{
public int X
public int Y
}
And a method in some class that is iterated over many times elsewhere:
public bool MyMethod( MyStruct myStruct )
{
return ...
}
Is changing the MyMethod signature to the following an acceptable optimization?
public bool MyMethod( ref MyStruct myStruct )
If so, how much of an advantage would it really be? If not, about how many fields would a struct need for a big enough advantage using ref this way?
I'm calling the twitter4j library using Clojure like so:
(def twitter (. (TwitterFactory.) getInstance))
This works fine when I call it as a script. But when I use gen-class, I get:
java.lang.IllegalArgumentException: Can't call public method of non-public class: public java.lang.Object twitter4j.TwitterFactoryBase.getInstance()
Is there a workaround for this?
I want to trigger a special action in the save() method of a Django model object when I'm saving a new record (not updating an existing record.)
Is the check for (self.id != None) necessary and sufficient to guarantee the self record is new and not being updated? Any special cases this might overlook?
I have a class (Class B) that inherits another class (Class A) that contains virtual methods.
Mistakenly, I omitted the override keyword when declaring a (supposed to be) overriding method in Class B.
Class A
public class ClassA{
public virtual void TestMethod(){
}
}
Class B
public class ClassB : ClassA{
public void TestMethod(){
}
}
The code compiled without a problem. Can anyone explain why?
I am using Eclipse v3.5.
In previous Eclipse versions i remember if i have defined a method with a parameter and didn't use it internally a warning appears, like this :
public void myMethod( int x ) {
// Didn't use x here so a warning appears at the x parameter.
}
But in v3.5 i do not see this warning. How can i enable it in Eclipse ?