Search Results

Search found 1506 results on 61 pages for 'ben dauphinee'.

Page 6/61 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • How do I work with constructs in PHPUnit?

    - by Ben Dauphinee
    I am new into PHPUnit, and just digging through the manual. I cannot find a decent example of how to build a complete test from end to end though, and so, am left with questions. One of these is how can I prep my environment to properly test my code? I am trying to figure out how to properly pass various configuration values needed for both the test setup/teardown methods, and the configs for the class itself. // How can I set these variables on testing start? protected $_db = null; protected $_config = null; // So that this function runs properly? public function setUp(){ $this->_acl = new acl( $this->_db, // The database connection for the class passed // from whatever test construct $this->_config // Config values passed in from construct ); } // Can I just drop in a construct like this, and have it work properly? // And if so, how can I set the construct call properly? public function __construct( Zend_Db_Adapter_Abstract $db, $config = array(), $baselinedatabase = NULL, $databaseteardown = NULL ){ $this->_db = $db; $this->_config = $config; $this->_baselinedatabase = $baselinedatabase; $this->_databaseteardown = $databaseteardown; } // Or is the wrong idea to be pursuing?

    Read the article

  • real time updates for new page events

    - by Ben Ford
    I know there's a few questions knocking around on this topic but none quite the same. I'm currently searching by location for all the pages relating to a particular geographic location and caching their events in a database. The problem being I have to currently loop through all the pages i'm watching frequently to check for updates. At the moment the 10,000 Pages I'm keeping track of takes a good while to update. It would be much neater (and nicer to fb) to be notified instead of polling. Does anyone know of a more efficient to do this? Thanks Ben

    Read the article

  • Could I be writing this code better?

    - by Ben Dauphinee
    Is there any website out there somewhere where a programmer such as myself might be able to post pieces of code to be looked at by more experienced people? I am thinking of something that programmers could use to have advice given on how to improve their ability. I really like the atmosphere here, but am not sure that posting code for review here is appropriate.

    Read the article

  • Possible to distribute an MPI (C++) program accross the internet rather than within a LAN cluster?

    - by Ben
    Hi there, I've written some MPI code which works flawlessly on large clusters. Each node in the cluster has the same cpu architecture and has access to a networked (i.e. 'common') file system (so that each node can excecute the actual binary). But consider this scenario: I have a machine in my office with a dual core processor (intel). I have a machine at home with a dual core processor (amd). Both machines run linux, and both machines can successfully compile and run the MPI code locally (i.e. using 2 cores). Now, is it possible to link the two machines together via MPI, so that I can utilise all 4 cores, bearing in mind the different architectures, and bearing in mind the fact that there are no shared (networked) filesystems? If so, how? Thanks, Ben.

    Read the article

  • How can I get started with PHPUnit, where my class construct requires a preconfigured db connection?

    - by Ben Dauphinee
    I have a class that uses a lot of database internally, so I built the constructor with a $db handle that I am supposed to pass to it. I am just getting started with PHPUnit, and I am not sure how I should go ahead and pass the database handle through setup. public function setUp(/*do I pass a database handle through here, using a reference? aka &$db*/){ $this->_acl = new acl; } public function __construct(Zend_Db_Adapter_Abstract $db, $config = array()){

    Read the article

  • How can I force a jQuery plugin to refresh the data it has loaded?

    - by Ben Dauphinee
    I am working with jQuery Pagination, and a popup form. On saving the data in the form, how would I go about forcing the Pagination plugin to reload the data it would load for whatever page I am on, without reloading the entire webpage? Ex: Item 1 Item 2 Item 3 Add Item-Item 23-Save-Reload List Item 1 Item 2 Item 3 Item 23 http://d-scribe.de/webtools/jquery-pagination/lib/jquery_pagination/README

    Read the article

  • How can I test if a point lies within a 3d shape with its surface defined by a point cloud?

    - by Ben
    Hi I have a collection of points which describe the surface of a shape that should be roughly spherical, and I need a method with which to determine if any other given point lies within this shape. I've previously been approximating the shape as an exact sphere, but this has proven too inaccurate and I need a more accurate method. Simplicity and speed is favourable over complete accuracy, a good approximation will suffice. I've come across techniques for converting a point cloud to a 3d mesh, but most things I have found have been very complicated, and I am looking for something as simple as possible. Any ideas? Many thanks, Ben.

    Read the article

  • Search sort by parameter match count in the query? PostgreSQL

    - by Ben Dauphinee
    I am working on a search query in PostgreSQL, and one of the things I do is sort my query results by the number of parameters matched. I have no clue how this can be done. Does anyone have a suggestion or solution? Table brand color type engine Ford Blue 4-door V8 Maserati Blue 2-door V12 Saturn Green 4-door V8 GM Yellow 1-door V4 Current Query SELECT brand FROM table WHERE color = 'Blue' or type = '4-door' or engine = 'V8' Result Should Be Ford (3 match) Saturn (2 match) Maserati (1 match)

    Read the article

  • jQuery Dialog form serialize reposting incorrect data on subsequent uses

    - by Ben Dauphinee
    I'm working with forms inside jQuery Dialog, and am having some issues with the data it's posting. First load and save works fine, posts the correct data. Until I refresh the page though, every subsequent load seems to work, as in the correct data is in the form, however, when saved, the data from the first load is what is posted every time. function formdialog(url, tack, divid, scriptload){ $.getJSON(url+tack+"/form", function(data){ var formwin = '<div><form id="formdialog">'+data['form']+'</form></div>'; var dialog = $(formwin).dialog({ title: data['title'], autoOpen: false, modal: true, buttons: { "Save": function(){ $.post(url+tack+"/process", $("#formdialog").serialize(), function(data){ alert($("#formdialog").serialize()); $(this).dialog('close'); $(this).remove(); } ); }, "Cancel": function(){$(this).dialog('close'); $(this).remove();} } }); dialog.dialog("open"); }); } $(function(){ $("a.edlnk").click(function(){ var url = $(this).attr("href"); formdialog(CONFIG_HREF_SITE+"ajax/"+appControl, "/"+url, divid); return false; }); });

    Read the article

  • Best way to implement a List(Of) with a maximum number of items

    - by Ben
    I'm trying to figure out a good way of implementing a List(Of) that holds a maximum number of records. e.g. I have a List(Of Int32) - it's being populated every 2 seconds with a new Int32 item. I want to store only the most current 2000 items. How can I make the list hold a maximum of 2000 items, then when the 2001'th item is attempted to be added, the List drops the 2000'th item (resulting in the current total being 1999). Thing is, I need to make sure I'm dropping only the oldest item and adding a new item into the List. Ben

    Read the article

  • DIV not sizing correctly when elements inside are bigger?

    - 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

  • Converting code to perl sub, but not sure I'm doing it right

    - by Ben Dauphinee
    I'm working from a question I posted earlier (here), and trying to convert the answer to a sub so I can use it multiple times. Not sure that it's done right though. Can anyone provide a better or cleaner sub? sub search_for_key { my ($args) = @_; foreach $row(@{$args->{search_ary}}){ print "@$row[0] : @$row[1]\n"; } my $thiskey = NULL; my @result = map { $args->{search_ary}[$_][0] } # Get the 0th column... grep { @$args->{search_in} =~ /$args->{search_ary}[$_][1]/ } # ... of rows where the 0 .. $#array; # first row matches $thiskey = @result; print "\nReturning: " . $thiskey . "\n"; return $thiskey; } search_for_key({ 'search_ary' => $ref_cam_make, 'search_in' => 'Canon EOS Rebel XSi' });

    Read the article

  • Global jQuery dialog variable not working properly

    - by Ben Dauphinee
    When I call the function, the dialog does work. If I move the dialog construction into the showtimes_list function, everything works fine. I thought that variables declared outside a function were global in context? var dialog_list = $("<div></div>").dialog({ autoOpen: false, modal: true, height: 300, width: 720, }); function showtimes_list(sid){ dialog_list.html(""); $.get("ajax_showtimes.php?sid="+sid, function(data){ dialog_list.html(data); } ); dialog_list.dialog("open"); }

    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

  • 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

  • Any way to make this PostgreSQL count query any faster?

    - by Ben Dauphinee
    I'm running a case-insensitive search on a table with 7.2 million rows, and I was wondering if there was any way to make this query any faster? Currently, it takes approx 11.6 seconds to execute, with just one search parameter, and I'm worried that as soon as I add more than one, this query will become massively slow. SELECT count(*) FROM "exif_parse" WHERE (description ~* 'canon')

    Read the article

  • Could this be considered a well-written class (am I using OOP correctly)?

    - 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

  • How to target specific letter/word with jquery?

    - by Gal
    As a mere example, I want to apply the class "fancy" to all occurrences of the sign "&" in the document. The CSS: .fancy { font-style: italic; } So a text that looks like this: Ben & Jerry's would be manipulated by jquery to this: Ben <span class="fancy">&</span> Jerry's Is there a function to target specific words/phrases/letters like this?

    Read the article

  • How to merge two single column csv files with linux commands

    - by user1328191
    I was wondering how to merge two single column csv files into one file where the resulting file will contain two columns. file1.csv    first_name    chris    ben    jerry file2.csv    last_name    smith    white    perry result.csv    first_name,last_name    chris,smith    ben,white    jerry,perry Thanks

    Read the article

  • Combining Searchlogic named scopes with OR

    - by jaycode
    Is something like this possible? Product.price_greater_than(10000).or_tags_name_equals('luxury') The wiki doesn't help much on this... I saw in the wiki: User.id_or_age_lt_or_username_or_first_name_begins_with(10) => "id < 10 OR age < 10 OR username LIKE 'ben%' OR first_name like'ben%'" I really don't get that, how in the world did "ben" comes up??? could anyone help please?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >