Atm all I do is type it into a command prompt, first to compile, a second time to run.
The Big Programming Thread - Page 295
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
cydial
United States750 Posts
Atm all I do is type it into a command prompt, first to compile, a second time to run. | ||
Roe
Canada6002 Posts
On May 07 2013 11:58 cydial wrote: I'm doing basic computer science atm and I'm wondering how people actually get a program to be executed through double clicking it. Atm all I do is type it into a command prompt, first to compile, a second time to run. what language is the program written in? | ||
waxypants
United States479 Posts
What is your environment (mainly talking just about OS here). | ||
obesechicken13
United States10467 Posts
On May 07 2013 12:25 waxypants wrote: What is your environment (mainly talking just about OS here). If it's windows then you can only run .exe's(starcraft) (and other files with default opening methods set up(.docx files)) or .bat(windows batch) files natively. You can probably set up shell scripts(or any other language) to run with double click I think using cygwin but that's more complex. Also .bat files are looked down upon because they're hard to work with. You could have one .bat file that both compiles and runs the compiled file. | ||
cydial
United States750 Posts
I'd like to do it in python (linux) or c++ / c (windows). | ||
JeanLuc
Canada377 Posts
On May 07 2013 13:04 cydial wrote: I'd like to do it in python (linux) or c++ / c (windows). In windows you just double click the exe file and it should run. Create a shortcut for the .exe file or whatever and give it a different picture other than the default. You might need to put in some code that will wait for the user to press a keystroke before exiting (in your console io application) (when you are compiling C program in windows an .exe file will get created. just look for that) | ||
enigmaticcam
United States280 Posts
On May 07 2013 09:20 Craton wrote: How does one go about writing a select statement (PL/SQL) that will accomplish the following: Assume a "lookup" table with a pair of fields "match" and "replace" that have values like: À, A; È, E (such that you have pairs of "accented" characters in the match and "normal" characters in the replace). Assume you have another table with n number of records, any of which have one or more characters matching this pattern. The end translation should go something like ÀNYWHÈRÈ -> ANYWHERE. For a single value, I can use a CONNECT BY LEVEL to split each character into a separate field, join to the lookup table, and then use a MODEL construct to perform the replacement and concatenation of each character (ordering maintained), taking only the final "built" value. However, I can't make it work when I have multiple values (i.e. from a table), since I can't just connect it by level. I feel there might also be a way to skip the CONNECT BY step altogether, but I can't make it happen. Thoughts? I've only had experience with Microsoft T-SQL, and my solution there would be to build a cursor, loop through the multiple values, and process them one at a time. Not sure what would be the PL/SQL equivalent. Instead of processing them one by one, you could even group them together by string length and process all the values that are the same length all at once. | ||
Arnstein
Norway3381 Posts
| ||
DertoQq
France906 Posts
If you want to do that, you can create your own class | ||
Arnstein
Norway3381 Posts
| ||
netherh
United Kingdom333 Posts
On May 07 2013 21:31 Arnstein wrote: Isn't there an easier way to declare a variable that can't get less than zero? I suggest using an int, and just checking to make sure it doesn't go below zero where necessary.
| ||
Tobberoth
Sweden6375 Posts
On May 07 2013 21:31 Arnstein wrote: Isn't there an easier way to declare a variable that can't get less than zero? In object oriented languages, you would probably implement it as a property. Something like: (C#) private int _notbelowzero; | ||
Kambing
United States1176 Posts
On May 07 2013 21:48 Tobberoth wrote: In object oriented languages, you would probably implement it as a property. Something like: (C#) private int _notbelowzero; In a standard OO language (Java, C++) this is the only way to do it. Unsigned in the context of C and C++ is insufficient because it only tells the compiler how to interpret the underlying memory rather than enforce any kind of property about that value. Refinement types allow you to do exactly that (in general, specify an arbitrary predicate over a type) but are not in any mainstream languages. For example, in an extension of F#, the property you want would be ascribed to a variable as follows:
| ||
cydial
United States750 Posts
On May 07 2013 13:30 JeanLuc wrote: In windows you just double click the exe file and it should run. Create a shortcut for the .exe file or whatever and give it a different picture other than the default. You might need to put in some code that will wait for the user to press a keystroke before exiting (in your console io application) (when you are compiling C program in windows an .exe file will get created. just look for that) How would I do it in python? | ||
Rannasha
Netherlands2398 Posts
Create a new shortcut (typically with the menu opened by rightclicking on the desktop) and in the shortcut options, enter "python /path/to/file/nameofyourfile.py". Basically call the 'python' program with the path to your python-file as argument and make a shortcut out of it. | ||
Perscienter
957 Posts
http://cx-freeze.sourceforge.net/ | ||
cydial
United States750 Posts
On May 08 2013 01:31 Rannasha wrote: Create a new shortcut (typically with the menu opened by rightclicking on the desktop) and in the shortcut options, enter "python /path/to/file/nameofyourfile.py". Basically call the 'python' program with the path to your python-file as argument and make a shortcut out of it. Ahh kk hadn't thought of that. | ||
tec27
United States3690 Posts
On May 07 2013 21:18 DertoQq wrote: no, -10 is probably represented by something like that in binary (on 8 bits) : 10001010. The bit on the left represent the negative value. But if you tell the computer it is an unsigned int, the bit on the left will be interpreted as a 'real' number, so : 138 If you want to do that, you can create your own class You have the right idea, but that's not actually how negative numbers are represented, generally. See: http://en.wikipedia.org/wiki/Two's_complement What the actual value will be therefore depends on the size of the int. For 8 bits, the representation of -10 would be: 11110110 (or 246 unsigned). | ||
DertoQq
France906 Posts
On May 08 2013 05:24 tec27 wrote: You have the right idea, but that's not actually how negative numbers are represented, generally. See: http://en.wikipedia.org/wiki/Two's_complement What the actual value will be therefore depends on the size of the int. For 8 bits, the representation of -10 would be: 11110110 (or 246 unsigned). I know, I just though the "sign" method would be easier to explain (and understand) than the two's complement one. | ||
Abductedonut
United States324 Posts
I've been looking for software engineering internships/jobs as I'm almost out of school and I'm royally confused about some of the job requirements these employers have. Most if not all job requirements that I look at for non-huge tech companies often want expertise in a certain language, including internships. Are these requirements bullshit/just there for show? Companies like Microsoft, Amazon, Google, etc etc generally don't list specific language requirements. They'll say experience with C/C++/Java or other object oriented languages which to me, says they want someone who knows both theoretical software engineering as well some practical application of it. I ran into an undergraduate internship positions who wanted Erlang as a language requirement. This is how I figure: if you know how to program in general then you basically know every language (excluding different paradigms, bear with me here). To truly claim to know and understand a language then you must know the dark corners of it, and that takes YEARS of programming experience. Do these companies honestly expect me to have spent years learning Erland - a language I and most people haven't heard of? If they don't, then why the hell even bothering listing it as a requirement? If I know one language I can find my way around it. The same issues pops up with the J2SE and J2EE. I know Java - isn't that enough? I understand J2EE is more for enterprise software but having theoretical experience in distributed systems would be more important than knowing the J2EE dialect of the language, right? Why bother listing it as a requirement? And another thing - why bother listing language requirements at all? They're pointless. Software Engineering is not about programming, it's about the engineering behind the design of software. That's the job I'm applying for, C# just happens to be the tool I use to implement my design. I'm just so lost. | ||
| ||