Search Results

Search found 1539 results on 62 pages for 'ben wyatt'.

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

  • ASP.NET MVC Session usage

    - by Ben
    Currently I am using ViewData or TempData for object persistance in my ASP.NET MVC application. However in a few cases where I am storing objects into ViewData through my base controller class, I am hitting the database on every request (when ViewData["whatever"] == null). It would be good to persist these into something with a longer lifespan, namely session. Similarly in an order processing pipeline, I don't want things like Order to be saved to the database on creation. I would rather populate the object in memory and then when the order gets to a certain state, save it. So it would seem that session is the best place for this? Or would you recommend that in the case of order, to retrieve the order from the database on each request, rather than using session? Thoughts, suggestions appreciated. Thanks Ben

    Read the article

  • Rails - Override primary key on has_one

    - by Ben Hall
    I have the following associations, basically I want to link via userid and not the id of the object. class Tweet < ActiveRecord::Base has_one :user_profile, :primary_key = 'userid', :foreign_key = 'twitter_userid' class UserProfile < ActiveRecord::Base belongs_to :tweet, :foreign_key = 'userid' However the following spec fails as twitter_userid is reset to the id of the object it "should have the user's twitter id set on their user profile" do t = Tweet.new(:twitter_id = 1, :status = 'Tester', :userid = 'personA', :user_profile = UserProfile.new(:twitter_userid = 'personA', :avatar = 'abc')) t.save! t.user_profile.twitter_userid.should == 'personA' end should have the user's twitter id set on their user profile expected: "personA", got: 216 (using ==) However, the following does pass: it "should return the correct avatar after being saved" do t = Tweet.new(:twitter_id = 1, :status = 'Tester', :userid = 'personA', :user_profile = UserProfile.new(:twitter_userid = 'personA', :avatar = 'abc')) t.save! t.user_profile.avatar.should == 'abc' end How can I force it to use userid and not id? Thanks Ben

    Read the article

  • Training speech recognition software

    - by wyatt
    A little left field, but I'm trying to train a speech recognition program and the guidelines suggest that I attempt to speak clearly but naturally. I notice, however, that when one speaks naturally each word tends to drift into the next, resulting in a rather ambiguous boundary between the words. One the one hand, speaking in a more stilted manner would seem to aid the computer in recognising the phonemes, but on the other it would tend to make it less likely to understand more natural speech. Anyone knowledgeable in the field out there who can suggest which of the two approaches is more effective? Thanks

    Read the article

  • How to display some data differnetly than it is stored.

    - by Ben
    Hello, I seem to have a problem that I can't find a solution for. I have a table that has this format. projectId | departmentId | plan | ETC | month | year | ID But, I need to find a way to take that data and display it like this. Since this is my first time here I can't upload an image, but you can view it here. http://img85.imageshack.us/img85/8253/image004y.png Is this something a gridview can handle, or a repeater, or something else? Thank you. Ben

    Read the article

  • CLR Function not working in restored database

    - by Ben Thul
    So I've restore a database with CLR assemblies in it from one physical server to another. One of the functions in the CLR assembly essentially does an uncompress of some compressed data. When I run this function against data in the restored database it returns the compressed data (rather than the uncompressed data). No error is thrown in SSMS or in the SQL server error logs. At the suggestion of others, I've checked differences in the database ownership (both owned by sa), trustworthiness (both set to not trustworthy). I also checked differences in the .NET framework installs on both machines but found only that the target machine had a 1.1 version installed that the source didn't. I don't know what else to try. Any suggestions would be most appreciated. Thanks in advance. Thanks in advance, Ben

    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

  • 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 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

  • C++ casted realloc causing memory leak

    - by wyatt
    I'm using a function I found here to save a webpage to memory with cURL: struct WebpageData { char *pageData; size_t size; }; size_t storePage(void *input, size_t size, size_t nmemb, void *output) { size_t realsize = size * nmemb; struct WebpageData *page = (struct WebpageData *)output; page->pageData = (char *)realloc(page->pageData, page->size + realsize + 1); if(page->pageData) { memcpy(&(page->pageData[page->size]), input, realsize); page->size += realsize; page->pageData[page->size] = 0; } return realsize; } and find the line: page->pageData = (char *)realloc(page->pageData, page->size + realsize + 1); is causing a memory leak of a few hundred bytes per call. The only real change I've made from the original source is casting the line in question to a (char *), which my compiler (gcc, g++ specifically if it's a c/c++ issue, but gcc also wouldn't compile with the uncast statement) insisted upon, but I assume this is the source of the leak. Can anyone elucidate? Thanks

    Read the article

  • buffer size for socket connection in c++

    - by wyatt
    I'm trying to build a basic POP3 mail client in C/++, but I've run into a bit of an issue. Since you have to define the buffer size when building the program, but a message can be arbitrarily large, how do you, say, get the mail server to send it to you in parts? And if this isn't the correct means of solving the problem, what is? And while I'm here, can anyone confirm for me that RFC 2822 is still the current document defining email layout? Thanks

    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

  • Getting a unix timestamp as a string in C++

    - by wyatt
    I'm using the function time() in order to get a timestamp in C++, but, after doing so, I need to convert it to a string. I can't use ctime, as I need the timestamp itself (in its 10 character format). Trouble is, I have no idea what form a time_t variable takes, so I don't know what I'm converting it from. cout handles it, so it must be a string of some description, but I have no idea what. If anyone could help me with this it'd be much appreciated, I'm completely stumped. Alternately, can you provide the output of ctime to a MySQL datetime field and have it interpreted correctly? I'd still appreciate an answer to the first part of my question for understanding's sake, but this would solve my problem.

    Read the article

  • Accessing a webpage in C++

    - by wyatt
    Is there a good, simple library which allows C++ to load a webpage? I just want to grab the source as text. I'm not using any IDE or significant library, just straight command line. Tangentially, is there something fundamental I'm missing about programming in C++? I would think any language in common use today would have droves of web-based functionality, being so central to computer usage, but I can find next to no discussion on how to accomplish it. I realise C++ significantly predates the modern internet, so it lacking any core ability in the regard is reasonable, but the fact that relevant libraries seem so sparse is baffling. Thanks for your help.

    Read the article

  • Class destructor memory handling in C++

    - by wyatt
    What potential memory leaks won't an implicit destructor handle? I know that if you have anything stored on the heap it won't handle it, and if you have a connection to a file or a database, that needs to be handled manually. Is there anything else? What about, say, non-base data types like vectors? Also, in an explicit destructor, need you destroy non-heap variables which would have been destroyed by the implicit, or are they handled automatically? Thanks

    Read the article

  • variables in abstract classes C++

    - by wyatt
    I have an abstract class CommandPath, and a number of derived classes as below: class CommandPath { public: virtual CommandResponse handleCommand(std::string) = 0; virtual CommandResponse execute() = 0; virtual ~CommandPath() {} }; class GetTimeCommandPath : public CommandPath { int stage; public: GetTimeCommandPath() : stage(0) {} CommandResponse handleCommand(std::string); CommandResponse execute(); }; All of the derived classes have the member variable 'stage'. I want to build a function into all of them which manipulates 'stage' in the same way, so rather than defining it many times I thought I'd build it into the parent class. I moved 'stage' from the private sections of all of the derived classes into the protected section of CommandPath, and added the function as follows: class CommandPath { protected: int stage; public: virtual CommandResponse handleCommand(std::string) = 0; virtual CommandResponse execute() = 0; std::string confirmCommand(std::string, int, int, std::string, std::string); virtual ~CommandPath() {} }; class GetTimeCommandPath : public CommandPath { public: GetTimeCommandPath() : stage(0) {} CommandResponse handleCommand(std::string); CommandResponse execute(); }; Now my compiler tells me for the constructor lines that none of the derived classes have a member 'stage'. I was under the impression that protected members are visible to derived classes? The constructor is the same in all classes, so I suppose I could move it to the parent class, but I'm more concerned about finding out why the derived classes aren't able to access the variable. Also, since previously I've only used the parent class for pure virtual functions, I wanted to confirm that this is the way to go about adding a function to be inherited by all derived classes.

    Read the article

  • Exclude subexpression from regexec in c++

    - by wyatt
    Suppose I was trying to match the following expression using regex.h in C++, and trying to obtain the subexpressions contained: /^((1|2)|3) (1|2)$/ Suppose it were matched against the string "3 1", the subexpressions would be: "3 1" "3" "1" If, instead it were matched against the string "2 1", the subexpressions would be: "2 1" "2" "2" "1" Which means that, depending on how the first subexpression evaluates, the final one is in a different element in the pmatch array. I realise this particular example is trivial, as I could remove one of the sets of brackets, or grab the last element of the array, but it becomes problematic in more complicated expressions. Suppose all I want are the top-level subexpressions, the ones which aren't subexpressions of other subexpressions. Is there any way to only get them? Or, alternatively, to know how many subexpressions are matched within a subexpression, so that I can traverse the array irrespective of how it evaluates? Thanks

    Read the article

  • Overinclusion of libraries C++

    - by wyatt
    I'm reading about how to put a makefile together, but no-one seems to mention what to do if your files require different sets of libraries, they all seem to use the same set of libraries for each file. Since it seems unlikely that every single file has the same libraries, I take it the list they use must amalgamate all of the libraries required across the project. I just wanted to know if there's any downside to including too many libraries, or if the compiler works out which ones are needed and ignores the rest? Thanks

    Read the article

  • kill a process in bash

    - by wyatt
    How do I kill a process which is running in bash - for example, suppose I open a file: $ gedit file.txt is there any way within the command prompt to close it? This example is fairly trivial, since I could just close the window, but it seems to come up a bit, particularly when I mistype commands. Also is there any way to escape an executable which is running? This probably has the same solution, but I thought I'd ask anyway. Thanks

    Read the article

  • Class lookup structure array in C++

    - by wyatt
    I'm trying to create a structure array which links input strings to classes as follows: struct {string command; CommandPath cPath;} cPathLookup[] = { {"set an alarm", AlarmCommandPath}, {"send an email", EmailCommandPath}, {"", NULL} }; which will be used as follows: CommandPath *cPath = NULL; string input; getline(cin, input); for(int i = 0; cPathLookup[i] != ""; i++) { if(cPathLookup[i].command == input) cPath = new cPathLookup[i].cPath; } Obviously, this code is meaningless, but I think my intention is apparent - depending on input, I'd like cPath to be initialized as either a new AlarmCommandPath or a new EmailCommandPath. I could handle it with a function returning an instance depending on input, but a whole sequence of ifs just seems inelegant. I should also note that, in case it's not apparent and important, that AlarmCommandPath and EmailCommandPath are derived from CommandPath, and CommandPath is an abstract class. Thanks for any help you can offer. EDIT: I just noticed that, in spite of CommandPath being abstract, I have a declaration: CommandPath *cPath = NULL; in working code. Why does that compile?

    Read the article

  • How do i pass a number from a list as a parameter in scheme?

    - by wyatt
    I need to take a number from a list and convert it to a number so that i can pass it as a parameter. im trying to make a 1-bit adder in scheme. i've written the code for the or gate and the xor gate and also the half adder and now im trying to combine them all to make a full adder. im not sure if im going about it the right way. any input will be appreciated thank you. (define or-gate (lambda (a b) (if (= a 1) 1 (if (= b 1) 1 0)))) (define xor-gate (lambda (a b) (if (= a b) 0 1))) (define ha (lambda (a b) (list (xor-gate a b)(and-gate a b)))) (define fa (lambda (a b cin) (or-gate (cdr(ha cin (car (ha a b))))(cdr(ha a b))))) the issue i get when i run the program is that the half adder (ha) function outputs a list as a value and that makes the values incompatible with my other procedures because they require numbers and not lists. i feel like there is a simple solution but i dont know it.

    Read the article

  • C++ passing arguments to a program already running

    - by wyatt
    I'm reading through a tutorial on using voice commands to control applications and, in an example of controlling rhythmbox, it suggests commands such as the following can be executed: rhythmbox-client --play rhythmbox-client --pause Why does this not simply open a new instance of the program, and how can I emulate the functionality in my own programs? For example, how could I pass a string to a particular instance of a program? Thanks

    Read the article

  • Multithreaded SDL error in C++

    - by wyatt
    I'm building a program in C++, using SDL, and am occasionally receiving this error: * glibc detected * ./assistant: double free or corruption (!prev) It's difficult to replicate, so I can't find exactly what's causing it, but I just added a second thread to the program, and neither thread run on its own seems to cause the error. The threads don't share any variables, though they both run the functions SDL_BlitSurface and SDL_Flip. Could running these concurrently throw up such an error, or am I barking up the wrong tree? If this is the cause, should I simply throw a mutex around all SDL calls? Thanks

    Read the article

  • compiling a c++ program including mysql

    - by wyatt
    I'm new to gcc, and trying to compile a c++ program which includes mysql.h using the command: g++ -o test test.cpp -L/usr/include/mysql -lmysqlclient -I/usr/include/mysql It works without issue, but I was wondering if someone could explain the arguments to me. I don't like using commands I don't understand. Thanks

    Read the article

  • Exclude subexpression from regex in c++

    - by wyatt
    Suppose I was trying to match the following expression using regex.h in C++, and trying to obtain the subexpressions contained: /^((1|2)|3) (1|2)$/ Suppose it were matched against the string "3 1", the subexpressions would be: "3 1" "3" "1" If, instead it were matched against the string "2 1", the subexpressions would be: "2 1" "2" "2" "1" Which means that, depending on how the first subexpression evaluates, the final one is in a different element in the pmatch array. I realise this particular example is trivial, as I could remove one of the sets of brackets, or grab the last element of the array, but it becomes problematic in more complicated expressions. Suppose all I want are the top-level subexpressions, the ones which aren't subexpressions of other subexpressions. Is there any way to only get them? Or, alternatively, to know how many subexpressions are matched within a subexpression, so that I can traverse the array irrespective of how it evaluates? Thanks

    Read the article

  • functionality of cin in c++

    - by wyatt
    I'm a bit confused by the results of the following function: int main() { string command; while(1) { cin >> command; if(command == "end") return 0; else cout << "Could you repeat the command?" << endl; } return 0; } First of all - the output line ("could you...") repeats once for each individual word in the input (stored in command). So far as I can see, it should only be possible for it to happen once for each instance of the loop. Also, when the line 'if(command == "end")' is changed to 'if(command == "that's all")' it never triggers. A little testing suggested that all of the whitespace was removed from the command. Could someone explain to me what's going on here? Thanks

    Read the article

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