Search Results

Search found 352 results on 15 pages for 'joshua robison'.

Page 10/15 | < Previous Page | 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Consulting a Prolog Source Code from within a VS2008 Solution File

    - by Joshua Green
    I have a Prolog file (Hanoi.pl) containing the code for solving the Hanoi Towers puzzle: hanoi( N ):- move( N, left, middle, right ). move( 0, _, _, _ ):- !. move( N, A, B, C ):- M is N-1, move( M, A, C, B ), inform( A, B ), move( M, C, B, A ). inform( X, Y ):- write( 'move a disk from ' ), write( X ), write( ' to ' ), writeln( Y ). I also have a C++ file written in VS2008 IDE: #include <iostream> #include <string> #include <stdio.h> #include <stdlib.h> using namespace std; #include "SWI-cpp.h" #include "SWI-Prolog.h" predicate_t phanoi; term_t t0; int main(int argc, char** argv) { long n = 5; int rval; if ( !PL_initialise(1, argv) ) PL_halt(1); PL_put_integer( t0, n ); phanoi = PL_predicate( "hanoi", 1, NULL ); rval = PL_call_predicate( NULL, PL_Q_NORMAL, phanoi, t0 ); system( "PAUSE" ); } How can I consult my Prolog source code (Hanoi.pl) from within my C++ code? Not from the Command Prompt - from the code, something like include or consult or compile? It is located in the same folder as my cpp file. Thanks,

    Read the article

  • Getting a handle on GIS math, where do I start?

    - by Joshua
    I am in charge of a program that is used to create a set of nodes and paths for consumption by an autonomous ground vehicle. The program keeps track of the locations of all items in its map by indicating the item's position as being x meters north and y meters east of an origin point of 0,0. In the real world, the vehicle knows the location of the origin's lat and long, as it is determined by a dgps system and is accurate down to a couple centimeters. My program is ignorant of any lat long coordinates. It is one of my goals to modify the program to keep track of lat long coords of items in addition to an origin point and items' x,y position in relation to that origin. At first blush, it seems that I am going to modify the program to allow the lat long coords of the origin to be passed in, and after that I desire that the program will automatically calculate the lat long of every item currently in a map. From what I've researched so far, I believe that I will need to figure out the math behind converting to lat long coords from a UTM like projection where I specify the origin points and meridians etc as opposed to whatever is defined already for UTM. I've come to ask of you GIS programmers, am I on the right track? It seems to me like there is so much to wrap ones head around, and I'm not sure if the answer isn't something as simple as, "oh yea theres a conversion from meters to lat long, here" Currently, due to the nature of DGPS, the system really doesn't need to care about locations more than oh, what... 40 km? radius away from the origin. Given this, and the fact that I need to make sure that the error on my coordinates is not greater than .5 meters, do I need anything more complex than a simple lat/long to meters conversion constant? I'm knee deep in materials here. I could use some pointers about what concepts to research. Thanks much!

    Read the article

  • Why do people still use C these days? [closed]

    - by Joshua
    C++ is clearly a far superior language than C, since it has many features that C lacks (although, C++'s object model isn't as ideal as say C#'s). With the coming off the new C++0x standard, why hasn't C been phased out to obscurity? C++ has been around for so long, since the '80s. The Linux kernel has already been ported to C++ with negligible performance differences. I believe, with no evidence, that larger program structures benefit in performance if written in C++ than in C, if only because of object interaction. Don't get me started on "objects-in-C!" libraries, which are all a terrible hack. (Not that C++'s object model is the most ideal, but it is almost up to snuff with C# using common ad-hoc techniques.)

    Read the article

  • I am looking for an actual functional web browser control for .NET, maybe a C++ library

    - by Joshua
    I am trying to emulate a web browser in order to execute JavaScript code and then parse the DOM. The System.Windows.Forms.WebBrowser object does not give me the functionality I need. It let's me set the headers, but you cannot set the proxy or clear cookies. Well you can, but it is not ideal and messes with IE's settings. I've been extending the WebBrowser control pinvoking native windows functions so far, but it is really one hack on top of another. I can mess with the proxy and also clear cookies and such, but this control has its issues as I mentioned. I found something called WebKit .NET (http://webkitdotnet.sourceforge.net/), but I don't see support for setting proxies or cookie manipulation. Can someone recommend a c++/.NET/whatever library to do this: Basically tell me what I need to do to get an interface to similar this in .NET: // this should probably pause the current thread for the max timeout, // throw an exception on failure or return null w/e, VAGUELY similar to this string WebBrowserEmu::FetchBrowserParsedHtml(Uri url, WebProxy p, int timeoutSeconds, byte[] headers, byte[] postdata); void WebBrowserEmu::ClearCookies(); I am not responsible for my actions.

    Read the article

  • Checking if a touch is within a UIButton's bounds.

    - by Joshua
    I am trying to make an if statement which will check whether the users touch is within a UIButton's bounds. I thought this would be an easy affair as UIButton is a subclass of UIView, however my code doesn't seem to work. This is the code I have been using. - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { NSArray *array = [touches allObjects]; UITouch *specificTouch = [array objectAtIndex:0]; currentTouch = [specificTouch locationInView:self.view]; if (CGRectContainsPoint(but.bounds, currentTouch)) { //Do something is in bounds. } //Else do nothing. }

    Read the article

  • c windows connect() fails. error 10049

    - by Joshua Moore
    The following two pieces of code compile, but I get a connect() failed error on the client side. (compiled with MinGW). Client Code: // thanks to cs.baylor.edu/~donahoo/practical/CSockets/code/TCPEchoClientWS.c #include <stdio.h> #include <winsock.h> #include <stdlib.h> #define RCVBUFSIZE 32 // size of receive buffer void DieWithError(char *errorMessage); int main(int argc, char* argv[]) { int sock; struct sockaddr_in echoServAddr; unsigned short echoServPort; char *servIP; char *echoString; char echoBuffer[RCVBUFSIZE]; int echoStringLen; int bytesRcvd, totalBytesRcvd; WSAData wsaData; if((argc < 3) || (argc > 4)){ fprintf(stderr, "Usage: %s <Sever IP> <Echo Word> [<Echo Port>]\n", argv[0]); exit(1); } if (argc==4) echoServPort = atoi(argv[3]); // use given port if any else echoServPort = 7; // echo is well-known port for echo service if(WSAStartup(MAKEWORD(2, 0), &wsaData) != 0){ // load winsock 2.0 dll fprintf(stderr, "WSAStartup() failed"); exit(1); } // create reliable, stream socket using tcp if((sock=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) DieWithError("socket() failed"); // construct the server address structure memset(&echoServAddr, 0, sizeof(echoServAddr)); echoServAddr.sin_family = AF_INET; echoServAddr.sin_addr.s_addr = inet_addr(servIP); // server IP address echoServAddr.sin_port = htons(echoServPort); // establish connection to the echo server if(connect(sock, (struct sockaddr*)&echoServAddr, sizeof(echoServAddr)) < 0) DieWithError("connect() failed"); echoStringLen = strlen(echoString); // determine input length // send the string, includeing the null terminator to the server if(send(sock, echoString, echoStringLen, 0)!= echoStringLen) DieWithError("send() sent a different number of bytes than expected"); totalBytesRcvd = 0; printf("Received: "); // setup to print the echoed string while(totalBytesRcvd < echoStringLen){ // receive up to the buffer size (minus 1 to leave space for a null terminator) bytes from the sender if(bytesRcvd = recv(sock, echoBuffer, RCVBUFSIZE-1, 0) <= 0) DieWithError("recv() failed or connection closed prematurely"); totalBytesRcvd += bytesRcvd; // keep tally of total bytes echoBuffer[bytesRcvd] = '\0'; printf("%s", echoBuffer); // print the echo buffer } printf("\n"); closesocket(sock); WSACleanup(); exit(0); } void DieWithError(char *errorMessage) { fprintf(stderr, "%s: %d\n", errorMessage, WSAGetLastError()); exit(1); } Server Code: // thanks cs.baylor.edu/~donahoo/practical/CSockets/code/TCPEchoServerWS.c #include <stdio.h> #include <winsock.h> #include <stdlib.h> #define MAXPENDING 5 // maximum outstanding connection requests #define RCVBUFSIZE 1000 void DieWithError(char *errorMessage); void HandleTCPClient(int clntSocket); // tcp client handling function int main(int argc, char **argv) { int serverSock; int clientSock; struct sockaddr_in echoServerAddr; struct sockaddr_in echoClientAddr; unsigned short echoServerPort; int clientLen; // length of client address data structure WSAData wsaData; if (argc!=2){ fprintf(stderr, "Usage: %s <Server Port>\n", argv[0]); exit(1); } echoServerPort = atoi(argv[1]); if(WSAStartup(MAKEWORD(2, 0), &wsaData)!=0){ fprintf(stderr, "WSAStartup() failed"); exit(1); } // create socket for incoming connections if((serverSock=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP))<0) DieWithError("socket() failed"); // construct local address structure memset(&echoServerAddr, 0, sizeof(echoServerAddr)); echoServerAddr.sin_family = AF_INET; echoServerAddr.sin_addr.s_addr = htonl(INADDR_ANY); // any incoming interface echoServerAddr.sin_port = htons(echoServerPort); // local port // bind to the local address if(bind(serverSock, (struct sockaddr*)&echoServerAddr, sizeof(echoServerAddr) )<0) DieWithError("bind() failed"); // mark the socket so it will listen for incoming connections if(listen(serverSock, MAXPENDING)<0) DieWithError("listen() failed"); for (;;){ // run forever // set the size of the in-out parameter clientLen = sizeof(echoClientAddr); // wait for a client to connect if((clientSock = accept(serverSock, (struct sockaddr*)&echoClientAddr, &clientLen)) < 0) DieWithError("accept() failed"); // clientSock is connected to a client printf("Handling client %s\n", inet_ntoa(echoClientAddr.sin_addr)); HandleTCPClient(clientSock); } // NOT REACHED } void DieWithError(char *errorMessage) { fprintf(stderr, "%s: %d\n", errorMessage, WSAGetLastError()); exit(1); } void HandleTCPClient(int clientSocket) { char echoBuffer[RCVBUFSIZE]; // buffer for echostring int recvMsgSize; // size of received message // receive message from client if((recvMsgSize = recv(clientSocket, echoBuffer, RCVBUFSIZE, 0) <0)) DieWithError("recv() failed"); // send received string and receive again until end of transmission while(recvMsgSize > 0){ // echo message back to client if(send(clientSocket, echoBuffer, recvMsgSize, 0)!=recvMsgSize) DieWithError("send() failed"); // see if there's more data to receive if((recvMsgSize = recv(clientSocket, echoBuffer, RCVBUFSIZE, 0)) <0) DieWithError("recv() failed"); } closesocket(clientSocket); // close client socket } How can I fix this?

    Read the article

  • Unhandled Exception error message

    - by Joshua Green
    Does anyone know why including a term such as: t = PL_new_term_ref(); would cause an Unhandled Exception error message: 0xC0000005: Access violation reading location 0x0000000c. (Visual Studio 2008) I have a header file: class UserTaskProlog : public ArAction { public: UserTaskProlog( const char* name = " sth " ); ~UserTaskProlog( ); AREXPORT virtual ArActionDesired *fire( ArActionDesired currentDesired ); private: term_t t; }; and a cpp file: UserTaskProlog::UserTaskProlog( const char* name ) : ArAction( name, " sth " ) { char** argv; argv[ 0 ] = "libpl.dll"; PL_initialise( 1, argv ); PlCall( "consult( 'myProg.pl' )" ); } UserTaskProlog::~UserTaskProlog( ) { } ArActionDesired *UserTaskProlog::fire( ArActionDesired currentDesired ) { cout << " something " << endl; t = PL_new_term_ref( ); } Without t=PL_new_term_ref() everything works fine, but when I start adding my Prolog code (declarations first, such as t=PL_new_term_ref), I get this Access Violation error message. I'd appreciate any help. Thanks,

    Read the article

  • What Web design tool would make a good CityDesk replacement?

    - by Joshua Fox
    I am looking for a tool for building static template-based web sites, your typical brochure-ware for a non-profit or a personal site. I have used CityDesk, but that is out-of-date, unsupported, and has certain problems. Of course there are lots of tools out there, but I cannot find anything similar to CityDesk: WYSIWYG as well as HTML coding a templating system not overdesigned like, say, Dreamweaver built for developers who understand HTML/JS/CSS but easier to use than hand-coding of PHP, Ruby, or other templates in a text editor supporting the editing of pages by non-developers preferably free I'd also like it to be CSS-aware; and to have lots of free templates available. Or alternatively, static template-based sites are often developed nowadays on the Web using a CMS like Django; is that the way to go? Edit: Namo, DreamWeaver, NetObjects Fusion, Coffee Cup, Evrsoft First Page, and Microsoft Expression might be candidates. I'll appreciate comments on these based on the criteria above.

    Read the article

  • How to deploy jar artifacts directly from a maven repository to appserver specific directories

    - by Joshua
    I have JDBC driver dependencies (e.g. h2, mysql ..) which have to be copied under ${jboss.home}/common/lib before it is used by my EAR application. What would be the best way to directly copy from a maven repository into the above location instead of doing a manual copy. I would not prefer to store copies of the drivers as part of my SVN. Note: I currently specify this as a maven dependency and copy this artifact from the local repository, not sure if this is the best way to do solve this.

    Read the article

  • Project management and bundling dependencies

    - by Joshua
    I've been looking for ways to learn about the right way to manage a software project, and I've stumbled upon the following blog post. I've learned some of the things mentioned the hard way, others make sense, and yet others are still unclear to me. To sum up, the author lists a bunch of features of a project and how much those features contribute to a project's 'suckiness' for a lack of a better term. You can find the full article here: http://spot.livejournal.com/308370.html In particular, I don't understand the author's stance on bundling dependencies with your project. These are: == Bundling == Your source only comes with other code projects that it depends on [ +20 points of FAIL ] Why is this a problem, (especially given the last point)? If your source code cannot be built without first building the bundled code bits [ +10 points of FAIL ] Doesn't this necessarily have to be the case for software built against 3rd party libs? Your code needs that other code to be compiled into its library before the linker can work? If you have modified those other bundled code bits [ +40 points of FAIL ] If this is necessary for your project, then it naturally follows that you've bundled said code with yours. If you want to customize a build of some lib,say WxWidgets, you'll have to edit that projects build scripts to bulid the library that you want. Subsequently, you'll have to publish those changes to people who wish to build your code, so why not use a high level make script with the params already written in, and distribute that? Furthermore, (especially in a windows env) if your code base is dependent on a particular version of a lib (that you also need to custom compile for your project) wouldn't it be easier to give the user the code yourself (because in this case, it is unlikely that the user will already have the correct version installed)? So how would you respond to these comments, and what points may I be failing to take into consideration? Would you agree or disagree with the author's take (or mine), and why?

    Read the article

  • I am looking for an actual functional web browser type control for .NET, maybe a C++ LIBRARY#$??$?

    - by Joshua
    I am trying to emulate a web browser in order to execute JavaScript code and then parse the DOM. The System.Windows.Forms.WebBrowser object does not give me the functionality I need. It let's me set the headers, but you cannot set the proxy or clear cookies. Well you can, but it is not ideal and messes with IE's settings. I've been extending the WebBrowser control pinvoking native windows functions so far, but it is really one hack on top of another. I can mess with the proxy and also clear cookies and such, but this control has its issues as I mentioned. I found something called WebKit .NET (http://webkitdotnet.sourceforge.net/), but I don't see support for setting proxies or cookie manipulation. Can someone recommend a c++/.NET/whatever library to do this: Basically tell me what I need to do to get an interface to similar this in .NET: string FetchBrowserParsedHtml(Uri url, WebProxy p, int timeoutSeconds, byte[] headers, byte[] postdata); void ClearCookies(); I am not responsible for my actions.

    Read the article

  • Running The JVM From Within An MXML Component

    - by Joshua
    Thinking outside of the box here... What possible basic approaches could be taken in an effort to create a Flex component that could run Java? I know I can easily use flex to browse to or launch a Java app, but there are things I can only do if I can run the Java from WITHIN an MXML Component. I the strictest sense, I know it's not impossible (ie: if you had all the source code for flex and for the jvm), but what's the least impractical means to this end? Showcase your creativity.

    Read the article

  • Flex DataBinding Drilling Down Through Arrays

    - by Joshua
    The help page on the BindUtils.bindProperty function: http://livedocs.adobe.com/flex/3/langref/mx/binding/utils/BindingUtils.html Has this to say: "For example, to bind the property host.a.b.c, call the method as: bindProperty(host, ["a","b","c"], ...)." But what if I need to bind to host.a.b[2].c? How do I do that?

    Read the article

  • Change A Character In A String Using Actionscript

    - by Joshua
    What is the opposite of String.charAt()?? If I Have a string: var Str:String="Hello World"; How do I change the 5th character, for example, from a ' ' to an '_'? I can GET the 5th character like this: var C:String=Str.charAt(5); But how do I SET the 5th character? Thanks in advance.

    Read the article

  • Generating Source Info For Flex BitmapData.

    - by Joshua
    Instead of populating the BitmapData class from an IMAGE. I would like to (within Actionscript) GENERATE some new BitmapData by capturing the Bitmap representing say, a TextArea component on the stage. In other words, sort of take a "screen capture" or "screenshot" of one of the components, and convert that into an image. Am I silly to even wonder if such a thing is feasible? Can an Air/Flex app "look at itself" in this way? Can it turn a datagrid or a canvas or a textinput into the corresponding image AS IF via screen capture? Even a hint in the right direction would be appreciated, Thanks In Advance.

    Read the article

  • C++ Undeclared Identifier (but it is declared?)

    - by Joshua
    I'm pretty sure I've included the qanda class, but when I try to declare a vector that contains it or a class of that type I get an error saying that qanda is undefined. Any idea what the problem might be? bot_manager_item.h #pragma once #include "../bot_packet/bot_packet.h" #include <vector> class bot_manager_item; #include "qanda.h" #include "bot_manager.h" class bot_manager_item { public: bot_manager_item(bot_manager* mngr, const char* name, const char* work_dir); ~bot_manager_item(); bool startup(); void cleanup(); void on_push_event(bot_exchange_format f); bool disable; private: void apply_changes(); bot_manager *_mngr; std::string _name; std::string _work_dir; std::string _message; std::string _message_copy; std::vector<qanda> games; qanda test; char _config_full_path[2600]; }; qanda.h #ifndef Q_AND_A #define Q_AND_A #include "users.h" #include "..\bot_packet\bot_packet.h" #include "bot_manager.h" #include <string> #include <algorithm> #include <map> #include <vector> #include <fstream> class qanda { public: qanda(bot_manager * manager, std::string name, std::string directory); ~qanda(){}; void room_message(std::string username, std::string user_message); void timer_tick(); private: // data members std::string question; std::string answer; std::string directory; std::string command_prefix; std::string name; Users users; std::map <std::string, std::string> questions_and_answers; int time_per_question; // seconds int time_between_questions; // seconds int timer; // milliseconds bool is_delayed; bool is_playing; bot_manager * manager; // functions void new_question(); void send_message(std::string msg); void announce_question(); void load_questions(); }; #endif

    Read the article

  • Cocoa Touch: Why doesn't UINavigationController render 'Back' button?

    - by Joshua
    When I push a view controller it animates properly and slides in, the only problem is that no 'Back' button is rendered up top.The back button is still there, I can still tap it, it just doesn't render on the screen. This behavior is identical in both the simulator and on multiple devices. Is this a known issue or bug? Using 3.1.3 of the iPhone SDK. More information: It renders it for further levels, just not on the second level of nav controller. So Main Page (No back button - OK). Second level page (back button, but doesn't render - not OK). Third level page (Back button there and rendering - OK).

    Read the article

  • How Do I See The Final Text Of A Query Resulting From A Call To mysqli->prepare?

    - by Joshua
    After code like this: $stmt = $mysqli->prepare("SELECT District FROM City WHERE Name=?")) { $stmt->bind_param("s", $city); $stmt->execute(); $stmt->bind_result($district); $stmt->fetch(); printf("%s is in district %s\n", $city, $district); How Do I See The Actual SQL Statement That Was Executed? (It Should Look Something Like "SELECT District FROM City WHERE Name='Simi Valley';") I already realize that in this simplistic case it would be very easy to simply reconstruct the query... but how can I access it in a general way that will work for very complicated prepared statements, and cases where I don't necessarily already understand the intended structure of the query, etc. Isn't there some function or method that can be called on the statement object that will return the actual text of the SQL query, after binding?

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15  | Next Page >