Search Results

Search found 8397 results on 336 pages for 'implementation'.

Page 126/336 | < Previous Page | 122 123 124 125 126 127 128 129 130 131 132 133  | Next Page >

  • Excel LINEST() in C#

    - by Newbie
    Hi am searching to find a proper implementation of LINEST function in C# given a set of x and y, but I've had no luck. Y X 1 10 2 20 3 12 4 15 etc. Please help. Thanks

    Read the article

  • Mocking a Wcf ServiceContract

    - by Michael
    I want to mock a ServiceContract. The problem is that Moq (and Castle Dynamic-Proxy) copies the attributes from the interface to the dynamic proxy which Wcf don't like. Wcf sais: The ServiceContractAttribute should only be define on either the interface or the implementation, not both.

    Read the article

  • AES Cipher Key Strength in BlackBerry

    - by Basilio
    Hi All, I need to create an application that decrypts data that is encrypted using AES with a 512-bit key. What I need to know is whether we can create an AES key of length 512-bits? The documentation says we can create a key of length up to 256-bits. If that is the case, is there any way that I can add my own implementation for 512-bit AES key, or will I have to reduce the key strength used to encrypt the data originally? Thanks, Basilio

    Read the article

  • How to detect which Space the user is on in Mac OS X Leopard?

    - by georgebrock
    Mac OS X Leopard has a virtual desktop implementation called Spaces. I want to programatically detect which space the user is currently on. Cocoa is preferable but AppleScript is acceptable if there's no other way. I've seen a couple of AppleScript implementations, but the techniques they used seemed a bit too hacky to use in production code (one relied on causing and error and then parsing the error message to get the current space, the other interrogated the Spaces menu GUI)

    Read the article

  • Is this an idiomatic way to pass mocks into objects?

    - by Billy ONeal
    I'm a bit confused about passing in this mock class into an implementation class. It feels wrong to have all this explicitly managed memory flying around. I'd just pass the class by value but that runs into the slicing problem. Am I missing something here? Implementation: namespace detail { struct FileApi { virtual HANDLE CreateFileW( __in LPCWSTR lpFileName, __in DWORD dwDesiredAccess, __in DWORD dwShareMode, __in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes, __in DWORD dwCreationDisposition, __in DWORD dwFlagsAndAttributes, __in_opt HANDLE hTemplateFile ) { return ::CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); } virtual void CloseHandle(HANDLE handleToClose) { ::CloseHandle(handleToClose); } }; } class File : boost::noncopyable { HANDLE hWin32; boost::scoped_ptr<detail::FileApi> fileApi; public: File( __in LPCWSTR lpFileName, __in DWORD dwDesiredAccess, __in DWORD dwShareMode, __in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes, __in DWORD dwCreationDisposition, __in DWORD dwFlagsAndAttributes, __in_opt HANDLE hTemplateFile, __in detail::FileApi * method = new detail::FileApi() ) { fileApi.reset(method); hWin32 = fileApi->CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); } }; namespace detail { struct FileApi { virtual HANDLE CreateFileW( __in LPCWSTR lpFileName, __in DWORD dwDesiredAccess, __in DWORD dwShareMode, __in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes, __in DWORD dwCreationDisposition, __in DWORD dwFlagsAndAttributes, __in_opt HANDLE hTemplateFile ) { return ::CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); } virtual void CloseHandle(HANDLE handleToClose) { ::CloseHandle(handleToClose); } }; } class File : boost::noncopyable { HANDLE hWin32; boost::scoped_ptr<detail::FileApi> fileApi; public: File( __in LPCWSTR lpFileName, __in DWORD dwDesiredAccess, __in DWORD dwShareMode, __in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes, __in DWORD dwCreationDisposition, __in DWORD dwFlagsAndAttributes, __in_opt HANDLE hTemplateFile, __in detail::FileApi * method = new detail::FileApi() ) { fileApi.reset(method); hWin32 = fileApi->CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); } ~File() { fileApi->CloseHandle(hWin32); } }; Tests: namespace detail { struct MockFileApi : public FileApi { MOCK_METHOD7(CreateFileW, HANDLE(LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE)); MOCK_METHOD1(CloseHandle, void(HANDLE)); }; } using namespace detail; using namespace testing; TEST(Test_File, OpenPassesArguments) { MockFileApi * api = new MockFileApi; EXPECT_CALL(*api, CreateFileW(Eq(L"BozoFile"), Eq(56), Eq(72), Eq(reinterpret_cast<LPSECURITY_ATTRIBUTES>(67)), Eq(98), Eq(102), Eq(reinterpret_cast<HANDLE>(98)))) .Times(1).WillOnce(Return(reinterpret_cast<HANDLE>(42))); File test(L"BozoFile", 56, 72, reinterpret_cast<LPSECURITY_ATTRIBUTES>(67), 98, 102, reinterpret_cast<HANDLE>(98), api); }

    Read the article

  • Are there any implementations of multiset for .Net?

    - by dangph
    I'm looking for a .Net implementation of a multiset. Can anyone recommend a good one? (A multiset, or bag, is a set that can have duplicate values, and on which you can do set operations: intersection, difference, etc. A shopping cart for instance could be thought of as a multiset because you can have multiple occurrences of the same product.)

    Read the article

  • Constructor Injection and when to use a Service Locator

    - by Simon
    I'm struggling to understand parts of StructureMap's usage. In particular, in the documentation a statement is made regarding a common anti-pattern, the use of StructureMap as a Service Locator only instead of constructor injection (code samples straight from Structuremap documentation): public ShippingScreenPresenter() { _service = ObjectFactory.GetInstance<IShippingService>(); _repository = ObjectFactory.GetInstance<IRepository>(); } instead of: public ShippingScreenPresenter(IShippingService service, IRepository repository) { _service = service; _repository = repository; } This is fine for a very short object graph, but when dealing with objects many levels deep, does this imply that you should pass down all the dependencies required by the deeper objects right from the top? Surely this breaks encapsulation and exposes too much information about the implementation of deeper objects. Let's say I'm using the Active Record pattern, so my record needs access to a data repository to be able to save and load itself. If this record is loaded inside an object, does that object call ObjectFactory.CreateInstance() and pass it into the active record's constructor? What if that object is inside another object. Does it take the IRepository in as its own parameter from further up? That would expose to the parent object the fact that we're access the data repository at this point, something the outer object probably shouldn't know. public class OuterClass { public OuterClass(IRepository repository) { // Why should I know that ThingThatNeedsRecord needs a repository? // that smells like exposed implementation to me, especially since // ThingThatNeedsRecord doesn't use the repo itself, but passes it // to the record. // Also where do I create repository? Have to instantiate it somewhere // up the chain of objects ThingThatNeedsRecord thing = new ThingThatNeedsRecord(repository); thing.GetAnswer("question"); } } public class ThingThatNeedsRecord { public ThingThatNeedsRecord(IRepository repository) { this.repository = repository; } public string GetAnswer(string someParam) { // create activeRecord(s) and process, returning some result // part of which contains: ActiveRecord record = new ActiveRecord(repository, key); } private IRepository repository; } public class ActiveRecord { public ActiveRecord(IRepository repository) { this.repository = repository; } public ActiveRecord(IRepository repository, int primaryKey); { this.repositry = repository; Load(primaryKey); } public void Save(); private void Load(int primaryKey) { this.primaryKey = primaryKey; // access the database via the repository and set someData } private IRepository repository; private int primaryKey; private string someData; } Any thoughts would be appreciated. Simon

    Read the article

  • Memory efficient int-int dict in Python

    - by Bolo
    Hi, I need a memory efficient int-int dict in Python that would support the following operations in O(log n) time: d[k] = v # replace if present v = d[k] # None or a negative number if not present I need to hold ~250M pairs, so it really has to be tight. Do you happen to know a suitable implementation (Python 2.7)? EDIT Removed impossible requirement and other nonsense. Thanks, Craig and Kylotan! To rephrase. Here's a trivial int-int dictionary with 1M pairs: >>> import random, sys >>> from guppy import hpy >>> h = hpy() >>> h.setrelheap() >>> d = {} >>> for _ in xrange(1000000): ... d[random.randint(0, sys.maxint)] = random.randint(0, sys.maxint) ... >>> h.heap() Partition of a set of 1999530 objects. Total size = 49161112 bytes. Index Count % Size % Cumulative % Kind (class / dict of class) 0 1 0 25165960 51 25165960 51 dict (no owner) 1 1999521 100 23994252 49 49160212 100 int On average, a pair of integers uses 49 bytes. Here's an array of 2M integers: >>> import array, random, sys >>> from guppy import hpy >>> h = hpy() >>> h.setrelheap() >>> a = array.array('i') >>> for _ in xrange(2000000): ... a.append(random.randint(0, sys.maxint)) ... >>> h.heap() Partition of a set of 14 objects. Total size = 8001108 bytes. Index Count % Size % Cumulative % Kind (class / dict of class) 0 1 7 8000028 100 8000028 100 array.array On average, a pair of integers uses 8 bytes. I accept that 8 bytes/pair in a dictionary is rather hard to achieve in general. Rephrased question: is there a memory-efficient implementation of int-int dictionary that uses considerably less than 49 bytes/pair?

    Read the article

  • Google Maps show location based on user inputs

    - by Kiran Badi
    Hi I have an web application where in I have 4 fields in the form, like streetname,nearest street,zip,state and country.Based on this I need to show the location of this address in the google maps.I have to implement this functionality for GoogleMaps/Bing/ and Yahoo maps. Can someone point to correct api's for these.This is my first implementation of maps,so need some inputs.Appreciate if someone can point me to right direction.

    Read the article

  • Reimplementing data structures in the real world

    - by Jason
    The topic of algorithms class today was reimplementing data structures, specifically ArrayList in Java. The fact that you can customize a structure for in various ways definitely got me interested, particularly with variations of add() & iterator.remove() methods. But is reimplementing and customizing a data structure something that is of more interest to the academics vs the real-world programmers? Has anyone reimplemented their own version of a data structure in a commercial application/program, and why did you pick that route over your particular language's implementation?

    Read the article

  • Could a truly random number be generated using pings to psuedo-randomly selected IP addresses?

    - by _ande_turner_
    The question posed came about during a 2nd Year Comp Science lecture while discussing the impossibility of generating numbers in a deterministic computational device. This was the only suggestion which didn't depend on non-commodity-class hardware. Subsequently nobody would put their reputation on the line to argue definitively for or against it. Anyone care to make a stand for or against. If so, how about a mention as to a possible implementation?

    Read the article

  • How to build a complex table by using CSS?

    - by Relax
    Recently i ran into a complex table implementation, for example: tr1: | td1 | td2 | td3 | tr2: | td1 | td2 | tr3: | td1 | td2 | ... As this example shows, i want td1 are fixed with different width, td3 is also width fixed but at the right, td2 are all width auto to expand when screen radio changed. I'm wondering if there is a way to do this by using CSS?

    Read the article

  • Which web crawler to use to save news articles from a website into .txt files?

    - by brokencoding
    Hi, i am currently in dire need of news articles to test a LSI implementation (it's in a foreign language, so there isnt the usual packs of files ready to use). So i need a crawler that given a starting url, let's say http://news.bbc.co.uk/ follows all the contained links and saves their content into .txt files, if we could specify the format to be UTF8 i would be in heaven. I have 0 expertise in this area, so i beg you for some sugestions in which crawler to use for this task.

    Read the article

  • When I really need to use [NSThread sleepForTimeInterval:1];

    - by Timbo
    Hi there, I have a program that needs to use sleep. Like really needs to. In lieu of spending ages explaining why, suffice to say that it needs it. Now I'm told to split off my code into a separate thread if it requires sleep so I don't lose interface responsiveness, so I've started learning how to use NSThread. I've created a brand new program that is conceptual so to solve the issue for this example will help me in my real program. Short story is I have a class, it has instance variables and I need a loop with a sleep to be depended on the value of that instance variable. Here's what I've put together anyway, your help is very much appreciated :) Cheers Tim /// Start Test1ViewController.h /// #import <UIKit/UIKit.h> @interface Test1ViewController : UIViewController { UILabel* label; } @property (assign) IBOutlet UILabel *label; @end /// End Test1ViewController.h /// /// Start Test1ViewController.m /// #import "Test1ViewController.h" #import "MyClass.h" @implementation Test1ViewController @synthesize label; - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; label.text = @"1"; [NSThread detachNewThreadSelector:@selector(backgroundProcess) toTarget:self withObject:nil]; } - (void)backgroundProcess { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // Create an instance of a class that will eventually store a whole load of variables MyClass *aMyClassInstance = [MyClass new]; [aMyClassInstance createMyClassInstance:(@"Timbo")]; while (aMyClassInstance.myVariable--) { NSLog(@"blah = %i",aMyClassInstance.myVariable); label.text = [NSString stringWithFormat:@"blah = %d", aMyClassInstance.myVariable]; //how do I pass the new value out to the updateLabel method, or reference aMyClassInstance.myVariable? [self performSelectorOnMainThread:@selector(updateLabel) withObject:nil waitUntilDone:NO]; //the sleeping of the thread is absolutely mandatory and must be worked around. The whole point of using NSThread is so I can have sleeps [NSThread sleepForTimeInterval:1]; } [pool release]; } - (void)updateLabel {label.text = [NSString stringWithFormat:@"blah = %d", aMyClassInstance.myVariable]; // be nice if i could } - (void)didReceiveMemoryWarning {[super didReceiveMemoryWarning];} - (void)viewDidUnload {} - (void)dealloc {[super dealloc];} @end /// End Test1ViewController.m /// /// Start MyClass.h /// #import <Foundation/Foundation.h> @interface MyClass : NSObject { NSString* name; int myVariable; } @property int myVariable; @property (assign) NSString *name; - (void) createMyClassInstance: (NSString*)withName; - (int) changeVariable: (int)toAmount; @end /// End MyClass.h /// /// Start MyClass.h /// #import "MyClass.h" @implementation MyClass @synthesize name, myVariable; - (void) createMyClassInstance: (NSString*)withName{ name = withName; myVariable = 10; } - (int) changeVariable: (int)toAmount{ myVariable = toAmount; return toAmount; } @end /// End MyClass.h ///

    Read the article

  • What would be the good name for this operation?

    - by Rogach
    I see that Scala standard library misses the method to get ranges of objects in the collection, that satisfy the predicate: def <???>(p: A => Boolean): List[List[A]] = { val buf = collection.mutable.ListBuffer[List[A]]() var elems = this.dropWhile(e => !p(e)) while (elems.nonEmpty) { buf += elems.takeWhile(p) elems = elems.dropWhile(e => !p(e)) } buf.toList } What would be the good name for such method? And is my implementation good enough?

    Read the article

  • How to tile a 30000 x 6000 image for a 480 x 320 screen?

    - by Horace Ho
    (this is related to another question about implementation on iPhone) I have a large image, size around 30000 (w) x 6000 (h) pixels. You may consider it's like a big map. I assume I need to crop it up into smaller tiles. Questions: what is the tile strategy? Requirements: whole image (though cropped) can be scrolled up/down/left/right by swipes zoom in (up to pixel-to-pixel) out (down to screen-fit-by-height) by the 2-finger operation memory efficiency by lazy loading tiles Thanks!

    Read the article

  • WS Libs: com.sun.xml vs javax.xml

    - by Zilvinas
    There are identical classes of java WebServices API & IMPL in those packages groups, only package names are different. http://mvnrepository.com/artifact/javax.xml http://mvnrepository.com/artifact/com.sun.xml Which ones should I use in my code? I would prefer NON-com.sun.* as per java conventions, but still my dependencies ( e.g. Spring ) are using implementations from com.sun.* OR I can't find an implementation package in javax.xml Does anyone have any experience on this?

    Read the article

  • Calling assignment operator in copy constructor

    - by stas
    Are there some drawbacks of such implementation of copy-constructor? Foo::Foo(const Foo& i_foo) { *this = i_foo; } As I remember, it was recommend in some book to call copy constructor from assignment operator and use well-known swap trick, but I don't remember, why...

    Read the article

  • Liferay - Custom Authentication Web Service

    - by Vishal G
    Hi, I want to use authentication web services that is exposed by my legacy client. But I cannot copy those user information in to liferay database. Can any one help me to write a custom authentication service OR a hook/plugin to reuse my own implementation for authentication? Regards Vishal G Pillai

    Read the article

  • Generic IBindingListView Implementations

    - by Brad Leach
    Can anyone suggest a good implementation of a generic collection class that implements the IBindingListView & IBindingList interfaces and provides Filtering and Searching capabilities? I see my current options as: Using a class that someone else has written and tested Inheriting from BindingList, and implementing the IBindingListView interfaces Write a custom collection from scratch, implementing IBindingListView and IBindingList. Obviously, the first option is my preferred choice. Thanking you.

    Read the article

< Previous Page | 122 123 124 125 126 127 128 129 130 131 132 133  | Next Page >