Search Results

Search found 4765 results on 191 pages for 'gh unit'.

Page 118/191 | < Previous Page | 114 115 116 117 118 119 120 121 122 123 124 125  | Next Page >

  • Method parameters confusion

    - by elec
    Often time methods take more than 3 parameters which are all of the same type, eg. void mymethod (String param1, String param2, String param3) then it's very easy for the client to mix up the parameters orders, for instance inverting param1 and param2: mymethod (param2, param1, param3); ...which can be the cause of much time spent debugging what should be a trivial matter. Any tips on how to avoid this sort of mistake (apart from unit tests) ?

    Read the article

  • Group properties in custom control

    - by Gunners98
    I want to do a class that have properties like font, which will have other properties, such as name, size, unit,bold.I had tried a solution but it isn't working for me.(http://stackoverflow.com/questions/755391/group-properties-in-a-custom-control) Anyone can help? Any help will be appreciated. <TypeConverter(GetType(ExpandableObjectConverter))> _ Class TestingClass 'Some property here End Class

    Read the article

  • gcc check if file is main (#if __BASE_FILE__ == __FILE__)

    - by Marcin Raczkowski
    Hello. In ruby there's very common idiom to check if current file is "main" file: if __FILE__ == $0 # do something here (usually run unit tests) end I'd like to do something similar in C after reading gcc documentation I've figured that it should work like this: #if __FILE__ == __BASE_FILE__ // Do stuff #endif the only problem is after I try this: $ gcc src/bitmap_index.c -std=c99 -lm && ./a.out src/bitmap_index.c:173:1: error: token ""src/bitmap_index.c"" is not valid in preprocessor expressions Am I using #if wrong?

    Read the article

  • I need to modify a program to use arrays and a method call. Should I modify the running file, the data collection file, or both?

    - by g3n3rallyl0st
    I have to have multiple classes for this program. The problem is, I don't fully understand arrays and how they work, so I'm a little lost. I will post my program I have written thus far so you can see what I'm working with, but I don't expect anyone to DO my assignment for me. I just need to know where to start and I'll try to go from there. I think I need to use a double array since I will be working with decimals since it deals with money, and my method call needs to calculate total price for all items entered by the user. Please help: RUNNING FILE package inventory2; import java.util.Scanner; public class RunApp { public static void main(String[] args) { Scanner input = new Scanner( System.in ); DataCollection theProduct = new DataCollection(); String Name = ""; double pNumber = 0.0; double Units = 0.0; double Price = 0.0; while(true) { System.out.print("Enter Product Name: "); Name = input.next(); theProduct.setName(Name); if (Name.equalsIgnoreCase("stop")) { return; } System.out.print("Enter Product Number: "); pNumber = input.nextDouble(); theProduct.setpNumber(pNumber); System.out.print("Enter How Many Units in Stock: "); Units = input.nextDouble(); theProduct.setUnits(Units); System.out.print("Enter Price Per Unit: "); Price = input.nextDouble(); theProduct.setPrice(Price); System.out.print("\n Product Name: " + theProduct.getName()); System.out.print("\n Product Number: " + theProduct.getpNumber()); System.out.print("\n Amount of Units in Stock: " + theProduct.getUnits()); System.out.print("\n Price per Unit: " + theProduct.getPrice() + "\n\n"); System.out.printf("\n Total cost for %s in stock: $%.2f\n\n\n", theProduct.getName(), theProduct.calculatePrice()); } } } DATA COLLECTION FILE package inventory2; public class DataCollection { String productName; double productNumber, unitsInStock, unitPrice, totalPrice; public DataCollection() { productName = ""; productNumber = 0.0; unitsInStock = 0.0; unitPrice = 0.0; } //setter methods public void setName(String name) { productName = name; } public void setpNumber(double pNumber) { productNumber = pNumber; } public void setUnits(double units) { unitsInStock = units; } public void setPrice(double price) { unitPrice = price; } //getter methods public String getName() { return productName; } public double getpNumber() { return productNumber; } public double getUnits() { return unitsInStock; } public double getPrice() { return unitPrice; } public double calculatePrice() { return (unitsInStock * unitPrice); } }

    Read the article

  • Hibernate/Spring: getHibernateTemplate().save(...) Freezes/Hangs

    - by ashes999
    I'm using Hibernate and Spring with the DAO pattern (all Hibernate dependencies in a *DAO.java class). I have nine unit tests (JUnit) which create some business objects, save them, and perform operations on them; the objects are in a hash (so I'm reusing the same objects all the time). My JUnit setup method calls my DAO.deleteAllObjects() method which calls getSession().createSQLQuery("DELETE FROM <tablename>").executeUpdate() for my business object table (just one). One of my unit tests (#8/9) freezes. I presumed it was a database deadlock, because the Hibernate log file shows my delete statement last. However, debugging showed that it's simply HibernateTemplate.save(someObject) that's freezing. (Eclipse shows that it's freezing on HibernateTemplate.save(Object), line 694.) Also interesting to note is that running this test by itself (not in the suite of 9 tests) doesn't cause any problems. How on earth do I troubleshoot and fix this? Also, I'm using @Entity annotations, if that matters. Edit: I removed reuse of my business objects (use unique objects in every method) -- didn't make a difference (still freezes). Edit: This started trickling into other tests, too (can't run more than one test class without getting something freezing) Transaction configuration: <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <tx:advice id="txAdvice" transaction-manager="txManager"> <!-- the transactional semantics... --> <tx:attributes> <!-- all methods starting with 'get' are read-only --> <tx:method name="get*" read-only="true" /> <tx:method name="find*" read-only="true" /> <!-- other methods use the default transaction settings (see below) --> <tx:method name="*" /> </tx:attributes> </tx:advice> <!-- my bean which is exhibiting the hanging behavior --> <aop:config> <aop:pointcut id="beanNameHere" expression="execution(* com.blah.blah.IMyDAO.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="beanNameHere" /> </aop:config>

    Read the article

  • Codeigniter: user defined helper function does not load.

    - by cbrandolino
    Hi everybody. I made a custom helper extending the system string_helper.php. I placed it in my /application/helpers folder, called MY_string_helper.php as required, unit-tested its functions. Now, when I try to call one of its functions from a model, it does not work. The functions in the default string helper work, instead. It looks like my extension is not loaded for some reasons. Thanks a lot, and happy holidays.

    Read the article

  • how to retain exact numbers that come from Access Database

    - by Shiny
    MY scenario is... I have 6,000 datas in Excel Sheet.. I try to import to Access Database.It enters the Database like this.. UNit Price 34512.00 Vat 4.00 BUt when i Retrieve to DataGridColumn it Shows vat Rate as 4(whole number).I accept zeros has no values..But I need that to be displayed in Grid as 4.0 . How to achieve this

    Read the article

  • How do I calculate the average direction of two vectors

    - by Mike Broughton
    Hi, I am writing and opengl based iphone app and would like to allow a user to translate around a view based on the direction that they move two fingers on the screen. For one finger I know I could just calculate the vector from the start position to the current position of the users finger and then find the unit vector of this to get just the direction, but I don't know how I would do this for two fingers, I don't think adding the components of the vectors and calculating the average would work so I'm pretty much stuck... thanks in advance

    Read the article

  • Stop running this script, IE7 using PHP

    - by Jomel Dicen
    I incorporate javascript in my PHP program: Try to check my codes. It loops depend on the number of records in database. for instance: $counter = 0; foreach($row_value as $data): echo $this->javascript($counter, $data->exrate, $data->tab); endforeach; private function javascript($counter=NULL, $exrate=NULL, $tab=NULL){ $js = " <script type='text/javascript'> $(function () { var textBox0 = $('input:text[id$=quantity{$counter}]').keyup(foo); var textBox1 = $('input:text[id$=mc{$counter}]').keyup(foo); var textBox2 = $('input:text[id$=lc{$counter}]').keyup(foo); function foo() { var value0 = textBox0.val(); var value1 = textBox1.val(); var value2 = textBox2.val(); var sum = add(value1, value2) * (value0 * {$exrate}); $('input:text[id$=result{$counter}]').val(parseFloat(sum).toFixed(2)); // Compute Total Quantity var qtotal = 0; $('.quantity{$tab}').each(function() { qtotal += Number($(this).val()); }); $('#tquantity{$tab}').text(qtotal); // Compute MC UNIT var mctotal = 0; $('.mc{$tab}').each(function() { mctotal += Number($(this).val()); }); $('#tmc{$tab}').text(mctotal); // Compute LC UNIT var lctotal = 0; $('.lc{$tab}').each(function() { lctotal += Number($(this).val()); }); $('#tlc{$tab}').text(lctotal); // Compute Result var result = 0; $('.result{$tab}').each(function() { result += Number($(this).val()); }); $('#tresult{$tab}').text(result); } function add() { var sum = 0; for (var i = 0, j = arguments.length; i < j; i++) { if (IsNumeric(arguments[i])) { sum += parseFloat(arguments[i]); } } return sum; } function IsNumeric(input) { return (input - 0) == input && input.length > 0; } }); </script> "; return $js; } When I running this on IE this message is always annoying me " Stop running this script? A script on this page is causing your web browser to run slowly. If it continues to run, your computer might become unresponsive." but in firefox it's functioning well.

    Read the article

  • Why is my custom view not appearing?

    - by user351469
    When I comment out setContentView(boardView); in my Game.java my custom view in BoardView works fine and displays everything nicely... but onSizeChanged never gets called in BoardView.java... so I can't read the device width and height at runtime. If I leave setContentView uncommented onSizeChanged works... but the screen is blank! I want to be able to read the screen width and height at runtime and set the sizes of my ImageViews at creation so they are the optimal size. public class Game extends Activity implements OnClickListener{ private BoardView boardView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); boardView = new BoardView(this); setContentView(boardView); // when this line disabled, it looks ok boardView.requestFocus(); } public class BoardView extends View { private final Game game; private float width; // width of one unit private float height; // height of one unit public BoardView(Context context){ super(context); this.game = (Game)context; setFocusable(true); setFocusableInTouchMode(true); LinearLayout maincontainer = new LinearLayout(game); maincontainer.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); maincontainer.setGravity(Gravity.CENTER); maincontainer.setOrientation(LinearLayout.VERTICAL); maincontainer.setBackgroundColor(Color.BLACK); LinearLayout innercontainer = new LinearLayout(game); innercontainer.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); innercontainer.setGravity(Gravity.CENTER); innercontainer.setOrientation(LinearLayout.HORIZONTAL); // declare a new table TableLayout layout = new TableLayout(game); layout.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); // build a grid of ImageViews in a TableLayout for (int f=1; f<=7; f++) { TableRow tr = new TableRow(game); for (int c=1; c<=7; c++) { ImageView b = new ImageView(game); b.setImageResource(R.drawable.neworb); b.setOnClickListener(game); tr.addView(b, 30,30); // I'd like to not use fixed values here } // for layout.addView(tr); } // for innercontainer.addView(layout); maincontainer.addView(innercontainer); game.setContentView(maincontainer); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh){ width = w/9f; height = width; super.onSizeChanged(w, h, oldw, oldh); } }

    Read the article

  • How can I run Gcov over an installed Cocoa application?

    - by Joe
    I have a Cocoa application which uses an installer. I want to be able to run code coverage over the code (after it has been installed). This is not the usual unit-test scenario where a single binary will run a suite of tests. Rather, the tests in question will interact with the UI and the app back-end whilst it is running, so I ideally want to be able to start the application knowing that Gcov is profiling it and then run tests against it. Any ideas?

    Read the article

  • Accessing Custom Configurations in NUnit class

    - by Martin Ongtangco
    I'm really banging my head onto this one. I can't make the Custom Configuration to work with NUnit. It kept on failing to read the configuration file. I followed carefully this article: http://devlicio.us/blogs/derik_whittaker/archive/2006/11/13/app-config-and-custom-configuration-sections.aspx placed the references in the Unit test class App.Config, still everything failed. Is there some sort of a magic setting to do here?

    Read the article

  • Strange eclipse error

    - by Gandalf StormCrow
    Has anyone expirience this error before: this happens when I hit CTRL + space , here is the error : For those who has tinyurl blocked: This compilation unit is not on the build path of the java project. This is a maven project, mvn eclipse:eclipse doesn't help I mean it compiles and runs just fine just something is wrong and I can't figure out what. I checkouted this project from SVN, it wasn't developed on my PC.

    Read the article

  • Delphi: Which are the downsides of having unused units listed in the uses clause?

    - by user193655
    I use cnPack Uses cleaner, but in general which are the downsides of having useless units? I know some of them: 1) of course if the unit is never used across the full project there will be useless resource consuption 2) the code insight will give useless results 3) the code insight will be slower But imagine a simple case: I have a project with 2 forms, I use StrUtils in one of them but I declared StrUtils in both of them... Is there any downside in temrs of memory consumption in this case or not?

    Read the article

  • Speed up PostGreSQL createdb?

    - by John
    Is there a way to speed up PostgreSQL's createdb command? Normally I wouldn't care, but doing unit testing in Django creates a database every time, and it takes about 5 seconds. I'm using openSUSE 11.2 64-bit, PostgreSQL 8.4.2

    Read the article

  • How do I combine two interfaces when creating mocks?

    - by sduplooy
    We are using Rhino Mocks to perform some unit testing and need to mock two interfaces. Only one interface is implemented on the object and the other is implemented dynamically using an aspect-oriented approach. Is there an easy way to combine the two interfaces dynamically so that a mock can be created and the methods stubbed for both interfaces?

    Read the article

  • Does there exists a method to render an object using DebuggerDisplayAttribute

    - by Joe
    I have a number of classes that are decorated with DebuggerDisplayAttribute. I want to be able to add trace statements to Unit Tests that will display instances of these classes. Does there exist a method in the .NET Framework that will display an object formatted using DebuggerDisplayAttribute (or fall back to using .ToString() if no DebuggerDisplayAttribute is defined)?

    Read the article

  • Random Int in VB.Net

    - by brendan
    I need to generate random integer between 1-n (where n is a positive whole number) to use for a unit test. I don't need something overly complicated to ensure true randomnesses - just an old fashioned random number. How would I do that?

    Read the article

  • MIgrations and Rspec

    - by pablorc
    Hi, I'm developing a Rails application with Rspec for unit testing. Weeks ago, Rspec used to migrate the database to the last version automatically when executing 'rake spec', but now it doesn't do it automatically, I have to implement everything for myself. This happens in test environment, because my development data doesn't desappear. Is my fault? I didn't change anything, I think :) Thanks in advance.

    Read the article

< Previous Page | 114 115 116 117 118 119 120 121 122 123 124 125  | Next Page >