For instance this code:
function stuff() {
this.onlyMethod = function () {
return something;
}
}
// some error is thrown
stuff().nonExistant();
Is there a way to do something like PHP's __call as a fallback from inside the object?
function stuff() {
this.onlyMethod = function () {
return something;
}
this.__call__ = function (name, params) {
alert(name + " can't be called.");
}
}
// would then raise the alert "nonExistant can't be called".
stuff().nonExistant();
I'm trying to make a class that extends qwidget, that pops up a new window, I must be missing something fundamental,
class NewQuery(QtGui.QWidget):
def __init__(self, parent):
QtGui.QMainWindow.__init__(self,parent)
self.setWindowTitle('Add New Query')
grid = QtGui.QGridLayout()
label = QtGui.QLabel('blah')
grid.addWidget(label,0,0)
self.setLayout(grid)
self.resize(300,200)
when a new instance of this is made in main window's class, and show() called, the content is overlaid on the main window, how can I make it display in a new window?
I have the following 2 macros:
#define SCOPED_ENUM_HEADER(NAME) struct NAME{ enum _NAME{
#define SCOPED_ENUM_FOOTER(NAME) };}; typedef NAME::_NAME NAMEtype;
Only the first instance of NAME get replaced by the passed NAME. What's wrong with it?
Is is to be used in such a way:
SCOPED_ENUM_HEADER(LOGLEVEL)
UNSET,
FILE,
SCREEN
SCOPED_ENUM_FOOTER(LOGLEVEL)
Thanks you
How to write a query that can find me all item_number start with a certain value ?
For instance there are item_numbers like these :
123_abc
123_xyz
ierireire
321_add
999_pop
My current query looks like this :
"select from "+PayPal_Message.class.getName()+" where item_number == '"+Item_Number+"' order by item_number desc"
What's a query look like that can return all item_numbers start with "123_" ?
According to the Release Notes:
All user request have an
X-AppEngine-Country header which
contains the ISO-3166-1 alpha-2
country code for the user, based on
the IP address of the client request.
My app is running on localhost with the 1.5.1 Java release which contains the X-AppEngine-Country header but I don't seem to be receiving any value for this header in my requests.
Do I have to deploy the app to a production instance to test this feature?
hi folks,
i got a webpage with some "cards" (divs) layin on it.
they are positioned in a star-like order, flowing to the background.
i want to bring cards from the background to the middle-foreground bei clicking on it (to focus the card "contact" for instance).
how can i realize this? is there any script which is already containing a function like this?
How can i write 'one bit' into a file stream or file structure each time? is it possible to write to a queue and then flush it ? is it possible with c# or java?
this was needed when i try to implement an instance of Huffman codding. i can't write bits into files. so write them to a bitset and then (when compression was completed) write 8-bit piece of it each time (exclude last one).
Hi,
given a plain text file, how can I do, using bash, awk, sed, etc, to, at the line number NLINE, add the string STR, just n spaces after the end of the line?
So, for instance, if this is the line NLINE:
date march 13th
for 5 spaces, we get
date march 13th STR
and one gets the modification in a new file.
Thanks
What does "object affine" mean? For instance, there are object affine thread pools. While I understand both thread pools and affine transformations in math, I can't think of an association between them.
I anticipate using some images in my Java application. These images will be drawn onto my JPanel using g.drawImage(). The JPanel is resizable and the images should scale as the JPanel increases/decreases in size
Two questions:
What image format is best for this type of desired scalable image? For instance, in this application, an image of size 100x100 may be scaled into an image of size 30x30 or 10x10 or 300x300.
How can I write code to do this scaling?
Hello,
I have an object of CalendarEntry
I know that http://www.google.com/calendar/feeds/[email protected]/allcalendars/full is the feed url of all calendars
but how I can get this feed url from CalendarEntry instance?
Because I wanna post a new entry in a specified calendar and I need this url.
Thanks!
What is the difference when a class extend from Handler and Thread?
As described in developer.android.com
...
Each Handler instance is associated with a single thread and that thread's message queue.
...
Does the thread has no message queue ?
Any benefit for a class extend from Handler?
Hi,
I've seen iphone related open source library which says something like,
"You need 4.0+ iOS build environment but the code will run on 3.0+ iOS device."
I wonder how those two requirements can differ and how can I tell a minimum 'device' iOS version which a certain api would need.
For instance I want to use UIGestureRecognizer but the apple doc says it's 3.2+, but I want my app run on 3.12+.
Is there a difference between build os requirement and device os requirement to run an app?
Thank you
any better way to write this ?
$(this).parent().parent().find(" dd ul").toggle();
update..
I am trying to create a dropdown using the script here
http://www.jankoatwarpspeed.com/post/2009/07/28/reinventing-drop-down-with-css-jquery.aspx
however the script works only for one instance of list and my code works good for multiple instances. Just curious if there is another better way to get parent of a parent in jQuery
I am willing to build an email application which runs on the server side.
Not being familiar with any particular server I wonder if I can get some recommendations based on experience.
I have seen many great startups which built some neat apps on the email platform (for instance, friendfeed's notification mechanism, or surely posterous which mail is at the heart of their business logic), and wonder about which mail server have they found easy to learn and integrate with.
PS:
MS Exchange or any other not open-source are not an option
Must run on linux
I would like to obtain all the versions of a given file in my SVN repository. For instance, let's say that the file ThirdPartyAssembly.dll was checked 3 times, is there a command that will get me all the version on my HD (e.g. ThirdPartyAssembly.dll.v1, ThirdPartyAssembly.dll.v2, ThirdPartyAssembly.dll.v3, etc.)?
Thanks!
Hi,
I guess it has to do something with string being a reference type but I dont get why simply string.Replace("X","Y") does not work?
Why I need to do `string A=stringB.Replace("X","Y")
I thought it is just a method to be done on specified instance? Thanks for explanation
EDIT: Thank you so far. I extend my question Why "b+="FFF"works but the b.replace is not?
I have a timer which helps me to move a point in a line, and I want to pause the animation, then resume it from paused time?
How can I capture the current time of a javax.swing.Timer instance?
Hello,
I'd like to know if the executing thread is the one that created a given control instance (to prevent cross-thread if it's not).
Is that possible ?
Thx.
Hi,
In the constructor of an object i need to create a WPF mediaElement object:
m_videoMedia = new MediaElement();
but the class can also be instantiated from a other thread so i need to use
Dispatcher.Invoke(DispatcherPriority.Normal,
(Action)(() => { m_videoMedia = new MediaElement(); }));
But how can I get the right dispatcher instance in that constructor :s
We have two installations of DB2.
When defining a foreign key with a long name, it works fine on one instance, but not on the other (we get a SQL0107N Name too long - max length is 18).
What is causing this different behaviour? Is there a parameter we can change or is it version dependant?