Search Results

Search found 2474 results on 99 pages for 'patrick scott'.

Page 74/99 | < Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >

  • Why use third-party vector libraries at all?

    - by Patrick Powns
    So I'm thinking of using the Eigen matrix library for a project I'm doing (2D space simulator). I just went ahead and profiled some code with Eigen::Vector2d, and with bare arrays. I noticed a 10x improvement in assigning values to elements in the array, and a 40x improvement in calculating the dot products. Here is my profiling if you want to check it out, basically it's ~4.065s against ~0.110s. Obviously bare arrays are much more efficient at dot products and assigning stuff. So why use the Eigen library (or any other library, Eigen just seemed the fastest)? Is it stability? Complicated maths that would be hard to code by yourself efficiently?

    Read the article

  • $_POST vs. $_SERVER['REQUEST_METHOD'] == 'POST'

    - by Scott
    Some guy called one of my Snipplr submissions "crap" because I used if ($_SERVER['REQUEST_METHOD'] == 'POST') instead of if ($_POST) Checking the request method seems more correct to me because that's what I really want to do. Is there some operational difference between the two or is this just a code clarity issue?

    Read the article

  • SELECT DISTINCT multiple field search?

    - by Patrick
    I'm trying to search multiple fields zc_city and zc_zip for when user input and then return row results for zc_city zc_state and zc_zip $q = strtolower($_GET["q"]); if (!$q) return; $sql = "SELECT DISTINCT zc_city AS zcity FROM search_zipcodes WHERE zc_city LIKE '$q%'"; $rsd = mysql_query($sql); while($rs = mysql_fetch_array($rsd)) { $zcity = $rs['zcity']; echo "$zcity\n"; }

    Read the article

  • Javascript adding two numbers incorrectly

    - by Scott
    Global.alert("base: " + base + ", upfront: " + upfront + ", both: " + (base + upfront)); This code above outputs this: base: 15000, upfront: 36, both: 1500036 Why is it joining the two numbers instead of adding them up? I eventually want to set the value of another field to this amount using this: mainPanel.feesPanel.initialLoanAmount.setValue(Ext.util.Format.number((base + upfront), '$0,000.00')); ...and when I try that now it turns the number into the millions instead of 15,036.00. I have no idea why. Any ideas?

    Read the article

  • Generic SQL builder .NET

    - by Patrick
    I'm looking for a way to write an SQL statement in C# targeting different providers. A typical example of SQL statements differentiating is the LIMIT in PostgreSQL vs. TOP in MSSQL. Is the only way to solve SQL-syntax like the two above to write if-statements depending on which provider the user selects or using try catch statements as flow control (LIMIT didn't work, I'll try TOP instead)? I've seen the LINQ Take method, but I'm wondering if one can do this without LINQ? In other words, does C# have some generic SQL Provider class that I have failed to find that can be used?

    Read the article

  • Add the categories selector widget to the PAGE editor with predefined categories listed?

    - by Scott B
    The following code will add the categories selector widget to the WordPress Page editor interface... add_action('admin_menu', 'my_post_categories_meta_box'); function my_post_categories_meta_box() { add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'page', 'side', 'core'); } What I would like to do is to figure out how to modify the resulting category listing so that it only contains a predefined list of hard coded categories that I define. Since I'm adding this via my custom theme, it will only appear on the page editor when my theme is active on the site. And I have some specific "handler" categories that my theme installs into the site and later uses to determine layout elements.

    Read the article

  • Updating external Flex components from an action

    - by Scott
    Hello, I'm new to Flex and am having trouble understanding Events. I think Events are what I want to use for my situation. I have 2 components, addUser.mxml and listUsers.mxml. I access these from a ViewStack in my main application. When I load listUsers.mxml it shows a list of current users in a datagrid via a HTTPService call. When I add a user using the form on addUser.mxml I would like the datagrid in listUsers.mxml to refresh when I return to that view to show the new user. I've tried several different things with addEventListener and dispatchEvent but can't seem to get it working. Can someone help me with this logic?

    Read the article

  • What's an effective way to reuse ArrayLists in a for loop?

    - by Patrick
    hi, I'm reusing the same ArrayList in a for loop, and I use for loop results = new ArrayList<Integer>(); experts = new ArrayList<Integer>(); output = new ArrayList<String>(); .... to create new ones. I guess this is wrong, because I'm allocating new memory. Is this correct ? If yes, how can I empty them ? Added: another example I'm creating new variables each time I call this method. Is this good practice ? I mean to create new precision, relevantFound.. etc ? Or should I declare them in my class, outside the method to not allocate more and more memory ? public static void computeMAP(ArrayList<Integer> results, ArrayList<Integer> experts) { //compute MAP double precision = 0; int relevantFound = 0; double sumprecision = 0; thanks

    Read the article

  • align input text with label in my Search gadget

    - by Patrick
    hi, I would like to align the label of my search widget with the input text (they are slightly not aligned on all browsers). Any css tip ? thanks This is my code: Search <span class="views-widget"> <span id="edit-search-wrapper" class="form-item"> <input type="text" class="form-text" title="Enter the terms you wish to search for." value="" size="15" id="edit-search" name="search" maxlength="128"> </span> </span> </div>

    Read the article

  • Error - Trying to get property of non-object

    - by Patrick Lanfranco
    I am currently getting this error on one of my files: /var/www/vhosts/httpdocs/generator/index.php on line 6 Line 6 would be resulting in: echo $results->GetBookCodesResult->BookCodes->BookInfo->ServiceCode; My code: <?php $config['soap_url'] = "http://myservice.com?WSDL"; if(isset($_REQUEST['codes'])) { $results = request_Data(explode("\n",$_REQUEST['codes'])); echo $results->GetBookCodesResult->BookCodes->BookInfo->ServiceCode; } .... What is the best method to have this fixed? Some advice would be appreciated.

    Read the article

  • Why is this condition never satisfied ?

    - by Patrick
    I don't know why this condition is never satisfied: I'm comparing two ArrayList values, and it is always false. if ( (Integer) results.get(rank) == (Integer) experts.get(j)) I'm debugging and I have exactly the same 2 values: 3043 and 3043 However it doesn't work. thanks

    Read the article

  • Calculating percent "x/y * 100" always results in 0?

    - by Patrick Beninga
    In my assignment i have to make a simple version of Craps, for some reason the percentage assignments always produce 0 even when both variables are non 0, here is the code. import java.util.Random; Header, note the variables public class Craps { private int die1, die2,myRoll ,myBet,point,myWins,myLosses; private double winPercent,lossPercent; private Random r = new Random(); Just rolls two dies and produces their some. public int roll(){ die1 = r.nextInt(6)+1; die2 = r.nextInt(6)+1; return(die1 + die2); } The Play method, this just loops through the game. public void play(){ myRoll = roll(); point = 0; if(myRoll == 2 ||myRoll == 3 || myRoll == 12){ System.out.println("You lose!"); myLosses++; }else if(myRoll == 7 || myRoll == 11){ System.out.println("You win!"); myWins++; }else{ point = myRoll; do { myRoll = roll(); }while(myRoll != 7 && myRoll != point); if(myRoll == point){ System.out.println("You win!"); myWins++; }else{ System.out.println("You lose!"); myLosses++; } } } This is where the bug is, this is the tester method. public void tester(int howMany){ int i = 0; while(i < howMany){ play(); i++; } bug is right here in these assignments statements winPercent = myWins/i * 100; lossPercent = myLosses/i* 100; System.out.println("program ran "+i+" times "+winPercent+"% wins "+ lossPercent+"% losses with "+myWins+" wins and "+myLosses+" losses"); } }

    Read the article

  • CSS: is there any way to have the same relative positioning even if the previous element have differ

    - by Patrick
    hi, I have a sequence of couples of elements. (.div1, .div2) I'm using position:relative attribute on .div2 to move it a bit on top and right with respect to div1. However .div1 elements have different content and heights, so the relative positioning of .div2 is not consistent (they sometimes are too high, sometimes too low). .div2 { position:relative; left:200px; top:-300; } thanks

    Read the article

  • Drupal: $form['#redirect'] = FALSE; doesn't work.

    - by Patrick
    hi, I've tried to change the redirection when I submit my edit-node form, by addming the following line to my template.php file, in my theme $form['#redirect'] = FALSE; I'm sure the template.php file works well because I have other lines in which I change, for example, the weights of some elements. But the redirection doesn't work. I've also tried $form['#redirect'] = 'anotherPage'; without success. What am I doing wrong ? I'm following the Drupal APIs, about forms: http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6#redirect thanks

    Read the article

  • Please explain this delete top 100 SQL syntax

    - by Patrick
    Basically I want to do this: delete top( 100 ) from table order by id asc but MS SQL doesn't allow order in this position The common solution seems to be this: DELETE table WHERE id IN(SELECT TOP (100) id FROM table ORDER BY id asc) But I also found this method here: delete table from (select top (100) * from table order by id asc) table which has a much better estimated execution plan (74:26). Unfortunately I don't really understand the syntax, please can some one explain it to me? Always interested in any other methods to achieve the same result as well. EDIT: I'm still not getting it I'm afraid, I want to be able to read the query as I read the first two which are practically English. The above queries to me are: delete the top 100 records from table, with the records ordered by id ascending delete the top 100 records from table where id is anyone of (this lot of ids) delete table from (this lot of records) table I can't change the third one into a logical English sentence... I guess what I'm trying to get at is how does this turn into "delete from table (this lot of records)". The 'from' seems to be in an illogical position and the second mention of 'table' is logically superfluous (to me).

    Read the article

  • C# Simpler / more efficient method of if ... else flow?

    - by Scott
    I'm currently working on an emulation server for a flash-client based game, which has a "pets system", and I was wondering if there was a simpler way of going about checking the level of specified pets. Current code: public int Level { get { if (Expirience 100) // Level 2 { if (Expirience 200) // Level 3 { if (Expirience 400) // Level 4 - Unsure of Goal { if (Expirience 600) // Level 5 - Unsure of Goal { if (Expirience 1000) // Level 6 { if (Expirience 1300) // Level 7 { if (Expirience 1800) // Level 8 { if (Expirience 2400) // Level 9 { if (Expirience 3200) // Level 10 { if (Expirience 4300) // Level 11 { if (Expirience 7200) // Level 12 - Unsure of Goal { if (Expirience 8500) // Level 13 - Unsure of Goal { if (Expirience 10100) // Level 14 { if (Expirience 13300) // Level 15 { if (Expirience 17500) // Level 16 { if (Expirience 23000) // Level 17 { return 17; // Bored } return 16; } return 15; } return 14; } return 13; } return 12; } return 11; } return 10; } return 9; } return 8; } return 7; } return 6; } return 5; } return 4; } return 3; } return 2; } return 1; } } Yes, I'm aware I've misspelt Experience, I had made the mistake in a previous function and hadn't gotten around to updating everything... :P

    Read the article

  • What is the best practice when using UIStoryboards?

    - by Scott Sherwood
    Having used storyboards for a while now I have found them extremely useful however, they do have some limitations or at least unnatural ways of doing things. While it seems like a single storyboard should be used for your app, when you get to even a moderately sized application this presents several problems. Working within teams is made more difficult as conflicts in Storyboards can be problematic to resolve (any tips with this would also be welcome) The storyboard itself can become quite cluttered and unmanageable. So my question is what are the best practices of use? I have considered using a hybrid approach having logical tasks being split into separate storyboards, however this results in the UX flow being split between the code and the storyboard. To me this feels like the best way to create reusable actions such as login actions etc. Also should I still consider a place for Xibs? This article has quite a good overview of many of the issues and it proposes that for scenes that only have one screen, xibs should be used in this case. Again this feels unusual to me with Apples support for instantiating unconnected scenes from a storyboard it would suggest that xibs won't have a place in the future but I could be wrong.

    Read the article

  • javascript - Google Chrome cluttering Array generated from .split()

    - by patrick
    Given the following string: var str = "one,two,three"; If I split the string on the commas, I normally get an array, as expected: var arr = str.split(/\s*,\s*/); Trouble is that in Google Chrome (for Mac), it appends extra properties to the array. Output from Chrome's debugger: arr: Array 0: one 1: two 2: three constructor: function Array() index: undefined input: undefined length: 3 So if I iterate over the array with a for/in loop, it iterates over the new properties. Specifically the input and index properties. Using hasOwnProperty doesn't seem to help. A fix would be to do a for loop based on the length of the Array. Still I'm wondering if anyone has insight into why Chrome behaves this way. Firefox and Safari don't have this issue.

    Read the article

< Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >