• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 22:04
CEST 04:04
KST 11:04
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Serral wins HomeStory Cup 2914Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
Reynor: GSL Loss Wasn't About Preparation Format12[IPSL] Spring 2026 Grand Finals - This Weekend!1Weekly Cups (July 6 - 12): Protoss strike back12BSL Season 22 Full Overview & Conclusion8BSL Season 22 Full Overview & Conclusion8
StarCraft 2
General
Is the larve respawn broken? Weekly Cups (July 6 - 12): Protoss strike back Serral wins HomeStory Cup 29 Yamato Cup Series Interview with an American 16 Year Old Grandmaster
Tourneys
WardiTV Summer Cup 2026 GSL CK #5 Race War RSL Revival: Season 6 - Qualifiers and Main Event HomeStory Cup 29 Vespene Cup #1 — $300+ USD, July 10
Strategy
[G] Having the right mentality to improve
Custom Maps
New Map Maker - Looking for Advice - Love or Hate Work In Progress Melee Maps [D]RTS in all its shapes and glory <3
External Content
The PondCast: SC2 News & Results Mutation # 534 Burning Evacuation Mutation # 533 Die Together Mutation # 532 Nuclear Family
Brood War
General
Pros Debate: Zerg Unfairly Nerfed? (ASL S22 map) screpdb: new Starcraft reporting tool ASL 22 Proposed Map Pool BSL Season 22 Full Overview & Conclusion BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[Megathread] Daily Proleagues [ASL22] Wildcard Qualifier [IPSL] Spring 2026 Grand Finals - This Weekend! IPSL Spring 2026 Top 4!
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers Creating a full chart of Zerg builds Relatively freeroll strategies
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Stormgate/Frost Giant Megathread Path of Exile Summer Games Done Quick 2026!
Dota 2
Looking for a Dota Mentor Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank NeO.D_StephenKing vs This Guy From 1 Million Dance TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread UK Politics Mega-thread Russo-Ukrainian War Thread YouTube Thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club The HerO Fan Club!
Media & Entertainment
Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Movie Discussion! Series you have seen recently...
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Tennis[sport] Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Simple Questions Simple Answers FPS when play League Of Legend on laptop How to clean a TTe Thermaltake keyboard?
TL Community
Northern Ireland Global Starcraft The Automated Ban List
Blogs
Poker (part 2)
Nebuchad
The Experiences We Want and …
TrAiDoS
An Exploration of th…
waywardstrategy
Gauntlet SC2: A Retrospectiv…
Ctone23
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Evil Gacha Games and the…
ffswowsucks
Customize Sidebar...

Website Feedback

Closed Threads



Active: 5883 users

The Big Programming Thread - Page 323

Forum Index > General Forum
Post a Reply
Prev 1 321 322 323 324 325 1032 Next
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
Profile Blog Joined October 2010
United States4397 Posts
July 15 2013 05:54 GMT
#6441
What are good books/websites from which to learn html/css/javascript?
☺
Iggyhopper
Profile Joined July 2010
United States259 Posts
Last Edited: 2013-07-15 06:14:15
July 15 2013 06:10 GMT
#6442
NOT w3schools.

JavaScript-
Interactive: http://www.codecademy.com/
Book/Resource: http://eloquentjavascript.net/
HardlyNever
Profile Blog Joined July 2011
United States1258 Posts
July 16 2013 21:30 GMT
#6443
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).
Out there, the Kid learned to fend for himself. Learned to build. Learned to break.
Arnstein
Profile Blog Joined May 2010
Norway3381 Posts
July 16 2013 21:38 GMT
#6444
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?
rsol in response to the dragoon voice being heard in SCII: dragoon ai reaches new lows: wanders into wrong game
Release
Profile Blog Joined October 2010
United States4397 Posts
July 17 2013 02:44 GMT
#6445
I too am curious why not w3schools?
☺
tofucake
Profile Blog Joined October 2009
Hyrule19228 Posts
July 17 2013 03:11 GMT
#6446
w3schools is kinda completely shit
Liquipediaasante sana squash banana
tec27
Profile Blog Joined June 2004
United States3702 Posts
July 17 2013 06:13 GMT
#6447
We've had this discussion at least like 3 times in this thread already, please search for it instead of starting it again. The reasons haven't changed.
Can you jam with the console cowboys in cyberspace?
Encdalf
Profile Joined February 2012
Germany66 Posts
July 17 2013 09:29 GMT
#6448
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
Profile Blog Joined August 2010
United States523 Posts
Last Edited: 2013-07-18 01:21:45
July 18 2013 01:21 GMT
#6449
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?

phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2013-07-18 01:25:47
July 18 2013 01:25 GMT
#6450
malloc ?

I haven't written C++ in 5 years, so there's probably a better way to do it.
Who after all is today speaking about the destruction of the Armenians?
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
Last Edited: 2013-07-18 01:44:26
July 18 2013 01:40 GMT
#6451
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.


struct stat;
char *data;
int statresult = stat(path_to_file, &stat);

// returns 0 on success, could write !statresult but that looks more misleading
if (statresult == 0)
{
// C++ Version:
data = new char[stat.st_size];

// C Version
data = malloc(stat.st_size);

// read file into data
// don't forget to delete[] (C++) or free() (C) after you are done with data
}

Pawsom
Profile Blog Joined February 2009
United States928 Posts
July 18 2013 01:40 GMT
#6452
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
Profile Blog Joined November 2008
Jollibee19350 Posts
July 18 2013 02:31 GMT
#6453
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.
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
Rotodyne
Profile Blog Joined July 2005
United States2263 Posts
July 18 2013 02:46 GMT
#6454
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.
I can only play starcraft when I am shit canned. IPXZERG is a god.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
July 18 2013 03:06 GMT
#6455
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
Profile Joined August 2010
Sweden6375 Posts
July 18 2013 09:09 GMT
#6456
On July 18 2013 10:40 Pawsom wrote:
Show nested quote +
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++

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
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2013-07-18 22:44:28
July 18 2013 22:40 GMT
#6457
On July 18 2013 18:09 Tobberoth wrote:
Show nested quote +
On July 18 2013 10:40 Pawsom wrote:
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++

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>
#include <vector>
#include <boost/spirit/include/qi.hpp>

namespace spirit = boost::spirit;
namespace qi = boost::spirit::qi;
std::vector<char> data;
qi::parse(spirit::istream_iterator(std::ifstream("input.txt") >> std::noskipws), spirit::istream_iterator(), *qi::char_, data)

conspired against by a confederacy of dunces.
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
Last Edited: 2013-07-18 23:12:33
July 18 2013 23:08 GMT
#6458
On July 19 2013 07:40 nunez wrote:
Show nested quote +
On July 18 2013 18:09 Tobberoth wrote:
On July 18 2013 10:40 Pawsom wrote:
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++

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 library for cpp.

example parsing file into vector of chars... look how cute.

#include <fstream>
#include <vector>
#include <boost/spirit/include/qi.hpp>

namespace spirit = boost::spirit;
namespace qi = boost::spirit::qi;
std::vector<char> data;
qi::parse(spirit::istream_iterator(std::ifstream("input.txt") >> std::noskipws), spirit::istream_iterator(), *qi::char_, data)



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?]
Any sufficiently advanced technology is indistinguishable from magic
nunez
Profile Blog Joined February 2011
Norway4003 Posts
July 18 2013 23:44 GMT
#6459
On July 19 2013 08:08 RoyGBiv_13 wrote:
Show nested quote +
On July 19 2013 07:40 nunez wrote:
On July 18 2013 18:09 Tobberoth wrote:
On July 18 2013 10:40 Pawsom wrote:
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++

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 library for cpp.

example parsing file into vector of chars... look how cute.

#include <fstream>
#include <vector>
#include <boost/spirit/include/qi.hpp>

namespace spirit = boost::spirit;
namespace qi = boost::spirit::qi;
std::vector<char> data;
qi::parse(spirit::istream_iterator(std::ifstream("input.txt") >> std::noskipws), spirit::istream_iterator(), *qi::char_, data)



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.
conspired against by a confederacy of dunces.
Release
Profile Blog Joined October 2010
United States4397 Posts
July 19 2013 00:09 GMT
#6460
I keep getting this error:

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?
☺
Prev 1 321 322 323 324 325 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 6h 56m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ViBE236
NeuroSwarm 228
RuFF_SC2 117
Nina 82
ProTech12
WinterStarcraft5
StarCraft: Brood War
GuemChi 4864
Bale 7
Counter-Strike
summit1g10911
taco 381
minikerr32
Other Games
tarik_tv5482
shahzam594
JimRising 361
C9.Mang0151
Maynarde144
XaKoH 108
LeX0
Organizations
Other Games
gamesdonequick3473
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 13 non-featured ]
StarCraft 2
• davetesta32
• Mapu3
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Scarra1279
Upcoming Events
Replay Cast
6h 56m
CrankTV Team League
8h 56m
Replay Cast
1d 6h
CrankTV Team League
1d 8h
Replay Cast
1d 21h
RSL Revival
2 days
Clem vs Lambo
Scarlett vs Cure
CranKy Ducklings
2 days
IPSL
2 days
Dragon vs Hawk
RSL Revival
3 days
Classic vs Trap
herO vs SHIN
Sparkling Tuna Cup
3 days
[ Show More ]
IPSL
3 days
Bonyth vs Ret
WardiTV Weekly
4 days
Monday Night Weeklies
4 days
PiGosaur Cup
5 days
The PondCast
6 days
Liquipedia Results

Completed

Proleague 2026-07-13
HSC XXIX
Eternal Conflict S2 E2

Ongoing

IPSL Spring 2026
Acropolis #4
CSL 2026 Summer (S21)
KCM Race Survival 2026 Season 3
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
SCTL 2026 Spring
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026

Upcoming

Escore Tournament S3: W3
ASL S22 SEASON OPEN Day 1
Escore Tournament S3: W4
ASL S22 SEASON OPEN Day 2
Escore Tournament S3: W5
CSLAN 4
Blizzard Classic Cup 2026
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
Light Tournament 2026
Eternal Conflict S2 Finale
Eternal Conflict S2 E3
Logitech G Connect 2026
StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.