raise

How to get a pay raise?

Lot's of people have trouble asking for a raise (me included). Post your tips, stories, anything that may help. ...

How do I keep Visual Studio from autoraising, when I activate "Focus Follows Mouse"?

I'm running VS2008 and have used SystemParametersInfo to activate "Focus Follows Mouse" and "Do not Raise On Focus." Sadly though, VS2008 (with and without SP1) doesn't honour the "Do not Raise" part and eagerly pushes into the foreground every time the pointer touches its window. A while ago I complained about that on my blog and poste...

Proper way of raising events from C++/CLI ?

Hi, I was wondering what's the proper way of raising events from C++/CLI. In C# one should first make a copy of the handler, check if it's not null, and then call it. Is there a similar practice for C++/CLI? ...

RSpec and Open-URI how do I mock raise a SocketError/TimeoutError

I want to be able to spec out that when Open-Uri open() calls either timeout or raise an exception such as SocketError I am handling things as expected, however I'm having trouble with this. Here is my spec (for SocketError): @obj.should_receive(:open).with("some_url").and_raise(SocketError) And the part of my object where I'm using ...

Raising external object's events in C#

If actions is a Panel, am I able to raise the Click event of it's parent? I have this code at the moment, but the Click event isn't a method, so this code is invalid. Does anyone know how I can achieve this? actions.Click += delegate(object Sender, EventArgs e) { ((Panel)Sender).Parent.Click(); } ...

Best practice for Python Assert

Is there a performance or code maintenance issue with using assert as part of the standard code instead of using it just for debugging purposes? Is assert x >= 0, 'x is less then zero' and better or worse then if x < 0: raise Exception, 'x is less then zero' Also, is there anyway to set a business rule like if x < 0 raise err...

C#: Do you raise or throw an exception?

I know that this probably doesn't really matter, but I would like to know what is correct. If a piece of code contains some version of throw new SomeKindOfException(). Do we say that this piece of code can potentially raise an exception? Or throw an exception? The keyword is throw, so I am kind of leaning towards that, but to raise an ...

Is it possible to raise an event on an object, from outside that object, without a custom function.

public class a { public event eventhandler test; public void RaiseTest(){//fire test} } Is it possible to raise test on this class, from outside this class, without calling the method? Basically I have a large number of events which must be raised based on an external source, and do not want to create a Raise() function for eac...

Raise an event in C#

I cam across this question in a Microsoft Practice Test and get confused. Here is the question: Which of the following C# code samples is the proper way to raise an event, assuming that the Alarm event, the AlarmEventArgs class, and the AlarmEventHandler delegate have been declared? Here is the "correct" answer they provi...

Exception libraries for C (not C++)

Hi - I am rolling my own exception library for C and would like good examples to examine. So far, I have been looking at David Hanson's: http://drhanson.net/work/ But I know I've seen other ones available in the past. Can you send me some additional pointers? Thanks, SetJmp ...

EventHandler is null

I am trying to raise a click event from User control and handle it on the containing page. The problem I have is, when I click the button 'imgstep1' on the user control, the code behind imgstep1_click event triggers and but the 'btnHandler' event is alway null. Hence it doesnt call the parent event. Any help on this will be much appreci...

Ruby Web API scraping / error handling with Hpricot

I have written a simple ruby gem to scrape a set of websites, providing a simple API, inside the gem itself I have included a retry method... to attempt to use Hpricot 3 or more times on failure mostly due to timeouts. def retryable(options = {}, &block) opts = { :tries => 1, :on => Exception }.merge(options) retry_exception, retri...

scope of raise exception, handling your own exceptions in PLSQL code

I have this procedure: create or replace PROCEDURE CONVERTE IS CURSOR oldemployees IS SELECT * FROM emp1 WHERE data_saida= NULL; new_ndep emp1.num_dep%type; bi_inexistente EXCEPTION; dep_inexistente EXCEPTION; employeeNr emp1.num_empregado%type; BEGIN FOR old_emp IN oldemployees LOO...

Is it OK to raise a built-in exception, but with a different message, in Python?

Is it OK to raise a built-in exception with a custom text? or to raise a built-in warning also with custom text? The documentation reads: exception ValueError: Raised when a built-in operation or function receives an argument (…) Is it implied that only built-in operations should raise a ValueError exception? In practice, I unde...

Python: Can I overload the raise statement with def __raise__(self):?

Here's my exception class that is using raise: class SCE(Exception): """ An error while performing SCE functions. """ def __init__(self, value=None): """ Message: A string message or an iterable of strings. """ if value is None: self._values = [] elif isinstance(value, ...

Eager loading for globalize2 translations

Hi, i have 2 models - Issue and Answers (issue has many answers) and both have translations with globalize2. Every time i attempting to load Issue with answers via @issue = Issue.find(params[:id]) @answers = @issue.answers causes loading of translations for each Answer (1 sql query per Answer). How can i optimize it? ...

Raising WPF MouseLeftButtonDownEvent event

Hi, I am trying ot raise a MouseLeftButtonDownEvent by bubbling it up the Visual tree with the following code. MouseButtonEventArgs args = new MouseButtonEventArgs(Mouse.PrimaryDevice,0, MouseButton.Left); args.RoutedEvent = UIElement.MouseLeftButtonDownEvent; args.Source = this; RaiseE...

How does ruby's rb_raise stop the execution of the c function calling it?

If you write a ruby method as a function in C that uses rb_raise, the part of the function after the call will not get excecuted and the program will stop and you will think that rb_raise used exit(). But if you rescue the exception in ruby, like: begin method_that_raises_an_exception rescue end puts 'You wil still get here.' The ru...

Go - Raise an exception

I would want to raise an exception as it's made in Python or Java --to finish the program with an error message--. An error message could be returned to a parent function: func readFile(filename string) (content string, err os.Error) { content, err := ioutil.ReadFile(filename) if err != nil { return "", os.ErrorString("...

Question about when and when not to raise events (C#)

I am programming an instant messaging library for MSN Messenger, and I have a simple question about raising events. When logging in, should I be raising UserAdded for each user that is synchronized (already on the contact list), or should the UserAdded event be reserved for when a new user has been added to the contact list via the AddU...