Daily Archives

Articles indexed Friday April 23 2010

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

  • Assign C++ instance method to a global-function-pointer ?

    - by umanga
    Greetings, My project structure is as follows: \- base (C static library) callbacks.h callbacks.c paint_node.c . . * libBase.a \-app (C++ application) main.cpp In C library 'base' , I have declared global-function-pointer as: in singleheader file callbacks.h #ifndef CALLBACKS_H_ #define CALLBACKS_H_ extern void (*putPixelCallBack)(); extern void (*putImageCallBack)(); #endif /* CALLBACKS_H_ */ in single C file they are initialized as callbacks.c #include "callbacks.h" void (*putPixelCallBack)(); void (*putImageCallBack)(); Other C files access this callback-functions as: paint_node.c #include "callbacks.h" void paint_node(node *node,int index){ //Call callbackfunction . . putPixelCallBack(node->x,node->y,index); } I compile these C files and generate a static library 'libBase.a' Then in C++ application, I want to assign C++ instance method to this global function-pointer: I did something like follows : in Sacm.cpp file #include "Sacm.h" extern void (*putPixelCallBack)(); extern void (*putImageCallBack)(); void Sacm::doDetection() { putPixelCallBack=(void(*)())&paintPixel; //call somefunctions in 'libBase' C library } void Sacm::paintPixel(int x,int y,int index) { qpainter.begin(this); qpainter.drawPoint(x,y); qpainter.end(); } But when compiling it gives the error: sacmtest.cpp: In member function ‘void Sacm::doDetection()’: sacmtest.cpp:113: error: ISO C++ forbids taking the address of an unqualified or parenthesized non-static member function to form a pointer to member function. Say ‘&Sacm::paintPixel’ sacmtest.cpp:113: error: converting from ‘void (Sacm::)(int, int, int)’ to ‘void ()()’ Any tips?

    Read the article

  • operator<< overload,

    - by mr.low
    //using namespace std; using std::ifstream; using std::ofstream; using std::cout; class Dog { friend ostream& operator<< (ostream&, const Dog&); public: char* name; char* breed; char* gender; Dog(); ~Dog(); }; im trying to overload the << operator. I'm also trying to practice good coding. But my code wont compile unless i uncomment the using namespace std. i keep getting this error and i dont know. im using g++ compiler. Dog.h:20: error: ISO C++ forbids declaration of ‘ostream’ with no type Dog.h:20: error: ‘ostream’ is neither function nor member function; cannot be declared friend. if i add line using std::cout; then i get this error. Dog.h:21: error: ISO C++ forbids declaration of ‘ostream’ with no type. Can somebody tell me the correct way to overload the << operator with out using namespace std;

    Read the article

  • C#: Windows Forms: What could cause Invalidate() to not redraw?

    - by Rosarch
    I'm using Windows Forms. For a long time, pictureBox.Invalidate(); worked to make the screen be redrawn. However, it now doesn't work and I'm not sure why. this.worldBox = new System.Windows.Forms.PictureBox(); this.worldBox.BackColor = System.Drawing.SystemColors.Control; this.worldBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.worldBox.Location = new System.Drawing.Point(170, 82); this.worldBox.Name = "worldBox"; this.worldBox.Size = new System.Drawing.Size(261, 250); this.worldBox.TabIndex = 0; this.worldBox.TabStop = false; this.worldBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.worldBox_MouseMove); this.worldBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.worldBox_MouseDown); this.worldBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.worldBox_MouseUp); Called in my code to draw the world appropriately: view.DrawWorldBox(worldBox, canvas, gameEngine.GameObjectManager.Controllers, selectedGameObjects, LevelEditorUtils.PREVIEWS); View.DrawWorldBox: public void DrawWorldBox(PictureBox worldBox, Panel canvas, ICollection<IGameObjectController> controllers, ICollection<IGameObjectController> selectedGameObjects, IDictionary<string, Image> previews) { int left = Math.Abs(worldBox.Location.X); int top = Math.Abs(worldBox.Location.Y); Rectangle screenRect = new Rectangle(left, top, canvas.Width, canvas.Height); IDictionary<float, ICollection<IGameObjectController>> layers = LevelEditorUtils.LayersOfControllers(controllers); IOrderedEnumerable<KeyValuePair<float, ICollection<IGameObjectController>>> sortedLayers = from item in layers orderby item.Key descending select item; using (Graphics g = Graphics.FromImage(worldBox.Image)) { foreach (KeyValuePair<float, ICollection<IGameObjectController>> kv in sortedLayers) { foreach (IGameObjectController controller in kv.Value) { // ... float scale = controller.View.Scale; float width = controller.View.Width; float height = controller.View.Height; Rectangle controllerRect = new Rectangle((int)controller.Model.Position.X, (int)controller.Model.Position.Y, (int)(width * scale), (int)(height * scale)); // cull objects that aren't intersecting with the canvas if (controllerRect.IntersectsWith(screenRect)) { Image img = previews[controller.Model.HumanReadableName]; g.DrawImage(img, controllerRect); } if (selectedGameObjects.Contains(controller)) { selectionRectangles.Add(controllerRect); } } } foreach (Rectangle rect in selectionRectangles) { g.DrawRectangle(drawingPen, rect); } selectionRectangles.Clear(); } worldBox.Invalidate(); } What could I be doing wrong here?

    Read the article

  • url rewriting + Asp.Net Login Form = Death

    - by xor88
    Hi, on our site we do url rewriting to generate massive amounts of database generated pages. on every page, there is a Login control for users. like this: Internal aspx page: /DB.aspx?id=123 User visible url: /ABC/123.aspx, /ABC/456.aspx ... (url rewritten) unfortunately, the tag on each page has an action attribute of "DB.aspx?id=123". when the user clicks the button the browser is posting to /ABC/DB.aspx?id=123 which of course does not exist. solutions i tried: 1. change the action attribute by subclassing HtmlForm. this destroys the all other forms on the site. 2. remove the action attribute (so that the browser is always posting to the same url). this works on the rewritten pages but on "/" (the default.aspx in the root dir) i get a message that the verb post is not allowed on "/" (iis 6 and i have no control over mappings) anybody?

    Read the article

  • Use msbuild community tasks without installing

    - by mickyjtwin
    In our developer environment, no users have administration rights. As such, it's not possible to install MSBuild.CommunityTasks without getting admin to do so. What I'm wondering is similar to NAnt, i.e. is it possible to include the files in your solution directory, and just reference it from there? This way, will not matter if the person has it installed, when they checkout latest code, the msbuild community files will come with, and solution will build. \SolutionDir\{solution}.sln \SolutionDir\Project\{files} \SolutionDir\MSBuild.Community\files

    Read the article

  • Software Reverse Engineering

    - by devang
    I am an Master's Student and i am learning Software Reverse Engineering. I am looking for softwares which can be legally reverse engineered. i looked on the net, but i am unable to find any..:( Do you any softwares which can be legally reverse engineered. I am not allowed to use Open source softwares.

    Read the article

  • Programmatically submit a form

    - by Fabian Vilers
    Hi all, I've seen a tons of sample to how to programmatically submit a form (in .NET) but none of them has the specific requirements I need. The case I'm working on has a query string (http://.../index=?p=update), some hidden fields and a upload file. Does anyone has managed to submit this kind of form with a webrequest? Thanks a lot in advance, Fabian

    Read the article

  • How to put Java source inside IDE

    - by karikari
    I have a Java program source files, complete with its subdirectories. My problem is, how can I put all of this inside an IDE (ie. Netbeans, Eclipse) , so that I can easily, modify, compile and package it to become a *.jar file.

    Read the article

  • Delphi 2010 Wide functions vs. String functions

    - by Mick
    We're currently converting a Delphi 2007 project to Delphi 2010. We were already using Unicode (via WideStrings and TNT Unicode Controls). I was expecting to replace all Wide functions, e.g. WideUpperCase, with their equivalent, e.g. UpperCase, but they do not work the same way. For example, WideUpperCase works differently from UpperCase. WideUpperCase correctly uppercases Campañas, but UpperCase leaves the ñ in lower case. Are there any other differences that I should be aware of? e.g. do WideFormat and Format work the same? Thanks

    Read the article

  • HttpWebRequest: How to find a postal code at Canada Post through a WebRequest with x-www-form-enclos

    - by Will Marcouiller
    I'm currently writing some tests so that I may improve my skills with the Internet interaction through Windows Forms. One of those tests is to find a postal code which should be returned by Canada Post website. My default URL setting is set to: http://www.canadapost.ca/cpotools/apps/fpc/personal/findByCity?execution=e4s1 The required form fields are: streetNumber, streetName, city, province The contentType is "application/x-www-form-enclosed" EDIT: Please consider the value "application/x-www-form-encoded" instead of point 3 value as the contentType. (Thanks EricLaw-MSFT!) The result I get is not the result expected. I get the HTML source code of the page where I could manually enter the information to find the postal code, but not the HTML source code with the found postal code. Any idea of what I'm doing wrong? Shall I consider going the XML way? Is it first of all possible to search on Canada Post anonymously? Here's a code sample for better description: public static string FindPostalCode(ICanadadianAddress address) { var postData = string.Concat(string.Format("&streetNumber={0}", address.StreetNumber) , string.Format("&streetName={0}", address.StreetName) , string.Format("&city={0}", address.City) , string.Format("&province={0}", address.Province)); var encoding = new ASCIIEncoding(); byte[] postDataBytes = encoding.GetBytes(postData); request = (HttpWebRequest)WebRequest.Create(DefaultUrlSettings); request.ImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Anonymous; request.Container = new CookieContainer(); request.Timeout = 10000; request.ContentType = contentType; request.ContentLength = postDataBytes.LongLength; request.Method = @"post"; var senderStream = new StreamWriter(request.GetRequestStream()); senderStream.Write(postDataBytes, 0, postDataBytes.Length); senderStream.Close(); string htmlResponse = new StreamReader(request.GetResponse().GetResponseStream()).ReadToEnd(); return processedResult(htmlResponse); // Processing the HTML source code parsing, etc. } I seem stuck in a bottle neck in my point of view. I find no way out to the desired result. EDIT: There seems to have to parameters as for the ContentType of this site. Let me explain. There's one with the "meta"-variables which stipulates the following: meta http-equiv="Content-Type" content="application/xhtml+xml, text/xml, text/html; charset=utf-8" And another one later down the code that is read as: form id="fpcByAdvancedSearch:fpcSearch" name="fpcByAdvancedSearch:fpcSearch" method="post" action="/cpotools/apps/fpc/personal/findByCity?execution=e1s1" enctype="application/x-www-form-urlencoded" My question is the following: With which one do I have to stick? Let me guess, the first ContentType is to be considered as the second is only for another request to a function or so when the data is posted? EDIT: As per request, the closer to the solution I am is listed under this question: WebRequest: How to find a postal code using a WebRequest against this ContentType=”application/xhtml+xml, text/xml, text/html; charset=utf-8”? Thanks for any help! :-)

    Read the article

  • Calculate order price by date selection value

    - by albatross
    Alright, I know there's a simple way to do this, but it's been years since I've done much javascript My client has an online order form for event registration (developed by previous web dev.). Currently the order total is just a hidden field: <INPUT value=78.00 type=hidden name=amount /> But I need the total to calculate based on what date they choose: <SELECT style="BACKGROUND-COLOR: #ffff99" name=altDate1> <OPTION value=04/09> Friday, April 9 </OPTION> <OPTION value=04/14> Wednesday, April 14 </OPTION> <OPTION value=04/16> Friday, April 16 </OPTION> <OPTION value=04/19> Monday, April 19 </OPTION> <OPTION value=04/29> Thursday, April 29 </OPTION> </SELECT> This is the javascript that process the form: <SCRIPT language=Javascript> function PaymentButtonClick() { document.addform.Product_Name.value = document.Information.StudentLastName.value + ","+ document.Information.StudentFirstName.value+","+ document.Information.StudentID.value+","+ document.Information.altDate1.name+","+","+ document.Information.Guests.value+ "," + document.Information.StudentType.value; document.addform.Product_Code.value = document.Information.StudentID.value; if ((document.Information.UCheck.checked==true) && (document.Information.altDate1.value != "") && (document.Information.altDate1.value != "x")) { if (document.Information.StudentLastName.value != "" || document.Information.StudentFirstName.value != "" || document.Information.StudentID.value != "" ) { document.addform.submit(); } else { alert("Please enter missing information"); } } } </SCRIPT>

    Read the article

  • tapestry 4 session expired

    - by cometta
    is below caused by user session expired? if yes, how to exend session on tapestry 4 ? or any other way to solve this problem? Unable to process client request: Unable to forward to local resource '/app?service=page&page=Home&id=692': java.lang.NullPointerException: Property 'webRequest' of <OuterProxy for tapestry.globals.RequestGlobals(org.apache.tapestry.services.RequestGlobals)> is null. Apr 22, 2010 5:14:43 PM org.apache.catalina.core.ApplicationContext log SEVERE: app: ServletException javax.servlet.ServletException: java.lang.NullPointerException: Property 'webRequest' of <OuterProxy for tapestry.globals.RequestGlobals(org.apache.tapestry.services.RequestGlobals)> is null. at org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:65) at $ServletRequestServicer_128043b52ea.service($ServletRequestServicer_128043b52ea.java) at org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55) at $ServletRequestServicerFilter_128043b52e6.service($ServletRequestServicerFilter_128043b52e6.java) at $ServletRequestServicer_128043b52ec.service($ServletRequestServicer_128043b52ec.java) at org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52) at $ServletRequestServicerFilter_128043b52e4.service($ServletRequestServicerFilter_128043b52e4.java) at $ServletRequestServicer_128043b52ec.service($ServletRequestServicer_128043b52ec.java) at org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53) at $ServletRequestServicerFilter_128043b52e8.service($ServletRequestServicerFilter_128043b52e8.java) at $ServletRequestServicer_128043b52ec.service($ServletRequestServicer_128043b52ec.java) at $ServletRequestServicer_128043b52de.service($ServletRequestServicer_128043b52de.java) at org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:126) at org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:171) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378) at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109) at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390) at org.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67) at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390) at org.springframework.security.ui.ntlm.NtlmProcessingFilter.doFilterHttp(NtlmProcessingFilter.java:358) at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390) at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101) at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390) at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235) at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390) at org.springframework.security.concurrent.ConcurrentSessionFilter.doFilterHttp(ConcurrentSessionFilter.java:99) at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53) at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390) at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619)

    Read the article

  • How to fill HTTP forms through java?

    - by Yatendra Goel
    I want to fill a text field of a HTTP form through java and then want to click on the submit button through java so as to get the page source of the document returned after submitting the form. I can do this by sending HTTP request directly but I don't to this in this way. Very Urgent. You can also paste the code or demo code to explain in a better way.

    Read the article

  • What should I use to define image height/width resolution?

    - by Tedy
    I've read all over the Internet that I should not define fonts (or anything) with absolute pixel height/width/size and instead, use EM ... so that on higher resolution displays, my web site can scale appropriately. However, what do I use to define IMAGE height/width ... because images won't scale well (they look pixelated)

    Read the article

  • Who moved this PC here aka Locate which port on switch a PC is plugged into

    - by ggonsalv
    The catch is you have no SNMP access, not even public. The end vision is locate a PC in building easily even if PC's are moved around. The MAC address of the PC is known and the software would run as client on each desktop, reporting back which port the PC was plugged into. Well from a programmer perspective, my network skills are not the best. Yes I could use SNMP, download the MAC port table, load it into SQL, match it to the PC name. Seems alot of work. Lets say I ping a single point from the PC. Would the echo have some thing unique for each device on the same switch? All I need to identify some thing unique for each PC plugged into each port. If the PC was moved from location A to a different location then the unique response would change.

    Read the article

  • Windows XP Disc: corrupt or not corrupt?

    - by Wesley
    Hi all, I just finished one of my builds and am trying to install Windows XP onto it. Here are the specs beforehand... Intel Pentium 4 Northwood 2.4 GHz (512KB L2, 533MHz FSB) QDI Superb 4 Motherboard 2x 1GB PC3200 DDR RAM Seagate 80GB IDE HDD Bestec 250W PSU 16MB NVIDIA TNT2 Pro Samsung DVD-ROM USB 2.0 PCI Card Generic PCI Modem The issue right now is that when I'm running through the Windows Setup from my XP Pro SP3 disc, partway through the setup says that a random file on the disc is corrupt and the computer needs to be restarted. Every time I tried booting it up, a different file was noted as corrupt. However, I tested the same disc on another computer and the Windows XP disc ran to the end of the setup screen without error. I tried this on another computer and the same thing. What could possibly be happening on this one build to cause it errors during the Windows Setup? Thanks in advance.

    Read the article

  • zip password crack possible?

    - by tm1rbrt
    I have a piece of software i have to install on company laptops. The installer needs a serial to work properly, but i don't have it (my manager isn't here so i cant ask him). The installer tells me to ring a phone number which doesnt appear to be connected anymore. I would download win32dasm and ollydbg and have a go at cracking the installer but i dont really have time and i havnt done it in years. There is a zip file on the disc that looks like it contains all the program files but it is passworded. Is it feasible to crack this or will it take ages?

    Read the article

  • Windows 7 System Tray Date Display Not Appearing

    - by Anton
    I'm using Windows 7 RC and for some reason, the date won't show at all on my system tray. It used to for a while, but one day it just stopped (I didn't even notice it until someone pointed it out). So I've been trying to fix it, by customizing the format of the date, resetting to defaults, etc... But nothing works, it still doesn't show. The time appears fine.

    Read the article

  • Paste string of date format mm/dd/yy to Numbers

    - by David.Chu.ca
    I have trouble to paste a list of strings in the format of 'mm/dd/yy' into Numbers. For example: 04/01/10 04/03/10 04/13/10 The result will be: 2004-01-10 2004-03-10 04/13/10 It looks like that Numbers convert the mm into year, then month and last day. Is there any way to paste whatever as they are? Do I have to change settings in Numberers or System preference?

    Read the article

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