Search Results

Search found 1689 results on 68 pages for 'andrew 1510'.

Page 39/68 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • library to determine indefinite article of a noun

    - by Andrew Bullock
    Are there any libraries for .NET that deal with determining the Indefinite Article of a noun? My crude attempt is below, which will probably work for 99% of my usage (which is acceptable) just wondering if there are any established alternatives? public static string GetIndefinateArticle(string noun) { if(string.IsNullOrEmpty(self)) return self; var first = noun[0]; if(first == 'a' || first == 'e' || first == 'i' || first == 'o') return "a " + self; return "an " + self; }

    Read the article

  • C++ portable end of line

    - by Andrew
    Hi everyone, is there any way to automatically use correct EOL character depending on the OS used? I was thinking of something like std::eol? I know that it is very easy to use preprocessor directives but curious if that is already available.

    Read the article

  • Google App Engine Needs Index Error

    - by Andrew Johnson
    I am currently getting a needs index error on my app engine app: http://www.gaiagps.com/wiki/home. I believe this index should have been created automatically by my index.yaml file (see below). Googling a bit, I think I just need to wait for my index to be built. Is this correct, or do I need to do something manually? Is there some sort of index-building queue? My tables are very, very small right now. EDIT: I added the line "indexes:" to my app.yaml, and now app engine reports the index is building, so I think this is fixed. It's weird that this file was wrong considering I've never touched it. indexes: # AUTOGENERATED # This index.yaml is automatically updated whenever the dev_appserver # detects that a new type of query is run. If you want to manage the # index.yaml file manually, remove the above marker line (the line # saying "# AUTOGENERATED"). If you want to manage some indexes # manually, move them above the marker line. The index.yaml file is # automatically uploaded to the admin console when you next deploy # your application using appcfg.py. - kind: Revision properties: - name: name - name: created The app works on my dev server, but not in production. However, on my dev console, I have noticed this error (EDIT: THIS ERROR IS GONE NOW THAT I ADDED indexes: to the app.yaml file above): ERROR 2009-10-18 04:46:51,908 dev_appserver_index.py:176] Error parsing /gaiagps.com/index.yaml: 'NoneType' object is not callable in "<string>", line 13, column 3: - kind: Revision ^

    Read the article

  • How to create an "endless" scrolling slideshow?

    - by Andrew
    I know a good bit of JS and I'm familiar with jQuery, and I'm trying to create an "endless" slideshow (like the one on http://thisismedium.com/), where the images scroll -- one right behind the other -- and when it reaches the end it loops. I don't really know how to start, so I was hoping someone could point me in the right direction. I created a slideshow before that automatically switched images and let you click Next and Previous, but I'm stuck here. =/.

    Read the article

  • Can I ensure all tests contain an assertion in test/unit?

    - by Andrew Grimm
    With test/unit, and minitest, is it possible to fail any test that doesn't contain an assertion, or would monkey-patching be required (for example, checking if the assertion count increased after each test was executed)? Background: I shouldn't write unit tests without assertions - at a minimum, I should use assert_nothing_raised if I'm smoke testing to indicate that I'm smoke testing. Usually I write tests that fail first, but I'm writing some regression tests. Alternatively, I could supply an incorrect expected value to see if the test is comparing the expected and actual value.

    Read the article

  • Win32 select/poll/eof/ANYTHING!?!?!

    - by Andrew
    Using the standard Win32 file I/O API's (CreateFile/ReadFile/etc), I'm trying to wait for a file to become readable, or for an exception to occur on the file. If Windows had any decent POSIX support, I could just do: select(file_count, files_waiting_for_read, NULL, files_waiting_for_excpt, NULL, NULL); And select will return when there's anything interesting on some of the files. Windows doesn't support select or poll. Fine. I figured I could take the file and do something like: while(eof(file_descriptor)) { Sleep(100); } The above loop would exit when more data is available to be read. But nope, Windows doesn't have an equivalent of eof() either! I could possibly call ReadFile() on the file, and determine if it's at the eof that way. But, then I'd have to handle the reading at that point in time -- I'm hoping to simply be able to figure out that a file is readable, without actually reading it. What are my options?

    Read the article

  • JQuery. Hide elements before they rendered. Best practice

    - by Andrew Florko
    Hello everybody, I want to generate html layout with areas (divs, spans) that can be shown/hidden conditionally. These areas are hidden by default. If I call .hide method with jquery on document.ready these areas may blink (browsers render partially loaded documents). So I apply "display: none" style in html layout. I wonder what is the best practice to avoid blinking, because applying "display:none" breaks incapsulation rule - I know what jquery does with hide/show and use it. If jquery's hiding/showing implementation will change one day, I'll get the whole site unworkable. Thank you in advance

    Read the article

  • Why does font-size only work when I set background-color on a button?

    - by Andrew Latham
    I am in Rails 3.2.6, on Chrome. I have the following code in my html.erb file: <div id="beta"> <%= form_tag({}, {:id => "id_search"}) do %> ID: <%= text_field_tag "beta_id" %> <%= submit_tag "Go" %> <% end %> </div> When I set the font-size to 24pt in my CSS file, the text field changes properly, but the button doesn't change at all. I pulled it up in my Developer Tools, and it was getting the CSS property, but just not changing its font size. Even when I put !important, nothing happened. I couldn't change the font-family either. JSFiddle: http://jsfiddle.net/R5CXg/ Changing other properties worked. When I changed the background-color property, the button suddenly turned square instead of round, and popped into the correct font-size and font-family. Why was this the case and how can I work around it?

    Read the article

  • PHP / C++ space calculations for parcel packing

    - by Andrew Willis
    I am working on a shopping cart project which requires a 'postage calculator' based on items that the person has in their cart. Obviously I will be storing the item's dimensions incl. weight and padding in a database and will also store the parcel (box) size and weight that the items will go in to, incl. box padding. Figuring the weight of the parcels will be easy but I was wondering how to go about figuring how to pack the box via PHP, that is, I would like the code to 'play tetris' with the items to make sure they get the best possible fit, giving accurate postage costs. Does anybody have any ideas on how best to achieve this or does anybody know of a PHP Class or function that can do this? EDIT: When I said 'best possible fit' maybe I was being optimistic! Having the script try every possible combination of package distribution within the parcel would be over the top, however I could improve the speed by writing the algoritm in C++ and running the program in PHP when the user 'checks out', the return value being an array with the parcel size and weight (which are all that are needed to calculate postage costs)

    Read the article

  • Discriminator based on joined property

    - by Andrew
    Suppose I have this relationship: abstract class Base { int Id; int JoinedId; ... } class Joined { int Id; int Discriminator; ... } class Sub1 : Base { ... } class Sub2 : Base { ... } for the following tables: table Base ( Id int, JoinedId int, ... ) table Joined ( Id int, Discriminator int, ... ) I would like to set up a table-per-hierarchy inheritance mapping for the Base, Sub1, Sub2 relationships, but using the Disciminator property from the Joined class as the discriminator. Here's the general idea for the mapping file: <class name="Base" table="Base"> <id name="Id"><generator class="identity"/></id> <discriminator /> <!-- ??? or <join> or <many-to-one>? --> <subclass name="Sub1" discriminator-value="1">...</subclass> <subclass name="Sub2" discriminator-value="2">...</subclass> </class> Is there any way of accomplishing something like this with the <discriminator>, <join>, or <many-to-one>? NHiberante seems to assume the discriminator is a column on the given table (which makes sense to me.. I know this is unorthodox). Thanks.

    Read the article

  • [PHP] building html tables from query data... faster?

    - by Andrew Heath
    With my limited experience/knowledge I am using the following structure to generate HTML tables on the fly from MySQL queries: $c = 0; $t = count($results); $table = '<table>'; while ($c < $t) { $table .= "<tr><td>$results[0]</td><td>$results[1]</td> (etc etc) </tr>"; ++$c; } $table .= '</table>'; this works, obviously. But for tables with 300+ rows there is a noticeable delay in pageload while the script builds the table. Currently the maximum results list is only about 1,100 rows, and the wait isn't long, but there's clearly a wait. Are there other methods for outputting an HTML table that are faster than my WHILE loop? (PHP only please...)

    Read the article

  • strip all <img> tags within a div

    - by Andrew Welch
    Hi, I have a jcycle plugin on a number of divs which are testimonials. Basically I don't want to show the tag in the testimonial viewed in a block on the front page but rather I do want it to show on another page. So I want to add some jquery or another method that strips the img tags for the front page display. Any ideas how to do this? Thanks Andy

    Read the article

  • Should I call release on these cocoa objective-c variables?

    - by Andrew Arrow
    In the code below I'm making a new NSString with alloc and initializing it with the contents of some file. Because I'm calling alloc I know it's my responsibility to call release on the string when I'm done. But what about the variables "lines" and "line"? Since the method "componentsSeparatedByString" does not start with the word "new" or "create" can I assume "lines" will be autoreleased? Same question for "line" since "objectAtIndex" also does not start with "new" or "create". NSString* buffer = [[NSString alloc] initWithData:[fileManager contentsAtPath:@"/foo"] encoding:NSUTF8StringEncoding]; NSArray* lines = [buffer componentsSeparatedByString:@"\n"]; NSString* line = [lines objectAtIndex:5]; // do something with line [buffer release]; So is the code above okay? Or should I be calling "release" on lines and line too? Thanks.

    Read the article

  • Select Statements in Jobs

    - by Andrew Vogel
    I have inherited a few jobs and I am trying to understand why select statements would be in their steps. I would think that select statements would be pointless in an automated job that displays nothing for an end user.

    Read the article

  • Skype Mac API - Use AppleScript or 5 year old API?

    - by Andrew
    I have a x86_64 app that I would like to have optionally read Skype status messages. However, the 5 year old skype mac framework is 32-bit, and if there is a way to have that compile within a 64-bit app, I haven't found it. My question is, basically, how should I go about doing this? I really only need to get and set the USERSTATUS AWAY/ONLINE string. Using AppleScript, a "Should Skype allow this" dialog pops up... every time. This is highly inefficient and downright irritating. Advice? I'm considering writing a 32-bit CLI wrapper, but that seems like overkill.

    Read the article

  • PHP: How to copy elements from an associative array and place them at the beginning of the array?

    - by Andrew
    I have an array of countries that I will be using in a select menu: array( [0] => " -- Select -- " [1] => "Afghanistan" [3] => "Albania" [4] => "Algeria" [39] => "Canada" [47] => "USA" ) //etc... I want to copy create copies of the Canada and USA entries and place them at the front of my array. So the array should end up looking like this: array( [0] => " -- Select -- " [47] => "USA" [39] => "Canada" [1] => "Afghanistan" [3] => "Albania" [4] => "Algeria" [39] => "Canada" [47] => "USA" ) //etc... The array keys correspond to their ID in the database, so I can't change the keys. How can I achieve this?

    Read the article

  • POSTDATA, ASIHTTPrequest + instapaper

    - by Andrew
    Hi guys, I'm trying to use ASIHTTPRequest to submit links to instapaper (http://www.instapaper.com/api). I'm able to authenticate but I get a 400 response when trying to submit a link, so I'm clearly in need of figuring how to use postdata. Any help appreciated. Sample code attached. Thanks NSURL *url = [NSURL URLWithString:urlInstapaperAddUrl]; ASIHTTPRequest instapaperAuthRequest = [ASIHTTPRequest requestWithURL:url]; [instapaperAuthRequest setDelegate:self]; [instapaperAuthRequest setRequestMethod:@"PUT"]; NSData temp = [[NSData alloc] initWithData:[@"url=http://www.redhat.com" dataUsingEncoding:NSASCIIStringEncoding]]; [instapaperAuthRequest appendPostData:temp]; [instapaperAuthRequest addBasicAuthenticationHeaderWithUsername:@"myusername" andPassword:@"mypassword"]; [instapaperAuthRequest startAsynchronous];

    Read the article

  • Separate functionality depending on Role in ASP.NET MVC

    - by Andrew Bullock
    I'm looking for an elegant pattern to solve this problem: I have several user roles in my system, and for many of my controller actions, I need to deal with slightly different data. For example, take /Users/Edit/1 This allows a Moderator to edit a users email address, but Administrators to edit a user's email address and password. I'd like a design for separating the two different bits of action code for the GET and the POST. Solutions I've come up with so far are: Switch inside each method, however this doesn't really help when i want different model arguments on the POST :( Custom controller factory which chooses a UsersController_ForModerators and UsersController_ForAdmins instead of just UsersController from the controller name and current user role Custom action invoker which choose the Edit_ForModerators method in a similar way to above Have an IUsersController and register a different implementation of it in my IoC container as a named instance based on Role Build an implementation of the controller at runtime using Castle DynamicProxy and manipulate the methods to those from role-based implementations Im preferring the named IoC instance route atm as it means all my urls/routing will work seamlessly. Ideas? Suggestions?

    Read the article

  • Powershell - Splitting variable into chunks

    - by Andrew
    I have written a query in Powershell interrogating a F5 BIG-IP box through it's iControl API to bring back CPU usage etc. Using this code (see below) I can return the data back into a CSV format which is fine. However the $csvdata variable contains all the data. I need to be able to take this variable and for each line split each column of data into a seperate variable. The output currently looks like this: timestamp,"Utilization" 1276181160,2.3282800000e+00 Any advice would be most welcome $SystemStats = (Get-F5.iControl).SystemStatistics ### Allocate a new Query Object and add the inputs needed $Query = New-Object -TypeName iControl.SystemStatisticsPerformanceStatisticQuery $Query.object_name = $i $Query.start_time = $startTime $Query.end_time = 0 $Query.interval = $interval $Query.maximum_rows = 0 ### Make method call passing in an array of size one with the specified query $ReportData = $SystemStats.get_performance_graph_csv_statistics( (,$Query) ) ### Allocate a new encoder and turn the byte array into a string $ASCII = New-Object -TypeName System.Text.ASCIIEncoding $csvdata = $ASCII.GetString($ReportData[0].statistic_data)

    Read the article

  • Practical Experience using Stripes?

    - by Andrew Whitehouse
    I am coming from an Enterprise Java background which involves a fairly heavyweight software stack, and have recently discovered the Stripes framework; my initial impression is that this seems to do a good job of minimising the unpleasant parts of building a web application in Java. Has anyone used Stripes for a project that has gone live? And can you share your experiences from the project? Also, did you consider any other technologies and (if so) why did you chose Stripes?

    Read the article

  • c++ exceptions and program execution logic

    - by Andrew
    Hello everyone, I have been thru a few questions but did not find an answer. I wonder how should the exception handling be implemented in a C++ software so it is centralized and it is tracking the software progress? For example, I want to process exceptions at four stages of the program and know that exception happened at that specific stage: 1. Initialization 2. Script processing 3. Computation 4. Wrap-up. At this point, I tried this: int main (...) { ... // start logging system try { ... } catch (exception &e) { cerr << "Error: " << e.what() << endl; cerr << "Could not start the logging system. Application terminated!\n"; return -1; } catch(...) { cerr << "Unknown error occured.\n"; cerr << "Could not start the logging system. Application terminated!\n"; return -2; } // open script file and acquire data try { ... } catch (exception &e) { cerr << "Error: " << e.what() << endl; cerr << "Could not acquire input parameters. Application terminated!\n"; return -1; } catch(...) { cerr << "Unknown error occured.\n"; cerr << "Could not acquire input parameters. Application terminated!\n"; return -2; } // computation try { ... } ... This is definitely not centralized and seems stupid. Or maybe it is not a good concept at all?

    Read the article

  • Rails auto_complete "undefined method `auto_complete_for'" problem

    - by Andrew Wize
    rails - 2.3.8 ruby - 1.8.7 After auto_complete plugin installstion i still have "undefined method `auto_complete_for'" problem! Andrey-Bezruks-MacBook-Pro:eyeonasia.stage wizeflux$ ruby script/plugin install http://github.com/rails/auto_complete.git --force svn: '/Users/wizeflux/Projects/ionasia/eyeonasia.stage/vendor/plugins' is not a working copy Initialized empty Git repository in /Users/wizeflux/Projects/ionasia/eyeonasia.stage/vendor/plugins/auto_complete/.git/ warning: Option "depth" is ignored for github.com/rails/auto_complete.git From github.com/rails/auto_complete * branch HEAD - FETCH_HEAD Andrey-Bezruks-MacBook-Pro:eyeonasia.stage wizeflux$ after restarting server i get an error on line " auto_complete_for :listings, :name " - undefined method `auto_complete_for' for #

    Read the article

  • Common lisp, CFFI, and instantiating c structs

    - by andrew
    Hi, I've been on google for about, oh, 3 hours looking for a solution to this "problem." I'm trying to figure out how to instantiate a C structure in lisp using CFFI. I have a struct in c: struct cpVect{cpFloat x,y;} Simple right? I have auto-generated CFFI bindings (swig, I think) to this struct: (cffi:defcstruct #.(chipmunk-lispify "cpVect" 'classname) (#.(chipmunk-lispify "x" 'slotname) :double) (#.(chipmunk-lispify "y" 'slotname) :double)) This generates a struct "VECT" with slots :X and :Y, which foreign-slot-names confirms (please note that I neither generated the bindings or programmed the C library (chipmunk physics), but the actual functions are being called from lisp just fine). I've searched far and wide, and maybe I've seen it 100 times and glossed over it, but I cannot figure out how to create a instance of cpVect in lisp to use in other functions. Note the function: cpShape *cpPolyShapeNew(cpBody *body, int numVerts, cpVect *verts, cpVect offset) Takes not only a cpVect, but also a pointer to a set of cpVects, which brings me to my second question: how do I create a pointer to a set of structs? I've been to http://common-lisp.net/project/cffi/manual/html_node/defcstruct.html and tried the code, but get "Error: Unbound variable: PTR" (I'm in Clozure CL), not to mention that looks to only return a pointer, not an instance. I'm new to lisp, been going pretty strong so far, but this is the first real problem I've hit that I can't figure out. Thanks!

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >