Search Results

Search found 7 results on 1 pages for 'layne'.

Page 1/1 | 1 

  • How to handle server-client requests

    - by Layne
    Currently I'm working on a Server-Client system which will be the backbone of my application. I have to find the best way to send requests and handle them on the server-side. The server-side should be able to handle requests like this one: getPortfolio -i 2 -d all In an old project I decided to send such a request as string and the server application had to look up the first part of the string ("getPortfolio"). Afterwards the server application had to find the correct method in a map which linked the methods with the the first part of the string ("getPortfolio"). The second part ("-i 2 -d all") got passed as parameter and the method itself had to handle this string/parameter. I doubt that this is the best solution in order to handle many different requests. Rgds Layne

    Read the article

  • RapidXML, reading and saving values

    - by Layne
    Hello, I've worked myself through the rapidXML sources and managed to read some values. Now I want to change them and save them to my XML file: Parsing file and set a pointer void SettingsHandler::getConfigFile() { pcSourceConfig = parsing->readFileInChar(CONF); cfg.parse<0>(pcSourceConfig); } Reading values from XML void SettingsHandler::getDefinitions() { SettingsHandler::getConfigFile(); stGeneral = cfg.first_node("settings")->value(); /* stGeneral = 60 */ } Changing values and saving to file void SettingsHandler::setDefinitions() { SettingsHandler::getConfigFile(); stGeneral = "10"; cfg.first_node("settings")->value(stGeneral.c_str()); std::stringstream sStream; sStream << *cfg.first_node(); std::ofstream ofFileToWrite; ofFileToWrite.open(CONF, std::ios::trunc); ofFileToWrite << "<?xml version=\"1.0\"?>\n" << sStream.str() << '\0'; ofFileToWrite.close(); } Reading file into buffer char* Parser::readFileInChar(const char* p_pccFile) { char* cpBuffer; size_t sSize; std::ifstream ifFileToRead; ifFileToRead.open(p_pccFile, std::ios::binary); sSize = Parser::getFileLength(&ifFileToRead); cpBuffer = new char[sSize]; ifFileToRead.read( cpBuffer, sSize); ifFileToRead.close(); return cpBuffer; } However, it's not possible to save the new value. My code is just saving the original file with a value of "60" where it should be "10". Rgds Layne

    Read the article

  • MySQL Connector Linker Problem

    - by Layne
    Hey, I'm trying to compile a program with the MySQL C++ Connector but somehow I can't get the linking right. The errors I get are: mysql/lib/libmysqlcppconn.so: undefined reference to `std::ios_base::ios_base()@GLIBCPP_3.2'.... etc locations: libmysqlcppconn.so: mysql/lib/ libmysqlclient.so: /usr/lib/ I tried to follow the tutorial on mysql and some other pages but the results where the same, maybe I missed something.

    Read the article

  • Knight's tour / recursion

    - by Layne
    Hey, I'm trying to learn a little bit more about recursion but somehow I can't solve the knight's tour and I'm hoping someone can point out my logic error. public class main { static int fsize = 5; static int board[][] = new int[fsize][fsize]; static int[] sprung_x = {1,2,2,1,-1,-2,-2,-1}; static int[] sprung_y = {-2,-1,1,2,2,1,-1,-2}; static void SucheWeg(int schrittnummer, int x, int y) { board[x][y] = schrittnummer; if( schrittnummer == ((fsize*fsize)-1)) { for(int i = 0; i<fsize; i++) { for(int c=0; c<fsize; c++) { System.out.printf("%3d", board[i][c]); } System.out.println("\n"); } } else { for(int i = 0; i<8; i++) { for(int c = 0; c<8; c++) { if( (x+sprung_x[i]) >= 0 && (x+sprung_x[i]) < fsize && (y+sprung_y[c]) >= 0 && (y+sprung_y[c]) < fsize ) { if(board[x+sprung_x[i]][y+sprung_y[c]] == -1) { System.out.println("Move: "+schrittnummer + "\n"); SucheWeg(schrittnummer+1, (x+sprung_x[i]), (y+sprung_y[c])); } } } } board[x][y] = -1; } } public static void main(String[] args) { System.out.println("Begin: \n"); for(int i = 0; i<fsize; i++) { for(int c = 0; c<fsize; c++) { board[i][c] = -1; } } SucheWeg(0, 0, 0); System.out.println("\nEnd"); } }

    Read the article

  • Spring-MVC Problem using @Controller on controller implementing an interface

    - by layne
    I'm using spring 2.5 and annotations to configure my spring-mvc web context. Unfortunately, I am unable to get the following to work. I'm not sure if this is a bug (seems like it) or if there is a basic misunderstanding on how the annotations and interface implementation subclassing works. For example, @Controller @RequestMapping("url-mapping-here") public class Foo { @RequestMapping(method=RequestMethod.GET) public void showForm() { ... } @RequestMapping(method=RequestMethod.POST) public String processForm() { ... } } works fine. When the context starts up, the urls this handler deals with are discovered, and everything works great. This however does not: @Controller @RequestMapping("url-mapping-here") public class Foo implements Bar { @RequestMapping(method=RequestMethod.GET) public void showForm() { ... } @RequestMapping(method=RequestMethod.POST) public String processForm() { ... } } When I try to pull up the url, I get the following nasty stack trace: javax.servlet.ServletException: No adapter for handler [com.shaneleopard.web.controller.RegistrationController@e973e3]: Does your handler implement a supported interface like Controller? org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:1091) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:874) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501) javax.servlet.http.HttpServlet.service(HttpServlet.java:627) However, if I change Bar to be an abstract superclass and have Foo extend it, then it works again. @Controller @RequestMapping("url-mapping-here") public class Foo extends Bar { @RequestMapping(method=RequestMethod.GET) public void showForm() { ... } @RequestMapping(method=RequestMethod.POST) public String processForm() { ... } } This seems like a bug. The @Controller annotation should be sufficient to mark this as a controller, and I should be able to implement one or more interfaces in my controller without having to do anything else. Any ideas?

    Read the article

  • priority_queue with dynamic priorities

    - by Layne
    Hey, I have a server application which accepts incomming queries and executes them. If there are too many queries they should be queued and if some of the other queries got executed the queued queries should be executed as well. Since I want to pass queries with different priorities I think using a priority_queue would be the best choice. e.g. The amout of the axcepting queries (a) hit the limt and new queries will be stored in the queue. All queries have a priority of 1 (lowest) if some of the queries from (a) get executed the programm will pick the query with the highest priority out of the queue and execute it. Still no problem. Now someone is sending a query with a priority of 5 which gets added to the queue. Since this is the query with the highest priority the application will execute this query as soon as the running queries no longer hit the limit. There might be the worst case that 500 queries with a priority of 1 are queued but wont be executed since someone is always sending queries with a priority of 5 hence these 500 queries will be queued for a looooong time. In order to prevent that I want to increase the prioritiy of all queries which have a lower priority than the query with the higher priority, in this example which have a priority lower than 5. So if the query with a priority of 5 gets pulled out of the queue all other queries with a priority < 5 should be increased by 0.2. This way queries with a low priority wont be queued for ever even if there might be 100 queries with a higher priority. I really hope can help me to solve the problem with the priorities: Since my queries consist of an object I thought something like this might work: class Query { public: Query( std::string p_stQuery ) : stQuery( p_stQuery ) {}; std::string getQuery() const {return stQuery;}; void increasePriority( const float fIncrease ) {fPriority += fIncrease;}; friend bool operator < ( const Query& PriorityFirst, const Query& PriorityNext ) { if( PriorityFirst.fPriority < PriorityNext.fPriority ) { if( PriorityFirst.fStartPriority < PriorityNext.fStartPriority ) { Query qTemp = PriorityFirst; qTemp.increasePriority( INCREASE_RATE ); } return true; } else { return false; } }; private: static const float INCREASE_RATE = 0.2; float fPriority; // current priority float fStartPriority; // initialised priority std::string stQuery; };

    Read the article

  • Help me please with this error

    - by Brandon
    I setup IIS. I moved my folder with all the files to the IIS directory. Now when I go to http://localhost/thefolder I get: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)] Luxand.FSDK.ActivateLibrary(String LicenseKey) +0 FaceRecognition._Default.Page_Load(Object sender, EventArgs e) in D:\Project Details\Layne Projects\DotNet Project\FaceRecognition\FaceRecognition\Default.aspx.cs:60 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42 System.Web.UI.Control.OnLoad(EventArgs e) +132 System.Web.UI.Control.LoadRecursive() +66 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428

    Read the article

1