methods

iPhone UIImage Method crashes

I have this method in my Car.h class file: @interface Car : NSObject { NSString * name; UIImage* image; } + (id)withName:(NSString *)name withImage:(UIImage *)image; @end and my Car.m class file: #import "Car.h" @implementation Car @synthesize name, image; + (id)withName:(NSString *)name withImage:(UIImage *)image { Car *newCar ...

callback method in iframe to return a value to opener

I have to call a callback method in iframe to return a value to opener. I know SqueezeBox has "assign, open, close" static methods, but I do not understand how it works, can someone help me please? ...

Calling a subclassed virtual method from a base class method

class A { public: virtual void doSomething(void) {} void doStuff(void) { doSomething(); } }; class B : public A { public: void doSomething(void) { // do some stuff here } }; B * b = new B; b->doStuff(); It gives me Segmentation fault. What am I doing wrong? It s...

Is there a C# method similar to Javascripts OnBlur?

I am creating a windows form in C#, I have phone and email fields that I want to validate when the user leaves the fields, when I double click the textbox in visual studio, it writes a textchanged event, I don't want to call the validate method until the user is done entering the full entry. Is there a way to do this similar to OnBlur...

Controlling Display of Methods In Template

I have the following in a view (foreign key relationships via _set): srvr = Server.objects.get(name=q) return render_to_response('search_results.html', {'drv': srvr.drive_set.all(), 'memry': srvr.memory_set.all(), 'query': q}) The results template includes: {% if drv %} <table> <tr> <td>{{ drv }}</td> </tr> </tabl...

How do you write a get method that retrives the title of an object, not its Id - w/ ASP.NET MVC

So this is the method in my repository I use to get records from my db via its Id public BlogsTable GetBlogPosts(int id) { return db.BlogsTables.SingleOrDefault(d => d.Id == id); } And this is my controller using the get method public ActionResult Details(int id) { BlogsTable blogPostDetails = re...

How to dynamically adjust method names and calls with Objective-C

Hello. I am trying to condense my code for a method and was wondering how I would achieve the following: I have a bunch of variables that differ only in their number such as: int intVariable1 int intVariable2 UILabel Label1 UILabel Label2 BOOL bool1 BOOL bool2 etc. So I want to call a method and pass in an int. That int would dete...

How to export c# methods?

Hello, how can we export c# methods? I hava a dll and I want to use its methods in the Python language with the ctypes module. Because I need to use the ctypes module, I need to export the c# methods for them to be visible in Python. So, how can I export the c# methods (like they do in c++)? ...

iPhone Audio Resources

When browsing Stack Overflow I see mostly articles and questions about initializing and playback of audio files. My question: Where on the internet are tutorials for advanced audio playback and maybe editing for the various methods of playback? And maybe some tutorials on general workings of audio components, like the fundamentals of the...

When loading a dll in Python does the dir function shows its methods?

Does this code shows the methods from a dll? from ctypes import * x = cdll.LoadLibrary("olari.dll") dir(x) if not, how can we see the .dll methods in python? ...

How to avoid calling a ajax method more than once?

Hi! I have a .NET application that access methods located on handlers through AJAX calls. This AJAX calls are fired, generally, when the user clicks on certain buttons. My problem happens when the user clicks the buttons more than once. It messes up with all my object´s state. How do u take care of it? I know I can block the user click...

how do you suppress a direct call to a managed method?

I want to know if this is inherently possible: Think of a cloud scenario. I allow users to upload their .net code onto my server. However to manage things on my server I can't allow users to write code which make direct calls to methods such as HttpWebRequest.Create(). If the user has written such a code it would mean he/she is trying ...

"Tell, don't ask": what is the difference between a non-void method and a getter?

How might I justify using a non-void method while not using any property getters? What is the distinction between these two concepts such that getters are evil but non-void methods are acceptable? EDIT: int CalculateSomething(); int Calculation { get; } The fact that I can change the signature of CalculateSomething and pass values ...

Scala abstract method param question, List of T

I have a helper method: def controlStructure[T <: SomeObject](exceptions: Class[_]*)(body: => T) = { try { val tempObject = body tempObject.callSomeMethod Some(tempObject) } catch { case e if (exceptions.contains(e.getClass)) => None } } called with: controlStructure[MySomeObject...

Good ASP.NET method for checking, reading and returning file contents

I found a good way to check if a file exists and read the contents if it does, but for some reason I can't create a method out of it. Here's what I have so far: <script runat="server"> void Page_Load(Object s, EventArgs e) { lblFunction.Text = mwbInclude("test.txt"); } string mwbInclude(string fileName) { ...

C++ passing arrays to a method problem

Hey there I have this function: void vdCleanTheArray(int (*Gen_Clean)[25]) { } I wanted to know what kind of array does it accepts and clear it. Sorry, I have a little knowledge in c++, someone just asked me. Thanks! ...

C# Combine methods by passing in field type?

I wasn't sure how to title this question correctly but here is what i'm trying to do. Say I have a class Customer that has an ID, firstName, and lastName field. Now say I have a list of customers and I want to write one method that will write ID, firstName, OR lastName to the console depending on which one I specify. In essense, I...

Save method manytomany

I've got a model called Card which has a ManyToMany relationship to Tag. When I save a Card, I'd like to create a Product as well, which I want to have the same ManyToMany relationship to tag. How do I access the instance's tags? self.tags.all() gives an empty list, while if I check after saving, the card actually has tags. My code...

Speed of data manipulation in PHP vs MySQL

Apologies in advance if this is a silly question but I'm wondering which might be faster/better in the following simplified scenario... I've got registered users (in a users table) and I've got countries (in a countries table) roughly as follows: USERS TABLE: user_id (PK, INT) | country_id (FK, TINYINT) | other user-related fields... ...

JUnit Easymock Unexpected method call

Hi, I'm trying to setup a test in JUnit w/ EasyMock and I'm running into a small issue that I can't seem to wrap my head around. I was hoping someone here could help. Here is a simplified version of the method I'm trying to test: public void myMethod() { //Some code executing here Obj myObj = this.service.getObj(param); i...