• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 09:05
CEST 15:05
KST 22:05
  • 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 2911Serral 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 Format10[IPSL] Spring 2026 Grand Finals - This Weekend!1Weekly Cups (July 6 - 12): Protoss strike back6BSL Season 22 Full Overview & Conclusion8BSL Season 22 Full Overview & Conclusion8
StarCraft 2
General
Weekly Cups (July 6 - 12): Protoss strike back Latest hotfix to Patch 5.0.16 Serral wins HomeStory Cup 29 Reynor: GSL Loss Wasn't About Preparation Format Co-op Commander Guide: Kerrigan
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
screpdb: new Starcraft reporting tool Pros Debate: Zerg Unfairly Nerfed? (ASL S22 map) BSL Season 22 Full Overview & Conclusion BGH Auto Balance -> http://bghmmr.eu/ ASL 22 Proposed Map Pool
Tourneys
[ASL22] Wildcard Qualifier [IPSL] Spring 2026 Grand Finals - This Weekend! [Megathread] Daily Proleagues 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
NeO.D_StephenKing vs This Guy From 1 Million Dance TL Mafia Community Thread TL Mafia Power Rank Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread UK Politics Mega-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
The Automated Ban List
Blogs
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: 4879 users

The Big Programming Thread - Page 386

Forum Index > General Forum
Post a Reply
Prev 1 384 385 386 387 388 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.
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
Last Edited: 2013-11-04 20:03:35
November 04 2013 19:57 GMT
#7701
To feanorian,

I saw your question in the IRC some days ago but wasn't online when you sent it.

What you want is:
char * const * c_string_pointer

Why?
My technique for reading declarations in C is the "backwards" rule. I read from right to left, where each type-qualifier,volatile or const modifies the type immediately after it if its a pointer, or before it if its a type. Watch:
char * const * c_string_pointer
C_string_pointer is a pointer to a constant pointer of type char


With arrays and functions, you use the clockwise inside-to-outside rule, it can get very confusing for difficult, long functions or array types.

volatile foo * const * bar[len];

bar is an array of length len of pointers to constant pointers to a volatile foo.

int * volatile bar(char * const foo[])

bar is a volatile pointer to function with one argument, foo, which is an array of constant pointers to char, which returns an int.
Any sufficiently advanced technology is indistinguishable from magic
CorsairHero
Profile Joined December 2008
Canada9491 Posts
November 04 2013 21:34 GMT
#7702
On November 05 2013 04:02 obesechicken13 wrote:
I'm having some problems with a website. Sitegrounds says we are going over the CPU load available for our site. We upgraded and are still going over and sitegrounds is shutting us down.

It's definitely a cron issue rather than a visitors issue. All of the problems occur at 1AM or 2AM. HTTP CPU load is low but Cron CPU usage is high.
[image loading]

These cron job times are wrong. Add one hour for each one. Eg if it says it runs at 4:30, it really runs at 5:30 my time. Timezones.
[image loading]

How do I debug this?
I've looked at the error logs file and there's nothing from this month in it.
Which files should I be looking at?

Run each cron job one at a time and look at cpu usage?

ps -p <PID> -o %cpu,%mem,cmd

Not the most elegant way, but you don't have that many cronjobs
© Current year.
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
Last Edited: 2013-11-05 04:31:20
November 05 2013 04:28 GMT
#7703
On November 05 2013 06:34 CorsairHero wrote:
Show nested quote +
On November 05 2013 04:02 obesechicken13 wrote:
I'm having some problems with a website. Sitegrounds says we are going over the CPU load available for our site. We upgraded and are still going over and sitegrounds is shutting us down.

It's definitely a cron issue rather than a visitors issue. All of the problems occur at 1AM or 2AM. HTTP CPU load is low but Cron CPU usage is high.
[image loading]

These cron job times are wrong. Add one hour for each one. Eg if it says it runs at 4:30, it really runs at 5:30 my time. Timezones.
[image loading]

How do I debug this?
I've looked at the error logs file and there's nothing from this month in it.
Which files should I be looking at?

Run each cron job one at a time and look at cpu usage?

ps -p <PID> -o %cpu,%mem,cmd

Not the most elegant way, but you don't have that many cronjobs

Thought about that but then I noticed I couldn't run ps -p since I'm on a shared server.

I eventually realized there was something wrong with the sitegrounds reporting. Thank you to everyone who took the time to read what I wrote.

Sitegrounds defines CPU time as number of seconds used by a machine in any given hour. By that graph, I used 4.5million seconds of CPU in that one hour. Can't blame them, I'd cancel someone's account too if they were somehow breaking the time continuum to get more internet from me.

Tip('CPU time or CPU usage is the amount of time (in seconds)<br> a computer program uses in processing CPU instructions.<br> No Customer is allowed to use more than 20000 CPU Seconds<br> for any given calendar day. No Customer is allowed to use more<br> than 2000 CPU Seconds for any given hour of the day.<br><br><b>The hourly and daily statistics are being updated<br>each hour')
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
sluggaslamoo
Profile Blog Joined November 2009
Australia4494 Posts
November 05 2013 04:51 GMT
#7704
On November 05 2013 02:26 ObliviousNA wrote:
What's a good OpenGL book? I have a decent background in it, but I want to learn the modern/correct way of doing things.

Considering:
http://www.amazon.com/OpenGL-Programming-Guide-Official-Learning/dp/0321773039/ref=sr_1_1?ie=UTF8&qid=1383584858&sr=8-1&keywords=opengl

http://www.amazon.com/OpenGL-SuperBible-Comprehensive-Reference-ebook/dp/B00E1GL1SO/ref=sr_1_2?ie=UTF8&qid=1383584858&sr=8-2&keywords=opengl

Neither have stellar reviews for their recent versions, which makes me a bit wary. I'm mainly looking for a good description of API and best practices with a refresher on the math.

Also, if someone could speak to the formatting/support for their e-books (with a smaller screen like the nex 7) that would be great!


The red book definitely, you won't find anything as comprehensive online. Also its really big, but you don't have to read it from front to back if you know what it is you need to learn.
Come play Android Netrunner - http://www.teamliquid.net/forum/viewmessage.php?topic_id=409008
Reggiegigas
Profile Joined August 2010
234 Posts
November 05 2013 09:07 GMT
#7705
I have a question. C++.

So I want to have a file with various sections, and under each section, there will be sample names separated by commas.

So what I want to happen is that when a character in my game is born, it will open the file and jump to the relevant section and randomly select a name and apply that to the character object.

How do I do this? I only know the basics of ifstream/ofstream.

I want it to be dynamic so if I manually add names to the sections, the program will still be able to determine by itself how many there are in the section, and then to randomly pick one.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
November 05 2013 09:44 GMT
#7706
--- Nuked ---
Reggiegigas
Profile Joined August 2010
234 Posts
November 05 2013 10:25 GMT
#7707
On November 05 2013 18:44 Nesserev wrote:
Well, it all depends on how you format your file...

For example, if you format your sections like these
SECTIONNAME
name1, name2, name3, etc.

You can use the readline function in a while loop to find the appropriate sectionname,
and then use a readline function again to put all the names in a string, and then use a function to process that string into an array/vector of strings...

There are so many ways to do it...


What I had in mind was something like this


**********
** Human Male region1
**********
name1, name2, name3 (...)

(others...)

**********
** Orc Female region2
**********
name1, name2, name3, name4 (...)

(etc)
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
November 05 2013 11:00 GMT
#7708
--- Nuked ---
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
November 05 2013 13:23 GMT
#7709
Load the whole thing into memory once and keep it there. It's highly unlikely that this file would be so large that memory is an issue.

Ideally you would just use XML, no point in implementing a parser for your own format. You'd have to find a simple C++ xml parser.
Something like this:
<section race="human" gender="male" region="TL">
<name>Reggie</name>
<name>Gigas</name>
(more names)
</section>
(more sections)

If you have a good reason to disagree with the above, please tell me. Thank you.
Manit0u
Profile Blog Joined August 2004
Poland17788 Posts
Last Edited: 2013-11-05 17:06:25
November 05 2013 17:03 GMT
#7710
On November 05 2013 19:25 Reggiegigas wrote:
Show nested quote +
On November 05 2013 18:44 Nesserev wrote:
Well, it all depends on how you format your file...

For example, if you format your sections like these
SECTIONNAME
name1, name2, name3, etc.

You can use the readline function in a while loop to find the appropriate sectionname,
and then use a readline function again to put all the names in a string, and then use a function to process that string into an array/vector of strings...

There are so many ways to do it...


What I had in mind was something like this

Show nested quote +

**********
** Human Male region1
**********
name1, name2, name3 (...)

(others...)

**********
** Orc Female region2
**********
name1, name2, name3, name4 (...)

(etc)


http://www.cplusplus.com/reference/map/map/
http://en.wikipedia.org/wiki/Associative_containers_(C )

Just use a mapping and dump it to file. Best way to store data like that. Not only is it human-readable but also usable by the code.

Example:


typedef map < string, list<string> > map_type;

map_type name_map;
list<string> h_m_name_list;

h_m_name_list.pushback("Joe");
h_m_name_list.pushback("Bill);

name_map["h_male_names"] = h_m_name_list;


You could do it with lists, arrays of strings etc. If you dump it to the file it'll look more or less like that:


h_male_names : ({ "Joe", "Bill" })


You can even nest maps inside of maps if you want (at least you can in other languages, been a while since I did something in C++).
Time is precious. Waste it wisely.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
November 05 2013 17:49 GMT
#7711
I agree, keep a copy of the data in memory. Once you need to actually save this memory to a file you can dump it all in one go.
Mataza
Profile Blog Joined August 2010
Germany5364 Posts
November 06 2013 00:41 GMT
#7712
I need like a starter package on C.
(that is just c, not c++ or c#)

Compiler, do I something like JVM to execute c programs, a resource to learn the commands etc.
I would be ever so grateful if someone could point me in the right direction.

For some reason the editors vim and emacs were recommended to me. Haven't really used either yet, but I don't exactly see the point?

If nobody hates you, you´re doing something wrong. However someone hating you doesn´t make you right
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
November 06 2013 00:52 GMT
#7713
On November 06 2013 09:41 Mataza wrote:
I need like a starter package on C.
(that is just c, not c++ or c#)

Compiler, do I something like JVM to execute c programs, a resource to learn the commands etc.
I would be ever so grateful if someone could point me in the right direction.

For some reason the editors vim and emacs were recommended to me. Haven't really used either yet, but I don't exactly see the point?



C is a minimal language. No need for a virtual machine like the JVM to execute your code in, as it will run directly within your host OS.

For compilers, I recommend using GCC. There are other compilers out there, but GCC is historically the most used. You can find it in the Mingwe (personally preferred) or Cygwin packages for Windows, or if using Linux, it's included by default in 99% of the distros out there.

People recommend vim or emacs as once you've learned them, they are easily the most efficient way to navigate code (arguably for any language). They each were originally built for Linux, but there are ports now for other general purpose operating systems as well such as Windows. I'd guess that what you really want is a familiar development environment to learn an introduction to C. For that, here's a link to my old alma mater's instructions for getting C set up for eclipse on Windows. http://www.rose-hulman.edu/class/csse/resources/Eclipse/eclipse-c-configuration.htm


Any sufficiently advanced technology is indistinguishable from magic
Cyx.
Profile Joined November 2010
Canada806 Posts
November 06 2013 01:43 GMT
#7714
On November 06 2013 09:41 Mataza wrote:
I need like a starter package on C.
(that is just c, not c++ or c#)

Compiler, do I something like JVM to execute c programs, a resource to learn the commands etc.
I would be ever so grateful if someone could point me in the right direction.

For some reason the editors vim and emacs were recommended to me. Haven't really used either yet, but I don't exactly see the point?



Also, as far as editors go, you'll find that having a code browser of some sort with syntax highlighting and all of the other nice things that come with a full IDE is like... REALLY nice for working in C. Sure you can write all your programs in Notepad and compile them with the command line if you feel like... but being able to see typos and things that are just not legal before you even try to compile them is life-saving, and the debugging abilities that IDEs provide you with are also really hard to even imagine working without on anything more than two or three files large.
Zorkmid
Profile Joined November 2008
4410 Posts
November 06 2013 03:46 GMT
#7715
A lot of people that I've talked to say that IDEs are a bad way to learn a language for just that very reason.
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
November 06 2013 04:24 GMT
#7716
Right tools for the right job...
If you're handling just one .c file and one .h file, a full on IDE is going to confuse you more than help. Notepad++ does code highlighting and a single command in your terminal can run the program without having to learn how to create a new project, manage a makefile, add dependencies, etc...
For writing C, I do so in an editor that is pretty close to notepad.

That being said, a good debugger is worth learning, and using gdb on the command-line is not ideal.

If you think about it, most of your time writing code is spent navigating the code, reading what it does. Nothing has more information about the code than a debugger during run-time. Static analysis will only take you so far in a weakly typed language like C.
Any sufficiently advanced technology is indistinguishable from magic
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
November 06 2013 04:42 GMT
#7717
--- Nuked ---
AsmodeusXI
Profile Blog Joined July 2007
United States15536 Posts
November 06 2013 15:31 GMT
#7718
Question for the wizards in here: does anyone have any recommendations for a JavaScript library/framework for games development? I'm interested in doing game creation in HTML5 and there are a LOT of options out there, so I'm looking for some opinions.
WriterTL > RL. BNet: Asmodeus#1187 - LoL: DJForeclosure - Steam: asmodeusxi | www.n3rddimension.com
Cyx.
Profile Joined November 2010
Canada806 Posts
November 06 2013 19:17 GMT
#7719
On November 06 2013 12:46 Zorkmid wrote:
A lot of people that I've talked to say that IDEs are a bad way to learn a language for just that very reason.


And this is why we don't post without fully reading what we're responding to. 0o

don't listen to me, I was responding mostly to the 'why should I use an editor' rather than the 'what tools should I get to learn c' =/
Zorkmid
Profile Joined November 2008
4410 Posts
Last Edited: 2013-11-06 21:03:43
November 06 2013 21:03 GMT
#7720
On November 07 2013 04:17 Cyx. wrote:
Show nested quote +
On November 06 2013 12:46 Zorkmid wrote:
A lot of people that I've talked to say that IDEs are a bad way to learn a language for just that very reason.


And this is why we don't post without fully reading what we're responding to. 0o

don't listen to me, I was responding mostly to the 'why should I use an editor' rather than the 'what tools should I get to learn c' =/


I wasn't really responding to anything you said, just giving one point of view on IDEs as a learning tool. No need for the saltyness.
Prev 1 384 385 386 387 388 1032 Next
Please log in or register to reply.
Live Events Refresh
Kung Fu Cup
11:00
2026 Week 15
IntoTheiNu 806
RotterdaM535
WardiTV493
Ryung 259
TKL 255
SteadfastSC157
IndyStarCraft 131
Rex119
CosmosSc2 5
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 535
Ryung 259
TKL 255
SteadfastSC 157
IndyStarCraft 131
Rex 119
ProTech102
CosmosSc2 5
StarCraft: Brood War
Calm 4877
Rain 1977
Shuttle 1967
Sea 1807
Bisu 1647
Jaedong 1423
Horang2 606
Mini 488
Soma 359
Light 331
[ Show more ]
firebathero 280
EffOrt 249
Soulkey 239
actioN 234
sorry 222
Stork 210
Snow 170
Last 160
ggaemo 141
Mong 131
Zeus 103
Killer 101
hero 95
ZergMaN 63
Free 54
Pusan 52
Rush 52
ZerO 48
Hyun 46
JYJ 41
soO 36
Movie 36
ToSsGirL 30
910 28
Aegong 27
scan(afreeca) 25
Noble 19
Barracks 17
GoRush 13
Terrorterran 12
Sacsri 12
Sexy 11
Icarus 9
zelot 8
Rock 4
Dota 2
Gorgc6573
Dendi506
syndereN118
XcaliburYe21
League of Legends
Doublelift2664
Counter-Strike
edward485
byalli359
Other Games
singsing1145
B2W.Neo569
hiko472
Lowko337
Pyrionflax194
DeMusliM144
Liquid`VortiX143
Livibee80
KnowMe72
ZerO(Twitch)19
XaKoH 8
Organizations
Other Games
gamesdonequick2737
BasetradeTV193
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 12 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos2758
• TFBlade651
Upcoming Events
Replay Cast
19h 55m
CrankTV Team League
21h 55m
Replay Cast
1d 19h
CrankTV Team League
1d 21h
Replay Cast
2 days
RSL Revival
2 days
Clem vs Lambo
Scarlett vs Cure
CranKy Ducklings
2 days
IPSL
3 days
Dragon vs Hawk
RSL Revival
3 days
Classic vs Trap
herO vs SHIN
Sparkling Tuna Cup
3 days
[ Show More ]
IPSL
4 days
Bonyth vs Ret
WardiTV Weekly
4 days
Monday Night Weeklies
5 days
PiGosaur Cup
6 days
The PondCast
6 days
Liquipedia Results

Completed

YSL S3
HSC XXIX
Eternal Conflict S2 E2

Ongoing

IPSL Spring 2026
Acropolis #4
CSL 2026 Summer (S21)
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...

Disclosure: This page contains affiliate marketing links that support TLnet.

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.