• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 03:22
CEST 09:22
KST 16:22
  • 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
[ASL22] Ro24 Preview: Siren's Call8[ASL22] Ro24 Preview: Summer's End9Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 244ByuL, and the Limitations of Standard Play3
Community News
Stellar Fest TWO the Moon (Dec 16-20)8Weekly Cups (August 24-30): Patches' balance mod takes over2New 3v3 BGH Ladder (and more) on ShieldBattery!40Weekly Cups (August 17-23): Zerg dominate the week6Weekly Cups (August 10-16): SHIN doubles4
StarCraft 2
General
Weekly Cups (August 10-16): SHIN doubles Nexon wins bid to develop StarCraft IP content, distribute Overwatch mobile game SC4ALL II: SC2 Player Announcement 6/8 - Maru Weekly Cups (August 24-30): Patches' balance mod takes over How would you feel about frequent/monthly balance patches for SC2?
Tourneys
IntoTheTV X SOOP SC2 League : Weekly & Monthly SC2 INu's Battles#20 [BO.9] 2026 GSTL Announcement Stellar Fest TWO the Moon (Dec 16-20) PIG STY FESTIVAL 8.0! (13 - 23 August)
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
Mutation # 541 Binary Choice The PondCast: SC2 News & Results Mutation # 540 Dodge This Mutation # 539 Thunder Dome
Brood War
General
ASL22 General Discussion BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ [Personal Project Share] Terran Defense v0.60 XUN appreciation thread
Tourneys
KCM Race Survival 2026 Season 3 [Megathread] Daily Proleagues BSL LAN Party - Kraków 29-30 August - OPEN SIGNUPS [ASL22] Ro24 Group F
Strategy
Replay Review Process - What do you do? Game Theory for Starcraft Odyssey Mineral Stack Saturation Fighting Spirit mining rates
Other Games
General Games
[Maplestory Hardcore] Let's Play~!! General RTS Discussion Thread Stratus: Battle for the sky now on steam Early acc Nintendo Switch Thread Stormgate/Frost Giant Megathread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank TL Mafia Community Thread NeO.D_StephenKing vs This Guy From 1 Million Dance
Community
General
US Politics Mega-thread Paid Marketing Services | Drive Leads & Sales with Things Aren’t Peaceful in Palestine Is a Spice Mill Worth It for Everyday Cooking? Russo-Ukrainian War Thread
Fan Clubs
MarineLorD Fan Club The Creator Fan Club The ShoWTimE Fan Club
Media & Entertainment
Movie Discussion! Anime Discussion Thread
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023 NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Regacy Esports: The Bh…
regacyesports
Violent Games and Crime Rate…
TrAiDoS
LOCKPICKING NOOB
LUCKY_NOOB
Cathedral Of CS And NY pizza a…
FuDDx
Please support my new stand…
Peanutsc
Customize Sidebar...

Website Feedback

Closed Threads



Active: 4803 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
Hyrule19252 Posts
July 17 2013 03:11 GMT
#6446
w3schools is kinda completely shit
Liquipediaasante sana squash banana
tec27
Profile Blog Joined June 2004
United States3707 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
Replay Cast
00:00
2026 GSTL: Main Stage Day 4
Discussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ProTech144
EnDerr 43
StarCraft: Brood War
Rain 1808
sSak 106
Dota 2
NeuroSwarm132
League of Legends
JimRising 562
Counter-Strike
shoxiejesuss345
Super Smash Bros
hungrybox401
Other Games
ceh9418
XaKoH 280
m0e_tv231
Happy210
Livibee116
crisheroes73
[ Show 11 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• Light_VIP 10
• iopq 8
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• WagamamaTV125
Upcoming Events
The PondCast
2h 38m
OSC
15h 8m
IntoTheTV X SOOP
1d 3h
CranKy Ducklings
2 days
Sparkling Tuna Cup
3 days
OSC
3 days
Shopify Rebellion Sundays
3 days
Mixu vs TBD
Spirit vs TBD
Clem vs TBD
Afreeca Starleague
4 days
Soma vs Shuttle
BeSt vs Rush
WardiTV Weekly
4 days
Afreeca Starleague
5 days
Leta vs ggaemo
Jaedong vs Queen
[ Show More ]
GSL
5 days
PiGosaur Cup
5 days
Kung Fu Cup
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2026-09-02
PiG Sty Festival 8.0
Light Tournament 2026

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
ASL Season 22
Super Anchor Qualifying S3
CSL 2026 AUTUMN (S22)
RSL Revival: Season 6
Calamity Invitational
Big Dog Cup 2026 Div 1
BLAST Open Fall 2026
Esports World Cup 2026
Esports World Cup 2026: LCQ
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026

Upcoming

Acropolis #5
Acropolis #5 - TRS
Escore Tournament S3: King of Kings
Blizzard Classic Cup 2026
Acropolis #5 - GSA
Acropolis #5 - GSB
Acropolis #5 - GSC
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
BLAST Rivals Fall 2026
IEM Beijing 2026
Stake Ranked Episode 5
PGL Masters Bucharest 2026
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
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.