The Big Programming Thread - Page 323
| 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. | ||
|
Release
United States4397 Posts
| ||
|
Iggyhopper
United States259 Posts
JavaScript- Interactive: http://www.codecademy.com/ Book/Resource: http://eloquentjavascript.net/ | ||
|
HardlyNever
United States1258 Posts
http://jqueryvalidation.org/ I'm having trouble getting it to work on my form. Or anyone recommend another jquery plugin to validate my forms (they don't have to be too robust). | ||
|
Arnstein
Norway3381 Posts
On July 15 2013 15:10 Iggyhopper wrote: NOT w3schools. JavaScript- Interactive: http://www.codecademy.com/ Book/Resource: http://eloquentjavascript.net/ Just wondering, what's wrong with w3schools? | ||
|
Release
United States4397 Posts
| ||
|
tofucake
Hyrule19173 Posts
| ||
|
tec27
United States3702 Posts
| ||
|
Encdalf
Germany66 Posts
On July 15 2013 14:54 Release wrote: What are good books/websites from which to learn html/css/javascript? Webplatform http://www.webplatform.org/ or MDN https://developer.mozilla.org/en-US/docs/Web/HTML https://developer.mozilla.org/en-US/docs/Web/CSS https://developer.mozilla.org/en-US/docs/Web/JavaScript My advice is, to start with learning html structuring and semantics (basics won't take long), add css afterwards and learn how to style the elements, and only when you got the basic knowledge of both, start with javascript. In the beginning you will probably use js to modify the dom and it won't help you if you don't know what you're doing there ![]() On July 17 2013 06:38 Arnstein wrote: Just wondering, what's wrong with w3schools? http://www.w3fools.com/ | ||
|
holdthephone
United States523 Posts
Have a text input file, want to read it into char array, but size of file is variable (could be 8 chars, 64, 512, etc...). How can I accommodate for the right amount of characters, besides simply creating an ultra huge char array? | ||
|
phar
United States1080 Posts
I haven't written C++ in 5 years, so there's probably a better way to do it. | ||
|
Deleted User 101379
4849 Posts
On July 18 2013 10:21 holdthephone wrote: Alright, C++: Have a text input file, want to read it into char array, but size of file is variable (could be 8 chars, 64, 512, etc...). How can I accommodate for the right amount of characters, besides simply creating an ultra huge char array? use stat() to get the size of the file and malloc() or new[] an array of that size.
| ||
|
Pawsom
United States928 Posts
On July 18 2013 10:21 holdthephone wrote: Alright, C++: Have a text input file, want to read it into char array, but size of file is variable (could be 8 chars, 64, 512, etc...). How can I accommodate for the right amount of characters, besides simply creating an ultra huge char array? Vectors if its C++ | ||
|
icystorage
Jollibee19350 Posts
mcc (a regular poster in this thread) helped me step by step and explained that to me perfectly. Really one of the people that helped me during my freshman year. | ||
|
Rotodyne
United States2263 Posts
On July 17 2013 06:30 HardlyNever wrote: Anyone have experience with this JQuery plugin ? http://jqueryvalidation.org/ I'm having trouble getting it to work on my form. Or anyone recommend another jquery plugin to validate my forms (they don't have to be too robust). I have used that one before and it seemed to work well. If you post your code or PM me I could take a look. | ||
|
Deleted User 101379
4849 Posts
On July 18 2013 11:31 icystorage wrote: malloc definitely. mcc (a regular poster in this thread) helped me step by step and explained that to me perfectly. Really one of the people that helped me during my freshman year.malloc() is a C call, C++ uses new/new[]. The difference is that new[] calls the constructor if you initialize an array of a class, so it's better to get used to using the C++ specific operator even for cases where there is no actual difference. | ||
|
Tobberoth
Sweden6375 Posts
This would be my advice as well. You can use new (or malloc though if it's C++ I don't see why you would), but in modern C++, using vectors would probably be considered best practice. | ||
|
nunez
Norway4003 Posts
On July 18 2013 18:09 Tobberoth wrote: This would be my advice as well. You can use new (or malloc though if it's C++ I don't see why you would), but in modern C++, using vectors would probably be considered best practice. use vector! don't use new unless you can't not heap it. if you are also looking to parse the files contents check out boost spirit qi! excellent parser generator (header only) library for cpp. example parsing file into vector of chars... look how cute. #include <fstream> | ||
|
RoyGBiv_13
United States1275 Posts
On July 19 2013 07:40 nunez wrote: use vector! don't use new unless you can't not heap it. if you are also looking to parse the files contents check out boost spirit qi! excellent parser generator library for cpp. example parsing file into vector of chars... look how cute. #include <fstream> A more generic question would be: "how do I keep a variable amount of memory reserved for X purpose". The more generic answer is: "on the heap, on the stack, or within ROM (a file on the file system, typically) [and secret option D, manually defined memory]" You typically don't want to use the stack for unbounded amounts of memory, as it can cause a stack overflow, which could be a security hole. This is typically why you don't have unbounded recursion either. In this case, you are trying to buffer a variable amount of memory in RAM for processing data typically stored in ROM. This would mean you will dynamically request memory from the heap. Boost's Array, std's Vector, and C's malloc library all use heap. Typical OS behaviour states that your heap can continue to grow as long as you have pages left for the kernel to assign, so it is bounded by the amount of RAM on your system. Because the malloc library uses operating system hooks, it does not have (major) security issues like the stack does. Vector and Array are pretty good at heap management, trying to keep your data in a contiguous virtual block if possible, but calling malloc directly also has it's benefits. The keyword "new" is a wrapper around malloc that also calls the constructor for that class. The third option would be to directly process the file in ROM without buffering the entire thing into RAM. This is a strategy used by many of the GNU utilities, as streaming data does not need a variable size buffer. Probably the fastest way, but definitely overkill in most applications. [secret option D is just assigning a pointer to some place in memory, clearing it and using it, but why do this whenever such smart people have already built a malloc library?] | ||
|
nunez
Norway4003 Posts
On July 19 2013 08:08 RoyGBiv_13 wrote: A more generic question would be: "how do I keep a variable amount of memory reserved for X purpose". The more generic answer is: "on the heap, on the stack, or within ROM (a file on the file system, typically) [and secret option D, manually defined memory]" You typically don't want to use the stack for unbounded amounts of memory, as it can cause a stack overflow, which could be a security hole. This is typically why you don't have unbounded recursion either. In this case, you are trying to buffer a variable amount of memory in RAM for processing data typically stored in ROM. This would mean you will dynamically request memory from the heap. Boost's Array, std's Vector, and C's malloc library all use heap. Typical OS behaviour states that your heap can continue to grow as long as you have pages left for the kernel to assign, so it is bounded by the amount of RAM on your system. Because the malloc library uses operating system hooks, it does not have (major) security issues like the stack does. Vector and Array are pretty good at heap management, trying to keep your data in a contiguous virtual block if possible, but calling malloc directly also has it's benefits. The keyword "new" is a wrapper around malloc that also calls the constructor for that class. The third option would be to directly process the file in ROM without buffering the entire thing into RAM. This is a strategy used by many of the GNU utilities, as streaming data does not need a variable size buffer. Probably the fastest way, but definitely overkill in most applications. [secret option D is just assigning a pointer to some place in memory, clearing it and using it, but why do this whenever such smart people have already build a malloc library?] i didn't mean to imply vector does not use heap if you extrapolated that from my post (the vector itself is ofc on the stack), it usually does (does not have to). maybe i should have been more explicit instead of going for a bad pun, he he. rather to use vector instead of new for a dynamically sized array of chars, felt it was a safe bet considering the perceived context. | ||
|
Release
United States4397 Posts
Warning: Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in eclipse for php. I've tried editting the php.ini, using the date_default_timezone_set, and ini_set, but none of these get rid of this error. Any other way to fix this error? | ||
| ||

mcc (a regular poster in this thread) helped me step by step and explained that to me perfectly. Really one of the people that helped me during my freshman year.