Search Results

Search found 4252 results on 171 pages for 'david 85'.

Page 119/171 | < Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >

  • Get Item from Collection by unique ID

    - by David Murdoch
    I have a collection of Contacts that inherits from CollectionBase: public class ContactCollection : CollectionBase{ //... } each contact in the collection has a unique ID: public class Contact{ public int ContactID{ get; private set; } //... } I think what I would like to do is something like the following: // get the contact by their unique [Contact]ID Contact myPerson = Contact.GetContactById(15); // get all contacts for the customer ContactCollection contacts = customer.GetContacts(); // replaces the contact in the collection with the // myPerson contact with the same ContactID. contacts.ReplaceAt(myPerson); // saves the changes to the contacts and the customer // customer.Save(); There is probably a better way...if so, please suggest it.

    Read the article

  • Listen to HTML/CSS events of web page

    - by David Metcalfe
    I'm looking for a way to listen for an event in the HTML/CSS of a webpage. Basically, a website I use at work lists queues and appointments, which flag as yellow/red based on the amount of time late on taking said appointment. Other than this visual aide, there is no alert of any kind, which is a failing point if one is juggling multiple windows and doesn't notice. What I would like to do is put together a simple way to watch for the tag ID or perhaps the flag hex color, and then alert me in a way of my choosing. The work environment is on OS X, so I presume I'm looking at an Objective-C centric solution unless Applescript is capable of doing this. Any help would be greatly appreciated.

    Read the article

  • Entity Framework - Self Tracking Objects - how to reset client side?

    - by David
    I am using wcf with self tracking entity framework objects. On the client side i have bound an entity to an edit form (which has multiple textboxes and comboboxes). After the user hits Save, the entity is sent through wcf to the server wcf service which will attempt to save the entity. If there is a failure (say a network failure), I need to reset the current entity back to original values. How best can I do this client side? (I recognize with Self Tracking objects there is a property OriginalValues however that collection seems to have count=0) so not sure how to get the original values? Thanks-

    Read the article

  • Select count() max() Date HELP!!! mysql oracle

    - by DAVID
    Hi guys i have a table with shifts history along with emp ids im using this code to retrieve a list of employees and their total shifts by specifying the range to count from: SELECT ope_id, count(ope_id) FROM operator_shift WHERE ope_shift_date >=to_date( '01-MAR-10','dd-mon-yy') and ope_shift_date <= to_date('31-MAR-10','dd-mon-yy') GROUP BY OPE_ID which gives OPE_ID COUNT(OPE_ID) 1 14 2 7 3 6 4 6 5 2 6 5 7 2 8 1 9 2 10 4 10 rows selected. NOW how do i choose the employee with the highest no of shifts under the specified range date, please this is really important

    Read the article

  • Refer to a Spark view component in code

    - by David
    I'm building a mobile AIR app using Flash Builder 4.5. The initial view in my views package is TestHomeView.mxml. I want to refer to it in one of my .as classes elsewhere in the app, and I'm not sure how to do that. Theoretically I should be able to add an "id" attribute to TestHomeView.mxml, but FB gives me an error: "id is not allowed on the root tag of a component". The root tag is s:view. The reason I need to do this is that within another class I make various calculations and then need to pass an array of values to a component in my view class. So in SomeOtherActionScriptClass.as I first assemble the array, myArray, and then in that class I want to do this: myViewComponent.viewArray = myArray; If I'm going to do that, I also need to import the view class into the .as class, which strikes me as weird. So is there a simple way to do what I want, or do I have to dispatch a custom event which contains the array, and listen for it in the view class? Thanks.

    Read the article

  • python + auto ssh proccess to get date info

    - by david
    I need to perform on my linux 5.3 ssh [Linux machine red hat 5.3] date in order to get the date results , during ssh need to answer on the following question (yes/no)? -- yes password: -- diana_123 and then I will get the date results please advice how to do this automated process with python? ( on my Linux I have Python 2.2.3 ) python script should get the IP address number , and perform automatically ssh to 103.116.140.151 and return the date results as --> Fri Nov 18 11:25:18 IST 2011 example of manual proccess: # ssh 103.116.140.151 date The authenticity of host '103.116.140.151 (103.116.140.151)' can't be established. RSA key fingerprint is ad:7e:df:9b:53:86:9f:98:17:70:2f:58:c2:5b:e2:e7. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '103.116.140.151' (RSA) to the list of known hosts. [email protected]'s password: Fri Nov 18 11:25:18 IST 2011

    Read the article

  • An image cropper: How to prevent the default drag n' drop action?

    - by David Gore
    I am developing an image cropper and would like to ask you the following question: In order to prevent the default drag n' drop action when you press the left button on an image and keeping it pressed try to move the mouse, wouldn't it be cross-browser if to just use the picture as a background to a div box? Just like so: <div id="theDiv" style="background:url(pic.png) no-repeat;"></div> How do you think? Is it acceptable? Not too ugly? Or should be done with JS?

    Read the article

  • Unit Testing VS 2008 Using Excel

    - by David
    When using Excel (2003) to provide data for my unit tests it seems to think that when a cell has TRUE / FALSE value that it is null when there has been no preceding cell values e.g. if (TestContext.DataRow["SatisfactionExtremelySatisfied"] != DBNull.Value) model.SatisfactionExtremelySatisfied = (bool)TestContext.DataRow ["SatisfactionExtremelySatisfied"]; Sample Excel Data DataRow SatisfactionExtremelySatisfied 0 1 2 TRUE 3 TRUE When reading the test data using OLEDB the cells with TRUE hold no value but when the preceding cells have the value FALSE entered it correctly gets the values TRUE. Am I missing something?

    Read the article

  • Framework/tool for processing C++ unit tests with numerical output

    - by David Claridge
    Hi, I am working on a C++ application that uses computer vision techniques to identify various types of objects in a sequence of images. The (1000+) images have been hand-classified, so we have an XML file for each image containing a description of where the objects are actually located in the images. I would like to know if there is a testing framework that can understand/graph results from tests that are numeric, in this case some measure of the error in the program's classification of the images, rather than just pass/fail style unit tests. We would like to use something like CDash/CTest for running these automated tests, and viewing over time how improvements to the vision algorithms are causing the images to be more correctly classified. Does anyone know of a tool/framework that can do this?

    Read the article

  • How To perform a SQL Query to DataTable Operation That Can Be Cancelled

    - by David W
    I tried to make the title as specific as possible. Basically what I have running inside a backgroundworker thread now is some code that looks like: SqlConnection conn = new SqlConnection(connstring); SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(Results); conn.Close(); sda.Dispose(); Where query is a string representing a large, time consuming query, and conn is the connection object. My problem now is I need a stop button. I've come to realize killing the backgroundworker would be worthless because I still want to keep what results are left over after the query is canceled. Plus it wouldn't be able to check the canceled state until after the query. What I've come up with so far: I've been trying to conceptualize how to handle this efficiently without taking too big of a performance hit. My idea was to use a SqlDataReader to read the data from the query piece at a time so that I had a "loop" to check a flag I could set from the GUI via a button. The problem is as far as I know I can't use the Load() method of a datatable and still be able to cancel the sqlcommand. If I'm wrong please let me know because that would make cancelling slightly easier. In light of what I discovered I came to the realization I may only be able to cancel the sqlcommand mid-query if I did something like the below (pseudo-code): while(reader.Read()) { //check flag status //if it is set to 'kill' fire off the kill thread //otherwise populate the datatable with what was read } However, it would seem to me this would be highly ineffective and possibly costly. Is this the only way to kill a sqlcommand in progress that absolutely needs to be in a datatable? Any help would be appreciated!

    Read the article

  • tomcat wont start up on linux machine

    - by David
    hi, im new to linux but after spending the day i have got linux running. installed java and tomcat. my goal is host my app with this linux box i've just set up. i know it all works fine from my windows based machine but it is my laptop so i'm planning this as my dedicated server. following many many forums i've now got tomcat 7 installed. however i cannot get it to start. changing to the tomcat directory and "./startup.sh" i get output Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local.tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: usr/lib/jvm/java-6-sun/ Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local.tomcat/bin/c\tomcat-juli.jar thats the end of theoutput. however localhost:8080 is not up. and in the tomcat log file is the error "eval: 1: usr/lib/jvm/java-6-sun//bin/java: not found" hopfully there is some expert here who can help me with this problem. please note that im a novice when it comes to linux. thankyou oh and my version of linux is Ubuntu 10.04 LTS - the Lucid Lynx

    Read the article

  • Create instance of generic type in Java?

    - by David Citron
    Is it possible to create an instance of a generic type in Java? I'm thinking based on what I've seen that the answer is "no" (due to type erasure), but I'd be interested if anyone can see something I'm missing: class SomeContainer<E> { E createContents() { return what??? } } EDIT: It turns out that Super Type Tokens could be used to resolve my issue, but it requires a lot of reflection-based code, as some of the answers below have indicated. I'll leave this open for a little while to see if anyone comes up with anything dramatically different than Ian Robertson's Artima Article.

    Read the article

  • How do I suppress this output?

    - by David
    I have a code chunk in an R Markdown file. ```{r} library(UsingR) ``` Using knitHTML to compile causes the following output, which never happened before I updated to the latest versions of R and RStudio: ## Loading required package: MASS ## Loading required package: HistData ## Loading required package: Hmisc ## Loading required package: grid ## Loading required package: lattice ## Loading required package: survival ## Loading required package: splines ## Loading required package: Formula ## ## Attaching package: 'Hmisc' ## ## The following objects are masked from 'package:base': ## ## format.pval, round.POSIXt, trunc.POSIXt, units ## ## Loading required package: aplpack ## Loading required package: tcltk ## Loading required package: quantreg ## Loading required package: SparseM ## ## Attaching package: 'SparseM' ## ## The following object is masked from 'package:base': ## ## backsolve ## ## ## Attaching package: 'quantreg' ## ## The following object is masked from 'package:Hmisc': ## ## latex ## ## The following object is masked from 'package:survival': ## ## untangle.specials ## ## ## Attaching package: 'UsingR' ## ## The following object is masked from 'package:survival': ## ## cancer How can I suppress this output? Note: echo=FALSE did not work.

    Read the article

  • Could not find generator mini_test:install

    - by David James
    I expected these generators to be available: $ rails g Usage: rails generate GENERATOR [args] [options] MiniTest: mini_test:controller mini_test:helper mini_test:install mini_test:mailer mini_test:model mini_test:scaffold So I ran: $ rails g mini_test:install But got this error: Could not find generator mini_test:install. As for my environment, here is the relevant portion of my Gemfile: group :test, :development do gem 'minitest-rails' end And the resulting portions of my Gemfile.lock: minitest (2.12.1) minitest-rails (0.0.7) minitest (~> 2.12) rails (~> 3.1) I am now in the process of debugging this. I would appreciate any tips. In any case, I will report back.

    Read the article

  • case insensitive for sql LIKE wildcard statement

    - by David Morrow
    sorry if this is a repeat, i looked around some and didnt find what i was after so here goes SELECT * FROM trees WHERE trees.`title` LIKE '%elm%' this works fine, but not if the tree is named Elm or ELM ect... how do i make sql case insensitive for this wild-card search? again apologies if this is repeated. oh, using MySql 5 on apache

    Read the article

  • How to store array of NSManagedObjects in an NSManagedObject

    - by David Tay
    I am loading my app with a property list of data from a web site. This property list file contains an NSArray of NSDictionaries which itself contains an NSArray of NSDictionaries. Basically, I'm trying to load a tableView of restaurant menu categories each of which contains menu items. My property list file is fine. I am able to load the file and loop through the nodes structure creating NSEntityDescriptions and am able to save to Core Data. Everything works fine and expectedly except that in my menu category managed object, I have an NSArray of menu items for that category. Later on, when I fetch the categories, the pointers to the menu items in a category is lost and I get all the menu items. Am I suppose to be using predicates or does Core Data keep track of my object graph for me? Can anyone look at how I am loading Core Data and point out the flaw in my logic? I'm pretty good with either SQL and OOP by themselves, but am a little bewildered by ORM. I thought that I should just be able to use aggregation in my managed objects and that the framework would keep track of the pointers for me, but apparently not. NSError *error; NSURL *url = [NSURL URLWithString:@"http://foo.com"]; NSArray *categories = [[NSArray alloc] initWithContentsOfURL:url]; NSMutableArray *menuCategories = [[NSMutableArray alloc] init]; for (int i=0; i<[categories count]; i++){ MenuCategory *menuCategory = [NSEntityDescription insertNewObjectForEntityForName:@"MenuCategory" inManagedObjectContext:[self managedObjectContext]]; NSDictionary *category = [categories objectAtIndex:i]; menuCategory.name = [category objectForKey:@"name"]; NSArray *items = [category objectForKey:@"items"]; NSMutableArray *menuItems = [[NSMutableArray alloc] init]; for (int j=0; j<[items count]; j++){ MenuItem *menuItem = [NSEntityDescription insertNewObjectForEntityForName:@"MenuItem" inManagedObjectContext:[self managedObjectContext]]; NSDictionary *item = [items objectAtIndex:j]; menuItem.name = [item objectForKey:@"name"]; menuItem.price = [item objectForKey:@"price"]; menuItem.image = [item objectForKey:@"image"]; menuItem.details = [item objectForKey:@"details"]; [menuItems addObject:menuItem]; } [menuCategory setValue:menuItems forKey:@"menuItems"]; [menuCategories addObject:menuCategory]; [menuItems release]; } if (![[self managedObjectContext] save:&error]) { NSLog(@"An error occurred: %@", [error localizedDescription]); }

    Read the article

  • Refactoring common method header and footer

    - by David Wong
    I have the following chunk of header and footer code appearing in alot of methods. Is there a cleaner way of implementing this? Session sess = factory.openSession(); Transaction tx; try { tx = sess.beginTransaction(); //do some work ... tx.commit(); } catch (Exception e) { if (tx!=null) tx.rollback(); throw e; } finally { sess.close(); } The class in question is actually an EJB 2.0 SessionBean which looks like: public class PersonManagerBean implements SessionBean { public void addPerson(String name) { // boilerplate // dostuff // boilerplate } public void deletePerson(Long id) { // boilerplate // dostuff // boilerplate } }

    Read the article

  • How to extract data from F# list

    - by David White
    Following up my previous question, I'm slowly getting the hang of FParsec (though I do find it particularly hard to grok). My next newbie F# question is, how do I extract data from the list the parser creates? For example, I loaded the sample code from the previous question into a module called Parser.fs, and added a very simple unit test in a separate module (with the appropriate references). I'm using XUnit: open Xunit [<Fact>] let Parse_1_ShouldReturnListContaining1 () = let interim = Parser.parse("1") Assert.False(List.isEmpty(interim)) let head = interim.Head // I realise that I have only one item in the list this time Assert.Equal("1", ???) Interactively, when I execute parse "1" the response is: val it : Element list = [Number "1"] and by tweaking the list of valid operators, I can run parse "1+1" to get: val it : Element list = [Number "1"; Operator "+"; Number "1"] What do I need to put in place of my ??? in the snippet above? And how do I check that it is a Number, rather than an Operator, etc.?

    Read the article

  • F# How to tokenise user input: separating numbers, units, words?

    - by David White
    I am fairly new to F#, but have spent the last few weeks reading reference materials. I wish to process a user-supplied input string, identifying and separating the constituent elements. For example, for this input: XYZ Hotel: 6 nights at 220EUR / night plus 17.5% tax the output should resemble something like a list of tuples: [ ("XYZ", Word); ("Hotel:", Word); ("6", Number); ("nights", Word); ("at", Operator); ("220", Number); ("EUR", CurrencyCode); ("/", Operator); ("night", Word); ("plus", Operator); ("17.5", Number); ("%", PerCent); ("tax", Word) ] Since I'm dealing with user input, it could be anything. Thus, expecting users to comply with a grammar is out of the question. I want to identify the numbers (could be integers, floats, negative...), the units of measure (optional, but could include SI or Imperial physical units, currency codes, counts such as "night/s" in my example), mathematical operators (as math symbols or as words including "at" "per", "of", "discount", etc), and all other words. I have the impression that I should use active pattern matching -- is that correct? -- but I'm not exactly sure how to start. Any pointers to appropriate reference material or similar examples would be great.

    Read the article

  • C++ game loop example

    - by David
    Can someone write up a source for a program that just has a "game loop", which just keeps looping until you press Esc, and the program shows a basic image. Heres the source I have right now but I have to use SDL_Delay(2000); to keep the program alive for 2 seconds, during which the program is frozen. #include "SDL.h" int main(int argc, char* args[]) { SDL_Surface* hello = NULL; SDL_Surface* screen = NULL; SDL_Init(SDL_INIT_EVERYTHING); screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE); hello = SDL_LoadBMP("hello.bmp"); SDL_BlitSurface(hello, NULL, screen, NULL); SDL_Flip(screen); SDL_Delay(2000); SDL_FreeSurface(hello); SDL_Quit(); return 0; } I just want the program to be open until I press Esc. I know how the loop works, I just don't know if I implement inside the main() function, or outside of it. I've tried both, and both times it failed. If you could help me out that would be great :P

    Read the article

  • Pass arguments to a parameter class object

    - by David R
    This is undoubtedly a simple question. I used to do this before, but it's been around 10 years since I worked in C++ so I can't remember properly and I can't get a simple constructor call working. The idea is that instead of parsing the args in main, main would create an object specifically designed to parse the arguments and return them as required. So: Parameters params = new Parameters(argc, argv) then I can call things like params.getfile() Only problem is I'm getting a complier error in Visual Studio 2008 and I'm sure this is simple, but I think my mind is just too rusty. What I've got so far is really basic: In the main: #include "stdafx.h" #include "Parameters.h" int _tmain(int argc, _TCHAR* argv[]) { Parameters params = new Parameters(argc, argv); return 0; } Then in the Parameters header: #pragma once class Parameters { public: Parameters(int, _TCHAR*[]); ~Parameters(void); }; Finally in the Parameters class: include "Stdafx.h" #include "Parameters.h" Parameters::Parameters(int argc, _TCHAR* argv[]) { } Parameters::~Parameters(void) { } I would appreciate if anyone could see where my ageing mind has missed the really obvious. Thanks in advance.

    Read the article

  • Interview Programming Questions - In house Exam

    - by David McGraw
    I have a company that would like to bring me in to serve me an hour long exam. No resources other than a pencil and paper. I really couldn't get any sort of feedback on the type of exam (implementation or generic) beside that it would test a few specific areas. Have you done anything like this? What sort of questions did they ask? What's a good way to prepare? I'll probably go in a couple weeks before school starts back up. A time sensitive exam structure is a weak point for me, so what should I absolutely focus down on? If they like the exam, that's when I'll get a face-to-face meeting. An advance thanks goes to everybody who provide their time.

    Read the article

  • How to do rolling balances in Linq2SQL

    - by David Liddle
    Given an account with a list of transactions I would like to output a query that shows each transaction with the rolling balance (just like you would see on an online banking account). TRANSACTIONS - ID - DATE - AMOUNT Here is what I created in T-SQL however was wondering if this can be translated to linq2sql code? select T.ID, convert(char(10), T.DATE, 101) as 'DATE', T.AMOUNT, (select sum(O.AMOUNT) from TRANSACTIONS O where O.DATE < T.DATE or (O.DATE = T.DATE and O.ID <= T.ID)) 'BALANCE' from TRANSACTIONS as T where T.DATE between @pStartDate and @pEndDate order by T.DATE, T.ID Alternatively I guess my other option is to just call a stored procedure for these kind of results. However, I have Services which call Repositories and didn't really want to put the sproc call in the Repository.

    Read the article

  • Improving File Read Performance (single file, C++, Windows)

    - by david
    I have large (hundreds of MB or more) files that I need to read blocks from using C++ on Windows. Currently the relevant functions are: errorType LargeFile::read( void* data_out, __int64 start_position, __int64 size_bytes ) const { if( !m_open ) { // return error } else { seekPosition( start_position ); DWORD bytes_read; BOOL result = ReadFile( m_file, data_out, DWORD( size_bytes ), &bytes_read, NULL ); if( size_bytes != bytes_read || result != TRUE ) { // return error } } // return no error } void LargeFile::seekPosition( __int64 position ) const { LARGE_INTEGER target; target.QuadPart = LONGLONG( position ); SetFilePointerEx( m_file, target, NULL, FILE_BEGIN ); } The performance of the above does not seem to be very good. Reads are on 4K blocks of the file. Some reads are coherent, most are not. A couple questions: Is there a good way to profile the reads? What things might improve the performance? For example, would sector-aligning the data be useful? I'm relatively new to file i/o optimization, so suggestions or pointers to articles/tutorials would be helpful.

    Read the article

< Previous Page | 115 116 117 118 119 120 121 122 123 124 125 126  | Next Page >