Search Results

Search found 5749 results on 230 pages for 'miles away'.

Page 117/230 | < Previous Page | 113 114 115 116 117 118 119 120 121 122 123 124  | Next Page >

  • C++ find method is not const?

    - by Rachel
    I've written a method that I'd like to declare as const, but the compiler complains. I traced through and found that this part of the method was causing the difficulty: bool ClassA::MethodA(int x) { bool y = false; if(find(myList.begin(), myList.end(), x) != myList.end()) { y = true; } return y; } There is more happening in the method than that, but with everything else stripped away, this was the part that didn't allow the method to be const. Why does the stl find algorithm prevent the method from being const? Does it change the list in any way?

    Read the article

  • Need to merge multiple pdf's into a single PDF with Table Of Contents sections

    - by Jason
    Will have 50-100 single PDF's that we'll be generating with a php script. PDF's are generally grouped into groups of 10-20. Each group needs to have it's own Table of Contents or Index, and then there also needs to be a Master Table of Contents or Index at the beginning. Or if that is too difficult we could get away with a single Table of Contents at the beginning. What's the best way to go about this? Will we need to create the Table of Contents and then export that to PDF and append it to the beginning and mash the rest of the files after that? Or is there a better solution? And what's the best tool for us to merge the pdf's? Will be running on a Linux server.

    Read the article

  • Python objects as userdata in ctypes callback functions

    - by flight
    The C function myfunc operates on a larger chunk of data. The results are returned in chunks to a callback function: int myfunc(const char *data, int (*callback)(char *result, void *userdata), void *userdata); Using ctypes, it's no big deal to call myfunc from Python code, and to have the results being returned to a Python callback function. This callback work fine. myfunc = mylib.myfunc myfunc.restype = c_int myfuncFUNCTYPE = CFUNCTYPE(STRING, c_void_p) myfunc.argtypes = [POINTER(c_char), callbackFUNCTYPE, c_void_p] def mycb(result, userdata): print result return True input="A large chunk of data." myfunc(input, myfuncFUNCTYPE(mycb), 0) But, is there any way to give a Python object (say a list) as userdata to the callback function? In order to store away the result chunks, I'd like to do e.g.: def mycb(result, userdata): userdata.append(result) userdata=[] But I have no idea how to cast the Python list to a c_void_p, so that it can be used in the call to myfunc. My current workaround is to implement a linked list as a ctypes structure, which is quite cumbersome.

    Read the article

  • Best Practices for Sanitizing SQL inputs Using JavaScript?

    - by Greg Bulmash
    So, with HTML5 giving us local SQL databases on the client side, if you want to write a select or insert, you no longer have the ability to sanitize third party input by saying $buddski = mysql_real_escape_string($tuddski) because the PHP parser and MySQL bridge are far away. It's a whole new world of SQLite where you compose your queries and parse your results with JavaScript. But while you may not have your whole site's database go down, the user who gets his/her database corrupted or wiped due to a malicious injection attack is going to be rather upset. So, what's the best way, in pure JavaScript, to escape/sanitize your inputs so they will not wreak havoc with your user's built-in database? Scriptlets? specifications? Anyone?

    Read the article

  • Handle .NET exceptions within Classic ASP pages

    - by Tyler
    Hi All, I am making MSSQL stored procedure CLR calls from ASP pages. When an exception occurs, it is logged and then rethrown. In this scenario I need to be able to handle the exception (if possible) in the ASP page. Note that I cannot move away from classic ASP in this instance; I am stuck within a legacy system for this project. Please let me know if you know of a way to handle the exceptions in classic ASP. I appreciate the help! Thanks, Tyler

    Read the article

  • classic asp - response.redirect and response.write problem

    - by apg1985
    Hi People, The problem if someone types into the search box a location it goes through to that location page but if they type in a location thats not found or they dont type anything in I need it to redirect back to the homepage (index.asp) and display "whoops we couldnt find that" in the search box (input field) This is the vb Case Else response.redirect "index.asp?whoops=whoops we couldnt find that" End Select Then in the value of the input field I have value="<% =whoops %>" This doesnt work by the way, first is this the best way of doing it because id rather not have the error message in the url. This there away of posting the error as a variable and then calling it into the input field like, <% =whoops %>

    Read the article

  • Why is the JVM stack-based and the DalvikVM register based?

    - by aioobe
    I'm curious, why did Sun decide to make the JVM stack-based and Google decide to make the DalvikVM register based? I suppose the JVM can't really assume that a certain number of registers are available on the target platform, since it is supposed to be platform independent. Therefor it just postpones the register-allocation etc, to the JIT compiler. (Correct me if I'm wrong.) So the Android guys thought, "hey, that's inefficient, let's go for a register based vm right away..."? But wait, there are multiple different android devices, what number of registers did the Dalvik target? Are the Dalvik opcodes hardcoded for a certain number of registers? Do all current Android devices on the market have about the same number of registers? Or, is there a register re-allocation performed during dex-loading? How does all this fit together?

    Read the article

  • Linux bash: when to use egrep instead of grep?

    - by Michael Mao
    Hi all : I am preparing for a Linux terminal assessment now, I tried to Google and found most resources are referring to the basic "grep" rather than the more powerful "egrep" -- well, that is at least what the professor said in lecture. I am always working with small samples so performance tuning is a thing too far away. So basically I'd like to know are there any areas where I must switch to egrep to do it in a better way? Is it safe to work with basic "grep" as for now? will there be potential risks? Sorry about my limited knowledge on Linux shell commands, the man page looks like a maze to me and honestly I haven't put much time in understanding all the features both command provide.

    Read the article

  • Memory management, and async operations: when does an object become nil?

    - by Kenny Winker
    I have a view that will be displaying downloaded images and text. I'd like to handle all the downloading asynchronously using ASIHTTPRequest, but I'm not sure how to go about notifying the view when downloads are finished... If I pass my view controller as the delegate of the ASIHTTPRequest, and then my view is destroyed (user navigates away) will it fail gracefully when it tries to message my view controller because the delegate is now nil? i.e. if i do this: UIViewController *myvc = [[UIViewController alloc] init]; request.delegate = myvc; [myvc release]; Do myvc, and request.delegate now == a pointer to nil? This is the problem with being self-taught... I'm kinda fuzzy on some basic concepts. Other ideas of how to handle this are welcome.

    Read the article

  • Using jQuery to load Telerik MVC scripts.

    - by ProfK
    I'm busy building my first MVC app that uses the Telerik MVC components. Their docs specify that the ScriptRegistrar helper be called right at the bottom of a view, e.g. "at the end of the master page.". I assume this renders a script block that must only run when the page has loaded. I normally prefer to achieve this using jQuery, and keep all my script related stuff at the top of my master page, preferably in the <head> tag. Is there anything I can do to achieve this with the Telerik components and do away with the lone and forgotten helper call at the bottom of my master page?

    Read the article

  • adding to json property that may or may not exist yet

    - by mmcgrail
    let say i want to do this var dasboard = {}; $('.check').click(function(){ $(this).toggleClass("active").siblings().slideToggle('slow', function() { dashboard['pages']['pagename'][$(this).closest('li').attr("id")]['show'] = $(this).is(":hidden") ? 'collapsed' : 'expanded'; }); } i get an error saying 'dashboard.pages is undefined' is there away to dynamically add 'pages' and the children that follow without having to do the work of checking to see if it is defined first then if its not doing dashboard['pages'] = {}; because sometimes they may already exist and I don't want to have to inspect the tree first i just want to build the branches as needed

    Read the article

  • Running your own GAE server

    - by h2g2java
    The question http://stackoverflow.com/questions/2505265/how-difficult-is-it-to-migrate-away-from-google-app-engine triggered me to think about this issue again. I have read of someone running, production-wise, Google app engine development version on their own server. My questions are: Are there any security issues running GAE development on your own server in production mode and exposing it to the www? If so how to mitigate them? Can GAE dev be run on Amazon? Is it possible to port my GAE apps running on Google servers to a GAE running on Amazon, without code changes, but without changing any reference in using other gdata services such as google docs, youtube, gmail, etc. How to configure GAE dev server to use my own hadoop? Or to use Amazon's hadoop?

    Read the article

  • Always importing too many classes... I think!

    - by Bill
    I have a basic problem with knowing which classes to import for a given application, renderer, AS package, mxml component, etc. There seems to be hundreds of classes (both mx and flash) and I'm never sure which one(s) to import... so I just keep adding import statements until the errors go away. Is there a reference somewhere that I don't know about? Or does this just come with experience? Also... does importing a load of classes actually make the file size larger or does Flex only import the classes used nregardless of what I specify? If it only uses what is needed, why wouldn't everyone just do: import mx.*;

    Read the article

  • Does ActiveRecord make Ruby on Rails code hard to test?

    - by Erik Öjebo
    I've spent most of my time in statically typed languages (primarily C#). I have some bad experiences with the Active Record pattern and unit testing, because of the static methods and the mix of entities and data access code. Since the Ruby community probably is the most test driven of the communities out there, and the Rails ActiveRecord seems popular, there must be some way of combining TDD and ActiveRecord based code in Ruby on Rails. I would guess that the problem goes away in dynamic languages, somehow, but I don't see how. So, what's the trick?

    Read the article

  • Detecting (on the server side) when a Flex client disconnects from BlazeDS destination

    - by Alex Curtis
    Hi all, I'd like to know whether it's possible to easily detect (on the server side) when Flex clients disconnect from a BlazeDS destination please? My scenario is simply that I'd like to try and use this to figure out how long each of my clients are connected for each session. I need to be able to differentiate between clients as well (ie so not just counting the number of currently connected clients which I see in ds-console). Whilst I could program in a "I'm now logging out" process in my clients, I don't know whether this will fire if the client simply navigates away to another web page rather than going though said logout process. Can anyone suggest if there's an easy way to do this type of monitoring on the server side please. Many thanks, Alex

    Read the article

  • Unique issue with Rails setup

    - by Alexis Abril
    Becoming a bit of a Ruby convert, but I've run into an issue with my Rails installation. I realize, in spirit, this question may overlap with superuser.com, but am asking here due to the nature of the installation. My command: sudo gem install rails Response is: /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/spec_fetcher.rb:232: warning:getc is obsolete; use STDIN.getc instead The "/opt/local" may be giving away the fact I'm using MacPorts(Mac OS 10.4). After that response, there is no new command line issued by the system, just a hang. Any insite is greatly appreciated.

    Read the article

  • Scalar-Valued Function in NHibernate

    - by Byron Sommardahl
    I have the following scalar function in MS SQL 2005: CREATE FUNCTION [dbo].[Distance] ( @lat1 float, @long1 float,@lat2 float, @long2 float ) RETURNS float AS BEGIN RETURN (3958*3.1415926*sqrt((@lat2-@lat1)*(@lat2-@lat1) + cos(@lat2/57.29578)*cos(@lat1/57.29578)*(@long2-@long1)*(@long2-@long1))/180); END I need to be able to call this function from my NHibernate queries. I read over this article, but I got bogged down in some details that I didn't understand right away. If you've used scalar functions with NHibernate, could you possibly give me an example of how your HBM file would look for a function like this?

    Read the article

  • Core Plot on iPad Runs with Debugger, not Standalone

    - by phantomdata
    Hey guys, Thanks to Ole Begemann, I spent yesterday digging around in Core Plot to explore adding graphing to an iPad application that I've been working on. I was fairly satisfied with it, and wanted to show it off to a friend of mine - so I stopped the debugger, took the device off the dock, handed it over to my friend and pushed the icon. Lo, it started and then immediately crashed. I figured that it was using the release profile, and on a whim went ahead and compiled and ran (through the debugger) under the release profile instead of the debug. As expected, it crashed right away with EXC_BAD_ACCESS. I have added the relative path to the core plot to Release configuration and -all_load and -ObjC to the "other" linker flags - just like in the debugger profile and googled all around. IT seems that most people with this issue have forgotten to add the linker flags. Does anyone have any suggestions for next steps in figuring out this issue?

    Read the article

  • Compiler optimization of repeated accessor calls

    - by apocalypse9
    I've found recently that for some types of financial calculations that the following pattern is much easier to follow and test especially in situations where we may need to get numbers from various stages of the computation. public class nonsensical_calculator { ... double _rate; int _term; int _days; double monthlyRate { get { return _rate / 12; }} public double days { get { return (1 - i); }} double ar { get { return (1+ days) /(monthlyRate * days) double bleh { get { return Math.Pow(ar - days, _term) public double raar { get { return bleh * ar/2 * ar / days; }} .... } Obviously this often results in multiple calls to the same accessor within a given formula. I was curious as to whether or not the compiler is smart enough to optimize away these repeated calls with no intervening change in state, or whether this style is causing a decent performance hit. Further reading suggestions are always appreciated

    Read the article

  • XCode toolchain error: dyld: Symbol not found: _objc_collect_if_needed

    - by freespace
    I have been seeing the following error message a lot whenever I build something using the simulator: dyld: Symbol not found: _objc_collect_if_needed Referenced from: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/Foundation.framework/Foundation Expected in: /usr/lib/libobjc.A.dylib in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/System/Library/Frameworks/Foundation.framework/Foundation I am running XCode 3.2.2 on OS X 10.6.3, and have reinstalled the SDK twice with no avail. This error makes running any code on the simulator something of a Russian Roulette, but with 5 out of 6 chambers loaded. I have checked the files mentioned in the error message, and they all checkout as being present. This sometimes go away if I restart XCode. Other times I have to logout, or even restart. And sometimes nothing works. I have googled this, even tried apple's developer forums. Other than a reference to this in the MonoTouch list, this bug appears to be completely unknown otherwise. Anything help would be greatly appreciated - this is a real PITA. Cheers, Steve

    Read the article

  • Listing subdirectories 3 levels deep using LINQ C#

    - by paradox
    I'd like to know if there is a better alternative to my following code (preferably using LINQ) #region List and filter directories to only 3 levels deep // List all subdirectories within main directory string[] folders = Directory.GetDirectories(@"C:\pdftest\", "*" ,SearchOption.AllDirectories); List<string> subdirectories = new List<string>(); //Filter away all main directories, now we are left with subdirectories 3 levels deep for (int i = 0; i<folders.Length; i++) { int occurences = folders[i].Split('\\').Length-1; if (occurences==4) subdirectories.Add(folders[i]); } #endregion

    Read the article

  • RegEx: Split String at Capitalized Letters and Non-capitalized letters to Create Small Cap Fonts

    - by Otaku
    So i've purposefully stayed away from RegEx as just looking at it kills me...ugh. But now I need it and could really use some help to do this in .NET (C# or VB.NET). I need to split a string based on capitalization or lack thereof. For example: I'm not upPercase "I" "'m not up" "P" "ercase" or FBI Agent Winters "FBI A" "gent " "W" "inters" The reason I'm doing this is to manually create small caps, in which non-capitalized strings will be sent to uppercase and their font size made 80% of the original font size. Appreciate any help that could be provided here.

    Read the article

  • Why is FxCop warning about an overflow (CA2233) in this C# code?

    - by matt
    I have the following function to get an int from a high-byte and a low-byte: public static int FromBytes(byte high, byte low) { return high * (byte.MaxValue + 1) + low; } When I analyze the assembly with FxCop, I get the following critical warning: CA2233: OperationsShouldNotOverflow Arithmetic operations should not be done without first validating the operands to prevent overflow. I can't see how this could possibly overflow, so I am just assuming FxCop is being overzealous. Am I missing something? And what steps could be taken to correct what I have (or at least make the FxCop warning go away!)?

    Read the article

  • Accelerometer API for Laptops

    - by FreshCode
    Most IBM (and some Dell) laptops have built-in accelerometers to stop any moving parts during a sudden fall, but I was unable to find a standardised Windows API to access this data. I assume that each manufacturer would provide a driver to interface with the sensor. Which popular laptop brands come standard with accelerometers accessible from an API and which libraries should I use to access the data? Does an API* exist to abstract away the differences between different manufacturers? I am aware of the Windows 7 Sensor API, but I would like support for XP and earlier.

    Read the article

  • Safari Back button not honouring PHP logout session

    - by Steve Kemp
    I've got a logout.php page which ends a user's session and works well and does the following: session_start(); session_unset(); session_destroy(); I've just noticed when testing with Safari that when you logout you can click the back button to return to the previous page which requires authentication but are not prompted. You cannot navigate away from this page without entering the navigation but it should not be displaying the previous page in the first place. So far in my testing this is only an issue with Safari on Mac OS X and there are a number of other reports about this but with no resolution that I could find: http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_23702691.html I would love to be able to disable this behaviour with Safari's back button - surprised that this is happening in the first place. Thanks, Steve

    Read the article

< Previous Page | 113 114 115 116 117 118 119 120 121 122 123 124  | Next Page >