Search Results

Search found 1904 results on 77 pages for 'ben johnson'.

Page 62/77 | < Previous Page | 58 59 60 61 62 63 64 65 66 67 68 69  | Next Page >

  • How to return something in Matlab?

    - by Ben Fossen
    I have a simple function function increase(percent, number) low = number- number*percent; end I want to return low so I can use it as an argument for another function mitoGen(asp, arg, increase(.2,234), glu) Is there a way to do this?

    Read the article

  • Xcode Unit Testing - Accessing Resources from the application's bundle?

    - by Ben Scheirman
    I'm running into an issue and I wanted to confirm that I'm doing things the correct way. I can test simple things with my SenTestingKit tests, and that works okay. I've set up a Unit Test Bundle and set it as a dependency on the main application target. It successfully runs all tests whenever I press cmd+B. Here's where I'm running into issues. I have some XML files that I need to load from the resources folder as part of the application. Being a good unit tester, I want to write unit tests around this to make sure that they are loading properly. So I have some code that looks like this: NSString *filePath = [[NSBundle mainBundle] pathForResource:@"foo" ofType:@"xml"]; This works when the application runs, but during a unit test, mainBundle points to the wrong bundle, so this line of code returns nil. So I changed it up to utilize a known class like this: NSString *filePath = [[NSBundle bundleForClass:[Config class]] pathForResource:@"foo" ofType:@"xml"]; This doesn't work either, because in order for the test to even compile code like this, it Config needs to be part of the Unit Test Target. If I add that, then the bundle for that class becomes the Unit Test bundle. (Ugh!) Am I approaching this the wrong way?

    Read the article

  • numberOfSectionsInTableView is requested in/after viewDidLoad ONLY if tableview is empty

    - by Ben Packard
    A simple tableviewController, empty. A modal that can be launched from a button. No data in the data source for the tableview, and no rows displayed. I open the modal, use it to add an item, and return to the tableview controller. The tableview updates itself automatically, and the new row is displayed. I add a second item. The table view does NOT update automatically. I can tell by logging inside numberOfSectionsInTableView that even if I go to add the first item and cancel, the tableview refreshes - it asks for the number of sections, rows, and the cell to display (if there is one). But not if there is one pre-existing row in the table. I've scoured my code but can't find anything that would cause the tableview to know when the first item is added, but none afterwards. Any ideas? EDIT - I have further narrowed my issue so will close this shortly and post a more specific question

    Read the article

  • How might a C# programmer approach writing a solution in javascript?

    - by Ben McCormack
    UPDATE: Perhaps this wasn't clear from my original post, but I'm mainly interested in knowing a best practice for how to structure javascript code while building a solution, not simply learning how to use APIs (though that is certainly important). I need to add functionality to a web site and our team has decided to approach the solution using a web service that receives a call from a JSON-formatted AJAX request from within the web site. The web service has been created and works great. Now I have been tasked with writing the javascript/html side of the solution. If I were solving this problem in C#, I would create separate classes for formatting the request, handling the AJAX request/response, parsing the response, and finally inserting the response somehow into the DOM. I would build properties and methods appropriately into each class, doing my best to separate functionality and structure where appropriate. However, I have to solve this problem in javascript. Firstly, how could I approach my solution in javascript in the way I would approach it from C# as described above? Or more importantly, what's a better way to approach structuring code in javascript? Any advice or links to helpful material on the web would be greatly appreciated. NOTE: Though perhaps not immediately relevant to this question, it may be worth noting that we will be using jQuery in our solution.

    Read the article

  • Loop not working when I try to traverse a Simple XML Object

    - by Ben Shelock
    I'm trying to loop through the results from the Last.fm API but it's not working. function get_url($url){ $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5); $content = curl_exec($ch); curl_close($ch); return $content; } $xml = get_url('http://ws.audioscrobbler.com/2.0/?method=album.search&album=kid%20a&api_key=b25b959554ed76058ac220b7b2e0a026'); $doc = new SimpleXMLElement($xml); $albums = $doc->results->albummatches; foreach($albums as $album){ echo $album->album->name; } This just shows the first album. If I change the code within the foreach loop to echo $album->name; it shows nothing at all. What am I doing wrong?

    Read the article

  • Objective C: Class Extensions and Protocol Conformation Warnings

    - by Ben Reeves
    I have a large class, which I have divided into several different class extension files for readability. @protocol MyProtocol @required -(void)required; @end @interface MyClass : NSObject <MyProtocol> @end @interface MyClass (RequiredExtension) -(void)required; @end Is there a better way to do this, without the compiler warning? warning: class 'MyClass' does not fully implement the 'MyProtocol' protocol

    Read the article

  • Given a short (2-week) sprint, is it ever acceptable to forgo TDD to "get things done"?

    - by Ben Aston
    Given a short sprint, is it ever acceptable to forgo TDD to "get things done" within the sprint. For example a given piece of work might need say 1/3 of the sprint to design the object model around an existing implementation. Under this scenario you might well end up with implemented code, say half way through the sprint, without any tests (implementing unit tests during this "design" stage would add significant effort and the tests would likely be thrown away a few times until the final "design" is settled upon). You might then spend a day or two in the second week adding in unit / integration tests after the fact. Is this acceptable?

    Read the article

  • MSI Parameter Inspection

    - by Ben Breen
    With a windows MSI file, is there a way to grab all the possible installation parameters in .NET code? I need to make a generic user interface to configure multiple MSI files not known until run-time – then install them together in one go.

    Read the article

  • How to install VC80CRT debug runtimes without full visual studio 2005?

    - by Ben L
    I can't run a debug sdk application because it requires both VC 8 and VC 9 versions of the CRT. But it only requires visual studio 2008 for plugin dev, which is what I need. How do I install the debug runtimes from 2005 on to a Windows7 machine? I can't figure out how to make them run app local nor can I copy anything into the winSxS folder without a trusted installer.

    Read the article

  • How can I share code across static libraries without duplicate symbol errors?

    - by Ben Flynn
    I am new to building static libraries and would like to create 2(+) libraries each of which has some unique code and some shared code. My intention is that other projects will link one or more of these static libraries. Util.h/m <-- Shared ImplOne.h/m <-- Unique to 'ImplOne' ImplTwo.h/m <-- Unique to 'ImplTwo' I am using XCode and generating the libraries by building Util.m and ImplOne.m in one case, and Util.m and ImplTwo.m in the other. Of course the issue is that I now cannot use these libraries together because they will have duplicate symbols. What is a better architecture for this situation?

    Read the article

  • Formatting the output of a custom tool so I can double click an error in Visual Studio and the file opens

    - by Ben Scott
    I've written a command line tool that preprocesses a number of files then compiles them using CodeDom. The tool writes a copyright notice and some progress text to the standard output, then writes any errors from the compilation step using the following format: foreach (var err in results.Errors) { // err is CompilerError var filename = "Path\To\input_file.xprt"; Console.WriteLine(string.Format( "{0} ({1},{2}): {3}{4} ({5})", filename, err.Line, err.Column, err.IsWarning ? "" : "ERROR: ", err.ErrorText, err.ErrorNumber)); } It then writes the number of errors, like "14 errors". This is an example of how the error appears in the console: Path\To\input_file.xrpt (73,28): ERROR: An object reference is required for the non-static field, method, or property 'Some.Object.get' (CS0120) When I run this as a custom tool in VS2008 (by calling it in the post-build event command line of one of my project's assemblies), the errors appear nicely formatted in the Error List, with the correct text in each column. When I roll over the filename the fully qualified path pops up. The line and column are different to the source file because of the preprocessing which is fine. The only thing that stands out is that the Project given in the list is the one that has the post-build event. The problem is that when I double click an error, nothing happens. I would have expected the file to open in the editor. I'm vaugely aware of the Microsoft.VisualStudio.Shell.Interop namespace but I think it should be possible just by writing to the standard output.

    Read the article

  • Excel Worksheet Index

    - by Ben
    I have the following code that works great but I am trying to modify it so that instead of replacing column 1 of the Index page with a new index I would rather start the range in Cell C11. Right now, the new Index starts in Cell A1 of the Index sheet. Here is the code: Private Sub Worksheet_Activate() Dim wSheet As Worksheet Dim l As Long l = 1 With Me .Columns(1).ClearContents .Cells(1, 1) = "INDEX" .Cells(1, 1).Name = "Index" End With For Each wSheet In Worksheets If wSheet.Name <> Me.Name Then l = l + 1 With wSheet .Range("A1").Name = "Start_" & wSheet.Index .Hyperlinks.Add Anchor:=.Range("A1"), Address:="", _ SubAddress:="Index", TextToDisplay:="Back to Index" End With Me.Hyperlinks.Add Anchor:=Me.Cells(l, 1), Address:="", _ SubAddress:="Start_" & wSheet.Index, TextToDisplay:=wSheet.Name End If Next wSheet End Sub I have successfully modified the code so that the link back to the index on each sheet is in cell A4 without trouble, but I can't figure out how to have the index be replaced starting at Cell C11

    Read the article

  • Why does my DIV clip its child DIV when jQuery moves it in IE?

    - by Ben Saufley
    I have two divs, both with position:absolute;, one inside the other. The parent isn't in a place where it can be set as position:relative without an extra layer of complexity (there are a lot of other elements around it that I'd have to account for to put it where it needs to be, which is at the very top of the page, over everything). The child element is made to stick off the bottom of the parent. In Chrome, Safari, Firefox, it all works splendidly. In IE, it works until jQuery moves the parent element - at which point the parent element clips the child, so you can barely see the top of the child. I feel like I've read about this, about IE clipping child elements, but I can't seem to find an answer that applies to my case. It's pretty simple, basically: <div id="parent" style="position:absolute;top:0;left:0;"> [content] <div id="tab" style="position:absolute;bottom:-30px;left:0;width:64px;height:32px;background-image:(...);"></div> </div> <script> $(document).ready( function() { $("#tab").click(function() { $("#parent").animate({"top":"-50px"},300); }); }); </script>

    Read the article

  • How to make a random number generator in matlab that is based on percentages?

    - by Ben Fossen
    I am currently using the built in random number generator. for example nAsp = randi([512, 768],[1,1]); 512 is the lower bound and 768 is the upper bound, the random number generator chooses a number from between these two values. What I want is to have two ranges for nAsp but I want one of them to get called 25% of the time and the other 75% of the time. Then gets plugged into he equation. Does anyone have any ideas how to do this or if there is a built in function in matlab already? for example nAsp = randi([512, 768],[1,1]); gets called 25% of the time nAsp = randi([690, 720],[1,1]); gets called 75% of the time

    Read the article

  • Apache Modrewrite & 301 redirect- Dynamic URLs with characters.

    - by Ben Chesters
    I've been trying for weeks, literally, to rename these URLs and also ensure the old one is 301 redirected to the new one: www.example.com/?mod=11&p=215 - www.example.com/clean-url-section www.example.com/?mod=96&tab=6 - www.example.com/clean-url-section-2 Does anyone have any idea why I am having no luck, I got 500 server errors or nothing at all! Is it because of the question marks and characters? I'd be grateful for any help. I have tried this (below) and it seems to be redirecting to the http:// www.example.com/new-page (this page doesn't exist, as I only want it to rename the page BUT use a 301 so that search engines continue you to value it) RewriteCond %{query_string} mod=96&tab=6 RewriteRule (.*) http:// www. example.com/new-page? [R=301,L] Scratching my head!

    Read the article

  • Could this be considered a well-written PHP5 class?

    - by Ben Dauphinee
    I have been learning OOP principals on my own for a while, and taken a few cracks at writing classes. What I really need to know now is if I am actually using what I have learned correctly, or if I could improve as far as OOP is concerned. I have chopped a massive portion of code out of a class that I have been working on for a while now, and pasted it here. To all you skilled and knowledgeable programmers here I ask: Am I doing it wrong? class acl extends genericAPI{ // -- Copied from genericAPI class protected final function sanityCheck($what, $check, $vars){ switch($check){ case 'set': if(isset($vars[$what])){return(1);}else{return(0);} break; } } // --------------------------------- protected $db = null; protected $dataQuery = null; public function __construct(Zend_Db_Adapter_Abstract $db, $config = array()){ $this->db = $db; if(!empty($config)){$this->config = $config;} } protected function _buildQuery($selectType = null, $vars = array()){ // Removed switches for simplicity sake $this->dataQuery = $this->db->select( )->from( $this->config['table_users'], array('tf' => '(CASE WHEN count(*) > 0 THEN 1 ELSE 0 END)') )->where( $this->config['uidcol'] . ' = ?', $vars['uid'] ); } protected function _sanityRun_acl($sanitycheck, &$vars){ switch($sanitycheck){ case 'uid_set': if(!$this->sanityCheck('uid', 'set', $vars)){ throw new Exception(ERR_ACL_NOUID); } $vars['uid'] = settype($vars['uid'], 'integer'); break; } } private function user($action = null, $vars = array()){ switch($action){ case 'exists': $this->_sanityRun_acl('uid_set', $vars); $this->_buildQuery('user_exists_idcheck', $vars); return($this->db->fetchOne($this->dataQuery->__toString())); break; } } public function user_exists($uid){ return($this->user('exists', array('uid' => $uid))); } } $return = $acl_test->user_exists(1);

    Read the article

  • Setting a property in XAML for a User Control

    - by Ben
    Hi, I have a user control that has a property of type Integer, that i am trying to set in the XAML Template to be that of a property within the bindingsource. If I set the property using a hard coded integer i.e. <MyControl MyIntegerProperty="3" /> This works fine, but if i try <MyControl MyIntegerProperty="{Binding MyDataContextIntegerProperty}" /> it fails. I know that the integer property on MyDataContext is returning a valid integer, and i know that this format works, as directly above this in the template, i have the line <TextBlock Text="{Binding MyDataContextStringProperty}" /> which works correctly. Is there any flag that i need to set on my User Controls Integer property to allow this to work? Or am i doing something else wrong? Thanks

    Read the article

  • SQL Compact performance on device

    - by Ben M
    My SQL Compact database is very simple, with just three tables and a single index on one of the tables (the table with 200k rows; the other two have less than a hundred each). The first time the .sdf file is used by my Compact Framework application on the target Windows Mobile device, the system hangs for well over a minute while "something" is done to the database: when deployed, the DB is 17 megabytes, and after this first usage, it balloons to 24 megs. All subsequent usage is pretty fast, so I'm assuming there's some sort of initialization / index building going on during this first usage. I'd rather not subject the user to this delay, so I'm wondering what this initialization process is and whether it can be performed before deployment. For now, I've copied the "initialized" database back to my desktop for use in the setup project, but I'd really like to have a better answer / solution. I've tried "full compact / repair" in the VS Database Properties dialog, but this made no difference. Any ideas? For the record, I should add that the database is only read from by the device application -- no modifications are made by that code.

    Read the article

  • Classes. Whats the point?

    - by Ben Shelock
    I'm fairly new to OOP in PHP, I've made a couple of basic scripts but nothing impressive. All I've really taken from it is that it would probably be easier just make a collection of functions and include them. The structure of classes seems to just confuse what was otherwise a simple process. And in collating everything into a class it doesn't really add any functionality. So I'm clearly missing something. Could someone explain what functionality is added by creating classes

    Read the article

  • Building a life-critical System using Agile

    - by Ben Breen
    Looking at the general trend of comments in my question about Building an Aircraft using Agile, the biggest problem other than cost appears to be safety. Do people feel that it is not possible to build a safe system (or prove it is safe) using agile? Doesn’t all the iterative testing mitigate this? Is it likely that a piece of software developed using agile will never be as reliable as counterparts such as waterfall?

    Read the article

  • Padding on A nested in LI in DIV does not size div correctly. Suggestions?

    - by Ben Dauphinee
    Tried removing the overflow hidden, but that does not seem to fix it. Suggestions? Relevent HTML and problem illustration here: http://mgc.selfip.com/bugscreen01.jpg Relevent CSS #nav{padding: 5px 0px; overflow: hidden; background-color: #7af;} ul#nav{white-space: nowrap;} #nav li{display: inline; list-style-type: none;} #nav li a{padding: 5px 10px;} #nav a{font-family: "Adobe Caslon Pro", "Hoefler Text", Georgia, Garamond, Times, serif; font-size: 14pt; font-variant: small-caps;} #nav a:link, #nav a:visited{color: #fff; text-decoration: none;} #nav a:hover, #nav a:focus{color: #fff; background: #91db24;}

    Read the article

< Previous Page | 58 59 60 61 62 63 64 65 66 67 68 69  | Next Page >