• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 10:05
CEST 16:05
KST 23: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
Team TLMC #5 - Finalists & Open Tournaments1[ASL20] Ro16 Preview Pt2: Turbulence10Classic Games #3: Rogue vs Serral at BlizzCon9[ASL20] Ro16 Preview Pt1: Ascent10Maestros of the Game: Week 1/Play-in Preview12
Community News
StarCraft II 5.0.15 PTR Patch Notes149BSL 2025 Warsaw LAN + Legends Showmatch2Weekly Cups (Sept 8-14): herO & MaxPax split cups4WardiTV TL Team Map Contest #5 Tournaments1SC4ALL $6,000 Open LAN in Philadelphia8
StarCraft 2
General
StarCraft II 5.0.15 PTR Patch Notes Why Storm Should NOT Be Nerfed – A Core Part of Pr #1: Maru - Greatest Players of All Time Team TLMC #5 - Finalists & Open Tournaments Team Liquid Map Contest #21 - Presented by Monster Energy
Tourneys
RSL: Revival, a new crowdfunded tournament series Stellar Fest KSL Week 80 StarCraft Evolution League (SC Evo Biweekly) SC2's Safe House 2 - October 18 & 19
Strategy
Custom Maps
External Content
Mutation # 491 Night Drive Mutation # 490 Masters of Midnight Mutation # 489 Bannable Offense Mutation # 488 What Goes Around
Brood War
General
Soulkey on ASL S20 ASL20 General Discussion BW General Discussion Diplomacy, Cosmonarchy Edition ASL TICKET LIVE help! :D
Tourneys
[ASL20] Ro16 Group D BSL 2025 Warsaw LAN + Legends Showmatch [ASL20] Ro16 Group C Small VOD Thread 2.0
Strategy
Simple Questions, Simple Answers Muta micro map competition Fighting Spirit mining rates [G] Mineral Boosting
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile Borderlands 3 General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread
Community
General
The Big Programming Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread UK Politics Mega-thread
Fan Clubs
The Happy Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread
Sports
Formula 1 Discussion 2024 - 2026 Football Thread MLB/Baseball 2023
World Cup 2022
Tech Support
Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s)
TL Community
BarCraft in Tokyo Japan for ASL Season5 Final The Automated Ban List
Blogs
Too Many LANs? Tournament Ov…
TrAiDoS
i'm really bored guys
Peanutsc
I <=> 9
KrillinFromwales
A very expensive lesson on ma…
Garnet
hello world
radishsoup
Lemme tell you a thing o…
JoinTheRain
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1588 users

The Big Programming Thread - Page 833

Forum Index > General Forum
Post a Reply
Prev 1 831 832 833 834 835 1031 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.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
January 30 2017 05:43 GMT
#16641
On January 30 2017 14:14 Nesserev wrote:
Show nested quote +
On January 30 2017 14:05 WarSame wrote:
Could any of you please tell me why I can access the local host version of my server but cannot access it through my external IP? I allowed traffic through the firewall according to this guide.

Seems like the guide doesn't say anything about port forwarding, so I guess that's what you forgot?

Ah, that is a good point. I'll look that up tomorrow, thanks for the heads up!
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
mantequilla
Profile Blog Joined June 2012
Turkey779 Posts
January 30 2017 10:23 GMT
#16642
On January 30 2017 14:43 WarSame wrote:
Show nested quote +
On January 30 2017 14:14 Nesserev wrote:
On January 30 2017 14:05 WarSame wrote:
Could any of you please tell me why I can access the local host version of my server but cannot access it through my external IP? I allowed traffic through the firewall according to this guide.

Seems like the guide doesn't say anything about port forwarding, so I guess that's what you forgot?

Ah, that is a good point. I'll look that up tomorrow, thanks for the heads up!



easier, use ngrok
Age of Mythology forever!
Manit0u
Profile Blog Joined August 2004
Poland17350 Posts
February 01 2017 07:21 GMT
#16643
Handling .dmg file upload to the server.
Have to validate content type.

.dmg mime-type:
OSX - application/x-apple-diskimage
Debian - application/zlib
CentOS - application/octet-stream

WTF?!

How come the same file returns 3 different mime-types?

[image loading]
Time is precious. Waste it wisely.
Manit0u
Profile Blog Joined August 2004
Poland17350 Posts
Last Edited: 2017-02-01 08:47:02
February 01 2017 08:45 GMT
#16644
http://checkyourbackups.work/

https://docs.google.com/document/d/1GCK53YDcBWQveod9kfzW-VCxIABGiryG7_z_6jHdVik/pub
Time is precious. Waste it wisely.
Djagulingu
Profile Blog Joined December 2010
Germany3605 Posts
February 01 2017 08:55 GMT
#16645
On February 01 2017 16:21 Manit0u wrote:
Handling .dmg file upload to the server.
Have to validate content type.

.dmg mime-type:
OSX - application/x-apple-diskimage
Debian - application/zlib
CentOS - application/octet-stream

WTF?!

I had the same shit happening to me with zip files. Ended up not validating over mime type and validated on just file extension instead.
"windows bash is a steaming heap of shit" tofucake
Manit0u
Profile Blog Joined August 2004
Poland17350 Posts
February 01 2017 11:32 GMT
#16646
On February 01 2017 17:55 Djagulingu wrote:
Show nested quote +
On February 01 2017 16:21 Manit0u wrote:
Handling .dmg file upload to the server.
Have to validate content type.

.dmg mime-type:
OSX - application/x-apple-diskimage
Debian - application/zlib
CentOS - application/octet-stream

WTF?!

I had the same shit happening to me with zip files. Ended up not validating over mime type and validated on just file extension instead.


I do both. Thought it would be a nice touch, so that people can't upload fake files (quite important if your server is serving application installers and update files).
Time is precious. Waste it wisely.
Djagulingu
Profile Blog Joined December 2010
Germany3605 Posts
Last Edited: 2017-02-01 12:12:43
February 01 2017 12:12 GMT
#16647
On February 01 2017 20:32 Manit0u wrote:
Show nested quote +
On February 01 2017 17:55 Djagulingu wrote:
On February 01 2017 16:21 Manit0u wrote:
Handling .dmg file upload to the server.
Have to validate content type.

.dmg mime-type:
OSX - application/x-apple-diskimage
Debian - application/zlib
CentOS - application/octet-stream

WTF?!

I had the same shit happening to me with zip files. Ended up not validating over mime type and validated on just file extension instead.


I do both. Thought it would be a nice touch, so that people can't upload fake files (quite important if your server is serving application installers and update files).

I did both too before switching to just checking file extension instead. Too many different mime types possible. Also, if you validate on every single mime type, you can still get fake files. Let's say you validate over all three of them. I remember application/octet-stream definitely from some places. I can just spoof the extension of a file whose mime type is application/octet-stream (application/octet-stream is much more common than you think) and upload that for shits and giggles.
"windows bash is a steaming heap of shit" tofucake
tofucake
Profile Blog Joined October 2009
Hyrule19087 Posts
February 01 2017 14:30 GMT
#16648
I usually do something like an array of allowed file extensions with an array of mime-types allowed per extension, so

[
'dmg' => ['application/x-apple-diskimage', 'application/zlib', 'application/octet-stream']
]


it's worked well for me in the past
Liquipediaasante sana squash banana
Acrofales
Profile Joined August 2010
Spain18055 Posts
February 01 2017 14:41 GMT
#16649
Honestly, octet-stream is the most useless mime-type ever. It is basically a cover-all, and insofar as I know, could be any binary data. So why even bother?
phar
Profile Joined August 2011
United States1080 Posts
February 01 2017 17:03 GMT
#16650
On February 01 2017 17:45 Manit0u wrote:
http://checkyourbackups.work/

https://docs.google.com/document/d/1GCK53YDcBWQveod9kfzW-VCxIABGiryG7_z_6jHdVik/pub

Ha wow. Talk about fast and loose, damn.
Who after all is today speaking about the destruction of the Armenians?
Manit0u
Profile Blog Joined August 2004
Poland17350 Posts
February 02 2017 08:29 GMT
#16651
On February 02 2017 02:03 phar wrote:
Show nested quote +
On February 01 2017 17:45 Manit0u wrote:
http://checkyourbackups.work/

https://docs.google.com/document/d/1GCK53YDcBWQveod9kfzW-VCxIABGiryG7_z_6jHdVik/pub

Ha wow. Talk about fast and loose, damn.


Yeah, GitLab is pretty fucked. They have balls of steel though, doing it all in public and even live streaming their recovery attempts. I feel really bad for them though. Implementing 5 different backup/recovery mechanisms of which none have worked.

Regarding the text editor discussion from a couple pages back:
http://www.viemu.com/a-why-vi-vim.html
Time is precious. Waste it wisely.
Acrofales
Profile Joined August 2010
Spain18055 Posts
February 02 2017 08:40 GMT
#16652
On February 02 2017 17:29 Manit0u wrote:
Show nested quote +
On February 02 2017 02:03 phar wrote:
On February 01 2017 17:45 Manit0u wrote:
http://checkyourbackups.work/

