Search Results

Search found 1913 results on 77 pages for 'paul huff'.

Page 59/77 | < Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >

  • C#: How to unit test a method that relies on another method within the same class?

    - by michael paul
    I have a class similar to the following: public class MyProxy : ClientBase<IService>, IService { public MyProxy(String endpointConfiguration) : base(endpointConfiguration) { } public int DoSomething(int x) { int result = DoSomethingToX(x); //This passes unit testing int result2 = ((IService)this).DoWork(x) //do I have to extract this part into a separate method just //to test it even though it's only a couple of lines? //Do something on result2 int result3 = result2 ... return result3; } int IService.DoWork(int x) { return base.Channel.DoWork(x); } } The problem lies in the fact that when testing I don't know how to mock the result2 item without extracting the part that gets result3 using result2 into a separate method. And, because it is unit testing I don't want to go that deep as to test what result2 comes back as... I'd rather mock the data somehow... like, be able to call the function and replace just that one call.

    Read the article

  • C# Unit Testing: How do I set a Lazy<T>.ValueCreated to false?

    - by michael paul
    Basically, I have a unit test that gets a singleton instance of a class. Some of my tests required me to mock this singleton, so when I do Foo.Instance I get a different type of instance. The problem is that my checks are passing individually, but failing overall because one test is interfering with another. I tried to do a TestCleanup where I set: Foo_Accessor._instance = null; but that didn't work. What I really need is Foo_Accessor._instance.IsValueCreated = false; (_instance is a Lazy). Any way to unset the Lazy object that I didn't think of?

    Read the article

  • [Drupal] Image thumbnails as links

    - by Paul
    Hey all, im building a webshop in Drupal and i was wondering if you could help me with the following problem: I got one big image frame (500x500) and 5 little image thumbnails(95x95) underneath the big one. How can i realise that if the visitor clicks on the thumbnail, the big image frame gets filled with that specific image?

    Read the article

  • Adding folder to Eclipse classpath

    - by Paul
    Hello, When i develop a project i create a folder in my project called libs. And in this folder i place all the library jars that i use. Is there a way to add just the libs folder to the class path so that i do not have to add each individual jar? I was thinking something along the lines of a variable or creating a user library. Many thanks.

    Read the article

  • Create object of unknown class (two inherited classes)

    - by Paul
    I've got the following classes: class A { void commonFunction() = 0; } class Aa: public A { //Some stuff... } class Ab: public A { //Some stuff... } Depending on user input I want to create an object of either Aa or Ab. My imidiate thought was this: A object; if (/*Test*/) { Aa object; } else { Ab object; } But the compiler gives me: error: cannot declare variable ‘object’ to be of abstract type ‘A’ because the following virtual functions are pure within ‘A’: //The functions... Is there a good way to solve this?

    Read the article

  • Shell scripting and test expressions

    - by Paul
    Hi, I'm trying to test whether a directory path exists when a file is passed to my script. I use dirname to strip and save the path. I want my script to run only if the path exists. This is my attempt below. FILE=$1 DIRNAME=dirname $FILE if [ -z $DIRNAME ] ; then echo "Error no file path" exit 1 fi But this doesn't work. Actual when there is no file path dirname $FILE still returns "." to DIRNAME, i.e. this directory. So how do i distinguish between "." and "/bla/bla/bla". Thanks.

    Read the article

  • compareTo() method java is acting weird

    - by Ron Paul
    hi im having trouble getting this to work im getting an error here with my object comparison...how could I cast the inches to a string ( i never used compare to with anything other than strings) , or use comparison operators to compare the intigers, Object comparison = this.inches.compareTo(obj.inches); here is my code so far import java.io.*; import java.util.*; import java.lang.Integer; import java.lang.reflect.Array; public class Distance implements Comparable<Distance> { private static final String HashCodeUtil = null; private int feet; private int inches; private final int DEFAULT_FT = 1; private final int DEFAULT_IN = 1; public Distance(){ feet = DEFAULT_FT; inches = DEFAULT_IN; } public Distance(int ft, int in){ feet = ft; inches = in; } public void setFeet(int ft){ try { if(ft<0){ throw new CustomException("Distance is not negative"); } } catch(CustomException c){ System.err.println(c); feet =ft; } } public int getFeet(){ return feet; } public void setInches(int in){ try { if (in<0) throw new CustomException("Distance is not negative"); //inches = in; } catch(CustomException c) { System.err.println(c); inches = in; } } public int getInches(){ return inches; } public String toString (){ return "<" + feet + ":" + inches + ">"; } public Distance add(Distance m){ Distance n = new Distance(); n.inches = this.inches + m.inches; n.feet = this.feet + m.feet; while(n.inches>12){ n.inches = n.inches - 12; n.feet++; } return n; } public Distance subtract(Distance f){ Distance m = new Distance(); m.inches = this.inches - f.inches; m.feet = this.feet - f.feet; while(m.inches<0){ m.inches = m.inches - 12; feet--; } return m; } @Override public int compareTo(Distance obj) { // TODO Auto-generated method stub final int BEFORE = -1; final int EQUAL = 0; final int AFTER = 1; if (this == obj) return EQUAL; if(this.DEFAULT_IN < obj.DEFAULT_FT) return BEFORE; if(this.DEFAULT_IN > obj.DEFAULT_FT) return AFTER; Object comparison = this.inches.compareTo(obj.inches); if (this.inches == obj.inches) return compareTo(null); assert this.equals(obj) : "compareTo inconsistent with equals"; return EQUAL; } @Override public boolean equals( Object obj){ if (obj != null) return false; if (!(obj intanceof Distance)) return false; Distance that = (Distance)obj; ( this.feet == that.feet && this.inches == that.inches); return true; else return false; } @Override public int hashCode(int, int) { int result = HashCodeUtil.inches; result = HashCodeUtil.hash(result, inches ); result = HashCodeUtil.hash(result, feet); ruturn result; }

    Read the article

  • ASP.NET MVC subdomain shows folder name

    - by Paul
    Hi, I'm using godaddy shared hosting, with IIS7, Integrated mode, and published up a bog standard MVC2 app to dev.lazygekko.com created with Visual Web Developer 2010. It all works, however when any of the links are clicked, they point to dev.lazygekko.com/dev/..., dev being the folder it is pointing at. Can anyone shed some light on what I may be doing wrong? Many thanks.

    Read the article

  • How can I add file locations to a database after they are uploaded using a Perl CGI script?

    - by Paul K
    I have a CGI program I have written using Perl. One of its functions is to upload pics to the server. All of it is working well, including adding all kinds of info to a MySQL db. My question is: How can I get the uploaded pic files location and names added to the db? I would rather that instead of changing the script to actually upload the pics to the db. I have heard horror stories of uploading binary files to databases. Since I am new to all of this, I am at a loss. Have tried doing some research and web searches for 3 weeks now with no luck. Any suggestions or answers would be greatly appreciated. I would really hate to have to manually add all the locations/names to the db. I am using: a Perl CGI script, MySQL db, Linux server and the files are being uploaded to the server. I AM NOT looking to add the actual files to the db. Just their location(s).

    Read the article

  • Disable redirect in fb:request-form Send/Cancel button

    - by Colossal Paul
    How do I disable the redirect in Facebook's invite form? <fb:serverfbml style="width: 600px; height: 650px;"> <script type="text/fbml"> <fb:request-form action="index.php" method="POST" invite="true" type="MyApp" content="Please have a look. <fb:req-choice url='http://apps.facebook.com/myapp/' label='View Now!' />"> <div class="clearfix" style="padding-bottom: 10px;"> <fb:multi-friend-selector condensed="true" style="width: 600px;" /> </div> <fb:request-form-submit /> </fb:request-form> After selecting friends, you will see the final Send Invite dialog with your template. After you click send or cancel, how do i disable the redirect by just closing the the dialog? Thanks.

    Read the article

  • padding not shifting my logo

    - by paul smith
    I have a logo link that's using a background-image (css sprite). All works fine, but when I try to add a 20px padding to the top of the link (to give it more space for user to click the link), the background image is not moving down. Here is my css: a { background-image:url("sprite.png"); background-repeat:no-repeat; display:block; height:70px; width:70px; padding-top:20px; /* give top of the link more click space */ } And my html: <a href="#" style="background-position:0 0;"></a> What am I doing wrong?

    Read the article

  • Combine First, Middle Initial, Last name and Suffix in T-SQL (No extra spaces)

    - by Paul
    I'm trying not to reinvent the wheel here...I have these four fields [tbl_Contacts].[FirstName], [tbl_Contacts].[MiddleInitial], [tbl_Contacts].[LastName], [tbl_Contacts].[Suffix] And I want to create a FullName field in a view, but I can't have extra spaces if fields are blank...So I can't do FirstName + ' ' + MiddleInitial + ' ' + LastName + ' ' + Suffix...Because if there is no middle initial or suffix I'd have 2 extra spaces in the field. I think I need a Case statement, but I thought someone would have a handy method for this...Also, the middleinitial and suffix may be null.

    Read the article

  • Opening a streaming connection to an HTTP server on iPhone/Cocoa environment?

    - by Paul
    I've been using NSURLConnection to do a HTTP post to establish the connection. I've also implemented the didReceiveData delegagate to process incoming bytes as they become available. As incoming data comes in via didReceiveData, I add the NSData to a data buffer and try parsing the bytesteam if enough data has come in to complete a message segment. I'm having a hard time managing the data buffer (NSMutableData object) to remove bytes that have been parsed to structs. Was curious if there's an easier way. Thanks

    Read the article

  • Is it possible to deny access to SQL Server from specific programs?

    - by Paul McLoughlin
    Currently one of our databases (SQL Server 2008) is accessed via a number of different mechanisms: .Net SqlClient Data Provider; SQL Server Management Studio; various .Net applications and 2007 Microsoft Office system (basically Excel). I see that in the sys.dm_exec_sessions DMV it is possible to see the program name of the program accessing the database for the current sessions. My question is: is it possible for one to deny access from a particular named program? First prize would be if this could be done for any named program, but we would gain a great deal of benefit from being able to deny access to this specific database from all Microsoft Office applications (especially Excel).

    Read the article

  • Can I Define Exceptions to Eclipse cleanup rules?

    - by Henrik Paul
    Most often the cleanup rules (Preferences Java Code Style Clean Up) in Eclipse work perfectly and create nice-looking code. But sometimes, especially with comments and concatenated string snippets (like inline SQL queries), the cleanup just messes things up, and destroys my formatting. Is there a way to say to Eclipse "Don't touch this block of text! I have formatted it just the way I like, and you would make it just less readable"?

    Read the article

  • Getting a divs z-index to overlap a div with absolute positioning

    - by Paul Herron
    Does anyone know how I could get the logo at the top of my page to appear on top of the curtains. http://nuigums.tumblr.com/ The logo is within a section tag along with the rest of the content with a z-index of 2, which is required to get the footer reveal effect I want. The curtain has a z-index of 3. I tried setting the z-index of the logo div to 4 but I presume the fact that the sections styling overrides that? I would like the logo to scroll with the content of the page also. Thanks. :)

    Read the article

  • Checking sqlite datetime NULL with RoR

    - by Paul N
    RoR/SQL newbie here. My datetime column 'deleted_at' are all uninitialized. Running this query returns an error: SELECT * FROM variants v ON v.id = ovv0.variant_id INNER JOIN option_values_variants ovv1 ON v.id = ovv1.variant_id INNER JOIN option_values_variants ovv2 ON v.id = ovv2.variant_id INNER JOIN option_values_variants ovv3 ON v.id = ovv3.variant_id INNER JOIN option_values_variants ovv4 ON v.id = ovv4.variant_id WHERE v.deleted_at = NULL AND v.product_id = 1060500595 However, if I set my datetime values to 0, and set my query to v.deleted_at = 0, the correct variant is returned to me. How do I check for uninitialized/NULL datetimes?

    Read the article

  • SQL change "like" to "contains"

    - by Paul
    products table (mySQL) record_id categories (comma-delimited list) --------- -------------------------------- 1 960|1,957|1,958|1 I have the following dynamic query (simplified for the purposes of this question). The query is passed specified categories, each in the format xxxx|yyyy, and I need to return products having the passed category in its comma-delimited list of categories. The current query looks like: select p.* from products p where (p.categories like '%27|0%' or p.categories like '%972|1%' or p.categories like '%969|1%') But, the LIKE clause sometimes permits anomalies. I would like to write the query more like: select p.* from products p where (p.categories contains '27|0' or p.categories contains'972|1' or p.categories contains '969|1') How would I do this?

    Read the article

  • Difference Between Two Lists with Many Duplicates in Python

    - by Paul
    I have several lists that contain many of the same items and many duplicate items. I want to check which items in one list are not in the other list. For example, I might have one list like this: l1 = ['a', 'b', 'c', 'b', 'c'] and one list like this: l2 = ['a', 'b', 'c', 'b'] Comparing these two lists I would want to return a third list like this: l3 = ['c'] I am currently using some terrible code that I made a while ago that I'm fairly certain doesn't even work properly shown below. def list_difference(l1,l2): for i in range(0, len(l1)): for j in range(0, len(l2)): if l1[i] == l1[j]: l1[i] = 'damn' l2[j] = 'damn' l3 = [] for item in l1: if item!='damn': l3.append(item) return l3 How can I better accomplish this task?

    Read the article

  • Website hosting from home - IIS6 [closed]

    - by Paul
    I'm wanting to host a few websites from home, primarily because I'm using some BETA Microsoft software (.NET 4 and EF) and don't want to install it on my production server which is hosted at eukhost.com. Basically, I'm completely new to this sort of thing. So far, here is what I've done: Registered the domain name at namecheap.com (let's call it mydomain.com) Gone to "Nameserver Registration" in the panel and entered my IP address for the NS1 and NS2 records (let's say the IP is 0.0.0.0). Gone to "Domain Name Server Setup" and entered ns1.mydomain.com & ns2.mydomain.com Forwarded requests from port 80 to my internal IP (let's say 192.168.1.254) Created the website in IIS (I'm just testing with a single website so far, so have not created any host header values) Now, if I type in the IP address (http://0.0.0.0) I get the site as expected. However, if I enter http://www.mydomain.com I get an error saying "DNS Error - Cannot find server". I'm aware that there is a service from DynDNS that will automatically change the IP if I have a dynamic address, however my IP has remained static since I installed the ISP (since October) so I don't need this. Is there any way that I can get the DNS to work just by configuring IIS or something in Windows? I don't really want to have to pay for any 3rd party service. Thanks,

    Read the article

  • MATLAB, time match filter

    - by Paul
    OK, I am still getting the hang of MATLAB. I have two files in different format. One Excel file. data1.xls, size= 86400 X 62. It looks like: Date/Time par1 par2 par3 par4 par5 par6 par6 par7 par8 par9 08/02/09 00:06:45 0 3 27 9.9 -133.2 0 0 0 1 0 Another file, data2.csv, size = 144 X 27. (If nothing is missing.) It looks like: date time P01 P02 P03 P04 P05 P06 P07 P08 P09 P10 P11 8/16/2009 0:00 51 45 46 54 53 52 524 5 399 89 78 Now I am using Data10minAvg = mean(reshape(Data,300,144,62)); to get the 10 min average of the first Excel file. Now I need to match up that file I am making above with the .csv file. The problem is many timestamps are missing in the .csv file. How do I make data2.csv into a file of size 144 X 27, replacing the missing datestamps by rows of zero? It will really help me than compare data1.xls file with newdata2.csv.

    Read the article

  • When is (true == x) === !!x false?

    - by Paul S.
    JavaScript has different equality comparison operators Equal == Strict equal === It also has a logical NOT ! and I've tended to think of using a double logical NOT, !!x, as basically the same as true == x. However I know this is not always the case, e.g. x = [] because [] is truthy for ! but falsy for ==. So, for which xs would (true == x) === !!x give false? Alternatively, what is falsy by == but not !! (or vice versa)?

    Read the article

< Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >