Search Results

Search found 26126 results on 1046 pages for 'generic service contract'.

Page 90/1046 | < Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >

  • Operator as and generic classes

    - by abatishchev
    I'm writing .NET On-the-Fly compiler for CLR scripting and want execution method make generic acceptable: object Execute() { return type.InvokeMember(..); } T Execute<T>() { return Execute() as T; /* doesn't work: The type parameter 'T' cannot be used with the 'as' operator because it does not have a class type constraint nor a 'class' constraint */ // also neither typeof(T) not T.GetType(), so on are possible return (T) Execute(); // ok } But I think operator as will be very useful: if result type isn't T method will return null, instead of an exception! Is it possible to do?

    Read the article

  • Rails: Generic form actions, cancel link losing `:back` on validation failure

    - by Patrick Connor
    I am trying to create a generic set of Submit, Cancel, and Destroy actions for forms. At this point, it appears that everything is working, except that I lose :back functionality then a form reloads due to validation errors. Is there a way to catch the fact that validation has failed, and in that case, keep the request.env['HTTP_REFERER'] or :back value the same without having to edit every controller? = simple_form_for @announcement do |f| = f.error_notification = f.input :message = f.input :starts_at = f.input :ends_at #submit = f.button :submit = "or " = link_to("cancel", url_for(:back)) .right - if !f.object.new_record? - resource = (f.object.class.name).downcase = link_to "destroy", url_for(:action => 'destroy'), :confirm => "Are you sure that you want to delete this #{resource}?", :method => :delete .clear .non_input #post_back_msg #indicator.inline = image_tag "indicator.gif" .inline = "Please wait..." .non_input

    Read the article

  • C# Using Reflection to Get a Generic Object's (and its Nested Objects) Properties

    - by Jimbo
    This is a scenario created to help understand what Im trying to achieve. I am trying to create a method that returns the specified property of a generic object e.g. public object getValue<TModel>(TModel item, string propertyName) where TModel : class{ PropertyInfo p = typeof(TModel).GetProperty(propertyName); return p.GetValue(item, null); } The code above works fine if you're looking for a property on the TModel item e.g. string customerName = getValue<Customer>(customer, "name"); However, if you want to find out what the customer's group's name is, it becomes a problem: e.g. string customerGroupName = getValue<Customer>(customer, "Group.name"); Hoping someone can give me some insight on this way out scenario - thanks.

    Read the article

  • How to check if TypeIdenitifier(T) is an Object?

    - by John
    I'm creating a generic list class that has a member of type Array(Array of ). The problem is the class descruction,because the class is supposed to be used for types from byte to types inheriting TObject. Specifically: destructor Destroy; var elem:T; begin /*if(T is Tobject) then //Check if T inherits TObject {Compiler error!} for elem in FData do TObject(elem).Free;*/ // do not know how to do it SetLength(FItems,0); //FItems : Array of T inherited Destroy; end; How do I check if T is TObject so I can free every member if the typeidenitifier is a class,for example?

    Read the article

  • Catch a generic exception in Java?

    - by Alex Baranosky
    We use JUnit 3 at work and there is no ExpectedException annotation. I wanted to add a utility to our code to wrap this: try { someCode(); fail("some error message"); } catch (SomeSpecificExceptionType ex) { } So I tried this: public static class ExpectedExceptionUtility { public static <T extends Exception> void checkForExpectedException(String message, ExpectedExceptionBlock<T> block) { try { block.exceptionThrowingCode(); fail(message); } catch (T ex) { } } } However, Java cannot use generic exception types in a catch block, I think. How can I do something like this, working around the Java limitation? Is there a way to check that the ex variable is of type T?

    Read the article

  • Java generics: actual class as a generic parameter.

    - by user554916
    What do I write instead of "TheClass" to make this work? Or is there an alternative way to do it (possibly without making WithName and WithAge generic)? class Item { NeigborList<TheClass> neighbors; } class WithName extends Item { // here I want neighbors to be a NeighborList<WithName> String name; void someMethod() { System.out.println(neighbors.nearestTo(this).name); } } class WithAge extends Item { // here I want neighbors to be a NeighborList<WithAge> int age; void someOtherMethod() { System.out.println(neighbors.nearestTo(this).age); } }

    Read the article

  • Determining whether a class implements a generic list in a T4 template

    - by James Hollingworth
    I'm writing a T4 template which loads some classes from an assembly, does some analysis of the classes and then generates some code. One particular bit of analysis I need to do is to determine whether the class implements a generic list. I can do this pretty simply in C#, e.g. public class Foo : List<string> { } var t = typeof(Foo); if (t.BaseType != null && t.BaseType.IsGenericType && t.BaseType.GetGenericTypeDefinition() == typeof(List<>))) Console.WriteLine("Win"); However T4 templates use the FXCop introspection engine and so you do not have access to the .net reflection API. I've spent the past couple of hours in Reflector but still can't figure it out. Does anyone have any clues about how to do this?

    Read the article

  • Generic class implementing interface fails

    - by Pitming
    A meet a strange problem at compimation saying that a class does not implement an interface. Lets say a v got a class: public Class MyClass { ... } And an interace: public Interface IMyInterface { MyClass PropertyOfMyClass {get;} } and now a generic class: public class MyGeneric<T> where T:MyClass { T PropertyOfMyClass { get{return ...;} } } Until here everythings fine and compiles right. But this will break at compilation time: public class MyGeneric<T>:IMyInterace where T:MyClass { T PropertyOfMyClass { get{return ...;} } } Saying that MyGeneric does not implements method of IMyInterface. But obviously it does, not ?

    Read the article

  • Common type for generic classes of different types

    - by DinGODzilla
    I have (for example) Dictionary of different generic types (d1, d2, d3, d4) and I want to store them in something var d1 = new Dictionary<int, string>(); var d2 = new Dictionary<int, long>(); var d3 = new Dictionary<DateTime, bool>(); var d4 = new Dictionary<string, object>(); var something = ??? //new List<object> {d1, d2, d3, d4}; Is there any other way how to store that in something with common denominator different than object? Thanks :-)

    Read the article

  • Django GenericRelation doesn't save related object's id - is this a bug or am I doing it wrong?

    - by pinkeen
    I have a model with a generic relation (call it A), when creating an instance of this object I pass an instance of another model (call it B) as the initializer of the content_object field (via kwargs of the constructor). If I don't save B before creating A then when saving A the content_object_id is saved to the db as NULL. If I save B before passing it to the constructor of A then everything's allright. It's not logical. I assumed that the ID of the related object (B) is fetched when doing A.save() and it should throw some kind of an exception if B isn't saved yet but it just fails silently. I don't like the current solution (saving B beforhand) because we don't know yet if I will be always willing to keep the object, not just scrap it, and there are performance considerations - what if I will add some another data and save it once more shortly after. class BaseNodeData(models.Model): ... extnodedata_content_type = models.ForeignKey(ContentType, null=True) extnodedata_object_id = models.PositiveIntegerField(null=True) extnodedata = generic.GenericForeignKey(ct_field='extnodedata_content_type', fk_field='extnodedata_object_id') class MarkupNodeData(models.Model): raw_content = models.TextField() Suppose we do: markup = MarkupNodeData(raw_content='...') base = BaseNodeData(..., extnodedata=markup) markup.save() base.save() # both records are inserted to the DB but base is stored with extnodedata_object_id=NULL markup = MarkupNodeData(raw_content='...') base = BaseNodeData(..., extnodedata=markup) base.save() markup.save() # no exception is thrown and everything is the same as above markup = MarkupNodeData(raw_content='...') markup.save() base = BaseNodeData(..., extnodedata=markup) base.save() # this works as expected Of course I can do it this way, but it doesn't change anything: base = BaseNodeData(...) base.extnodedata = markup My question is - is this a bug in django which I should report or maybe I'm doing something wrong. Docs on GenericRelations aren't exactly verbose.

    Read the article

  • Generic SQL builder .NET

    - by Patrick
    I'm looking for a way to write an SQL statement in C# targeting different providers. A typical example of SQL statements differentiating is the LIMIT in PostgreSQL vs. TOP in MSSQL. Is the only way to solve SQL-syntax like the two above to write if-statements depending on which provider the user selects or using try catch statements as flow control (LIMIT didn't work, I'll try TOP instead)? I've seen the LINQ Take method, but I'm wondering if one can do this without LINQ? In other words, does C# have some generic SQL Provider class that I have failed to find that can be used?

    Read the article

  • Operation Problems in Java Generic

    - by alantheweasel
    I got some problem when i was learning Java Generic : interface calculator<T, R> { public void execute(T t, R r); } class executeAdd<T, R> implements calculator<T, R> { private T first; private R second; public executeAdd(T first, R second) { super(); this.first = first; this.second = second; } @Override public void execute(T t, R r) { // TODO Auto-generated method stub Object o = t + r // ERROR ! What i could do it ? } }

    Read the article

  • Solution to compiler warning for generic varargs

    - by TJR
    A puzzle from this blog. Similar to SO1445233. Given the following source listing, explain why the compiler is producing a warning at invocation to the list method and give a solution for removing the warning without resorting to @SuppressWarnings annotation. public class JavaLanguagePuzzle3 { public static void main(String[] args) { list("1", 2, new BigDecimal("3.5")); } private static <T> List<T> list(T... items) { return Arrays.asList(items); } } Warning: Type safety: A generic array of Object&Serializable&Comparable<?> is created for a varargs parameter

    Read the article

  • Generic arrays of parametrized ArrayLists in java?

    - by athena123
    I am new to Java, so I am not aware of the nitty gritties. Why can't I create generic array of parametrized ArrayList? Instead I have to write, ArrayList<String>[] alist = new ArrayList[10]; or I have to create List of ArrayLists. Aren't arrays supposed to be more efficient than ArrayLists? Then why doesn't Java allow it? Also, what is the difference between following two lines. ArrayList<String>[] alist = new ArrayList[10]; ArrayList<String>[] alist = new ArrayList<?>[10];

    Read the article

  • A generic Find method to search by Guid type for class implementing IDbSet interface

    - by imak
    I am implementing a FakeDataSet class by implementing IDbSet interface. As part of implementing this interface, I have to implement Find method. All my entity classes has an Guid type Id column. I am trying to implement Find method for this FakeDbSet class but having hard time to write it in a generic way. Below is my attempts for writing this method but since it does not know about Id been Guid type, I am getting compilation error on m.Id call. Any ideas on how this could be accomplished? public class FakeDataSet<T> : IDbSet<T> where T: class, new() { // Other methods for implementing IDbSet interface public T Find(params object[] keyValues) { var keyValue = (Guid)keyValues.FirstOrDefault(); return this.SingleOrDefault(m => m.Id == keyValue); // How can I write this } }

    Read the article

  • Generics not so generic !!

    - by Aymen
    Hi I tried to implement a generic binary search algorithm in scala. Here it is : type Ord ={ def <(x:Any):Boolean def >(x:Any):Boolean } def binSearch[T <: Ord ](x:T,start:Int,end:Int,t:Array[T]):Boolean = { if (start > end) return false val pos = (start + end ) / 2 if(t(pos)==x) true else if (t(pos) < x) binSearch(x,pos+1,end,t) else binSearch(x,start,pos-1,t) } everything is OK until I tried to actually use it (xD) : binSearch(3,0,4,Array(1,2,5,6)) the compiler is pretending that Int not a member of Ord, well what shall I do to solve this ? Thanks

    Read the article

  • Deploying web services on a RHEL 5 box using Apache/Tomcat/Axis/Java.

    - by Deepak Konidena
    Hi, I am new to the Web services scene. I currently have access to a RHEL5 box and i need to deploy a java web service on it. It runs apache and i know this because i have a website hosted on this machine. Now, i want to deploy a web service on to this website to be able to just pass a link to someone when they need to access my web service. Could someone point out a resource or explain what all i need to get the webservice deployed using Tomcat/Apache Axis and Java. I have done this on Windows (hosted on localhost) but couldn't quite figure out things on linux. Any help is greatly appreciated. Thanks. Deepak.

    Read the article

  • SP1 for MS-Windows Vista won't install because it requires SP1

    - by Randolf Richardson
    A laptop with Windows Vista (32-bit) installed (no viruses or SpyWare; the Sony Root Kit SpyWare was recently removed by MalwareBytes). It doesn't currently have Service Pack 1 installed, and although Windows Updates will download and execute it, the installation fails with an error indicating that Service Pack 1 is required. Has anyone encountered this problem and found a way to resolve it? I've tried rebooting, as well as clearing out the MS-Windows Update temporary download files (while shutting down the Windows Installer service), but the problem persists. Thanks in advance.

    Read the article

  • WCF Service error on IIS with metadata

    - by Bruno Silva
    Hi, I'm trying to publish a service to IIS, it builds and runs OK on the ASP.NET dev server. When running in IIS I can get to the metadata by navigating to the service or by adding service reference in Visual Studio. But when I call a method from my client app it crashes with a internal server error. So I went to the Event Log and found this: WebHost failed to process a request. Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/8810861 Exception: System.Web.HttpException (0x80004005): There was no channel actively listening at 'http://mysite.net/soundhubservice.svc/$metadata'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. ---> System.ServiceModel.EndpointNotFoundException: There was no channel actively listening at 'http://mysite.net/soundhubservice.svc/$metadata'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest() at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) Process Name: w3wp Process ID: 1080 My Web.Config looks something like this: <configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <services> <service name="SoundHub.Services.SoundHubService" behaviorConfiguration="StreamingServiceBehavior"> <host> <baseAddresses> <add baseAddress="http://localhost/SoundHubServive"/> </baseAddresses> </host> <endpoint address="service" binding="basicHttpBinding" bindingConfiguration="httpBuffering" contract="SoundHub.Services.ISoundHubService"/> <endpoint address="stream" binding="basicHttpBinding" bindingConfiguration="HttpStreaming" contract="SoundHub.Services.ISoundHubStreamService"/> <!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />--> </service> </services> <bindings> <basicHttpBinding> <binding name="HttpStreaming" maxReceivedMessageSize="67108864" transferMode="Streamed"/> <binding name="httpBuffering" transferMode="Buffered" /> </basicHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="StreamingServiceBehavior"> <serviceMetadata httpGetEnabled="True"/> <serviceDebug includeExceptionDetailInFaults="False"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> </configuration> Tried several combinations of settings I found while searching online but nothing helped, always the same error. Thanks Bruno

    Read the article

  • WCF service is not getting called

    - by Cheranga
    I have a web solution and I have a WCF service project inside it. We need to support "cookieless". so in the web.config, it's set as <sessionState mode="SQLServer" sqlConnectionString="Data Source=ds;Initial Catalog=db;User Id=uid;Password=pwd" allowCustomSqlDatabase="true" cookieless="true" timeout="720" regenerateExpiredSessionId="false"/> The WCF service will be supporting sessions, so we have also set "aspNetCompatibilityEnabled" to true in web.config. <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/> The service and interfaces are as follows, [ServiceContract(SessionMode=SessionMode.Allowed)] public interface ICDOCService { } [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class CDOCService : ICDOCService { } The problem we are facing is we cannot access the service from any client application. (web app, WCF test client) The following error is showing, when we access it via WCF Test client, Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service. The content type text/html; charset=UTF-8 of the response message does not match the content type of the binding (multipart/related; type="application/xop+xml"). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: <HTML> <HEAD> <link rel="alternate" type="text/xml" href="http://localhost:53721/Services/CDOCService.svc?disco"/> <STYLE type="text/css">#content{ FONT-SIZE: 0.7em; PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px; MARGIN-LEFT: 0px; COLOR: #000000; FONT-FAMILY: Verdana; BACKGROUND-COLOR: white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR: #000000; FONT-FAMILY: Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f0f0e0 1px solid; MARGIN-TOP: -5px; PADDING-LEFT: 5px; FONT-SIZE: 1.2em; PADDING-BOTTOM: 5px; BORDER-LEFT: #f0f0e0 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #f0f0e0 1px solid; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e5e5cc}.heading1{MARGIN-TOP: 0px; PADDING-LEFT: 15px; FONT-WEIGHT: normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 3px; MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #003366}.intro{MARGIN-LEFT: -15px} </STYLE> <TITLE>CDOCService Service</TITLE></HEAD><BODY><DIV id="content"><P '. Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at ICDOCService.GetCDOCCount(String institutionID, String mrnID, String userID, String callingSystemID, String securityToken) at CDOCServiceClient.GetCDOCCount(String institutionID, String mrnID, String userID, String callingSystemID, String securityToken)

    Read the article

  • ANDROID: inside Service class, executing a method for Toast (or Status Bar notification) from schedu

    - by Peter SHINe ???
    I am trying to execute a {public void} method in Service, from scheduled TimerTask which is periodically executing. This TimerTask periodically checks a condition. If it's true, it calls method via {className}.{methodName}; However, as Java requires, the method needs to be {pubic static} method, if I want to use {className} with {.dot} The problem is this method is for notification using Toast(Android pop-up notification) and Status Bar To use these notifications, one must use Context context = getApplicationContext(); But for this to work, the method must not have {static} modifier and resides in Service class. So, basically, I want background Service to evaluate condition from scheduled TimerTask, and execute a method in Service class. Can anyone help me what's the right way to use Service, invoking a method when certain condition is satisfied while looping evaluation? Here are the actually lines of codes: The TimerTask class (WatchClipboard.java) : public class WatchClipboard extends TimerTask { //DECLARATION private static GetDefinition getDefinition = new GetDefinition(); @Override public void run() { if (WordUp.clipboard.hasText()) { WordUp.newCopied = WordUp.clipboard.getText().toString().trim().toLowerCase(); if (!(WordUp.currentCopied.equals(WordUp.newCopied))) { WordUp.currentCopied = WordUp.newCopied; Log.v(WordUp.TAG, WordUp.currentCopied); getDefinition.apiCall_Wordnik(); FetchService.instantNotification(); //it requires this method to have {static} modifier, if I want call in this way. } } } } And the Service class (FetchService.java) : If I change the modifier to static, {Context} related problems occur public class FetchService extends Service { public static final String TAG = "WordUp"; //for Logcat filtering //DECLARATION private static Timer runningTimer; private static final boolean THIS_IS_DAEMON = true; private static WatchClipboard watchClipboard; private static final long DELAY = 0; private static final long PERIOD = 100; @Override public IBinder onBind(Intent arg0) { // TODO Auto-generated method stub return null; } @Override public void onCreate() { Log.v(WordUp.TAG, "FetchService.onCreate()"); super.onCreate(); //TESTING SERVICE RUNNING watchClipboard = new WatchClipboard(); runningTimer = new Timer("runningTimer", THIS_IS_DAEMON); runningTimer.schedule(watchClipboard, DELAY, PERIOD); } @Override public void onDestroy() { super.onDestroy(); runningTimer.cancel(); stopSelf(); Log.v(WordUp.TAG, "FetchService.onCreate().stopSelf()"); } public void instantNotification() { //If I change the modifier to static, {Context} related problems occur Context context = getApplicationContext(); // application Context //use Toast notification: Need to accept user interaction, and change the duration of show Toast toast = Toast.makeText(context, WordUp.newCopied+": "+WordUp.newDefinition, Toast.LENGTH_LONG); toast.show(); //use Status notification: need to automatically expand to show lines of definitions NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); int icon = R.drawable.icon; // icon from resources CharSequence tickerText = WordUp.newCopied; // ticker-text long when = System.currentTimeMillis(); // notification time CharSequence contentTitle = WordUp.newCopied; //expanded message title CharSequence contentText = WordUp.newDefinition; //expanded message text Intent notificationIntent = new Intent(this, WordUp.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); // the next two lines initialize the Notification, using the configurations above Notification notification = new Notification(icon, tickerText, when); notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent); mNotificationManager.notify(WordUp.WORDUP_STATUS, notification); } }

    Read the article

  • Order Unlocked iPhone 4S From Apple Online Store. $649, No Contract, Any Network.

    - by Gopinath
    Apple opened the flood gates of iPhone 4S! Now you can buy the unlocked iPhone 4S directly from Apple instead of buying them from grey market. The Apple US Online store has started accepting order for unlocked iPhone 4S and at the moment the expected shipping time is around 1 to 2 weeks. Price of the phones starts from $649 for 16GB and goes up to $849 for 64GB version. These unlocked phones are free from monthly contracts, works on any GSM network around the globe. Sorry CDMA networks, unlocked iPhone 4S is not yet ready for you! Its a good move from Apple. This helps people from staying away from multi-year contracts and also visitors returning from USA now can buy an original unlocked iPhone to use in their home countries. Buy iPhone 4S from Apple Online Store This article titled,Order Unlocked iPhone 4S From Apple Online Store. $649, No Contract, Any Network., was originally published at Tech Dreams. Grab our rss feed or fan us on Facebook to get updates from us.

    Read the article

  • How to achieve a loosely coupled REST API but with a defined and well understood contract?

    - by BestPractices
    I am new to REST and am struggling to understand how one would properly design a REST system to both allow for loose coupling but at the same time allow a consumer of a REST API to understand the API. If, in my client code, I issue a GET request for a resource and get back XML, how do I know what to do with that xml? e.g. if it contains <fname>John</fname><lname>Smith</lname> how do I know that these refer to the concept of "first name", "last name"? Is it up to the person writing the REST API to define in documentation some place what each of the XML fields mean? What if producer of the API wants to change the implementation to be <firstname> instead of <fname>? How do they do this and notify their consumers that this change occurred? Or do the consumers just encounter the error and then look at the payload and figure out on their own that it changed? I've read in REST in Practice that using a WADL tool to create a client implementation based on the WADL (and hide the fact that you're doing a distributed call) is an "anti-pattern". But I was planning to do this-- at least then I would have a statically typed API call that, if it changed, I would know at compile time and not at run time. Why is this a bad thing to generate client code based on a WADL? And how do I know what to do with the links that returned in the response of a POST to a REST API? What defines this contract and gives true meaning to what each link will do? Please help! I dont understand how to go from statically-typed or even SOAP/RPC to REST!

    Read the article

  • Long-term Freelance contract: should it have a salary-day or not?

    - by otto
    I don't like to speak about money. I just like to work. I still believe in a relationship between good work and good compensation. Hence I don't want ask my employer about my compensations, actually they are asking me. So I created a liberal contract with unspecified salary-day -- I did not want to lose my rights to my own projects and I did not pay any attention to the salary-day. Now the firm said that they would have paid me 1 month earlier if I had provided a tax -paper. I provided it before the next payment -day (unspecified). During the next month, the co-employer pretty much blocks my working -- does not allow me to access working repository and the co-employer goes to cruise when we should finalize a project so I cannot do anything. Now the project is not finalized, the co-employer has apparently provided some false statements to the boss about my doings (not getting anything for one month's work and 1 month when the co-employer pretty much wasted just my time) -- I was only allowed to debug the code of my co-employer and not to do anything. I feel that co-employer did not allow me to work by purpose so that they have an excuse not to pay any salary. The co-employer says that I cannot speak to the boss. The boss say that I need to speak directly to co-employer, not to him. I haven't said anything about the situation. I did not get things done because I was not allowed and now I am not even allowed to speak. Boss is the person who pays salaries. But both boss and co-employer have stages in the firm -- I think co-employer and boss are the same person pretty much, they created a theatre so that they get almost 2 month's work for free. Now I have multiple ideas how to avoid this kind of situations in the future: specify the salary day make sure you can speak directly to the manager and the boss, not through middle-hand other?

    Read the article

  • Duplicate C# web service proxy classes generated for Java types

    - by Sergey
    My question is about integration between a Java web service and a C# .NET client. Service: CXF 2.2.3 with Aegis databinding Client: C#, .NET 3.5 SP1 For some reason Visual Studio generates two C# proxy enums for each Java enum. The generated C# classes do not compile. For example, this Java enum: public enum SqlDialect { GENERIC, SYBASE, SQL_SERVER, ORACLE; } Produces this WSDL: <xsd:simpleType name="SqlDialect"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="GENERIC" /> <xsd:enumeration value="SYBASE" /> <xsd:enumeration value="SQL_SERVER" /> <xsd:enumeration value="ORACLE" /> </xsd:restriction> </xsd:simpleType> For this WSDL Visual Studio generates two partial C# classes (generated comments removed): [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")] [System.Runtime.Serialization.DataContractAttribute(Name="SqlDialect", Namespace="http://somenamespace")] public enum SqlDialect : int { [System.Runtime.Serialization.EnumMemberAttribute()] GENERIC = 0, [System.Runtime.Serialization.EnumMemberAttribute()] SYBASE = 1, [System.Runtime.Serialization.EnumMemberAttribute()] SQL_SERVER = 2, [System.Runtime.Serialization.EnumMemberAttribute()] ORACLE = 3, } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.3082")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://somenamespace")] public enum SqlDialect { GENERIC, SYBASE, SQL_SERVER, ORACLE, } The resulting C# code does not compile: The namespace 'somenamespace' already contains a definition for 'SqlDialect' I will appreciate any ideas...

    Read the article

< Previous Page | 86 87 88 89 90 91 92 93 94 95 96 97  | Next Page >