• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 17:24
CEST 23:24
KST 06:24
  • 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
[ASL21] Ro8 Preview Pt2: Progenitors5Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists22
Community News
RSL Revival: Season 5 - Qualifiers and Main Event10Code S Season 1 (2026) - RO12 Results12026 GSL Season 1 Qualifiers25Maestros of the Game 2 announced92026 GSL Tour plans announced15
StarCraft 2
General
Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Code S Season 1 (2026) - RO12 Results Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun Team Liquid Map Contest #22 - The Finalists MaNa leaves Team Liquid
Tourneys
StarCraft Evolution League (SC Evo Biweekly) 2026 GSL Season 2 Qualifiers Sparkling Tuna Cup - Weekly Open Tournament $1,400 SEL Season 3 Ladder Invitational RSL Revival: Season 5 - Qualifiers and Main Event
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
[ASL21] Ro8 Preview Pt2: Progenitors ASL21 General Discussion Why there arent any 256x256 pro maps? BW General Discussion BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[ASL21] Ro8 Day 3 [Megathread] Daily Proleagues [ASL21] Ro8 Day 2 Escore Tournament StarCraft Season 2
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Stormgate/Frost Giant Megathread OutLive 25 (RTS Game) Daigo vs Menard Best of 10 Dawn of War IV Nintendo Switch Thread
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread European Politico-economics QA Mega-thread 3D technology/software discussion Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion McBoner: A hockey love story
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Movie Stars In Video Games: …
TrAiDoS
ramps on octagon
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1194 users

The Big Programming Thread - Page 73

Forum Index > General Forum
Post a Reply
Prev 1 71 72 73 74 75 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.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
August 02 2011 11:55 GMT
#1441
On August 02 2011 20:51 Rhyze wrote:
I guess it was a stupid question :D and i didn't write the script, a real employee did :D and i work for the government ^^


Well, in my experience, 99% of the programmers shouldn't ever touch any code again because they just don't have any clue, so it's not suprising for me to see horrible code, even in government code from full time programmers :p
Kahzaar
Profile Joined October 2010
Sweden897 Posts
August 02 2011 20:53 GMT
#1442
Hey everyone, I've been trying to do a simple imageslider in jquery but I can't get it to work. I'm not sure how to make to write the .attr-part. The .jpg gives me an error and I'm not sure how to write it. Any clues?
+ Show Spoiler +
<script type="text/javascript">
var PicNumber = 1;
$(window).load(function () {
$("imageActive").attr("src",PicNumber".jpg");
});

$(nextPic).click(function () {
PicNumber+=1;
});

$(prevPic).click(function () {
PicNumber-=1;
});
</script>
disco
Profile Blog Joined June 2009
Netherlands1667 Posts
August 02 2011 21:01 GMT
#1443
This should work:
+ Show Spoiler +

<script type="text/javascript">
var PicNumber = 1;
$(window).load(function () {
$("imageActive").attr("src",PicNumber+".jpg");
});

$(nextPic).click(function () {
PicNumber+=1;
});

$(prevPic).click(function () {
PicNumber-=1;
});
</script>
this game is a fucking jokie
Kahzaar
Profile Joined October 2010
Sweden897 Posts
August 02 2011 23:56 GMT
#1444
On August 03 2011 06:01 disco wrote:
This should work:
+ Show Spoiler +

<script type="text/javascript">
var PicNumber = 1;
$(window).load(function () {
$("imageActive").attr("src",PicNumber+".jpg");
});

$(nextPic).click(function () {
PicNumber+=1;
});

$(prevPic).click(function () {
PicNumber-=1;
});
</script>

thanks, had to change some other smalls things too, but now it's working
disco
Profile Blog Joined June 2009
Netherlands1667 Posts
August 03 2011 07:35 GMT
#1445
On August 03 2011 08:56 Kahzaar wrote:
Show nested quote +
On August 03 2011 06:01 disco wrote:
This should work:
+ Show Spoiler +

<script type="text/javascript">
var PicNumber = 1;
$(window).load(function () {
$("imageActive").attr("src",PicNumber+".jpg");
});

$(nextPic).click(function () {
PicNumber+=1;
});

$(prevPic).click(function () {
PicNumber-=1;
});
</script>

thanks, had to change some other smalls things too, but now it's working


No problem, I didn't really pay attention to anything other than the missing "+" for the filename.
this game is a fucking jokie
haduken
Profile Blog Joined April 2003
Australia8267 Posts
Last Edited: 2011-08-03 09:42:36
August 03 2011 09:41 GMT
#1446
nvm
Rillanon.au
mmp
Profile Blog Joined April 2009
United States2130 Posts
August 07 2011 08:52 GMT
#1447
On August 01 2011 11:12 EvanED wrote:
Show nested quote +
On July 31 2011 19:29 Frigo wrote:
I seriously recommend against touching any kind of scripting, functional, procedural or esoteric language without having a proper knowledge of Java or C++. You will learn nothing useful.

I vehemently disagree with this, for reasons I've stated above. (Just the negative part -- that you won't learn anything useful. Depending on your interest, Java or C++ might be a reasonable starting language.)

I've got a substantial portion of the "best" CS schools on my side too. US News gives the top 10 as MIT (#1), CMU (#2), Stanford and UIUC (#3-tie), Cal Berkeley (#5), Georgia Tech (#6), UT Austin (#7), Michigan (#8), Cal Tech (#9) and Cornell (#10).

Of those: MIT used to use Scheme and now uses Python in their intro class, CMU uses SML, Stanford uses Java, UIUC uses Java for what seems to be the primary first in-major class (there's another intro class that uses Python, but I'm not sure how it fits in), Cal Berkeley seems to emphasize Scheme though it's not at the complete exclusion of everything else, Georgia Tech uses Python, UT Austin uses Java, Michigan uses ??? (I actually can't find a course webpage, and the description doesn't say; there's a chance it uses C++. If you have better luck than me, the course is EECS 280), Caltech uses Python, Cornell uses Java.

Discounting Michigan, counting UIUC as Java, and counting Berkeley as Scheme, the counts are 4 schools for Java, 3 schools for Python, 1 school for Scheme, and one school for SML. Even if Michigan came into the picture with Java, that's still half of the US News top 10 schools which teach a language you accuse of teaching "nothing useful."

Now, the pressures are very different for a university deciding how to set its curriculum and an individual deciding what to learn, but I think that "you won't learn anything from a high-level language" is complete bogus.

Show nested quote +
On July 31 2011 19:50 KaiserJohan wrote: I would do either that or C. C is also less complex than C++, there is less chance of getting lost early. Its easier to find C++ resources though, and you can just reuse C code in C++...


Well, that's sort of true, but at the same time IMO a good C programmer does not necessarily make a good C++ programmer (though it is likely). You'll have to unlearn a fair bit of stuff for that.


Python is a great first language in my opinion. It's easy to pick up, gets shit done fast, and can take you very far. A real Swiss-Army-Knife language.

MIT's intro EECS class used to be an adventure in Scheme programming and everyone loved it because the assignments were flexible and allowed for a lot of creativity; now it's a well-rounded EE+CS mediocre bore (no CS bias from me: nobody likes it!). The AI class also moved from Scheme to Python, but I think this was a good decision (some of that Scheme code was pretty gross).
I (λ (foo) (and (<3 foo) ( T_T foo) (RAGE foo) )) Starcraft
Badboyrune
Profile Blog Joined May 2010
Sweden2247 Posts
August 09 2011 09:17 GMT
#1448
If you're interested in starting doing some programming for Android/iPhone is the best way to go about it to first learn basic java and then learn how to implement it into Android/iPhone apps, or start out with app programming right away?
"If yellow does start SC2, I should start handsomenerd diaper busniess and become a rich man" - John the Translator
Soier
Profile Joined August 2010
Denmark28 Posts
August 09 2011 11:58 GMT
#1449
For Android:
Since you need basic java to program for Android I would recomend getting the java skills before you start with your app. If you know basic java and use Eclipse with the Android dev kit you are well equiped på produce and test android apps.

Dont know much about iPhnoe programming, as far as I know you need to know about objective-C++ witch is a harder language to learn than java. Furthermore if you want you iPhone app on the market you have to jump allot of hoops and even pay for a lisence, so if you are just starting out I would recoment programming for Android.

Can PM me if you have further questions
Play more
Badboyrune
Profile Blog Joined May 2010
Sweden2247 Posts
August 09 2011 16:55 GMT
#1450
On August 09 2011 20:58 Soier wrote:
For Android:
Since you need basic java to program for Android I would recomend getting the java skills before you start with your app. If you know basic java and use Eclipse with the Android dev kit you are well equiped på produce and test android apps.

Dont know much about iPhnoe programming, as far as I know you need to know about objective-C++ witch is a harder language to learn than java. Furthermore if you want you iPhone app on the market you have to jump allot of hoops and even pay for a lisence, so if you are just starting out I would recoment programming for Android.

Can PM me if you have further questions


Thanks a bunch! More or less as I suspected then, time to look up some java guides.

Not a big Apple guy so iPhone programming was never the main idea. Still it might be worth the trouble in the future, in which case I'll pick you up on your offer to help. Actually I might do that anyway if I remember if, or rather when, i run into trouble :p

Thanks again!
"If yellow does start SC2, I should start handsomenerd diaper busniess and become a rich man" - John the Translator
Emperor_Earth
Profile Blog Joined April 2009
United States824 Posts
August 09 2011 19:12 GMT
#1451
I'm starting a really big site. If anyone is interested in contributing to something meaningful and to be proud of, send me a pm. You may be able to help.

If I had to guess right now, PHP, MySql, jQuery, CSS2/3, standard LAMP setup basically.

Debating on: PostgreSQL vs MySQL
Ruby (probably on Rails) vs Java vs PHP
@Emperor_Earth ------- "Amat Victoria Curam."
ibutoss
Profile Blog Joined June 2005
Australia341 Posts
August 13 2011 01:33 GMT
#1452
On August 02 2011 20:55 Morfildur wrote:
Show nested quote +
On August 02 2011 20:51 Rhyze wrote:
I guess it was a stupid question :D and i didn't write the script, a real employee did :D and i work for the government ^^


Well, in my experience, 99% of the programmers shouldn't ever touch any code again because they just don't have any clue, so it's not suprising for me to see horrible code, even in government code from full time programmers :p


I believe the problem with this sentiment among programmers is that everyone else's code is always going to be crap compared to the ideal solution. When you work in industry it's more than likely the programmer wanted extra time to complete X, but management said no we have a deadline, do the bare minimum. So when you look at someone else's horrible code perhaps keep in mind that you don't know the full circumstances of how it came about. (That said I agree, it probably was just bad code from someone with no clue. haha)

I've seen this happen time and time again. It takes a complete culture shift to actually work quality into software projects.
Nada got Yooned
Abductedonut
Profile Blog Joined December 2010
United States324 Posts
August 14 2011 03:00 GMT
#1453
Anyone know a simple way to safely use the gets() function in stdio.h?
fabiano
Profile Blog Joined August 2009
Brazil4644 Posts
August 14 2011 03:04 GMT
#1454
On August 14 2011 12:00 Abductedonut wrote:
Anyone know a simple way to safely use the gets() function in stdio.h?


What do you mean? o.O
"When the geyser died, a probe came out" - SirJolt
Frigo
Profile Joined August 2009
Hungary1023 Posts
August 14 2011 04:23 GMT
#1455
Sorry man, gets is inherently unsafe and vulnerable to buffer overflow attacks. Use something else, especially if it is C++.
http://www.fimfiction.net/user/Treasure_Chest
Abductedonut
Profile Blog Joined December 2010
United States324 Posts
August 14 2011 05:06 GMT
#1456
On August 14 2011 12:04 fabiano wrote:
Show nested quote +
On August 14 2011 12:00 Abductedonut wrote:
Anyone know a simple way to safely use the gets() function in stdio.h?


What do you mean? o.O


Yeah, the gets() function in the C standard library is completely vulnerable to buffer overflows, which is basically what a hacker can use to take control of the computer.

On August 14 2011 13:23 Frigo wrote:
Sorry man, gets is inherently unsafe and vulnerable to buffer overflow attacks. Use something else, especially if it is C++.


Well, getline is C++ so I can't use it in C. I've found a solution using fgets() but that's sortof cheating since it's not gets(). There's also the issue that the rest of the string is still in stdin, which is kindaof a hassle to deal with, but whatever. Here's what i mean: ( and fabiano, i compiled using gets() the first time, the warning is there for you as well )

+ Show Spoiler +
[image loading]


If anyone can think of another solution using actual gets(), please let me know! I'm actually curious.
Frigo
Profile Joined August 2009
Hungary1023 Posts
August 14 2011 05:49 GMT
#1457
No sorry, the compiler is quite right about warning you, it simply can't be made safe. You need to know in advance whether the line fits in your buffer, and that is simply not possible with the standard input, only with files.

Why is it so important anyway, isn't fgets enough? It's not that difficult to write a function that behaves like std::vector in the sense that it automatically grows the buffer when you need to insert more data.
http://www.fimfiction.net/user/Treasure_Chest
EvanED
Profile Joined October 2009
United States111 Posts
Last Edited: 2011-08-14 23:15:10
August 14 2011 23:08 GMT
#1458
On August 14 2011 14:06 Abductedonut wrote:If anyone can think of another solution using actual gets(), please let me know! I'm actually curious.

Really the only way that I can think of that has a chance of working is something like the following:
// global or file static:
jmp_buf from_fgets;

void return_to_past_gets(int ign) {
(void) ign;
longjmp(from_fgets, 1);
}

// Where you want to call fgets
struct sigaction old_handler;
char * buf;
int ret;
if (setjmp(&from_fgets) == 0) {
// Set up memory. 'buf' will point to 4096 bytes, then a guard page
buf = mmap(NULL, 4096*2, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (buf == NULL) goto err_mmap;
ret = mprotect(buf + 4096, 1, PROT_NONE);
if (ret != 0) goto err_mprotect;

// set up a handler for SIGSEGV, which will be
struct sigaction new_handler;
new_handler.sa_handler = return_to_past_gets;
ret = sigemptyset (&new_action.sa_mask);
if (ret != 0) goto err_sigemptyset;
new_action.sa_flags = 0;
ret = sigaction(SIGSEGV, &new_action, &old_action);
if (ret != 0) goto err_sigaction_new

// call fgets
fgets(buf);
}
else {
// fgets overflowed.
ret = ungetc(buf[4095], stdin);
if (ret != 0) goto err_ungetc
buf[4095] = 0;
}
ret = sigaction(SIGSEGV, &old_action, NULL);
if (ret != 0) goto err_sigaction_restore

// YOU implement err_mmap, err_mprotect, err_ungetc, err_sigemptyset,
// err_sigaction_new, and err_sigaction_restore

// Oh, and don't forget to
unmmap(buf, 4096*2);
// instead of free(buf)


There. A (*)safe way of calling fgets. Except that I'm not sure that mmap is guaranteed to return something on a page boundary, pages aren't guaranteed to be 4096 bytes, MAP_ANONYMOUS isn't POSIX, I didn't take into account wanting anything other than an entire page, fgets is probably not guaranteed to write into its buffer sequentially... and if that's not enough, you risk leaving the internals of libc in an inconsistent state because fgets didn't get a chance to return cleanly.

Doesn't that sound worth not saying
fgets(buf, size, stdin);

? :-)


Edit:
On August 14 2011 14:49 Frigo wrote:
No sorry, the compiler is quite right about warning you, it simply can't be made safe. You need to know in advance whether the line fits in your buffer, and that is simply not possible with the standard input, only with files.

This is a bit of a red herring, which can be demonstrated two ways. First, calling fgets(buf, size, stdin) works fine, and is just like calling gets(buf) except that if it reads more than size bytes, it will stop early. (There's a difference in how it handles the trailing newline if it doesn't stop early, as well.) It's not like fgets is imbued with psychic powers to see what's coming up in the stream, it just makes a "best-effort" attempt to fit it in the given buffer. The second way you can see this is calling fgets on an actual file -- it doesn't figure out that the current line is too long to fit into the buffer and does nothing, it again makes that best-effort attempt.

(And as a third way: just because the runtime thinks something is a file doesn't mean it is -- it could be a device node, a fifo, etc. -- and doesn't mean it can seek randomly.)
Craton
Profile Blog Joined December 2009
United States17281 Posts
August 17 2011 23:14 GMT
#1459
I have an interview coming up. What would be some good areas to brush up on beforehand? The job is primarily C#.NET and VB.NET in both client-side applications and ASP.NET.

Finished B.S. in May.
twitch.tv/cratonz
TheRageKage12
Profile Joined November 2010
United States161 Posts
August 17 2011 23:24 GMT
#1460
On August 18 2011 08:14 Craton wrote:
I have an interview coming up. What would be some good areas to brush up on beforehand? The job is primarily C#.NET and VB.NET in both client-side applications and ASP.NET.

Finished B.S. in May.


Know the syntax and basic semantics of all those languages (derp) and be able to write out programs on a whiteboard in them. Also review all your algorithms (sorting, DFS, BFS, etc.) and data structures with their inherent strengths and weaknesses (for example, hash tables have O(1) lookup time but are rather large in memory).
Prev 1 71 72 73 74 75 1032 Next
Please log in or register to reply.
Live Events Refresh
Monday Night Weeklies
16:00
#50
RotterdaM905
TKL 287
SteadfastSC181
IndyStarCraft 155
BRAT_OK 153
ZombieGrub96
EnkiAlexander 46
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 905
TKL 287
SteadfastSC 181
IndyStarCraft 155
BRAT_OK 153
ZombieGrub96
StarCraft: Brood War
Calm 3067
Mini 360
ggaemo 221
NaDa 5
Dota 2
monkeys_forever508
League of Legends
JimRising 397
Counter-Strike
pashabiceps2052
Super Smash Bros
Mew2King97
PPMD67
Heroes of the Storm
Liquid`Hasu416
Other Games
summit1g4670
Grubby4657
Liquid`RaSZi1335
FrodaN1148
Beastyqt930
shahzam569
C9.Mang0312
mouzStarbuck171
ArmadaUGS142
UpATreeSC78
NightEnD10
Organizations
Other Games
BasetradeTV464
Dota 2
PGL Dota 2 - Main Stream48
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 15 non-featured ]
StarCraft 2
• mYiSmile115
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Eskiya23 7
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• imaqtpie2158
Other Games
• Shiphtur354
• WagamamaTV332
Upcoming Events
Replay Cast
2h 37m
Sparkling Tuna Cup
12h 37m
Afreeca Starleague
12h 37m
Snow vs Flash
WardiTV Invitational
13h 37m
SHIN vs Nicoract
Solar vs Nice
PiGosaur Cup
1d 2h
GSL
1d 12h
Classic vs Cure
Maru vs Rogue
GSL
2 days
SHIN vs Zoun
ByuN vs herO
OSC
2 days
OSC
2 days
Replay Cast
3 days
[ Show More ]
Escore
3 days
The PondCast
3 days
WardiTV Invitational
3 days
Zoun vs Ryung
Lambo vs ShoWTimE
OSC
4 days
Replay Cast
4 days
CranKy Ducklings
4 days
RSL Revival
4 days
SHIN vs Bunny
ByuN vs Shameless
WardiTV Invitational
4 days
Krystianer vs TriGGeR
Cure vs Rogue
uThermal 2v2 Circuit
4 days
BSL
4 days
Replay Cast
5 days
Sparkling Tuna Cup
5 days
RSL Revival
5 days
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
5 days
BSL
5 days
GSL
6 days
Afreeca Starleague
6 days
Liquipedia Results

Completed

Proleague 2026-05-02
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026

Upcoming

YSL S3
Escore Tournament S2: W6
KK 2v2 League Season 1
BSL 22 Non-Korean Championship
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
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.