• What Do You Need Help With? V6
    7,544 replies, posted
[QUOTE=Soleeedus;42612309][URL="http://mui.codeplex.com/"]instead of strangling yourself too much with WPF[/URL][/QUOTE] That UI is very pretty, loved it on Zune.
yeah, it's also used with Office 2013/Visual Studio 2012/new MS software/github windows
I think this is a dynamix binding issue but, c++ I have an interface class with some virtual functions = 0; the header for this class has a static pointer of the class so that its essentially a singleton. in main I do: staticNoisePtr = new NoiseImplementation(); and can use staticNoisePtr just fine, however if I include the relevant header files in a different class and try using staticNoisePtr, it says that its null
-snip- I'm a moron. Might help if I returned the new byte array.
[QUOTE=Richy19;42613854]I think this is a dynamix binding issue but, c++ I have an interface class with some virtual functions = 0; the header for this class has a static pointer of the class so that its essentially a singleton. in main I do: staticNoisePtr = new NoiseImplementation(); and can use staticNoisePtr just fine, however if I include the relevant header files in a different class and try using staticNoisePtr, it says that its null[/QUOTE] The static storage specifier means that each translation unit will get its own variable. You can use extern instead of static and define it in some translation unit.
[QUOTE=ZeekyHBomb;42616894]The static storage specifier means that each translation unit will get its own variable. You can use extern instead of static and define it in some translation unit.[/QUOTE] But the definition wasnt in the class, it was just in the header. IE: I t looked like: [code] #header guard class Noise{...}; static Noise* noise; [/code]
That's what I assumed. Note that it would work if it was declared inside the class. It does not work as expected like that, just as your experienced ;)
Someone recommend me some good sites/books for C# and its libraries please.
[QUOTE=elevate;42623555]Someone recommend me some good sites/books for C# and its libraries please.[/QUOTE] Accelerated C# 2010. Shit's good.
[QUOTE=ZeekyHBomb;42605691]Just a small mistake: the last line should be [i]db[noparse][i][/noparse] = value[/i]. [i]db[index][/i] gets overwritten by the first iteration of the while-loop, which is why you cache it in the variable [i]value[/i]. Also please post the code in code-tags and not as image.[/QUOTE] Actually that wouldn't work because Value only holds key(db[index]) and it's supposed to insert db[index]. Or well, actually it would work, but only for key=lambda x : x... But I managed to solve it this way: [code] def insertion_sort(db, key=lambda x : x): for index in range(1, len(db)): value = db[index] i = index while i > 0 and key(db[i - 1]) > key(value): db[i] = db[i - 1] db[i-1] = value i -= 1 [/code] [editline]24th October 2013[/editline] [QUOTE=uint64;42624253]Accelerated C# 2010. Shit's good.[/QUOTE] Is that book in any way related to Accelerated C++? Because that book was amazing.
I bought Accelerated C++, waiting for it to arrive. I have used a bit of C++ in Source SDK and Polycode but I didn't learn it properly like I did C# so I have a few gaps that need filling.
[QUOTE=karl1k;42625921] Is that book in any way related to Accelerated C++? Because that book was amazing.[/QUOTE] Honestly, no idea.
What GUI library for Java could you recommend me? I took a quick peak into Swing, but there is a certain part of it I don't understand. [CODE] public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { SimpleExample ex = new SimpleExample(); ex.setVisible(true); } }); }[/CODE] I know that it is parsing a new Runnable object to the function, but why is there a body indicated by the curly brackets behind the constructor call? How is it possible, to create a new instance of a class and add a body to override a function? I thought it was only possible by inheriting a base class which had abstract functions?
[QUOTE=marvinelo;42632355]What GUI library for Java could you recommend me? I took a quick peak into Swing, but there is a certain part of it I don't understand. [CODE] public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { SimpleExample ex = new SimpleExample(); ex.setVisible(true); } }); }[/CODE] I know that it is parsing a new Runnable object to the function, but why is there a body indicated by the curly brackets behind the constructor call? How is it possible, to create a new instance of a class and add a body to override a function? I thought it was only possible by inheriting a base class which had abstract functions?[/QUOTE] That's called an anonymous inner class, it has special syntax. [url]http://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html[/url]
[QUOTE=marvinelo;42632355]What GUI library for Java could you recommend me? I took a quick peak into Swing, but there is a certain part of it I don't understand. [CODE] public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { SimpleExample ex = new SimpleExample(); ex.setVisible(true); } }); }[/CODE] I know that it is parsing a new Runnable object to the function, but why is there a body indicated by the curly brackets behind the constructor call? How is it possible, to create a new instance of a class and add a body to override a function? I thought it was only possible by inheriting a base class which had abstract functions?[/QUOTE] It's a Java feature they often use because there are no delegates. [code]new Object() { // class body }[/code] This creates a new anonymous nested class derived from Object. It holds a reference to the outer class which can lead to memory leaks if you aren't careful and e.g. abuse this with {} initializer blocks as property initializers for a return value. [editline]24th October 2013[/editline] Whoops, didn't refresh :v:
So, i'm sure this is some really basic stuff for most of you, but i thought i would bring it here, and get input from the more educated masses. So, in my Programming I class, i'm supposed to be making this: [img]http://i1326.photobucket.com/albums/u654/aaronwhite1786/Program_zpsc2d4e116.jpg[/img] I think i've got the basic math and the core of the program set up, but the alignment and getting the zeros to show are throwing me for a loop. Here's my code. [code] // Major Program I // Aaron White #include <iostream> #include <iomanip> #include <string> #include <fstream> #include "StdAfx.h" using namespace std; int _tmain() { //declare variables double A; double B; double C; double D; double A1; double B1; double C1; double D1; double grandTotal; double saleTotal; double tax; //figure out how many total items will be purchased? cout << "How many PC's do you intend to purchase? "; cin >> A; cout << "And, how many Backup Hard Drives would you like? "; cin >> B; cout << "How many Cameras would you like to add to this order?"; cin >> C; cout << "Finally, we have software bundles for only $49. How many would you like? "; cin >> D; //Set up Math A1 = A * 1498.23; B1 = B * 84.00; C1 = C * 119.00; D1 = D * 49.00; //total math saleTotal = A1 + B1 + C1 + D1; //cout << "Your total before taxes is " << total << endl; tax = saleTotal / 7.65; //cout << "And your taxes come to a total of " <<tax <<endl; grandTotal = tax + saleTotal; //cout << "For a grand total of " <<grandTotal <<endl; //They all work. Now check alignment and setup //set up final sale screen cout << " ********** " <<endl; cout << endl; cout << " NewWave Computers " <<endl; cout << " 123 Main Street " <<endl; cout << "Anywhere, USA" <<endl; cout << "QTY Item Cost" <<endl; cout << A << "NW-PC $" << A1 <<endl; cout << B << "Second Drive $" << B1 <<endl; cout << C << "Camera $" << C1 <<endl; cout << D << "Software Bundle $" << D1 <<endl; cout << " ___________________" <<endl; cout << " Total $" <<saleTotal <<endl; cout << " Tax $" <<tax <<endl; cout << " ____________________" <<endl; cout << " Grand Total $" <<grandTotal <<endl; //pause the screen system ("PAUSE"); return (0); } [/code] I'm sure there are plenty of errors, but i guess i'm more concerned with the alignment, and whatever i seem to be missing on the numbers. I hate them set as float numbers (I think i remember us going over something about setting the float to allow a certain number of decimals to be visible, but i can't remember. I'm going to go back through my book after this.) Anyhow, any tips would be much appreciated, even if it's just a link to go read through. I'll continue searching, and hopefully come back with some answers of my own. Thanks in advance, guys. [editline]24th October 2013[/editline] holy shit, that's a mess to read. Sorry guys :\
To set how many decimals you want it to print you can use: [code] std::cout << std::setprecision(2) [/code] If you want to restore std:cout precision to the old value after you've printed you can use: [code] size_t save_prec = std::cout.precision(); std::cout << std::setprecision(2) << //print something with 2 decimal values std::cout.precision(save_prec) [/code]
[QUOTE=karl1k;42637295]To set how many decimals you want it to print you can use: [code] std::cout << std::setprecision(2) [/code] If you want to restore std:cout precision to the old value after you've printed you can use: [code] size_t save_prec = std::cout.precision(); std::cout << std::setprecision(2) << //print something with 2 decimal values std::cout.precision(save_prec) [/code][/QUOTE] Awesome, thanks a ton! Now to figure out this alignment mess i have going on. Programming I is giving me a nice love/hate relationship with C++. Super interesting when i can figure it out, and i can get stuff to work, infuriating when i can't figure something out. Thanks again!
[QUOTE=JohnStamosFan;42637009] -snip- [/QUOTE] Alright, to get those two fancy zeros to show up at the end of your prices you can use the following functions: std::showpoint [url]http://www.cplusplus.com/reference/ios/showpoint/[/url] <iostream> std::setprecision() [url]http://www.cplusplus.com/reference/iomanip/setprecision/[/url] <iomanip> When using showpoint(), setprecision(2) will affect the amount of numbers to show AFTER the decimal :) Also your variables can be declared as: [CODE] double A, B, C, D; [/CODE] I would suggest naming your variables better such as A -> computersBought, A1 -> computersPrice, ect. Just for readability, up to you of course.
I've made like a register type thing in java using an Array list [code]ArrayList<Member> someStuff = new ArrayList<Member>();[/code] Member class/object whatever you call it has phone number and password. How can I search through the Array list to create a kind of login system to see if what the user inputs exists in the array?
[code]Member entry; for(Member member : someStuff) { if(member.someField == value) { entry = member; break; } } if(entry == null) { //not found }[/code] You could also overwrite the equals-method for member, construct a Member of the info you're searching by and use the ArrayList.contains method, but this is probably not very pretty. You could also use a data-structure that is more fit to that purpose: a kind of [url=http://docs.oracle.com/javase/6/docs/api/java/util/Map.html]Map[/url]. I recommend doing that.
[QUOTE=ZeekyHBomb;42639223][code]Member entry; for(Member member : someStuff) { if(member.someField == value) { entry = member; break; } } if(entry == null) { //not found }[/code] You could also overwrite the equals-method for member, construct a Member of the info you're searching by and use the ArrayList.contains method, but this is probably not very pretty. You could also use a data-structure that is more fit to that purpose: a kind of [url=http://docs.oracle.com/javase/6/docs/api/java/util/Map.html]Map[/url]. I recommend doing that.[/QUOTE] 10/10 regret doing uni course involving software development.
We have been given an assignment in image processing to scan a "galaxy" image and identify the type by the amount of blue stars in it using OpenCV. Im kind of at a loss how to go about this but one thought I had was to convert the BGR image to HSV or HSL and then check using that, does that make sense? Are there any better ways of going about this, im really lost as to how to go about it
I'm working on a mobile application for my University that I inherited from an employee here. I've figured just about everything out about his code and I'm fairly decent (or at least I like to think so) at Objective-C/Java at this point but I cannot for the life of me figure this problem out. We have a map section that lists all of the buildings on campus. But for whatever reason pins aren't being placed in iOS 7 even though they work in iOS 6. The camera still centers on the building that you select, and no errors occur so I know the code itself is working, but for whatever reason it just doesn't want to cooperate. This is the section of the code that places the pins, and subsequent alert message if the user wants more information. [code] - (MKPinAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation{ // Exclude user location if(annotation == mapView.userLocation){ return nil; } static NSString *identifier = @"pin"; AnnotationView *view = (AnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier:identifier]; if(view == nil){ view = [[AnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier]; } return view; } -(void) mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control{ Annotation *annotation = (Annotation *)view.annotation; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:annotation.title message:annotation.description delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alert show]; } [/code]
[QUOTE=JohnStamosFan;42637009]So, i'm sure this is some really basic stuff for most of you, but i thought i would bring it here, and get input from the more educated masses. So, in my Programming I class, i'm supposed to be making this: [img]http://i1326.photobucket.com/albums/u654/aaronwhite1786/Program_zpsc2d4e116.jpg[/img] I think i've got the basic math and the core of the program set up, but the alignment and getting the zeros to show are throwing me for a loop. Here's my code. -code- I'm sure there are plenty of errors, but i guess i'm more concerned with the alignment, and whatever i seem to be missing on the numbers. I hate them set as float numbers (I think i remember us going over something about setting the float to allow a certain number of decimals to be visible, but i can't remember. I'm going to go back through my book after this.) Anyhow, any tips would be much appreciated, even if it's just a link to go read through. I'll continue searching, and hopefully come back with some answers of my own. Thanks in advance, guys. [editline]24th October 2013[/editline] holy shit, that's a mess to read. Sorry guys :\[/QUOTE] use '\t' inside of your strings when dealing with tabs, like this: [code] cout << "\t\t\t\t**********" <<endl; cout << endl; cout << "\t\tNewWave Computers" <<endl; [/code] and since you're new to programming, here's a little explanation just in case: the \ character is an escape character which has multiple functions depending on the character next to it. for instance: \t - tab \n - newline (similar to std::endl) \b - backspace (removes character before it) \0 - null terminator or you can use it to represent certain characters that normally wouldn't be allowed due to the syntax of C/C++ and many other languages: \' - single quote \" - double quote \\ - single backslash (in case you want to use the actual '\' character without making an escape command) [url="http://en.wikipedia.org/wiki/Escape_sequences_in_C"]and there are still more other escape commands.[/url]
And do not use tabs for alignment, because tab-lengths can differ. If you want "automatic" alignment, look at [url=http://en.cppreference.com/w/cpp/io/manip/setw]std::setw[/url].
You all are awesome. Thanks. Now I'm actually thinking I'll make some progress on this thing tonight. Thanks again, guys.
Is there a C++ library for monitoring Audio? I want to do something along the lines of Audiosurf.
[QUOTE=reevezy67;42647637]Is there a C++ library for monitoring Audio? I want to do something along the lines of Audiosurf.[/QUOTE] libBass and fmod
Hey guys. Just a question. What's a good, free IDE for creating GUI Ruby applications for Windows?
Sorry, you need to Log In to post a reply to this thread.