Search Results

Search found 16637 results on 666 pages for 'lat long'.

Page 32/666 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • Warning: date() expects parameter 2 to be long, string given in

    - by Simon
    its the $birthDay = date("d", $alder); $birthYear = date("Y", $alder); i dont know what it is here is my code //Dag $maxDays = 31; $birthDay = date("d", $alder); echo '<select name="day">'; echo '<option value="">Dag</option>'; for($i=1; $i<=$maxDays; $i++) { echo '<option '; if($birthDay == $i){ echo 'selected="selected"'; } echo ' value="'.$i.'">'.$i.'</option>'; } echo '</select>'; //Måned echo '<select name="month">'; $birthMonth = date("m", $alder); $aManeder = 12; echo '<option value="">Måned</option>'; for($i = 1; $i <= $aManeder; $i++) { echo '<option '; if($birthMonth == $i) { echo 'selected="selected"'; } echo ' value="'.$i.'">'.$ManderArray[$i].'</option>'; } echo '</select>'; //År $startYear = date("Y"); $endYear = $startYear - 30; $birthYear = date("Y", $alder); echo '<select name="year">'; echo '<option value="">år</option>'; while($endYear <= $startYear) { echo '<option '; if($birthYear == $endYear) { echo 'selected="selected"'; } echo ' value="'.$endYear.'">'.$endYear.'</option>'; $endYear++; } echo '</select>';

    Read the article

  • Adding my own items to Long Click on Text Box menu on android

    - by Boardy
    Hi all, I am currently developing an application for android. I'm not sure if this is possible but here it goes. When the user clicks and holds on a text box whether it is a website or a piece of software a menu is displayed which shows paste and input method. What I want to be able to do is add my own items to this menu and when the user clicks on my item it will load my app, they can select an item from a list view. It will then copy the contents and automatically paste it into the text field the user selected. Thanks for your help in this matter

    Read the article

  • Data-binding taking too long to update

    - by Justin
    In my application I have this code in my view model: hiddenTextContainer.PreHideVerticalOffset = VerticalOffset; hiddenTextContainer.HiddenText = Text.Remove(SelectionStart, SelectionLength); hiddenTextContainer.HasHiddenText = true; hiddenTextContainer.NonHiddenTextStart = SelectionStart; Text = Text.Substring(SelectionStart, SelectionLength); SelectionStart = Text.Length; hiddenTextContainer.ImmediatePostHideVerticalOffset = VerticalOffset; This code is used to hide selected text in a textbox. Text is a string property data bound to the text property of a textbox and VerticalOffset is a double property data bound to the VerticalOffset property of that same textbox. I need to save the VerticalOffset before and after the hiding of selected text takes place, but with my code below both hiddenTextContainer.PreHideVerticalOffset and hiddenTextContainer.ImmediatePostHideVerticalOffset are always set to the same value no matter what. I have figured out that this is because the text of the textbox has not been updated by the time the code reaches: hiddenTextContainer.ImmediatePostHideVerticalOffset = VerticalOffset; Is there any way I can fix this?

    Read the article

  • Long list of if statements in Java

    - by steve
    Hi, Sorry I can't find a question answering this, I'm almost certain someone else has raised it before. My problem is that I'm writing some system libraries to run embedded devices. I have commands which can be sent to these devices over radio broadcasts. This can only be done by text. inside the system libraries I have a thread which handles the commands which looks like this if (value.equals("A") { doCommandA() } else if (value.equals"B") { doCommandB() } else if etc. The problem is that there are a lot of commands to it will quickly spiral to something out of control. Horrible to look out, painful to debug and mind boggling to understand in a few months time.

    Read the article

  • Alternative to CURL due to long waiting

    - by aalan
    Hey Guys I currently run a PHP-script using CURL to send data to another server, to do run a PHP-script that could take up to a minute to run. This server doesn't give any data back. But the CURL-request still has to wait for it to complete, and then it loads the rest of the orignal page. I would like my PHP-script to just send the data to the other server and then not wait for an answer. So my question is how should I solve this? I have read that CURL always has to wait. What are your suggestions? Thank You!

    Read the article

  • Rendering ListBox takes too long on Windows Phone

    - by Bhawk1990
    I am working on a Windows Phone 7 Application using Local SQLite Database and I'm having an issue with the rendering time of pages that use DataBinding. Currently it takes 60-70ms to retrieve the data from the database. Then it takes about 3100ms to render the data retrieved using a ListBox with DataBinding. Here you can see the DataTemplate of the ListBox: <DataTemplate x:Key="ListBoxItemTemplate"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="68" /> <ColumnDefinition /> </Grid.ColumnDefinitions> <TextBlock x:Name="TimeColumn" Text="{Binding TimeSpan}" Grid.Column="0" Grid.Row="0" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" /> <TextBlock Text="{Binding Stop.StopName}" Grid.Column="1" Grid.Row="0" Margin="15,0,0,0" TextWrapping="NoWrap" Foreground="Black" HorizontalAlignment="Left" VerticalAlignment="Center" /> </Grid> </DataTemplate> Comment: I have tried it using Canvas instead of Grid too, same result. Then, the database loads data into a CSList (using ViciCoolStorage) and that gets Binded to the ListBox: StationList.ItemsSource = App.RouteViewModel.RouteStops; Comment: I have tried to add the elements of the CSList to an ObservableCollection and bind that to the interface but didn't seem to change anything. Question: Am I doing something wrong that results in a huge load time - even if just loading 10 elements -, or this is normal? Do you have any recommendations to get a better performance with DataBinding? Thank you for your answers in advance!

    Read the article

  • delete taking really long time! mysql

    - by every_answer_gets_a_point
    i am doing this: delete calibration_2009 from calibration_2009 join batchinfo_2009 on calibration_2009.rowid = batchinfo_2009.rowid where batchinfo_2009.reporttime like '%2010%'; both tables have about 500k lines of data i suspect that 250k match the criteria to be deleted so far it has been running for 2 hours!!! is there something wrong?

    Read the article

  • Sending arbitrarily long string over Java TCP socket

    - by bibismcbryde
    I have an Android app that communicates over a TCP socket with a server I wrote. The method I'm using now to read and write output works fine for smaller strings (up to 60kB) but I get an exception thrown when the string is much longer than that. Here is the relevant part of what I have for the server and client: Server: DataInputStream dis = null; DataOutputStream dos = null; try { dis = new DataInputStream(server.getInputStream()); dos = new DataOutputStream(server.getOutputStream()); String input = ""; input = dis.readUTF(); handle_input info = new handle_input(input, id); String xml = info.handle(); dos.writeUTF(xml); server.close(); } Client: Socket socket = null; DataOutputStream dos = null; DataInputStream dis = null; Boolean result; try { socket = new Socket(ip, port); dos = new DataOutputStream(socket.getOutputStream()); dis = new DataInputStream(socket.getInputStream()); dos.writeUTF(the_text); String in = ""; while (in.equals("")) { in += dis.readUTF(); } } How can I modify it to deal with potentially enormous Strings? I've been looking around and can't seem to find a clear answer. Thanks.

    Read the article

  • setContentView taking long time (10-15 seconds) to execute

    - by Paul
    I have a large activity that contains 100 or more buttons. But it's working fine once loaded. Problem however is loading. From clicking its launch icon to getting the first view it takes 10-12 seconds. Until the first view, it shows gray title bar in black background. At least, I want to show a simple progress bar or dialog while its loading. But it seems like you cannot show anything before setContentView executed. I think I have tried everything I could without any success. If you can give me any hint or idea, I would be thankful. UPDATE: I found a dramatic resolution. It takes now a second to load the view. I didn't use splash, thread or async task at all - BTW, don't try to use thread or async on UI because Android UI is not thread-safe. Problem was that those buttons were based on a custom class that requires initialization to load same resource. - so 100 or more file operations were happening on setContentView. Making them a just single loading solved my problem.

    Read the article

  • SerialPort.Open() takes very long time to execute

    - by narancha
    I'm having trouble when I'm trying to use the SerialPort.Open() function. Sometimes it opens in 5 seconds and sometimes it takes several minutes. This is my code: public void InvokeSerialPortdetectedEvent(string s) { SerialPortDetectEvent.Invoke(this, s); // the invoked funktion is called PortHandeler_SerialPortDetectEvent() } void PortHandeler_SerialPortDetectEvent(object sender, string name) { OpenSerialPort(name); AddDongleToDeviceList(); } private void OpenSerialPort(string Name) { if (serialPort1.IsOpen) { return; } serialPort1.PortName = Name; try { serialPort1.Open(); if (serialPort1.IsOpen) { Console.Write("Open Serialport: " + Name); } } catch (Exception e) { Console.Write(e.Message); Console.Write(e.StackTrace); } }

    Read the article

  • "LNK2001: unresolved external symbol" when trying to build my program

    - by random
    I get the following error(s) on my program that captures the mouse and then draws a line. Errors: 1>------ Build started: Project: Capture_Mouse_Line, Configuration: Debug Win32 ------ 1> main.cpp 1>main.obj : error LNK2001: unresolved external symbol "public: static long * Line::yc2" (?yc2@Line@@2PAJA) 1>main.obj : error LNK2001: unresolved external symbol "public: static long * Line::xc2" (?xc2@Line@@2PAJA) 1>main.obj : error LNK2001: unresolved external symbol "public: static long * Line::yc1" (?yc1@Line@@2PAJA) 1>main.obj : error LNK2001: unresolved external symbol "public: static long * Line::xc1" (?xc1@Line@@2PAJA) 1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup 1>D:\Visual C++ Projects\Capture_Mouse_Line\Debug\Capture_Mouse_Line.exe : fatal error LNK1120: 5 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== Here is my code: #include<allegro5\allegro.h> #include<allegro5\allegro_native_dialog.h> #include<allegro5\allegro_primitives.h> #include<Windows.h> #include<allegro5\allegro_windows.h> #ifndef WIDTH #define WIDTH 1440 #endif #ifndef HEIGHT #define HEIGHT 900 #endif class Line { public: static void ErasePreviousLine(); static void DrawLine(long* x, long* y,long* x2,long* y2); static bool Erasable(); static long* xc1; static long* yc1; static long* xc2; static long* yc2; }; void Line::ErasePreviousLine() { delete xc1; xc1 = NULL; delete yc1; yc1 = NULL; delete xc2; xc2 = NULL; delete yc2; yc2 = NULL; } bool Line::Erasable() { if(xc1 && yc1 && xc2 && yc2 == NULL) { return false; } else { return true; } } void Line::DrawLine(long* x,long* y,long* x2,long* y2) { if(!al_init_primitives_addon()) { al_show_native_message_box(NULL,NULL,NULL,"failed to initialize allegro", NULL,NULL); } xc1 = x; yc1 = y; xc2 = x2; yc2 = y2; al_draw_line((float)*xc1, (float)*yc1, (float)*xc2, (float)*yc2,al_map_rgb(255,0,255), 1); delete x; delete y; delete x2; delete y2; } LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; ALLEGRO_DISPLAY* display = NULL; if(!al_init()) { al_show_native_message_box(NULL,NULL,NULL,"failed to initialize allegro", NULL,NULL); return -1; } display = al_create_display(WIDTH,HEIGHT); if(!display) { al_show_native_message_box(NULL,NULL,NULL,"failed to initialize display", NULL,NULL); return -1; } HWND hwnd = al_get_win_window_handle(display); if(hwnd == NULL) { MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); while(GetMessage(&msg, NULL, 0, 0) > 0) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; } LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { static bool bIsCaptured; static POINTS ptsBegin; static POINTS ptsEnd; switch(msg) { case WM_LBUTTONDOWN: SetCapture(hwnd); bIsCaptured = true; ptsBegin = MAKEPOINTS(lParam); return 0; case WM_MOUSEMOVE: if(wParam & MK_LBUTTON) { if(!Line::Erasable()) { return 0; } Line::ErasePreviousLine(); ptsEnd = MAKEPOINTS(lParam); Line::DrawLine(new long(ptsBegin.x),new long(ptsBegin.y),new long(ptsEnd.x),new long(ptsEnd.y)); } break; case WM_LBUTTONUP: bIsCaptured = false; ReleaseCapture(); break; case WM_ACTIVATEAPP: { if(wParam == TRUE) { if(bIsCaptured){ SetCapture(hwnd);} } } break; } return 0; }

    Read the article

  • In .NET, how can I convert from "0.000" to a 'long'?

    - by willem
    I have a string, "0.000" (or any similar string), that I would like to convert to a long. I am happy to "chop-off" anything after the decimal. What is the best way to go about this? I can convert to double and then to long, but I'm just wondering if there is an easier way. All the following statements throw exceptions: long l3 = Convert.ToInt64(nrToConvert); long l1; long.TryParse(nrToConvert, out l1); long l2 = long.Parse(nrToConvert);

    Read the article

  • Are there mapping utilities out there that will let me import geo position data (lat/long) and plot the points on a map?

    - by GregH
    I have a data file with a bunch of lat/long positions. Is there any mapping software out there (google maps, etc) that will allow me to import the positions from the file and plot them on a map? I would be this can be done through google maps but I'm not sure how to do it. I just want something that I can use quickly with a minimal amount of programming to do. I don't need to annotate anything. Just view where the points are on the map. I'm just wondering if there is something already available out there to import into google maps.

    Read the article

  • why some websites changes their short and user friendly URL to long URL?

    - by diEcho
    Hello All, i wonder why some website changes their short and user friendly url to long url like cricinfo.com ---- espncricinfo.com indiafm.com --- bollywoodhungama.com and many others i have seen i just want to know that what is the exact need of doing that?? is there economical reason or what??i think user dont like to write long website name still i also type indiafm.com and browser automatically redirect the URL. (sorry if tags are wrong) Thanks,

    Read the article

  • How do I add Polylines in gmaps4rails v2

    - by LaraF
    I upgraded to the latest version of gmaps4rails (v2) and am having some issues getting polylines drawing. I can get markers working with the sample code on the wiki, but if I change the addMarkers to addPolylines, nothing renders in the map. Here's the handler code: handler = Gmaps.build('Google'); handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){ polylines = handler.addPolylines([{"lat":45.678295,"lng":-121.603813,"ele":438.626221,"time":1381851321},{"lat":45.678196,"lng":-121.603607,"ele":423.202148,"time":1381851363},{"lat":45.678181,"lng":-121.603607,"ele":421.108398,"time":1381851373},{"lat":45.678162,"lng":-121.603584,"ele":420.153442,"time":1381851383},{"lat":45.678123,"lng":-121.603569,"ele":422.561096,"time":1381851393},{"lat":45.678165,"lng":-121.6036,"ele":425.191284,"time":1381851403},{"lat":45.678169,"lng":-121.603607,"ele":425.262329,"time":1381851413}]); handler.bounds.extendWith(polylines); handler.fitMapToBounds(); }); No errors in the javascript console, just no map rendering. Any thoughts?

    Read the article

  • Project Euler Problem 14

    - by MarkPearl
    The Problem The following iterative sequence is defined for the set of positive integers: n n/2 (n is even) n 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 40 20 10 5 16 8 4 2 1 It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although it has not been proved yet (Collatz Problem), it is thought that all starting numbers finish at 1. Which starting number, under one million, produces the longest chain? NOTE: Once the chain starts the terms are allowed to go above one million. The Solution   public static long NextResultOdd(long n) { return (3 * n) + 1; } public static long NextResultEven(long n) { return n / 2; } public static long TraverseSequence(long n) { long x = n; long count = 1; while (x > 1) { if (x % 2 == 0) x = NextResultEven(x); else x = NextResultOdd(x); count++; } return count; } static void Main(string[] args) { long largest = 0; long pos = 0; for (long i = 1000000; i > 1; i--) { long temp = TraverseSequence(i); if (temp > largest) { largest = temp; pos = i; } } Console.WriteLine("{0} - {1}", pos, largest); Console.ReadLine(); }

    Read the article

  • problem in start up my RMI server(under ISP) so that it can recieve remote calls over Internet.--Jav

    - by Lokesh Kumar
    i m creating a Client/Server application in which my server and client can be on the same or on different machines but both are under ISP. My RMI programs:- -Remote Intreface:- //Calculator.java public interface Calculator extends java.rmi.Remote { public long add(long a, long b) throws java.rmi.RemoteException; public long sub(long a, long b) throws java.rmi.RemoteException; public long mul(long a, long b) throws java.rmi.RemoteException; public long div(long a, long b) throws java.rmi.RemoteException; } Remote Interface Implementation:- //CalculatorImpl.java public class CalculatorImpl extends java.rmi.server.UnicastRemoteObject implements Calculator { public CalculatorImpl() throws java.rmi.RemoteException { super(); } public long add(long a, long b) throws java.rmi.RemoteException { return a + b; } public long sub(long a, long b) throws java.rmi.RemoteException { return a - b; } public long mul(long a, long b) throws java.rmi.RemoteException { return a * b; } public long div(long a, long b) throws java.rmi.RemoteException { return a / b; } } Server:- //CalculatorServer.java import java.rmi.Naming; import java.rmi.server.RemoteServer; public class CalculatorServer { public CalculatorServer() { try { Calculator c = new CalculatorImpl(); Naming.rebind("rmi://"+args[0]+":1099/CalculatorService", c); } catch (Exception e) { System.out.println("Trouble: " + e); } } public static void main(String args[]) { new CalculatorServer(); } } Client:- //CalculatorClient.java import java.rmi.Naming; import java.rmi.RemoteException; import java.net.MalformedURLException; import java.rmi.NotBoundException; public class CalculatorClient { public static void main(String[] args) { try { Calculator c = (Calculator)Naming.lookup("rmi://"+args[0]+"/CalculatorService"); System.out.println( c.sub(4, 3) ); System.out.println( c.add(4, 5) ); System.out.println( c.mul(3, 6) ); System.out.println( c.div(9, 3) ); } catch (MalformedURLException murle) { System.out.println(); System.out.println("MalformedURLException"); System.out.println(murle); } catch (RemoteException re) { System.out.println(); System.out.println("RemoteException"); System.out.println(re); } catch (NotBoundException nbe) { System.out.println(); System.out.println("NotBoundException"); System.out.println(nbe); } catch (java.lang.ArithmeticException ae) { System.out.println(); System.out.println("java.lang.ArithmeticException"); System.out.println(ae); } } } when both Server and client programs are on same machine:- i start my server program by passing my router static IP address:-192.168.1.35 in args[0] and my server starts...fine. and by passing the same Static IP address in my Client's args[0] also works fine. but:- when both Server and client programs are on different machines:- now,i m trying to start my Server Program by passing it's public IP address:59.178.198.247 in args[0] so that it can recieve call over internet. but i am unable to start it. and the following exception occurs:- Trouble: java.rmi.ConnectException: Connection refused to host: 59.178.198.247; nested exception is: java.net.ConnectException: Connection refused: connect i think it is due to NAT Problem because i am under ISP. so,my problem is that how can i start my RMI Server under ISP so that it can recieve remote calls from internet????

    Read the article

  • dynamically drawing polylines on googlemaps using php/mysql

    - by arc
    Hi. I am new to the googlemaps API. I have written a small app for my mobile phone that periodically updates its location to an SQL databse. I would like to display this information on a googlemap in my browser. Ideally i'd like to then poll the database periodically and if any new co-ords have arrived, add them to the line. Best way of describing it is this; http://tiny.cc/HEIa0 In a quest to get to there, i've started on the documents on google and been modifying them to try and acheive what I want. It doesn't work - and i don't know enough to know why. I would love some advice as to why, and any pointers towards my ultimate goal would be very much welcomed. Google Maps AJAX + MySQL/PHP Example <script type="text/javascript"> //<![CDATA[ function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(47.614495, -122.341861), 13); GDownloadUrl("phpsqlajax_genxml.php", function(data) { var xml = GXml.parse(data); var line = []; var markers = xml.documentElement.getElementsByTagName("points"); for (var i = 0; i < points.length; i++) { var point = points.item(i); var lat = point.getAttribute("lat"); var lng = point.getAttribute("lng"); var latlng = new GLatLng(lat, lng); line.push(latlng); if (point.firstChild) { var station = point.firstChild.nodeValue; var marker = createMarker(latlng, station); map.addOverlay(marker); } } var polyline = new GPolyline(line, "#ff0000", 3, 1); map.addOverlay(polyline); }); } //]]> My php file is generating the following XML; <?xml version="1.0" encoding="UTF-8" ?> <points> <point lng="-122.340141" lat="47.608940"/> <point lng="-122.344391" lat="47.613590"/> <point lng="-122.356445" lat="47.624561"/> <point lng="-122.337654" lat="47.606365"/> <point lng="-122.345673" lat="47.612823"/> <point lng="-122.340363" lat="47.605961"/> <point lng="-122.345467" lat="47.613976"/> <point lng="-122.326584" lat="47.617214"/> <point lng="-122.342834" lat="47.610126"/> </points> I have successfully worked through this; http://code.google.com/apis/maps/articles/phpsqlajax.html before attempting to customise the code. Any pointers? Where am I go wrong?

    Read the article

  • How do I draw the points in an ESRI Polyline, given the bounding box as lat/long and the "points" as

    - by Aaron
    I'm using OpenMap and I'm reading a ShapeFile using com.bbn.openmap.layer.shape.ShapeFile. The bounding box is read in as lat/long points, for example 39.583642,-104.895486. The bounding box is a lower-left point and an upper-right point which represents where the points are contained. The "points," which are named "radians" in OpenMap, are in a different format, which looks like this: [0.69086486, -1.8307719, 0.6908546, -1.8307716, 0.6908518, -1.8307717, 0.69085056, -1.8307722, 0.69084936, -1.8307728, 0.6908477, -1.8307738, 0.69084626, -1.8307749, 0.69084185, -1.8307792]. How do I convert the points like "0.69086486, -1.8307719" into x,y coordinates that are usable in normal graphics? I believe all that's needed here is some kind of conversion, because bringing the points into Excel and graphing them creates a line whose curve matches the curve of the road at the given location (lat/long). However, the axises need to be adjusted manually and I have no reference as how to adjust the axises, since the given bounding box appears to be in a different format than the given points. The ESRI Shapefile technical description doesn't seem to mention this (http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf).

    Read the article

  • How to set up a functional macro with parameters in C++?

    - by user1728737
    is there a way that I can make this work? Or do I need to use separate files? #include <iostream> // Necessary using namespace std; long double primary, secondary, tertiary; #define long double mMaxOf2(long double min, long double max) { return ((max > min) ? (max) : (min)); } #define long double mMaxOf3(long double Min, long double Max, long double Mid) { long double Mid = (long double mMaxOf2(long double Min, long double Mid)); long double Max = (long double mMaxOf2(long double Mid, long double Max)); return (Max); } int main() { cout << "Please enter three numbers: "; cin << primary << secondary << tertiary; cout << "The maximum of " << primary << " " << secondary << " " << tertiary; cout << " using mMaxOf3 is " << long double mMaxOf3(primary, secondary, tertiary); return 0; } This is the error that I am getting. |20|error: expected unqualified-id before '{' token|

    Read the article

  • "EXC_BAD_ACCESS: Unable to restore previously selected frame" Error, Array size?

    - by Job
    Hi there, I have an algorithm for creating the sieve of Eratosthenes and pulling primes from it. It lets you enter a max value for the sieve and the algorithm gives you the primes below that value and stores these in a c-style array. Problem: Everything works fine with values up to 500.000, however when I enter a large value -while running- it gives me the following error message in xcode: Program received signal: “EXC_BAD_ACCESS”. warning: Unable to restore previously selected frame. Data Formatters temporarily unavailable, will re-try after a 'continue'. (Not safe to call dlopen at this time.) My first idea was that I didn't use large enough variables, but as I am using 'unsigned long long int', this should not be the problem. Also the debugger points me to a point in my code where a point in the array get assigned a value. Therefore I wonder is there a maximum limit to an array? If yes: should I use NSArray instead? If no, then what is causing this error based on this information? EDIT: This is what the code looks like (it's not complete, for it fails at the last line posted). I'm using garbage collection. /*--------------------------SET UP--------------------------*/ unsigned long long int upperLimit = 550000; // unsigned long long int sieve[upperLimit]; unsigned long long int primes[upperLimit]; unsigned long long int indexCEX; unsigned long long int primesCounter = 0; // Fill sieve with 2 to upperLimit for(unsigned long long int indexA = 0; indexA < upperLimit-1; ++indexA) { sieve[indexA] = indexA+2; } unsigned long long int prime = 2; /*-------------------------CHECK & FIND----------------------------*/ while(!((prime*prime) > upperLimit)) { //check off all multiples of prime for(unsigned long long int indexB = prime-2; indexB < upperLimit-1; ++indexB) { // Multiple of prime = 0 if(sieve[indexB] != 0) { if(sieve[indexB] % prime == 0) { sieve[indexB] = 0; } } } /*---------------- Search for next prime ---------------*/ // index of current prime + 1 unsigned long long int indexC = prime - 1; while(sieve[indexC] == 0) { ++indexC; } prime = sieve[indexC]; // Store prime in primes[] primes[primesCounter] = prime; // This is where the code fails if upperLimit > 500000 ++primesCounter; indexCEX = indexC + 1; } As you may or may not see, is that I am -very much- a beginner. Any other suggestions are welcome of course :)

    Read the article

  • Why did object-oriented paradigms take so long to go mainstream?

    - by Earlz
    I read this question and it got me thinking about another fairly recent thing. Object oriented languages. I'm not sure when the first one was created, but why did it take so long before they became mainstream? C became vastly popular, but didn't become the object-oriented C++ for years(decades?) later No mainstream language before the 90s was object oriented Object oriented really seemed to take off with Java and C++ around the same time Now, my question, why did this take so long? Why wasn't C originally conceived as an object-oriented language? Taking a very small subset of C++ wouldn't have affected the core language a whole lot, so why was this idea not popular until the 90s?

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >