Search Results

Search found 4643 results on 186 pages for 'john dyer'.

Page 21/186 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • Track/Display Array Index As Part Of Cout (C++)

    - by John Smith
    Hi, I have a command line C++ program that lets you enter basic information about a person (ID number, name, age, etc.) and I want to output to a console in the following manner: ------------------------------------------------------------------- Index ID # First Name Last Name Age ------------------------------------------------------------------- 0 1234 John Smith 25 The person objects are stored in an array of Persons and I've overload the ostream (<<) operator to print out all of the fields like you see. The dashed lines and header come from a displayHdg() function. Anyhow, I have not been able to figure out how to get the proper index value for the array. Ideally, I'd like to generate the indices for each line, but all my attempts have failed. The array is looped through and each object printed in the main() function, and the ostream is overloaded in a person class, so I tried to use global variables as well as static variables, and all of those produce incorrect numbering (i.e. show 0, 1 the first time (for 2 objects), then change to 1, 2 on the next display). Any ideas?

    Read the article

  • Java unit test coverage numbers do not match.

    - by Dan
    Below is a class I have written in a web application I am building using Java Google App Engine. I have written Unit Tests using TestNG and all the tests pass. I then run EclEmma in Eclipse to see the test coverage on my code. All the functions show 100% coverage but the file as a whole is showing about 27% coverage. Where is the 73% uncovered code coming from? Can anyone help me understand how EclEmma works and why I am getting the discrepancy in numbers? package com.skaxo.sports.models; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.IdentityType; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; @PersistenceCapable(identityType= IdentityType.APPLICATION) public class Account { @PrimaryKey @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY) private Long id; @Persistent private String userId; @Persistent private String firstName; @Persistent private String lastName; @Persistent private String email; @Persistent private boolean termsOfService; @Persistent private boolean systemEmails; public Account() {} public Account(String firstName, String lastName, String email) { super(); this.firstName = firstName; this.lastName = lastName; this.email = email; } public Account(String userId) { super(); this.userId = userId; } public void setId(Long id) { this.id = id; } public Long getId() { return id; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public boolean acceptedTermsOfService() { return termsOfService; } public void setTermsOfService(boolean termsOfService) { this.termsOfService = termsOfService; } public boolean acceptedSystemEmails() { return systemEmails; } public void setSystemEmails(boolean systemEmails) { this.systemEmails = systemEmails; } } Below is the test code for the above class. package com.skaxo.sports.models; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertFalse; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; public class AccountTest { @Test public void testId() { Account a = new Account(); a.setId(1L); assertEquals((Long) 1L, a.getId(), "ID"); a.setId(3L); assertNotNull(a.getId(), "The ID is set to null."); } @Test public void testUserId() { Account a = new Account(); a.setUserId("123456ABC"); assertEquals(a.getUserId(), "123456ABC", "User ID incorrect."); a = new Account("123456ABC"); assertEquals(a.getUserId(), "123456ABC", "User ID incorrect."); } @Test public void testFirstName() { Account a = new Account("Test", "User", "[email protected]"); assertEquals(a.getFirstName(), "Test", "User first name not equal to 'Test'."); a.setFirstName("John"); assertEquals(a.getFirstName(), "John", "User first name not equal to 'John'."); } @Test public void testLastName() { Account a = new Account("Test", "User", "[email protected]"); assertEquals(a.getLastName(), "User", "User last name not equal to 'User'."); a.setLastName("Doe"); assertEquals(a.getLastName(), "Doe", "User last name not equal to 'Doe'."); } @Test public void testEmail() { Account a = new Account("Test", "User", "[email protected]"); assertEquals(a.getEmail(), "[email protected]", "User email not equal to '[email protected]'."); a.setEmail("[email protected]"); assertEquals(a.getEmail(), "[email protected]", "User email not equal to '[email protected]'."); } @Test public void testAcceptedTermsOfService() { Account a = new Account(); a.setTermsOfService(true); assertTrue(a.acceptedTermsOfService(), "Accepted Terms of Service not true."); a.setTermsOfService(false); assertFalse(a.acceptedTermsOfService(), "Accepted Terms of Service not false."); } @Test public void testAcceptedSystemEmails() { Account a = new Account(); a.setSystemEmails(true); assertTrue(a.acceptedSystemEmails(), "System Emails is not true."); a.setSystemEmails(false); assertFalse(a.acceptedSystemEmails(), "System Emails is not false."); } }

    Read the article

  • How to select only the first rows for each unique value of a column

    - by nuit9
    Let's say I have a table of customer addresses: CName | AddressLine ------------------------------- John Smith | 123 Nowheresville Jane Doe | 456 Evergreen Terrace John Smith | 999 Somewhereelse Joe Bloggs | 1 Second Ave In the table, one customer like John Smith can have multiple addresses. I need the select query for this table to return only first row found where there are duplicates in 'CName'. For this table it should return all rows except the 3rd (or 1st - any of those two addresses are okay but only one can be returned). Is there a keyword I can add to the SELECT query to filter based on whether the server has already seen the column value before?

    Read the article

  • Devise email confirmation from localhost

    - by John
    I am able to get the registration confirmation email to send out in deployment on Heroku, but when I try a registration on localhost:3000, I get the following error: undefined local variable or method `confirmed_at' for #<User:0xb67a1ff0> In my config/environments/production.rb file I have: config.action_mailer.default_url_options = { :host => 'xxxx.com' } And I have an initializer file with the following format: ActionMailer::Base.smtp_settings = { :user_name => "[email protected]", :password => "xxxxxx", :domain => "xxxx.com", :address => "smtp.sendgrid.net", :port => "xxx", :authentication => :plain, :enable_starttls_auto => true }; What settings do I need to get the localhost working? Thanks! John

    Read the article

  • Gridview : Hyperlink and description in the same column cell

    - by John McNamara
    Hi Guys, Apologies for the newbie question. My client wishes me to make a small change to the gridview on his http://www.flogitdonegal.com/SearchPage.aspx page. Note the way the Title column is a hyperlink to view more information. This comes from a 'BriefDescription' field in the database. How can I add 250 chars from the 'FullDescription' underneath the Title in the same cell, but I dont want it be a hyperlink. Essentially it will be 2 fields coming into the same column. Thanks in advance for all help. John

    Read the article

  • Anchoring the Action URL of a Form

    - by John
    Hello, I am using a function that leads users to a file called "comments2.php": <form action="http://www...com/.../comments/comments2.php" method="post"> On comments2.php, data passed over from the form is inserted into MySQL: $query = sprintf("INSERT INTO comment VALUES (NULL, %d, %d, '%s', NULL)", $uid, $subid, $comment); mysql_query($query) or die(mysql_error()); Then, later in comments2.php, I am using a query that loops through entries meeting certain criteria. The loop contains a row with the following information: echo '<td rowspan="3" class="commentname1" id="comment-' . $row["commentid"] . '">'.stripslashes($row["comment"]).'</td>'; For the function above, I would like the URL to be anchored by the highest value of "commentid" for id="comment-' . $row["commentid"] . '" How can this be done? Thanks in advance, John

    Read the article

  • AJAX: Statusbar: force update of UpdatePanel while function executes

    - by John Bourke
    Hi Guys, I have a label inside an update panel which I wouldl ike to use as a status bar. Basically the user clicks a button which executes a main fucntion that performs a series of tasks. I'd like to inform the user as to the state of the function as it progresses e.g.: Stage 1: Retrieving data... Stage 2: Calculating values... Stage 3: Printing values... Stage 4: Done! I've tried updating the updatepanel directly from the function but it only updates the panel at the end of function (stage 4) and shows "Done!" (which I understand is how it should work). I've been looking into timers and threads to try and update the panel seperate to the main function but I thought I'd post here incase anyone has any better ideas? Thanks for any help in advance! John bourkeyo is offline Reply With Quote

    Read the article

  • .htaccess URL is being cut at a space (I'm using Codeigniter)

    - by Ice
    I've used the following code to map https://live.example.com on to http://example.com/api Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTPS} =on RewriteCond %{HTTP_HOST} ^live\.example\.com [NC] RewriteRule (.+)$ "http://example.com/api/$1" [L,P] The following url: https://live.example.com/userlinks/xml/John%20James/MvPjeUTo15/ Is suppose to map onto: http://example.com/api/userlinks/xml/John%20James/MvPjeUTo15/ Instead it maps it to: http://example.com/api/userlinks/xml/John So it seems to cut it at the space. I am using the Codeigniter framework but I am not sure if the problem lies there. Also using %20 or just a space in the url bar produces no different results. Anyone any idea and/or solution why this happens? Thank you very much, Ice

    Read the article

  • correct approach to store in database

    - by John
    I'm developing an online website (using Django and Mysql). I have a Tests table and User table. I have 50 tests within the table and each user completes them at their own pace. How do I store the status of the tests in my DB? One idea that came to my mind is to create an additional column in User table. That column containing testid's separated by comma or any other delimiter. userid | username | testscompleted 1 john 1, 5, 34 2 tom 1, 10, 23, 25 Another idea was to create a seperate table to store userid and testid. So, I'll have only 2 columns but thousands of rows (no of tests * no of users) and they will always continue to increase. userid | testid 1 1 1 5 2 1 1 34 2 10

    Read the article

  • How to create an object reference to a xaml page from App.xaml.cs codebehind?

    - by John K.
    Hi all, I have a Silverlight 4 Business Project where I have enabled the ASP.NET Authentication/Authorization role information. I would like to pass the currently authenticated user's account information from the app.xaml.cs codebehind to a different XAML page, but I have no idea how that is done, or if it's even possible. My goal is to databind the IsEnabled property of various buttons of my target XAML page, based on whether the current user is in a particular admin related role or not. The Application_UserLoaded event handler of app.xaml.cs seems to be the safest event handler to initiate this task because it fires only after the user's account information is loaded from the server. I had previously attempted to retrieve the current user information directly from my target XAML page, but I was never getting the current user information because Application_UserLoaded hadn't finished loading the current user info yet. public partial class App : Application { private void Application_UserLoaded(LoadUserOperation operation) { // How do you create an object reference to a XAML page from your project solution // from this event handler? } } Thanks in advance for any assistance, John

    Read the article

  • Moving Webdav app from Win server 2k to Win server 2k3 now getting authentication issues.

    - by John
    I have an intranet web app that uses CSS httpFolder to map a webdav folder to an IFrame on a web page. The user then can drop files in the frame and the page processes them when the user presses the button. This works well on a Win 2k SP4 server running IIS 5. I have moved the app over to a Win 2k3 server running IIS 6. I have made sure the WebDAV extensions are allowed. I have set everything else in IIS to match the original installation on the old server. But when I try to access the WebDAV folder I am repeatedly prompted for my login credentials. I use my domain admin login but even that doesn't work. What am I missing? What differences are there between WebDAV on 2k vs 2k3? TIA John

    Read the article

  • How- XLST Transformation

    - by Yuan Ray
    Just wanted to ask on how to get the author names in the given xml sample below and put an attribut of eq="yes". EQ means Equal Contributors. This is the XML. <ArticleFootnote Type="Misc"> <Para>John Doe and Jane Doe are equal contributors.</Para> </ArticleFootnote> This should be the output in other form of XML. <AuthorGroups> <Authors eq="yes">John Doe</Authors> <Authors eq="yes">Jane Doe</Authors> </AuthorGroups> Assuming that JOhn Doe and Jane Doe are already defined in the list of authors but after the transformation, author tag should have the attribute eq="yes". Please help as I don't know much writing in xlst. Thanks in advance.

    Read the article

  • Allowing New Users to Invite Their Gmail Contacts

    - by John
    Hello, For my site, I would like to give new users the option to invite all of their Gmail contacts to join. What is the basic step-by-step process to set this up? (Also, is it necessary to buy an SSL for this?) Thanks in advance, John EDIT: My site has a basic login where users set up a username and password. I would like to give users the option to invite their Gmail contacts right after they create their new profile. I would also like to give them the option to invite their Gmail contacts anytime they want.

    Read the article

  • php / mysql - select id from one table excepting ids which are in second table

    - by John
    hello. for example i have 2 tables: 1 . users: id Name 1 Mike 2 Adam 3 Tom 4 John 5 Andy 6 Ray 2 . visits: userID date 1 ... 3 ... 6 ... i want to make a page which can be visited once in 12 hours, when user visits that page his id is included in database ( visits ), how i can select all users ( from database users) excepting users who visited page in <= 12 hours ( users from database visits )?

    Read the article

  • Making a Link Appear if a Condition is Met

    - by John
    Hello, The PHP code below echoes a link if the "loginid" of the logged-in user is on a list determined by getEditorList();. It works fairly well, but I think it might work better if I were to do it with Javascript instead. How could I accomplish the same thing with Javascript? Thanks in advance, John $editors = getEditorsList(); foreach($editors as $editor) { $editorids[] = $editor['loginid']; } if(in_array($_SESSION['loginid'], $editorids)) { echo "<div class='footervote'><a href='http://www...com/.../footervote.php'>Vote</a></div>"; } Login function: <?php if (!isLoggedIn()) { if (isset($_POST['cmdlogin'])) { if (checkLogin($_POST['username'], $_POST['password'])) { show_userbox(); } else { echo "Incorrect Login information !"; show_loginform(); } } else { show_loginform(); } } else { show_userbox(); } ?>

    Read the article

  • @media queries - one rule overrides another?

    - by John
    I have multiple @media queries all working fine but as soon as i put in a higher max screen-width than 1024px the rules for the higher width gets applied to everything. @media screen and (max-width: 1400px) { #wrap { width: 72%; } } @media screen and (max-width: 1024px) { #slider h2 { width: 100%; } #slider img { margin: 60px 0.83333333333333% 0 2.08333333333333%; } .recent { width: 45.82%; margin: 10px 2.08333333333334% 0 1.875%; } } as you can see 1024px (and also the 800px max-width query) do not change the #wrap width and work fine. As soon as i add the 1400px max-width query it changes them to 72% for ALL sizes and does the same for any element - for instance if i set #slider img to have a margin of 40px it will show at ALL sizes even though it is only in the max-width of 1400px. Am i missing something really obvious? Been trying to work this out for the past 2 days! Thanks, John

    Read the article

  • Core Data and BOOL setup

    - by John Valen
    I am working on an app that uses Core Data as its backend for managing SQLite records. I have everything working with strings and numbers, but have just tried adding BOOL fields and can't seem to get things to work. In the .xcdatamodel, I have added a field to my object called isCurrentlyForSale which is not Optional, not Transient, and not Indexed. The attribute's type is set to Boolean with default value NO. When I created the class files from the data model, the boilerplate code added for this property in the .h header was: @property (nonatomic, retain) NSNumber * isCurrentlyForSale; along with the @dynamic isCurrentlyForSale; in the .m implementation file. I've always worked with booleans as simple BOOLs. I've read that I could use NSNumber's numberWithBool and boolValue methods, but this seems like an aweful lot of extra code for something so simple. Can the @property in the header be changed to a simple BOOL? If so is there anything to watch out for? Thanks -John

    Read the article

  • Update Message on ASP.NET ModelPopupExtender

    - by John
    Hi, I have a form in a MS AJAX ModalPopup Extender, which is in a UpdatePanel (for async loading). Everything works as expected. There is one thing that I am trying to do but not sure how to do it. On form submission, there is server side validation on top of client side validation. My question is: what is the best way to display validation error messages if any? It would be ideal if the messages could be written to the popup asynchronously so that the popup is still there. If this is not possible, I am thinking of displaying the messages using the JavaScript alert box. Any insight and suggestions are greatly appreciated. John

    Read the article

  • How to extract data from a text file

    - by šljaker
    I need to parse some large text file and extract Display name and area code only if it matches the following pattern: Line starts with display name (any number of words) Followed by 6 digits (can contain spaces) Followed by #text tag e.g. John doe 123 456 #text some text Display name: John doe Area code: 123 456 Test 123456 #text Display name: Test Area code: 123456 Test 123 #test Invalid, area code contains only 3 digits Test 123456 #test1 Invalid, contains invalid tag Test 123g45 #test Invalid, area code contains letters etc. I know how to open the text file and read it line by line, but having trouble with writing the regular expression. Any help would be greatly appreciated! edit: I have tried this: private static void Main(string[] args) { string text = "John Doe 123 45 #text Lorem ipsum dolor :)"; string pattern = @"(\w+)*([0-9]{2,5}).([0-9]{2,5}).#text"; Match match = Regex.Match(text, pattern, RegexOptions.IgnoreCase); if (match.Success) { string key = match.Groups[0].Value; Console.WriteLine(key); } }

    Read the article

  • Using a Time Zone Conversion When Dynamically Generating Results

    - by John
    Hello, If I understand correctly, the code below converts $row["datesubmitted"] from one timezone to another. I would like to print the converted $row["datesubmitted"] dynamically in an HTML table. Is there a way that I can apply the conversion below for each row that is pulled from MySQL? I assume that I can't just plug $row["dt"] into the code since there is no field called "dt" in the MySQL that I am using. Thanks in advance, John $dt = new DateTime($row["datesubmitted"], $tzFrom); $dt->setTimezone($tzTo);

    Read the article

  • How to determine the timezone that an email was sent from in C#

    - by John Sibly
    Can anyone recommend a way to determine the timezone that an email was sent from in C#? Looking at the header information of an email includes information like: Received: from mail-ew0-f211.google.com (123.85.219.211) by UKExchange (10.1.10.99) with Microsoft SMTP Server id 1.2.345.6; Tue, 13 Apr 2010 14:26:24 +0100 Received: by ewy3 with SMTP id 3so288857ewy.6 for <[email protected]>; Tue, 13 Apr 2010 06:26:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.213.2 with HTTP; Tue, 13 Apr 2010 06:26:23 -0700 (PDT) X-Originating-IP: [83.244.243.210] Date: Tue, 13 Apr 2010 14:26:23 +0100 Received: by 10.103.3.17 with SMTP id f17mr3087878mui.123.1271165183473; Tue, 13 Apr 2010 06:26:23 -0700 (PDT) There are a number of "Received: from" and "Received: by" keys with a date, time and timezone indicated on the end. Which one of these should I attempt to parse? Is this a reliable way to figure out the sender's timezone, or anyone recommend a better way?

    Read the article

  • Extracting multiple values from a string with RegEx

    - by Toni Frankola
    I have an input string that's generated as in following example: string.Format("Document {0}, was saved by {1} on {2}. The process was completed {3} milliseconds and data was received.", "Document.docx", "John", "1/1/2011", 45); Generate string looks like this then: Document Document.docx, was saved by John on 1/1/2011. The process was completed 45 milliseconds and data was received. Once such a string is received from a different application, what would be the easiest way to parse with regex and extract values Document.docx, John, 1/1/2011, 45 from it. I am looking for the easiest way to do this as we will have to parse a number of different input strings.

    Read the article

  • Creating a Variable of Present Date Minus a Past Timestamp

    - by John
    Hello, In the code below, "created" is a field in a MySQL table. This field is of the type "timestamp" and the default is set to "CURRENT_TIMESTAMP" of whenever a given row is created. In the query below, I would like to create a new variable that equals the present date minus the timestamp of "created", rounded off to units of days. I would like the present date to be whenever the query is run. How could I do this? Thanks in advance, John $sqlStr = "SELECT l.loginid, l.username, l.created, ...

    Read the article

  • Could I use Revert after abrupting Merge?

    - by John
    Hallo all, Just now I tried to upload a modified working copy to its branch in the following steps: 1. Update 2. Commit Then I attempted to Merge the changes in the trunk to this branch. However during editing of the conflicts I realized there were so many conflicting codes that I could not address completely today, then I gived up the Merge, and the working copy got an exclamation mark immediately. Thru Check for modifications I found that many many files had been modified or had conflicts. It seems that the Merge has been somehow wrongly carried out. My question: could I return to the state before the Merge simply using Revert? Thanks a lot in advance, John

    Read the article

  • What's the fastest way to approximate the period of data using Octave?

    - by John
    I have a set of data that is periodic (but not sinusoidal). I have a set of time values in one vector and a set of amplitudes in a second vector. I'd like to quickly approximate the period of the function. Any suggestions? Specifically, here's my current code. I'd like to approximate the period of the vector x(:,2) against the vector t. Ultimately, I'd like to do this for lots of initial conditions and calculate the period of each and plot the result. function xdot = f (x,t) xdot(1) =x(2); xdot(2) =-sin(x(1)); endfunction x0=[1;1.75]; #eventually, I'd like to try lots of values for x0(2) t = linspace (0, 50, 200); x = lsode ("f", x0, t) plot(x(:,1),x(:,2)); Thank you! John

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >