|
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. |
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!
|
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
|
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?
|
|
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.
|
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).
|
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.
|
Hyrule18969 Posts
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
|
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?
|
Ha wow. Talk about fast and loose, damn.
|
On February 02 2017 02:03 phar wrote: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
|
|
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?
|
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.
|
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.
|
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.
|
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.
|
|
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.
|
|
|
|
|