I am not quite clear as to why or when to use Interfaces. Can someone post a complete, simple and small example of an Interface using VB.NET in a Console Application. How is it extensible?
Currently I am creating a WCF service which has to connect to a DAL which, just connects to a database using ADO.net and stored procedures.
The DAl writes its responses from the database to a datacontract which is passed over the wire to the client via the service.
I was reading that this may possibly be the anti pattern 'CRudy Interface', but I wasn't sure as I am sharing the datacontract.
If I am using an anti pattern, can anyone suggest a better pattern to use for the behavior I require?
Thanks
What happens to state information held by a class's variable after coming back from a low memory situation?
I know that views will get unloaded and then reloaded later but what about some ancillary classes & data held in them that's used by the controller that launched the view?
Sample scenario in question:
@interface MyCustomController: UIViewController
{
ServiceAuthenticator *authenticator;
}
-(id)initWithAuthenticator:(ServiceAuthenticator *)auth;
// the user may press a button that will cause the authenticator
// to post some data to the service.
-(IBAction)doStuffButtonPressed:(id)sender;
@end
@interface ServiceAuthenticator
{
BOOL hasValidCredentials; // YES if user's credentials have been validated
NSString *username;
NSString *password; // password is not stored in plain text
}
-(id)initWithUserCredentials:(NSString *)username password:(NSString *)aPassword;
-(void)postData:(NSString *)data;
@end
The app delegate creates the ServiceAuthenticator class with some user data (read from plist file) and the class logs the user with the remote service.
inside MyAppDelegate's applicationDidFinishLaunching:
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
ServiceAuthenticator *auth = [[ServiceAuthenticator alloc] initWithUserCredentials:username password:userPassword];
MyCustomController *controller = [[MyCustomController alloc] initWithNibName:...];
controller.authenticator = auth;
// Configure and show the window
[window addSubview:..];
// make everything visible
[window makeKeyAndVisible];
}
Then whenever the user presses a certain button, 'MyCustomController's doStuffButtonPressed' is invoked.
-(IBAction)doStuffButtonPressed:(id)sender
{
[authenticator postData:someDataFromSender];
}
The authenticator in-turn checks to if the user is logged in (BOOL variable indicates login state) and if so, exchanges data with the remote service. The ServiceAuthenticator is the kind of class that validates the user's credentials only once and all subsequent calls to the object will be to postData.
Once a low memory scenario occurs and the associated nib & MyCustomController will get unloaded -- when it's reloaded, what's the process for resetting up the 'ServiceAuthenticator' class & its former state?
I'm periodically persisting all of the data in my actual model classes. Should I consider also persisting the state data in these utility style classes? Is that the pattern to follow?
I'm writing an interface spec in MS Word and it would be great if there were some sort of template or pluggin for Word (2003 here) that would make it all look a bit prettier.
(I'm realizing how spoiled I am with even the archaic VB6 IDE).
Suppose we have a class called AccountService that manages the state of accounts.
AccountService is defined as
interface AccountService{
public void debit(account);
public void credit(account);
public void transfer(Account account, Account account1);
}
Given this definition, what is the best way to implement transfer() so that you can guarantee that transfer is an atomic operation.
I'm interested in answers that reference Java 1.4 code as well as answers that might use resources from java.util.concurrent in Java 5
Hi all ,
I want to customize my tab bar user interface some thing like this .
custmized tab bar
So can anyone tell me how to prepare these types of ui layout or rendering ?
Thanks ,
I'm looking for the syntax of the getter/setter. Which is the setter and which is the getter??
Is the readwrite attribute the getter?
Is the assign the setter?
@interface SomeClass : NSObject
{
NSString *str;
NSDate *date;
}
@property (readwrite, assign) NSString *str;
@property (readwrite, assign) NSDate *date;
I have a Windows Server 2003 running Mercurial's hgwebdir.cgi to serve repositories. Push/Pull etc is working as expected for existing repositories.
Currently I'm using remote desktop If I need a new repository on the server.
Is there a better way to do it? Command line, web interface, cgi?
I have a scenario where I would want a plugin to construct a LINQ (to objects) query, send it across an appdomain and then apply and run it against a collection of my choosing
Is it possible, how?
If not, perhaps I could send a whole method (interface) across the appdomain and run it against the data on the appside? The main thing is that I want the data to reside in the CurrentDomain and the logic for operating on it in the plugin so I don't have to send the data across the boundary...
Would it be possible to integrate Python (and/or Perl) and Ruby? I've looked at http://www.goto.info.waseda.ac.jp/~fukusima/ruby/python/doc/ and http://code.google.com/p/ruby-perl/ , but they both seem rather outdated.
Has someone generated a Ruby interface for Python's C API?
I have a Class<? extends Annotation> and tried calling newInstance() but Java yelled at me for the obvious reason that I can't instantiate an interface. But I know frameworks like EasyMock are perfectly capable of instantiating interfaces. What would it take to get a completely dumb Annotation instance out of my Class?
Hi..
please let me know what are the devices wil be listed using the below code
guid = GUID_DEVINTERFACE_VOLUME;
// Get device Information handle for Volume interface
hDevInfo = SetupDiGetClassDevs( &guid, NULL, NULL,
DIGCF_DEVICEINTERFACE | DIGCF_PRESENT );
Thank you
I'm leveraging the Doubleton Pattern from this link http://www.codeproject.com/KB/architecture/designpattern_doubleton.aspx in my own code. I think it makes things a lot easier since the Singleton only provides one instance, but I get two with this pattern. I was wondering if it would make sense to have it implement an interface so I can inject it into my domain layer.
Actually, free is good enough, it doesn't have to be open source :)
I'm currently using the Schema Compare utility of VS2008, but it doesn't have a command line interface and has some other weaknesses as well.
I'm wondering what free tools others are using to provide command line schema comparisons/synchronizations?
Thanks.
I am trying to send a faceless email (sending an email without showing the interface), using the code below.
I also want to attach an image to this email.
Is this possible?
- (void) sendEmailTo:(NSString *)toStr withSubject:(NSString *)subjectStr withBody:(NSString *)bodyStr
{
NSString *emailString=[[NSString alloc] initWithFormat:@"mailto:?to=%@&subject=%@&body=%@",
[toStr stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding],
[subjectStr stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding],
[bodyStr stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:emailString]];
[emailString release];
}
I've looked at a lot of the previous questions asked about sharepoint and accessing objects via web-services, and I am pretty convinced that tasks can be accessed through the Lists interface.
Can anybody please verify this for me?
Also, if anyone has any examples of this I would be very grateful. I'm not a Sharepoint guy but I need to connect to an instance just to retrieve task objects.
I am creating an web application on the .net 4.0 framework (beta2 ) in C#.
When I try to use a assembly called "ActiveHomeScriptLib", I get the following error:
Interop type
'ActiveHomeScriptLib.ActiveHomeClass'
cannot be embedded. Use the applicable
interface instead.
When I change the framework to version 3.5, I don't have any errors.
What is an Interop Type and why does this only occur when I use the 4.0 framework.
Let's say I have the URI for a RESTful or other contract-less API. Is it possible to determine its interface programatically? I'm using C#/ASP.net MVC, not sure if that's important.
I understand that there won't be a published contract, but I'm wondering if there's something I'm not thinking of (there usually is).
Does the native Blackberry API allow for the modification of any messaging interface?
For example, I'd like to be able to build an app that added a button at the bottom of a received message which says 'translate this'. I've heard that this kind of thing is possible using J2ME plus the native BlackBerry API. Can this be done for all kinds of messages, eg SMS, email and BB messaging?
The translation aspect is not relevant, it just provides the context for the kind of feature I'm after.
Hi,
I need to give my user a web interface to change the session timeout interval. So, each installation of the application might have different timeouts for their sessions, but they web.xml cannot be different.
Is there a way to set the session timeout programatically, so that I could use, say, ServletContextListener.contextInitialized() to read the configured interval and set it upon application startup?
Thanks a lot.
Hi,
Usually I am a web developer so this is probably a very novice question. I recently made an app in VB2008, but I developed it in a huge reso (1920x1200). The person that will be using it still uses 800x600 reso. Is there any simple way I can resize the entire interface to fit any resolution? I didn't really think about it at all while I was making the program.
I was wondering if it would be possible to write a file, not to the local system, but to a connected server or other network path. Would i have to use an external php interface for this or can i entrust this to the AIR framework?
I'm pretty sure that AIR has certain security precautions to prevent this.
Thanks a bunch!
Regards
Hello,
I used use Google’s slick interface to get my mail and It’s always going to be here:
https://mail.google.com/a/yourdomainhere.com
I want to write python script that send mail so i failed to configure server settings
smtp = smtplib.SMTP('what is mail server will be?', what is the port)
smtp.login('[email protected]', 'pass')
Please could any one help me ??
Thanks
I'd like to implement a simple class (in Java) that would allow me to register and deregister strings, and on the basis of the current set of strings auto-complete a given string. So, the interface would be:
void add(String)
void remove(String)
String complete(String)
What's the best way to do this in terms of algorithms and data-structures?