Search Results

Search found 14402 results on 577 pages for 'interface builder'.

Page 9/577 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Interface Builder hang up on retina images

    - by Jim
    In my app I create 2 folders for images "Standard" and "Retina" where I put a lot of images for my app. When I open one of my xib file, Interface Builder hang up... I found that if I remove Retina Image that is used by this xib, then IB will open xib without any problem... This problem occurs only with 1 xib file, another xib files can be opened without any problems. What can be the reason of hang up? Can image be bad? Or maybe I shouldn't put Retina Images to "Retina" folder? What can be the reason? Thanks...

    Read the article

  • Apple Interface Builder: adding subview to UIImageView

    - by kpower
    I created UIImageView with the help of Interface Bulder. Now I want to place label inside it (as its subview). In code I can type something like: [myUIImageView addSubview:myUILabel]; But can I do it with the help of IB? I found the solution for UIView, but can't find something similar for UIImageView.

    Read the article

  • TextBox Borders in Reporting Services (Report Builder 3.0)

    - by ChrisHDog
    I have a report that I am creating in Report Builder 3.0 that I appear unable to set the color value (or any value) on TextBoxes Borders. I have a list that I have added a text box to. I then click on the text box and select Text Box Properties ... then click Border, the value for Color: is Black. If I change this value to anything else and then click OK, then come back into Text Box properties it is set back to Black. Any idea what is going on here? Is this not the correct way to set a border color?

    Read the article

  • Add device driver to Windows CE 6.0 through Platform Builder

    - by Luís Mendes
    I'm trying to add a device driver to a Windows CE 6.0 image that I'm creating through Platform Builder. The driver in question, for the VIA 6656 chipset (used in many USB Wi-Fi adapters/dongles), is available in the manufacturer's website and consists of several files: .PDB, .REG, .BIB, .DLL, .MAP and .REL. I understand that the REG file must be imported in my OSDesign.reg, the BIB file to my OSDesign.bib and the DLL must be placed in the /Windows folder of my image. What I don't understand is what to do with the remaining files (PDB, MAP and REL). Could anyone assist me in this matter? Thank you in advance!

    Read the article

  • Go - Generic function using an interface

    - by nevalu
    Since I've a similar function for 2 different data types: func GetStatus(value uint8) (string) {...} func GetStatus(name string) (string) {...} I would want to use a way more simple like: func GetStatus(value interface{}) (string) {...} Is possible to create a generic function using an interface? The data type could be checked using reflect.Typeof(value)

    Read the article

  • interface builder breaks on dual display

    - by madmik3
    Hi, I frequently connect and disconnect my laptop from a secondary display. Additionally I work in a small group that uses svn to manage xib files. It seems that if you drag a UIView display into a secondary display in interface builder and save the xib then either disconnect that display or open it on a computer with a secondary display in a different postion (left v right of the screen for example) then the view can't be seen/closed/moved. I've found no work around other than attaching a secondary display in the same position. This can be a real pain. Has anyone found a solution to this? thanks.

    Read the article

  • Issues using UITapGestureRecognizers in Interface Builder

    - by 5StringRyan
    I'm attempting to use the UITapGestureRecognizer object that can be found in Interface Builder. I've dragged a single "UITapGestureRecognizer" from the object library to a single view xib. I then create an IBAction method from this tap gesture, for a simple test, I'm just printing an "NSLog" message to the console once there is a tap on the view. I've run this, and the tap method isn't being called. I right click the view in IB and I noticed that there is a warning "!" on the view's "Outlook Collections" I see: Outlook Collections gestureRecognizers - Tap Gesture Recognizer (!) The warning states: UIView does not have an outlet collection named gestureRecognizers. What do I need to do to remedy this?

    Read the article

  • Difference between abstract class and interface

    - by nectar
    A class implementing an interface has to implement all the methods of the interface, but if that class is implementing an abctract class is it necessary to implement all abstract methods? If not, can we create the object of that class which is implementing the Abstract class???

    Read the article

  • SQL programming interface to external storage application

    - by Gopala
    My application is a non-relational database application with a tcl interface to retrieve data. I would like to add SQL programming interface to my application. Is there any library that converts SQL/PLSQL statements to API calls? It should also support stored procedures. SQLite(Embedded) has 'virtual table' mechanism that suits my requirement but it lacks stored procedure feature. -Gopala

    Read the article

  • Interface explosion problem

    - by Benny
    I am implementing a screen using MVP pattern, with more feature added to the screen, I am adding more and more methods to the IScreen/IPresenter interface, hence, the IScreen/IPresenter interface is becoming bigger and bigger, what should I do to cope with this situation?

    Read the article

  • Using View multiple times in Interface Builder

    - by user1396236
    I'm using a UITableview and have a custom Cell with some labels. I set up all the constraints in Interface Builder. Now I'm using this Cell multiple times, I just copied it in IB. Now it's the time to change some of these contraints because of some bugs (I'm converting a iPhone App to an Universal). But it can't be right that I now have to set the constraints manually for every cell? How do I do right? If I want to control the constraints in one central place, do I have to set them up in Code? I would really not like that! Thanks in advance.

    Read the article

  • Give a reference to a python instance attribute at class definition

    - by Guenther Jehle
    I have a class with attributes which have a reference to another attribute of this class. See class Device, value1 and value2 holding a reference to interface: class Interface(object): def __init__(self): self.port=None class Value(object): def __init__(self, interface, name): self.interface=interface self.name=name def get(self): return "Getting Value \"%s\" with interface \"%s\""%(self.name, self.interface.port) class Device(object): interface=Interface() value1=Value(interface, name="value1") value2=Value(interface, name="value2") def __init__(self, port): self.interface.port=port if __name__=="__main__": d1=Device("Foo") print d1.value1.get() # >>> Getting Value "value1" with interface "Foo" d2=Device("Bar") print d2.value1.get() # >>> Getting Value "value1" with interface "Bar" print d1.value1.get() # >>> Getting Value "value1" with interface "Bar" The last print is wrong, cause d1 should have the interface "Foo". I know whats going wrong: The line interface=Interface() line is executed, when the class definition is parsed (once). So every Device class has the same instance of interface. I could change the Device class to: class Device(object): interface=Interface() value1=Value(interface, name="value1") value2=Value(interface, name="value2") def __init__(self, port): self.interface=Interface() self.interface.port=port So this is also not working: The values still have the reference to the original interface instance and the self.interface is just another instance... The output now is: >>> Getting Value "value1" with interface "None" >>> Getting Value "value1" with interface "None" >>> Getting Value "value1" with interface "None" So how could I solve this the pythonic way? I could setup a function in the Device class to look for attributes with type Value and reassign them the new interface. Isn't this a common problem with a typical solution for it? Thanks!

    Read the article

  • HTTP Builder/Groovy - lost 302 (redirect) handling?

    - by Misha Koshelev
    Dear All: I am reading here http://groovy.codehaus.org/modules/http-builder/doc/handlers.html "In cases where a response sends a redirect status code, this is handled internally by Apache HttpClient, which by default will simply follow the redirect by re-sending the request to the new URL. You do not need to do anything special in order to follow 302 responses." This seems to work fine when I simply use the get() or post() methods without a closure. However, when I use a closure, I seem to lose 302 handling. Is there some way I can handle this myself? Thank you p.s. Here is my log output showing it is a 302 response [java] FINER: resp.statusLine: "HTTP/1.1 302 Found" Here is the relevant code: // Copyright (C) 2010 Misha Koshelev. All Rights Reserved. package com.mksoft.fbbday.main import groovyx.net.http.ContentType import java.util.logging.Level import java.util.logging.Logger class HTTPBuilder { def dataDirectory HTTPBuilder(dataDirectory) { this.dataDirectory=dataDirectory } // Main logic def logger=Logger.getLogger(this.class.name) def closure={resp,reader-> logger.finer("resp.statusLine: \"${resp.statusLine}\"") if (logger.isLoggable(Level.FINEST)) { def respHeadersString='Headers:'; resp.headers.each() { header->respHeadersString+="\n\t${header.name}=\"${header.value}\"" } logger.finest(respHeadersString) } def text=reader.text def lastHtml=new File("${dataDirectory}${File.separator}last.html") if (lastHtml.exists()) { lastHtml.delete() } lastHtml<<text new XmlSlurper(new org.cyberneko.html.parsers.SAXParser()).parseText(text) } def processArgs(args) { if (logger.isLoggable(Level.FINER)) { def argsString='Args:'; args.each() { arg->argsString+="\n\t${arg.key}=\"${arg.value}\"" } logger.finer(argsString) } args.contentType=groovyx.net.http.ContentType.TEXT args } // HTTPBuilder methods def httpBuilder=new groovyx.net.http.HTTPBuilder () def get(args) { httpBuilder.get(processArgs(args),closure) } def post(args) { args.contentType=groovyx.net.http.ContentType.TEXT httpBuilder.post(processArgs(args),closure) } } Here is a specific tester: #!/usr/bin/env groovy import groovyx.net.http.HTTPBuilder import groovyx.net.http.Method import static groovyx.net.http.ContentType.URLENC import java.util.logging.ConsoleHandler import java.util.logging.Level import java.util.logging.Logger // MUST ENTER VALID FACEBOOK EMAIL AND PASSWORD BELOW !!! def email='' def pass='' // Remove default loggers def logger=Logger.getLogger('') def handlers=logger.handlers handlers.each() { handler->logger.removeHandler(handler) } // Log ALL to Console logger.setLevel Level.ALL def consoleHandler=new ConsoleHandler() consoleHandler.setLevel Level.ALL logger.addHandler(consoleHandler) // Facebook - need to get main page to capture cookies def http = new HTTPBuilder() http.get(uri:'http://www.facebook.com') // Login def html=http.post(uri:'https://login.facebook.com/login.php?login_attempt=1',body:[email:email,pass:pass]) assert html==null // Why null? html=http.post(uri:'https://login.facebook.com/login.php?login_attempt=1',body:[email:email,pass:pass]) { resp,reader-> assert resp.statusLine.statusCode==302 // Shouldn't we be redirected??? // http://groovy.codehaus.org/modules/http-builder/doc/handlers.html // "In cases where a response sends a redirect status code, this is handled internally by Apache HttpClient, which by default will simply follow the redirect by re-sending the request to the new URL. You do not need to do anything special in order to follow 302 responses. " } Here are relevant logs: FINE: Receiving response: HTTP/1.1 302 Found Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.DefaultClientConnection receiveResponseHeader FINE: << HTTP/1.1 302 Found Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.DefaultClientConnection receiveResponseHeader FINE: << Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.DefaultClientConnection receiveResponseHeader FINE: << Expires: Sat, 01 Jan 2000 00:00:00 GMT Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.DefaultClientConnection receiveResponseHeader FINE: << Location: http://www.facebook.com/home.php? Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.DefaultClientConnection receiveResponseHeader FINE: << P3P: CP="DSP LAW" Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.DefaultClientConnection receiveResponseHeader FINE: << Pragma: no-cache Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.DefaultClientConnection receiveResponseHeader FINE: << Set-Cookie: datr=1275687438-9ff6ae60a89d444d0fd9917abf56e085d370277a6e9ed50c1ba79; expires=Sun, 03-Jun-2012 21:37:24 GMT; path=/; domain=.facebook.com Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.DefaultClientConnection receiveResponseHeader FINE: << Set-Cookie: lxe=koshelev%40post.harvard.edu; expires=Tue, 28-Sep-2010 15:24:04 GMT; path=/; domain=.facebook.com; httponly Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.DefaultClientConnection receiveResponseHeader FINE: << Set-Cookie: lxr=deleted; expires=Thu, 04-Jun-2009 21:37:23 GMT; path=/; domain=.facebook.com; httponly Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.DefaultClientConnection receiveResponseHeader FINE: << Set-Cookie: pk=183883c0a9afab1608e95d59164cc7dd; path=/; domain=.facebook.com; httponly Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.DefaultClientConnection receiveResponseHeader FINE: << Content-Type: text/html; charset=utf-8 Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.DefaultClientConnection receiveResponseHeader FINE: << X-Cnection: close Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.DefaultClientConnection receiveResponseHeader FINE: << Date: Fri, 04 Jun 2010 21:37:24 GMT Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.DefaultClientConnection receiveResponseHeader FINE: << Content-Length: 0 Jun 4, 2010 4:37:22 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies FINE: Cookie accepted: "[version: 0][name: datr][value: 1275687438-9ff6ae60a89d444d0fd9917abf56e085d370277a6e9ed50c1ba79][domain: .facebook.com][path: /][expiry: Sun Jun 03 16:37:24 CDT 2012]". Jun 4, 2010 4:37:22 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies FINE: Cookie accepted: "[version: 0][name: lxe][value: koshelev%40post.harvard.edu][domain: .facebook.com][path: /][expiry: Tue Sep 28 10:24:04 CDT 2010]". Jun 4, 2010 4:37:22 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies FINE: Cookie accepted: "[version: 0][name: lxr][value: deleted][domain: .facebook.com][path: /][expiry: Thu Jun 04 16:37:23 CDT 2009]". Jun 4, 2010 4:37:22 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies FINE: Cookie accepted: "[version: 0][name: pk][value: 183883c0a9afab1608e95d59164cc7dd][domain: .facebook.com][path: /][expiry: null]". Jun 4, 2010 4:37:22 PM org.apache.http.impl.client.DefaultRequestDirector execute FINE: Connection can be kept alive indefinitely Jun 4, 2010 4:37:22 PM groovyx.net.http.HTTPBuilder doRequest FINE: Response code: 302; found handler: post302$_run_closure2@7023d08b Jun 4, 2010 4:37:22 PM groovyx.net.http.HTTPBuilder doRequest FINEST: response handler result: null Jun 4, 2010 4:37:22 PM org.apache.http.impl.conn.SingleClientConnManager releaseConnection FINE: Releasing connection org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@605b28c9 You can see there is clearly a location argument. Thank you Misha

    Read the article

  • Interface Casting vs. Class Casting

    - by Legatou
    I've been led to believe that casting can, in certain circumstances, become a measurable hindrance on performance. This may be moreso the case when we start dealing with incoherent webs of nasty exception throwing\catching. Given that I wish to create more correct heuristics when it comes to programming, I've been prompted to ask this question to the .NET gurus out there: Is interface casting faster than class casting? To give a code example, let's say this exists: public interface IEntity { IParent DaddyMommy { get; } } public interface IParent : IEntity { } public class Parent : Entity, IParent { } public class Entity : IEntity { public IParent DaddyMommy { get; protected set; } public IParent AdamEve_Interfaces { get { IEntity e = this; while (this.DaddyMommy != null) e = e.DaddyMommy as IEntity; return e as IParent; } } public Parent AdamEve_Classes { get { Entity e = this; while (this.DaddyMommy != null) e = e.DaddyMommy as Entity; return e as Parent; } } } So, is AdamEve_Interfaces faster than AdamEve_Classes? If so, by how much? And, if you know the answer, why?

    Read the article

  • Flex / Flash builder : no returning data using database

    - by Tristan
    Hello, i'm following some flex tutorials everything's working as wanted expected for one thing : When i use my function getServerByBrand($brand) there is no returned data into my datagrid and i don't know why because it uses the same schema as getAllserver() which is working . I don't know whether it's cause by the function itselft or the configuration in flash builder : protected function RechercheGSP_clickHandler(event:MouseEvent):void { getServerByBrandResult.token = dbClass.getServerByBrand(SearchInput.text); } Here's what i've got in Data/Services : getServerByBrand(brand : string) : Object And finally the function : public function getServerByBrand($brand) { $stmt = mysqli_prepare($this->connection, "SELECT DISTINCT * FROM $this->tablename where GSP_nom=? "); $this->throwExceptionOnError(); mysqli_stmt_execute($stmt); $this->throwExceptionOnError(); $rows = array(); mysqli_stmt_bind_result($stmt, $row->idServ, $row->GSP_nom, $row->IPserv, $row->port, $row->tickrate, $row->membre, $row->nomPays, $row->finContrat, $row->actif, $row->timestamp, $row->type, $row->jeux, $row->slot, $row->ipClient, $row->essai, $row->reussite, $row->echec, $row->valide, $row->email); while (mysqli_stmt_fetch($stmt)) { $row->timestamp = new DateTime($row->timestamp); $rows[] = $row; $row = new stdClass(); mysqli_stmt_bind_result($stmt, $row->idServ, $row->GSP_nom, $row->IPserv, $row->port, $row->tickrate, $row->membre, $row->nomPays, $row->finContrat, $row->actif, $row->timestamp, $row->type, $row->jeux, $row->slot, $row->ipClient, $row->essai, $row->reussite, $row->echec, $row->valide, $row->email); } mysqli_stmt_free_result($stmt); mysqli_close($this->connection); return $rows; } I tested the settings with configure return type and it tells me : "the operation returned a primitive "object". test settings : Parameters (brand) / Input type (String) / Value (woop) To conclude, there is no returned object at all. Do you see the problem ? Thanks

    Read the article

  • Flex - Flash Builder Design View not showing embedded fonts correctly

    - by Crusader
    Tools: Air 2, Flex SDK 4.1, Flash Builder, Halo component set (NO Spark being used at all) Fonts work perfectly when running the appliction, but not in design view. This effectively makes design view WORTHLESS because it's impossible to properly position components or labels without knowing what the true size is (it changes depending on font...) ... CSS included in root component like so: <fx:Style source="style.css"/> CSS file: /* CSS file */ @namespace mx "library://ns.adobe.com/flex/mx"; global { font-family:Segoe; font-size:14; color:#FFFFFF; } mx|Application, mx|VBox, mx|HBox, mx|Canvas { font-family:Segoe; background-color:#660000; border-color:#222277; color:#FFFFFF; } mx|Button { font-family:Segoe; fill-colors:#660000, #660000, #660000, #660000; color:#FFFFFF; } .... Interestingly (or buggily?), when I try pasting the style tag into a subcomponent (lower than the top level container), I get a bunch of warnings in the subcomponent editor view stating that CSS type selectors are not supported in.. (all the components in the style sheet). Yet, they do work when the application is executed. Huh? This is how I'm embedding the fonts in the root level container: [Embed(source="/assets/segoepr.ttf", fontName="Segoe", mimeType="application/x-font-truetype", embedAsCFF='false')] public static const font:Class; [Embed(source="/assets/segoeprb.ttf", fontName="Segoe", mimeType="application/x-font-truetype", fontWeight="bold", embedAsCFF='false')] public static const font2:Class; So, is there a way to get embedded fonts to work in design view or what?

    Read the article

  • Newtonsoft JSON Interface Serialization error

    - by Ben
    I am using C# .NET 4.0, Newtonsoft JSON 4.5.0. public class Recipe { [JsonProperty(TypeNameHandling = TypeNameHandling.All)] public List<IFood> Foods{ get; set; } ... } I want to serialize and deserialize this Recipe object. If I serialize and deserialize the object during application lifetime this succeeds, but if I serialize the object, exit application and then deserialize it then it throws an exception, that it cannot instantiate IFood (since it is an interface). The problem is that it does not serialize the implementation of interface. "$type": "System.Collections.Generic.List`1[[NSM.Shared.Models.IFood, NSMShared]], mscorlib" I tried using TypeNameHandling.Object and Array and Auto, but it didn't help. Is there any way to serialize it properly? Or at least to define the class mapping before deserializing? EDIT: I am using JSON coupled with Hammock ( http://code.google.com/p/relax-net/ ), C# driver for CouchDB, which internally serializes and deserializes objects. As mentioned the problem is that it does not serialize the interface implementation.

    Read the article

  • Delphi RTTI unable to find interface

    - by conciliator
    I'm trying to fetch an interface using D2010 RTTI. program rtti_sb_1; {$APPTYPE CONSOLE} {$M+} uses SysUtils, Rtti, mynamespace in 'mynamespace.pas'; var ctx: TRttiContext; RType: TRttiType; MyClass: TMyIntfClass; begin ctx := TRttiContext.Create; MyClass := TMyIntfClass.Create; // This prints a list of all known types, including some interfaces. // Unfortunately, IMyPrettyLittleInterface doesn't seem to be one of them. for RType in ctx.GetTypes do WriteLn(RType.Name); // Finding the class implementing the interface is easy. RType := ctx.FindType('mynamespace.TMyIntfClass'); // Finding the interface itself is not. RType := ctx.FindType('mynamespace.IMyPrettyLittleInterface'); MyClass.Free; ReadLn; end. Both IMyPrettyLittleInterface and TMyIntfClass = class(TInterfacedObject, IMyPrettyLittleInterface) are declared in mynamespace.pas. Do anyone know why this doesn't work? Is there a way to solve my problem? Thanks in advance!

    Read the article

  • Flash builder 4 - change output filename using external build-config.xml (not Ant)

    - by Casey
    I'm trying to change the output filename with a config file loaded via the compiler option -load-config. It looks like this in my compiler arguments: -load-config+=build-config.xml. I've tried the following: <flex-config> <o>absolute/path/to/filename</o> </flex-config> and <flex-config> <output>absolute/path/to/filename</output> </flex-config> and <flex-config> <compiler> <o>absolute/path/to/filename</o> </compiler> </flex-config> and <flex-config> <compiler> <output>absolute/path/to/filename</output> </compiler> </flex-config> but none have worked. I'm on a PC using Flash Builder 4. Has anyone else done this? Also, ideally, I want to use a relative path instead of absolute. I can't get this to work either, even if I do so in the "additional compiler arguments" field of the Project configuration. Thanks in advance!

    Read the article

  • Cannot inherit from generic base class and specific interface using same type with generic constrain

    - by simendsjo
    Sorry about the strange title. I really have no idea how to express it any better... I get an error on the following snippet. I use the class Dummy everywhere. Doesn't the compiler understand the constraint I've added on DummyImplBase? Is this a compiler bug as it works if I use Dummy directly instead of setting it as a constraint? Error 1 'ConsoleApplication53.DummyImplBase' does not implement interface member 'ConsoleApplication53.IRequired.RequiredMethod()'. 'ConsoleApplication53.RequiredBase.RequiredMethod()' cannot implement 'ConsoleApplication53.IRequired.RequiredMethod()' because it does not have the matching return type of 'ConsoleApplication53.Dummy'. C:\Documents and Settings\simen\My Documents\Visual Studio 2008\Projects\ConsoleApplication53\ConsoleApplication53\Program.cs 37 27 ConsoleApplication53 public class Dummy { } public interface IRequired<T> { T RequiredMethod(); } public interface IDummyRequired : IRequired<Dummy> { void OtherMethod(); } public class RequiredBase<T> : IRequired<T> { public T RequiredMethod() { return default(T); } } public abstract class DummyImplBase<T> : RequiredBase<T>, IDummyRequired where T: Dummy { public void OtherMethod() { } }

    Read the article

  • Invoking a method overloaded where all arguments implement the same interface

    - by double07
    Hello, My starting point is the following: - I have a method, transform, which I overloaded to behave differently depending on the type of arguments that are passed in (see transform(A a1, A a2) and transform(A a1, B b) in my example below) - All these arguments implement the same interface, X I would like to apply that transform method on various objects all implementing the X interface. What I came up with was to implement transform(X x1, X x2), which checks for the instance of each object before applying the relevant variant of my transform. Though it works, the code seems ugly and I am also concerned of the performance overhead for evaluating these various instanceof and casting. Is that transform the best I can do in Java or is there a more elegant and/or efficient way of achieving the same behavior? Below is a trivial, working example printing out BA. I am looking for examples on how to improve that code. In my real code, I have naturally more implementations of 'transform' and none are trivial like below. public class A implements X { } public class B implements X { } interface X { } public A transform(A a1, A a2) { System.out.print("A"); return a2; } public A transform(A a1, B b) { System.out.print("B"); return a1; } // Isn't there something better than the code below??? public X transform(X x1, X x2) { if ((x1 instanceof A) && (x2 instanceof A)) { return transform((A) x1, (A) x2); } else if ((x1 instanceof A) && (x2 instanceof B)) { return transform((A) x1, (B) x2); } else { throw new RuntimeException("Transform not implemented for " + x1.getClass() + "," + x2.getClass()); } } @Test public void trivial() { X x1 = new A(); X x2 = new B(); X result = transform(x1, x2); transform(x1, result); }

    Read the article

  • MacRuby + Interface Builder: How to display, then close, then display a window again

    - by Derick Bailey
    I'm a complete n00b with MacRuby and Cocoa, though I've got more than a year of Ruby experience, so keep that in mind when answering - I need lots of details and explanation. :) I've set up a simple project that has 2 windows in it, both of which are built with Interface Builder. The first window is a simple list of accounts using a table view. It has a "+" button below the table. When I click the + button, I want to show an "Add New Account" window. I also have an AccountsController < NSWindowController and a AddNewAccountController class, set up as the delegates for these windows, with the appropriate button click methods wired up, and outlets to reference the needed windows. When I click the "+" button in the Accounts window, I have this code fire: @add_account.center @add_account.display @add_account.makeKeyAndOrderFront(nil) @add_account.orderFrontRegardless this works great the first time I click the + button. Everything shows up, I'm able to enter my data and have it bind to my model. however, when I close the add new account form, things start going bad. if I set the add new account window to release on close, then the second time I click the + button, the window will still pop up but it's frozen. i can't click any buttons, enter any data, or even close the form. i assume this is because the form's code has been released, so there is no message loop processing the form... but i'm not entirely sure about this. if i set the add new account window to not release on close, then the second time i click the + button, the window shows up fine and it is usable - but it still has all the data that i had previously entered... it's still bound to my previous Account class instance. what am I doing wrong? what's the correct way to create a new instance of the Add New Account form, create a new Account model, bind that model to the form and show the form, when I click the + button on the Accounts form? ... this is all being done on OSX 10.6.6, 64bit, with XCode 3.2.4

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >