Search Results

Search found 244 results on 10 pages for 'wrappers'.

Page 1/10 | 1 2 3 4 5 6 7 8 9 10  | Next Page >

  • Generating Wrappers for REST APIs

    - by Kyle
    Would it be feasible to generate wrappers for REST APIs? An earlier question asked about machine readable descriptions of RESTful services addressed how we could write (and then read) API specifications in a standardized way which would lend itself well to generated wrappers. Could a first pass parser generate a decent wrapper that human intervention could fix up? Perhaps the first pass wouldn't be consistent, but would remove a lot of the grunt work and make it easy to flesh out the rest of the API and types. What would need to be considered? What's stopping people from doing this? Has it already been done and my google fu is weak for the day?

    Read the article

  • Should adapters or wrappers be unit tested?

    - by m3th0dman
    Suppose that I have a class that implements some logic: public MyLogicImpl implements MyLogic { public void myLogicMethod() { //my logic here } } and somewhere else a test class: public MyLogicImplTest { @Test public void testMyLogicMethod() { /test my logic } } I also have: @WebService public MyWebServices class { @Inject private MyLogic myLogic; @WebMethod public void myLogicWebMethod() { myLogic.myLogicMethod(); } } Should there be a test unit for myLogicWebMethod or should the testing for it be handled in integration testing.

    Read the article

  • Why would TCP wrappers stop working for sshd?

    - by toby1kenobi
    On a couple of CentOS 5 servers sshd seems to have become 'unwrapped' - previously I was using TCP wrappers and hosts.allow/hosts.deny to control access, but these are now not being used. If I execute $ldd /usr/sbin/sshd | grep libwrap $ it outputs nothing, whereas on servers where TCP wrappers are still working I see libwrap.so.0 => /lib64/libwrap.so.0 (0x00002b2fbcb81000) Does anyone know what might cause this, or how it could be rectified? Updated As requested: $ rpm -qV openssh-server S.5....T c /etc/pam.d/sshd S.?....T c /etc/ssh/sshd_config S.5..... /usr/sbin/sshd

    Read the article

  • Automatically creating C# wrappers from c headers?

    - by Winner
    Is there a way to automatically create p/invoke wrappers for .net from a c header? Of course I could create them by hand, but maintaining them would be painful, and I'd probably make a mistake somewhere resulting in hard to debug crashes. I tried SWIG, but it created full classes where simple structs would be sufficient. I'd prefer if the output worked on mono too, but that is not necessary.

    Read the article

  • Javascript wrappers for Twitter

    - by Ravi Vyas
    I am planning to build a JS based twitter client. Information about libraries/clients is pretty old on other SO Questions. I was wondering if anyone has come across wrappers other than Spaz and TwitterHelper. Thanks :-)

    Read the article

  • Eclipse Pydev: Supress no-self errors in python wrappers generated with swig

    - by Christian
    Hi, when generating python wrappers with swig the python wrapper classes in the generated python file do not have an explicit self parameter, for example see below: class PySwigIterator(_object): def value(*args): return _spatiotemporalnmf.PySwigIterator_value(*args) def incr(*args): return _spatiotemporalnmf.PySwigIterator_incr(*args) def decr(*args): return _spatiotemporalnmf.PySwigIterator_decr(*args) def distance(*args): return _spatiotemporalnmf.PySwigIterator_distance(*args) I am developing with the eclipse pluging Pydev. Pydev always shows an error when it detects a method without explicit self parameter. I am aware of two methods to get rid of the errors: First, disable error checking for the whole project in the Pydev preferences. Second, add a #@NoSelf to every line with an error. I don't want to use the first one, because I still want to get error warnings for my non-swig-generated files. Obviously the second one is also not very good, because I would have to do it by hand and every time I generate the file again, all #@NoSelfs will be gone. My Question now is, is there a better way to achieve this? Thanks

    Read the article

  • Using nested error wrappers with jQuery validate plugin

    - by RyOnLife
    I am using the jQuery validate plugin. My error labels are styled like tooltips and take many levels of nested divs in order to create. The plugin has a wrapper option that allows for an element type to be specified as a wrapper for the error message, but it's only wrapped once. Is anyone familiar with how to do nested wrapping? This isn't my exact markup, but as an example: <div class="tooltip"> <div> <div> <span class="error">This field is required.</span> </div> </div> </div> * UPDATE * The response from Chris answers my original question, but creates a new problem. The errors are now being displayed as desired, but the plugin fails to clear them. When a failed validation passes, span.error is set to display:none, but the div.tooltip nested wrapper still displays.

    Read the article

  • ExtAsp or Coolite - ASP.NET wrappers around ExtJs

    - by Jon
    Hi, We are a small Microsoft shop looking into ExtJs and like the rapid building of complex and structured UIs that can be achieved with the toolkit. However we have been experimenting with ExtAsp.NET (CodePlex) which is an opensource layer of ASP.NET code which wraps around the ExtJs framework. We have also noticed the Coolite framework which looks good too and does the same thing. We have 2 options, either we purchase the ExtJs license which will be required if we use ExtAsp, or we purchase the Coolite kit which includes the ExtJs license. It looks like Coolite is actually it little cheaper than the ExtJs for some reason?? However, is it a little more risky as regards upgrade path if the Coolite framework becomes unsupported, whereas ExtAsp as an open source solution will have community backing? Just looking to make the right step.

    Read the article

  • Wrappers of primitive types in arraylist vs arrays

    - by ismail marmoush
    Hi, In "Core java 1" I've read CAUTION: An ArrayList is far less efficient than an int[] array because each value is separately wrapped inside an object. You would only want to use this construct for small collections when programmer convenience is more important than efficiency. But in my software I've already used Arraylist instead of normal arrays due to some requirements, though "The software is supposed to have high performance and after I've read the quoted text I started to panic!" one thing I can change is changing double variables to Double so as to prevent auto boxing and I don't know if that is worth it or not, in next sample algorithm public void multiply(final double val) { final int rows = getSize1(); final int cols = getSize2(); for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { this.get(i).set(j, this.get(i).get(j) * val); } } } My question is does changing double to Double makes a difference ? or that's a micro optimizing that won't affect anything ? keep in mind I might be using large matrices.2nd Should I consider redesigning the whole program again ?

    Read the article

  • Decorator Pattern - Multiple wrappers or quantity property?

    - by Jiminizer
    I'm making use of the decorator pattern for one of the first times, as part of a Uni project. As far as I can see, the pattern seems to be meant more for adding functionality in a modular manner, however we've been taught it with uses such as a coffee or pizza maker, where the object has modular components that are added - changing properties rather than behaviour. I'm trying to make the most of both uses, however I've come up with a question. In the example in the book we're using (Head First Design Patterns), the pattern is used in a coffee shop creating different coffees. So, for example, milk, froth, sugar, sprinkles are all decorators. How would you implement a system that used the same decorator multiple times (for example, a coffee with two sugars)? Would you rewrap the coffee, or give sugar a quantity property? Or (as i'm starting to suspect) would this never be an issue as the pattern isn't designed to be used this way?

    Read the article

  • SQL-wrappers (activerecord) to recommened for python?

    - by Horace Ho
    is there an activerecord (any similar SQL-wrapper) for python? which is good for: used in a server-side python script light-weight supports MySQL what I need to do: insert (filename, file size, file md5, the file itself) into (string, int, string, BLOB) columns if the same file (checksum + filename) does not exist in db thx

    Read the article

  • C or C++: how do loaders/wrappers work?

    - by guitar-
    Here's an example of what I mean... User runs LOADER.EXE program LOADER.EXE downloads another EXE but keeps it all in memory without saving it to disk Runs the downloaded EXE just as it would if it were executed from disk, but does it straight from memory I've seen a few applications like this, and I've never seen an example or an explanation of how it works. Does anyone know? Another example is having an encrypted EXE embedded in another one. It gets extracted and decrypted in memory, without ever being saved to disk before it gets executed. I've seen that one used in some applications to prevent piracy.

    Read the article

  • Can I legally publish my Fortran 90 wrappers to nVidias CUFFT library (from CUDA SDK)?

    - by Jakub Narebski
    From a legal standpoint (licensing issues), can I legally in agreement with license publish Fortran 90 wrappers (bindings) to CUFFT library from nVidia CUDA Toolkit, under some open source license (either CC0 i.e. public domain, or some kind of permissive license like BSD). nVidia provides only C bindings with their CUDA SDK. Header files contain the following text: /* * Copyright 1993-2011 NVIDIA Corporation. All rights reserved. * * NOTICE TO LICENSEE: * * This source code and/or documentation ("Licensed Deliverables") are * subject to NVIDIA intellectual property rights under U.S. and * international Copyright laws. * * These Licensed Deliverables contained herein is PROPRIETARY and * CONFIDENTIAL to NVIDIA and is being provided under the terms and * conditions of a form of NVIDIA software license agreement by and * between NVIDIA and Licensee ("License Agreement") or electronically * accepted by Licensee. Notwithstanding any terms or conditions to * the contrary in the License Agreement, reproduction or disclosure * of the Licensed Deliverables to any third party without the express * written consent of NVIDIA is prohibited. The License.txt file includes the following fragment Source Code: Developer shall have the right to modify and create derivative works with the Source Code. Developer shall own any derivative works ("Derivatives") it creates to the Source Code, provided that Developer uses the Materials in accordance with the terms and conditions of this Agreement. Developer may distribute the Derivatives, provided that all NVIDIA copyright notices and trademarks are propagated and used properly and the Derivatives include the following statement: "This software contains source code provided by NVIDIA Corporation."

    Read the article

  • Can't get SFTP to work in PHP

    - by Chris Kloberdanz
    I am writing a simple SFTP client in PHP because we have the need to programatically retrieve files via n remote servers. I am using the PECL SSH2 extension. I have run up against a road block, though. The documentation on php.net suggests that you can do this: $stream = fopen("ssh2.sftp://$sftp/path/to/file", 'r'); However, I have an ls method that attempts to something similar public function ls($dir) { $rd = "ssh2.sftp://{$this->sftp}/$dir"; $handle = opendir($rd); if (!is_resource($handle)) { throw new SFTPException("Could not open directory."); } while (false !== ($file = readdir($handle))) { if (substr($file, 0, 1) != '.'){ print $file . "\n"; } } closedir($handle); } I get the following error: PHP Warning: opendir(): Unable to open ssh2.sftp://Resource id #5/outgoing on remote host This makes perfect sense because that's what happens when you cast a resource to string. Is the documentation wrong? I tried replacing the resource with host, username, and host and that didn't work either. I know the path is correct because I can run SFTP from the command line and it works fine. Has anyone else tried to use the SSH2 extenstion with SFTP? Am I missing something obvious here? UPDATE: I setup sftp on another machine in-house and it works just fine. So, there must be something about the server I am trying to connect to that isn't working.

    Read the article

  • C# wrapper for array of three pointers

    - by fergs
    I'm currently working on a C# wrapper to work with Dallmeier Common API light. See previous posting: http://stackoverflow.com/questions/2430089/c-wrapper-and-callbacks I've got pretty much everything 'wrapped' but I'm stuck on wrapping a callback which contains an array of three pointers & an array integers: dlm_setYUVDataCllback int(int SessionHandle, void (*callback) (long IPlayerID, unsigned char** yuvData, int* pitch, int width, int height, int64_t ts, char* extData)) Function Set callback, to receive current YUV image. Arguments SessionHandle: handle to current session. Return PlayerID (see callback). Callback - IPlayerId: id to the Player object - yuvData: array of three pointers to Y, U and V part of image The YUV format used is YUV420 planar (not packed). char *y = yuvData[0]; char *u = yuvData[1]; char *v = yuvData[2]; - pitch: array of integers for pitches for Y, U and V part of image - width: intrinsic width of image. - height - ts : timestamp of current frame - extData: additional data to frame How do I go about wrapping this in c#? Any help is much appreciated.

    Read the article

  • Custom stream wrappers, what could they be useful for in web applications?

    - by michael
    I suppose the concept is language agnostic, but I don't know what it's called in other languages. In PHP they're Stream Wrappers. In short, a wrapper class that allows manipulation of a streamable resource (resource that can be read to/written to/seek into, such as a file, a db, an url). For example, in a template engine (a view), upon including a template file such as: include "view.wrapper://path/to/my/template/file.phtml"; my custom wrapper, declared elsewhere and associated with "view.wrapper", would first intercepts the file to replace such things as short tags (<?=) with a more verbose counterpart (<?php echo). This allows developers to use short tags in views, even if the server isn't set to allow it. It can also be applied to the preprocessing of views pseudo syntax such as {@myVar} (e.g. replacing it with $this->myVar). This is only one application of custom stream wrappers, but the feature seems powerful enough to make me think that there are others that could make life a lot simpler for developers. What have you built, or thought about building, custom stream wrappers for? where have you seen some interesting implementations? I'm particularly interested in their applications in web development.

    Read the article

  • Hot to get rid of memory allocations/deallocations in swig wrappers?

    - by Dmitriy Matveev
    I want to use swig for generation of read-only wrappers for a complex object. The object which I want to wrap will always be existent while I will read it. And also I will only use my wrappers at the time that object is existent, thus I don't need any memory management from SWIG. For following swig interface: %module test %immutable; %inline %{ struct Foo { int a; }; struct Bar { int b; Foo f; }; %} I will have a wrappers which will have a lot of garbage in generated interfaces and do useless work which will reduce performance in my case. Generated java wrapper for Bar class will be like this: public class Bar { private long swigCPtr; protected boolean swigCMemOwn; protected Bar(long cPtr, boolean cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = cPtr; } protected static long getCPtr(Bar obj) { return (obj == null) ? 0 : obj.swigCPtr; } protected void finalize() { delete(); } public synchronized void delete() { if (swigCPtr != 0) { if (swigCMemOwn) { swigCMemOwn = false; testJNI.delete_Bar(swigCPtr); } swigCPtr = 0; } } public int getB() { return testJNI.Bar_b_get(swigCPtr, this); } public Foo getF() { return new Foo(testJNI.Bar_f_get(swigCPtr, this), true); } public Bar() { this(testJNI.new_Bar(), true); } } I don't need 'swigCMemOwn' field in my wrapper since it always will be false. All code related to this field will also be useless. There are also unnecessary logic in native code: SWIGEXPORT jlong JNICALL Java_some_testJNI_Bar_1f_1get(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jlong jresult = 0 ; struct Bar *arg1 = (struct Bar *) 0 ; Foo result; (void)jenv; (void)jcls; (void)jarg1_; arg1 = *(struct Bar **)&jarg1; result = ((arg1)->f); { Foo * resultptr = (Foo *) malloc(sizeof(Foo)); memmove(resultptr, &result, sizeof(Foo)); *(Foo **)&jresult = resultptr; } return jresult; } I don't need these calls to malloc and memmove. I want to force swig to resolve both of these problems, but don't know how. Is it possible?

    Read the article

  • Define a swig interface file for generation of wrapper to every type from some header file

    - by Dmitriy Matveev
    Hi! We're using some C library in our Java project. Several years ago some other developer which has retired few years ago (as always) has created all the wrappers for us. The wrappers were generated by the swig, but the interface file is lost now. The basic idea of library and the wrappers for it is following: There only one function which returns pointer to some complex object. And there are wrapper for that function. The complex object is a tree-like structure with dozens of node kinds and types (C structures) used to represent them. There are hundreds of wrappers for every field of every type and we're trying to use them all. The library was updated some time ago and now there are some new data we unaware of which yet, but would like to use. This data is contained in some of the objects indirectly contained or referenced from the object created by the function we call (Some new fields and types were added). I know that I shouldn't make any changes to the wrappers by hand and should rather modify the interface, but as I already wrote it's missing. For now I only want to generate wrappers some few types which are added/changed and them to our old wrappers, but later I want to start creation of interface file which will define "what and how should be wrapped". All the definitions necessary for us are defined in single header file. Is it possible to tell swig to generate wrappers for every type in this header? If so, how can I write such interface file?

    Read the article

  • Wrappers/law of demeter seems to be an anti-pattern...

    - by Robert Fraser
    I've been reading up on this "Law of Demeter" thing, and it (and pure "wrapper" classes in general) seem to generally be anti patterns. Consider an implementation class: class Foo { void doSomething() { /* whatever */ } } Now consider two different implementations of another class: class Bar1 { private static Foo _foo = new Foo(); public static Foo getFoo() { return _foo; } } class Bar2 { private static Foo _foo = new Foo(); public static void doSomething() { _foo.doSomething(); } } And the ways to call said methods: callingMethod() { Bar1.getFoo().doSomething(); // Version 1 Bar2.doSomething(); // Version 2 } At first blush, version 1 seems a bit simpler, and follows the "rule of Demeter", hide Foo's implementation, etc, etc. But this ties any changes in Foo to Bar. For example, if a parameter is added to doSomething, then we have: class Foo { void doSomething(int x) { /* whatever */ } } class Bar1 { private static Foo _foo = new Foo(); public static Foo getFoo() { return _foo; } } class Bar2 { private static Foo _foo = new Foo(); public static void doSomething(int x) { _foo.doSomething(x); } } callingMethod() { Bar1.getFoo().doSomething(5); // Version 1 Bar2.doSomething(5); // Version 2 } In both versions, Foo and callingMethod need to be changed, but in Version 2, Bar also needs to be changed. Can someone explain the advantage of having a wrapper/facade (with the exception of adapters or wrapping an external API or exposing an internal one).

    Read the article

  • Is there a tool I can use to generate interfaces and wrappers for object mocking in c#

    - by fostandy
    Given a class like System.Timers.Timer, or ANY managed class (whether user defined, from the .net framework, or some 3rd party library) is there some program I can use to (a) generate an interface based on this class and (b) generate a wrapper for the given class? for example if I have a public class Foo { public object MyProperty { get { ... } set { ... } } public int SomeMethod(object a) { ... } } it will create an interface interface IFoo { object MyProperty { get; set; } int SomeMethod(object a) { ... } } and maybe even a wrapper class FooWrap { // something for relay constructor here ... Foo _me; public object MyProperty { get { return _me.MyProperty; } set { _me.MyProperty = value; } } public int SomeMethod(object a) { return _me.SomeMethod(); } } Obviously there's stuff I haven't thought about like events, generics etc. I want a DWIMNWIS-PSICHTO(-Plus-Stuff-I-Clearly-Haven't-Thought-Of). I'm aware resharper can be used to extract an interface but I've only been able to use this on my own classes. Aside: Wow, it is amazing how simply becoming accustomed to a previously 'unacceptable' idea eventually gives it legitimacy. A year ago the idea of having to create interfaces for all objects I want to mock and adopting an injection framework would have seemed like the height of madness. It turns out that while it's not quite death and taxes, it is sparta. I am aware of and have used typemock. It certainly is the work of elvish wizards. One day when $800 does not seem like quite so much money I intend to buy it.

    Read the article

  • C++ STL: How to write wrappers for cout, cerr, cin and endl?

    - by Ashwin
    I do not like using namespace std, but I am also tired of having to type std:: in front of every cout, cin, cerr and endl. So, I thought of giving them shorter new names like this: // STLWrapper.h #include <iostream> #include <string> extern std::ostream& Cout; extern std::ostream& Cerr; extern std::istream& Cin; extern std::string& Endl; // STLWrapper.cpp #include "STLWrapper.h" std::ostream& Cout = std::cout; std::ostream& Cerr = std::cerr; std::istream& Cerr = std::cin; std::string _EndlStr("\n"); std::string& Endl = _EndlStr; This works. But, are there any problems in the above which I am missing? Is there a better way to achieve the same?

    Read the article

  • Practices for Foreground/Background threads in .NET

    - by Andrei Taptunov
    I work with in-house legacy communication framework which exposes some high level abstractions. These abstractions are wrappers with some logic around .NET threads. When I looked at code I've noticed that some abstractions are wrappers around foreground threads while others are wrappers around background threads. The sad thing is that I don't see any logic why in some cases foreground threads are used and background in other cases. Are there any guidelines or patterns & practices when it's better to choose one over another on server side and client side (I believe there should be some difference)?

    Read the article

  • REST or Non-REST on Internal Services

    - by tyndall
    I'm curious if others have chosen to implement some services internally at their companies as non-REST (SOAP, Thrift, Proto Buffers, etc...) as a way to auto-generate client libraries/wrappers? I'm on a two year project. I will be writing maybe 40 services over that period with my team. 10% of those services definitely make sense as REST services, but the other 90% feel more like they could be done in REST or RPC style. Of these 90%, 100% will be .NET talking to .NET. When I think about all the effort to have my devs develop client "wrappers" for REST services I cringe. WADL or RSDL don't seem to have enough mindshare. Thoughts? Any good discussions of this "internal service" issue online? If you have struggled with this what general rules for determining REST or non-REST have you used?

    Read the article

  • Is there a standard for machine-readable descriptions of RESTful services?

    - by ecmendenhall
    I've interacted with a few RESTful APIs that provided excellent documentation for humans and descriptive URIs, but none of them seem to return machine-readable descriptions of themselves. It's not too tough to write methods of my own that assemble the right paths, and many language-specific API libraries are already just wrappers around RESTful requests. But the next level of abstraction seems really useful: a library that could read in an API's own machine readable documentation and generate the wrappers automatically, perhaps with a call to some standard URI like base_url + '/documentation' Are there any standards for machine-readable API documentation? Am I doing REST wrong? I am a relatively new programmer, but this seems like a good idea.

    Read the article

1 2 3 4 5 6 7 8 9 10  | Next Page >