- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 12
- Posts with Upvotes
- 12
- Upvoting Members
- 7
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
- PC Specs
- AMD @2.9GHz, 40Gig Intel SSD, 21 inch LED LCD Ubuntu Linux 10
77 Posted Topics
Re: You could obscure the strings by changing the value of their characters. | |
![]() | Re: [QUOTE=vincentjohn;1426383]the one that can almost do anything a programmer wants to do with[/QUOTE] Python, because it's high-level, has a fantastic memory manager/recycler, a library that supports most anything anybody can ask of it, and has almost as little restrictions as C++. With Python formatting a programmer can practice coding style … |
The server only does the basics. TODOs: The header method needs expanding. The file send method can't handle too large files. Maybe write custom buffer class since some buffering is done. Keep cache of recent files. | |
Re: [QUOTE][CODE]startTime = time.time() ## I'm not sure how this works, just learned the trick.[/CODE][/QUOTE] This line gets the current system time (a form which doesn't reset to zero). The script calculates the difference between the program start time and the current time. | |
Re: I've read several C++ books in my life, and "C++ in a Nutshell", written by Ray Lischner, is in my opinion by far the most coherent and complete C++ book I've ever read or browsed. On the other hand I've read a lot of good things about Accelerated C++, and … | |
Re: Some thoughts: What are you accomplishing with: [CODE]for i in range(n): open('wpdocs\\file' + str(i) + '.wp', 'wb').close()[/CODE] "f" is your bitstream. This reads up to the end of the stream: [CODE]out_block = f.read(int(carved))[/CODE] Is "path" supposed to be quotated? [CODE] doc_wp = open('path', 'wb')[/CODE] [B]doc_wp[/B] writes to itelf. | |
Re: try [CODE] 1. for(j=0; line[k]!=' '; k++)[/CODE] just a guess | |
Re: Is the body of the function missing? | |
Re: Since you'll be doing a lot of string manipulation, and strings are immutable, I would consider using a list capable of insert. | |
Re: [QUOTE=llianne;1435492]how does the try catch and finally work in a run time program???[/QUOTE] A try/catch/finally block resembles a if/if else/else block in structure, however in functionality it it quite different. The code scoped within the try block attempts to execute, and if an error (exception) is thrown, the stack will … | |
Re: What about Python inspired iteration? [CODE]byte range[] = new byte[5]; for (byte nul : range) { System.out.println("do stuff"); }[/CODE] | |
Re: You should use whitespace. | |
Re: [QUOTE=Jelte12345;1427454]has to write and erase a couple of gigs to the memory every time the program runs[/QUOTE] My solution: Read the file one burst at a time, like 1024 characters. Add 1 to a counter each time you reach a newline character, and also keep track of your position in … | |
Re: It is impossible to sort a dictionary. They aren't ordered. | |
Re: NetBeans is sponsored by Oracle, so I highly recommend it. | |
I'm assuming there's no easier way to do this. Is thread locking really automatic? Am I misreading the documentation? [CODE]from threading import Thread make_thread = lambda fn, *args: Thread(None, fn, None, args).start() def my_fn(*args): for arg in args: print (arg) make_thread(my_fn, "toaster", "ovens") [/CODE] | |
What are some hints or tips on writing efficient functions? I read about converting the code to assembly, and I've also read about the stack and functions. However, I fail to understand how data stored higher can be accessed before the end on a FIFO stack, as any local variable … | |
Re: > Currently the information is stored directly without the [use] of objects. > ArrayList<String> myArr = new ArrayList<String>(); Not true. String is a class. > I also want to know the special use of this ArrayList, in this particular scenario. > Integer vacationIndex = nameLength % myArr.size(); ArrayList is a … | |
Re: [QUOTE=pankaj37marwal;1426463]#include<iostream.h> or #include<conio.h>[/QUOTE] Have you tried removing the ".h"? | |
Re: I started with "Java for Dummies (9 Books in One)". And NetBeans. I love NetBeans. | |
Re: I did a project like this in Java. The goal was to write the entire calculator using the functional programming style. I ran into quite a few problems involving parsing the negative numbers versus minus operators, and ended up adding a bunch of if statements checking for "-" after "e" … | |
Re: Could you cut the code down to 20 or 30 lines? The least amount of code which replicates the problem. Also could you use white space indentation? People tend to respond to posts which are easy on the eyes and short. | |
Re: [QUOTE=mattloto;1426263]Hi, so I finally got around to looking into OOP in c++ and I have a question about classes. So I made this simple class: [CODE]#include <iostream> using namespace std; class Shape { int xPos, yPos; public: Shape(int x, int y) { xPos=x; yPos=y; } } ; int main() { … | |
I read about a coding style where not one variable is changed. Everything must stay constant. I don't remember what it's called, but it's the bomb. I never realized this little project would be [I]so easy[/I]. Here is a 98 line calculator that supports [B]()^*/+-[/B]. If you find a bug, … | |
Re: [QUOTE][CODE]~Card(hearts[1]);//I am not sure if this is even right[/CODE][/QUOTE] It's not. Destructors take no arguments and are called automatically. They should also be virtual whenever the object might be polymorphic. | |
Re: [URL="http://www.cplusplus.com/doc/tutorial/"]http://www.cplusplus.com/doc/tutorial/[/URL] [URL="http://cplus.about.com/od/learning1/ss/cppobjects.htm"]http://cplus.about.com/od/learning1/ss/cppobjects.htm[/URL] [URL="http://www.codersource.net/c/c-tutorials/c-tutorial-class.aspx"]http://www.codersource.net/c/c-tutorials/c-tutorial-class.aspx[/URL] Fetched from: [URL="http://www.google.com/search?q=c%2B%2B+classes"]http://www.google.com/search?q=c%2B%2B+classes[/URL] I also recommend C++ for Dummies [I]then[/I] C++ in a Nutshell (O'Reilly Book) Since you have a lot written I wouldn't start out writing classes. I would break up the functions so that each one does an individual task. Repeating code can be sorted … | |
Re: [URL="http://java.sun.com/javaee/sdk/javaee6sdk_relnotes.jsp"]http://java.sun.com/javaee/sdk/javaee6sdk_relnotes.jsp[/URL] | |
Re: Reading from right to left, cast each char to int then subtract the ASCII value of zero, multiplying by 10 more than the last. Can also be used with float. [CODE]#include <stdio.h> #include <stdlib.h> int main(){ int result = 0; int multiplier = 1; int end = 0; char buffer[512];; … | |
Re: Are you using the proper folder delimiter for your operating system? | |
Re: On a key pressed event, test for and remove the newline character. | |
Re: Gooooooogle got me this [URL="http://bytes.com/topic/c/answers/213647-null-c"]URL[/URL]. [B]\0[/B] is the null terminator to a string. It's sometimes handy with all arrays to have a unique terminator, but usually not possible. | |
Re: Maybe what you're looking for is: [CODE]int* list = new int[Width][Height];[/CODE] | |
Re: Your Public class is public, and therefore in it's own file. [I]Maybe[/I] [URL="http://download.oracle.com/javase/1.5.0/docs/tooldocs/solaris/javac.html"]this[/URL] will help. See especially, [B]Compiling Multiple Source Files[/B]. [QUOTE=Slimmy;1421086]Your constructor is supposed to take two arguments. On line 5 you are not supplying any arguments. Besides that most of your code is also wrong.[/QUOTE] [B]Correct.[/B] | |
Re: Here's a basic example of my input loops: [CODE]for line in iter(lambda: input("Enter something (nothing to quit): "), ""): print (len(line))[/CODE] | |
Re: This works fine for me: [CODE]import random print random.randint(1, 6)[/CODE] | |
Re: The issue happens when you append your Python directory to your default directories. As long as the executable has a different name, per version, there shouldn't be an issue. I know Linux does that but I'm not sure about Windows. | |
Re: It works but is ambiguous to me. Did you get a warning? | |
Re: Like jonsca said, never use gets. It easily overflows. I don't know what your system calls are doing. I also noticed your errors are passing silently. What specific functions aren't being called or aren't running properly? | |
Re: [URL="http://www.codeproject.com/KB/IP/client_server_socket.aspx"]http://www.codeproject.com/KB/IP/client_server_socket.aspx[/URL] | |
Re: I would count it's length, allocate that much memory, reset the pointer, then copy it into that memory. | |
Re: Could you be more specific? How exactly are they going to be combined? Do you mean some form of demodularization? | |
Re: This is from Gooooooooogle. Maybe it will help you get started. [URL="http://download.oracle.com/javase/tutorial/uiswing/components/layeredpane.html"]http://download.oracle.com/javase/tutorial/uiswing/components/layeredpane.html[/URL] | |
Re: Should the function definition have a type? | |
Re: I've been looking for an answer to this question also. | |
These days, it's usually unnecessary to consider how much memory to allocate for a string input. This was mostly for fun. This code allocates memory as the user inputs each key stroke, then allocates and returns a string pointer when the user presses enter. Tell me what you think! [B]USAGE:[/B] … | |
Re: Are you doing [B]wallet = leftPanel.getMoney()[/B]? | |
Re: gcc and g++ are my favorites. I've heard good things about Visual Studio. |
The End.