Search Results

Search found 6374 results on 255 pages for 'double underscore'.

Page 109/255 | < Previous Page | 105 106 107 108 109 110 111 112 113 114 115 116  | Next Page >

  • Passing a string to a function in C++

    - by Chef Flambe
    I want to pass a string like "Celcius" into a function that I have but I keep getting errors tossed back at me from the Function. System::Console::WriteLine' : none of the 19 overloads could convert all the argument types I figure I just have something simple wrong. Can someone point out my mistake please? Using MS Visual C++ 2010 I've posted the offending code. The other functions (not posted) work fine. void PrintResult( double result, std::string sType ); // Print result and string // to the console //============================================================================================= // start of main //============================================================================================= void main( void ) { ConsoleKeyInfo CFM; // Program Title and Description ProgramDescription(); // Menu Selection and calls to data retrieval/calculation/result Print CFM=ChooseFromMenu(); switch(CFM.KeyChar) // ************************************************************ { //* case '1' : PrintResult(F2C(GetTemperature()),"Celsius"); //* break; //* //* case '2' : PrintResult(C2F(GetTemperature()),"Fahrenheit"); //* break; //* //* default : Console::Write("\n\nSwitch : Case !!!FAILURE!!!"); //* } //************************************************************ system("pause"); return; } //Function void PrintResult( double result, std::string sType ) { Console::WriteLine("\n\nThe converted temperature is {0:F2} degrees {1}\n\n",result,sType); return; }

    Read the article

  • Optimal (Time paradigm) solution to check variable within boundary

    - by kumar_m_kiran
    Hi All, Sorry if the question is very naive. I will have to check the below condition in my code 0 < x < y i.e code similar to if(x > 0 && x < y) The basic problem at system level is - currently, for every call (Telecom domain terminology), my existing code is hit (many times). So performance is very very critical, Now, I need to add a check for boundary checking (at many location - but different boundary comparison at each location). At very normal level of coding, the above comparison would look very naive without any issue. However, when added over my statistics module (which is dipped many times), performance will go down. So I would like to know the best possible way to handle the above scenario (kind of optimal way for limits checking technique). Like for example, if bit comparison works better than normal comparison or can both the comparison be evaluation in shorter time span? Other Info x is unsigned integer (which must be checked to be greater than 0 and less than y). y is unsigned integer. y is a non-const and varies for every comparison. Here time is the constraint compared to space. Language - C++. Now, later if I need to change the attribute of y to a float/double, would there be another way to optimize the check (i.e will the suggested optimal technique for integer become non-optimal solution when y is changed to float/double). Thanks in advance for any input. PS : OS used is SUSE 10 64 bit x64_64, AIX 5.3 64 bit, HP UX 11.1 A 64.

    Read the article

  • JAR file: Could not find main class

    - by ApertureT3CH
    Okay, I have a strange problem. I wanted to run one of my programs as a .jar file, but when I open it by double-clicking it, I get an error message like "Could not find main class, program is shutting down". I'm pretty sure I did everything right, the jar should work afaik. I also tried other programs, it's the same with every single one. (I'm creating the .jar's through BlueJ) There is no problem when I run them through a .bat . And here comes the strangest thing of all: The .jar's have worked some time ago (one or two months I guess), and I don't remember doing anything different. It's the same BlueJ-Version. Okay, maybe Java updated and something got messed up... I googled, but I couldn't find a solution. (some people seem to have a similar problem, and it seems to be only them who can't run their .jar's; they uploaded them and other people say the .jar's run fine.) What could be the problem? How can I solve it? I'd really appreciate some help here. Thank you :) ApertureT3CH EDIT: okay guys, you're making me unsure here. Imma check the manifest again, at this unholy time ( 1:34 am ) :P EDIT2: This is my MANIFEST.MF Manifest-Version: 1.0 Class-Path: Main-Class: LocalChatClientGUI [empty line] [empty line] The Main class is correct. EDIT3: Thanks to hgrey: There is nothing wrong with the jar. I can run it from a bat file, which actually should not be different from double-clicking the jar, right? Yet I get the error when clicking it, and it works fine through the bat. EDIT4: I finally solved the problem. I re-installed the JRE and now it works, although I can't see any version differences. Thanks to everyone!

    Read the article

  • How can I create an array of random numbers in C++

    - by Nick
    Instead of The ELEMENTS being 25 is there a way to randomly generate a large array of elements....10000, 100000, or even 1000000 elements and then use my insertion sort algorithms. I am trying to have a large array of elements and use insertion sort to put them in order and then also in reverse order. Next I used clock() in the time.h file to figure out the run time of each algorithm. I am trying to test with a large amount of numbers. #define ELEMENTS 25 void insertion_sort(int x[],int length); void insertion_sort_reverse(int x[],int length); int main() { clock_t tStart = clock(); int B[ELEMENTS]={4,2,5,6,1,3,17,14,67,45,32,66,88, 78,69,92,93,21,25,23,71,61,59,60,30}; int x; cout<<"Not Sorted: "<<endl; for(x=0;x<ELEMENTS;x++) cout<<B[x]<<endl; insertion_sort(B,ELEMENTS); cout <<"Sorted Normal: "<<endl; for(x=0;x<ELEMENTS;x++) cout<< B[x] <<endl; insertion_sort_reverse(B,ELEMENTS); cout <<"Sorted Reverse: "<<endl; for(x=0;x<ELEMENTS;x++) cout<< B[x] <<endl; double seconds = clock() / double(CLK_TCK); cout << "This program has been running for " << seconds << " seconds." << endl; system("pause"); return 0; }

    Read the article

  • Sending a message to nil?

    - by Ryan Delucchi
    As a Java developer who is reading Apple's Objective-C 2.0 documentation: I wonder as to what sending a message to nil means - let alone how it is actually useful. Taking an excerpt from the documentation: There are several patterns in Cocoa that take advantage of this fact. The value returned from a message to nil may also be valid: If the method returns an object, any pointer type, any integer scalar of size less than or equal to sizeof(void*), a float, a double, a long double, or a long long, then a message sent to nil returns 0. If the method returns a struct, as defined by the Mac OS X ABI Function Call Guide to be returned in registers, then a message sent to nil returns 0.0 for every field in the data structure. Other struct data types will not be filled with zeros. If the method returns anything other than the aforementioned value types the return value of a message sent to nil is undefined. Has Java rendered my brain incapable of grokking the explanation above? Or is there something that I am missing that would make this as clear as glass? Note: Yes, I do get the idea of messages/receivers in Objective-C, I am simply confused about a receiver that happens to be nil.

    Read the article

  • What's an effective way to reuse ArrayLists in a for loop?

    - by Patrick
    hi, I'm reusing the same ArrayList in a for loop, and I use for loop results = new ArrayList<Integer>(); experts = new ArrayList<Integer>(); output = new ArrayList<String>(); .... to create new ones. I guess this is wrong, because I'm allocating new memory. Is this correct ? If yes, how can I empty them ? Added: another example I'm creating new variables each time I call this method. Is this good practice ? I mean to create new precision, relevantFound.. etc ? Or should I declare them in my class, outside the method to not allocate more and more memory ? public static void computeMAP(ArrayList<Integer> results, ArrayList<Integer> experts) { //compute MAP double precision = 0; int relevantFound = 0; double sumprecision = 0; thanks

    Read the article

  • wifi provider onLocationChanged is never called

    - by Kelsie
    I got a weird problem. I uses wifi to retrieve user location. I have tested on several phones; on some of them, I could never get a location update. it seemed that the method onLocationChanged is never called. My code is attached below.. Any suggestions appreciated!!! @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); LocationManager locationManager; locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); String provider = locationManager.NETWORK_PROVIDER; Location l = locationManager.getLastKnownLocation(provider); updateWithNewLocation(l); locationManager.requestLocationUpdates(provider, 0, 0, locationListener); } private void updateWithNewLocation(Location location) { TextView myLocationText; myLocationText = (TextView)findViewById(R.id.myLocationText); String latLongString = "No location found"; if (location != null) { double lat = location.getLatitude(); double lng = location.getLongitude(); latLongString = "Lat:" + lat + "\nLong:" + lng; } myLocationText.setText("Your Current Position is:\n" + latLongString); } private final LocationListener locationListener = new LocationListener() { public void onLocationChanged(Location location) { updateWithNewLocation(location); Log.i("onLocationChanged", "onLocationChanged"); Toast.makeText(getApplicationContext(), "location changed", Toast.LENGTH_SHORT).show(); } public void onProviderDisabled(String provider) {} public void onProviderEnabled(String provider) {} public void onStatusChanged(String provider, int status, Bundle extras) {} }; Manifest <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.INTERNET"/>

    Read the article

  • Java: Incompatible Types

    - by user2922081
    import java.text.*; import java.util.*; public class Proj3 { public static void main(String[]args){ // DecimalFormat df = new DecimalFormat("#0.00”); Scanner s = new Scanner(System.in); int TotalHours = 0; int TotalGrade = 0; System.out.print("How many courses did you take? "); int Courses = Integer.parseInt(s.nextLine()); System.out.println(""); int CourseNumber = Courses - (Courses - 1); while (Courses > 0){ System.out.print("Course (" + CourseNumber +"): How many hours? "); int Hours = Integer.parseInt(s.nextLine()); TotalHours = TotalHours + Hours; System.out.print("Course (" + CourseNumber +"): Letter grade? "); char Grade = s.nextLine().charAt(0); if (Grade == 'A'){ TotalGrade = TotalGrade + (4 * Hours); } if (Grade == 'B'){ TotalGrade = TotalGrade + (3 * Hours); } if (Grade == 'C'){ TotalGrade = TotalGrade + (2 * Hours); } if (Grade == 'D'){ TotalGrade = TotalGrade + (1 * Hours); } Courses = Courses - 1; CourseNumber = CourseNumber + 1; } Double GPA = TotalGrade / TotalHours; System.out.println(df.format(GPA)); } } This is for an assignment and I don't know how to fix my problem. The Double GPA = TotalGrade / ToutalHours; line is coming up with the Incompatible Types error. Also I'm supposed to include the DecimalFormat df = new DecimalFormat("#0.00”);line at the beginning of the main but its not working. Anything is very helpful. Thanks

    Read the article

  • How to use Geocoder to get the current location zip code

    - by Noble6
    I am trying to get the zip code of the users current location.I have a teditText in MyActivity which should get populated based on the zip code I get from this activity. public class LocationActivity extends MyActivity { double LATITUDE; double LONGITUDE; Geocoder geocoder = new Geocoder(this, Locale.ENGLISH); { try { List<Address> addresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 1); if(addresses != null) { Address returnedZip = addresses.get(0); StringBuilder currentZip = new StringBuilder("Address:\n"); for(int i=0; i<returnedZip.getMaxAddressLineIndex(); i++) { strcurrentZip.append(returnedZip.getPostalCode()); } m_zip.setText(strcurrentZip.toString()); } else { m_zip.setText("No zip returned!"); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); m_zip.setText("zip not found!"); } } } I am not getting any response,the app logcat does not show any errors but the the editText field I want to populate remains blank.

    Read the article

  • Gmail - error adding pop3 account from my mail server (postfix+courier)

    - by Lucas Lobosque
    I use courier to add pop3/imap support to my mail server, and I get this when I try to add a new pop3 account in gmail: Server returned error: "Missing +OK response upon connecting to the server: * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2011 Double Precision, Inc. See COPYING for distribution information." Any help on how to fix this would be appreciated.

    Read the article

  • Prevent Explorer From Expanding Network Folders when in Folders View

    - by Chris
    When you are browsing a network share and there are over 1000 folders in the root (like at work), is there a way to prevent Explorer from expanding all the Folders when you have the "Folders" view enabled? Explorer will open the folder your double clicked on, and show that in the right navigation pane, and it's great, but wait about five seconds and the rest of the folder list pops into view, I'd rather that not happen. There is only one folder I'm interested in (or have access to), and it's annoying waiting for Explorer to load the rest of the files.

    Read the article

  • How to disable “smart quotes” in Windows Live Mail?

    - by Indrek
    Windows Live Mail by default changes straight quotation marks (" and ') to typographic quotation marks, aka "smart quotes" (“, ”, ‘ and ’). This often results in the recipient of the email seeing blank rectangles or other symbols instead of the smart quotes, due to encoding problems. Unlike in most programs, there's doesn't seem to be any built-in option to disable this, and searching online for solutions only leads to workarounds, like hitting Backspace immediately after typing a single or double quote, and switching to "Plain text" mode. Is there any way to disable this behaviour?

    Read the article

  • Save Remote SSL Certificate via Linux Command Line

    - by Jim
    Can you think of any linux command-line method for saving the certificate presented by a HTTPS server? Something along the lines of having curl/wget/openssl make a SSL connection and save the cert rather than the HTTP response content. The gui equivalent to what I'm looking for would be to browse to the HTTPS site, double-click on the browser "secure site" icon, and export the cert. Except the goal here is to do it non-interactively. Thanks, Jim

    Read the article

  • Hijack.StartMenu Malwarebytes Anti-Malware is a false positive?

    - by Senseful
    I just ran the Malwarebytes Anti-Malware quick scan for the first time and it found: Registry Data Items Infected: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Start_ShowSearch (Hijack.StartMenu) - Bad: (0) Good: (1) - No action taken. I just wanted to double check (and provide a top Google result for people in the future that might have the same issue) that this was a false positive and can be safely right-click ignored.

    Read the article

  • Foreign website keeps loading in a tab when I start up Firefox

    - by user31788
    Whenever I double-click on the FF icon to open Firefox, a Chinese website loads up in one of the tabs. Checking my settings for startup homepage (Tools Options) it was set to Google. Can anyone please advise how can I remove the uninvited Chinese website from loading every time I open Firefox? I am using Windows 7 64 bit with Firefox as my default web browser.

    Read the article

  • Outlook 2003: open email in edit mode

    - by Eleasar
    Is there some macro (or C# code) to open an email automatically in edit mode? I know i can double click an email item, go to edit and edit message - but can i do this to automatically open an email in this way? Or even better if i could show emails in edit mode in the reading pane?

    Read the article

  • What is the correct way to setup my virtual hosts in Apache to serve 2 differnt domains?

    - by Michael
    I have a current website on an Apache server (foo.com) and I want the same server to serve a new site (bar.com), is this the correct way to setup my virtual hosts? <VirtualHost *:80 ServerName foo.com ServerAlias www.foo.com Include conf.d/foo.conf </VirtualHost <VirtualHost *:80 ServerName bar.com ServerAlias www.bar.com Include conf.d/bar.conf </VirtualHost I'm hesitant to do an /etc/init.d/httpd reload without someone double checking! :)

    Read the article

  • Problems installing iPhone final 3.2 SDK on OSX

    - by user34475
    I downloaded the latest iPhone SDK (xcode_3.2.2.2_and_iPhone_SDK_3.2_final.dmg) from Apple and uninstalled the old SDK before the install. I double-clicked the .dmg file and got the following pop-ups: The following Disk Images couldn't be found and xcode_3.2.2.2_and_iPhone_SDK_3.2_final.dmg is not recognized I am using OS 10.6.3 How do I solve this?

    Read the article

< Previous Page | 105 106 107 108 109 110 111 112 113 114 115 116  | Next Page >