https://docs.google.com/document/d/1GCK53YDcBWQveod9kfzW-VCxIABGiryG7_z_6jHdVik/pub

Ha wow. Talk about fast and loose, damn.


Yeah, GitLab is pretty fucked. They have balls of steel though, doing it all in public and even live streaming their recovery attempts. I feel really bad for them though. Implementing 5 different backup/recovery mechanisms of which none have worked.

Regarding the text editor discussion from a couple pages back:
http://www.viemu.com/a-why-vi-vim.html

They fixed it eventually, but still lost some stuff. Not a great day for them.
https://www.theregister.co.uk/2017/02/02/gitlabcom_has_found_and_restored_from_an_accidental_backup/

That said, I think the way they handled it was quite impressive. No attempt at a cover-up, but full transparency. Neat.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
February 03 2017 02:23 GMT
#16653
a couple C questions


#1.) is there anything wrong with leaving parts of your for loop blank?
for example: for(; x < 7; x++) where x was previously initialized.

#2.) my teachers are making me use underscores instead of camelcase. This is frustrating since they had us use camelcase for a year with java and now they want us to switch. is there a reason or are they just being dicks?
Manit0u
Profile Blog Joined August 2004
Poland17350 Posts
Last Edited: 2017-02-03 02:44:50
February 03 2017 02:37 GMT
#16654
On February 03 2017 11:23 travis wrote:
a couple C questions


#1.) is there anything wrong with leaving parts of your for loop blank?
for example: for(; x < 7; x++) where x was previously initialized.

#2.) my teachers are making me use underscores instead of camelcase. This is frustrating since they had us use camelcase for a year with java and now they want us to switch. is there a reason or are they just being dicks?


Ad. 1. No, you can even do for ( ; ; ) as an infinite loop.
Ad. 2. Different language, different syntax and traditions. Get used to it (in PHP for example most people are using camelCase for functions even though they're case insensitive, which can lead to accidental overwrites). http://stackoverflow.com/questions/1722112/what-are-the-most-common-naming-conventions-in-c

Oh, and please do use OTBS. Makes your life much easier in the long run.
Time is precious. Waste it wisely.
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
February 03 2017 03:20 GMT
#16655
On February 03 2017 11:23 travis wrote:
a couple C questions


#1.) is there anything wrong with leaving parts of your for loop blank?
for example: for(; x < 7; x++) where x was previously initialized.

#2.) my teachers are making me use underscores instead of camelcase. This is frustrating since they had us use camelcase for a year with java and now they want us to switch. is there a reason or are they just being dicks?


You'll see a lot of syntax magic in your C class, but I'd suggest never writing code that way. You'll thank yourself if you read it again in a few months when don't remember what trick did what.

Unless you work at one place for your entire career pretty much every place is going to have a different coding standard. Getting used to reading different syntaxs is good for you. Even if you write the same language like say java everywhere there will be some company that does something stupid like use three spaces for indents.
I'll always be your shadow and veil your eyes from states of ain soph aur.
Cyx.
Profile Joined November 2010
Canada806 Posts
February 03 2017 03:56 GMT
#16656
On February 03 2017 11:23 travis wrote:
#2.) my teachers are making me use underscores instead of camelcase. This is frustrating since they had us use camelcase for a year with java and now they want us to switch. is there a reason or are they just being dicks?

Like others have said... it's basically a 'when in Rome' kinda deal. Different languages have different traditions and styles, and a lot of the time even different projects in the same language will have their own preferred style. Sticking with the style that's already in place is important - it's really jarring to read code that switches styles partway through. So you'll have to get used to it eventually

For what it's worth I really prefer snake_case everywhere except for PascalCase classes... maybe Ruby rubbed off on me too much but I hate camelCase now, it just looks like an abomination. Like seriously, whose idea was it to capitalize everything *except* the first letter of something? Literally backwards from everywhere else in the English language.
netherh
Profile Blog Joined November 2011
United Kingdom333 Posts
February 03 2017 06:42 GMT
#16657
On February 03 2017 12:20 Blitzkrieg0 wrote:
Show nested quote +
On February 03 2017 11:23 travis wrote:
#1.) is there anything wrong with leaving parts of your for loop blank?
for example: for(; x < 7; x++) where x was previously initialized.

You'll see a lot of syntax magic in your C class, but I'd suggest never writing code that way. You'll thank yourself if you read it again in a few months when don't remember what trick did what.


That's not syntax magic. That's super common. Things like this also shouldn't be daunting:


for (int x = 0, y = 2; x < 7 && y < 7; y++, x += 2 )
{
...
}


I'd say there are very few language features you should actively avoid (maybe trigraphs). Just focus on doing things in the simplest way and making it readable (e.g. don't nest 3 ternary operators together).

Even if you avoid for loops with empty statements, other people won't, so you should understand it. Function pointer syntax is much trickier, but you should get used to that too.
Askelad
Profile Joined October 2016
France20 Posts
Last Edited: 2017-02-18 17:52:25
February 03 2017 09:30 GMT
#16658
.
RoomOfMush
Profile Joined March 2015
1296 Posts
February 03 2017 09:40 GMT
#16659
If you are not a good coder C++ is definitely not for you. There are too many traps in the language that you can fall for. A design which would appear like a great idea in a higher level language might give you a lot of headache in C++.
Like with any tool in the world I would say this: Use the right tool for the right circumstance. If you actually need something that C++ gives you then go for C++. If you dont, then dont make yourself suffer for no reason.
Askelad
Profile Joined October 2016
France20 Posts
Last Edited: 2017-02-18 17:51:59
February 03 2017 10:04 GMT
#16660
.
Prev 1 831 832 833 834 835 1031 Next
Please log in or register to reply.
Live Events Refresh
RSL Revival
10:00
Season 2: Playoffs Day 7
Cure vs ZounLIVE!
Crank 1244
Tasteless1194
IndyStarCraft 264
CranKy Ducklings165
Rex158
3DClanTV 61
IntoTheiNu 25
LiquipediaDiscussion
BSL Open LAN 2025 - War…
08:00
Day 1 - Group Stages
ZZZero.O108
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Crank 1244
Tasteless 1194
IndyStarCraft 264
Rex 158
Railgan 27
MindelVK 2
Codebar 0
StarCraft: Brood War
Britney 71931
Calm 5506
Rain 3201
Horang2 2384
EffOrt 1569
GuemChi 1070
Flash 966
BeSt 651
actioN 428
Hyuk 386
[ Show more ]
Larva 299
Hyun 250
firebathero 210
Light 173
Rush 169
Soma 148
ZZZero.O 108
Soulkey 104
hero 83
Sharp 81
Zeus 81
sSak 79
Mong 72
Movie 70
Last 70
Aegong 69
ajuk12(nOOB) 47
soO 40
Nal_rA 37
ivOry 28
Sacsri 17
Terrorterran 10
Hm[arnc] 9
Noble 9
Dota 2
Gorgc4986
singsing3492
qojqva2725
Dendi1171
XcaliburYe384
Fuzer 193
Counter-Strike
shoxiejesuss240
kRYSTAL_8
Heroes of the Storm
Khaldor229
Liquid`Hasu0
Other Games
gofns14927
tarik_tv11431
B2W.Neo1552
FrodaN702
DeMusliM545
crisheroes354
Lowko252
Hui .197
KnowMe146
mouzStarbuck106
TKL 47
NeuroSwarm41
Trikslyr32
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• intothetv
• sooper7s
• Migwel
• AfreecaTV YouTube
• LaughNgamezSOOP
• IndyKCrew
• Kozan
StarCraft: Brood War
• FirePhoenix4
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 3733
• WagamamaTV241
League of Legends
• Nemesis2995
• Jankos1665
• Stunt488
Other Games
• Shiphtur0
Upcoming Events
OSC
6h 55m
BSL Open LAN 2025 - War…
17h 55m
RSL Revival
19h 55m
Classic vs TBD
WardiTV Invitational
20h 55m
Online Event
1d 1h
Wardi Open
1d 20h
Monday Night Weeklies
2 days
Sparkling Tuna Cup
2 days
LiuLi Cup
3 days
The PondCast
4 days
[ Show More ]
CranKy Ducklings
5 days
Maestros of the Game
6 days
Clem vs Reynor
Liquipedia Results

Completed

Proleague 2025-09-10
Chzzk MurlocKing SC1 vs SC2 Cup #2
HCC Europe

Ongoing

BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
LASL Season 20
2025 Chongqing Offline CUP
BSL World Championship of Poland 2025
RSL Revival: Season 2
Maestros of the Game
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1

Upcoming

IPSL Winter 2025-26
BSL Season 21
SC4ALL: Brood War
BSL 21 Team A
Stellar Fest
SC4ALL: StarCraft II
EC S1
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
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 © 2025 TLnet. All Rights Reserved.