Search Results

Search found 1517 results on 61 pages for 'ben tew'.

Page 52/61 | < Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >

  • JSF/HTML - Add a java applet to web page programmaticly.

    - by Ben
    Hi, Theres a web page i'm making which content is very dynamic and so I'm building it from inside the backing bean. I would like to add a java applet to the web page but I could not find the Java Object to correspond to the <applet> tag. So My questions are - What is the JAVA Object for an applet? How did you find it? (For similar future searches) Thanks! P.S - Just to be clear. An example: <h:PanelGroup> would be HtmlPanelGroup as a java object.

    Read the article

  • Python: Best practice for including a version number in an app?

    - by Ben
    I have a PyQt application that reads and writes data files. I am including a 'version number' in each file written. This is a simple number similar to: 1.2 or something (major and minor versions). I am doing this so that I can change the format of these data files in future versions and then still correctly parse them simply by checking to see what the version is inside the file. My question is what is the best practice for keeping this number stored inside the app itself. I.e. do I just hard-code the app version number into the class that is responsible for reading and writing files? Or should I have some sort of object/variable stored at the top-level of the app and somehow access it from the class responsible for reading and writing these files. If the latter, how do I store it and how do I access it? Thanks.

    Read the article

  • Is it possible to determine whose code (according to `git blame`) was affected by each hunk output by `git diff`?

    - by Ben
    I have a large cross-cutting commit that I would like to split up according to the authors whose code was affected, both to increase the reviewers' familiarity with the code they're reviewing, and to divide the review burden equitably. I realize that the blame may be mixed within a given hunk, in which case it would be nice to either collect multiple reviewers or just choose the most "blameworthy" one (breaking ties arbitrarily is fine).

    Read the article

  • How to hide/show more text within a certain length (like youtube)

    - by Ben
    So lets say i have want to have a text to only be a certain amount of characters/length and after that length i want to put an link to reveal the full length of the text. The link will be (more...). And once the user clicks the link (more..) the rest of the text will slide down. How would i accomplish this. Heres an example. blah blah blah blah blah (more...) when user clicks (more..) , it will show the entire text will show Also i am taking a about data in a table row/table cell, not just any text

    Read the article

  • C++ - Distributing different headers than development

    - by Ben
    I was curious about doing this in C++: Lets say I have a small library that I distribute to my users. I give my clients both the binary and the associated header files that they need. For example, lets assume the following header is used in development: #include <string> ClassA { public: bool setString(const std::string & str); private: std::string str; }; Now for my question. For deployment, is there anything fundamentally wrong with me giving a 'reduced' header to my clients? For example, could I strip off the private section and simply give them this: #include <string> ClassA { public: bool setString(const std::string & str); }; My gut instinct says "yes, this is possible, but there are gotchas", so that is why I am asking this question here. If this is possible and also safe, it looks like a great way to hide private variables, and thus even avoid forward declaration in some cases. I am aware that the symbols will still be there in the binary itself, and that this is just a visibility thing at the source code level. Thanks!

    Read the article

  • How do I clear the text contents of a div in javascript?

    - by Ben
    I'm temporarily adding contents to a div,tempDiv, and adding that to a link which is appended to a div, #contentHere, that's displayed. I need to clear the contents of tempDiv so that the links aren't appended to each other, creating a string of urls that don't link to anywhere. $(document).ready(function(){ $.getJSON("data.php", function(data){ for(i = 0; i < 5; i++){ $("#tempDiv").append(data.justIn[i].dataLink+ ' '); $("#contentHere").append("<a href=\"#tempDiv\">Click to go to the div link</a>"); //I need to clear the contents of tempDiv here } }); }); Solutions to clearing the temporary contents of the div as I go?

    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

  • Why does the :nth-child(2) selector work on what I expect to be :first-child?

    - by Ben
    I have an example of what I'm trying to ask. I use this kind of format often. I'd expect to be able to select that first div with fieldset div:first-child { } but it seems that it's only grabbed by the 2nd child selector. I would expect "field 1" to be red and not blue. It makes more sense semantically (to me at least) to say "style the first div in the fieldset like so" instead of saying the 2nd. Why is this happening and is there a way to achieve the effect I want (to be able to call div:first-child)?

    Read the article

  • Can first descendent be selected directly?

    - by Ben Huh
    I am currently using find() and first() method to select the first descendent element from each of the <div> elements that contains the parent class. But I find this quite cumbersome since find() method would produce a set of matched elements before the first element is being picked. The following is the skeleton of my code: HTML <div class=parent> <ul> <li>random characters</li> <li>random characters</li> <li>random characters</li> <li>random characters</li> </ul> </div> <div class=parent> <ul> <li>random characters</li> <li>random characters</li> <li>random characters</li> <li>random characters</li> </ul> </div> <div class=non-parent> <ul> <li>random characters</li> <li>random characters</li> <li>random characters</li> <li>random characters</li> </ul> </div> <div class=parent> <ul> <li>random characters</li> <li>random characters</li> <li>random characters</li> <li>random characters</li> </ul> </div> // .....the list continues Javascript $('.parent').each(function() { $(this).find('ul li').first().css('color', 'red'); // do other stuff within each loop }); I have seen people using $(".parent li:first") selector. But, because I am doing it in a loop, I am not sure how or whether if this could be done and would like some advice. Thanks.

    Read the article

  • ConcurrenctBag(Of MyType) Vs List(Of MyType)

    - by Ben
    What is the advantage of using a ConcurrentBag(Of MyType) against just using a List(Of MyType)? The MSDN page on the CB (http://msdn.microsoft.com/en-us/library/dd381779(v=VS.100).aspx) states that ConcurrentBag(Of T) is a thread-safe bag implementation, optimized for scenarios where the same thread will be both producing and consuming data stored in the bag So what is the advantage? I can understand the advantage of the other collection types in the Concurrency namespace, but this one puzzled me. Thanks.

    Read the article

  • C++ Filling an 1D array to represent a n-dimensional object based on a straight line segment

    - by Ben
    I'm struggling to find a good way to put this question but here goes. I'm making a system that uses a 1D array implemented as double * parts_ = new double[some_variable];. I want to use this to hold co-ordinates for a particle system that can run in various dimensions. What I want to be able to do is write a generic fill algorithm for filling this in n-dimensions with a common increment in all direction to a variable size. Examples will serve best I think. Consider the case where the number of particles stored by the array is 4 In 1D this produces 4 elements in the array because each particle only has one co-ordinate. 1D: {0, 25, 50, 75}; In 2D this produces 8 elements in the array because each particle has two co-ordinates.. 2D: {0, 0, 0, 25, 25, 0, 25, 25} In 3D this produces 12 elements in the array because each particle now has three co-ordinates {0, 0, 0, 0, 0, 25, 0, 0, 50, ... } These examples are still not quite accurate, but they hopefully will suffice. The way I would do this normally for two dimensions: int i = 0; for(int x = 0; x < parts_size_ / dims_ / dims_ * 25; x += 25) { for(int y = 0; y < parts_size_ / dims_ / dims_ * 25; y += 25) { parts_[i] = x; parts_[i+1] = y; i+=2; // Indentation hates me today .< How can I implement this for n-dimensions where 25 can be any number? The straight line part is because it seems to me logical that a line is a somewhat regular shape in 1D, as is a square in 2D, and a cube in 3D. It seems to me that it would follow that there would be similar shapes in this family that could be implemented for 4D and higher dimensions via a similar fill pattern. This is the shape I wish to set my array to represent.

    Read the article

  • join same rails models twice, eg people has_many clubs through membership AND people has_many clubs through committee

    - by Ben
    Models: * Person * Club Relationships * Membership * Committee People should be able to join a club (Membership) People should be able to be on the board of a club (Committee) For my application these involve vastly different features, so I would prefer not to use a flag to set (is_board_member) or similar. I find myself wanting to write: People has_many :clubs :through = :membership # :as = :member? :foreign_key = :member_id? has_many :clubs :through = :committee # as (above) but I'm not really sure how to stitch this together

    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 do I write to command line from a WPF application?

    - by ben
    Hi I know how to write to console but if I write to console in my program and call my program from the command line it won't display anything. How do I make it so that when I say Console.WriteLine or Console.Out.Writeline ir prints to the command prompt from which it was called and not somewhere else? Once again I know how to do Console.WriteLine so it's not that :-p unless I'm doing it wrong. From what I can tell it's probably something to do with Console.SetOut(TextWriter t) this is a WPF application and I need it to post its data to the command line while still retaining the GUI at startup. I've triple checked and my code hits the print lines, I can actually see the lines being printed to the Visual Studio output window, it just won't display in the command line when I run it manually without VS. If possible I need to conditionally have the console display. ie if run from command line (or even with command arguments), display or post to the prompt, otherwise do not.

    Read the article

  • Rails nested association issue

    - by Ben Langfeld
    Ok, so I'm new to both Ruby and Rails and I'm trying to do what I believe is called a nested association (please correct me if this is the wrong terminology). I currently have a User model and a Domains model and I have many to many associations setup (using has_many :through) between the two, and this works fine. I now want to extend this to allow for a single role per domain per user (eg User1 is a member of Domain1 and has the role "Admin"). I have setup a Roles model with a single field (name:string) and have created three roles. I have also added a role_id column to the join table (memberships). I expected (and this is probably the issue) to be able to just use user1 = User.find(1) user1.domains.first => <some domain object> user1.domains.first.role => <some role object> but this returns a method not defined error. Can anyone tell me what I'm failing to grasp here? My model classes can be seen at http://gist.github.com/388200

    Read the article

  • Ruby 1.8.7 and RSPEC tutorial

    - by Ben Nelson
    I'm just diving into ruby development for a class assignment and the machines at my Uni have only got ruby 1.8.7 on them so I need to develop for that. I have found tutorials on the web for ruby = 1.9 and rspec that are really good but I haven't found anything for ruby 1.8.7 (I'm guessing it's pretty dated?). Does anyone have anything using rspec testing and has an indepth discussion on ruby 1.8.7 for me? I'd really appreciate it! Thanks!

    Read the article

  • Summary statistics in visual basic

    - by ben
    Below I am trying to write a script the goal of which is to calculate some summary statistics for a few different columns of numbers. I have gotten some help on it up to the "Need help below" mark. But beyond that I am flabergasted as to how to calculate the simple stats (sum, mean, standard deviation, coefficient of variation). I know VB has scripts for these stats, which I have included in my code, but I guess I need to do some extra declaring or something. Advice much appreciated. Thanks. Sub TOAinput() Const n As Integer = 648 Dim stratum(n), hybrid(n), acres(n), hhsz(n), offinc(n) Dim s1 As Integer Dim s2 As Integer Dim i As Integer For i = 1 To n stratum(i) = Worksheets("hhid level").Cells(i + 1, 2).Value Next i s1 = 0 s2 = 0 For i = 1 To n If stratum(i) = 1 Then s1 = s1 + 1 Else: s2 = s2 + 1 End If Next i Dim acres1(), hhsz1(), offinc1(), acres2(), hhsz2(), offinc2() ReDim acres1(s1), hhsz1(s1), offinc1(s1), acres2(s2), hhsz2(s2), offinc2(s2) 'data infiles: acres, hh size, off-farm income, For i = 1 To n acres(i) = Worksheets("hhid level").Cells(i + 1, 4).Value hhsz(i) = Worksheets("hhid level").Cells(i + 1, 5).Value offinc(i) = Worksheets("hhid level").Cells(i + 1, 6).Value Next i s1 = 0 s2 = 0 For i = 1 To n If stratum(i) = 1 Then s1 = s1 + 1 acres1(s1) = acres(i) hhsz1(s1) = hhsz(i) offinc1(s1) = offinc(i) Else: s2 = s2 + 1 acres2(s2) = acres(i) hhsz2(s2) = hhsz(i) offinc2(s2) = offinc(i) End If Next i '**************************** 'Need help below '**************************** Dim sumac1, sumac2, mhhsz1, mhhsz2, cvhhsz1, cvhhsz2 sumac1 = Sum(acres1) sumac2 = Sum(acres2) mhhsz1 = Average(hhsz1) mhhsz2 = Average(hhsz2) cvhhsz1 = StDev(hhsz1) / Average(hhsz1) cvhhsz2 = StDev(hhsz2) / Average(hhsz2) End Sub

    Read the article

  • Building a document server

    - by Ben
    Hey, I'm just looking for some rough guidance here on the feasibility of a project. I have say a few thousand text documents and I want to create a web based system to serve them up to users in a OS X application. It's just a tiny aside for my family's small business, so it doesn't need to be amazing at the moment, we just want to see if we can can anyone to use it. I can't believe it can be that hard to do this? -Some sort of SQL backend database to manage permissions for users? -Download through the application? -For the moment just want to view the raw text files. -If we want people to pay, how would we go about incorporating that? Sorry for the vague outline. I'm still not 100% sure on what we want. Thanks for any help.

    Read the article

< Previous Page | 48 49 50 51 52 53 54 55 56 57 58 59  | Next Page >